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.

915 lines
27 KiB

4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
  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-button @click="searchList()" type="primary">{{ buttons.search }}</el-button>
  9. <el-button @click="saveColumnList()" type="primary" v-show="showDefault">{{ buttons.defaultTable }}
  10. </el-button>
  11. <el-button @click="userSetting" type="primary">{{ buttons.settingTable }}</el-button>
  12. <el-button @click="updateExpDate()" v-if="" type="primary">{{ buttons.updateExp }}</el-button>
  13. <el-form label-position="top" style="margin-top: 5px" v-show="searchShow" :inline="true" :model="queryData"
  14. @keyup.enter.native="getDataList()">
  15. <el-form-item label="失效日期">
  16. <el-date-picker
  17. style="width: 100px"
  18. v-model="queryData.startDate"
  19. type="date"
  20. placeholder="选择日期">
  21. </el-date-picker>
  22. -
  23. <el-date-picker
  24. style="width: 100px"
  25. v-model="queryData.endDate"
  26. type="date"
  27. format="yyyy-MM-dd"
  28. value-format="yyyy-MM-dd"
  29. placeholder="选择日期">
  30. </el-date-picker>
  31. </el-form-item>
  32. <el-form-item label="超期天数">
  33. <el-input style="width: 80px" oninput="value=value.replace(/[^\-\d]/g, '')" v-model="queryData.day1" clearable>
  34. </el-input>
  35. -
  36. <el-input style="width: 80px" oninput="value=value.replace(/[^\-\d]/g, '')" v-model="queryData.day2" clearable>
  37. </el-input>
  38. </el-form-item>
  39. <el-form-item label="卷号">
  40. <el-input v-model="queryData.rollno" clearable>
  41. </el-input>
  42. </el-form-item>
  43. <el-form-item >
  44. <span slot="label" style="" @click="getBaseList(5)"><a herf="#">物料编码</a></span>
  45. <el-input v-model="queryData.partno" clearable>
  46. </el-input>
  47. </el-form-item>
  48. <el-form-item style="margin-top: 18px">
  49. <el-button @click="getDataList()" type="primary">{{ buttons.search1 }}</el-button>
  50. </el-form-item>
  51. <el-form-item style="margin-top: 18px" >
  52. <el-checkbox label="修改之后刷新" name="type" v-model="getFlag"></el-checkbox>
  53. </el-form-item>
  54. </el-form>
  55. <el-table
  56. ref="rawRollInfo"
  57. :height="height"
  58. :data="dataList"
  59. border
  60. @selection-change="selectionChangeHandle"
  61. v-loading="dataListLoading"
  62. style="width: 100%;">
  63. <el-table-column type="selection" header-align="center" align="center" width="50"></el-table-column>
  64. <el-table-column
  65. v-for="(item,index) in columnList" :key="index"
  66. :sortable="item.columnSortable"
  67. :prop="item.columnProp"
  68. :header-align="item.headerAlign"
  69. :show-overflow-tooltip="item.showOverflowTooltip"
  70. :align="item.align"
  71. :fixed="item.fixed"
  72. :min-width="item.columnWidth"
  73. :label="item.columnLabel">
  74. <template slot-scope="scope">
  75. <span v-if="!item.columnHidden"> {{ scope.row[item.columnProp] }}</span>
  76. <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]"
  77. style="width: 100px; height: 80px"/></span>
  78. </template>
  79. </el-table-column>
  80. </el-table>
  81. <el-dialog
  82. :title="'修改失效日期'"
  83. :close-on-click-modal="false"
  84. width="200px"
  85. :visible.sync="updateExp">
  86. <el-form ref="dataForm" style="margin-left: 15px;margin-top: -5px" label-position="top"
  87. label-width="80px">
  88. <el-form-item label="失效日期" prop="expireddate">
  89. <el-date-picker style="width: 150px" value-format="yyyy-MM-dd" v-model="expireddate" placeholder="失效日期"></el-date-picker>
  90. </el-form-item>
  91. </el-form>
  92. <span slot="footer" class="dialog-footer">
  93. <el-button type="primary" @click="updateExpSubmit()">确定</el-button>
  94. <el-button @click="updateExp = false">取消</el-button>
  95. </span>
  96. </el-dialog>
  97. <!-- 设置列 -->
  98. <column v-if="visible" ref="column" @refreshData="getTableUserColumn"></column>
  99. <Chooselist ref="baseList" @getBaseData="getBaseData"></Chooselist>
  100. </div>
  101. </template>
  102. <script>
  103. import Chooselist from '@/views/modules/common/Chooselist'
  104. import { batchUpdateExpireddate,expiryList} from '@/api/crollinfo/crollinfo.js'
  105. import column from "../common/column";
  106. import search from "../common/search";
  107. import {
  108. searchSysLanguageParam,
  109. searchFunctionButtonList,
  110. saveButtonList,
  111. } from "@/api/sysLanguage.js"
  112. import {
  113. saveTableDefaultList,
  114. getTableDefaultListLanguage,
  115. getTableUserListLanguage,
  116. removerDefault,
  117. removerUser
  118. } from "@/api/table.js"
  119. import {userFavoriteList, saveUserFavorite, removeUserFavorite} from '@/api/userFavorite.js'
  120. export default {
  121. data() {
  122. return {
  123. searchVisible: false,
  124. getFlag: true,
  125. visible: false,
  126. updateExp: false,
  127. searchShow: false,
  128. expireddate: '',
  129. addOrUpdateVisible: false,
  130. CRollInfo: {},
  131. // table高度
  132. height: 450,
  133. userId:this.$store.state.user.name,
  134. // 是否收藏
  135. favorite: false,
  136. addLanguage: false,
  137. functionId: this.$route.meta.menuId,
  138. tableId: "105002002ETM",
  139. languageCode: this.$i18n.locale,
  140. showDefault: false,
  141. queryData: {
  142. day: '',
  143. rollno: '',
  144. partno: '',
  145. startDate: '',
  146. endDate: ''
  147. },
  148. queryTable: {
  149. functionId: this.$route.meta.menuId,
  150. tableId: "105002002ETM",
  151. languageCode: this.$i18n.locale
  152. },
  153. // 语言词典集合
  154. sysLanguageParams: [],
  155. columnList: [
  156. {
  157. "userId": this.$store.state.user.name,
  158. "tableId": "105002002ETM",
  159. "tableName": "有效期管理",
  160. "columnProp": "rollno",
  161. "columnLabel": "卷号",
  162. "columnHidden": false,
  163. "columnImage": false,
  164. "columnSortable": false,
  165. "columnWidth": 100,
  166. "format": null,
  167. "sortLv": 10,
  168. "status": true,
  169. "fixed": true,
  170. "serialNumber": null,
  171. "columnType": "string",
  172. "align": null
  173. },
  174. {
  175. "userId": this.$store.state.user.name,
  176. "tableId": "105002002ETM",
  177. "tableName": "有效期管理",
  178. "columnProp": "partno",
  179. "columnLabel": "物料编号",
  180. "columnHidden": false,
  181. "columnImage": false,
  182. "columnSortable": false,
  183. "columnWidth": 100,
  184. "format": null,
  185. "sortLv": 11,
  186. "status": true,
  187. "fixed": false,
  188. "serialNumber": null,
  189. "columnType": "string",
  190. "align": null
  191. },
  192. {
  193. "userId": this.$store.state.user.name,
  194. "tableId": "105002002ETM",
  195. "tableName": "有效期管理",
  196. "columnProp": "partDescription",
  197. "columnLabel": "物料描述",
  198. "columnHidden": false,
  199. "columnImage": false,
  200. "columnSortable": false,
  201. "columnWidth": 250,
  202. "format": null,
  203. "sortLv": 12,
  204. "status": true,
  205. "fixed": false,
  206. "serialNumber": null,
  207. "columnType": "string",
  208. "align": null
  209. },
  210. {
  211. "userId": this.$store.state.user.name,
  212. "tableId": "105002002ETM",
  213. "tableName": "有效期管理",
  214. "columnProp": "site",
  215. "columnLabel": "工厂编号",
  216. "columnHidden": false,
  217. "columnImage": false,
  218. "columnSortable": false,
  219. "columnWidth": 80,
  220. "format": null,
  221. "sortLv": 13,
  222. "status": true,
  223. "fixed": false,
  224. "serialNumber": null,
  225. "columnType": "string",
  226. "align": null
  227. },
  228. {
  229. "userId": this.$store.state.user.name,
  230. "tableId": "105002002ETM",
  231. "tableName": "有效期管理",
  232. "columnProp": "status",
  233. "columnLabel": "状态",
  234. "columnHidden": false,
  235. "columnImage": false,
  236. "columnSortable": false,
  237. "columnWidth": 80,
  238. "format": null,
  239. "sortLv": 14,
  240. "status": true,
  241. "fixed": false,
  242. "serialNumber": null,
  243. "columnType": "number",
  244. "align": null
  245. },
  246. {
  247. "userId": this.$store.state.user.name,
  248. "tableId": "105002002ETM",
  249. "tableName": "有效期管理",
  250. "columnProp": "rollqty",
  251. "columnLabel": "卷数量",
  252. "columnHidden": false,
  253. "columnImage": false,
  254. "columnSortable": false,
  255. "columnWidth": 80,
  256. "format": null,
  257. "sortLv": 15,
  258. "status": true,
  259. "fixed": false,
  260. "serialNumber": null,
  261. "columnType": "number",
  262. "align": null
  263. },
  264. {
  265. "userId": this.$store.state.user.name,
  266. "tableId": "105002002ETM",
  267. "tableName": "有效期管理",
  268. "columnProp": "supplierid",
  269. "columnLabel": "供应商编号",
  270. "columnHidden": false,
  271. "columnImage": false,
  272. "columnSortable": false,
  273. "columnWidth": 80,
  274. "format": null,
  275. "sortLv": 16,
  276. "status": false,
  277. "fixed": false,
  278. "serialNumber": null,
  279. "columnType": "string",
  280. "align": null
  281. },
  282. {
  283. "userId": this.$store.state.user.name,
  284. "tableId": "105002002ETM",
  285. "tableName": "有效期管理",
  286. "columnProp": "suppliername",
  287. "columnLabel": "供应商名称",
  288. "columnHidden": false,
  289. "columnImage": false,
  290. "columnSortable": false,
  291. "columnWidth": 80,
  292. "format": null,
  293. "sortLv": 17,
  294. "status": false,
  295. "fixed": false,
  296. "serialNumber": null,
  297. "columnType": "string",
  298. "align": null
  299. },
  300. {
  301. "userId": this.$store.state.user.name,
  302. "tableId": "105002002ETM",
  303. "tableName": "有效期管理",
  304. "columnProp": "overdueDays",
  305. "columnLabel": "超期天数",
  306. "columnHidden": false,
  307. "columnImage": false,
  308. "columnSortable": false,
  309. "columnWidth": 120,
  310. "format": null,
  311. "sortLv": 20,
  312. "status": true,
  313. "fixed": false,
  314. "serialNumber": null,
  315. "columnType": "date",
  316. "align": null
  317. },
  318. {
  319. "userId": this.$store.state.user.name,
  320. "tableId": "105002002ETM",
  321. "tableName": "有效期管理",
  322. "columnProp": "expireddate",
  323. "columnLabel": "失效日期",
  324. "columnHidden": false,
  325. "columnImage": false,
  326. "columnSortable": false,
  327. "columnWidth": 120,
  328. "format": null,
  329. "sortLv": 21,
  330. "status": true,
  331. "fixed": false,
  332. "serialNumber": null,
  333. "columnType": "date",
  334. "align": null
  335. },
  336. {
  337. "userId": this.$store.state.user.name,
  338. "tableId": "105002002ETM",
  339. "tableName": "有效期管理",
  340. "columnProp": "createdby",
  341. "columnLabel": "创建人",
  342. "columnHidden": false,
  343. "columnImage": false,
  344. "columnSortable": false,
  345. "columnWidth": 80,
  346. "format": null,
  347. "sortLv": 40,
  348. "status": true,
  349. "fixed": false,
  350. "serialNumber": null,
  351. "columnType": "string",
  352. "align": null
  353. },
  354. {
  355. "userId": this.$store.state.user.name,
  356. "tableId": "105002002ETM",
  357. "tableName": "有效期管理",
  358. "columnProp": "createddate",
  359. "columnLabel": "创建时间",
  360. "columnHidden": false,
  361. "columnImage": false,
  362. "columnSortable": false,
  363. "columnWidth": 150,
  364. "format": null,
  365. "sortLv": 41,
  366. "status": true,
  367. "fixed": false,
  368. "serialNumber": null,
  369. "columnType": "date",
  370. "align": null
  371. },
  372. {
  373. "userId": this.$store.state.user.name,
  374. "tableId": "105002002ETM",
  375. "tableName": "有效期管理",
  376. "columnProp": "rolldate",
  377. "columnLabel": "卷创建日期",
  378. "columnHidden": false,
  379. "columnImage": false,
  380. "columnSortable": false,
  381. "columnWidth": 120,
  382. "format": null,
  383. "sortLv": 42,
  384. "status": true,
  385. "fixed": false,
  386. "serialNumber": null,
  387. "columnType": "date",
  388. "align": null
  389. },
  390. {
  391. "userId": this.$store.state.user.name,
  392. "tableId": "105002002ETM",
  393. "tableName": "有效期管理",
  394. "columnProp": "manufacturedate",
  395. "columnLabel": "制造日期",
  396. "columnHidden": false,
  397. "columnImage": false,
  398. "columnSortable": false,
  399. "columnWidth": 120,
  400. "format": null,
  401. "sortLv": 43,
  402. "status": true,
  403. "fixed": false,
  404. "serialNumber": null,
  405. "columnType": "string",
  406. "align": null
  407. },
  408. {
  409. "userId": this.$store.state.user.name,
  410. "tableId": "105002002ETM",
  411. "tableName": "有效期管理",
  412. "columnProp": "warehouseid",
  413. "columnLabel": "仓库编号",
  414. "columnHidden": false,
  415. "columnImage": false,
  416. "columnSortable": false,
  417. "columnWidth": 80,
  418. "format": null,
  419. "sortLv": 18,
  420. "status": false,
  421. "fixed": false,
  422. "serialNumber": null,
  423. "columnType": "string",
  424. "align": null
  425. },
  426. {
  427. "userId": this.$store.state.user.name,
  428. "tableId": "105002002ETM",
  429. "tableName": "有效期管理",
  430. "columnProp": "orderref1",
  431. "columnLabel": "关联单号1",
  432. "columnHidden": false,
  433. "columnImage": false,
  434. "columnSortable": false,
  435. "columnWidth": 80,
  436. "format": null,
  437. "sortLv": 31,
  438. "status": false,
  439. "fixed": false,
  440. "serialNumber": null,
  441. "columnType": "string",
  442. "align": null
  443. },
  444. {
  445. "userId": this.$store.state.user.name,
  446. "tableId": "105002002ETM",
  447. "tableName": "有效期管理",
  448. "columnProp": "orderref2",
  449. "columnLabel": "关联单号2",
  450. "columnHidden": false,
  451. "columnImage": false,
  452. "columnSortable": false,
  453. "columnWidth": 80,
  454. "format": null,
  455. "sortLv": 32,
  456. "status": false,
  457. "fixed": false,
  458. "serialNumber": null,
  459. "columnType": "string",
  460. "align": null
  461. },
  462. {
  463. "userId": this.$store.state.user.name,
  464. "tableId": "105002002ETM",
  465. "tableName": "有效期管理",
  466. "columnProp": "orderref3",
  467. "columnLabel": "关联单号3",
  468. "columnHidden": false,
  469. "columnImage": false,
  470. "columnSortable": false,
  471. "columnWidth": 80,
  472. "format": null,
  473. "sortLv": 33,
  474. "status": false,
  475. "fixed": false,
  476. "serialNumber": null,
  477. "columnType": "string",
  478. "align": null
  479. },
  480. {
  481. "userId": this.$store.state.user.name,
  482. "tableId": "105002002ETM",
  483. "tableName": "有效期管理",
  484. "columnProp": "orderref4",
  485. "columnLabel": "关联单号4",
  486. "columnHidden": false,
  487. "columnImage": false,
  488. "columnSortable": false,
  489. "columnWidth": 80,
  490. "format": null,
  491. "sortLv": 34,
  492. "status": false,
  493. "fixed": false,
  494. "serialNumber": null,
  495. "columnType": "string",
  496. "align": null
  497. },
  498. {
  499. "userId": this.$store.state.user.name,
  500. "tableId": "105002002ETM",
  501. "tableName": "有效期管理",
  502. "columnProp": "orderref5",
  503. "columnLabel": "关联单号5",
  504. "columnHidden": false,
  505. "columnImage": false,
  506. "columnSortable": false,
  507. "columnWidth": 80,
  508. "format": null,
  509. "sortLv": 35,
  510. "status": false,
  511. "fixed": false,
  512. "serialNumber": null,
  513. "columnType": "string",
  514. "align": null
  515. },
  516. {
  517. "userId": this.$store.state.user.name,
  518. "tableId": "105002002ETM",
  519. "tableName": "有效期管理",
  520. "columnProp": "remark",
  521. "columnLabel": "备注",
  522. "columnHidden": false,
  523. "columnImage": false,
  524. "columnSortable": false,
  525. "columnWidth": 80,
  526. "format": null,
  527. "sortLv": 99,
  528. "status": false,
  529. "fixed": false,
  530. "serialNumber": null,
  531. "columnType": "string",
  532. "align": null
  533. },
  534. ],
  535. dataList: [],
  536. selectList: [],
  537. buttonList: [],
  538. buttons: {
  539. add: '添加',
  540. edit: '编辑',
  541. delete: '删除',
  542. deleteList: '批量删除',
  543. cz: '操作',
  544. search: '搜索',
  545. search1: '查询',
  546. download: '导出',
  547. settingTable: '设置列表',
  548. defaultTable: '设置默认配置',
  549. updateExp: '修改失效日期'
  550. },
  551. dataListLoading: false,
  552. dataListSelections: [],
  553. pagination: {
  554. page: 1,
  555. pageSize: 200,
  556. total: 0,
  557. },
  558. totalPage: 5,
  559. countTotal: 200,
  560. }
  561. },
  562. components: {
  563. column,
  564. search,
  565. Chooselist
  566. },
  567. mounted() {
  568. this.$nextTick(() => {
  569. this.height = window.innerHeight - 180;
  570. this.lazyLoading()
  571. })
  572. },
  573. activated() {
  574. // this.getDataList()
  575. },
  576. methods: {
  577. // 获取基础数据列表
  578. getBaseList(val1){
  579. this.tagNo = val1
  580. this.$nextTick(() => {
  581. let strVal = '';
  582. if (this.queryData.partno){
  583. strVal = this.queryData.partno
  584. }
  585. this.$refs.baseList.init(val1,strVal)
  586. })
  587. },
  588. getBaseData(val){
  589. this.queryData.partno = val.PartNo
  590. },
  591. // 打开搜索页面
  592. searchList() {
  593. if (this.searchShow) {
  594. this.searchShow = false
  595. return
  596. } else {
  597. this.searchShow = true
  598. }
  599. },
  600. lazyLoading() {
  601. let dom = document.querySelector(".el-table__body-wrapper");
  602. dom.addEventListener("scroll", (v) => {
  603. const scrollDistance = dom.scrollHeight - dom.scrollTop - dom.clientHeight;
  604. // console.log("鼠标滑动-scrollDistance", scrollDistance)
  605. // if (scrollDistance <= 0) { //分辨率问题,如果设置 100% ,滑倒最底部,scrollDistance的值 可能为 0.201 到 -0.201
  606. if (scrollDistance <= 1) {
  607. //等于0证明已经到底,可以请求接口
  608. if (this.pagination.page >= this.totalPage) {
  609. //判断是否到达底部
  610. // this.$message.warning("我~是有底线的 (~ ̄▽ ̄)~");
  611. //console.log("我~是有底线的 (~ ̄▽ ̄)~")
  612. }
  613. if (this.pagination.page < this.totalPage) {
  614. //当前页数小于总页数就请求
  615. this.pagination.page++; //当前页数自增
  616. //console.log("页面已经到达底部,可以请求接口,请求第 " + this.pagination.page + " 页数据");
  617. this.pagination.pageSize = this.countTotal;
  618. this.getDataListAdd()
  619. }
  620. }
  621. });
  622. },
  623. // 获取数据列表
  624. getDataList() {
  625. this.dataListLoading = true
  626. let query = {
  627. parttypeFlag: 'F',
  628. toexpiredays: this.queryData.day,
  629. rollno: this.queryData.rollno,
  630. partno: this.queryData.partno,
  631. startDate: this.queryData.startDate,
  632. endDate: this.queryData.endDate,
  633. day1: this.queryData.day1,
  634. day2: this.queryData.day2,
  635. limit: 200,
  636. page: 1
  637. }
  638. expiryList(query).then(({data}) => {
  639. if (data && data.code === 0) {
  640. this.dataList = data.page.list
  641. this.totalPage = data.page.totalPage
  642. // this.countTotal = data.page.totalCount
  643. this.pagination.page = data.page.currPage
  644. this.pagination.total = data.page.totalCount
  645. }
  646. this.dataListLoading = false
  647. })
  648. // this.searchShow = false
  649. },
  650. // 滚动获取数据
  651. getDataListAdd() {
  652. this.dataListLoading = true
  653. let query = {
  654. parttypeFlag: 'F',
  655. toexpiredays: this.queryData.day,
  656. rollno: this.queryData.rollno,
  657. partno: this.queryData.partno,
  658. limit: this.pagination.pageSize,
  659. startDate: this.queryData.startDate,
  660. endDate: this.queryData.endDate,
  661. page: this.pagination.page
  662. }
  663. expiryList(query).then(({data}) => {
  664. if (data && data.code === 0) {
  665. let voList = data.page.list
  666. this.dataList.push(...voList)
  667. }
  668. this.dataListLoading = false
  669. })
  670. // this.searchShow = false
  671. },
  672. selectionChangeHandle(val){
  673. this.selectList = val
  674. },
  675. // 修改失效日期
  676. updateExpDate() {
  677. let rollInfoList = this.selectList.map(item => {
  678. let rollInfo = {
  679. site: item.site,
  680. rollno: item.rollno,
  681. expireddate: this.expireddate
  682. }
  683. return rollInfo;
  684. })
  685. if (rollInfoList.length==0){
  686. this.$message.warning("请选择卷")
  687. return
  688. }
  689. this.updateExp = true
  690. },
  691. // 表单提交
  692. updateExpSubmit() {
  693. let rollInfoList = this.selectList.map(item => {
  694. let rollInfo = {
  695. site: item.site,
  696. rollno: item.rollno,
  697. expireddate: this.expireddate
  698. }
  699. return rollInfo;
  700. })
  701. batchUpdateExpireddate(rollInfoList).then(({data}) => {
  702. if (data && data.code === 0) {
  703. this.$message.success('操作成功')
  704. this.updateExp = false
  705. this.expireddate = ''
  706. if (this.getFlag){
  707. this.getDataList()
  708. }
  709. } else {
  710. this.$message.error(data.msg)
  711. }
  712. })
  713. },
  714. // 修改信息
  715. update(val) {
  716. this.CRollInfo = val
  717. if (this.CRollInfo.expireDateControlFlag != 'Y') return this.$message.info('该物料未设置有效期');
  718. this.addOrUpdateVisible = true
  719. this.$nextTick(() => {
  720. this.$refs.addOrUpdate.init(this.CRollInfo.rollno, this.CRollInfo.site)
  721. })
  722. },
  723. // 校验用户是否收藏
  724. favoriteIsOk() {
  725. let userFavorite = {
  726. userId: this.$store.state.user.id,
  727. languageCode: this.$i18n.locale
  728. }
  729. userFavoriteList(userFavorite).then(({data}) => {
  730. let size = data.list.filter(item => item.menuId == this.$route.meta.menuId).length;
  731. if (size > 0) {
  732. this.favorite = true
  733. } else {
  734. this.favorite = false
  735. }
  736. })
  737. },
  738. // 收藏 OR 取消收藏
  739. favoriteFunction() {
  740. let userFavorite = {
  741. userId: this.$store.state.user.id,
  742. functionId: this.$route.meta.menuId,
  743. }
  744. if (this.favorite) {
  745. // 取消收藏
  746. this.$confirm(`确定取消收藏`, '提示', {
  747. confirmButtonText: '确定',
  748. cancelButtonText: '取消',
  749. type: 'warning'
  750. }).then(() => {
  751. removeUserFavorite(userFavorite).then(({data}) => {
  752. this.$message.success(data.msg)
  753. this.favorite = false
  754. })
  755. })
  756. } else {
  757. // 收藏
  758. saveUserFavorite(userFavorite).then(({data}) => {
  759. this.$message.success(data.msg)
  760. this.favorite = true
  761. })
  762. }
  763. },
  764. // 获取button的词典
  765. getFunctionButtonList() {
  766. let queryButton = {
  767. functionId: this.functionId,
  768. tableId: this.tableId,
  769. languageCode: this.languageCode,
  770. objectType: 'button'
  771. }
  772. searchFunctionButtonList(queryButton).then(({data}) => {
  773. if (data.data.length > 0) {
  774. this.buttons = data.data
  775. }
  776. })
  777. },
  778. // 获取语言词典
  779. getSysLanguageParamList() {
  780. let querySysLanguageParam = {
  781. languageCode: this.$i18n.locale
  782. }
  783. searchSysLanguageParam(querySysLanguageParam).then(({data}) => {
  784. this.sysLanguageParams = data.rows
  785. })
  786. },
  787. // 打开页面设置
  788. userSetting() {
  789. this.visible = true;
  790. let queryTable = {
  791. userId: this.userId,
  792. functionId: this.functionId,
  793. tableId: this.tableId,
  794. languageCode: this.languageCode
  795. }
  796. this.$nextTick(() => {
  797. this.$refs.column.init(queryTable);
  798. });
  799. },
  800. // 获取 用户保存的 格式列
  801. getTableUserColumn() {
  802. let queryTableUser = {
  803. userId: this.userId,
  804. functionId: this.functionId,
  805. tableId: this.tableId,
  806. languageCode: this.languageCode,
  807. objectType: 'table',
  808. status: true,
  809. }
  810. getTableUserListLanguage(queryTableUser).then(({data}) => {
  811. if (data.rows.length > 0) {
  812. //this.columnList = []
  813. this.columnList = data.rows
  814. } else {
  815. this.getColumnList()
  816. }
  817. })
  818. },
  819. // 保存 默认配置 列
  820. async saveColumnList() {
  821. // 删除所有的该页面下保存的数据
  822. //删除 user自定义的数据
  823. await removerUser(this.queryTable)
  824. // 删除默认配置
  825. await removerDefault(this.queryTable)
  826. // 保存页面 table属性
  827. let sumColumnList = this.columnList;
  828. sumColumnList = sumColumnList.map(item => {
  829. return item = {
  830. tableId: item.tableId,
  831. tableName: item.tableName,
  832. columnProp: item.columnProp,
  833. columnLabel: item.columnLabel,
  834. columnHidden: false,
  835. columnImage: false,
  836. columnSortable: false,
  837. columnWidth: item.columnWidth,
  838. format: item.format,
  839. functionId: this.$route.meta.menuId,
  840. sortLv: item.sortLv,
  841. status: true,
  842. fixed: item.fixed,
  843. serialNumber: item.serialNumber,
  844. columnType: item.columnType,
  845. align: item.align
  846. }
  847. })
  848. await saveTableDefaultList(sumColumnList)
  849. // 保存页面 button label title 属性
  850. let buttons = this.buttonList.map(item => {
  851. return item = {
  852. functionId: this.$route.meta.menuId,
  853. languageValue: item.languageValue,
  854. objectId: item.objectId,
  855. objectType: item.objectType,
  856. tableId: item.tableId
  857. }
  858. })
  859. await saveButtonList(buttons)
  860. this.getFunctionButtonList()
  861. this.getColumnList()
  862. },
  863. // 获取 tableDefault 列
  864. getColumnList() {
  865. let queryTable = {
  866. functionId: this.functionId,
  867. tableId: this.tableId,
  868. languageCode: this.languageCode
  869. }
  870. getTableDefaultListLanguage(queryTable).then(({data}) => {
  871. if (!data.rows.length == 0) {
  872. // this.showDefault = false
  873. this.columnList = data.rows
  874. } else {
  875. // this.showDefault = true
  876. }
  877. })
  878. },
  879. },
  880. created() {
  881. //this.getTableUserColumn()
  882. this.getSysLanguageParamList()
  883. this.getFunctionButtonList()
  884. this.favoriteIsOk()
  885. }
  886. }
  887. </script>
  888. <style scoped>
  889. .sl-svg {
  890. overflow: hidden;
  891. float: right;
  892. }
  893. </style>