ExpenseApplyFor.vue 36 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150
  1. <template>
  2. <div class="table_btnbox">
  3. <!-- 搜索 -->
  4. <el-row class="top">
  5. <el-form
  6. v-model="queryFrom"
  7. size="small"
  8. label-width="95px"
  9. class="query-form"
  10. >
  11. <el-form-item label="转账状态" label-width="95px" prop="transferFlag">
  12. <el-select
  13. v-model="queryFrom.transferFlag"
  14. placeholder="请选择转账状态"
  15. clearable
  16. >
  17. <el-option label="已转账" value="0"></el-option>
  18. <el-option label="未转账" value="1"></el-option>
  19. </el-select>
  20. </el-form-item>
  21. <el-form-item label="申请人" label-width="95px" prop="applicant">
  22. <el-input
  23. v-model="queryFrom.applicant"
  24. placeholder="请输入申请人"
  25. class="widths"
  26. clearable
  27. ></el-input>
  28. </el-form-item>
  29. <el-form-item label="申请部门" label-width="95px" prop="applySector">
  30. <el-input
  31. v-model="queryFrom.applySector"
  32. placeholder="请输入申请部门"
  33. class="widths"
  34. clearable
  35. ></el-input>
  36. </el-form-item>
  37. <el-form-item label="申请日期" label-width="95px" prop="applyTime">
  38. <el-date-picker
  39. v-model="queryFrom.applyTime"
  40. type="date"
  41. placeholder="选择日期"
  42. >
  43. </el-date-picker>
  44. </el-form-item>
  45. <el-form-item>
  46. <el-button type="primary" size="small" @click="queryStaffInfo"
  47. >查询</el-button
  48. >
  49. </el-form-item>
  50. </el-form>
  51. </el-row>
  52. <!-- 申请按钮 -->
  53. <el-button
  54. class="operation"
  55. type="primary"
  56. plain
  57. size="medium"
  58. @click="showExpense"
  59. >资金使用申请单</el-button
  60. >
  61. <el-button
  62. @click="expendDataup"
  63. type="primary"
  64. size="medium"
  65. :disabled="!this.expentList.length"
  66. >批量导出</el-button
  67. >
  68. <!-- 表格 -->
  69. <kt-common-table
  70. :operationWidth="operationWidth"
  71. class="ktTable"
  72. permsEdit="sys:agent:view"
  73. ref="dataTable"
  74. :data="pageResult"
  75. :columns="columns"
  76. editButtonName="编辑"
  77. button1Name="删除"
  78. button2Name="查看"
  79. button2Background="#409eff"
  80. :showBatchDelete="false"
  81. :showBatchPrint="true"
  82. :showOperation="true"
  83. @findPage="findPage"
  84. :isshowpagination="true"
  85. @handleEdit="expendEdit($event, 1)"
  86. @handleButton1="expendDelete"
  87. @handleButton2="expendEdit($event, 2)"
  88. @selectionChange="selectionChange"
  89. ></kt-common-table>
  90. <!-- 申请资金弹框 -->
  91. <el-dialog
  92. class="dialog"
  93. :title="expendTitle"
  94. :close-on-click-modal="false"
  95. :before-close="resetForm"
  96. :visible.sync="expenseDialog"
  97. width="60%"
  98. >
  99. <div class="dialog-body">
  100. <el-form
  101. :model="tableForm"
  102. :rules="tableFormRules"
  103. ref="tableForm"
  104. label-width="130px"
  105. size="small"
  106. class="tableForm"
  107. :disabled="formDisable"
  108. >
  109. <el-row>
  110. <el-col :span="12">
  111. <el-form-item label="支出单位:" prop="company">
  112. <el-select
  113. v-model="tableForm.company"
  114. filterable
  115. placeholder="支出单位"
  116. >
  117. <el-option
  118. v-for="(item, index) in innerCollectionData"
  119. :key="item.accountId + '' + index"
  120. :label="item.name"
  121. :value="item.bankCardNum"
  122. >
  123. </el-option>
  124. </el-select>
  125. </el-form-item>
  126. </el-col>
  127. <el-col :span="12">
  128. <el-form-item label="申请人" prop="applicant">
  129. <el-input
  130. type="text"
  131. resize="none"
  132. v-model="tableForm.applicant"
  133. ></el-input>
  134. </el-form-item>
  135. </el-col>
  136. </el-row>
  137. <el-row>
  138. <el-col :span="12">
  139. <el-form-item label="申请部门" prop="applySector">
  140. <el-input
  141. type="text"
  142. resize="none"
  143. v-model="tableForm.applySector"
  144. ></el-input>
  145. </el-form-item>
  146. </el-col>
  147. <el-col :span="12">
  148. <el-form-item label="申请日期" prop="applyTime">
  149. <el-date-picker
  150. v-model="tableForm.applyTime"
  151. align="right"
  152. type="date"
  153. value-format="yyyy-MM-dd"
  154. :picker-options="pickerOptions"
  155. >
  156. </el-date-picker>
  157. </el-form-item>
  158. </el-col>
  159. </el-row>
  160. <el-row class="collec">
  161. <el-col :span="12">
  162. <el-form-item
  163. label="收款单位信息"
  164. style="width: 100%"
  165. prop="collectionMessage"
  166. >
  167. <el-select
  168. v-model="tableForm.collectionMessage"
  169. filterable
  170. placeholder=""
  171. >
  172. <el-option
  173. v-for="(item, index) in collectionData"
  174. :key="item.accountId + 'aa' + index"
  175. :label="item.name"
  176. :value="item.bankCardNum"
  177. >
  178. </el-option>
  179. </el-select>
  180. </el-form-item>
  181. </el-col>
  182. <el-col :span="12">
  183. <el-form-item label="资金用途" prop="fundUse">
  184. <el-cascader
  185. v-model="tableForm.fundUse"
  186. :show-all-levels="true"
  187. :clearable="true"
  188. :checkStrictly="true"
  189. :emitPath="false"
  190. placeholder=""
  191. :options="fundFlowData"
  192. filterable
  193. :props="{
  194. children: 'child',
  195. label: 'category',
  196. value: 'category',
  197. checkStrictly: false,
  198. }"
  199. ></el-cascader>
  200. </el-form-item>
  201. </el-col>
  202. </el-row>
  203. <el-row>
  204. <el-col :span="24">
  205. <el-form-item label="资金流程" prop="payMethod" class="paymethod">
  206. <el-select
  207. v-model="tableForm.company"
  208. filterable
  209. placeholder=""
  210. disabled
  211. >
  212. <el-option
  213. v-for="(item, index) in innerCollectionData"
  214. :key="item.accountId + '' + index"
  215. :label="item.name"
  216. :value="item.bankCardNum"
  217. >
  218. </el-option>
  219. </el-select>
  220. <i class="el-icon-right"></i>
  221. <el-select
  222. v-model="tableForm.collectionMessage"
  223. filterable
  224. placeholder=""
  225. disabled
  226. >
  227. <el-option
  228. v-for="(item, index) in collectionData"
  229. :key="item.accountId + 'aa' + index"
  230. :label="item.name"
  231. :value="item.bankCardNum"
  232. >
  233. </el-option>
  234. </el-select>
  235. </el-form-item>
  236. </el-col>
  237. </el-row>
  238. <el-row>
  239. <el-col :span="12">
  240. <el-form-item label="申请金额(元)" prop="applyAmount">
  241. <el-input-number
  242. v-model="tableForm.applyAmount"
  243. :min="0"
  244. :precision="2"
  245. @blur="chageAppl"
  246. :max="99999999999999999"
  247. label=""
  248. ></el-input-number>
  249. </el-form-item>
  250. </el-col>
  251. <el-col :span="12">
  252. <el-form-item label="大写金额" prop="bigApplyAmount">
  253. <el-input
  254. type="text"
  255. resize="none"
  256. v-model="tableForm.bigApplyAmount"
  257. disabled
  258. ></el-input>
  259. </el-form-item>
  260. </el-col>
  261. </el-row>
  262. <el-row>
  263. <el-col :span="12">
  264. <el-form-item label="支付方式" prop="payMethod">
  265. <el-checkbox-group v-model="tableForm.payMethod">
  266. <el-checkbox
  267. v-for="payItem in payment_methodsData"
  268. :key="payItem.value"
  269. :label="payItem.label"
  270. :value="payItem.value"
  271. :disabled="payItem.value == 2"
  272. ></el-checkbox>
  273. </el-checkbox-group>
  274. </el-form-item>
  275. </el-col>
  276. <el-col :span="12">
  277. <el-form-item label="备注" prop="remark">
  278. <el-input
  279. type="text"
  280. resize="none"
  281. v-model="tableForm.remark"
  282. ></el-input>
  283. </el-form-item>
  284. </el-col>
  285. </el-row>
  286. <el-row style="margin-bottom: 20px">
  287. <el-col :span="12" style="text-align: center"
  288. ><h3>支出方资金归属(%)</h3>
  289. <span>(请输入资金归属百分比)</span></el-col
  290. >
  291. <el-col :span="12" style="text-align: center"
  292. ><h3>收入方资金归属(%)</h3>
  293. <span>(请输入资金归属百分比)</span></el-col
  294. >
  295. </el-row>
  296. <el-row class="profit_box">
  297. <el-col :span="12">
  298. <el-form-item
  299. v-for="item in affiliationData2"
  300. :key="item.profitId + 'zc'"
  301. :label="item.profitName"
  302. prop="entProfit"
  303. >
  304. <el-input-number
  305. v-model="item.profit"
  306. :min="0"
  307. placeholder="请输入利润(%)"
  308. :max="100"
  309. label=""
  310. ></el-input-number>
  311. </el-form-item>
  312. </el-col>
  313. <el-col :span="12">
  314. <el-form-item
  315. v-for="item in affiliationData"
  316. :key="item.profitId + 'sr'"
  317. :label="item.profitName"
  318. prop="entProfit"
  319. >
  320. <el-input-number
  321. v-model="item.profit"
  322. :min="0"
  323. placeholder="请输入利润(%)"
  324. :max="100"
  325. label=""
  326. ></el-input-number>
  327. </el-form-item>
  328. </el-col>
  329. </el-row>
  330. </el-form>
  331. </div>
  332. <div slot="footer" class="dialog-footer">
  333. <el-button @click="resetForm" size="small">取 消</el-button>
  334. <el-button
  335. v-if="!formDisable"
  336. type="primary"
  337. @click="submitForm"
  338. size="small"
  339. >{{ buttonValue }}</el-button
  340. >
  341. </div>
  342. </el-dialog>
  343. <!-- <el-dialog
  344. class="dialog"
  345. :title="expendTitle"
  346. :close-on-click-modal="false"
  347. :before-close="resetForm"
  348. :visible.sync="expenseaaa"
  349. width="60%"
  350. > -->
  351. <!-- <ExpenseManagement></ExpenseManagement> -->
  352. <!-- </el-dialog> -->
  353. <!-- 新增账户弹框 -->
  354. <!-- <expense-component
  355. ref="expenseComponent"
  356. :formData="formData"
  357. :title="title"
  358. :dialogFormVisible="dialogFormVisible"
  359. @resetForm="closeForm"
  360. @submitForm="submitUserForm"
  361. @setDateInterval="setDateInterval"
  362. @outChange="outChange"
  363. class="expense-component"
  364. ></expense-component> -->
  365. </div>
  366. </template>
  367. <script>
  368. import ExpenseComponent from "./ExpenseComponent.vue"; //新增账户信息弹框
  369. // import ExpenseManagement from "./ExpenseManagement.vue"; //新增账户信息
  370. import KtCommonTable from "@/views/Core/KtCommonTable.vue"; //表格组件
  371. import { toChies, convertPositive } from "../../../utils/moneyTransition";
  372. export default {
  373. name: "ExpenseApplyFor",
  374. components: { KtCommonTable, ExpenseComponent },
  375. data() {
  376. //开票金额自定义校验
  377. let applyAmountRules = (rule, value, callback) => {
  378. if (value == 0) {
  379. callback(new Error("申请金额不能小于0"));
  380. } else {
  381. callback();
  382. }
  383. };
  384. return {
  385. formDisable: false, //资金申请form表单是否可选状态
  386. expentList: [], //批量导出数据
  387. expenseaaa: true,
  388. expendTitle: "新增资金使用申请单", //弹框标题
  389. operationWidth: 250, //操作单元格宽度
  390. queryFrom: {}, //查询form表单
  391. pageRequest: {
  392. // 列表查询条件
  393. pageNo: 1,
  394. pageSize: 10,
  395. },
  396. dialogFormVisible: false, //账户信息弹出框状态
  397. title: "新增账户信息", //账户信息弹框标题
  398. expenseDialog: false, //申请单显示状态
  399. pageResult: {
  400. //表格参数
  401. pageNo: 1,
  402. pageSize: 10,
  403. content: [],
  404. },
  405. formData: {
  406. outerFlag: "0", //账户类别
  407. accountName: "", //户名
  408. accountQuality: "", //账户性质
  409. bankCardNum: "", //银行卡号
  410. bank: "", //开户行
  411. bankName: "", //开户行名称
  412. bankNum: "", //开户行号
  413. certExpirationDate: "", //证书有效期
  414. clearingProfit: "", //结算卡
  415. dayStrokeNum: "", //单日转账笔数限制
  416. exteriorProfit: "", //外部过账金额
  417. fiscalProfit: "", //财税公司利润
  418. insuranceProfit: "", //保险公司回款
  419. otherProfit: "", //其他利润
  420. parkProfit: "", //园区利润
  421. priDayLines: "", //对私单日限额
  422. priSingleLines: "", //对私单笔限额
  423. priYearExcess: "", //对私年剩余额度
  424. priYearLines: "", //对私年额度
  425. pubDayLines: "", //对公单日限额
  426. pubSingleLines: "", //对公单笔限额
  427. pubYearExcess: "", //对公年剩余额度
  428. pubYearLines: "", //对公年额度
  429. tianqinProfit: "", //天勤利润
  430. },
  431. columns: [
  432. // 申请列表表格头部
  433. {
  434. prop: "transferFlagName",
  435. label: "转账状态",
  436. minWidth: 80,
  437. sortable: false,
  438. },
  439. {
  440. prop: "applicant",
  441. label: "申请人",
  442. minWidth: 80,
  443. sortable: false,
  444. },
  445. {
  446. prop: "applySector",
  447. label: "申请部门",
  448. minWidth: 100,
  449. sortable: false,
  450. },
  451. {
  452. prop: "applyTime",
  453. label: "申请日期",
  454. minWidth: 100,
  455. sortable: false,
  456. },
  457. {
  458. prop: "applyAmount",
  459. label: "申请金额(元)",
  460. minWidth: 120,
  461. sortable: false,
  462. },
  463. {
  464. prop: "bigApplyAmount",
  465. label: "大写金额",
  466. minWidth: 150,
  467. sortable: false,
  468. },
  469. {
  470. prop: "company",
  471. label: "单位",
  472. minWidth: 260,
  473. sortable: false,
  474. },
  475. {
  476. prop: "collectionMessage",
  477. label: "收款单位信息",
  478. minWidth: 260,
  479. sortable: false,
  480. },
  481. {
  482. prop: "fundFlow",
  483. label: "资金流程",
  484. minWidth: 460,
  485. sortable: false,
  486. },
  487. {
  488. prop: "fundUse",
  489. label: "资金用途",
  490. minWidth: 100,
  491. sortable: false,
  492. },
  493. {
  494. prop: "remark",
  495. label: "备注",
  496. minWidth: 100,
  497. sortable: false,
  498. },
  499. {
  500. prop: "payMethod",
  501. label: "支付方式",
  502. minWidth: 160,
  503. sortable: false,
  504. },
  505. ],
  506. pickerOptions: {
  507. //日期快捷键
  508. disabledDate(time) {
  509. return time.getTime() > Date.now();
  510. },
  511. shortcuts: [
  512. {
  513. text: "今天",
  514. onClick(picker) {
  515. picker.$emit("pick", new Date());
  516. },
  517. },
  518. {
  519. text: "昨天",
  520. onClick(picker) {
  521. const date = new Date();
  522. date.setTime(date.getTime() - 3600 * 1000 * 24);
  523. picker.$emit("pick", date);
  524. },
  525. },
  526. {
  527. text: "一周前",
  528. onClick(picker) {
  529. const date = new Date();
  530. date.setTime(date.getTime() - 3600 * 1000 * 24 * 7);
  531. picker.$emit("pick", date);
  532. },
  533. },
  534. ],
  535. },
  536. payment_methodsData: [], //支付方式字典数据
  537. affiliationData: [], //归属字典数据
  538. affiliationData2: [], //归属字典数据
  539. collectionData: [], //收款单位信息数据
  540. innerCollectionData: [], //内部账户单位信息数据
  541. account_qualityData: [], //账户性质字典
  542. fundFlowData: [], //资金用途字典数据
  543. tableFormRules: {
  544. //资金申请单规则
  545. company: [
  546. {
  547. required: true,
  548. message: "请至少选择一个支出单位",
  549. trigger: "change",
  550. },
  551. ],
  552. applicant: [
  553. { required: true, message: "申请人不能为空", trigger: "blur" },
  554. ],
  555. applySector: [
  556. { required: true, message: "申请部门不能为空", trigger: "blur" },
  557. ],
  558. applyTime: [
  559. {
  560. type: "string",
  561. required: true,
  562. message: "请选择申请日期",
  563. trigger: "change",
  564. },
  565. ],
  566. applyAmount: [{ validator: applyAmountRules, trigger: "blur" }],
  567. remark: [{ required: true, message: "备注不能为空", trigger: "blur" }],
  568. type: [
  569. {
  570. type: "array",
  571. required: true,
  572. message: "请至少选择一个活动性质",
  573. trigger: "change",
  574. },
  575. ],
  576. collectionMessage: [
  577. { required: true, message: "请选择收款单位信息", trigger: "change" },
  578. ],
  579. fundUse: [
  580. { required: true, message: "请选择资金用途", trigger: "change" },
  581. ],
  582. },
  583. companyItem: {}, //选择单位整条数据
  584. collectionMessageItem: {}, //选择收款单位整条数据
  585. expendDataId: "", //修改时该条数据id
  586. buttonValue: "导 出", //弹框提交按钮内容
  587. //新增申请表单form表单
  588. tableForm: {
  589. company: "", //单位
  590. applicant: "", //申请人
  591. applySector: "", //申请部门
  592. applyTime: "", //申请日期
  593. collectionMessage: "", //收款单位信息
  594. fundFlow: "", //资金流程
  595. fundUse: "", //资金用途
  596. remark: "", //备注
  597. applyAmount: "", //申请金额
  598. bigApplyAmount: "", //大写金额
  599. payMethod: [], //支付方式
  600. },
  601. };
  602. },
  603. watch: {
  604. expenseDialog(n) {
  605. if (!n) {
  606. this.formDisable = false;
  607. this.$refs.tableForm.resetFields();
  608. // this.tableForm.payMethod = [
  609. // this.payment_methodsData.find((item) => item.value == 2).label,
  610. // ];
  611. //清除支出收入方资金归属值
  612. this.affiliationData.forEach((item) => {
  613. item.profit = 0;
  614. });
  615. this.affiliationData2.forEach((item) => {
  616. item.profit = 0;
  617. });
  618. //清除支出收入方资金归属值
  619. this.expendDataId = "";
  620. }
  621. },
  622. },
  623. created() {
  624. this.business("use_funds"); //备注字典
  625. this.business("payment_methods"); //支付方式字典
  626. this.business("account_quality"); //账户性质字典
  627. this.getTreeList(); //获取资金用途树字典
  628. this.getAllUser(); //获取所有银行账户信息
  629. this.getAffiliationData(); //获取归属数据
  630. },
  631. mounted() {},
  632. methods: {
  633. //表格多选事件
  634. selectionChange(e) {
  635. this.expentList = e.selections.map((item) => item.excelAccountOperateId);
  636. },
  637. //获取归属数据
  638. getAffiliationData() {
  639. this.$api.expense.getList().then((res) => {
  640. if (res.code == 200) {
  641. res.data.map((item) => {
  642. item.profit = 0;
  643. return item;
  644. });
  645. this.affiliationData = JSON.parse(JSON.stringify(res.data));
  646. this.affiliationData2 = JSON.parse(JSON.stringify(res.data));
  647. } else {
  648. this.$message.error(res.msg);
  649. }
  650. });
  651. },
  652. //导出公共方法
  653. expendDataup(e, idList) {
  654. idList = idList || this.expentList;
  655. this.$api.expense.excel(idList).then((response) => {
  656. if (response.code == 200) {
  657. if (response.data == null) {
  658. this.$message.error("暂无导出数据,请重试!");
  659. return;
  660. }
  661. let url = process.env.BASE_URL + "/upload/" + response.data; // 3.创建一个临时的url指向blob对象
  662. // 4.创建url之后可以模拟对此文件对象的一系列操作,例如:预览、下载
  663. let a = document.createElement("a");
  664. a.href = url;
  665. a.click();
  666. // 5.释放这个临时的对象url
  667. window.URL.revokeObjectURL(url);
  668. document.body.removeChild(a); //移除a标签
  669. this.resetForm();
  670. this.findPage();
  671. } else {
  672. this.$message.error(response.msg);
  673. }
  674. });
  675. },
  676. //点击编辑按钮
  677. expendEdit(index, type) {
  678. let row = index.row;
  679. if (type == 1) {
  680. if (row.transferFlag == 0) {
  681. this.$message.error("已转账数据不能操作");
  682. return;
  683. }
  684. } else {
  685. this.formDisable = true;
  686. }
  687. this.expendDataId = row.excelAccountOperateId;
  688. this.$api.expense
  689. .getAccountExcelById(row.excelAccountOperateId)
  690. .then((res) => {
  691. if (res.code == 200) {
  692. this.tableForm = JSON.parse(JSON.stringify(res.data));
  693. this.tableForm.payMethod = this.tableForm.payMethod.split(",");
  694. this.tableForm.collectionMessage = res.data.enterCardNum;
  695. this.tableForm.company = res.data.outCardNum;
  696. this.tableForm.fundUse = [
  697. this.tableForm.fundUse,
  698. this.tableForm.fundFen,
  699. ];
  700. //转换资金归属
  701. for (let key in res.data.outProfit) {
  702. this.affiliationData2.forEach((item) => {
  703. if (item.profitEng == key) {
  704. item.profit = convertPositive(res.data.outProfit[key] * -1);
  705. }
  706. });
  707. }
  708. for (let key in res.data.entProfit) {
  709. this.affiliationData.forEach((item) => {
  710. if (item.profitEng == key) {
  711. item.profit = convertPositive(res.data.entProfit[key]);
  712. }
  713. });
  714. }
  715. //转换资金归属
  716. } else {
  717. this.$message.error(res.msg);
  718. }
  719. });
  720. this.expendTitle = "编辑资金使用申请单";
  721. this.buttonValue = "确认提交";
  722. this.expenseDialog = true;
  723. },
  724. //删除数据事件
  725. expendDelete(index) {
  726. let row = index.row;
  727. if (row.transferFlag == 0) {
  728. this.$message.error("已转账数据不能操作");
  729. return;
  730. }
  731. this.$confirm("确认删除该条数据吗?", "提示", {
  732. type: "warning",
  733. })
  734. .then(() => {
  735. this.$api.expense
  736. .deleteAccountExcel(index.row.excelAccountOperateId)
  737. .then((res) => {
  738. if (res.code == 200) {
  739. this.$message.success("删除成功");
  740. this.findPage();
  741. } else {
  742. this.$message.error(res.msg);
  743. }
  744. });
  745. })
  746. .catch(() => {});
  747. },
  748. //获取资金用途树数据
  749. getTreeList() {
  750. this.$api.expense.getAccountExpensesTreeList().then((res) => {
  751. if (res.code == 200) {
  752. this.fundFlowData = res.data;
  753. this.fundFlowSet();
  754. } else {
  755. this.$message.error(res.msg);
  756. }
  757. });
  758. },
  759. //资金用途数据转换 如果最后一项child数组长度为0把值变为null
  760. fundFlowSet(data) {
  761. data = data || this.fundFlowData;
  762. for (var i = 0; i < data.length; i++) {
  763. if (data[i].child.length) {
  764. this.fundFlowSet(data[i].child);
  765. } else {
  766. data[i].child = null;
  767. }
  768. }
  769. },
  770. //搜索列表功能
  771. queryStaffInfo() {
  772. this.findPage();
  773. },
  774. //查询列表
  775. findPage(data) {
  776. if (data && data.pageRequest) {
  777. this.pageRequest.pageNo = data.pageRequest.pageNum;
  778. this.pageRequest.pageSize = data.pageRequest.pageSize;
  779. }
  780. let obj = { ...this.queryFrom, ...this.pageRequest };
  781. this.$api.expense
  782. .getAccountExcel(obj)
  783. .then((res) => {
  784. res.data.records.forEach((element) => {
  785. element.transferFlagName =
  786. element.transferFlag == 0 ? "已转账" : "未转账";
  787. });
  788. this.pageResult = {
  789. content: res.data.records,
  790. pageNum: res.data.current,
  791. pageSize: res.data.size,
  792. totalPages: res.data.pages,
  793. totalSize: res.data.total,
  794. };
  795. })
  796. .then(data != null ? data.callback : "");
  797. },
  798. //选择证书有效日期区间
  799. // setDateInterval(e) {
  800. // if (e != null && e != "") {
  801. // this.formData.startCertExpirationDate = e[0];
  802. // this.formData.endCertExpirationDate = e[1];
  803. // } else {
  804. // this.formData.startCertExpirationDate = "";
  805. // this.formData.endCertExpirationDate = "";
  806. // }
  807. // },
  808. //新增用户信息提交
  809. // submitUserForm() {
  810. // let params = JSON.parse(JSON.stringify(this.formData));
  811. // delete params.certExpirationDate;
  812. // //新增
  813. // this.$api.expense.insertAccount(params).then((res) => {
  814. // if (res.code == 200) {
  815. // this.$message({
  816. // message: "添加成功",
  817. // type: "success",
  818. // });
  819. // } else {
  820. // this.$message({
  821. // message: `添加失败, ${res.msg}`,
  822. // type: "error",
  823. // });
  824. // }
  825. // this.getAllUser();
  826. // this.closeForm();
  827. // });
  828. // },
  829. //弹框重新赋值
  830. // outChange(e) {
  831. // if (e == 1) {
  832. // this.formData = {
  833. // outerFlag: e, //账户类别
  834. // accountName: this.formData.accountName, //户名
  835. // accountQuality: this.formData.accountQuality, //账户性质
  836. // bankCardNum: this.formData.bankCardNum, //银行卡号
  837. // bank: this.formData.bank, //开户行
  838. // };
  839. // } else {
  840. // this.formData = {
  841. // outerFlag: e, //账户类别
  842. // accountName: this.formData.accountName, //户名
  843. // accountQuality: this.formData.accountQuality, //账户性质
  844. // bankCardNum: this.formData.bankCardNum, //银行卡号
  845. // bank: this.formData.bank, //开户行
  846. // bankName: "", //开户行名称
  847. // bankNum: "", //开户行号
  848. // certExpirationDate: "", //证书有效期
  849. // clearingProfit: "", //结算卡
  850. // dayStrokeNum: "", //单日转账笔数限制
  851. // exteriorProfit: "", //外部过账金额
  852. // fiscalProfit: "", //财税公司利润
  853. // insuranceProfit: "", //保险公司回款
  854. // otherProfit: "", //其他利润
  855. // parkProfit: "", //园区利润
  856. // priDayLines: "", //对私单日限额
  857. // priSingleLines: "", //对私单笔限额
  858. // priYearExcess: "", //对私年剩余额度
  859. // priYearLines: "", //对私年额度
  860. // pubDayLines: "", //对公单日限额
  861. // pubSingleLines: "", //对公单笔限额
  862. // pubYearExcess: "", //对公年剩余额度
  863. // pubYearLines: "", //对公年额度
  864. // tianqinProfit: "", //天勤利润
  865. // };
  866. // }
  867. // },
  868. //弹框取消重置
  869. // closeForm() {
  870. // this.dialogFormVisible = false;
  871. // this.formData = {
  872. // outerFlag: "0", //账户类别
  873. // accountName: "", //户名
  874. // accountQuality: "", //账户性质
  875. // bankCardNum: "", //银行卡号
  876. // bank: "", //开户行
  877. // bankName: "", //开户行名称
  878. // bankNum: "", //开户行号
  879. // certExpirationDate: "", //证书有效期
  880. // clearingProfit: "", //结算卡
  881. // dayStrokeNum: "", //单日转账笔数限制
  882. // exteriorProfit: "", //外部过账金额
  883. // fiscalProfit: "", //财税公司利润
  884. // insuranceProfit: "", //保险公司回款
  885. // otherProfit: "", //其他利润
  886. // parkProfit: "", //园区利润
  887. // priDayLines: "", //对私单日限额
  888. // priSingleLines: "", //对私单笔限额
  889. // priYearExcess: "", //对私年剩余额度
  890. // priYearLines: "", //对私年额度
  891. // pubDayLines: "", //对公单日限额
  892. // pubSingleLines: "", //对公单笔限额
  893. // pubYearExcess: "", //对公年剩余额度
  894. // pubYearLines: "", //对公年额度
  895. // tianqinProfit: "", //天勤利润
  896. // };
  897. // },
  898. //新增账户信息
  899. // addUserFn() {
  900. // this.dialogFormVisible = true;
  901. // },
  902. //获取所有账户信息
  903. getAllUser() {
  904. this.$api.expense.getAccountByAccountName().then((res) => {
  905. if (res.code == 200) {
  906. let arr = [];
  907. let newarr = [];
  908. res.data.forEach((item, index) => {
  909. if (item.invAccountCardList != null) {
  910. item.invAccountCardList.forEach((it) => {
  911. it.name =
  912. (item.outerFlag == 0 ? "内部用户" : "外部用户") +
  913. " " +
  914. (it.accountQuality == 0 ? "公户" : "私户") +
  915. " " +
  916. item.accountName +
  917. " " +
  918. it.bankCardNum +
  919. " " +
  920. it.bank;
  921. it.nameValue =
  922. item.accountName + " " + it.bankCardNum + " " + it.bank;
  923. });
  924. arr.push(...item.invAccountCardList);
  925. //获取全部内部用户
  926. if (item.outerFlag == 0) {
  927. newarr.push(...item.invAccountCardList);
  928. }
  929. }
  930. });
  931. this.innerCollectionData = newarr;
  932. this.collectionData = arr;
  933. }
  934. });
  935. },
  936. //申请金额填写完成后
  937. chageAppl(e) {
  938. this.tableForm.bigApplyAmount = toChies(this.tableForm.applyAmount);
  939. },
  940. //数据字典
  941. business(typeName) {
  942. this.$api.dict.findByLableName(typeName).then((res) => {
  943. this[typeName + "Data"] = res.data;
  944. if (typeName == "payment_methods") {
  945. this.tableForm.payMethod = [
  946. this[typeName + "Data"].find((item) => item.value == 2).label,
  947. ];
  948. }
  949. });
  950. },
  951. //费用申请弹框
  952. showExpense() {
  953. this.expendTitle = "新增资金使用申请单";
  954. this.buttonValue = "提 交";
  955. this.expenseDialog = true;
  956. },
  957. //取消隐藏弹框
  958. resetForm() {
  959. this.expenseDialog = false;
  960. },
  961. //导出事件
  962. submitForm() {
  963. let params = JSON.parse(JSON.stringify(this.tableForm));
  964. this.$refs.tableForm.validate((valid) => {
  965. if (valid) {
  966. params.payMethod = this.toPayment(params.payMethod); //支付方式转换
  967. let companyItem = this.collectionData.find((item) => {
  968. return item.bankCardNum === params.company;
  969. });
  970. let collectionMessageItem = this.collectionData.find(
  971. (item) => item.bankCardNum === params.collectionMessage
  972. );
  973. params.company = companyItem.nameValue; //单位
  974. params.outCardNum = companyItem.bankCardNum; //支出账户id
  975. params.outFlag = collectionMessageItem.outerFlag; //支出账户性质
  976. params.collectionMessage = collectionMessageItem.nameValue; //收入账户信息
  977. params.enterCardNum = collectionMessageItem.bankCardNum; //收入账户id
  978. params.fundUse =
  979. this.tableForm.fundUse[this.tableForm.fundUse.length - 2]; //资金用途
  980. params.fundFen =
  981. this.tableForm.fundUse[this.tableForm.fundUse.length - 1]; //资金用途分项
  982. params.fundFlow = params.company + "→" + params.collectionMessage; //资金流程
  983. //转化资金归属
  984. params.entProfit = {};
  985. params.outProfit = {};
  986. this.affiliationData.forEach((item) => {
  987. params.entProfit[item.profitEng] = item.profit;
  988. });
  989. this.affiliationData2.forEach((item) => {
  990. params.outProfit[item.profitEng] = item.profit*-1;
  991. });
  992. //转化资金归属
  993. if (this.expendDataId) {
  994. //修改
  995. params.expendDataId = this.expendDataId;
  996. this.$api.expense.update(params).then((res) => {
  997. if (res.code == 200) {
  998. this.resetForm();
  999. this.findPage();
  1000. } else {
  1001. this.$message.error(res.msg);
  1002. }
  1003. });
  1004. } else {
  1005. //新增+导出
  1006. this.$api.expense.insert(params).then((res) => {
  1007. if (res.code == 200) {
  1008. this.resetForm();
  1009. this.findPage();
  1010. } else {
  1011. this.$message.error(res.msg);
  1012. }
  1013. });
  1014. }
  1015. } else {
  1016. return false;
  1017. }
  1018. });
  1019. //校验
  1020. // if (!params.company) {
  1021. // this.$message.error("请选择单位");
  1022. // return;
  1023. // } else if (!params.applicant) {
  1024. // this.$message.error("申请人不能为空");
  1025. // return;
  1026. // } else if (!params.applySector) {
  1027. // this.$message.error("申请部门不能为空");
  1028. // return;
  1029. // } else if (!params.applyTime) {
  1030. // this.$message.error("请填写申请日期");
  1031. // return;
  1032. // } else if (!params.collectionMessage) {
  1033. // this.$message.error("请选择收款单位信息");
  1034. // return;
  1035. // } else if (!params.fundUse) {
  1036. // this.$message.error("请选择资金用途");
  1037. // return;
  1038. // } else if (params.applyAmount == 0) {
  1039. // this.$message.error("请填写金额");
  1040. // return;
  1041. // }
  1042. },
  1043. //支付方式转换
  1044. toPayment(list) {
  1045. let newList = [];
  1046. list.forEach((item) => {
  1047. let newItem = this.payment_methodsData.find(
  1048. (payItem) => payItem.label == item
  1049. );
  1050. if (newItem) {
  1051. newList.push(newItem.value);
  1052. }
  1053. });
  1054. newList.sort();
  1055. newList = newList.join(",");
  1056. return newList;
  1057. },
  1058. },
  1059. };
  1060. </script>
  1061. <style scoped>
  1062. .query-form {
  1063. display: flex;
  1064. align-items: center;
  1065. margin-top: 14px;
  1066. }
  1067. .td-title,
  1068. .demo-tableForm >>> .el-form-item__label {
  1069. color: #323335;
  1070. font-weight: bold;
  1071. text-align: center;
  1072. }
  1073. .td-content,
  1074. .demo-tableForm >>> .el-input.is-disabled .el-input__inner {
  1075. color: #474545;
  1076. }
  1077. .expense-table >>> .el-textarea__inner,
  1078. .expense-table >>> .el-input__inner {
  1079. border: none;
  1080. padding: 0;
  1081. text-align: center;
  1082. }
  1083. .expense-table >>> .el-form-item {
  1084. margin: 0;
  1085. padding: 0;
  1086. }
  1087. .tableForm >>> .el-checkbox-group,
  1088. .tableForm >>> .el-date-editor,
  1089. .tableForm >>> .el-select,
  1090. .tableForm >>> .el-input-number,
  1091. .tableForm >>> .el-cascader,
  1092. .tableForm >>> .el-select {
  1093. width: 100%;
  1094. }
  1095. .demo-tableForm >>> .el-input__inner {
  1096. border: none;
  1097. }
  1098. .demo-tableForm >>> .el-input__prefix,
  1099. .demo-tableForm >>> .el-select__caret {
  1100. display: none;
  1101. }
  1102. .idea-box >>> .el-input.is-disabled .el-input__inner,
  1103. .expense-table >>> .el-input.is-disabled .el-input__inner {
  1104. background-color: #fff;
  1105. }
  1106. .demo-tableForm >>> .el-input-number__decrease,
  1107. .demo-tableForm >>> .el-input-number__increase {
  1108. display: none;
  1109. }
  1110. .demo-tableForm >>> .el-checkbox__input.is-disabled + span.el-checkbox__label {
  1111. color: #409eff;
  1112. }
  1113. .demo-tableForm
  1114. >>> .el-checkbox__input.is-disabled.is-checked
  1115. .el-checkbox__inner {
  1116. background-color: #409eff;
  1117. border-color: #409eff;
  1118. color: #fff;
  1119. }
  1120. .demo-tableForm
  1121. >>> .el-checkbox__input.is-disabled.is-checked
  1122. .el-checkbox__inner::after {
  1123. border-color: #fff;
  1124. }
  1125. .demo-tableForm >>> .el-input__suffix {
  1126. display: none;
  1127. }
  1128. .el-icon-right {
  1129. font-size: 20px;
  1130. }
  1131. .operation {
  1132. margin-bottom: 15px;
  1133. }
  1134. .paymethod >>> .el-form-item__content {
  1135. display: flex;
  1136. align-items: center;
  1137. }
  1138. .el-icon-right {
  1139. margin: 0 10px;
  1140. }
  1141. .table_btnbox {
  1142. position: relative;
  1143. }
  1144. .dialog-body {
  1145. overflow-y: auto;
  1146. height: 500px;
  1147. }
  1148. </style>