ExpenseApplyFor.vue 38 KB

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