fee-info.vue 35 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771
  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: "feeCnName",
  227. width: '120',
  228. overHidden: true,
  229. },
  230. {
  231. label: "收费标准",
  232. prop: "unitNo",
  233. width: '120',
  234. overHidden: true,
  235. },
  236. {
  237. label: "单价",
  238. prop: "price",
  239. overHidden: true,
  240. },
  241. {
  242. label: "数量",
  243. prop: "quantity",
  244. overHidden: true,
  245. },
  246. {
  247. label: "金额",
  248. prop: "amount",
  249. overHidden: true,
  250. },
  251. {
  252. label: "币别",
  253. prop: "curCode",
  254. overHidden: true,
  255. },
  256. {
  257. label: "外币金额",
  258. prop: "amountLoc",
  259. overHidden: true,
  260. },
  261. {
  262. label: "汇率",
  263. prop: "exrate",
  264. overHidden: true,
  265. },
  266. {
  267. label: "结算汇率",
  268. prop: "stlExrate",
  269. overHidden: true,
  270. },
  271. {
  272. label: "备注",
  273. prop: "remarks",
  274. cell: true,
  275. width: '200',
  276. overHidden: true,
  277. },
  278. ]
  279. },
  280. optionC: {},
  281. optionCBack: {
  282. height: 'auto',
  283. calcHeight: 30,
  284. menuWidth: 140,
  285. tip: false,
  286. border: true,
  287. addBtn: false,
  288. viewBtn: false,
  289. editBtn: false,
  290. delBtn: false,
  291. menu: false,
  292. refreshBtn: false,
  293. selection: true,
  294. align: 'center',
  295. column: [
  296. {
  297. label: "index",
  298. prop: "index",
  299. width: "55",
  300. headerslot: true,
  301. },
  302. {
  303. label: "账单",
  304. prop: "accStatus",
  305. width: '80',
  306. overHidden: true,
  307. dicData: [{
  308. label: '否',
  309. value: 0
  310. }, {
  311. label: '是',
  312. value: 1
  313. }]
  314. },
  315. {
  316. label: "往来单位",
  317. prop: "corpCnName",
  318. width: '160',
  319. overHidden: true,
  320. },
  321. {
  322. label: "费用名称",
  323. prop: "feeCnName",
  324. width: '120',
  325. overHidden: true,
  326. },
  327. {
  328. label: "收费标准",
  329. prop: "unitNo",
  330. width: '120',
  331. overHidden: true,
  332. },
  333. {
  334. label: "单价",
  335. prop: "price",
  336. overHidden: true,
  337. },
  338. {
  339. label: "数量",
  340. prop: "quantity",
  341. overHidden: true,
  342. },
  343. {
  344. label: "金额",
  345. prop: "amount",
  346. overHidden: true,
  347. },
  348. {
  349. label: "币别",
  350. prop: "curCode",
  351. overHidden: true,
  352. },
  353. {
  354. label: "外币金额",
  355. prop: "amountLoc",
  356. overHidden: true,
  357. },
  358. {
  359. label: "汇率",
  360. prop: "exrate",
  361. overHidden: true,
  362. },
  363. {
  364. label: "结算汇率",
  365. prop: "stlExrate",
  366. overHidden: true,
  367. },
  368. {
  369. label: "备注",
  370. prop: "remarks",
  371. cell: true,
  372. width: '200',
  373. overHidden: true,
  374. },
  375. ]
  376. },
  377. selectionDList: [],
  378. selectionCList: []
  379. }
  380. },
  381. async created() {
  382. this.optionD = await this.getColumnData(this.getColumnName(381), this.optionDBack);
  383. this.optionC = await this.getColumnData(this.getColumnName(382), this.optionCBack);
  384. },
  385. methods: {
  386. addRow(type) {
  387. if (!this.form.id) return this.$message.error('请保存数据');
  388. if (type == 'D') {
  389. this.form.feeCenterListD.push({
  390. $cellEdit: true,
  391. pid: this.form.id,
  392. dc: type,
  393. accStatus: 0,
  394. businessType: this.form.businessType,
  395. billNo: this.form.businessNo,
  396. billDate: this.form.businessDate
  397. })
  398. }
  399. if (type == 'C') {
  400. this.form.feeCenterListC.push({
  401. $cellEdit: true,
  402. pid: this.form.id,
  403. dc: type,
  404. accStatus: 0,
  405. businessType: this.form.businessType,
  406. billNo: this.form.businessNo,
  407. billDate: this.form.businessDate
  408. })
  409. }
  410. },
  411. countChange(row) {
  412. row.amount = _.multiply(Number(row.quantity ? row.quantity : 0), Number(row.price ? row.price : 0))
  413. if (row.feeCnName == '首付款' || row.feeCnName == '尾款') {
  414. row.amount = _.multiply(Number(row.amountLoc ? row.amountLoc : 0), Number(row.exrate ? row.exrate : 0))
  415. }
  416. },
  417. selectionDChange(list) {
  418. this.selectionDList = list
  419. },
  420. selectionCChange(list) {
  421. this.selectionCList = list
  422. },
  423. rowDicChange(name, row, el) {
  424. if (name == 'corpCnName') {
  425. if (row) {
  426. el.corpId = row.id
  427. el.corpEnName = row.enName
  428. el.billCorpId = row.id
  429. el.billCorpCnName = row.cnName
  430. } else {
  431. el.corpId = null
  432. el.corpEnName = null
  433. el.billCorpId = null
  434. el.billCorpCnName = null
  435. }
  436. }
  437. if (name == 'feeCnName') {
  438. if (row) {
  439. el.feeId = row.id
  440. el.feeCode = row.code
  441. el.feeEnName = row.enName
  442. el.curCode = row.curNo
  443. el.elementsId = row.accElementId
  444. el.elementsCode = row.elementsCode
  445. el.elementsCnName = row.accElementName
  446. el.elementsEnName = row.elementsEnName
  447. bcurrencyGetExrate({ date: this.form.contractDate, dc: el.dc }).then(res => {
  448. res.data.data.forEach(e => {
  449. if (row.curNo == e.code) {
  450. this.$set(el, 'exrate', e.exrate)
  451. }
  452. })
  453. })
  454. } else {
  455. el.feeId = null
  456. el.feeCode = null
  457. el.feeEnName = null
  458. el.curCode = null
  459. el.elementsId = null
  460. el.elementsCode = null
  461. el.elementsCnName = null
  462. el.elementsEnName = null
  463. }
  464. }
  465. if (name == 'curCode') {
  466. if (row) {
  467. bcurrencyGetExrate({ date: this.form.contractDate, dc: el.dc }).then(res => {
  468. res.data.data.forEach(e => {
  469. if (el.curCode == e.code) {
  470. this.$set(el, 'exrate', e.exrate)
  471. }
  472. })
  473. })
  474. } else {
  475. el.exrate = null
  476. }
  477. }
  478. },
  479. allClick(name, type) {
  480. if (name == '一键保存') {
  481. if (type == 'D') {
  482. this.form.feeCenterListD.forEach(e => {
  483. this.$set(e, '$cellEdit', false)
  484. })
  485. const loading = this.$loading({
  486. lock: true,
  487. text: '加载中',
  488. spinner: 'el-icon-loading',
  489. background: 'rgba(255,255,255,0.7)'
  490. });
  491. submitListTrade(this.form.feeCenterListD).then(res => {
  492. this.form.feeCenterListD = res.data.data
  493. this.$message.success("保存成功");
  494. }).finally(() => {
  495. loading.close();
  496. })
  497. }
  498. if (type == 'C') {
  499. this.form.feeCenterListC.forEach(e => {
  500. this.$set(e, '$cellEdit', false)
  501. })
  502. const loading = this.$loading({
  503. lock: true,
  504. text: '加载中',
  505. spinner: 'el-icon-loading',
  506. background: 'rgba(255,255,255,0.7)'
  507. });
  508. submitListTrade(this.form.feeCenterListC).then(res => {
  509. this.form.feeCenterListC = res.data.data
  510. this.$message.success("保存成功");
  511. }).finally(() => {
  512. loading.close();
  513. })
  514. }
  515. }
  516. if (name == '一键编辑') {
  517. if (type == 'D') {
  518. this.form.feeCenterListD.forEach(e => {
  519. this.$set(e, '$cellEdit', true)
  520. })
  521. }
  522. if (type == 'C') {
  523. this.form.feeCenterListC.forEach(e => {
  524. this.$set(e, '$cellEdit', true)
  525. })
  526. }
  527. }
  528. if (name == '批量删除') {
  529. let multiList = []
  530. let arr = []
  531. for (let index in this.selectionDList) {
  532. if (this.selectionDList[index].accStatus == 1) return this.$message.error("第" + (Number(this.selectionDList[index].$index) + 1) + "行不允许删除");
  533. }
  534. for (let index in this.selectionCList) {
  535. if (this.selectionCList[index].accStatus == 1) return this.$message.error("第" + (Number(this.selectionCList[index].$index) + 1) + "行不允许删除");
  536. }
  537. if (type == 'D') {
  538. this.$confirm("确定将选择数据删除?", {
  539. confirmButtonText: "确定",
  540. cancelButtonText: "取消",
  541. type: "warning"
  542. }).then(() => {
  543. multiList = this.selectionDList
  544. arr = this.form.feeCenterListD
  545. // 获取有id 的数据
  546. const itemsWithId = multiList.filter(item => item.hasOwnProperty('id'));
  547. let arrIds = itemsWithId.map(item => item.id) // 获取id 数据
  548. // 把选中的删除掉
  549. multiList.forEach((item) => {
  550. for (let index in arr) {
  551. if (JSON.stringify(item) == JSON.stringify(arr[index])) {
  552. arr.splice(Number(index), 1)
  553. }
  554. }
  555. })
  556. if (itemsWithId.length != 0) {
  557. const loading = this.$loading({
  558. lock: true,
  559. text: '加载中',
  560. spinner: 'el-icon-loading',
  561. background: 'rgba(255,255,255,0.7)'
  562. });
  563. feeRemove({ ids: arrIds.join(',') }).then(res => {
  564. this.$message.success("删除成功");
  565. }).finally(() => {
  566. loading.close();
  567. })
  568. }
  569. })
  570. }
  571. if (type == 'C') {
  572. this.$confirm("确定将选择数据删除?", {
  573. confirmButtonText: "确定",
  574. cancelButtonText: "取消",
  575. type: "warning"
  576. }).then(() => {
  577. multiList = this.selectionCList
  578. arr = this.form.feeCenterListC
  579. // 获取有id 的数据
  580. const itemsWithId = multiList.filter(item => item.hasOwnProperty('id'));
  581. let arrIds = itemsWithId.map(item => item.id) // 获取id 数据
  582. // 把选中的删除掉
  583. multiList.forEach((item) => {
  584. for (let index in arr) {
  585. if (JSON.stringify(item) == JSON.stringify(arr[index])) {
  586. arr.splice(Number(index), 1)
  587. }
  588. }
  589. })
  590. if (itemsWithId.length != 0) {
  591. const loading = this.$loading({
  592. lock: true,
  593. text: '加载中',
  594. spinner: 'el-icon-loading',
  595. background: 'rgba(255,255,255,0.7)'
  596. });
  597. feeRemove({ ids: arrIds.join(',') }).then(res => {
  598. this.$message.success("删除成功");
  599. }).finally(() => {
  600. loading.close();
  601. })
  602. }
  603. })
  604. }
  605. }
  606. if (name == '生成账单') {
  607. if (type == 'D') {
  608. for (let index in this.selectionDList) {
  609. if (this.selectionDList[index].accStatus != 0) {
  610. return this.$message.error("已生成账单");
  611. }
  612. }
  613. this.$confirm("确定将选择数据生成账单?", {
  614. confirmButtonText: "确定",
  615. cancelButtonText: "取消",
  616. type: "warning"
  617. }).then(() => {
  618. const loading = this.$loading({
  619. lock: true,
  620. text: '加载中',
  621. spinner: 'el-icon-loading',
  622. background: 'rgba(255,255,255,0.7)'
  623. });
  624. generateBill({ id: this.form.id, feeCenterListD: this.selectionDList }).then(res => {
  625. this.$message.success("成功生成账单");
  626. this.$emit('getDetails', this.form.id)
  627. }).finally(() => {
  628. loading.close();
  629. })
  630. })
  631. }
  632. if (type == 'C') {
  633. for (let index in this.selectionCList) {
  634. if (this.selectionCList[index].accStatus != 0) {
  635. return this.$message.error("已生成账单");
  636. }
  637. }
  638. this.$confirm("确定将选择数据生成账单?", {
  639. confirmButtonText: "确定",
  640. cancelButtonText: "取消",
  641. type: "warning"
  642. }).then(() => {
  643. const loading = this.$loading({
  644. lock: true,
  645. text: '加载中',
  646. spinner: 'el-icon-loading',
  647. background: 'rgba(255,255,255,0.7)'
  648. });
  649. generateBill({ id: this.form.id, feeCenterListC: this.selectionCList }).then(res => {
  650. this.$message.success("成功生成账单");
  651. this.$emit('getDetails', this.form.id)
  652. }).finally(() => {
  653. loading.close();
  654. })
  655. })
  656. }
  657. }
  658. if (name == '撤销账单') {
  659. if (type == 'D') {
  660. for (let index in this.selectionDList) {
  661. if (this.selectionDList[index].accStatus != 1) {
  662. return this.$message.error("未生成账单");
  663. }
  664. }
  665. this.$confirm("确定将选择数据撤销账单?", {
  666. confirmButtonText: "确定",
  667. cancelButtonText: "取消",
  668. type: "warning"
  669. }).then(() => {
  670. const loading = this.$loading({
  671. lock: true,
  672. text: '加载中',
  673. spinner: 'el-icon-loading',
  674. background: 'rgba(255,255,255,0.7)'
  675. });
  676. revokeBill({ id: this.form.id, feeCenterListD: this.selectionDList }).then(res => {
  677. this.$message.success("成功撤销账单");
  678. this.$emit('getDetails', this.form.id)
  679. }).finally(() => {
  680. loading.close();
  681. })
  682. })
  683. }
  684. if (type == 'C') {
  685. for (let index in this.selectionCList) {
  686. if (this.selectionCList[index].accStatus != 1) {
  687. return this.$message.error("未生成账单");
  688. }
  689. }
  690. this.$confirm("确定将选择数据撤销账单?", {
  691. confirmButtonText: "确定",
  692. cancelButtonText: "取消",
  693. type: "warning"
  694. }).then(() => {
  695. const loading = this.$loading({
  696. lock: true,
  697. text: '加载中',
  698. spinner: 'el-icon-loading',
  699. background: 'rgba(255,255,255,0.7)'
  700. });
  701. revokeBill({ id: this.form.id, feeCenterListC: this.selectionCList }).then(res => {
  702. this.$message.success("成功撤销账单");
  703. this.$emit('getDetails', this.form.id)
  704. }).finally(() => {
  705. loading.close();
  706. })
  707. })
  708. }
  709. }
  710. },
  711. //自定义列保存
  712. async saveColumn(ref, option, optionBack, code) {
  713. /**
  714. * 已定义全局方法,直接使用,saveColumnData保存列数据方法,参数传值(表格名称,当前表格的option数据)
  715. * 已定义全局方法,直接使用,getColumnName方法用来获取枚举值,参数根据自己定义的code值获取中文名
  716. * 一定要执行异步操作,要等接口成功返回,才能执行下一行代码
  717. */
  718. const inSave = await this.saveColumnData(this.getColumnName(code), this[option]);
  719. if (inSave) {
  720. this.$message.success("保存成功");
  721. //关闭窗口
  722. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  723. }
  724. },
  725. //自定义列重置
  726. async resetColumn(ref, option, optionBack, code) {
  727. this[option] = this[optionBack];
  728. const inSave = await this.delColumnData(this.getColumnName(code), this[optionBack]);
  729. if (inSave) {
  730. this.$message.success("重置成功");
  731. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  732. }
  733. },
  734. },
  735. }
  736. </script>
  737. <style scoped lang="scss">
  738. .disabledBox {
  739. display: flex;
  740. align-items: center;
  741. }
  742. .fontSize {
  743. font-size: 16px;
  744. color: #81B337;
  745. }
  746. .meetSize {
  747. font-size: 16px;
  748. color: #54BCBD;
  749. }
  750. ::v-deep#out-table .back-one {
  751. background: #ecf5ff !important;
  752. text-align: center;
  753. padding: 4px 0;
  754. }
  755. ::v-deep#out-table .back-two {
  756. background: #ecf5ff !important;
  757. text-align: center;
  758. padding: 4px 0;
  759. }
  760. </style>