PaymentDia.vue 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762
  1. <template xmlns:v-slot="http://www.w3.org/1999/XSL/Transform">
  2. <div>
  3. <el-dialog
  4. :title="title"
  5. :close-on-click-modal="false"
  6. draggable
  7. append-to-body
  8. width="1300px"
  9. @close="close"
  10. @keyup.enter.native="doSubmit"
  11. v-model="visible">
  12. <el-form :model="inputForm" ref="inputForm" v-loading="loading" :class="method==='view'?'readonly':''" :disabled="status === 'audit' || status === 'taskFormDetail' || method === 'view'"
  13. label-width="160px" @submit.native.prevent>
  14. <el-divider content-position="left"><i class="el-icon-document"></i>
  15. <span style="color: red;border-top: 20px">*</span>项目
  16. <el-button style="margin-left: 20px" type="primary" :readonly="true" :disabled="status === 'audit' || status === 'taskFormDetail' || method === 'view'" @click="insertEvent('base')" plain>
  17. 新增
  18. </el-button>
  19. </el-divider>
  20. <el-row :gutter="15">
  21. <el-col :span="24">
  22. <vxe-table
  23. border
  24. :footer-method="footerMethod2"
  25. show-overflow
  26. show-footer
  27. ref="baseTable"
  28. :key="baseKey"
  29. class="vxe-table-element"
  30. :data="inputForm.projectDTOList"
  31. style="margin-left: 5em"
  32. @cell-click=""
  33. @edit-closed=""
  34. keep-source
  35. :readonly="true"
  36. highlight-current-row
  37. :edit-rules="tableRules"
  38. :edit-config="{trigger: 'click', mode: 'cell', showStatus: true, autoClear: true, icon: '-'}"
  39. >
  40. <vxe-table-column field="name" align="center" title="项目名称" :edit-render="{}" show-overflow="title">
  41. <template v-slot:edit="scope">
  42. <el-input :disabled="status === 'audit' || status === 'taskFormDetail' || method === 'view'" @focus="openProgramPageForm(scope.$rowIndex)" placeholder="请填写项目名称" :readonly="true" v-model="scope.row.name"/>
  43. </template>
  44. </vxe-table-column>
  45. <vxe-table-column field="contractNo" align="center" title="合同编号" :edit-render="{}">
  46. <template v-slot:edit="scope">
  47. <el-input :disabled="true" :readonly="true" placeholder="请填写合同编号" v-model="scope.row.ncontractNo"/>
  48. </template>
  49. </vxe-table-column>
  50. <vxe-table-column field="contractName" align="center" title="合同名称" :edit-render="{}">
  51. <template v-slot:edit="scope">
  52. <el-input :disabled="true" placeholder="请填写合同名称" v-model="scope.row.contractName"/>
  53. </template>
  54. </vxe-table-column>
  55. <vxe-table-column title="操作" align="center" width="100">
  56. <template v-slot="scope">
  57. <el-button :disabled="status === 'audit' || status === 'taskFormDetail' || method === 'view'" type="danger" @click="removeEvent(scope.row,scope.$rowIndex,'base')">删除</el-button>
  58. </template>
  59. </vxe-table-column>
  60. </vxe-table>
  61. </el-col>
  62. </el-row>
  63. <el-divider content-position="left"><i class="el-icon-document"></i>
  64. 付款信息
  65. </el-divider>
  66. <el-row :gutter="15">
  67. <el-col :span="12">
  68. <el-form-item label="付款编号" prop="no"
  69. :rules="[ ]">
  70. <el-input :disabled="true" placeholder="编号自动生成" v-model="inputForm.no" ></el-input>
  71. </el-form-item>
  72. </el-col>
  73. <el-col :span="12">
  74. <el-form-item label="收款类别" prop="proceedType"
  75. :rules="[{required: true, message:'收款类别不能为空', trigger:'blur'}]">
  76. <el-radio-group v-model="inputForm.proceedType">
  77. <el-radio label="0">单位</el-radio>
  78. <el-radio label="1">个人</el-radio>
  79. </el-radio-group>
  80. </el-form-item>
  81. </el-col>
  82. <el-col :span="12">
  83. <el-form-item label="收款单位" prop="proceedOfficeName"
  84. :rules="[
  85. {required: true, message:'收款单位不能为空', trigger:'blur'},{required: true, message:'收款单位不能为空', trigger:'change'}
  86. ]">
  87. <el-input :readonly="true" placeholder="请填写收款单位" v-model="inputForm.proceedOfficeName" @focus="openWorkClientForm()" clearable></el-input>
  88. </el-form-item>
  89. </el-col>
  90. <el-col :span="12">
  91. <el-form-item label="开户银行" prop="ourBank"
  92. :rules="[
  93. {required: true, message:'开户银行不能为空', trigger:'blur'},{required: true, message:'开户银行不能为空', trigger:'change'}
  94. ]">
  95. <el-select v-model="inputForm.ourBank" @change="changeBank" placeholder="请选择开户银行" clearable style="width: 100%;">
  96. <el-option
  97. v-for="item in bankList"
  98. :key="item.id"
  99. :label="item.ourBank"
  100. :value="item.id">
  101. </el-option>
  102. </el-select>
  103. </el-form-item>
  104. </el-col>
  105. <el-col :span="12">
  106. <el-form-item label="开户账号" prop="bankNumber"
  107. :rules="[{required: true, message:'开户账号不能为空', trigger:'blur'}]">
  108. <el-input :disabled="true" placeholder="请输入开户账号" v-model="inputForm.bankNumber"></el-input>
  109. </el-form-item>
  110. </el-col>
  111. <el-col :span="12">
  112. <el-form-item label="税号" prop="dutyNumber"
  113. :rules="[]">
  114. <el-input placeholder="请输入税号" v-model="inputForm.dutyNumber"></el-input>
  115. </el-form-item>
  116. </el-col>
  117. <el-col :span="12">
  118. <el-form-item label="累计已支付金额" prop="amountPaid"
  119. :rules="[{required: true, message:'请输入累计已支付金额', trigger:'blur'}]">
  120. <el-input v-on:input="inputForm.amountPaid=inputForm.amountPaid.replace(/[^\d.]/g,'')
  121. .replace(/^\./g,'')
  122. .replace(/\.{2,}/g,'.')
  123. .replace('.','$#$').replace(/\./g,'').replace('$#$','.')
  124. .replace(/^(\-)*(\d+)\.(\d\d).*$/,'$1$2.$3').replace(/^0+/, '0')" :disabled="status === 'audit' || status === 'taskFormDetail' || method === 'view'" placeholder="请输入累计已支付金额" v-model="inputForm.amountPaid" clearable></el-input>
  125. </el-form-item>
  126. </el-col>
  127. <el-col :span="12">
  128. <el-form-item label="付款人" prop="paymentUser"
  129. :rules="[]">
  130. <!-- <UserSelectSignatory style="width: 100%" ref="userSelect2" :limit="1"-->
  131. <!-- :readonly="true" :modelValue="inputForm.paymentUser"-->
  132. <!-- @update:modelValue='(value) => {inputForm.paymentUser = value}'></UserSelectSignatory>-->
  133. <UserSelect :readonly="true" :disabled="status === 'audit' || status === 'taskFormDetail'" :limit='1' :modelValue="inputForm.paymentUser" @update:modelValue='(value,label) => {inputForm.paymentUser = value}'></UserSelect>
  134. </el-form-item>
  135. </el-col>
  136. <el-col :span="12">
  137. <el-form-item label="付款时间" prop="paymentTime"
  138. :rules="[]">
  139. <el-date-picker
  140. style="width: 100%"
  141. v-model="inputForm.paymentTime"
  142. type="date"
  143. value-format="YYYY-MM-DD"
  144. placeholder="请选择时间"
  145. :default-value="new Date()"
  146. />
  147. </el-form-item>
  148. </el-col>
  149. <el-col :span="12">
  150. <el-form-item label="付款方式" prop="paymentType"
  151. :rules="[{required: true, message:'请选择付款方式', trigger:'blur'}]"
  152. >
  153. <el-select v-model="inputForm.paymentType" placeholder="请选择付款方式" clearable style="width: 100%;">
  154. <el-option
  155. v-for="item in $dictUtils.getDictList('jy_payment_type')"
  156. :key="item.value"
  157. :label="item.label"
  158. :value="item.value">
  159. </el-option>
  160. </el-select>
  161. </el-form-item>
  162. </el-col>
  163. <el-col :span="24">
  164. <el-form-item label="付款理由或用途" prop="reason"
  165. :rules="[{required: true, message:'请输入付款理由或用途', trigger:'blur'} ]">
  166. <el-input :disabled="status === 'audit' || status === 'taskFormDetail' || method === 'view'" type="textarea" placeholder="请输入付款理由或用途" maxlength="500" style="width:100%" v-model="inputForm.reason" show-word-limit></el-input>
  167. </el-form-item>
  168. </el-col>
  169. <el-col :span="12">
  170. <el-form-item label="付款金额(小写)" prop="paymentLower"
  171. :rules="[{required: true, message:'请输入付款金额(小写)', trigger:'blur'}]">
  172. <el-input v-on:input="inputForm.paymentLower=inputForm.paymentLower.replace(/[^\d.]/g,'')
  173. .replace(/^\./g,'')
  174. .replace(/\.{2,}/g,'.')
  175. .replace('.','$#$').replace(/\./g,'').replace('$#$','.')
  176. .replace(/^(\-)*(\d+)\.(\d\d).*$/,'$1$2.$3').replace(/^0+/, '0')" @blur="convert(this.inputForm.paymentLower)" :disabled="status === 'audit' || status === 'taskFormDetail' || method === 'view'" placeholder="请输入付款金额" v-model="inputForm.paymentLower" clearable></el-input>
  177. </el-form-item>
  178. </el-col>
  179. <el-col :span="12">
  180. <el-form-item label="付款金额(大写)" prop="payment"
  181. :rules="[]">
  182. <el-input :disabled="true" placeholder="请输入付款金额" v-model="inputForm.payment"></el-input>
  183. </el-form-item>
  184. </el-col>
  185. <el-col :span="24">
  186. <el-form-item label="付款项目摘要" prop="remarks"
  187. :rules="[]">
  188. <el-input :disabled="status === 'audit' || status === 'taskFormDetail' || method === 'view'" type="textarea" placeholder="请输入付款项目摘要" maxlength="500" style="width:100%" v-model="inputForm.remarks" show-word-limit></el-input>
  189. </el-form-item>
  190. </el-col>
  191. </el-row>
  192. </el-form>
  193. <!-- 附件 -->
  194. <UpLoadComponent ref="uploadComponent"></UpLoadComponent>
  195. <ProjectForm ref="projectForm" @getProgram="getProgram"></ProjectForm>
  196. <WorkClientChooseRadio ref="workClientChooseRadio" @getWorkClientRadioChoose="getWorkClientRadioChoose"></WorkClientChooseRadio>
  197. <template #footer>
  198. <span class="dialog-footer">
  199. <el-button @click="close()" icon="el-icon-circle-close">关闭</el-button>
  200. <el-button type="primary" v-if="method != 'view'" @click="doSubmit()" icon="el-icon-circle-check" v-noMoreClick>确定</el-button>
  201. </span>
  202. </template>
  203. </el-dialog>
  204. </div>
  205. </template>
  206. <script>
  207. import XEUtils from 'xe-utils'
  208. import PaymentService from '@/api/jy/PaymentService'
  209. import { ElDatePicker } from 'element-plus';
  210. import CommonApi from '@/api/cw/common/CommonApi'
  211. import ProjectForm from './ProjectForm'
  212. import WorkClientChooseRadio from '../workClientInfo/WorkClientChooseRadio'
  213. import UserSelectSignatory from '../workClientInfo/clientUserSelect'
  214. import WorkClientService from '@/api/jy/WorkClientService'
  215. import UserSelect from '@/components/userSelect'
  216. import UpLoadComponent from '@/views/common/UpLoadComponent'
  217. export default {
  218. props: {
  219. businessId: {
  220. type: String,
  221. default: ''
  222. },
  223. formReadOnly: {
  224. type: Boolean,
  225. default: false
  226. },
  227. status: {
  228. type: String,
  229. default: ''
  230. }
  231. },
  232. data () {
  233. return {
  234. title: '',
  235. method: '',
  236. loading: false,
  237. visible: false,
  238. inputForm: {
  239. id: '',
  240. no: '',
  241. paymentUser: this.$store.state.user.id,
  242. paymentTime:this.moment(new Date()).format('YYYY-MM-DD'),
  243. reason: '',
  244. paymentLower:'', // 付款金额小写
  245. payment:'', //付款金额大写
  246. procInsId:'',
  247. status:'',
  248. projectDTOList:[],
  249. ourBank:'', //开户银行
  250. bankNumber:'', // 银行账号
  251. dutyNumber:'', //税号
  252. remarks:'',//摘要
  253. proceedOfficeId:'',//收款单位id
  254. proceedOfficeName:'',//收款单位名称
  255. amountPaid:'', //累计已支付金额
  256. proceedType:'', //收款类别
  257. paymentType:'', //付款方式
  258. files:[]
  259. },
  260. baseKey: '',
  261. keyWatch: '',
  262. dateList:[],
  263. programRow:'',
  264. bankList:[]
  265. }
  266. },
  267. PaymentService:null,
  268. CommonApi:null,
  269. workClientService: null,
  270. created () {
  271. console.log('jld ')
  272. this.paymentService=new PaymentService()
  273. this.commonApi = new CommonApi()
  274. this.workClientService = new WorkClientService()
  275. },
  276. mounted () {
  277. },
  278. activated () {
  279. },
  280. components: {
  281. ElDatePicker,
  282. ProjectForm,
  283. WorkClientChooseRadio,
  284. UserSelectSignatory,
  285. UserSelect,
  286. UpLoadComponent,
  287. },
  288. computed: {
  289. bus: {
  290. get () {
  291. this.$refs.uploadComponent.setDividerName('附件')
  292. return this.businessId
  293. },
  294. set (val) {
  295. this.businessId = val
  296. }
  297. }
  298. },
  299. watch: {
  300. 'keyWatch': {
  301. handler (newVal) {
  302. if (this.bus) {
  303. if (this.bus !== 'false') {
  304. this.init('', this.bus)
  305. }
  306. } else {
  307. this.$nextTick(() => {
  308. this.$refs.inputForm.resetFields()
  309. })
  310. }
  311. }
  312. },
  313. 'loading': {
  314. handler (newVal) {
  315. this.$emit('changeLoading', newVal)
  316. this.$refs.uploadComponent.changeLoading(newVal)
  317. }
  318. }
  319. },
  320. methods: {
  321. getKeyWatch(keyWatch) {
  322. this.keyWatch = keyWatch
  323. },
  324. init(method, id) {
  325. this.method = method
  326. this.inputForm={
  327. id: '',
  328. no: '',
  329. paymentUser: this.$store.state.user.id,
  330. paymentTime:'',
  331. reason: '',
  332. paymentLower:'', // 付款金额小写
  333. payment:'', //付款金额大写
  334. procInsId:'',
  335. status:'',
  336. projectDTOList:[],
  337. ourBank:'', //开户银行
  338. bankNumber:'', // 银行账号
  339. dutyNumber:'', //税号
  340. remarks:'',//摘要
  341. proceedOfficeId:'',//收款单位id
  342. proceedOfficeName:'',//收款单位名称
  343. amountPaid:'', //累计已支付金额
  344. proceedType:'', //收款类别
  345. paymentType:'', //付款方式
  346. files:[]
  347. }
  348. this.inputForm.id = id
  349. this.loading = false
  350. this.visible = true
  351. this.$nextTick(() => {
  352. this.$refs.inputForm.resetFields()
  353. this.loading = true
  354. if (this.commonJS.isNotEmpty(this.inputForm.id)) {
  355. console.log('this.inputForm.id', this.inputForm.id)
  356. this.paymentService.queryById(this.inputForm.id).then((data)=>{
  357. this.$refs.uploadComponent.clearUpload()
  358. this.inputForm = this.recover(this.inputForm, data)
  359. if (this.commonJS.isEmpty(data.projectDTOList)){
  360. this.inputForm.projectDTOList=[]
  361. }
  362. if (this.commonJS.isEmpty(this.inputForm.paymentUser)){
  363. this.inputForm.paymentUser== this.$store.state.user.id
  364. }
  365. if (this.commonJS.isNotEmpty(this.inputForm.proceedOfficeId)){
  366. this.workClientService.findById(this.inputForm.proceedOfficeId).then((da)=>{
  367. console.log('da',da)
  368. this.inputForm.proceedOfficeName=da.workClientInfo.name
  369. this.inputForm.proceedOfficeId=da.workClientInfo.Id
  370. if (this.commonJS.isNotEmpty(da.workClientBank)){
  371. da.workClientBank.forEach(item => {
  372. item.ourBank=item.ourBank
  373. this.bankList.push(item)
  374. this.inputForm.ourBank=item.id
  375. this.inputForm.bankNumber=item.bankNumber
  376. })
  377. }else {
  378. this.bankList = []
  379. }
  380. })
  381. }
  382. if (this.commonJS.isEmpty(this.inputForm.files)) {
  383. this.inputForm.files = []
  384. }
  385. this.$refs.uploadComponent.newUpload(method, this.inputForm.files, 'paymentMoney')
  386. })
  387. this.loading = false
  388. }
  389. })
  390. },
  391. saveForm(callback) {
  392. this.doSubmit('save', callback)
  393. },
  394. startForm(callback) {
  395. this.loading = true
  396. if (this.commonJS.isNotEmpty(this.inputForm.id)) {
  397. this.paymentService.queryById(this.inputForm.id).then((data) => {
  398. if (data.status !== '0' && data.status !== '1' && data.status !== '3') { // 审核状态不是“未发起”或“暂存”或“撤回”,就弹出提示
  399. this.loading = false
  400. this.$message.error('任务数据已发生改变或不存在,请在待办任务中确认此任务是否存在')
  401. throw new Error()
  402. } else {
  403. this.doSubmit('start', callback)
  404. }
  405. })
  406. } else {
  407. this.doSubmit('start', callback)
  408. }
  409. },
  410. async agreeForm(callback) {
  411. console.log('进入方法')
  412. this.loading = true
  413. await this.paymentService.queryById(this.inputForm.id).then((data) => {
  414. if (data.status !== '2' ) { // status的值不等于“审核中”,就弹出提示
  415. this.loading = false
  416. this.$message.error('任务数据已发生改变或不存在,请在待办任务中确认此任务是否存在')
  417. throw new Error()
  418. } else {
  419. this.inputForm.status= '2'
  420. this.commonApi.getTaskNameByProcInsId(this.inputForm.procInsId).then((data)=>{
  421. if (this.commonJS.isNotEmpty(data)) {
  422. if (data === '总经理审核') {
  423. this.inputForm.status = '5'
  424. }
  425. }
  426. let param = {status: this.inputForm.status, id: this.inputForm.id}
  427. this.paymentService.updateStatusById(param).then(() => {
  428. callback(data.businessTable, data.businessId, this.inputForm)
  429. this.loading = false
  430. }).catch(() => {
  431. this.loading = false
  432. })
  433. })
  434. }
  435. })
  436. },
  437. reapplyForm(callback) {
  438. this.loading = true
  439. this.paymentService.queryById(this.inputForm.id).then((data) => {
  440. if (data.status !== '4') { // 审核状态不是“驳回”,就弹出提示
  441. this.loading = false
  442. this.$message.error('任务数据已发生改变或不存在,请在待办任务中确认此任务是否存在')
  443. throw new Error('任务数据已发生改变或不存在,请在待办任务中确认此任务是否存在')
  444. } else {
  445. this.doSubmit('reapply', callback)
  446. }
  447. })
  448. },
  449. // 表单提交
  450. async doSubmit(status, callback) {
  451. this.loading = true
  452. if (this.commonJS.isEmpty(this.inputForm.paymentUser)){
  453. this.inputForm.paymentUser== this.$store.state.user.id
  454. }
  455. console.log('5',this.inputForm)
  456. if (status === 'save') {
  457. // 暂存
  458. this.loading = true
  459. this.inputForm.status = '1'
  460. this.paymentService.saveForm(this.inputForm).then((data) => {
  461. callback(data.businessTable, data.businessId, this.inputForm)
  462. this.loading = false
  463. }).catch(() => {
  464. this.loading = false
  465. })
  466. return
  467. } else if (status === 'start') {
  468. if (this.commonJS.isEmpty(this.inputForm.projectDTOList)) {
  469. this.$message.error('请选择项目')
  470. this.loading = false
  471. }
  472. if (this.commonJS.isEmpty(this.inputForm.proceedOfficeName)) {
  473. this.$message.error('请选择收款单位')
  474. this.loading = false
  475. }
  476. if (this.commonJS.isEmpty(this.inputForm.proceedType)) {
  477. this.$message.error('请选择收款类别')
  478. this.loading = false
  479. }
  480. if (this.commonJS.isEmpty(this.inputForm.amountPaid)) {
  481. this.$message.error('请输入累计已支付金额')
  482. this.loading = false
  483. }
  484. if (this.commonJS.isEmpty(this.inputForm.reason)) {
  485. this.$message.error('请输入付款用途')
  486. this.loading = false
  487. }
  488. if (this.commonJS.isEmpty(this.inputForm.paymentLower)) {
  489. this.$message.error('请输入付款金额')
  490. this.loading = false
  491. }
  492. if (this.commonJS.isEmpty(this.inputForm.paymentType)) {
  493. this.$message.error('请选择付款方式')
  494. this.loading = false
  495. }
  496. // 送审 待审核
  497. this.inputForm.status = '2'
  498. } else if (status === 'agree') {
  499. this.inputForm.status= '5'
  500. } else if (status === 'reapply') {
  501. this.inputForm.status = '2'
  502. }
  503. this.$refs['inputForm'].validate((valid) => {
  504. if (valid) {
  505. this.loading = true
  506. console.log('form',this.inputForm)
  507. this.paymentService.adminEditForm(this.inputForm).then((data) => {
  508. this.visible=false
  509. this.$emit('refreshList')
  510. }).catch(() => {
  511. this.$refs.inputForm.resetFields()
  512. this.loading = false
  513. })
  514. } else {
  515. this.loading = false
  516. }
  517. })
  518. },
  519. close() {
  520. this.inputForm = {
  521. id: '',
  522. no: '',
  523. paymentUser: this.$store.state.user.id,
  524. paymentTime:'',
  525. reason: '',
  526. paymentLower:'', // 付款金额小写
  527. payment:'', //付款金额大写
  528. procInsId:'',
  529. status:'',
  530. projectDTOList:[],
  531. ourBank:'', //开户银行
  532. bankNumber:'', // 银行账号
  533. dutyNumber:'', //税号
  534. remarks:'',//摘要
  535. }
  536. this.visible = false
  537. },
  538. async updateStatusById(type, callback) {
  539. this.loading = true
  540. if (type === 'reject' || type === 'reback') {
  541. this.paymentService.queryById(this.inputForm.id).then((data) => {
  542. if (data.status !== '2') { // status的值不等于“审核中”,就弹出提示
  543. this.loading = false
  544. this.$message.error('任务数据已发生改变或不存在,请在待办任务中确认此任务是否存在')
  545. throw new Error()
  546. } else {
  547. // if (type === 'agree') {
  548. // // 同意
  549. // this.inputForm.status = '5'
  550. // }
  551. if (type === 'reject') {
  552. // 驳回
  553. this.inputForm.status = '4'
  554. }
  555. if (type === 'reback') {
  556. // 撤回
  557. this.inputForm.status = '3'
  558. }
  559. if (type === 'reject' || type === 'reback') {
  560. let param = {status: this.inputForm.status, id: this.inputForm.id}
  561. this.paymentService.updateStatusById(param).then(() => {
  562. this.loading = false
  563. callback()
  564. })
  565. }
  566. }
  567. })
  568. } else if (type === 'hold') {
  569. this.paymentService.queryById(this.inputForm.id).then((data) => {
  570. if (data.status !== '4') { // status的值不等于“驳回”就弹出提示
  571. this.loading = false
  572. this.$message.error('任务数据已发生改变或不存在,请在待办任务中确认此任务是否存在')
  573. throw new Error()
  574. } else {
  575. // 终止
  576. let param = {status: '1', id: this.inputForm.id}
  577. this.paymentService.updateStatusById(param).then(() => {
  578. this.loading = false
  579. callback()
  580. })
  581. }
  582. })
  583. }
  584. },
  585. convert(money){
  586. if (!money) { return this.inputForm.payment='';}
  587. //数字的汉字数组
  588. let numberCNList = ['零', '壹', '贰', '叁', '肆', '伍', '陆', '柒', '捌', '玖'];
  589. //数字的基础单位汉字数组
  590. let numberBaseUnit = ['', '拾', '佰', '仟'];
  591. //数字的高级单位汉字数组
  592. let numberHighUnit = ['', '万', '亿', '兆'];// 一兆等于一万亿
  593. //小数部分单位汉字数组
  594. let floatUnit = ['角', '分', '毫', '厘'];
  595. //整数金额时后面跟的字符
  596. let integerLastCN = '整';
  597. //整数后的单位汉字
  598. let integerLastUnit = '元';
  599. //最大处理的数字
  600. let maxNum = 999999999999999.9999;
  601. //以小数点拆分金额产生的数组
  602. let decimalPointSplitList;
  603. //金额整数部分
  604. let integerNum;
  605. //金额小数部分
  606. let decimalNum;
  607. //返回的大写金额
  608. let moneyCNString = '';
  609. money = parseFloat(money);// 转为数字
  610. if(typeof money !== 'number' || isNaN(money)){this.$message('检测到非数字字符');return '';}
  611. //超出最大处理数字
  612. if (money >= maxNum) {this.$message('超出最大处理数字');return '';}
  613. // 等于0时 返回零元整
  614. if (money === 0) {
  615. moneyCNString = numberCNList[0] + integerLastUnit + integerLastCN;
  616. return moneyCNString;
  617. }
  618. //转换为字符串
  619. money = money.toString();
  620. /******金额数字的处理,转为字符串,判断有没有小数位,获取整数部分和小数部分*******/
  621. if (money.indexOf('.') === -1) {// 如果没有小数点
  622. integerNum = money;// money就都等于整数部分,小数部分为空
  623. decimalNum = '';
  624. } else {// 有小数点
  625. decimalPointSplitList = money.split('.');// 以小数点拆分数组
  626. if(decimalPointSplitList[1].length > 4)this.$message('金额精确仅支持到厘');
  627. integerNum = decimalPointSplitList[0];// 整数部分
  628. decimalNum = decimalPointSplitList[1].substr(0, 4);// 小数部分只支持4位
  629. }
  630. /******整数部分处理*******/
  631. if (parseInt(integerNum, 10) > 0) {// 以十进制转为int类型 大于零
  632. let zeroCount = 0;// 记录零的个数
  633. for (let i = 0; i < integerNum.length; i++) {
  634. let p = integerNum.length - 1 - i;// 当前数字的位数, 比如10000 ,1的位数是4 , 10001000,第一个1的位数是7,第二个1的位数是3
  635. console.log(p,integerNum[i]);
  636. let q = p / 4;// 当前数字位数 除以 4 商0余1,则值为0,控制其高级单位
  637. let m = p % 4;// 取余,比如1%4 商0余1 ,则值为1, 控制其基础单位
  638. // 如果当前数字等于零 则++
  639. if (integerNum[i] === '0') {zeroCount++;}
  640. // 否则当前数字不等于零时
  641. else {
  642. // 如果记录的零的个数大于0 返回结果中加一个汉字零
  643. if (zeroCount > 0) {moneyCNString += numberCNList[0];}
  644. //把零的个数归零,重新计算零的个数
  645. zeroCount = 0;
  646. // 然后把返回结果 加上 当前数字的汉字以及其基础单位
  647. moneyCNString += numberCNList[parseInt(integerNum[i])] + numberBaseUnit[m];
  648. }
  649. // 如果当前数字所在位数取余4等于0时,那么除以4一定是整数,并且记录的零的个数小于4个,则拼接当前位数对应的高级单位
  650. if (m === 0 && zeroCount < 4) {moneyCNString += numberHighUnit[q];}
  651. }
  652. moneyCNString += integerLastUnit;// 整数部分结束后 拼接上整数部分单位 元
  653. }
  654. /******小数部分处理 --- 小数部分只考虑是否有值,以及当前值所在单位,没有零的概念,所以只需拼接当前值对应的汉字,以及当前值的单位即可*******/
  655. if (decimalNum !== '') {
  656. for (let i = 0; i < decimalNum.length; i++) {
  657. if (decimalNum[i] !== '0') {// 如果当前数字不等于零 则加上当前数字的汉字 以及 其小数单位
  658. moneyCNString += numberCNList[Number(decimalNum[i])] + floatUnit[i];
  659. }
  660. }
  661. }else {// 如果没有小数部分则加上汉字 整
  662. moneyCNString += integerLastCN;
  663. }
  664. this.inputForm.payment= moneyCNString;
  665. },
  666. insertEvent(type) {
  667. if (type === 'base') {
  668. if (this.inputForm.projectDTOList.length>=1){
  669. if (this.commonJS.isEmpty(this.inputForm.projectDTOList[0].projectId)){
  670. this.$message.error('第一行不能为空')
  671. return
  672. }
  673. }
  674. this.$refs.baseTable.insertAt({})
  675. this.inputForm.projectDTOList.push({})
  676. this.baseKey = Math.random()
  677. }
  678. console.log('22',this.inputForm.projectDTOList)
  679. },
  680. // 删除
  681. removeEvent(row, rowIndex, type) {
  682. if (type === 'base') {
  683. this.$refs.baseTable.remove(row)
  684. this.inputForm.projectDTOList.splice(rowIndex, 1)
  685. }
  686. },
  687. openProgramPageForm(rowIndex) {
  688. this.$refs.projectForm.init()
  689. this.programRow = rowIndex
  690. console.log('11',this.programRow)
  691. },
  692. getProgram(rows) {
  693. console.log('1',rows)
  694. rows.forEach((item, index) => {
  695. this.inputForm.programId = item.id
  696. if (index === 0) {
  697. let r = this.inputForm.projectDTOList[this.programRow]
  698. r.projectId=item.id
  699. r.name = item.name
  700. r.contractNo = item.contractNo
  701. r.contractName = item.contractName
  702. console.log('2',this.inputForm.projectDTOList[this.programRow])
  703. } else {
  704. let r = {
  705. projectId: item.id,
  706. name: item.name,
  707. contractNo: item.contractNo,
  708. contractName: item.contractName,
  709. }
  710. this.$refs.baseTable.insertAt(r)
  711. this.inputForm.projectDTOList.push(r)
  712. this.baseKey = Math.random()
  713. }
  714. })
  715. this.$forceUpdate()
  716. this.programRow = ''
  717. // this.inputForm.reconciliationArea = this.inputForm.financeInvoiceBaseDTOList[0].location
  718. },
  719. openWorkClientForm() {
  720. this.$refs.workClientChooseRadio.init()
  721. },
  722. getWorkClientRadioChoose(row){
  723. console.log('row',row)
  724. console.log('row1',row.backs)
  725. this.bankList=[]
  726. this.inputForm.proceedOfficeId=row.id
  727. this.inputForm.proceedOfficeName=row.name
  728. row.backs.forEach(item => {
  729. item.ourBank=item.ourBank
  730. this.bankList.push(item)
  731. })
  732. },
  733. changeBank(value){
  734. this.bankList.forEach(item=>{
  735. console.log('item',item)
  736. if (item.id === value){
  737. this.inputForm.bankNumber=item.bankNumber
  738. }
  739. })
  740. console.log('this.inputForm.bankNumber',this.inputForm.bankNumber)
  741. }
  742. }
  743. }
  744. </script>
  745. <style scoped>
  746. /deep/ .el-input-number .el-input__inner {
  747. text-align: left;
  748. }
  749. /deep/ .vxe-footer--row .vxe-footer--column:nth-child(1) .vxe-cell--item {
  750. font-weight:700;
  751. }
  752. </style>