main.vue 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816
  1. <template>
  2. <div>
  3. <containerTitle title="费用明细"></containerTitle>
  4. <basic-container>
  5. <avue-crud
  6. ref="feeCrud"
  7. :data="feeData"
  8. :option="feeOption"
  9. @saveColumn="saveColumn"
  10. @resetColumn="resetColumn"
  11. @selection-change="selectionChange"
  12. :summary-method="summaryMethod"
  13. :cell-style="cellStyle"
  14. >
  15. <template slot="menuLeft">
  16. <el-tabs v-model="activeName" @tab-click="tabHandle">
  17. <el-tab-pane label="应收" name="first" :key="'first'">
  18. </el-tab-pane>
  19. <el-tab-pane label="应付" name="second" :key="'second'">
  20. </el-tab-pane>
  21. </el-tabs>
  22. <el-button
  23. type="primary"
  24. icon="el-icon-plus"
  25. size="small"
  26. @click.stop="rowAdd"
  27. :loading="buttonLoading"
  28. :disabled="disabled"
  29. >录入明细</el-button
  30. >
  31. <el-button
  32. type="warning"
  33. size="small"
  34. @click.stop="billingDetails('收费')"
  35. :loading="buttonLoading"
  36. :disabled="(financeDisabled && disabled) || selectionList.length == 0"
  37. v-if="selectTab === 1"
  38. >生成账单</el-button>
  39. <el-button
  40. type="warning"
  41. size="small"
  42. @click.stop="billingDetails('申请')"
  43. :loading="buttonLoading"
  44. :disabled="(financeDisabled && disabled) || selectionList.length == 0"
  45. v-if="selectTab === 2"
  46. >申请付费</el-button>
  47. </template>
  48. <template slot="menu" slot-scope="{ row, index }">
  49. <el-button
  50. size="small"
  51. icon="el-icon-edit"
  52. type="text"
  53. @click="rowCell(row, index)"
  54. :disabled="disabled"
  55. >{{ row.$cellEdit ? "保存" : "修改" }}</el-button
  56. >
  57. <el-button
  58. size="small"
  59. icon="el-icon-delete"
  60. type="text"
  61. @click="rowDel(row, index)"
  62. :disabled="disabled"
  63. >删 除</el-button
  64. >
  65. </template>
  66. <template slot="corpId" slot-scope="{ row, index }">
  67. <span v-if="row.$cellEdit" class="required_fields">*</span>
  68. <crop-select
  69. ref="corp"
  70. style="width: 90% !important;display: inline-block"
  71. v-if="row.$cellEdit"
  72. v-model="row.corpId"
  73. :cropIndex="index"
  74. @getCorpData="getCorpData"
  75. corpType="KG"
  76. ></crop-select>
  77. <span v-else>{{ row.corpName }}</span>
  78. </template>
  79. <template slot="feeName" slot-scope="{ row, index }">
  80. <span v-if="row.$cellEdit" class="required_fields">*</span>
  81. <breakdown-select
  82. v-if="row.$cellEdit"
  83. v-model="row.itemId"
  84. @selectValue="(value) => selectValue(value,row)"
  85. :configuration="breakConfiguration"
  86. >
  87. </breakdown-select>
  88. <span v-else>{{ row.feeName }}</span>
  89. </template>
  90. <template slot="billNo" slot-scope="{ row }">
  91. <el-select
  92. v-if="row.$cellEdit"
  93. v-model="row.billNo"
  94. size="small"
  95. filterable
  96. allow-create
  97. default-first-option
  98. clearable
  99. >
  100. <el-option
  101. v-for="(item,index) in billNoList"
  102. :key="index"
  103. :label="item"
  104. :value="item"
  105. >
  106. </el-option>
  107. </el-select>
  108. <span v-else>{{ row.billNo }}</span>
  109. </template>
  110. <template slot="price" slot-scope="{ row }">
  111. <el-input
  112. v-if="row.$cellEdit"
  113. v-model="row.price"
  114. placeholder="请输入"
  115. size="small"
  116. @input="countChange(row)"
  117. ></el-input>
  118. <span v-else>{{ row.price | micrometerFormat }}</span>
  119. </template>
  120. <template slot="quantity" slot-scope="{ row }">
  121. <el-input
  122. v-if="row.$cellEdit"
  123. v-model="row.quantity"
  124. size="small"
  125. placeholder="请输入"
  126. oninput='this.value=this.value.replace(/[^(\d.)]/g,"").replace(/^(\d+)\.(\d\d\d\d\d\d).*$/, "$1.$2")'
  127. @input="countChange(row)"
  128. ></el-input>
  129. <span v-else>{{ row.quantity | IntegerFormat }}</span>
  130. </template>
  131. <template slot="amount" slot-scope="{ row }">
  132. <span>{{ row.amount | micrometerFormat }}</span>
  133. </template>
  134. <template slot="exchangeRate" slot-scope="{ row }">
  135. <el-input
  136. v-if="row.$cellEdit"
  137. v-model="row.exchangeRate"
  138. size="small"
  139. oninput='this.value=this.value.replace(/[^(\d.)]/g,"").replace(/^(\d+)\.(\d\d).*$/, "$1.$2")'
  140. @change="rateChange(row)"
  141. placeholder="请输入"
  142. ></el-input>
  143. <span v-else>{{ row.exchangeRate }}</span>
  144. </template>
  145. <template slot="currency" slot-scope="{ row }">
  146. <el-select
  147. v-if="row.$cellEdit"
  148. v-model="row.currency"
  149. filterable
  150. allow-create
  151. default-first-option
  152. placeholder="请选择"
  153. size="small"
  154. @change="currencyChange(row)"
  155. >
  156. <el-option
  157. v-for="(item, index) in currencyList"
  158. :key="index"
  159. :label="item.dictValue"
  160. :value="item.dictValue"
  161. >
  162. </el-option>
  163. </el-select>
  164. <span v-else>{{ row.currency }}</span>
  165. </template>
  166. <template slot="unit" slot-scope="{ row }">
  167. <el-select
  168. v-if="row.$cellEdit"
  169. v-model="row.unit"
  170. filterable
  171. placeholder="请选择"
  172. size="small"
  173. >
  174. <el-option
  175. v-for="(item, index) in unitList"
  176. :key="index"
  177. :label="item.dictValue"
  178. :value="item.dictValue"
  179. >
  180. </el-option>
  181. </el-select>
  182. <span v-else>{{ row.unit }}</span>
  183. </template>
  184. </avue-crud>
  185. </basic-container>
  186. <el-dialog
  187. title="导入费用"
  188. append-to-body
  189. :visible.sync="feeDialog"
  190. top="5vh"
  191. width="60%"
  192. :close-on-click-modal="false"
  193. @closed="feeClose"
  194. class="el-dialogDeep"
  195. v-dialog-drag
  196. >
  197. <el-row style="height: 0;">
  198. <el-col :span="5">
  199. <div style="margin-top:45px">
  200. <el-scrollbar>
  201. <basic-container>
  202. <avue-tree
  203. :option="treeOption"
  204. :data="treeData"
  205. @node-click="nodeClick"
  206. />
  207. </basic-container>
  208. </el-scrollbar>
  209. </div>
  210. </el-col>
  211. <el-col :span="19">
  212. <avue-crud
  213. :option="option"
  214. :table-loading="loading"
  215. :data="data"
  216. ref="crud"
  217. @refresh-change="refreshChange"
  218. @selection-change="selectionChange"
  219. @current-change="currentChange"
  220. @size-change="sizeChange"
  221. :page.sync="page"
  222. @on-load="onLoad"
  223. :cell-style="cellStyle"
  224. >
  225. </avue-crud>
  226. </el-col>
  227. </el-row>
  228. <div class="dialogButton">
  229. <el-button @click="feeDialog = false">取 消</el-button>
  230. <el-button
  231. type="primary"
  232. @click="importData"
  233. :disabled="this.selectionList.length == 0"
  234. >
  235. 导入
  236. </el-button>
  237. </div>
  238. </el-dialog>
  239. <crop-dialog ref="cropDialog" @importCorp="importCorp"></crop-dialog>
  240. </div>
  241. </template>
  242. <script>
  243. import feeOption from "./config/feeInfo.json";
  244. import option from "./config/feeList.json";
  245. import { getDeptLazyTree, customerList } from "@/api/basicData/basicFeesDesc";
  246. import { delItem } from "@/api/feeInfo/fee-info";
  247. import { isPercentage, micrometerFormat, IntegerFormat } from "@/util/validate";
  248. import cropDialog from "@/components/crop-dialog/main";
  249. import _ from "lodash";
  250. import ApplyPayment from "../finance/applyPayment";
  251. import {applyLoan,paymentApply} from "@/api/financialManagement/paymentRequest";
  252. import { contrastList } from "@/util/contrastData";
  253. import { allCropList } from "@/api/basicData/customerInformation";
  254. import { getCustomerCode, getCustomerName } from "@/enums/management-type";
  255. export default {
  256. name: "feeInfo",
  257. data() {
  258. return {
  259. option: option,
  260. feeOption: {},
  261. feeDialog: false,
  262. buttonLoading:false,
  263. treeOption: {
  264. nodeKey: "id",
  265. lazy: true,
  266. treeLoad: function(node, resolve) {
  267. const parentId = node.level === 0 ? 0 : node.data.id;
  268. getDeptLazyTree(parentId).then(res => {
  269. resolve(
  270. res.data.data.map(item => {
  271. return {
  272. ...item,
  273. leaf: !item.hasChildren
  274. };
  275. })
  276. );
  277. });
  278. },
  279. addBtn: false,
  280. menu: false,
  281. size: "small",
  282. props: {
  283. labelText: "标题",
  284. label: "title",
  285. value: "value",
  286. children: "children"
  287. }
  288. },
  289. page: {
  290. pageSize: 10,
  291. currentPage: 1,
  292. total: 0
  293. },
  294. treeDeptId: null,
  295. loading: false,
  296. receivableButton: "primary",
  297. copeWithButton: "",
  298. data: [],
  299. feeData: [],
  300. selectionList: [],
  301. reData: null,
  302. currencyList: [],
  303. unitList:[],
  304. breakConfiguration:{
  305. multipleChoices:false,
  306. multiple:false,
  307. disabled:false,
  308. searchShow:true,
  309. collapseTags:false,
  310. clearable:true,
  311. placeholder:'请点击右边按钮选择',
  312. dicData:[]
  313. },
  314. allData:[],
  315. data_one:[],
  316. data_two:[],
  317. selectTab:1,
  318. activeName:"first",
  319. enableName:"first",
  320. tab1:true,
  321. tab2:false,
  322. corpList: [],
  323. };
  324. },
  325. props: {
  326. orderFeesList: {
  327. type: Array
  328. },
  329. disabled: {
  330. type: Boolean
  331. },
  332. feeUrl: {
  333. type: String
  334. },
  335. billUrl: {
  336. type: String
  337. },
  338. optionType:{
  339. type: String
  340. },
  341. itemType: {
  342. type: String
  343. },
  344. srcType: {
  345. type: Number,
  346. default: 2,
  347. },
  348. corpId: {
  349. type: String
  350. },
  351. billNoList:{
  352. type:Array
  353. },
  354. financeDisabled: {
  355. type: Boolean,
  356. default: true
  357. },
  358. },
  359. filters: {
  360. isPercentage(val) {
  361. return isPercentage(val);
  362. },
  363. micrometerFormat(val) {
  364. return micrometerFormat(val);
  365. },
  366. decimalFormat(num) {
  367. return num ? Number(num).toFixed(2) : "0.00";
  368. },
  369. IntegerFormat(num) {
  370. return IntegerFormat(num);
  371. },
  372. },
  373. async created() {
  374. this.feeOption = await this.getColumnData(
  375. this.getColumnName(33),
  376. feeOption
  377. );
  378. if(this.$store.getters.userInfo.tenant_id === '888390'){
  379. this.feeOption.column.forEach(item =>{
  380. if(item.prop === 'billNo'){
  381. item.hide = false
  382. }
  383. })
  384. }
  385. this.getWorkDicts("currency").then(res => {
  386. this.currencyList = res.data.data;
  387. });
  388. this.getWorkDicts("unit").then(res =>{
  389. this.unitList = res.data.data
  390. })
  391. allCropList({
  392. corpType: getCustomerCode("KG")
  393. }).then(res => {
  394. this.corpList = res.data.data;
  395. });
  396. },
  397. components: {
  398. cropDialog,
  399. ApplyPayment
  400. },
  401. watch: {
  402. 'orderFeesList'(newVla,oldVal){
  403. if(newVla !== oldVal){
  404. this.allData = newVla
  405. this.data_one = newVla.filter(item => item.feesType === 1) //应收
  406. this.data_two = newVla.filter(item => item.feesType === 2) //应付
  407. if (this.selectTab === 1) {
  408. this.feeData = this.data_one
  409. } else {
  410. this.feeData = this.data_two
  411. }
  412. }
  413. },
  414. 'activeName'(newVla,oldVal){
  415. if(newVla !== oldVal){
  416. if(newVla === "first"){
  417. this.tab1 = true;
  418. this.tab2 = false;
  419. this.data_two = this.feeData
  420. this.selectTab = 1
  421. this.feeData = this.data_one
  422. }else{
  423. this.tab1 = false;
  424. this.tab2 = true;
  425. this.data_one = this.feeData
  426. this.selectTab = 2
  427. this.feeData = this.data_two
  428. }
  429. }
  430. },
  431. },
  432. methods: {
  433. //选择费用
  434. selectValue(value,row){
  435. this.$set(row,"feeName",value.cname)
  436. this.$set(row,"ename",value.ename)
  437. this.currencyChange(row)
  438. },
  439. //选择应收应付
  440. // handleClick(tab){
  441. // if(tab.name === "first"){
  442. // this.tab1 = true;
  443. // this.tab2 = false;
  444. //
  445. // this.data_two = this.feeData
  446. //
  447. // this.selectTab = 1
  448. // this.feeData = this.data_one
  449. // }else{
  450. // this.tab1 = false;
  451. // this.tab2 = true;
  452. //
  453. // this.data_one = this.feeData
  454. //
  455. // this.selectTab = 2
  456. // this.feeData = this.data_two
  457. // }
  458. // },
  459. cellStyle() {
  460. return "padding:0;height:40px;";
  461. },
  462. importCorp(row) {
  463. this.feeData.push({
  464. itemId: null,
  465. corpId: row.id,
  466. corpName: row.name,
  467. ename:null,
  468. feeName: null,
  469. price: null,
  470. unit: null,
  471. quantity: null,
  472. amount: null,
  473. currency:'CNY',
  474. exchangeRate: 1,
  475. remarks: null,
  476. $cellEdit: true,
  477. feesType:this.selectTab
  478. });
  479. },
  480. //带出汇率
  481. currencyChange(row){
  482. this.currencyList.forEach(item =>{
  483. if(item.dictValue === row.currency){
  484. this.$set(row,"exchangeRate",item.remark)
  485. }
  486. })
  487. },
  488. rowDel(row, index) {
  489. this.$confirm("确定删除数据?", {
  490. confirmButtonText: "确定",
  491. cancelButtonText: "取消",
  492. type: "warning"
  493. }).then(() => {
  494. //费用判断是否需要调用删除接口
  495. if (row.id) {
  496. delItem(row.id, this.feeUrl).then(res => {
  497. this.$message({
  498. type: "success",
  499. message: "删除成功!"
  500. });
  501. this.feeData.splice(index, 1);
  502. });
  503. } else {
  504. this.$message({
  505. type: "success",
  506. message: "删除成功!"
  507. });
  508. this.feeData.splice(index, 1);
  509. }
  510. });
  511. },
  512. getCorpData(row) {
  513. console.log(row)
  514. this.feeData[row.index].corpName = row.cname;
  515. },
  516. countChange(row) {
  517. if (row.price && row.quantity) {
  518. row.amount = _.multiply(row.quantity, row.price).toFixed(2);
  519. }
  520. },
  521. rateChange(row) {
  522. if (row.exchangeRate >= 100) {
  523. row.exchangeRate = 0;
  524. this.$message.error("汇率不能超过100%");
  525. }
  526. },
  527. currentChange(val) {
  528. this.page.currentPage = val;
  529. },
  530. sizeChange(val) {
  531. this.page.currentPage = 1;
  532. this.page.pageSize = val;
  533. },
  534. //刷新
  535. refreshChange() {
  536. this.page.currentPage = 1;
  537. this.onLoad(this.page);
  538. },
  539. //多选
  540. selectionChange(list) {
  541. this.selectionList = list;
  542. },
  543. rePick(row, index) {
  544. this.reData = {
  545. ...row,
  546. index: index
  547. };
  548. this.feeDialog = true;
  549. this.onLoad(this.page);
  550. },
  551. //费用编辑
  552. rowCell(row, index) {
  553. if (row.$cellEdit == true) {
  554. this.$set(row, "$cellEdit", false);
  555. } else {
  556. this.$set(row, "$cellEdit", true);
  557. }
  558. },
  559. //新增
  560. rowAdd() {
  561. if (!this.corpId) return this.$message.error('请选择往来单位')
  562. if(this.$store.getters.userInfo.tenant_id === '888390'){
  563. this.$emit("getBillNo")
  564. }
  565. let corpName = this.corpList.find(item => this.corpId == item.id).cname
  566. const params = {
  567. feesType:this.selectTab,
  568. corpId: this.corpId,
  569. corpName: corpName
  570. }
  571. this.$refs.feeCrud.rowCellAdd(params);
  572. },
  573. onLoad(page) {
  574. this.loading = true;
  575. let data = {
  576. size: page.pageSize,
  577. current: page.currentPage,
  578. parentId: 0,
  579. feesTypeId: this.treeDeptId
  580. };
  581. customerList(data).then(res => {
  582. const data = res.data.data;
  583. this.page.total = data.total;
  584. this.data = data.records;
  585. this.loading = false;
  586. if (this.page.total) {
  587. this.option.height = window.innerHeight - 350;
  588. }
  589. });
  590. },
  591. //导入页左费用类型查询
  592. nodeClick(data) {
  593. this.treeDeptId = data.id;
  594. this.page.currentPage = 1;
  595. this.onLoad(this.page);
  596. },
  597. feeClose() {
  598. this.selectionList = [];
  599. this.page = {
  600. pageSize: 10,
  601. currentPage: 1,
  602. total: 0
  603. };
  604. this.treeDeptId = null;
  605. this.loading = false;
  606. this.data = [];
  607. this.reData = null;
  608. },
  609. importData() {
  610. if (this.reData) {
  611. this.selectionList.length;
  612. if (this.selectionList.length != 1) {
  613. return this.$message.error("重新选择的时候只能选择一条数据");
  614. } else {
  615. this.selectionList.forEach(e => {
  616. this.feeData.forEach((item, index) => {
  617. if (index == this.reData.index) {
  618. item.itemId = e.id;
  619. item.corpId = this.reData.corpId;
  620. item.feeName = e.cname;
  621. item.price = this.reData.price;
  622. // item.unit = e.unitno;
  623. item.quantity = this.reData.quantity;
  624. item.amount = this.reData.amount;
  625. item.remarks = this.reData.remarks;
  626. item.$cellEdit = true;
  627. }
  628. });
  629. });
  630. }
  631. } else {
  632. this.selectionList.forEach(e => {
  633. this.feeData.push({
  634. itemId: e.id,
  635. corpId: null,
  636. feeName: e.cname,
  637. price: 0,
  638. // unit: e.unitno,
  639. quantity: 0,
  640. amount: 0,
  641. remarks: null,
  642. $cellEdit: true,
  643. });
  644. });
  645. }
  646. this.feeDialog = false;
  647. },
  648. submitData() {
  649. let list = []
  650. //保存时 将所出的tab页数据赋值到相应 data上
  651. if(this.selectTab === 1){
  652. this.data_one = this.feeData
  653. }else{
  654. this.data_two = this.feeData
  655. }
  656. list.push(...this.data_one,...this.data_two)
  657. return list
  658. },
  659. billingDetails(type){
  660. //查看是否改动过数据
  661. this.$emit("beforeFinance",this.submitData(),(params)=>{
  662. if(params.valid){
  663. for(let i=0;i<this.selectionList.length;i++){
  664. if(this.selectionList[i].corpId != this.selectionList[0].corpId){
  665. return this.$message.error('批量操作结算单位必须一致')
  666. }
  667. if(this.selectionList[i].isCheck == 1){
  668. return this.$message.error("选中的数据已"+type+",请勿重复操作!")
  669. }
  670. }
  671. this.selectionList.map(item =>{
  672. // item.url = this.billUrl
  673. item.srcOrderno = params.srcOrderno
  674. item.srcParentId = params.parentId
  675. item.corpsName = item.corpName
  676. item.srcFeesId = item.id
  677. item.costType = item.itemId
  678. item.itemType = this.itemType
  679. item.optionType = this.optionType
  680. item.srcType = this.srcType //费用明细申请
  681. item.tradeType = this.optionType
  682. })
  683. let data = {
  684. billType: type,
  685. itemsList : this.selectionList,
  686. }
  687. if(type === '申请'){
  688. this.$confirm("您确定申请付费吗?", "提示", {
  689. confirmButtonText: "确定",
  690. cancelButtonText: "取消",
  691. type: "warning",
  692. }).then(()=>{
  693. this.buttonLoading = true
  694. data.checkType = 'ffsq'
  695. data.url = '/financialManagement/paymentRequest/index'
  696. data.pageStatus = 'this.$store.getters.pqStatus'
  697. data.pageLabel = '付费申请'
  698. applyLoan(data).then(res=>{
  699. if(res.data.success){
  700. this.$message.success("操作成功!")
  701. this.$emit("afterFinance")
  702. //跳转付费申请页面
  703. // if(this.$store.getters.pqStatus){
  704. // this.$alert("无法自动跳转,因为付费申请页面已存在!", "温馨提示", {
  705. // confirmButtonText: "确定",
  706. // type: 'warning',
  707. // callback: action => {
  708. // }
  709. // });
  710. // }else{
  711. // //关闭一下存在的列表页 跳转
  712. // this.$router.$avueRouter.closeTag('/financialManagement/paymentRequest/index');
  713. // this.$router.push({
  714. // path: "/financialManagement/paymentRequest/index",
  715. // query: {params: res.data.data.id},
  716. // });
  717. // }
  718. }
  719. }).finally(()=>{
  720. this.buttonLoading = false
  721. })
  722. })
  723. }else{
  724. this.$confirm("您确定生成账单吗?", "提示", {
  725. confirmButtonText: "确定",
  726. cancelButtonText: "取消",
  727. type: "warning",
  728. }).then(()=>{
  729. this.buttonLoading = true
  730. paymentApply(data).then(res=>{
  731. if(res.data.success){
  732. this.$message.success("操作成功!")
  733. this.$emit("afterFinance")
  734. }
  735. }).finally(()=>{
  736. this.buttonLoading = false
  737. })
  738. })
  739. }
  740. }
  741. })
  742. },
  743. summaryMethod({ columns, data }) {
  744. const sums = [];
  745. if (columns.length > 0) {
  746. columns.forEach((item, index) => {
  747. sums[0] = "合计";
  748. if (item.property == "quantity" || item.property == "amount") {
  749. let qtySum = 0;
  750. let amountSum = 0;
  751. data.forEach(e => {
  752. qtySum = _.add(qtySum, Number(e.quantity));
  753. amountSum = _.add(amountSum, Number(e.amount));
  754. });
  755. //数量总计
  756. if (item.property == "quantity") {
  757. sums[index] = qtySum ? qtySum.toFixed(2) : "0.00";
  758. }
  759. //金额总计
  760. if (item.property == "amount") {
  761. sums[index] = micrometerFormat(amountSum);
  762. }
  763. }
  764. });
  765. }
  766. return sums;
  767. },
  768. async saveColumn() {
  769. const inSave = await this.saveColumnData(
  770. this.getColumnName(33),
  771. this.feeOption
  772. );
  773. if (inSave) {
  774. this.$message.success("保存成功");
  775. //关闭窗口
  776. this.$refs.feeCrud.$refs.dialogColumn.columnBox = false;
  777. }
  778. },
  779. async resetColumn() {
  780. const inSave = await this.delColumnData(
  781. this.getColumnName(33),
  782. feeOption
  783. );
  784. if (inSave) {
  785. this.$message.success("重置成功");
  786. this.feeOption = feeOption;
  787. //关闭窗口
  788. this.$refs.feeCrud.$refs.dialogColumn.columnBox = false;
  789. }
  790. },
  791. tabHandle(data) {
  792. // if (data.name == this.enableName) return
  793. // this.enableName = data.name
  794. },
  795. },
  796. };
  797. </script>
  798. <style lang="scss" scoped>
  799. .required_fields{
  800. color: #F56C6C;
  801. display:inline-block;
  802. width: 7%
  803. }
  804. </style>