finstlbillsitems.vue 23 KB

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