You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

994 lines
31 KiB

  1. <template>
  2. <div class="mod-config">
  3. <div>
  4. <span @click="favoriteFunction()">
  5. <icon-svg :name="favorite?'xiangqufill':'xiangqu'" class="sl-svg" ></icon-svg>
  6. </span>
  7. </div>
  8. <el-form :inline="true" :model="querySysLanguagePack" @keyup.enter.native="getDataList()">
  9. <el-form-item :label="inputLabel.headerInput.label1">
  10. <el-input style="width: 100px;" v-model="queryHeaderData.wareHouseId" ></el-input>
  11. </el-form-item>
  12. <el-form-item :label="inputLabel.headerInput.label2">
  13. <el-input style="width: 100px;" v-model="queryHeaderData.wareHouseName" ></el-input>
  14. </el-form-item>
  15. <el-form-item :label="inputLabel.headerInput.label4">
  16. <el-select v-model="queryHeaderData.active" placeholder="请选择" style="width: 100px;">
  17. <el-option label="全部" value=""></el-option>
  18. <el-option
  19. v-for="item in selectList.select1"
  20. :key="item.value"
  21. :label="item.label"
  22. :value="item.value">
  23. </el-option>
  24. </el-select>
  25. </el-form-item>
  26. <el-form-item>
  27. <el-button @click="getDataList('Y')" type="primary">{{buttons.search}}</el-button>
  28. </el-form-item>
  29. <el-form-item>
  30. <el-button @click="initModel()" type="primary">{{buttons.add}}</el-button>
  31. <el-button @click="saveColumnList()" type="primary" v-show="showDefault">{{buttons.defaultTable}}
  32. </el-button>
  33. <el-button @click="userSetting" type="primary">{{ buttons.settingTable}}</el-button>
  34. <download-excel
  35. :fields="fields()"
  36. :data="exportData"
  37. type="xls"
  38. :name="exportName"
  39. :header="exportHeader"
  40. :footer="exportFooter"
  41. :defaultValue="exportDefaultValue"
  42. :fetch="createExportData"
  43. :before-generate="startDownload"
  44. :before-finish="finishDownload"
  45. worksheet="导出信息"
  46. class="el-button el-button--primary el-button--medium">
  47. {{buttons.download}}
  48. </download-excel>
  49. <el-button v-if="isAuth(':prd:delete')" type="danger" @click="deleteHandle()"
  50. :disabled="dataListSelections.length <= 0">{{ buttons.deleteList}}
  51. </el-button>
  52. </el-form-item>
  53. </el-form>
  54. <el-table
  55. id="commmon"
  56. :height="height"
  57. :data="dataList"
  58. border
  59. v-loading="dataListLoading"
  60. @selection-change="selectionChangeHandle"
  61. style="width: 100%;">
  62. <el-table-column
  63. v-for="(item,index) in columnList" :key="index"
  64. :sortable="item.columnSortable"
  65. :prop="item.columnProp"
  66. :header-align="item.headerAlign"
  67. :show-overflow-tooltip="item.showOverflowTooltip"
  68. :align="item.align"
  69. :fixed="item.fixed"
  70. :width="item.columnWidth"
  71. :label="item.columnLabel">
  72. <template slot-scope="scope">
  73. <span v-if="!item.columnHidden"> {{scope.row[item.columnProp]}}</span>
  74. <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]"
  75. style="width: 100px; height: 80px"/></span>
  76. </template>
  77. </el-table-column>
  78. <el-table-column
  79. fixed="right"
  80. header-align="center"
  81. align="center"
  82. width="90"
  83. :label="buttons.cz">
  84. <template slot-scope="scope">
  85. <a @click="initModel(scope.row)">{{buttons.edit}}</a>
  86. <a @click="delHeaderData(scope.row)">{{buttons.delete}}</a>
  87. </template>
  88. </el-table-column>
  89. </el-table>
  90. <column v-if="visible" ref="column" @refreshData="getTableUserColumn"></column>
  91. <el-dialog :close-on-click-modal="false" :close-on-press-escape="false" v-drag :title="inputLabel.headerInput.label5" :visible.sync="setUp.reviewFlag" width="325px">
  92. <el-form :inline="true" label-position="top">
  93. <el-form-item :label="inputLabel.headerInput.label1">
  94. <el-input style="width: 130px;" :readonly = "setUp.readonlyFlag" onkeyup="this.value = this.value.toUpperCase()" v-model="saveHeaderData.wareHouseId"></el-input>
  95. </el-form-item>
  96. <el-form-item :label="inputLabel.headerInput.label2">
  97. <el-input style="width: 130px;" v-model="saveHeaderData.wareHouseName"></el-input>
  98. </el-form-item>
  99. </el-form>
  100. <el-form :inline="true" label-position="top">
  101. <el-form-item :label="inputLabel.headerInput.label3">
  102. <el-select v-model="saveHeaderData.wareHouseTypeDb" placeholder="请选择" style="width: 130px;">
  103. <el-option
  104. v-for="item in selectList.select2"
  105. :key="item.value"
  106. :label="item.label"
  107. :value="item.value">
  108. </el-option>
  109. </el-select>
  110. </el-form-item>
  111. <el-form-item :label="inputLabel.headerInput.label4">
  112. <el-select v-model="saveHeaderData.active" placeholder="请选择" style="width: 130px;">
  113. <el-option
  114. v-for="item in selectList.select1"
  115. :key="item.value"
  116. :label="item.label"
  117. :value="item.value">
  118. </el-option>
  119. </el-select>
  120. </el-form-item>
  121. </el-form>
  122. <span slot="footer" class="dialog-footer">
  123. <el-button @click="setUp.reviewFlag = false">取消</el-button>
  124. <el-button type="primary" :disabled="setUp.saveButton" @click="saveHeaderFunction()">确定</el-button>
  125. </span>
  126. </el-dialog>
  127. </div>
  128. </template>
  129. <script>
  130. import column from "../common/column";
  131. import {
  132. searchSysLanguagePackList,
  133. searchSysLanguageParam,
  134. searchFunctionButtonList,
  135. saveButtonList,
  136. searchSysLanguage,
  137. searchLanguageListByLanguageCode,
  138. saveSysLanguageOne
  139. } from "@/api/sysLanguage.js"
  140. import getLodop from '@/utils/LodopFuncs.js'
  141. import {
  142. saveTableDefaultList,
  143. saveTableUser,
  144. getTableDefaultListLanguage,
  145. getTableUserListLanguage
  146. } from "@/api/table.js"
  147. import {
  148. userFavoriteList,
  149. saveUserFavorite,
  150. removeUserFavorite,
  151. } from '@/api/userFavorite.js'
  152. import {
  153. getWarehouseList,
  154. saveWarehouse,
  155. delWarehouse,
  156. getWareHouseTypeList,
  157. } from '@/api/warehouse/warehouse.js'
  158. export default {
  159. components: {
  160. column
  161. },
  162. data() {
  163. return {
  164. saveHeaderData :{
  165. id : 0,
  166. wareHouseId : '',
  167. wareHouseName : '',
  168. wareHouseType : '',
  169. active : '',
  170. wareHouseTypeDb : '',
  171. },
  172. queryHeaderData : {
  173. site : this.$store.state.user.site,
  174. wareHouseId : '',
  175. wareHouseName : '',
  176. wareHouseType : '',
  177. active : '',
  178. },
  179. setUp: {
  180. reviewFlag: false,
  181. saveButton: false,
  182. reviewFlag1 : false,
  183. readonlyFlag : false,
  184. },
  185. inputLabel :{
  186. headerInput : {
  187. label1 : '仓库编码',
  188. label2 : '仓库名称',
  189. label3 : '库位类型',
  190. label4 : '使用状态',
  191. label5 : '库房信息',
  192. },
  193. },
  194. selectList: {
  195. select1: [{
  196. value: 'Y',
  197. label: '启用'
  198. }, {
  199. value: 'N',
  200. label: '禁用'
  201. }],
  202. select2: [],
  203. },
  204. site : this.$store.state.user.site,
  205. userName : this.$store.state.user.name,
  206. // table高度
  207. height:450,
  208. // 是否收藏
  209. favorite: false,
  210. addLanguage: false,
  211. functionId: 2501,
  212. tableId: "wareHouse2501",
  213. value1: true,
  214. visible: false,
  215. showDefault: false,
  216. // 默认table 查询参数
  217. queryTable: {
  218. functionId: 2501,
  219. tableId: "wareHouse2501",
  220. languageCode: this.$i18n.locale
  221. },
  222. // 用户table 查询参数
  223. queryTableUser: {
  224. userId: this.$store.state.user.name,
  225. functionId: 2501,
  226. tableId: "wareHouse2501",
  227. status: true,
  228. languageCode: this.$i18n.locale
  229. },
  230. // 语言词典查询参数
  231. querySysLanguageParam: {
  232. languageCode: this.$i18n.locale
  233. },
  234. // 语言词典集合
  235. sysLanguageParams: [],
  236. // 用户table 配置集合
  237. userColumnList: [],
  238. // 展示列集
  239. columnList: [
  240. {
  241. userId: this.$store.state.user.name,
  242. functionId: 2501,
  243. serialNumber: 'wareHouse2501WareHouseId',
  244. tableId: "wareHouse2501",
  245. tableName: "wareHouseTable",
  246. columnProp: "wareHouseId",
  247. headerAlign: "center",
  248. align: "center",
  249. columnLabel: "仓库编码",
  250. columnHidden: false,
  251. columnImage: false,
  252. columnSortable: false,
  253. sortLv: 0,
  254. status: true,
  255. fixed: false,
  256. columnWidth : 100,
  257. },
  258. {
  259. userId: this.$store.state.user.name,
  260. functionId: 2501,
  261. serialNumber: 'wareHouse2501WareHouseName',
  262. tableId: "wareHouse2501",
  263. tableName: "wareHouseTable",
  264. columnProp: "wareHouseName",
  265. headerAlign: "center",
  266. align: "center",
  267. columnLabel: "仓库名称",
  268. columnHidden: false,
  269. columnImage: false,
  270. columnSortable: false,
  271. sortLv: 0,
  272. status: true,
  273. fixed: false,
  274. },
  275. {
  276. userId: this.$store.state.user.name,
  277. functionId: 2501,
  278. serialNumber: 'wareHouse2501WareHouseType',
  279. tableId: "wareHouse2501",
  280. tableName: "wareHouseTable",
  281. columnProp: "wareHouseTypeDb",
  282. headerAlign: "center",
  283. align: "center",
  284. columnLabel: "库房编码",
  285. columnHidden: false,
  286. columnImage: false,
  287. columnSortable: false,
  288. sortLv: 0,
  289. status: true,
  290. fixed: false,
  291. },
  292. {
  293. userId: this.$store.state.user.name,
  294. functionId: 2501,
  295. serialNumber: 'wareHouse2501WareHouseTypeDb',
  296. tableId: "wareHouse2501",
  297. tableName: "wareHouseTable",
  298. columnProp: "wareHouseType",
  299. headerAlign: "center",
  300. align: "center",
  301. columnLabel: "库房类型",
  302. columnHidden: false,
  303. columnImage: false,
  304. columnSortable: false,
  305. sortLv: 0,
  306. status: true,
  307. fixed: false,
  308. },
  309. /* {
  310. userId: this.$store.state.user.name,
  311. functionId: 2501,
  312. serialNumber: 'wareHouse2501Keeper',
  313. tableId: "wareHouse2501",
  314. tableName: "wareHouseTable",
  315. columnProp: "keeper",
  316. headerAlign: "center",
  317. align: "center",
  318. columnLabel: "管理人",
  319. columnHidden: false,
  320. columnImage: false,
  321. columnSortable: false,
  322. sortLv: 0,
  323. status: true,
  324. fixed: false,
  325. },
  326. {
  327. userId: this.$store.state.user.name,
  328. functionId: 2501,
  329. serialNumber: 'wareHouse2501CompanyId',
  330. tableId: "wareHouse2501",
  331. tableName: "wareHouseTable",
  332. columnProp: "companyId",
  333. headerAlign: "center",
  334. align: "center",
  335. columnLabel: "公司编码",
  336. columnHidden: false,
  337. columnImage: false,
  338. columnSortable: false,
  339. sortLv: 0,
  340. status: true,
  341. fixed: false,
  342. },*/
  343. {
  344. userId: this.$store.state.user.name,
  345. functionId: 2501,
  346. serialNumber: 'wareHouse2501StrActive',
  347. tableId: "wareHouse2501",
  348. tableName: "wareHouseTable",
  349. columnProp: "strActive",
  350. headerAlign: "center",
  351. align: "center",
  352. columnLabel: "状态",
  353. columnHidden: false,
  354. columnImage: false,
  355. columnSortable: false,
  356. sortLv: 0,
  357. status: true,
  358. fixed: false,
  359. },
  360. ],
  361. // 展示列集
  362. columnList1: [
  363. // {
  364. // userId: this.$store.state.user.name,
  365. // functionId: 2501,
  366. // tableId: "common1002",
  367. // tableName: "commonLanguage",
  368. // columnProp: "functionId",
  369. // headerAlign: "center",
  370. // align: "center",
  371. // columnLabel: "功能编码",
  372. // columnHidden: false,
  373. // columnImage: false,
  374. // columnSortable: false,
  375. // sortLv: 0,
  376. // status: true,
  377. // fixed: false
  378. // },
  379. // {
  380. // userId: this.$store.state.user.name,
  381. // functionId: 2501,
  382. // tableId: "common1002",
  383. // tableName: "commonLanguage",
  384. // columnProp: "objectId",
  385. // headerAlign: "center",
  386. // align: "center",
  387. // columnLabel: "序列化编码",
  388. // columnHidden: false,
  389. // columnImage: false,
  390. // columnSortable: false,
  391. // sortLv: 0,
  392. // status: true,
  393. // fixed: false,
  394. // },
  395. // {
  396. // userId: this.$store.state.user.name,
  397. // functionId: 2501,
  398. // tableId: "common1002",
  399. // tableName: "commonLanguage",
  400. // columnProp: "objectType",
  401. // headerAlign: "center",
  402. // align: "center",
  403. // columnLabel: "类型",
  404. // columnHidden: false,
  405. // columnImage: false,
  406. // columnSortable: false,
  407. // sortLv: 0,
  408. // status: true,
  409. // fixed: false,
  410. // },
  411. // {
  412. // userId: this.$store.state.user.name,
  413. // functionId: 2501,
  414. // tableId: "common1002",
  415. // tableName: "commonLanguage",
  416. // columnProp: "languageValue",
  417. // headerAlign: "center",
  418. // align: "center",
  419. // columnLabel: "语言值",
  420. // columnHidden: false,
  421. // columnImage: false,
  422. // columnSortable: false,
  423. // sortLv: 0,
  424. // status: true,
  425. // fixed: false,
  426. // },
  427. // {
  428. // userId: this.$store.state.user.name,
  429. // functionId: 2501,
  430. // tableId: "common1002",
  431. // tableName: "commonLanguage",
  432. // columnProp: "languageCode",
  433. // headerAlign: "center",
  434. // align: "center",
  435. // columnLabel: "语言编码",
  436. // columnHidden: false,
  437. // columnImage: false,
  438. // columnSortable: false,
  439. // sortLv: 0,
  440. // status: true,
  441. // fixed: false,
  442. // }
  443. ],
  444. // 数据集
  445. dataList: [],
  446. queryButton: {
  447. functionId: 2501,
  448. table_id: 'wareHouse2501',
  449. languageCode: this.$i18n.locale,
  450. objectType: 'button'
  451. },
  452. buttons: {
  453. add: '新增',
  454. edit: '编辑',
  455. delete: '删除',
  456. deleteList: '批量删除',
  457. cz: '操作',
  458. search: '查询',
  459. download: '导出',
  460. settingTable: '设置列表',
  461. defaultTable: '设置默认配置'
  462. },
  463. // 导出 start
  464. exportData: [],
  465. exportName: "页面功能语言",
  466. exportHeader: ["页面功能语言"],
  467. exportFooter: [],
  468. exportDefaultValue: "这一行这一列没有数据",
  469. // 导出 end
  470. buttonList: [
  471. {
  472. functionId: "2501",
  473. languageValue: '添加',
  474. objectId: 'add',
  475. objectType: "button",
  476. tableId: "wareHouse2501"
  477. },
  478. {
  479. functionId: "2501",
  480. languageValue: '编辑',
  481. objectId: 'edit',
  482. objectType: "button",
  483. tableId: "wareHouse2501"
  484. },
  485. {
  486. functionId: "2501",
  487. languageValue: '删除',
  488. objectId: 'delete',
  489. objectType: "button",
  490. tableId: "wareHouse2501"
  491. },
  492. // {
  493. // functionId: "2501",
  494. // languageValue: '批量删除',
  495. // objectId: 'deleteList',
  496. // objectType: "button",
  497. // tableId: "wareHouse2501"
  498. // },
  499. {
  500. functionId: "2501",
  501. languageValue: '操作',
  502. objectId: 'cz',
  503. objectType: "button",
  504. tableId: "wareHouse2501"
  505. },
  506. {
  507. functionId: "2501",
  508. languageValue: '查询',
  509. objectId: 'search',
  510. objectType: "button",
  511. tableId: "wareHouse2501"
  512. },
  513. {
  514. functionId: "2501",
  515. languageValue: '导出',
  516. objectId: 'download',
  517. objectType: "button",
  518. tableId: "wareHouse2501"
  519. },
  520. {
  521. functionId: "2501",
  522. languageValue: '设置列表',
  523. objectId: 'settingTable',
  524. objectType: "button",
  525. tableId: "wareHouse2501"
  526. },
  527. {
  528. functionId: "2501",
  529. languageValue: '设置默认配置',
  530. objectId: 'defaultTable',
  531. objectType: "button",
  532. tableId: "wareHouse2501"
  533. }
  534. ],
  535. languageList: [],
  536. languageColumnList: [],
  537. languageDataList: [],
  538. queryLanguage: {},
  539. // 数据集条件
  540. querySysLanguagePack: {
  541. functionId: '',
  542. page: 1,
  543. limit: 1,
  544. languageValue: '',
  545. objectType: '',
  546. objectId: ''
  547. },
  548. // 分页
  549. pageIndex: 1,
  550. pageSize: 20,
  551. totalPage: 0,
  552. dataListLoading: false,
  553. dataListSelections: [],
  554. addOrUpdateVisible: false
  555. }
  556. },
  557. mounted() {
  558. this.$nextTick(()=>{
  559. this.height = window.innerHeight - 170;
  560. })
  561. },
  562. activated() {
  563. this.getTblBaseList()
  564. this.getDataList()
  565. this.getLanguageList()
  566. },
  567. methods: {
  568. getTblBaseList(){
  569. let jsonDate = {
  570. site : this.site,
  571. type : 'WareHouseType'
  572. }
  573. this.selectList.select2 = []
  574. getWareHouseTypeList(jsonDate).then(({data}) =>{
  575. let list = data.list
  576. this.selectList.select2 = list.map(item =>{
  577. let resultData = {
  578. value: item.baseData,
  579. label : item.baseDesc,
  580. }
  581. return resultData
  582. })
  583. })
  584. },
  585. delHeaderData(row){
  586. this.$confirm(`确定删除该仓库及库位?`, '操作提示', {
  587. confirmButtonText: '确定',
  588. cancelButtonText: '取消',
  589. type: 'warning'
  590. }).then(() => {
  591. let jsonData ={
  592. site : row.site,
  593. wareHouseId : row.wareHouseId,
  594. }
  595. delWarehouse(jsonData).then(({data}) =>{
  596. if(data.code == 0){
  597. this.$message.success(data.msg)
  598. this.getDataList()
  599. }else {
  600. this.$alert(data.msg, '操作提示', {
  601. confirmButtonText: '确定',
  602. callback: action => {
  603. }
  604. });
  605. }
  606. })
  607. })
  608. },
  609. saveHeaderFunction(){
  610. this.setUp.saveButton = true
  611. if(this.saveHeaderData.wareHouseId == ''){
  612. this.$alert("请输入库房编码!", '操作提示', {
  613. confirmButtonText: '确定',
  614. callback: action => {
  615. this.setUp.saveButton = false
  616. }
  617. });
  618. return
  619. }else if(this.saveHeaderData.wareHouseName == ''){
  620. this.$alert("请输入库房名称!", '操作提示', {
  621. confirmButtonText: '确定',
  622. callback: action => {
  623. this.setUp.saveButton = false
  624. }
  625. });
  626. return
  627. }else if(this.saveHeaderData.wareHouseTypeDb == ''){
  628. this.$alert("请选择库位类型!", '操作提示', {
  629. confirmButtonText: '确定',
  630. callback: action => {
  631. this.setUp.saveButton = false
  632. }
  633. });
  634. return
  635. }
  636. for (let i = 0; i < this.selectList.select2.length; i++) {
  637. if(this.selectList.select2[i].value == this.saveHeaderData.wareHouseTypeDb){
  638. this.saveHeaderData.wareHouseType = this.selectList.select2[i].label
  639. }
  640. }
  641. saveWarehouse(this.saveHeaderData).then(({data}) =>{
  642. this.setUp.saveButton = false
  643. if(data.code == 0){
  644. this.$message.success(data.msg)
  645. this.getDataList()
  646. this.setUp.reviewFlag = false
  647. }else {
  648. this.$alert(data.msg, '操作提示', {
  649. confirmButtonText: '确定',
  650. callback: action => {
  651. }
  652. });
  653. }
  654. })
  655. },
  656. initModel(row){
  657. this.setUp.reviewFlag = true
  658. this.setUp.saveButton = false
  659. this.setUp.readonlyFlag = false
  660. this.saveHeaderData.id = 0
  661. this.saveHeaderData.site = this.site
  662. this.saveHeaderData.wareHouseId = ''
  663. this.saveHeaderData.wareHouseName = ''
  664. this.saveHeaderData.wareHouseType = ''
  665. this.saveHeaderData.wareHouseTypeDb = ''
  666. this.saveHeaderData.active = 'Y'
  667. this.saveHeaderData.useLocation = 'Y'
  668. this.saveHeaderData.validStock = 'Y'
  669. this.saveHeaderData.keeper = ''
  670. this.saveHeaderData.companyId = ''
  671. if(row != null){
  672. this.setUp.readonlyFlag = true
  673. this.saveHeaderData.id = 1
  674. this.saveHeaderData.wareHouseId = row.wareHouseId
  675. this.saveHeaderData.wareHouseName = row.wareHouseName
  676. this.saveHeaderData.wareHouseType = row.wareHouseType
  677. this.saveHeaderData.wareHouseTypeDb = row.wareHouseTypeDb
  678. this.saveHeaderData.active = row.active
  679. }
  680. },
  681. // 打印方式
  682. printReport(){
  683. alert( this.$store.state.user.site)
  684. //
  685. // const LODOP = getLodop()
  686. // if (LODOP) {
  687. // var strBodyStyle = '<style>'
  688. // strBodyStyle += 'table { border-top: 1 solid #000000; border-left: 1 solid #000000; border-collapse:collapse; border-spacing:0;}'
  689. // strBodyStyle += 'caption { line-height:2em; }'
  690. // strBodyStyle += 'td { border-right: 1 solid #000000; border-bottom: 1 solid #000000; text-align:center; padding:2px 3px; font-size:11px;}'
  691. // strBodyStyle += '</style>' //设置打印样式
  692. // var strFormHtml = strBodyStyle + '<body>' + document.getElementById('commmon').innerHTML + '</body>' //获取打印内容
  693. //
  694. // LODOP.PRINT_INIT('') //初始化
  695. // LODOP.PRINT_DESIGN();
  696. // //LODOP.PREVIEW();
  697. // //LODOP.PRINT();
  698. //
  699. // LODOP.SET_PRINT_PAGESIZE(2, 0, 0, 'A4') //设置横向
  700. // LODOP.ADD_PRINT_HTM('1%', '1%', '98%', '98%', strFormHtml) //设置打印内容
  701. // LODOP.SET_PREVIEW_WINDOW(2, 0, 0, 800, 600, '') //设置预览窗口模式和大小
  702. // LODOP.PREVIEW()
  703. // }
  704. },
  705. // 校验用户是否收藏
  706. favoriteIsOk(){
  707. let userFavorite ={
  708. userId:this.$store.state.user.id,
  709. languageCode:this.$i18n.locale
  710. }
  711. userFavoriteList(userFavorite).then(({data}) =>{
  712. let size = data.list.filter(item => item.userId==userFavorite.menuId).length;
  713. if (size>0){
  714. this.favorite = true
  715. }else {
  716. this.favorite = false
  717. }
  718. })
  719. },
  720. // 收藏 OR 取消收藏
  721. favoriteFunction(){
  722. let userFavorite ={
  723. userId: this.$store.state.user.id,
  724. functionId: this.$route.meta.menuId,
  725. }
  726. if (this.favorite){
  727. // 取消收藏
  728. this.$confirm(`确定取消收藏`, '提示', {
  729. confirmButtonText: '确定',
  730. cancelButtonText: '取消',
  731. type: 'warning'
  732. }).then(() => {
  733. removeUserFavorite(userFavorite).then(({data})=>{
  734. this.$message.success(data.msg)
  735. this.favorite = false
  736. })
  737. })
  738. }else {
  739. // 收藏
  740. saveUserFavorite(userFavorite).then(({data})=>{
  741. this.$message.success(data.msg)
  742. this.favorite = true
  743. })
  744. }
  745. },
  746. // 保存语言编辑
  747. saveLanguageList(val) {
  748. saveSysLanguageOne(val).then(({data}) => {
  749. if (data.code == 0) {
  750. this.$message.success(data.msg)
  751. } else {
  752. this.$message.error(data.msg)
  753. }
  754. })
  755. },
  756. // 编辑语言
  757. addLanguageFun() {
  758. if (this.querySysLanguagePack.languageCode) {
  759. this.addLanguage = true
  760. this.languageColumnList = []
  761. let query = {
  762. functionId: 2501,
  763. tableId: "common1002",
  764. languageCode: this.$i18n.locale
  765. }
  766. getTableDefaultListLanguage(query).then(({data}) => {
  767. if (data.rows.length > 0) {
  768. this.languageColumnList = data.rows
  769. }
  770. })
  771. this.languageColumnList = this.columnList
  772. searchLanguageListByLanguageCode(this.querySysLanguagePack).then(({data}) => {
  773. this.languageDataList = data.rows
  774. })
  775. } else {
  776. this.$message("请选中一种语言")
  777. }
  778. },
  779. // 获取多语言列表
  780. getLanguageList() {
  781. searchSysLanguage(this.queryLanguage).then(({data}) => {
  782. this.languageList = data.rows
  783. })
  784. },
  785. // 获取button的词典
  786. getFunctionButtonList() {
  787. searchFunctionButtonList(this.queryButton).then(({data}) => {
  788. if (JSON.stringify(data.data) != '{}' ) {
  789. this.buttons = data.data
  790. } else {
  791. // saveButtonList(this.buttonList).then(({data}) => {
  792. // })
  793. }
  794. })
  795. },
  796. // 获取语言词典
  797. getSysLanguageParamList() {
  798. searchSysLanguageParam(this.querySysLanguageParam).then(({data}) => {
  799. this.sysLanguageParams = data.rows
  800. })
  801. },
  802. // 打开页面设置
  803. userSetting() {
  804. this.visible = true;
  805. let queryTable = {
  806. userId: this.$store.state.user.name,
  807. functionId: 2501,
  808. tableId: "wareHouse2501",
  809. languageCode: this.$i18n.locale
  810. }
  811. this.$nextTick(() => {
  812. this.$refs.column.init(queryTable);
  813. });
  814. },
  815. // 获取 用户保存的 格式列
  816. getTableUserColumn() {
  817. getTableUserListLanguage(this.queryTableUser).then(({data}) => {
  818. if (data.rows.length > 0) {
  819. //this.columnList = []
  820. this.columnList = data.rows
  821. } else {
  822. this.getColumnList()
  823. }
  824. })
  825. },
  826. // 保存 默认配置 列
  827. saveColumnList() {
  828. saveTableDefaultList(this.columnList).then(({data}) => {
  829. if (data.code == 0) {
  830. this.$message.success(data.msg)
  831. this.showDefault = false
  832. } else {
  833. this.$message.error(data.msg)
  834. }
  835. })
  836. saveTableDefaultList(this.columnList1).then(({data}) => {
  837. if (data.code == 0) {
  838. this.$message.success(data.msg)
  839. this.showDefault = false
  840. } else {
  841. this.$message.error(data.msg)
  842. }
  843. })
  844. saveButtonList(this.buttonList).then(({data}) => {
  845. })
  846. this.getFunctionButtonList()
  847. this.getFunctionButtonList();
  848. this.getColumnList()
  849. },
  850. // 获取 tableDefault 列
  851. getColumnList() {
  852. getTableDefaultListLanguage(this.queryTable).then(({data}) => {
  853. if (!data.rows.length == 0) {
  854. this.showDefault = false
  855. this.columnList = data.rows
  856. } else {
  857. this.showDefault = true
  858. }
  859. })
  860. },
  861. // 获取数据列表
  862. getDataList() {
  863. this.dataListLoading = true
  864. getWarehouseList(this.queryHeaderData).then(({data}) => {
  865. if (data && data.code === 0) {
  866. this.dataList = data.rows
  867. // this.totalPage = data.page.totalCount
  868. } else {
  869. this.dataList = []
  870. // this.totalPage = 0
  871. }
  872. this.dataListLoading = false
  873. })
  874. },
  875. // 每页数
  876. sizeChangeHandle(val) {
  877. this.pageSize = val
  878. this.pageIndex = 1
  879. this.getDataList()
  880. },
  881. // 当前页
  882. currentChangeHandle(val) {
  883. this.pageIndex = val
  884. this.getDataList()
  885. },
  886. // 多选
  887. selectionChangeHandle(val) {
  888. this.dataListSelections = val
  889. },
  890. // 删除
  891. deleteHandle(id) {
  892. var ids = id ? [id] : this.dataListSelections.map(item => {
  893. return item.id
  894. })
  895. this.$confirm(`确定对[id=${ids.join(',')}]进行[${id ? '删除' : '批量删除'}]操作?`, '提示', {
  896. confirmButtonText: '确定',
  897. cancelButtonText: '取消',
  898. type: 'warning'
  899. }).then(() => {
  900. this.$http({
  901. url: this.$http.adornUrl('//prd/delete'),
  902. method: 'post',
  903. data: this.$http.adornData(ids, false)
  904. }).then(({data}) => {
  905. if (data && data.code === 0) {
  906. this.$message({
  907. message: '操作成功',
  908. type: 'success',
  909. duration: 1500,
  910. onClose: () => {
  911. this.getDataList()
  912. }
  913. })
  914. } else {
  915. this.$message.error(data.msg)
  916. }
  917. })
  918. })
  919. },
  920. // 导出
  921. fields(){
  922. let json = "{"
  923. this.columnList.forEach((item,index) =>{
  924. if (index == this.columnList.length-1 ){
  925. json +="\""+item.columnLabel+"\"" +":"+"\""+item.columnProp+"\""
  926. }else {
  927. json += "\""+item.columnLabel+"\"" +":"+"\""+item.columnProp+"\""+ ","
  928. }
  929. })
  930. json +="}"
  931. let s = eval("(" + json + ")")
  932. return s
  933. },
  934. createExportData() {
  935. // 点击导出按钮之后,开始导出数据之前的执行函数,返回值为需要下载的数据
  936. // TODO:构造需要下载的数据返回
  937. if(this.dataListSelections.length>0){
  938. return this.dataListSelections;
  939. }
  940. return this.dataList;
  941. },
  942. startDownload() {
  943. // this.exportData = this.dataList
  944. },
  945. finishDownload() {
  946. }
  947. },
  948. created() {
  949. this.getTableUserColumn()
  950. this.getSysLanguageParamList()
  951. this.getFunctionButtonList()
  952. this.favoriteIsOk()
  953. }
  954. }
  955. </script>
  956. <style scoped >
  957. .wrapper {
  958. height: calc(100% - 40px);
  959. }
  960. .sl-input {
  961. background-color: transparent;
  962. border: 0 !important;
  963. font-size: 12px !important;
  964. height: 12px !important;
  965. line-height: 14px !important;
  966. background-color: transparent !important;
  967. width: 140px;
  968. }
  969. .sl-input:focus, textarea:focus {
  970. outline: none;
  971. }
  972. .sl-svg{
  973. overflow: hidden;
  974. float: right;
  975. }
  976. </style>