fee-info.vue 36 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802
  1. <template>
  2. <div>
  3. <avue-crud :option="optionD" :table-loading="loading" :data="form.feeCenterListD" id="out-table" ref="crudD"
  4. @selection-change="selectionDChange" @resetColumn="resetColumn('crudD', 'optionD', 'optionDBack', 381)"
  5. @saveColumn="saveColumn('crudD', 'optionD', 'optionDBack', 381)">
  6. <template slot="menuLeft">
  7. <div style="display: inline-block;margin-right: 20px" class="disabledBox fontSize">
  8. <i class="el-icon-coin"></i>
  9. <span>应收费用</span>
  10. </div>
  11. <el-button type="info" plain size="small" :disabled="disabled"
  12. @click="allClick('一键保存', 'D')">一键保存</el-button>
  13. <el-button type="info" plain size="small" :disabled="disabled"
  14. @click="allClick('一键编辑', 'D')">一键编辑</el-button>
  15. <el-button type="danger" plain size="small" :disabled="disabled || selectionDList.length == 0"
  16. @click="allClick('批量删除', 'D')">批量删除</el-button>
  17. <el-button type="primary" plain size="small" :disabled="disabled || selectionDList.length == 0"
  18. @click="allClick('生成账单', 'D')">生成账单</el-button>
  19. <el-button type="danger" plain size="small" :disabled="disabled || selectionDList.length == 0"
  20. @click="allClick('撤销账单', 'D')">撤销账单</el-button>
  21. <!-- <el-button type="primary" plain size="small" :disabled="disabled"
  22. @click="allClick('打印账单', 'D')">打印账单</el-button>
  23. <el-button type="success" plain size="small" :disabled="disabled"
  24. @click="allClick('应收模板', 'D')">应收模板</el-button>
  25. <el-button type="primary" plain size="small" :disabled="disabled"
  26. @click="allClick('生成应收', 'D')">生成应收</el-button> -->
  27. </template>
  28. <template slot="indexHeader" slot-scope="{row,index}">
  29. <el-button type="primary" size="mini" icon="el-icon-plus" :disabled="disabled" circle @click="addRow('D')">
  30. </el-button>
  31. </template>
  32. <template slot="index" slot-scope="{row,index}">
  33. <span>{{ index + 1 }}</span>
  34. </template>
  35. <template slot="corpCnName" slot-scope="{ row }">
  36. <dic-select v-if="row.$cellEdit" v-model="row.corpCnName" placeholder="往来单位" key="id" label="cnName"
  37. res="records" url="/blade-los/bcorps/listByType" :filterable="true" :remote="true" dataName="cnName"
  38. @selectChange="rowDicChange('corpCnName', $event, row)"></dic-select>
  39. <span v-else>{{ row.corpCnName }}</span>
  40. </template>
  41. <template slot="feeCnName" slot-scope="{ row }">
  42. <dic-select v-if="row.$cellEdit" v-model="row.feeCnName" placeholder="费用名称" key="id" label="cnName"
  43. res="records" url="/blade-los/bfees/list" :filterable="true" :remote="true" dataName="cnName"
  44. @selectChange="rowDicChange('feeCnName', $event, row)"></dic-select>
  45. <span v-else>{{ row.feeCnName }}</span>
  46. </template>
  47. <template slot="unitNo" slot-scope="{ row }">
  48. <dic-select v-if="row.$cellEdit" v-model="row.unitNo" placeholder="收费标准" key="id" label="code"
  49. url="/blade-los/bunits/selectList" :filterable="true"
  50. @selectChange="rowDicChange('unitNo', $event, row)"></dic-select>
  51. <span v-else>{{ row.unitNo }}</span>
  52. </template>
  53. <tempalte slot="quantity" slot-scope="{ row }">
  54. <el-input-number v-if="row.$cellEdit" v-model="row.quantity" @change="countChange(row)" :controls="false"
  55. placeholder="请输入 数量" size="small" style="width: 100%;"></el-input-number>
  56. <span v-else>{{ row.quantity }}</span>
  57. </tempalte>
  58. <tempalte slot="price" slot-scope="{ row }">
  59. <el-input-number v-if="row.$cellEdit" v-model="row.price" @change="countChange(row)" :controls="false"
  60. placeholder="请输入 单价" size="small" style="width: 100%;"></el-input-number>
  61. <span v-else>{{ row.price }}</span>
  62. </tempalte>
  63. <template slot="curCode" slot-scope="{ row }">
  64. <dic-select v-if="row.$cellEdit" v-model="row.curCode" placeholder="币别" key="id" label="code"
  65. :url="'/blade-los/bcurrency/getExrate?date=' + form.contractDate + '&dc=' + row.dc" :filterable="true"
  66. @selectChange="rowDicChange('curCode', $event, row)"></dic-select>
  67. <span v-else>{{ row.curCode }}</span>
  68. </template>
  69. <tempalte slot="exrate" slot-scope="{ row }">
  70. <el-input-number v-if="row.$cellEdit" v-model="row.exrate" @change="countChange(row)" :controls="false"
  71. placeholder="请输入 汇率" size="small" style="width: 100%;"></el-input-number>
  72. <span v-else>{{ row.exrate }}</span>
  73. </tempalte>
  74. <tempalte slot="stlExrate" slot-scope="{ row }">
  75. <el-input-number v-if="row.$cellEdit" v-model="row.stlExrate" :controls="false" placeholder="请输入 结算汇率"
  76. size="small" style="width: 100%;"></el-input-number>
  77. <span v-else>{{ row.stlExrate }}</span>
  78. </tempalte>
  79. </avue-crud>
  80. <avue-crud style="margin-top: 10px;" :option="optionC" :table-loading="loading" :data="form.feeCenterListC"
  81. id="out-table" ref="crudC" @selection-change="selectionCChange"
  82. @resetColumn="resetColumn('crudC', 'optionC', 'optionCBack', 382)"
  83. @saveColumn="saveColumn('crudC', 'optionC', 'optionCBack', 382)">
  84. <template slot="menuLeft">
  85. <div style="display: inline-block;margin-right: 20px" class="disabledBox fontSize">
  86. <i class="el-icon-coin"></i>
  87. <span>应付费用</span>
  88. </div>
  89. <el-button type="info" plain size="small" :disabled="disabled"
  90. @click="allClick('一键保存', 'C')">一键保存</el-button>
  91. <el-button type="info" plain size="small" :disabled="disabled"
  92. @click="allClick('一键编辑', 'C')">一键编辑</el-button>
  93. <el-button type="danger" plain size="small" :disabled="disabled || selectionCList.length == 0"
  94. @click="allClick('批量删除', 'C')">批量删除</el-button>
  95. <el-button type="primary" plain size="small" :disabled="disabled || selectionCList.length == 0"
  96. @click="allClick('生成账单', 'C')">生成账单</el-button>
  97. <el-button type="danger" plain size="small" :disabled="disabled || selectionCList.length == 0"
  98. @click="allClick('撤销账单', 'C')">撤销账单</el-button>
  99. <!-- <el-button type="primary" plain size="small" :disabled="disabled"
  100. @click="allClick('打印账单', 'C')">打印账单</el-button>
  101. <el-button type="success" plain size="small" :disabled="disabled"
  102. @click="allClick('应付模板', 'C')">应付模板</el-button>
  103. <el-button type="primary" plain size="small" :disabled="disabled"
  104. @click="allClick('生成应付', 'C')">生成应付</el-button> -->
  105. </template>
  106. <template slot="indexHeader" slot-scope="{row,index}">
  107. <el-button type="primary" size="mini" icon="el-icon-plus" :disabled="disabled" circle @click="addRow('C')">
  108. </el-button>
  109. </template>
  110. <template slot="index" slot-scope="{row,index}">
  111. <span>{{ index + 1 }}</span>
  112. </template>
  113. <template slot="corpCnName" slot-scope="{ row }">
  114. <dic-select v-if="row.$cellEdit" v-model="row.corpCnName" placeholder="往来单位" key="id" label="cnName"
  115. res="records" url="/blade-los/bcorps/listByType" :filterable="true" :remote="true" dataName="cnName"
  116. @selectChange="rowDicChange('corpCnName', $event, row)"></dic-select>
  117. <span v-else>{{ row.corpCnName }}</span>
  118. </template>
  119. <template slot="feeCnName" slot-scope="{ row }">
  120. <dic-select v-if="row.$cellEdit" v-model="row.feeCnName" placeholder="费用名称" key="id" label="cnName"
  121. res="records" url="/blade-los/bfees/list" :filterable="true" :remote="true" dataName="cnName"
  122. @selectChange="rowDicChange('feeCnName', $event, row)"></dic-select>
  123. <span v-else>{{ row.feeCnName }}</span>
  124. </template>
  125. <template slot="unitNo" slot-scope="{ row }">
  126. <dic-select v-if="row.$cellEdit" v-model="row.unitNo" placeholder="收费标准" key="id" label="code"
  127. url="/blade-los/bunits/selectList" :filterable="true"
  128. @selectChange="rowDicChange('unitNo', $event, row)"></dic-select>
  129. <span v-else>{{ row.unitNo }}</span>
  130. </template>
  131. <tempalte slot="quantity" slot-scope="{ row }">
  132. <el-input-number v-if="row.$cellEdit" v-model="row.quantity" @change="countChange(row)" :controls="false"
  133. placeholder="请输入 数量" size="small" style="width: 100%;"></el-input-number>
  134. <span v-else>{{ row.quantity }}</span>
  135. </tempalte>
  136. <tempalte slot="price" slot-scope="{ row }">
  137. <el-input-number v-if="row.$cellEdit" v-model="row.price" @change="countChange(row)" :controls="false"
  138. placeholder="请输入 单价" size="small" style="width: 100%;"></el-input-number>
  139. <span v-else>{{ row.price }}</span>
  140. </tempalte>
  141. <template slot="curCode" slot-scope="{ row }">
  142. <dic-select v-if="row.$cellEdit" v-model="row.curCode" placeholder="币别" key="id" label="code"
  143. :url="'/blade-los/bcurrency/getExrate?date=' + form.contractDate + '&dc=' + row.dc" :filterable="true"
  144. @selectChange="rowDicChange('curCode', $event, row)"></dic-select>
  145. <span v-else>{{ row.curCode }}</span>
  146. </template>
  147. <tempalte slot="exrate" slot-scope="{ row }">
  148. <el-input-number v-if="row.$cellEdit" v-model="row.exrate" @change="countChange(row)" :controls="false"
  149. placeholder="请输入 汇率" size="small" style="width: 100%;"></el-input-number>
  150. <span v-else>{{ row.exrate }}</span>
  151. </tempalte>
  152. <tempalte slot="stlExrate" slot-scope="{ row }">
  153. <el-input-number v-if="row.$cellEdit" v-model="row.stlExrate" :controls="false" placeholder="请输入 结算汇率"
  154. size="small" style="width: 100%;"></el-input-number>
  155. <span v-else>{{ row.stlExrate }}</span>
  156. </tempalte>
  157. </avue-crud>
  158. </div>
  159. </template>
  160. <script>
  161. import dicSelect from "@/components/dicSelect/main";
  162. import { bcurrencyGetExrate } from "@/api/iosBasicData/rateManagement";
  163. import { submitListTrade, feeRemove, generateBill, revokeBill } from "@/api/tradeAgency/tradeAgency";
  164. import _ from "lodash";
  165. export default {
  166. components: {
  167. dicSelect
  168. },
  169. props: {
  170. detailData: {},
  171. disabled: {
  172. type: Boolean,
  173. default: false,
  174. },
  175. form: {
  176. type: Object,
  177. default: () => {
  178. }
  179. }
  180. },
  181. data() {
  182. return {
  183. optionD: {},
  184. optionDBack: {
  185. height: 'auto',
  186. calcHeight: 30,
  187. menuWidth: 140,
  188. tip: false,
  189. border: true,
  190. addBtn: false,
  191. viewBtn: false,
  192. editBtn: false,
  193. delBtn: false,
  194. menu: false,
  195. refreshBtn: false,
  196. selection: true,
  197. align: 'center',
  198. column: [
  199. {
  200. label: "index",
  201. prop: "index",
  202. width: "55",
  203. headerslot: true,
  204. },
  205. {
  206. label: "账单",
  207. prop: "accStatus",
  208. width: '80',
  209. overHidden: true,
  210. dicData: [{
  211. label: '否',
  212. value: 0
  213. }, {
  214. label: '是',
  215. value: 1
  216. }]
  217. },
  218. {
  219. label: "往来单位",
  220. prop: "corpCnName",
  221. width: '160',
  222. overHidden: true,
  223. },
  224. {
  225. label: "提单号",
  226. prop: "mblno",
  227. width: '160',
  228. overHidden: true,
  229. },
  230. {
  231. label: "费用名称",
  232. prop: "feeCnName",
  233. width: '120',
  234. overHidden: true,
  235. },
  236. {
  237. label: "收费标准",
  238. prop: "unitNo",
  239. width: '120',
  240. overHidden: true,
  241. },
  242. {
  243. label: "单价",
  244. prop: "price",
  245. overHidden: true,
  246. },
  247. {
  248. label: "数量",
  249. prop: "quantity",
  250. overHidden: true,
  251. },
  252. {
  253. label: "金额",
  254. prop: "amount",
  255. overHidden: true,
  256. },
  257. {
  258. label: "币别",
  259. prop: "curCode",
  260. overHidden: true,
  261. },
  262. {
  263. label: "外币金额",
  264. prop: "amountLoc",
  265. overHidden: true,
  266. },
  267. {
  268. label: "汇率",
  269. prop: "exrate",
  270. overHidden: true,
  271. },
  272. {
  273. label: "结算汇率",
  274. prop: "stlExrate",
  275. overHidden: true,
  276. },
  277. {
  278. label: "备注",
  279. prop: "remarks",
  280. cell: true,
  281. width: '200',
  282. overHidden: true,
  283. },
  284. ]
  285. },
  286. optionC: {},
  287. optionCBack: {
  288. height: 'auto',
  289. calcHeight: 30,
  290. menuWidth: 140,
  291. tip: false,
  292. border: true,
  293. addBtn: false,
  294. viewBtn: false,
  295. editBtn: false,
  296. delBtn: false,
  297. menu: false,
  298. refreshBtn: false,
  299. selection: true,
  300. align: 'center',
  301. column: [
  302. {
  303. label: "index",
  304. prop: "index",
  305. width: "55",
  306. headerslot: true,
  307. },
  308. {
  309. label: "账单",
  310. prop: "accStatus",
  311. width: '80',
  312. overHidden: true,
  313. dicData: [{
  314. label: '否',
  315. value: 0
  316. }, {
  317. label: '是',
  318. value: 1
  319. }]
  320. },
  321. {
  322. label: "往来单位",
  323. prop: "corpCnName",
  324. width: '160',
  325. overHidden: true,
  326. },
  327. {
  328. label: "提单号",
  329. prop: "mblno",
  330. width: '160',
  331. overHidden: true,
  332. },
  333. {
  334. label: "费用名称",
  335. prop: "feeCnName",
  336. width: '120',
  337. overHidden: true,
  338. },
  339. {
  340. label: "收费标准",
  341. prop: "unitNo",
  342. width: '120',
  343. overHidden: true,
  344. },
  345. {
  346. label: "单价",
  347. prop: "price",
  348. overHidden: true,
  349. },
  350. {
  351. label: "数量",
  352. prop: "quantity",
  353. overHidden: true,
  354. },
  355. {
  356. label: "金额",
  357. prop: "amount",
  358. overHidden: true,
  359. },
  360. {
  361. label: "币别",
  362. prop: "curCode",
  363. overHidden: true,
  364. },
  365. {
  366. label: "外币金额",
  367. prop: "amountLoc",
  368. overHidden: true,
  369. },
  370. {
  371. label: "汇率",
  372. prop: "exrate",
  373. overHidden: true,
  374. },
  375. {
  376. label: "结算汇率",
  377. prop: "stlExrate",
  378. overHidden: true,
  379. },
  380. {
  381. label: "优惠汇率",
  382. prop: "discountExrate",
  383. cell: true,
  384. type: 'number',
  385. controls: false,
  386. width: "120",
  387. overHidden: true,
  388. },
  389. {
  390. label: "利润",
  391. prop: "profit",
  392. overHidden: true,
  393. },
  394. {
  395. label: "备注",
  396. prop: "remarks",
  397. cell: true,
  398. width: '200',
  399. overHidden: true,
  400. },
  401. ]
  402. },
  403. selectionDList: [],
  404. selectionCList: []
  405. }
  406. },
  407. async created() {
  408. this.optionD = await this.getColumnData(this.getColumnName(381), this.optionDBack);
  409. this.optionC = await this.getColumnData(this.getColumnName(382), this.optionCBack);
  410. },
  411. methods: {
  412. addRow(type) {
  413. if (!this.form.id) return this.$message.error('请保存数据');
  414. if (type == 'D') {
  415. this.form.feeCenterListD.push({
  416. $cellEdit: true,
  417. pid: this.form.id,
  418. dc: type,
  419. accStatus: 0,
  420. businessType: this.form.businessType,
  421. billNo: this.form.businessNo,
  422. billDate: this.form.businessDate
  423. })
  424. }
  425. if (type == 'C') {
  426. this.form.feeCenterListC.push({
  427. $cellEdit: true,
  428. pid: this.form.id,
  429. dc: type,
  430. accStatus: 0,
  431. businessType: this.form.businessType,
  432. billNo: this.form.businessNo,
  433. billDate: this.form.businessDate
  434. })
  435. }
  436. },
  437. countChange(row) {
  438. row.amount = _.multiply(Number(row.quantity ? row.quantity : 0), Number(row.price ? row.price : 0))
  439. if (row.feeCode== 'SFK' || row.feeCode == 'WK') {
  440. row.amount = _.multiply(Number(row.amountLoc ? row.amountLoc : 0), Number(row.exrate ? row.exrate : 0))
  441. }
  442. },
  443. selectionDChange(list) {
  444. this.selectionDList = list
  445. },
  446. selectionCChange(list) {
  447. this.selectionCList = list
  448. },
  449. rowDicChange(name, row, el) {
  450. if (name == 'corpCnName') {
  451. if (row) {
  452. el.corpId = row.id
  453. el.corpEnName = row.enName
  454. el.billCorpId = row.id
  455. el.billCorpCnName = row.cnName
  456. } else {
  457. el.corpId = null
  458. el.corpEnName = null
  459. el.billCorpId = null
  460. el.billCorpCnName = null
  461. }
  462. }
  463. if (name == 'feeCnName') {
  464. if (row) {
  465. el.feeId = row.id
  466. el.feeCode = row.code
  467. el.feeEnName = row.enName
  468. el.curCode = row.curNo
  469. el.elementsId = row.accElementId
  470. el.elementsCode = row.elementsCode
  471. el.elementsCnName = row.accElementName
  472. el.elementsEnName = row.elementsEnName
  473. bcurrencyGetExrate({ date: this.form.contractDate, dc: el.dc }).then(res => {
  474. res.data.data.forEach(e => {
  475. if (row.curNo == e.code) {
  476. this.$set(el, 'exrate', e.exrate)
  477. }
  478. })
  479. })
  480. } else {
  481. el.feeId = null
  482. el.feeCode = null
  483. el.feeEnName = null
  484. el.curCode = null
  485. el.elementsId = null
  486. el.elementsCode = null
  487. el.elementsCnName = null
  488. el.elementsEnName = null
  489. }
  490. }
  491. if (name == 'curCode') {
  492. if (row) {
  493. bcurrencyGetExrate({ date: this.form.contractDate, dc: el.dc }).then(res => {
  494. res.data.data.forEach(e => {
  495. if (el.curCode == e.code) {
  496. this.$set(el, 'exrate', e.exrate)
  497. }
  498. })
  499. })
  500. } else {
  501. el.exrate = null
  502. }
  503. }
  504. },
  505. allClick(name, type) {
  506. if (name == '一键保存') {
  507. if (type == 'D') {
  508. this.form.feeCenterListD.forEach(e => {
  509. this.$set(e, '$cellEdit', false)
  510. })
  511. const loading = this.$loading({
  512. lock: true,
  513. text: '加载中',
  514. spinner: 'el-icon-loading',
  515. background: 'rgba(255,255,255,0.7)'
  516. });
  517. submitListTrade(this.form.feeCenterListD).then(res => {
  518. this.form.feeCenterListD = res.data.data
  519. this.$message.success("保存成功");
  520. }).finally(() => {
  521. loading.close();
  522. })
  523. }
  524. if (type == 'C') {
  525. for (let index in this.form.feeCenterListC) {
  526. if (this.form.feeCenterListC[index].feeCnName == '首款' || this.form.feeCenterListC[index].feeCnName == '尾款') {
  527. if (!this.form.feeCenterListC[index].discountExrate) return this.$message.error("第" + (Number(index) + 1) + "行"+this.form.feeCenterListC[index].feeCnName+"费用优惠汇率不能为空");
  528. }
  529. }
  530. this.form.feeCenterListC.forEach(e => {
  531. this.$set(e, '$cellEdit', false)
  532. })
  533. const loading = this.$loading({
  534. lock: true,
  535. text: '加载中',
  536. spinner: 'el-icon-loading',
  537. background: 'rgba(255,255,255,0.7)'
  538. });
  539. submitListTrade(this.form.feeCenterListC).then(res => {
  540. this.form.feeCenterListC = res.data.data
  541. this.$message.success("保存成功");
  542. }).finally(() => {
  543. loading.close();
  544. })
  545. }
  546. }
  547. if (name == '一键编辑') {
  548. if (type == 'D') {
  549. this.form.feeCenterListD.forEach(e => {
  550. this.$set(e, '$cellEdit', true)
  551. })
  552. }
  553. if (type == 'C') {
  554. this.form.feeCenterListC.forEach(e => {
  555. this.$set(e, '$cellEdit', true)
  556. })
  557. }
  558. }
  559. if (name == '批量删除') {
  560. let multiList = []
  561. let arr = []
  562. for (let index in this.selectionDList) {
  563. if (this.selectionDList[index].accStatus == 1) return this.$message.error("第" + (Number(this.selectionDList[index].$index) + 1) + "行不允许删除");
  564. }
  565. for (let index in this.selectionCList) {
  566. if (this.selectionCList[index].accStatus == 1) return this.$message.error("第" + (Number(this.selectionCList[index].$index) + 1) + "行不允许删除");
  567. }
  568. if (type == 'D') {
  569. this.$confirm("确定将选择数据删除?", {
  570. confirmButtonText: "确定",
  571. cancelButtonText: "取消",
  572. type: "warning"
  573. }).then(() => {
  574. multiList = this.selectionDList
  575. arr = this.form.feeCenterListD
  576. // 获取有id 的数据
  577. const itemsWithId = multiList.filter(item => item.hasOwnProperty('id'));
  578. let arrIds = itemsWithId.map(item => item.id) // 获取id 数据
  579. // 把选中的删除掉
  580. multiList.forEach((item) => {
  581. for (let index in arr) {
  582. if (JSON.stringify(item) == JSON.stringify(arr[index])) {
  583. arr.splice(Number(index), 1)
  584. }
  585. }
  586. })
  587. if (itemsWithId.length != 0) {
  588. const loading = this.$loading({
  589. lock: true,
  590. text: '加载中',
  591. spinner: 'el-icon-loading',
  592. background: 'rgba(255,255,255,0.7)'
  593. });
  594. feeRemove({ ids: arrIds.join(',') }).then(res => {
  595. this.$message.success("删除成功");
  596. }).finally(() => {
  597. loading.close();
  598. })
  599. }
  600. })
  601. }
  602. if (type == 'C') {
  603. this.$confirm("确定将选择数据删除?", {
  604. confirmButtonText: "确定",
  605. cancelButtonText: "取消",
  606. type: "warning"
  607. }).then(() => {
  608. multiList = this.selectionCList
  609. arr = this.form.feeCenterListC
  610. // 获取有id 的数据
  611. const itemsWithId = multiList.filter(item => item.hasOwnProperty('id'));
  612. let arrIds = itemsWithId.map(item => item.id) // 获取id 数据
  613. // 把选中的删除掉
  614. multiList.forEach((item) => {
  615. for (let index in arr) {
  616. if (JSON.stringify(item) == JSON.stringify(arr[index])) {
  617. arr.splice(Number(index), 1)
  618. }
  619. }
  620. })
  621. if (itemsWithId.length != 0) {
  622. const loading = this.$loading({
  623. lock: true,
  624. text: '加载中',
  625. spinner: 'el-icon-loading',
  626. background: 'rgba(255,255,255,0.7)'
  627. });
  628. feeRemove({ ids: arrIds.join(',') }).then(res => {
  629. this.$message.success("删除成功");
  630. }).finally(() => {
  631. loading.close();
  632. })
  633. }
  634. })
  635. }
  636. }
  637. if (name == '生成账单') {
  638. if (type == 'D') {
  639. for (let index in this.selectionDList) {
  640. if (this.selectionDList[index].accStatus != 0) {
  641. return this.$message.error("已生成账单");
  642. }
  643. }
  644. this.$confirm("确定将选择数据生成账单?", {
  645. confirmButtonText: "确定",
  646. cancelButtonText: "取消",
  647. type: "warning"
  648. }).then(() => {
  649. const loading = this.$loading({
  650. lock: true,
  651. text: '加载中',
  652. spinner: 'el-icon-loading',
  653. background: 'rgba(255,255,255,0.7)'
  654. });
  655. generateBill({ id: this.form.id, feeCenterListD: this.selectionDList }).then(res => {
  656. this.$message.success("成功生成账单");
  657. this.$emit('getDetails', this.form.id)
  658. }).finally(() => {
  659. loading.close();
  660. })
  661. })
  662. }
  663. if (type == 'C') {
  664. for (let index in this.selectionCList) {
  665. if (this.selectionCList[index].accStatus != 0) {
  666. return this.$message.error("已生成账单");
  667. }
  668. }
  669. this.$confirm("确定将选择数据生成账单?", {
  670. confirmButtonText: "确定",
  671. cancelButtonText: "取消",
  672. type: "warning"
  673. }).then(() => {
  674. const loading = this.$loading({
  675. lock: true,
  676. text: '加载中',
  677. spinner: 'el-icon-loading',
  678. background: 'rgba(255,255,255,0.7)'
  679. });
  680. generateBill({ id: this.form.id, feeCenterListC: this.selectionCList }).then(res => {
  681. this.$message.success("成功生成账单");
  682. this.$emit('getDetails', this.form.id)
  683. }).finally(() => {
  684. loading.close();
  685. })
  686. })
  687. }
  688. }
  689. if (name == '撤销账单') {
  690. if (type == 'D') {
  691. for (let index in this.selectionDList) {
  692. if (this.selectionDList[index].accStatus != 1) {
  693. return this.$message.error("未生成账单");
  694. }
  695. }
  696. this.$confirm("确定将选择数据撤销账单?", {
  697. confirmButtonText: "确定",
  698. cancelButtonText: "取消",
  699. type: "warning"
  700. }).then(() => {
  701. const loading = this.$loading({
  702. lock: true,
  703. text: '加载中',
  704. spinner: 'el-icon-loading',
  705. background: 'rgba(255,255,255,0.7)'
  706. });
  707. revokeBill({ id: this.form.id, feeCenterListD: this.selectionDList }).then(res => {
  708. this.$message.success("成功撤销账单");
  709. this.$emit('getDetails', this.form.id)
  710. }).finally(() => {
  711. loading.close();
  712. })
  713. })
  714. }
  715. if (type == 'C') {
  716. for (let index in this.selectionCList) {
  717. if (this.selectionCList[index].accStatus != 1) {
  718. return this.$message.error("未生成账单");
  719. }
  720. }
  721. this.$confirm("确定将选择数据撤销账单?", {
  722. confirmButtonText: "确定",
  723. cancelButtonText: "取消",
  724. type: "warning"
  725. }).then(() => {
  726. const loading = this.$loading({
  727. lock: true,
  728. text: '加载中',
  729. spinner: 'el-icon-loading',
  730. background: 'rgba(255,255,255,0.7)'
  731. });
  732. revokeBill({ id: this.form.id, feeCenterListC: this.selectionCList }).then(res => {
  733. this.$message.success("成功撤销账单");
  734. this.$emit('getDetails', this.form.id)
  735. }).finally(() => {
  736. loading.close();
  737. })
  738. })
  739. }
  740. }
  741. },
  742. //自定义列保存
  743. async saveColumn(ref, option, optionBack, code) {
  744. /**
  745. * 已定义全局方法,直接使用,saveColumnData保存列数据方法,参数传值(表格名称,当前表格的option数据)
  746. * 已定义全局方法,直接使用,getColumnName方法用来获取枚举值,参数根据自己定义的code值获取中文名
  747. * 一定要执行异步操作,要等接口成功返回,才能执行下一行代码
  748. */
  749. const inSave = await this.saveColumnData(this.getColumnName(code), this[option]);
  750. if (inSave) {
  751. this.$message.success("保存成功");
  752. //关闭窗口
  753. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  754. }
  755. },
  756. //自定义列重置
  757. async resetColumn(ref, option, optionBack, code) {
  758. this[option] = this[optionBack];
  759. const inSave = await this.delColumnData(this.getColumnName(code), this[optionBack]);
  760. if (inSave) {
  761. this.$message.success("重置成功");
  762. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  763. }
  764. },
  765. },
  766. }
  767. </script>
  768. <style scoped lang="scss">
  769. .disabledBox {
  770. display: flex;
  771. align-items: center;
  772. }
  773. .fontSize {
  774. font-size: 16px;
  775. color: #81B337;
  776. }
  777. .meetSize {
  778. font-size: 16px;
  779. color: #54BCBD;
  780. }
  781. ::v-deep#out-table .back-one {
  782. background: #ecf5ff !important;
  783. text-align: center;
  784. padding: 4px 0;
  785. }
  786. ::v-deep#out-table .back-two {
  787. background: #ecf5ff !important;
  788. text-align: center;
  789. padding: 4px 0;
  790. }
  791. </style>