detail.vue 26 KB

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