移动端
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

853 lignes
32 KiB

  1. <template>
  2. <div class="app-container">
  3. <van-nav-bar
  4. left-arrow
  5. fixed
  6. placeholder
  7. @click-left="$router.back(-1)"
  8. >
  9. <template #title>
  10. <p style="font-weight: bold;">添加现金使用申请</p>
  11. </template>
  12. </van-nav-bar>
  13. <van-form @submit="getChange" @failed="getError" :show-error-message="false" scroll-to-error validate-first>
  14. <p class="main_title">基础信息</p>
  15. <div class="main_box">
  16. <van-field
  17. readonly
  18. clickable
  19. required
  20. :rules="[{ required: true , message:'请选择申请时间' }]"
  21. v-model="form.applyDate"
  22. label="申请时间"
  23. placeholder="请选择申请时间"
  24. @click="showlasj = true"
  25. input-align="right"
  26. right-icon="arrow-down"
  27. />
  28. <van-popup v-model="showlasj" position="bottom">
  29. <van-datetime-picker
  30. v-model="currentDate"
  31. type="date"
  32. title="选择年月日"
  33. :min-date="minDate"
  34. :max-date="maxDate"
  35. @confirm="onConfirmLasj"
  36. @cancel="showlasj = false"
  37. />
  38. </van-popup>
  39. <van-field
  40. readonly
  41. clickable
  42. required
  43. :rules="[{ required: true , message:'请选择资金支出类别' }]"
  44. label="资金支出类别"
  45. placeholder="请选择"
  46. v-model="capitalExpenditureType"
  47. @click="showcapital = true"
  48. input-align="right"
  49. right-icon="arrow-down"
  50. label-width="auto"
  51. />
  52. <van-popup v-model="showcapital" position="bottom">
  53. <van-picker
  54. show-toolbar
  55. :columns="capitalExpenditureTypeOptions"
  56. @confirm="onConfirmCapital"
  57. @cancel="showcapital = false"
  58. />
  59. </van-popup>
  60. <van-field
  61. readonly
  62. required
  63. label="使用总金额"
  64. v-model="form.expenditureAmount"
  65. placeholder="根据下方收款金额自动核算"
  66. input-align="right"
  67. label-width="auto"
  68. />
  69. </div>
  70. <div class="main_box" style="margin-top: 10px;">
  71. <van-field
  72. label="付款事由"
  73. v-model="form.remark"
  74. type="textarea"
  75. placeholder="请输入付款事由"
  76. input-align="right"
  77. rows="3"
  78. label-width="auto"
  79. required
  80. :rules="[{ required: true , message:'请输入付款事由' }]"
  81. />
  82. </div>
  83. <div class="main_box" style="margin-top: 10px;">
  84. <van-field label="说明情况" v-model="form.explainSituation" type="textarea" placeholder="请输入说明情况" input-align="right" rows="3" label-width="auto"/>
  85. </div>
  86. <p class="main_title" v-if="capitalExpenditureOpen">关联项目</p>
  87. <div class="main_box" v-if="capitalExpenditureOpen" style="margin-bottom: 10px;margin-top: 10px;position:relative;">
  88. <van-field
  89. readonly
  90. clickable
  91. label="项目名称"
  92. placeholder="请选择"
  93. v-model="projectForm.projectName"
  94. @click="showproject = true"
  95. input-align="right"
  96. right-icon="arrow-down"
  97. required
  98. :rules="[{ required: true , message:'请选择项目名称' }]"
  99. />
  100. <van-popup v-model="showproject" position="bottom">
  101. <van-picker
  102. show-toolbar
  103. :columns="projectListShow"
  104. @confirm="onConfirmProject"
  105. @cancel="showproject = false"
  106. />
  107. </van-popup>
  108. <van-field required :rules="[{ required: true , message:'请输入承建单位' }]" v-model="projectForm.projectContractor" label="承建单位" placeholder="请输入承建单位" input-align="right" label-width="auto"/>
  109. <van-field required :rules="[{ required: true , message:'请输入合同价款' }]" v-model="projectForm.projectAmount" label="合同价款(元)" placeholder="请输入合同价款(元)" input-align="right" label-width="auto"/>
  110. <van-field
  111. readonly
  112. clickable
  113. label="工程款类型"
  114. placeholder="请选择"
  115. v-model="projectFundType"
  116. @click="showFundType = true"
  117. input-align="right"
  118. right-icon="arrow-down"
  119. required
  120. :rules="[{ required: true , message:'请选择工程款类型' }]"
  121. />
  122. <van-popup v-model="showFundType" position="bottom">
  123. <van-picker
  124. show-toolbar
  125. :columns="projectFundTypeOptions"
  126. @confirm="onConfirmFundType"
  127. @cancel="showFundType = false"
  128. />
  129. </van-popup>
  130. <van-field required :rules="[{ required: true , message:'请输入工程发票号' }]" v-model="projectForm.projectBillNum" label="工程发票号" placeholder="请输入工程发票号" input-align="right" label-width="auto"/>
  131. </div>
  132. <p class="main_title">付款方信息</p>
  133. <div class="main_box">
  134. <!-- <van-field label="付款方" v-model="form.payer" placeholder="请输入付款方" input-align="right" label-width="auto"/>-->
  135. <van-field
  136. readonly
  137. clickable
  138. label="付款方"
  139. placeholder="请选择付款方"
  140. v-model="form.payer"
  141. @click="showpayer = true"
  142. input-align="right"
  143. right-icon="arrow-down"
  144. label-width="auto"
  145. required
  146. :rules="[{ required: true , message:'请选择付款方' }]"
  147. />
  148. <van-popup v-model="showpayer" position="bottom">
  149. <van-picker
  150. show-toolbar
  151. :columns="payerOptions"
  152. @confirm="onConfirmPayer($event)"
  153. @cancel="showpayer = false"
  154. />
  155. </van-popup>
  156. <van-field :rules="[{ required: true , message:'可用余额不能为空' }]" required label="可用余额(元)" v-model="form.payerAccount" placeholder="请输入可用余额" input-align="right" label-width="auto"/>
  157. </div>
  158. <p class="main_title">收款方信息<van-button icon="plus" @click="addChargeItme(chargeItme.length)" size="mini" type="info" native-type="button" class="addFamily"/></p>
  159. <div :style="{position:'relative',padding: index == 0 ? '':'10px 0 0 0'}" v-for="(item, index) in chargeItme" :key="index">
  160. <van-button icon="minus" size="mini" type="danger" class="deleteFamily" native-type="button" v-if="index!=0" @click="deleteChargeItme(index)" />
  161. <div class="main_box" style="margin-bottom: 10px;position:relative;">
  162. <van-field required :rules="[{ required: true , message:'请输入收款方全称' }]" v-model="item.payee" label="收款方" placeholder="请输入收款方全称" input-align="right" label-width="auto"/>
  163. <van-field required :rules="[{ required: true , message:'请输入提款人' }]" v-model="item.drawer" label="提款人" placeholder="请输入提款人" input-align="right" label-width="auto"/>
  164. <van-field required :rules="[{ required: true , message:'请输入提款金额' }]" v-model="item.incomeAmount" type="number" label="提款金额(元)" placeholder="请输入提款金额" input-align="right" label-width="auto" @change="moneyChange"/>
  165. <van-field required :rules="[{ required: true , message:'请输入资金用途' }]" v-model="item.remark" label="资金用途" placeholder="请输入资金用途" input-align="right" label-width="auto" />
  166. </div>
  167. </div>
  168. <p class="main_title">上传附件</p>
  169. <div class="main_box" style="padding: 5px 0 0 8px;">
  170. <van-uploader v-model="fileList" :after-read="beforeRead" @delete="deleteFile"></van-uploader>
  171. </div>
  172. <div style="padding: 16px 0;">
  173. <van-row>
  174. <van-col span="12" align="center">
  175. <!-- @click="goUpdate"-->
  176. <van-button type="info" native-type="submit" @click="buttonType='update'" class="submitButton">保<i style="margin-right: 1em;"></i>存</van-button>
  177. </van-col>
  178. <van-col span="12" align="center">
  179. <!-- @click="goAdd"-->
  180. <van-button type="info" native-type="submit" @click="buttonType='add'" class="submitButton">保存并提交</van-button>
  181. </van-col>
  182. </van-row>
  183. <div class="clear"></div>
  184. </div>
  185. </van-form>
  186. </div>
  187. </template>
  188. <script>
  189. import { addTransfer , listPayee , updateTransfer , getProjectto , listProject , addProjectto , cashSubmit , getAccount ,getQmyeFlow} from "@/api/onlineHome/bankAgriculture/paymentApproval";
  190. import request from '@/utils/request'
  191. import {
  192. addCash,
  193. addCashdetail, attachmentList,
  194. commonAttach, listAccount,
  195. updateCash
  196. } from "../../../../api/onlineHome/bankAgriculture/paymentApproval";
  197. import Dialog from "vant/lib/dialog";
  198. export default {
  199. name: "approvalAdd11",
  200. data() {
  201. return {
  202. showcapital:false,
  203. showpayee:false,
  204. showlasj:false,
  205. showbankType:false,
  206. showproject:false,
  207. showFundType:false,
  208. showpayer:false,
  209. buttonType:'a',
  210. minDate: new Date(2000, 1, 1),
  211. maxDate: new Date(2050, 12, 31),
  212. currentDate: new Date(),
  213. form:{},
  214. fileList:[],
  215. capitalExpenditureType:'',
  216. payee:'',
  217. bankType:'',
  218. wfydlxDictionaries:[],
  219. jglxDictionaries:[],
  220. sysDictionaries:[],
  221. capitalExpenditureTypeOptions:[],
  222. bankTypeDictionaries:[],
  223. projectList:[],
  224. projectFundTypeOptions:[],
  225. projectFundTypeDictionaries:[],
  226. projectListShow:[],
  227. payerOptions:[],
  228. chargeItme:[],
  229. chargeItmeShow:[],
  230. payeeList:[],
  231. // 查询参数
  232. queryParams: {
  233. transferType:"",
  234. orderByColumn: "id",
  235. isAsc: "desc",
  236. },
  237. capitalExpenditureOpen:false,
  238. projectForm:{
  239. projectId:null,
  240. projectName:null,
  241. projectContractor:null,
  242. projectAmount:null,
  243. projectBillNum:null,
  244. projectFundType:'1',
  245. outId:null,
  246. ynType:'2'
  247. },
  248. projectFundType:'',
  249. uploadFiles:[],
  250. };
  251. },
  252. created() {
  253. this.reset();
  254. let queryParams={
  255. pageNum: 1,
  256. pageSize: 100,
  257. }
  258. listProject(queryParams).then(response => {
  259. this.projectList = response.rows;
  260. for (var i = 0; i < response.rows.length; i++) {
  261. this.projectListShow.push({text: response.rows[i].projectName, value: response.rows[i].id});
  262. }
  263. });
  264. this.getDicts("project_fund_type").then((response) => {
  265. for (var i = 0; i < response.data.length; i++) {
  266. this.projectFundTypeOptions.push({text: response.data[i].dictLabel, value: response.data[i].dictValue});
  267. }
  268. this.projectFundTypeDictionaries = response.data;
  269. });
  270. let queryParamsOld={
  271. pageNum: 1,
  272. pageSize: 10,
  273. accountType: "101",
  274. status: "N",
  275. }
  276. listAccount(queryParamsOld).then((response) => {
  277. this.payerOptions = response.rows;
  278. response.rows.map((res,index) => {
  279. res['payerFrom'] = '1'
  280. console.log(res)
  281. this.payerOptions[index].text = res.accountName;
  282. this.payerOptions[index].value = res.id;
  283. })
  284. });
  285. this.getDictionaries();
  286. this.addChargeItme();
  287. },
  288. methods: {
  289. // 表单重置
  290. reset() {
  291. this.form = {
  292. id: null,
  293. upId: null,
  294. downId: null,
  295. orderId: null,
  296. cashierId: null,
  297. cashType: '11',
  298. accountType: '2',
  299. explainSituation: null,
  300. succeedAmount: null,
  301. payer: null,
  302. payerAccount: null,
  303. operatorCode: null,
  304. enterpriseCode: null,
  305. expenditureAmount: null,
  306. capitalExpenditureType: '1',
  307. remark: null,
  308. transferStatus: "0",
  309. auditStatus: "0",
  310. paymentState: "1",
  311. bankPriority: "0",
  312. clientPriority: "0"
  313. };
  314. this.processList = {}
  315. this.projectForm={
  316. projectId:null,
  317. projectName:null,
  318. projectContractor:null,
  319. projectAmount:null,
  320. projectBillNum:null,
  321. projectFundType:'1',
  322. outId:null,
  323. ynType:'2'
  324. }
  325. },
  326. getChange(){
  327. if(this.buttonType == 'update'){
  328. this.goUpdate();
  329. }else if(this.buttonType == 'add'){
  330. this.goAdd();
  331. }
  332. },
  333. getDictionaries(){
  334. this.getDicts("capital_expenditure_type").then((res) => {
  335. for (let i = 0; i < res.data.length; i++) {
  336. this.capitalExpenditureTypeOptions.push({text: res.data[i].dictLabel, value: res.data[i].dictValue});
  337. }
  338. });
  339. this.getPayeeList();
  340. },
  341. getError(e){
  342. this.$notify({ type: 'danger', message: e.errors[0].message });
  343. },
  344. addChargeItme(index){
  345. if(this.chargeItme.length>0&&this.chargeItme[this.chargeItme.length-1].payee == ''){
  346. this.$notify({ type: 'danger', message: '请勿添加多个空列表信息' });
  347. return;
  348. }else if(this.chargeItme.length>0&&this.chargeItme[index-1].incomeAmount == ''){
  349. this.$notify({ type: 'danger', message: '请输入提款金额!' });
  350. return;
  351. }else if(this.chargeItme.length>0&&this.chargeItme[index-1].drawer == ''){
  352. this.$notify({ type: 'danger', message: '请输入提款人!' });
  353. return;
  354. }else if(this.chargeItme.length>0&&this.chargeItme[index-1].remark == ''){
  355. this.$notify({ type: 'danger', message: '请输入资金用途!' });
  356. return;
  357. }
  358. this.getDicts("bank_type").then(res => {
  359. this.chargeItme.splice(index + 1, 0, {
  360. payeeId: "", //收款方ID
  361. payee: "", //收款方全称
  362. payeeAccount: "", //收款账户
  363. drawer: "", //提款人
  364. incomeAmount: "", //提款金额
  365. bankType: "", //资金用途
  366. showPayee:false,
  367. showbankType:false
  368. });
  369. });
  370. },
  371. getPayeeList() {
  372. //普通转账
  373. this.queryParams.accountType = this.form.accountType
  374. this.queryParams.status = "0"
  375. listPayee(this.queryParams).then((response) => {
  376. this.payeeList = response.rows;
  377. response.rows.map((res,index) => {
  378. this.payeeList[index].text = res.payee;
  379. this.payeeList[index].value = res.id;
  380. })
  381. });
  382. },
  383. payeeDictLabel(datas, value) {
  384. let actions = [];
  385. Object.keys(datas).some((key) => {
  386. if (datas[key].payeeId == ('' + value)) {
  387. actions.push(datas[key].payee);
  388. return true;
  389. }
  390. })
  391. return actions.join('');
  392. },
  393. onConfirmCapital(data){
  394. if (data.value != 2){
  395. this.capitalExpenditureOpen = false;
  396. this.projectForm = [];
  397. }else{
  398. this.capitalExpenditureOpen = true;
  399. }
  400. this.capitalExpenditureType = data.text;
  401. this.form.capitalExpenditureType = data.value;
  402. this.showcapital = false;
  403. },
  404. onConfirmFundType(data){
  405. console.log(data)
  406. this.projectForm.projectFundType = data.value;
  407. this.projectFundType = data.text;
  408. this.showFundType = false;
  409. },
  410. onConfirmProject(data){
  411. this.projectList.map(res => {
  412. if(res.projectName==data.text){
  413. this.projectForm.projectId = res.id
  414. this.projectForm.projectName = res.projectName
  415. this.projectForm.projectContractor = res.projectContractor
  416. this.projectForm.projectAmount = res.projectAmount
  417. }
  418. })
  419. this.showproject = false;
  420. },
  421. onConfirmPayee(data,index){
  422. for (var i = 0 ; i < this.chargeItme.length ; i++){
  423. this.chargeItme[i].showPayee = false;
  424. }
  425. this.chargeItme[index].payee = data.text;
  426. this.chargeItme[index].payeeId = data.value;
  427. this.chargeItme[index].showpayee = false;
  428. this.payeeSelectChange(data.value , index)
  429. },
  430. onConfirmBankType(data,index){
  431. for (var i = 0 ; i < this.chargeItme.length ; i++){
  432. this.chargeItme[i].showbankType = false;
  433. }
  434. this.chargeItme[index].bankTypeText = data.text;
  435. this.chargeItme[index].bankType = data.value;
  436. this.chargeItme[index].showbankType = false;
  437. },
  438. onConfirmPayer(data){
  439. this.form.payer = data.text;
  440. this.form.cashierId = data.value;
  441. this.showpayer = false;
  442. this.selectChange(data.value)
  443. },
  444. onConfirmLasj(data){
  445. this.form.applyDate = this.getNowFormatDate(data).substr(0,10);
  446. this.showlasj = false;
  447. },
  448. accountTypeChange(e){
  449. this.payeeList = [];
  450. this.queryParams.accountType = this.form.accountType
  451. this.queryParams.status = "0"
  452. listPayee(this.queryParams).then((response) => {
  453. this.payeeList = response.rows;
  454. response.rows.map((res,index) => {
  455. this.payeeList[index].text = res.payee;
  456. this.payeeList[index].value = res.id;
  457. })
  458. });
  459. },
  460. // 钱计算
  461. moneyChange(input) {
  462. if(this.form.cashType=='11'){
  463. console.log(input)
  464. if(this.form.payerAccount==0){
  465. this.$notify({ type: 'danger', message: '申请使用金额不能等于0!' });
  466. this.chargeItme = []
  467. this.addChargeItme();
  468. return false;
  469. }else {
  470. let obj = {};
  471. obj = this.chargeItme.find((account) => {
  472. //model就是上面的数据源
  473. return parseFloat(account.incomeAmount).toFixed(2) === input; //筛选出匹配数据
  474. });
  475. let total = 0;
  476. this.chargeItme.forEach((money) => {
  477. total = (parseFloat(total) + parseFloat(money.incomeAmount)).toFixed(2)
  478. });
  479. this.$set(this.form, "expenditureAmount", total);
  480. if(parseFloat(this.form.payerAccount)<parseFloat(this.form.expenditureAmount)){
  481. this.$notify({ type: 'danger', message: '申请使用金额不能大于可用余额!' });
  482. this.form.expenditureAmount=""
  483. this.chargeItme = []
  484. this.addChargeItme();
  485. return false;
  486. }
  487. }
  488. }else{
  489. let obj = {};
  490. obj = this.chargeItme.find((account) => {
  491. //model就是上面的数据源
  492. return parseFloat(account.incomeAmount).toFixed(2) === input; //筛选出匹配数据
  493. });
  494. let total = 0;
  495. this.chargeItme.forEach((money) => {
  496. total = (parseFloat(total) + parseFloat(money.incomeAmount)).toFixed(2)
  497. });
  498. this.$set(this.form, "expenditureAmount", total);
  499. }
  500. },
  501. goAdd(){
  502. if(this.chargeItme.length<1){
  503. this.$notify({ type: 'danger', message: '请添加收款方信息' });
  504. return;
  505. }
  506. if(this.form.remark != null && this.form.remark.indexOf("|")!=-1){
  507. this.$notify({ type: 'danger', message: '付款事由禁止包含!' });
  508. return;
  509. }
  510. if(this.form.capitalExpenditureType==2){
  511. if(this.projectForm.projectName==""||this.projectForm.projectName==null){
  512. this.$notify({ type: 'danger', message: '请选择项目名称!' });
  513. return;
  514. }
  515. if(this.projectForm.projectBillNum==""||this.projectForm.projectBillNum==null){
  516. this.$notify({ type: 'danger', message: '请输入工程发票号!' });
  517. return;
  518. }
  519. }
  520. if(this.uploadFiles==null||this.uploadFiles.length==0){
  521. Dialog.confirm({
  522. title: '提示',
  523. message: '此申请单中未上传任何附件,是否确认提交?',
  524. })
  525. .then(() => {
  526. addCash(this.form).then((response) => {
  527. this.chargeItme.map(res => {
  528. res.cashId = response.data.id
  529. addCashdetail(res).then(r => {
  530. if(this.form.capitalExpenditureType==2){
  531. this.projectForm.outId = response.data.id
  532. this.$set(this.projectForm, "ynType", '2');
  533. addProjectto(this.projectForm).then(res => {
  534. cashSubmit(response.data.id).then(res => {
  535. this.$toast.success('提交成功');
  536. setTimeout(function(){
  537. history.go(-1)
  538. },2000)
  539. })
  540. })
  541. }else{
  542. cashSubmit(response.data.id).then(res => {
  543. this.$toast.success('提交成功');
  544. setTimeout(function(){
  545. history.go(-1)
  546. },2000)
  547. })
  548. }
  549. })
  550. })
  551. });
  552. })
  553. }else{
  554. addCash(this.form).then((response) => {
  555. console.log(this.uploadFiles)
  556. this.uploadFiles.map(rr => {
  557. const params = new FormData();
  558. params.append("tableId", response.data.id);
  559. params.append("tableName", "t_yinnong_cash");
  560. params.append("bizPath", "upload");
  561. params.append("fileType", "0");
  562. params.append("file", rr);
  563. commonAttach(params).then((r) => {
  564. })
  565. })
  566. this.chargeItme.map(res => {
  567. res.cashId = response.data.id
  568. addCashdetail(res).then(r => {
  569. if(this.form.capitalExpenditureType==2){
  570. this.projectForm.outId = response.data.id
  571. this.$set(this.projectForm, "ynType", '2');
  572. addProjectto(this.projectForm).then(res => {
  573. cashSubmit(response.data.id).then(res => {
  574. this.$toast.success('提交成功');
  575. setTimeout(function(){
  576. history.go(-1)
  577. },2000)
  578. })
  579. })
  580. }else{
  581. cashSubmit(response.data.id).then(res => {
  582. this.$toast.success('提交成功');
  583. setTimeout(function(){
  584. history.go(-1)
  585. },2000)
  586. })
  587. }
  588. })
  589. })
  590. });
  591. }
  592. },
  593. goUpdate(){
  594. if(this.chargeItme.length<1){
  595. this.$notify({ type: 'danger', message: '请添加收款方信息' });
  596. return;
  597. }
  598. if(this.form.remark != null && this.form.remark.indexOf("|")!=-1){
  599. this.$notify({ type: 'danger', message: '付款事由禁止包含!' });
  600. return;
  601. }
  602. if(this.form.capitalExpenditureType==2){
  603. if(this.projectForm.projectName==""||this.projectForm.projectName==null){
  604. this.$notify({ type: 'danger', message: '请选择项目名称!' });
  605. return;
  606. }
  607. if(this.projectForm.projectBillNum==""||this.projectForm.projectBillNum==null){
  608. this.$notify({ type: 'danger', message: '请输入工程发票号!' });
  609. return;
  610. }
  611. }
  612. if(this.uploadFiles==null||this.uploadFiles.length==0){
  613. addCash(this.form).then((response) => {
  614. this.chargeItme.map(res => {
  615. res.cashId = response.data.id
  616. addCashdetail(res).then(r => {
  617. if(this.form.capitalExpenditureType==2){
  618. this.projectForm.outId = response.data.id
  619. this.$set(this.projectForm, "ynType", '2');
  620. addProjectto(this.projectForm).then(res => {
  621. this.$toast.success('保存成功');
  622. setTimeout(function(){
  623. history.go(-1)
  624. },2000)
  625. })
  626. }else{
  627. this.$toast.success('保存成功');
  628. setTimeout(function(){
  629. history.go(-1)
  630. },2000)
  631. }
  632. })
  633. })
  634. });
  635. }else{
  636. addCash(this.form).then((response) => {
  637. console.log(this.uploadFiles)
  638. this.uploadFiles.map(rr => {
  639. const params = new FormData();
  640. params.append("tableId", response.data.id);
  641. params.append("tableName", "t_yinnong_cash");
  642. params.append("bizPath", "upload");
  643. params.append("fileType", "0");
  644. params.append("file", rr);
  645. commonAttach(params).then((r) => {
  646. })
  647. })
  648. this.chargeItme.map(res => {
  649. res.cashId = response.data.id
  650. addCashdetail(res).then(r => {
  651. if(this.form.capitalExpenditureType==2){
  652. this.projectForm.outId = response.data.id
  653. this.$set(this.projectForm, "ynType", '2');
  654. addProjectto(this.projectForm).then(res => {
  655. this.$toast.success('保存成功');
  656. setTimeout(function(){
  657. history.go(-1)
  658. },2000)
  659. })
  660. }else{
  661. this.$toast.success('保存成功');
  662. setTimeout(function(){
  663. history.go(-1)
  664. },2000)
  665. }
  666. })
  667. })
  668. });
  669. }
  670. },
  671. payeeSelectChange(select, i) {
  672. let obj = {};
  673. let fuzhitype = 0;
  674. obj = this.payeeList.find((account) => {
  675. //model就是上面的数据源
  676. return account.id === select ; //筛选出匹配数据
  677. });
  678. if(this.chargeItme != [] && this.chargeItme.length>1){
  679. this.chargeItme.some((value, index) => {
  680. if(value.payeeAccount != undefined &&value.payeeAccount != '' && obj.payeeAccount == value.payeeAccount&&index!=i){
  681. fuzhitype = 2;
  682. return true;
  683. }
  684. if(value.accountType != undefined &&value.accountType != '' && obj.accountType != value.accountType&&index!=i){
  685. fuzhitype = 1;
  686. return true;
  687. }
  688. });
  689. }
  690. if(fuzhitype == 0){
  691. this.$set(this.chargeItme[i], "payee",obj.payee)
  692. this.$set(this.chargeItme[i], "bankType", obj.bankType)
  693. this.$set(this.chargeItme[i], "payeeId", obj.id);
  694. this.$set(this.chargeItme[i], "payeeAccount", obj.payeeAccount);
  695. this.$set(this.chargeItme[i], "bankDeposit", obj.bankDeposit);
  696. this.$set(this.chargeItme[i], "accountType", obj.accountType);
  697. }else if(fuzhitype == 1){
  698. this.$set(this.chargeItme[i], "payee",'')
  699. this.$set(this.chargeItme[i], "bankType",'')
  700. this.$set(this.chargeItme[i], "payeeId", '');
  701. this.$set(this.chargeItme[i], "payeeAccount", '');
  702. this.$set(this.chargeItme[i], "bankDeposit", '');
  703. this.$set(this.chargeItme[i], "accountType", '');
  704. this.$notify({ type: 'danger', message: '请选择账户类型相同的收款方!' });
  705. }else if(fuzhitype == 2){
  706. this.$set(this.chargeItme[i], "payee",'')
  707. this.$set(this.chargeItme[i], "bankType",'')
  708. this.$set(this.chargeItme[i], "payeeId", '');
  709. this.$set(this.chargeItme[i], "payeeAccount", '');
  710. this.$set(this.chargeItme[i], "bankDeposit", '');
  711. this.$set(this.chargeItme[i], "accountType", '');
  712. this.$notify({ type: 'danger', message: '收款方已存在!' });
  713. }
  714. },
  715. selectChange(select) {
  716. let obj = {};
  717. obj = this.payerOptions.find((account) => {
  718. //model就是上面的数据源
  719. return account.id === select; //筛选出匹配数据
  720. });
  721. if(obj.payerFrom==1&&obj.operatorCode != null && obj.operatorCode != "" &&
  722. obj.enterpriseCode != null && obj.enterpriseCode != "" &&
  723. obj.accountPassword != null && obj.accountPassword != ""){
  724. this.$set(this.form, "bookId", obj.bookId);
  725. this.$set(this.form, "deptId", obj.deptId);
  726. this.$set(this.form, "cashierId", obj.id);
  727. this.$set(this.form, "payer", obj.accountName);
  728. this.$set(this.form, "payerAccount", obj.balance);
  729. this.$set(this.form, "operatorCode", obj.operatorCode);
  730. this.$set(this.form, "enterpriseCode", obj.enterpriseCode);
  731. this.$set(this.form, "payerFrom", '1');
  732. }else{
  733. if(obj.payerFrom==1){
  734. this.diglogStatus = false;
  735. this.$notify({ type: 'danger', message: "请完善付款方“操作员代码”、“企业编码”、“支付口令”等信息!" });
  736. this.$set(this.form,"payer","")
  737. this.$set(this.form,"payerAccount","")
  738. }else{
  739. this.$set(this.form, "payerFrom", obj.parerFrom);
  740. if(obj.operatorCode!=null&&obj.operatorCode!=''){
  741. this.$set(this.form, "operatorCode", obj.operatorCode);
  742. }else{
  743. this.$set(this.form, "operatorCode", '');
  744. }
  745. if(obj.enterpriseCode!=null&&obj.enterpriseCode!=''){
  746. this.$set(this.form, "enterpriseCode", obj.enterpriseCode);
  747. }else{
  748. this.$set(this.form, "enterpriseCode", '');
  749. }
  750. if(obj.accountPassword!=null&&obj.accountPassword!=''){
  751. this.$set(this.form, "accountPassword", obj.accountPassword);
  752. }else{
  753. this.$set(this.form, "accountPassword", '');
  754. }
  755. this.$set(this.form, "bookId",'');
  756. this.$set(this.form, "deptId", '');
  757. this.$set(this.form, "cashierId", obj.id);
  758. this.$set(this.form, "payer", obj.accountName);
  759. this.$set(this.form, "payerAccount", obj.balance);
  760. }
  761. }
  762. },
  763. beforeRead(file) {
  764. this.uploadFiles.push(file.file);
  765. },
  766. deleteFile(file){
  767. this.uploadFiles.map((response,index) => {
  768. if(file.file == response){
  769. this.uploadFiles.splice(index,1)
  770. }
  771. })
  772. },
  773. getFileList(){
  774. let oData= {
  775. tableId: this.$route.query.id,
  776. tableName: "t_yinnong_cash",
  777. bizPath: "upload",
  778. fileType: "0",
  779. }
  780. attachmentList(oData).then(res => {
  781. console.log(res)
  782. console.log(location.protocol+"//"+location.host+request.defaults.baseURL)
  783. res.rows.map(r => {
  784. let baseUrl = location.protocol+"//"+location.host+request.defaults.baseURL
  785. this.fileList.push({"url":baseUrl + r.fileUrl,"file":new File([],r.fileName,{})})
  786. console.log(r)
  787. })
  788. })
  789. },
  790. goBack(){
  791. window.history.go(-1)
  792. },
  793. //删除家庭成员
  794. deleteChargeItme(index){
  795. this.chargeItme.splice(index,1)
  796. },
  797. },
  798. }
  799. </script>
  800. <style scoped lang="scss">
  801. .app-container {
  802. padding: 2% 0;
  803. }
  804. .main_title{
  805. font-size: 0.4rem;
  806. color: #1D6FE9;
  807. margin: 0.2rem 6%;
  808. position: relative;
  809. }
  810. .main_box{
  811. width: 96%;
  812. margin: 0 auto;
  813. border-radius: 6px;
  814. box-shadow: 0px 3px 6px 0px rgba(0,0,0,0.16);
  815. overflow: hidden;
  816. background-color: #FFF;
  817. }
  818. .submitButton{
  819. width: 80%;
  820. margin: 0 auto;
  821. background-color: #1D6FE9;
  822. }
  823. .addFamily{
  824. position: absolute;
  825. top: -2px;
  826. right: 0;
  827. border-radius: 50%;
  828. }
  829. .deleteFamily{
  830. position: absolute;
  831. top: 0rem;
  832. right: 6%;
  833. z-index: 9;
  834. border-radius: 50%;
  835. }
  836. </style>