ExpenseApplyFor.vue 36 KB

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