finstlbillsitems2.vue 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741
  1. <template>
  2. <div>
  3. <!--:row-style="{height:'20px',padding:'0px',fontSize:'12px'}"-->
  4. <avue-crud
  5. :option="option"
  6. :data="tableData"
  7. id="out-table"
  8. ref="crud"
  9. @selection-change="handleSelectionChange"
  10. :header-cell-style="tableHeaderCellStyle"
  11. :row-class-name="rowClassName"
  12. :cell-style="cellStyle"
  13. :page.sync="page"
  14. @size-change="sizeChange"
  15. @current-change="currentChange"
  16. @resetColumn="resetColumn('crud', 'option', 'optionBack', 456)"
  17. @saveColumn="saveColumn('crud', 'option', 'optionBack', 456)"
  18. >
  19. <template slot="menuLeft">
  20. <slot name="menuLeft"></slot>
  21. </template>
  22. <tempalte slot="currentStlAmountRMB" slot-scope="{ row }">
  23. <el-input-number
  24. v-if="brfalse && !editSave"
  25. v-model="row.currentStlAmountRMB"
  26. @change="armbChange(row)"
  27. :controls="false"
  28. placeholder="请输入 本次对账CNY"
  29. size="mini"
  30. style="width: 100%;"
  31. :disabled="row.currentStlCurCode != 'CNY'"
  32. ></el-input-number>
  33. <span v-else>{{ row.currentStlAmountRMB }}</span>
  34. </tempalte>
  35. <tempalte slot="currentStlAmountUSD" slot-scope="{ row }">
  36. <el-input-number
  37. v-if="brfalse && !editSave"
  38. v-model="row.currentStlAmountUSD"
  39. @change="ausdChange(row)"
  40. :controls="false"
  41. placeholder="请输入 本次对账USD"
  42. size="mini"
  43. style="width: 100%;"
  44. :disabled="row.currentStlCurCode != 'USD'"
  45. ></el-input-number>
  46. <span v-else>{{ row.currentStlAmountUSD }}</span>
  47. </tempalte>
  48. <template slot="remarkss" slot-scope="{ row }">
  49. <el-input
  50. style="width: 100%;"
  51. v-model="row.remarkss"
  52. v-if="brfalse && !editSave"
  53. size="mini"
  54. autocomplete="off"
  55. clearable
  56. placeholder="请输入 备注"
  57. >
  58. </el-input>
  59. <span v-else>{{ row.remarkss }}</span>
  60. </template>
  61. <template slot="taxInvoiceNumber" slot-scope="{ row }">
  62. <el-input
  63. style="width: 100%;"
  64. v-model="row.taxInvoiceNumber"
  65. v-if="row.feeCnName == '增值税' && brfalse && !editSave"
  66. size="mini"
  67. autocomplete="off"
  68. clearable
  69. placeholder="请输入税票号"
  70. >
  71. </el-input>
  72. <span v-else>{{ row.taxInvoiceNumber }}</span>
  73. </template>
  74. <template slot="taxInvoiceDate" slot-scope="{ row }">
  75. <el-date-picker
  76. style="width: 100%;"
  77. v-model="row.taxInvoiceDate"
  78. v-if="row.feeCnName == '增值税' && brfalse && !editSave"
  79. size="mini"
  80. type="date"
  81. placeholder="选择日期"
  82. format="yyyy-MM-dd"
  83. value-format="yyyy-MM-dd"
  84. >
  85. </el-date-picker>
  86. <span v-else>{{ row.taxInvoiceDate }}</span>
  87. </template>
  88. <template slot="deductionTime" slot-scope="{ row }">
  89. <el-date-picker
  90. style="width: 100%;"
  91. v-model="row.deductionTime"
  92. v-if="row.feeCnName == '增值税' && brfalse && !editSave"
  93. size="mini"
  94. type="date"
  95. placeholder="选择日期"
  96. format="yyyy-MM-dd"
  97. value-format="yyyy-MM-dd"
  98. >
  99. </el-date-picker>
  100. <span v-else>{{ row.deductionTime }}</span>
  101. </template>
  102. <template slot="reconciliationAmount" slot-scope="{ row }">
  103. <el-popover trigger="click">
  104. <avue-crud :data="rlaData" :option="rlaOption"></avue-crud>
  105. <span style="color: #409EFF;cursor: pointer" slot="reference" @click="viewRLA(row)">{{ row.reconciliationAmount }}</span>
  106. </el-popover>
  107. </template>
  108. <template slot="reconciliationAmountUsd" slot-scope="{ row }">
  109. <el-popover trigger="click">
  110. <avue-crud :data="rlaData" :option="rlaOption"></avue-crud>
  111. <span style="color: #409EFF;cursor: pointer" slot="reference" @click="viewRLA(row)">{{ row.reconciliationAmountUsd }}</span>
  112. </el-popover>
  113. </template>
  114. </avue-crud>
  115. </div>
  116. </template>
  117. <script>
  118. import { getWorkDicts } from "@/api/system/dictbiz";
  119. import SearchQuery from "@/components/iosbasic-data/searchquery.vue";
  120. import { getRateList } from "@/api/iosBasicData/rateManagement";
  121. import costDetails from "@/views/iosBasicData/finstlbills/assembly/costDetails.vue";
  122. import { feecenterSelectByAccNoList } from "@/api/iosBasicData/finstlbills";
  123. import { getListAll } from "@/api/iosBasicData/finstlbills";
  124. export default {
  125. components: { costDetails, SearchQuery },
  126. props: {
  127. tableData: {
  128. type: Array,
  129. default: []
  130. },
  131. brfalse: {
  132. type: Boolean,
  133. default: true
  134. },
  135. handleSelectionData: {
  136. type: Array,
  137. default: []
  138. },
  139. // 是否禁用
  140. editSave: {
  141. type: Boolean,
  142. default: false
  143. },
  144. settlementdistar: {
  145. type: Boolean,
  146. default: false
  147. },
  148. form: {
  149. type: Object,
  150. default: {}
  151. }
  152. },
  153. data() {
  154. return {
  155. rlaData: [],
  156. rlaOption: {
  157. header: false,
  158. menu: false,
  159. align: "center",
  160. column: [
  161. {
  162. label: "来源单号",
  163. prop: "srcNo",
  164. width: "200",
  165. overHidden: true
  166. },
  167. {
  168. label: "来源类型",
  169. prop: "srcType",
  170. width: "80",
  171. overHidden: true
  172. },
  173. {
  174. label: "签收金额",
  175. prop: "signedAmount",
  176. width: "100",
  177. overHidden: true
  178. },
  179. {
  180. label: "签收人",
  181. prop: "consigneeName",
  182. width: "100",
  183. overHidden: true
  184. },
  185. {
  186. label: "签收时间",
  187. prop: "signingTime",
  188. width: "120",
  189. overHidden: true
  190. }
  191. ]
  192. },
  193. ifInvoiceData: [], // 是否数据
  194. invoicelosDara: [], // 发票
  195. curCodeData: [], // 币种
  196. option: {},
  197. optionBack: {
  198. height: "auto",
  199. calcHeight: 30,
  200. menuWidth: 60,
  201. tip: false,
  202. menu: false,
  203. border: true,
  204. addBtn: false,
  205. viewBtn: false,
  206. editBtn: false,
  207. delBtn: false,
  208. refreshBtn: false,
  209. index: true,
  210. selection: true,
  211. align: "center",
  212. column: [
  213. {
  214. label: "核销",
  215. prop: "isCleared",
  216. width: 60,
  217. type: "select",
  218. dicData: [
  219. {
  220. label: "未销账",
  221. value: 0
  222. },
  223. {
  224. label: "已销账",
  225. value: 1
  226. },
  227. {
  228. label: "部分销账",
  229. value: 3
  230. },
  231. {
  232. label: "销账",
  233. value: 9
  234. }
  235. ],
  236. overHidden: true
  237. },
  238. {
  239. label: "收付",
  240. prop: "dc",
  241. width: 60,
  242. type: "select",
  243. dicData: [
  244. {
  245. label: "收",
  246. value: "D"
  247. },
  248. {
  249. label: "付",
  250. value: "C"
  251. }
  252. ],
  253. overHidden: true
  254. },
  255. {
  256. label: "账单编号",
  257. prop: "accBillNo",
  258. width: 120,
  259. overHidden: true
  260. },
  261. {
  262. label: "原业务编号",
  263. prop: "billNo",
  264. width: 120,
  265. overHidden: true
  266. },
  267. {
  268. label: "费用名称",
  269. prop: "feeCnName",
  270. width: 80,
  271. overHidden: true
  272. },
  273. {
  274. label: "客户名称",
  275. prop: "corpCnName",
  276. width: 120,
  277. overHidden: true
  278. },
  279. {
  280. label: "MB/L NO",
  281. prop: "mblno",
  282. width: 100,
  283. overHidden: true
  284. },
  285. {
  286. label: "业务员",
  287. prop: "srcCnName",
  288. width: 80,
  289. overHidden: true
  290. },
  291. {
  292. label: "操作人",
  293. prop: "operatorName",
  294. width: 80,
  295. overHidden: true
  296. },
  297. {
  298. label: "币种",
  299. prop: "currentStlCurCode",
  300. width: 60,
  301. overHidden: true
  302. },
  303. {
  304. label: "汇率",
  305. prop: "currentStlExrate",
  306. width: 80,
  307. overHidden: true
  308. },
  309. {
  310. label: "本次CNY",
  311. prop: "currentStlAmountRMB",
  312. width: 100,
  313. overHidden: true
  314. },
  315. {
  316. label: "本次USD",
  317. prop: "currentStlAmountUSD",
  318. width: 100,
  319. overHidden: true
  320. },
  321. {
  322. label: "已签收CNY",
  323. prop: "reconciliationAmount",
  324. width: 100,
  325. overHidden: true
  326. },
  327. {
  328. label: "已签收USD",
  329. prop: "reconciliationAmountUsd",
  330. width: 100,
  331. overHidden: true
  332. },
  333. {
  334. label: "ETD",
  335. prop: "etd",
  336. width: 90,
  337. overHidden: true
  338. },
  339. {
  340. label: "船名",
  341. prop: "vesselCnName",
  342. width: 90,
  343. overHidden: true
  344. },
  345. {
  346. label: "航次",
  347. prop: "voyageNo",
  348. width: 90,
  349. overHidden: true
  350. },
  351. {
  352. label: "目的港",
  353. prop: "podCnName",
  354. width: 90,
  355. overHidden: true
  356. },
  357. {
  358. label: "箱量",
  359. prop: "quantityCntrTypesDescr",
  360. width: 90,
  361. overHidden: true
  362. },
  363. {
  364. label: "应结算CNY",
  365. prop: "amountRMB",
  366. width: 90,
  367. overHidden: true
  368. },
  369. {
  370. label: "应结算USD",
  371. prop: "amountUSD",
  372. width: 90,
  373. overHidden: true
  374. },
  375. {
  376. label: "已结算CNY",
  377. prop: "stlTtlAmountRMB",
  378. width: 90,
  379. overHidden: true
  380. },
  381. {
  382. label: "已结算USD",
  383. prop: "stlTtlAmountUSD",
  384. width: 90,
  385. overHidden: true
  386. },
  387. {
  388. label: "ETA",
  389. prop: "eta",
  390. width: 120,
  391. overHidden: true
  392. },
  393. {
  394. label: "备注",
  395. prop: "remarkss",
  396. width: 120,
  397. overHidden: true
  398. }
  399. ]
  400. },
  401. page: {
  402. currentPage: 1,
  403. total: 0,
  404. pageSize: 20,
  405. pageSizes: [20, 50, 100, 200, 500]
  406. },
  407. pageData: []
  408. };
  409. },
  410. async created() {
  411. this.option = await this.getColumnData(this.getColumnName(456), this.optionBack);
  412. this.isSignforWorkDicts();
  413. this.invoicelosWorkDictsfun();
  414. },
  415. methods: {
  416. viewRLA(row) {
  417. this.rlaData = [];
  418. getListAll({ billId: row.accBillId }).then(res => {
  419. this.rlaData = res.data.data;
  420. });
  421. },
  422. sizeChange(val) {
  423. this.page.currentPage = 1;
  424. this.page.pageSize = val;
  425. this.getList();
  426. },
  427. currentChange(val) {
  428. this.page.currentPage = val;
  429. this.getList();
  430. },
  431. getList() {
  432. this.page.total = this.tableData.length;
  433. const start = (this.page.currentPage - 1) * this.page.pageSize;
  434. const end = start + this.page.pageSize;
  435. this.pageData = this.tableData.slice(start, end);
  436. },
  437. armbChange(row) {
  438. if (Number(row.amount - row.reconciliationAmount) > 0) {
  439. if (Number(row.currentStlAmountRMB) < 0) {
  440. return this.$message.error("本次金额不能输入负数");
  441. }
  442. if (Number(row.currentStlAmountRMB) > Number(row.amount - row.reconciliationAmount)) {
  443. return this.$message.error("本次金额不能超过未签收金额:" + Number(row.amount - row.reconciliationAmount));
  444. }
  445. }
  446. if (Number(row.amount - row.reconciliationAmount) < 0) {
  447. if (row.currentStlAmountRMB >= 0) {
  448. return this.$message.error("本次金额不能输入非负数");
  449. }
  450. if (Number(row.currentStlAmountRMB) < Number(row.amount - row.reconciliationAmount)) {
  451. return this.$message.error("本次金额不能超过未签收金额:" + Number(row.amount - row.reconciliationAmount));
  452. }
  453. }
  454. },
  455. ausdChange(row) {
  456. if (Number(row.amount - row.reconciliationAmount) > 0) {
  457. if (Number(row.currentStlAmountUSD) < 0) {
  458. return this.$message.error("本次金额不能输入负数");
  459. }
  460. if (Number(row.currentStlAmountUSD) > Number(row.amount - row.reconciliationAmount)) {
  461. return this.$message.error("本次金额不能超过未签收金额:" + Number(row.amount - row.reconciliationAmount));
  462. }
  463. }
  464. if (Number(row.amount - row.reconciliationAmount) < 0) {
  465. if (row.currentStlAmountUSD >= 0) {
  466. return this.$message.error("本次金额不能输入非负数");
  467. }
  468. if (Number(row.currentStlAmountUSD) < Number(row.amount - row.reconciliationAmount)) {
  469. return this.$message.error("本次金额不能超过未签收金额:" + Number(row.amount - row.reconciliationAmount));
  470. }
  471. }
  472. },
  473. // 展开行或者关闭
  474. expandChange(row) {
  475. let accBillId = "";
  476. if (this.form.id) {
  477. accBillId = row.accBillId;
  478. } else {
  479. accBillId = row.id;
  480. }
  481. feecenterSelectByAccNoList({ accBillId }).then(res => {
  482. row.costDate = res.data.data.map(item => {
  483. if (item.curCode == "CNY") {
  484. this.$set(item, "rmbAmount", item.amount);
  485. this.$set(item, "usdAmount", "");
  486. this.$set(item, "rmbAmountNet", item.amountNet);
  487. this.$set(item, "usdAmountNet", "");
  488. } else {
  489. this.$set(item, "usdAmount", item.amount);
  490. this.$set(item, "rmbAmount", "");
  491. this.$set(item, "usdAmountNet", item.amountNet);
  492. this.$set(item, "rmbAmountNet", "");
  493. }
  494. return item;
  495. });
  496. });
  497. },
  498. // 明细删除
  499. deletefun(row, index) {
  500. this.$emit("deletefun", row.id, index);
  501. },
  502. // 币别切换
  503. corpChange(value, row) {
  504. this.$set(row, "currentStlCurCode", value);
  505. if (value == "CNY") {
  506. this.$set(row, "currentStlAmountRMB", Number(row.amount) - Number(row.stlTtlAmount));
  507. } else {
  508. this.$set(row, "currentStlAmountUSD", Number(row.amount) - Number(row.stlTtlAmount));
  509. }
  510. },
  511. // 接口请求
  512. // 是否接口
  513. isSignforWorkDicts() {
  514. getWorkDicts("ifInvoice").then(res => {
  515. this.ifInvoiceData = res.data.data;
  516. });
  517. },
  518. // 发票
  519. invoicelosWorkDictsfun() {
  520. getWorkDicts("invoice_los").then(res => {
  521. this.invoicelosDara = res.data.data;
  522. });
  523. },
  524. // 获取币别数据
  525. getRateListfun(cnName) {
  526. getRateList({ current: 1, size: 10, cnName }).then(res => {
  527. this.curCodeData = res.data.data.records;
  528. });
  529. },
  530. // 表头样式
  531. tableHeaderCellStyle({ row, column, rowIndex, columnIndex }) {
  532. return "padding:4px 0px;fontSize:12px;color:#000;background:#ecf5ff";
  533. },
  534. // 更改表格颜色
  535. headerClassName(tab) {
  536. //颜色间隔
  537. let back = "";
  538. if (tab.columnIndex >= 0 && tab.column.level === 1) {
  539. if (tab.columnIndex % 2 === 0) {
  540. back = "back-one";
  541. } else if (tab.columnIndex % 2 === 1) {
  542. back = "back-two";
  543. }
  544. }
  545. return back;
  546. },
  547. // Element UI 表格点击选中行/取消选中 快捷多选 以及快捷连续多选,高亮选中行 ——-------------------------------------——
  548. // 多选选择的数据
  549. handleSelectionChange(arr) {
  550. // // 全选
  551. // if (arr.length == this.tableData.length) {
  552. // for (let item of arr) {
  553. // this.$set(item,'tableSelect',1)
  554. // }
  555. // }
  556. // // 清除全选
  557. // if (arr.length == 0) {
  558. // for (let item of this.tableData) {
  559. // this.$set(item,'tableSelect',0)
  560. // }
  561. // }
  562. this.$emit("handleSelectionChange", arr);
  563. },
  564. // // 多选
  565. // toggleSelection(rows){
  566. // if (rows) {
  567. // rows.forEach(row => {
  568. // this.$refs.tableRef.toggleRowSelection(row);
  569. // });
  570. // } else {
  571. // this.$refs.tableRef.clearSelection();
  572. // }
  573. // },
  574. // 监听点击表格事件
  575. rowClick(row, column, event) {
  576. let refsElTable = this.$refs.tableRef; // 获取表格对象
  577. if (this.CtrlDown) {
  578. refsElTable.toggleRowSelection(row); // ctrl多选 如果点击两次同样会取消选中
  579. return;
  580. }
  581. if (this.shiftOrAltDown && this.handleSelectionData.length > 0) {
  582. // 通过rowIndex判断已选择的行中最上面和最下面的是哪行,再对比按住shift/alt点击的当前行得到新的最上面和最下面的行,把这两行中间的行进行循环选中。
  583. let topAndBottom = this.getTopAndBottom(row, this.bottomSelectionRow, this.topSelectionRow);
  584. refsElTable.clearSelection(); //先清空 不然会导致在这两行中间之外的行状态不变
  585. for (let index = topAndBottom.top; index <= topAndBottom.bottom; index++) {
  586. //选中两行之间的所有行
  587. refsElTable.toggleRowSelection(this.tableData[index], true);
  588. }
  589. } else {
  590. let findRow = this.handleSelectionData.find(c => c.rowIndex == row.rowIndex); //找出当前选中行
  591. //如果只有一行且点击的也是这一行则取消选择 否则清空再选中当前点击行
  592. if (findRow && this.handleSelectionData.length === 1) {
  593. refsElTable.toggleRowSelection(row, false);
  594. return;
  595. }
  596. // refsElTable.clearSelection(); // 清空之前选择的数据(如果放开,选择之前会变成单选)
  597. refsElTable.toggleRowSelection(row); // 调用选中行方法
  598. }
  599. },
  600. // 行的 style 的回调方法
  601. rowStyle({ row, rowIndex }) {
  602. // 直接在一个对象上定义一个新属性,或者修改一个对象的现有属性,并返回此对象
  603. // object: 要添加或者修改属性的目标对象;prop: 要定义或修改属性的名称;descript: 是一个对象,里面是我们上述的对象属性的特性;
  604. Object.defineProperty(row, "rowIndex", {
  605. //给每一行添加不可枚举属性rowIndex来标识当前行
  606. value: rowIndex, // 设置age的值,不设置的话默认为undefined
  607. writable: true, // 表示属性的值true可以修改,false不可以被修改
  608. enumerable: false // 设置为false表示不能通过 for-in 循环返回
  609. // configurable: false, // configurable 设置为 false,意味着这个属性不能从对象上删除
  610. });
  611. },
  612. keyDown(event) {
  613. let key = event.keyCode;
  614. if (key == 17) this.CtrlDown = true;
  615. if (key == 16 || key == 18) this.shiftOrAltDown = true;
  616. },
  617. keyUp(event) {
  618. let key = event.keyCode;
  619. if (key == 17) this.CtrlDown = false;
  620. if (key == 16 || key == 18) this.shiftOrAltDown = false;
  621. },
  622. // 文章说明 https://www.jianshu.com/p/48f2c522d2a2
  623. getTopAndBottom(row, bottom, top) {
  624. let n = row.rowIndex,
  625. mx = bottom.rowIndex,
  626. mi = top.rowIndex;
  627. if (n > mx) {
  628. return {
  629. top: mi,
  630. bottom: n
  631. };
  632. } else if (n < mx && n > mi) {
  633. return {
  634. top: mi,
  635. bottom: n
  636. };
  637. } else if (n < mi) {
  638. return {
  639. top: n,
  640. bottom: mx
  641. };
  642. } else if (n == mi || n == mx) {
  643. return {
  644. top: mi,
  645. bottom: mx
  646. };
  647. }
  648. },
  649. // 给选中行加上current-row这个class类,所以要使用row-class-name这个属性(其实给每一行添加rowIndex也可以用这个属性),
  650. // 判断方式也是通过判断rowIndex对比
  651. rowClassName({ row, rowIndex }) {
  652. let rowName = "",
  653. findRow = this.handleSelectionData.find(c => c.rowIndex === row.rowIndex);
  654. if (findRow) {
  655. rowName = "current-row"; // elementUI 默认高亮行的class类 不用再样式了^-^,也可通过css覆盖改变背景颜色
  656. }
  657. return rowName; //也可以再加上其他类名 如果有需求的话
  658. },
  659. // 收付展示不一样的颜色
  660. cellStyle({ row, rowIndex, columnIndex }) {
  661. let rowStyle = "";
  662. let bgStyle = "";
  663. if (row.dc == "D") {
  664. rowStyle = "color:#F56C6C;";
  665. } else if (row.dc == "C") {
  666. rowStyle = "color:#67C23A;";
  667. }
  668. if (row.id) {
  669. bgStyle = "background: #f0f9eb;";
  670. }
  671. return rowStyle + "padding:0px;fontSize:12px;" + bgStyle;
  672. },
  673. //自定义列保存
  674. async saveColumn(ref, option, optionBack, code) {
  675. const inSave = await this.saveColumnData(this.getColumnName(code), this[option]);
  676. if (inSave) {
  677. this.$message.success("保存成功");
  678. //关闭窗口
  679. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  680. }
  681. },
  682. //自定义列重置
  683. async resetColumn(ref, option, optionBack, code) {
  684. this[option] = this[optionBack];
  685. const inSave = await this.delColumnData(this.getColumnName(code), this[optionBack]);
  686. if (inSave) {
  687. this.$message.success("重置成功");
  688. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  689. }
  690. }
  691. },
  692. mounted() {
  693. // 按住ctrl实现多选 设置监听keydown事件,以及keyup事件,
  694. addEventListener("keydown", this.keyDown, false);
  695. addEventListener("keyup", this.keyUp, false);
  696. },
  697. beforeDestroy() {
  698. //解绑
  699. removeEventListener("keydown", this.keyDown);
  700. removeEventListener("keyup", this.keyUp);
  701. },
  702. watch: {
  703. tableData: {
  704. // 执行方法
  705. handler(oldValue, newValue) {
  706. this.page.currentPage = 1;
  707. this.pageData = [];
  708. this.getList();
  709. },
  710. deep: true, // 深度监听
  711. immediate: true // 第一次改变就执行
  712. }
  713. },
  714. computed: {
  715. //实时得到最上行和最下行
  716. bottomSelectionRow() {
  717. if (this.handleSelectionData.length == 0) return null;
  718. return this.handleSelectionData.reduce((start, end) => {
  719. return start.rowIndex > end.rowIndex ? start : end;
  720. });
  721. },
  722. topSelectionRow() {
  723. if (this.handleSelectionData.length == 0) return null;
  724. return this.handleSelectionData.reduce((start, end) => {
  725. return start.rowIndex < end.rowIndex ? start : end;
  726. });
  727. }
  728. }
  729. };
  730. </script>
  731. <style scoped>
  732. .textHide {
  733. width: 100%;
  734. overflow: hidden;
  735. white-space: nowrap;
  736. text-overflow: ellipsis;
  737. }
  738. </style>