detail.vue 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837
  1. <template>
  2. <div class="borderless" v-loading="pageLoading">
  3. <div class="customer-head">
  4. <div class="customer-back">
  5. <el-button type="danger" style="border: none;background: none;color: red" icon="el-icon-arrow-left"
  6. @click="backToList" :loading="btnLoading">返回列表</el-button>
  7. </div>
  8. <div class="add-customer-btn">
  9. <el-button type="primary" size="small" class="el-button--small-yh" @click.stop="openEdit" v-if="disabled">编 辑
  10. </el-button>
  11. <el-button v-if="checker && form.status != 3" type="primary" size="small" class="el-button--small-yh"
  12. @click.stop="openCheckDialog">
  13. 审批
  14. </el-button>
  15. <el-button v-if="form.status == 3 && tenantId == 681169 && roleName.indexOf('财务') !== -1" type="primary"
  16. size="small" class="el-button--small-yh" @click.stop="reimbursementCompleted">
  17. 报销完成
  18. </el-button>
  19. <el-button v-if="form.status > 0" @click.native="checkScheduleDialog = true, checkId = form.id" type="primary"
  20. size="small">审核进度</el-button>
  21. <el-button type="primary" v-if="!checkDisabled" :disabled="!form.id || disabled" size="small"
  22. @click="pleaseCheck" :loading="btnLoading">请核</el-button>
  23. <el-button v-if="form.status == 3 && tenantId != 681169" type="primary" size="small" class="el-button--small-yh"
  24. @click.stop="openCheckDialog">
  25. 报销
  26. </el-button>
  27. <el-button type="success" :disabled="!form.id" size="small" @click="copyDoc" :loading="btnLoading" v-if="false">
  28. 复制单据</el-button>
  29. <el-button type="primary" @click="editCustomer" size="small" :disabled="form.status > 0 && form.status !== 2"
  30. :loading="btnLoading">
  31. 保存数据</el-button>
  32. </div>
  33. </div>
  34. <div class="customer-main">
  35. <trade-card title="经办人信息">
  36. <avue-form ref="form" class="trading-form" v-model="form" :option="option">
  37. <template slot="userId">
  38. <el-select v-model="form.userId" filterable clearable size="small" placeholder="请选择" @change="userHandle"
  39. @clear="form.userName == null" :disabled="disabled || checkDisabled">
  40. <el-option v-for="(item, index) in userList" :key="index" :label="item.realName" :value="item.id">
  41. </el-option>
  42. </el-select>
  43. </template>
  44. <template slot="belongToCorpId">
  45. <crop-select v-model="form.belongToCorpId" corpType="GS" :disabled="disabled || checkDisabled"
  46. @getCorpData="returnBack" style="width: 100%" ref="KHSelect"></crop-select>
  47. </template>
  48. <template slot="deptId">
  49. <avue-input-tree leaf-only style="width: 100%;" size="small" :props="{ label: 'title' }"
  50. v-model="form.deptId" placeholder=" " type="tree" :dic="dic" :nodeClick="deptClick"
  51. :disabled="disabled || checkDisabled"></avue-input-tree>
  52. </template>
  53. <template slot="postId">
  54. <el-select v-model="form.postId" clearable filterable placeholder="请选择岗位" @change="postHandle"
  55. @clear="form.postId == null" :disabled="disabled || checkDisabled">
  56. <el-option v-for="(item, index) in postDic" :label="item.postName" :value="item.id" :key="index" />
  57. </el-select>
  58. </template>
  59. </avue-form>
  60. </trade-card>
  61. <trade-card title="报销明细">
  62. <avue-crud ref="crud" :key="key" :data="dataList" :option="tableOption" :cell-style="cellStyle"
  63. @saveColumn="saveColumn" @resetColumn="resetColumn">
  64. <template slot="menuLeft">
  65. <el-button type="primary" icon="el-icon-plus" size="small" @click.stop="newDetails"
  66. :disabled="disabled || checkDisabled">录入明细</el-button>
  67. <el-button type="info" icon="el-icon-printer" size="small" @click="openReport">报表打印</el-button>
  68. </template>
  69. <template slot="detailId" slot-scope="{ row }">
  70. <el-select v-if="row.$cellEdit" v-model="row.detailId" filterable clearable @change="detailChange(row)"
  71. size="small">
  72. <el-option v-for="(item, index) in row.feeList" :key="index" :label="item.cname" :value="item.id">
  73. </el-option>
  74. </el-select>
  75. <span v-else>{{ row.detail }}</span>
  76. </template>
  77. <template slot="menu" slot-scope="{ row, index }">
  78. <el-button size="small" icon="el-icon-edit" type="text" @click="rowCell(row, index)"
  79. :disabled="(disabled || checkDisabled) && form.status !== 3"
  80. v-if="form.status == 3 && tenantId == 681169 && roleName.indexOf('财务') !== -1">{{ row.$cellEdit ? "保存" :
  81. "修改" }}</el-button>
  82. <el-button size="small" icon="el-icon-edit" type="text" @click="rowCell(row, index)"
  83. :disabled="disabled || checkDisabled" v-else>{{ row.$cellEdit ? "保存" : "修改" }}</el-button>
  84. <el-button size="small" icon="el-icon-delete" type="text" @click="rowDel(row, index)"
  85. :disabled="disabled || checkDisabled">删除</el-button>
  86. </template>
  87. <template slot="moldId" slot-scope="{ row }">
  88. <avue-cascader v-if="row.$cellEdit" v-model="row.moldId" size="small" style="width: 100%;" :dic="dicArea"
  89. :props="props" :disabled="disabled || checkDisabled" check-strictly :emit-path="false"
  90. :show-all-levels="false" @change="moldChange($event, row, dicArea)" @clear="row.feeList = feesOption"
  91. placeholder="请选择">
  92. </avue-cascader>
  93. <span v-else>{{ row.mold }}</span>
  94. </template>
  95. <template slot="payMethod" slot-scope="{ row, index }">
  96. <el-select v-model="row.payMethod" size="small" placeholder="请选择" clearable :disabled="!row.$cellEdit">
  97. <el-option v-for="(item, index) in paymentOption" :key="index" :label="item.dictValue"
  98. :value="item.dictKey"></el-option>
  99. </el-select>
  100. </template>
  101. </avue-crud>
  102. </trade-card>
  103. <trade-card title="上传附件">
  104. <c-upload :basic="true" :enumerationValue="107.1" :disabled="disabled || checkDisabled" :data="fileList">
  105. </c-upload>
  106. </trade-card>
  107. <trade-card title="付款信息" v-if="tenantId == 681169">
  108. <avue-form :option="optionTwo" v-model="form">
  109. </avue-form>
  110. </trade-card>
  111. </div>
  112. <el-dialog append-to-body title="审批" class="el-dialogDeep" :visible.sync="checkDialog" width="50%"
  113. :close-on-click-modal="false" :destroy-on-close="true" :close-on-press-escape="false" v-dialog-drag>
  114. <check :checkData="checkData" :checkDetail="false" :idList="[]" @choceCheckFun="choceCheckFun">
  115. </check>
  116. </el-dialog>
  117. <el-dialog append-to-body title="审批进度" class="el-dialogDeep" :visible.sync="checkScheduleDialog" width="40%"
  118. :close-on-click-modal="false" :destroy-on-close="true" :close-on-press-escape="false" v-dialog-drag>
  119. <check-schedule :checkId="checkId" :batchNo="batchNo" @choceScheduleFun="choceScheduleFun">
  120. </check-schedule>
  121. </el-dialog>
  122. <!-- 报表-->
  123. <report-dialog :switchDialog="switchDialog" :reportId="form.id" reportName="事务-报销单" @onClose="onClose()" />
  124. </div>
  125. </template>
  126. <script>
  127. import tableOption from "./config/customerContact.json";
  128. import tableOptionTwo from "./config/customerContactTwo.json";
  129. import {
  130. isDiscount,
  131. isPercentage,
  132. micrometerFormat,
  133. IntegerFormat
  134. } from "@/util/validate";
  135. import { gainUser, getCharge } from "@/api/basicData/customerInquiry";
  136. import { getUserInfo } from "@/api/system/user";
  137. import { getDeptTree } from "@/api/system/dept";
  138. import { getCurrentDate } from "@/util/date";
  139. import { getList as getPostList } from "@/api/system/post";
  140. import { dataDetail, typeSave, removeGoods, pleaseCheck, reimbursementModify } from "@/api/standAlone/reimbursement";
  141. import { contrastObj, contrastList } from "@/util/contrastData";
  142. import check from "@/components/check/check";
  143. import checkSchedule from "@/components/check/checkSchedule";
  144. import reportDialog from "@/components/report-dialog/main";
  145. import { getDeptTree as getFeesId, getFeesList } from "@/api/basicData/basicFeesDesc";
  146. import { customerList as getKHList, detail as khDetail } from "@/api/basicData/customerInformation";
  147. import { getCorpDetail } from "@/api/maintenance/overpayment";
  148. import { integralDetail } from "@/api/maintenance/integral";
  149. import { getlistBankBy, getProfit } from "@/api/basicData/configuration";
  150. import da from "element-ui/src/locale/lang/da";
  151. export default {
  152. name: "detail",
  153. props: {
  154. detailData: {
  155. type: Object
  156. }
  157. },
  158. components: {
  159. check,
  160. checkSchedule,
  161. reportDialog
  162. },
  163. data() {
  164. return {
  165. roleName: localStorage.getItem("roleName").split(','),
  166. disabled: false,
  167. pageLoading: false,
  168. btnLoading: false,
  169. form: {},
  170. option: {
  171. menuBtn: false,
  172. labelWidth: 100,
  173. column: [
  174. {
  175. label: "申请报销人",
  176. prop: "userId",
  177. rules: [
  178. {
  179. required: true,
  180. message: " ",
  181. trigger: "change"
  182. }
  183. ],
  184. span: 8,
  185. slot: true,
  186. },
  187. {
  188. label: "提交时间",
  189. prop: "claimDate",
  190. span: 8,
  191. type: "date",
  192. format: "yyyy-MM-dd",
  193. valueFormat: "yyyy-MM-dd HH:mm:ss",
  194. rules: [
  195. {
  196. required: true,
  197. message: " ",
  198. trigger: "blur"
  199. }
  200. ]
  201. },
  202. {
  203. label: "要求支付日期",
  204. prop: "requiredPaymentTime",
  205. span: 8,
  206. type: "date",
  207. format: "yyyy-MM-dd",
  208. valueFormat: "yyyy-MM-dd HH:mm:ss"
  209. },
  210. {
  211. label: "所属公司",
  212. prop: "belongToCorpId",
  213. span: 16,
  214. slot: true,
  215. },
  216. {
  217. label: "所属部门",
  218. prop: "deptId",
  219. rules: [
  220. {
  221. required: true,
  222. message: " ",
  223. trigger: "blur"
  224. }
  225. ],
  226. span: 8,
  227. slot: true,
  228. },
  229. {
  230. label: "实报金额",
  231. prop: "totalAmount",
  232. disabled:true,
  233. span: 8,
  234. slot: true,
  235. },
  236. {
  237. label: "报销人银行户头",
  238. prop: "accountReimbursement",
  239. // type: 'select',
  240. // dicData: [],
  241. filterable: true,
  242. // props: {
  243. // label: "accountName",
  244. // value: "id"
  245. // },
  246. // change: (data) => {
  247. // let list = this.findObject(this.option.column, "accountReimbursement").dicData
  248. // for (let item of list) {
  249. // if (data.value == item.id) {
  250. // this.form.accountReimbursement = data.value
  251. // this.form.reimbursementAccountNo = item.accountBank
  252. // this.form.bankOfDeposit = item.accountNo
  253. // }
  254. // }
  255. // },
  256. span: 8,
  257. slot: true,
  258. },
  259. {
  260. label: "报销人账号",
  261. prop: "reimbursementAccountNo",
  262. span: 8,
  263. slot: true,
  264. },
  265. {
  266. label: "报销人开户行",
  267. prop: "bankOfDeposit",
  268. span: 8,
  269. slot: true,
  270. },
  271. {
  272. label: "系统编号",
  273. prop: "serialNo",
  274. disabled: true,
  275. span: 8,
  276. slot: true,
  277. },
  278. {
  279. label: "单据数量",
  280. prop: "billQuantity",
  281. span: 8,
  282. slot: true,
  283. },
  284. {
  285. label: "备注",
  286. prop: "remarks",
  287. type: "textarea",
  288. minRows: 2,
  289. span: 24,
  290. },
  291. ],
  292. },
  293. optionTwo: {
  294. menuBtn: false,
  295. labelWidth: 100,
  296. column: [
  297. {
  298. label: "支付时间",
  299. prop: "paymentTime",
  300. span: 8,
  301. type: "date",
  302. format: "yyyy-MM-dd",
  303. valueFormat: "yyyy-MM-dd HH:mm:ss"
  304. },
  305. {
  306. label: "支付方式",
  307. prop: "paymentMethodName",
  308. type: "select",
  309. dicUrl: "/api/blade-system/dict-biz/dictionary?code=payment_method",
  310. props: {
  311. label: "dictValue",
  312. value: "dictKey"
  313. },
  314. span: 8,
  315. slot: true,
  316. }, {
  317. label: "实际付款金额",
  318. prop: "paymentAmount",
  319. span: 8,
  320. slot: true,
  321. }, {
  322. label: "给付人",
  323. prop: "dans",
  324. filterable: true,
  325. type: "select",
  326. props: {
  327. label: "realName",
  328. value: "id"
  329. },
  330. span: 8,
  331. slot: true,
  332. }, {
  333. label: "财务出纳",
  334. prop: "financialCashier",
  335. type: "select",
  336. filterable: true,
  337. props: {
  338. label: "realName",
  339. value: "id"
  340. },
  341. span: 8,
  342. slot: true,
  343. }, {
  344. label: "科目编码",
  345. prop: "subjectCode",
  346. span: 8,
  347. slot: true,
  348. },
  349. ]
  350. },
  351. dataList: [],
  352. tableOption: {},
  353. goodsoptions: [],
  354. unitOption: [],
  355. paymentOption: [],
  356. fileList: [],
  357. selectionList: [],
  358. search: {},
  359. treeStyle: "height:" + (window.innerHeight - 315) + "px",
  360. goodsOption: {},
  361. loading: false,
  362. switchDialog: false, // 报表弹窗控制
  363. userList: [],
  364. dic: [], // 部门
  365. postDic: [], // 岗位
  366. loginUser: '', // 登录人
  367. breakConfiguration: {
  368. multipleChoices: false,
  369. multiple: false,
  370. disabled: false,
  371. searchShow: true,
  372. collapseTags: false,
  373. clearable: true,
  374. placeholder: "请点击右边按钮选择",
  375. dicData: []
  376. },
  377. oldForm: {},
  378. oldDataList: [],
  379. checkDisabled: false, // 审核状态
  380. checker: false,
  381. checkId: '',
  382. batchNo: '',
  383. checkDialog: false,
  384. checkScheduleDialog: false,
  385. checkData: {},
  386. dicArea: [],
  387. props: {
  388. value: 'value',
  389. label: 'title',
  390. },
  391. feesOption: [],
  392. tableOptionBack: {},
  393. key: 0,
  394. tenantId: JSON.parse(localStorage.getItem("saber-userInfo")).content.tenant_id
  395. }
  396. },
  397. async created() {
  398. if (this.tenantId == '681169') {
  399. this.tableOptionBack = tableOptionTwo
  400. } else {
  401. this.tableOptionBack = tableOption
  402. }
  403. this.$set(this.form, 'claimDate', getCurrentDate()); // 默认当前日期
  404. this.tableOption = await this.getColumnData(this.getColumnName(107), this.tableOptionBack);
  405. if (this.tableOption.column.find(item => item.prop == "quantity")) {
  406. this.findObject(this.tableOption.column, "quantity").change = (data) => {
  407. if (data.row.quantity && data.row.price) {
  408. data.row.amount = data.row.quantity * data.row.price
  409. }
  410. }
  411. }
  412. if (this.tableOption.column.find(item => item.prop == "price")) {
  413. this.findObject(this.tableOption.column, "price").change = (data) => {
  414. if (data.row.quantity && data.row.price) {
  415. data.row.amount = data.row.quantity * data.row.price
  416. }
  417. }
  418. }
  419. this.key++
  420. gainUser().then(res => {
  421. console.log(res)
  422. this.userList = res.data.data;
  423. this.findObject(this.optionTwo.column, "dans").dicData = res.data.data
  424. this.findObject(this.optionTwo.column, "financialCashier").dicData = res.data.data
  425. });
  426. getUserInfo().then(res => {
  427. this.$set(this.form, 'userId', res.data.data.id);
  428. this.$set(this.form, 'userName', res.data.data.realName);
  429. this.$set(this.form, 'deptId', res.data.data.deptId);
  430. this.$set(this.form, 'deptName', res.data.data.deptName);
  431. this.$set(this.form, 'bankOfDeposit', res.data.data.bankDeposit);
  432. this.$set(this.form, 'accountReimbursement', res.data.data.bankAccount);
  433. this.$set(this.form, 'reimbursementAccountNo', res.data.data.reimburseNumber);
  434. this.$set(this.form, 'postId', res.data.data.postId.split(',')[0]);
  435. this.$set(this.form, 'postName', res.data.data.postName.split(',')[0]);
  436. this.loginUser = res.data.data.realName;
  437. if (this.form.status == 3) {
  438. if (this.roleName.indexOf('财务') !== -1) {
  439. this.optionTwo.column.map(e => {
  440. this.$set(e, 'disabled', false)
  441. })
  442. }
  443. this.tableOption.column.map(e => {
  444. if (this.roleName.indexOf('财务') !== -1) {
  445. if (e.prop == 'subjectName') {
  446. this.$set(e, 'disabled', false)
  447. } else if (e.prop == 'accountingItemsName') {
  448. this.$set(e, 'disabled', false)
  449. } else {
  450. this.$set(e, 'disabled', true)
  451. }
  452. }
  453. })
  454. } else {
  455. this.optionTwo.column.map(e => {
  456. this.$set(e, 'disabled', true)
  457. })
  458. this.tableOption.column.map(e => {
  459. if (e.prop == 'subjectName') {
  460. this.$set(e, 'disabled', true)
  461. } else if (e.prop == 'accountingItemsName') {
  462. this.$set(e, 'disabled', true)
  463. } else {
  464. this.$set(e, 'disabled', false)
  465. }
  466. })
  467. }
  468. })
  469. getDeptTree().then(res => {
  470. this.dic = res.data.data
  471. })
  472. getPostList(1, 10).then(res => {
  473. if (res.data.data.total > 0) {
  474. this.postDic = res.data.data.records;
  475. if (Math.ceil(res.data.data.total / 10) > 1) {
  476. for (let i = 2; i <= Math.ceil(res.data.data.total / 10); i++) {
  477. getPostList(i, 10).then(e => {
  478. this.postDic = this.postDic.concat(e.data.data.records);
  479. });
  480. }
  481. }
  482. }
  483. });
  484. getFeesId().then(res => {
  485. this.dicArea = res.data.data;
  486. })
  487. getFeesList().then(res => {
  488. this.feesOption = res.data.data;
  489. });
  490. this.getWorkDicts('unit').then(res => {
  491. this.unitOption = res.data.data;
  492. })
  493. this.getWorkDicts("payment_term").then(res => {
  494. this.paymentOption = res.data.data;
  495. })
  496. if (this.detailData.query) {
  497. this.disabled = true;
  498. this.option.column.map(e => {
  499. this.$set(e, 'disabled', true)
  500. })
  501. this.optionTwo.column.map(e => {
  502. this.$set(e, 'disabled', true)
  503. })
  504. this.queryData(this.detailData.id);
  505. } else if (this.detailData.auditId) {
  506. this.checker = true;
  507. this.batchNo = this.detailData.check.batchNo
  508. this.queryData(this.detailData.id);
  509. }
  510. },
  511. filters: {
  512. IntegerFormat(num) {
  513. return IntegerFormat(num);
  514. },
  515. decimalFormat(num) {
  516. return num ? Number(num).toFixed(2) : "0.00";
  517. }
  518. },
  519. methods: {
  520. returnBack(row) {
  521. getlistBankBy(row.id).then(res => {
  522. console.log(res.data)
  523. this.findObject(this.option.column, "accountReimbursement").dicData = res.data
  524. })
  525. },
  526. // 查询
  527. queryData(id) {
  528. this.pageLoading = true;
  529. dataDetail({ id: id }).then(res => {
  530. this.form = res.data.data;
  531. this.fileList = this.form.fileList
  532. delete this.form.fileList
  533. this.dataList = this.form.itemList ? this.form.itemList : [];
  534. this.dataList.forEach(item => {
  535. this.moldChange(item.moldId, item, this.dicArea)
  536. if (item.payMethod) {
  537. item.payMethod = item.payMethod.toString();
  538. }
  539. })
  540. delete this.form.itemList;
  541. this.oldForm = this.deepClone({ ...this.form });
  542. this.oldDataList = this.deepClone([...this.dataList]);
  543. this.checkDisabled = this.form.status > 0 ? true : false;
  544. if (this.form.status > 0) {
  545. this.option.column.map(e => {
  546. this.$set(e, 'disabled', true)
  547. })
  548. this.optionTwo.column.map(e => {
  549. this.$set(e, 'disabled', true)
  550. })
  551. }
  552. }).finally(() => {
  553. this.pageLoading = false;
  554. })
  555. },
  556. //返回列表
  557. backToList() {
  558. this.$emit("goBack");
  559. },
  560. // 编辑按钮触发
  561. openEdit() {
  562. this.disabled = false;
  563. this.option.column.map(e => {
  564. if (this.checkDisabled) {
  565. this.$set(e, 'disabled', true)
  566. } else {
  567. if (e.prop != 'serialNo') {
  568. this.$set(e, 'disabled', false)
  569. }
  570. }
  571. })
  572. if (this.form.status == 3) {
  573. if (this.roleName.indexOf('财务') !== -1) {
  574. this.optionTwo.column.map(e => {
  575. this.$set(e, 'disabled', false)
  576. })
  577. }
  578. this.tableOption.column.map(e => {
  579. if (this.roleName.indexOf('财务') !== -1) {
  580. if (e.prop == 'subjectName') {
  581. this.$set(e, 'disabled', false)
  582. } else if (e.prop == 'accountingItemsName') {
  583. this.$set(e, 'disabled', false)
  584. } else {
  585. this.$set(e, 'disabled', true)
  586. }
  587. }
  588. })
  589. } else {
  590. this.optionTwo.column.map(e => {
  591. this.$set(e, 'disabled', true)
  592. })
  593. this.tableOption.column.map(e => {
  594. if (e.prop == 'subjectName') {
  595. this.$set(e, 'disabled', true)
  596. } else if (e.prop == 'accountingItemsName') {
  597. this.$set(e, 'disabled', true)
  598. } else {
  599. this.$set(e, 'disabled', false)
  600. }
  601. })
  602. }
  603. },
  604. // 复制
  605. copyDoc() {
  606. this.$emit("copyOrder", this.form.id);
  607. },
  608. //修改提交触发
  609. editCustomer(status) {
  610. for (let i = 0; i < this.dataList.length; i++) {
  611. if (this.dataList[i].amount == null) {
  612. return this.$message.error("报销明细第" + Number(i + 1) + "行的金额不能为空");
  613. }
  614. }
  615. this.$refs["form"].validate((valid, done) => {
  616. done();
  617. if (valid) {
  618. this.$set(this.form, 'itemList', this.dataList)
  619. let formTwo = {
  620. ...this.form,
  621. fileList: this.fileList
  622. }
  623. this.btnLoading = true;
  624. typeSave(formTwo).then(res => {
  625. this.$message({ type: "success", message: this.form.id ? "修改成功!" : "新增成功!" });
  626. this.queryData(res.data.data);
  627. }).finally(() => {
  628. this.btnLoading = false;
  629. })
  630. } else {
  631. return false
  632. }
  633. })
  634. },
  635. cellStyle() {
  636. return "padding:0;height:40px;";
  637. },
  638. async saveColumn() {
  639. const inSave = await this.saveColumnData(
  640. this.getColumnName(107),
  641. this.tableOption
  642. );
  643. if (inSave) {
  644. this.$message.success("保存成功");
  645. //关闭窗口
  646. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  647. this.$nextTick(() => {
  648. this.$refs.crud.doLayout()
  649. })
  650. }
  651. },
  652. async resetColumn() {
  653. this.tableOption = this.tableOptionBack;
  654. const inSave = await this.delColumnData(
  655. this.getColumnName(107), this.tableOptionBack
  656. );
  657. if (inSave) {
  658. this.$nextTick(() => {
  659. this.$refs.crud.doLayout()
  660. })
  661. this.$message.success("重置成功");
  662. //关闭窗口
  663. setTimeout(() => {
  664. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  665. }, 1000);
  666. }
  667. },
  668. //录入明细
  669. newDetails() {
  670. this.$refs["form"].validate((valid, done) => {
  671. done()
  672. if (valid) {
  673. this.dataList.push({
  674. $cellEdit: true,
  675. feeList: this.feesOption,
  676. expenseOwner: this.form.userName
  677. })
  678. }
  679. })
  680. },
  681. rowCell(row, index) {
  682. if (row.$cellEdit == true) {
  683. this.$set(row, "$cellEdit", false);
  684. } else {
  685. this.$set(row, "$cellEdit", true);
  686. }
  687. },
  688. rowDel(row, index) {
  689. this.$confirm("确定删除数据?", {
  690. confirmButtonText: "确定",
  691. cancelButtonText: "取消",
  692. type: "warning"
  693. }).then(() => {
  694. if (row.id) {
  695. removeGoods(row.id).then(res => {
  696. this.$message({
  697. type: 'success',
  698. message: '删除成功!'
  699. })
  700. this.dataList.splice(row.$index, 1);
  701. })
  702. } else {
  703. this.$message({
  704. type: "success",
  705. message: "删除成功!"
  706. });
  707. this.dataList.splice(row.$index, 1);
  708. }
  709. });
  710. },
  711. getKHData(row) { },
  712. //选择费用
  713. selectValue(value, row) {
  714. console.log(value)
  715. this.$set(row, "expenseItem", value.cname);
  716. },
  717. userHandle(row) {
  718. console.log()
  719. this.userList.forEach(item=>{
  720. if(row==item.id){
  721. this.form.userName=item.realName
  722. this.form.bankOfDeposit=item.bankDeposit
  723. this.form.accountReimbursement=item.bankAccount
  724. this.form.reimbursementAccountNo=item.reimburseNumber
  725. }
  726. })
  727. // this.form.userName = this.userList.find(item => item.id == this.form.userId).realName;
  728. },
  729. postHandle() {
  730. this.form.postName = this.postDic.find(item => item.id == this.form.postId).postName;
  731. },
  732. // 验证新旧值对比
  733. verification() {
  734. if (contrastObj(this.form, this.oldForm) ||
  735. contrastList(this.dataList, this.oldDataList)) {
  736. this.$confirm("数据发生变化未有提交记录, 是否提交?", "提示", {
  737. confirmButtonText: "确定",
  738. cancelButtonText: "取消",
  739. type: "warning"
  740. }).then(() => {
  741. this.editCustomer();
  742. }).catch(() => {
  743. return false; //取消改动数据
  744. })
  745. } else {
  746. return true;
  747. }
  748. },
  749. deptClick(data) {
  750. this.$set(this.form, 'deptName', data.title)
  751. },
  752. //报销完成
  753. reimbursementCompleted() {
  754. this.$set(this.form, 'itemList', this.dataList)
  755. let formTwo = {
  756. ...this.form,
  757. itemList: this.dataList,
  758. fileList: this.fileList
  759. }
  760. reimbursementModify(formTwo).then(res => {
  761. this.$message.success('生成成功')
  762. })
  763. },
  764. //打开审核
  765. openCheckDialog() {
  766. this.checkData = this.detailData.check
  767. this.checkDialog = true;
  768. },
  769. //关闭审核
  770. choceCheckFun() {
  771. this.checkDialog = false;
  772. },
  773. choceScheduleFun() {
  774. this.checkScheduleDialog = false
  775. },
  776. // 请核
  777. pleaseCheck() {
  778. if (this.verification()) {
  779. const data = {
  780. id: this.form.id,
  781. serialNo: this.form.serialNo,
  782. checkType: 'fybx',
  783. url: '/reimbursement/index',
  784. pageStatus: "this.$store.getters.reimbursementStatus",
  785. pageLabel: "报销",
  786. checkFlag: 1,
  787. }
  788. this.btnLoading = true;
  789. pleaseCheck(data).then(res => {
  790. this.$message.success('请核成功')
  791. this.queryData(this.form.id)
  792. }).catch(() => {
  793. this.$message.error('请核失败')
  794. }).finally(() => {
  795. this.btnLoading = false;
  796. })
  797. }
  798. },
  799. // 报表
  800. openReport() {
  801. this.switchDialog = !this.switchDialog;
  802. },
  803. // 报表关闭
  804. onClose(val) {
  805. this.switchDialog = val;
  806. },
  807. moldChange(e, row, list) {
  808. list.forEach(item => {
  809. if (e == item.value) {
  810. this.$set(row, 'mold', item.title);
  811. getFeesList({ feesTypeId: e }).then(res => {
  812. this.$set(row, 'feeList', res.data.data);
  813. this.$nextTick(() => {
  814. if (!(row.feeList.some(item => item.id == row.detailId))) {
  815. this.$set(row, 'detailId', null);
  816. }
  817. })
  818. });
  819. }
  820. if (item.hasChildren) {
  821. this.moldChange(e, row, item.children)
  822. }
  823. })
  824. },
  825. detailChange(row) {
  826. row.detail = row.feeList.find(item => item.id == row.detailId) ? row.feeList.find(item => item.id == row.detailId).cname : null
  827. },
  828. },
  829. }
  830. </script>
  831. <style scoped>
  832. </style>