applyAgainPayment.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511
  1. <template>
  2. <el-dialog
  3. :close-on-click-modal="false"
  4. :close-on-press-escape="false"
  5. :visible.sync="dialogVisible"
  6. title="付款申请单"
  7. top="50px"
  8. width="75%"
  9. :append-to-body="true"
  10. :before-close="beforeClose"
  11. class="statistic_base"
  12. :modal-append-to-body="true"
  13. custom-class="tagdialog"
  14. >
  15. <div class="tabsdom">
  16. <el-tabs v-model="activeName" @tab-click="handleClick">
  17. <el-tab-pane label="付款申请" name="first">
  18. <el-row type="flex" justify="end">
  19. <el-col :span="3" class="col-txt"><span>流程编号:</span></el-col>
  20. <el-col :span="6" class="col-input"><span style="font-size: 14px">{{ formData.flowNum }}</span></el-col>
  21. </el-row>
  22. <el-form
  23. ref="elForm"
  24. :model="formData"
  25. :rules="rules"
  26. label-width="150px"
  27. >
  28. <el-card shadow="always" style="padding: 15px 5px 5px 15px">
  29. <el-row :gutter="15">
  30. <el-col :span="24">
  31. <el-form-item label="标题" prop="title">
  32. <el-input v-model="formData.title" placeholder="付款领用单-年月日" readonly/>
  33. </el-form-item>
  34. </el-col>
  35. <el-col :span="12">
  36. <el-form-item label="创建人">
  37. <el-input v-model="userinfo.truename" placeholder="创建人" readonly />
  38. </el-form-item>
  39. </el-col>
  40. <el-col :span="12">
  41. <el-form-item label="创建部门">
  42. <el-input v-model="userinfo.deptName" placeholder="创建部门" readonly />
  43. </el-form-item>
  44. </el-col>
  45. <el-col :span="24">
  46. <el-form-item label="是否为无合同付款">
  47. <el-select
  48. v-model="formData.isNoContract"
  49. clearable
  50. filterable
  51. placeholder="是否为无合同付款"
  52. style="width: 100%"
  53. :popper-append-to-body="false"
  54. popper-class="statistic_base"
  55. >
  56. <el-option
  57. v-for="item in dc_data.ANSWER_NEED"
  58. :key="item.value"
  59. :label="item.label"
  60. :value="item.value"
  61. :popper-append-to-body="false"
  62. popper-class="statistic_base"
  63. />
  64. </el-select>
  65. </el-form-item>
  66. </el-col>
  67. <el-col :span="24">
  68. <el-form-item label="付款单位">
  69. <el-input v-model="formData.payerName" placeholder="请填写" />
  70. </el-form-item>
  71. </el-col>
  72. <el-col :span="24">
  73. <el-form-item label="收款单位">
  74. <el-input v-model="formData.payeeName" placeholder="请填写" />
  75. </el-form-item>
  76. </el-col>
  77. <el-col :span="24">
  78. <el-form-item label="资金用途">
  79. <el-input v-model="formData.moneyPurpose" placeholder="请填写" />
  80. </el-form-item>
  81. </el-col>
  82. <el-col :span="24">
  83. <el-form-item label="合同总价">
  84. <el-input v-model="formData.contractPrice" oninput="value=value.replace(/[^\d.]/g,'')" placeholder="请填写" />
  85. </el-form-item>
  86. </el-col>
  87. <el-col :span="24">
  88. <el-form-item label="付款说明">
  89. <el-input
  90. v-model="formData.payRemark"
  91. :autosize="{minRows: 4, maxRows: 4}"
  92. :style="{width: '100%'}"
  93. placeholder="请填写"
  94. type="textarea"
  95. maxlength="2000"
  96. show-word-limit
  97. />
  98. </el-form-item>
  99. </el-col>
  100. <el-col :span="24">
  101. <el-form-item label="累计付款">
  102. <el-input v-model="formData.havePayMoney" oninput="value=value.replace(/[^\d.]/g,'')" placeholder="请填写" />
  103. </el-form-item>
  104. </el-col>
  105. <el-col :span="12">
  106. <el-form-item label="申请金额(小写)" prop="applyPayMoney">
  107. <el-input v-model="formData.applyPayMoney" oninput="value=value.replace(/[^\d.]/g,'')" placeholder="请填写" @change="swapper(formData.applyPayMoney)" />
  108. </el-form-item>
  109. </el-col>
  110. <el-col :span="12">
  111. <el-form-item label="申请金额(大写)" prop="applyPayMoneyUppercase">
  112. <el-input v-model="formData.applyPayMoneyUppercase" placeholder="请填写" />
  113. </el-form-item>
  114. </el-col>
  115. <!-- <el-col :span="24">formData.applyPayMoneyUppercase={{formData.applyPayMoneyUppercase}}</el-col>-->
  116. <el-col :span="7">
  117. <el-form-item label="相关附件">
  118. <el-upload
  119. :action="$constant.BASE_URI+'/FileController/upload'"
  120. :file-list="formData.fileUrlList"
  121. :http-request="uploadFile"
  122. class="upload-demo"
  123. multiple
  124. >
  125. <el-button size="small" type="primary">上传附件</el-button>
  126. <div slot="file" slot-scope="{file}">
  127. <a :href="file.url">{{ file.name }}</a>
  128. <span class="el-upload-list__item-actions">
  129. <i class="el-icon-delete" @click="handlePictureRemove(file,formData.fileUrlList)" />
  130. </span>
  131. </div>
  132. </el-upload>
  133. </el-form-item>
  134. </el-col>
  135. <el-col :span="17" />
  136. </el-row>
  137. </el-card>
  138. </el-form>
  139. </el-tab-pane>
  140. <el-tab-pane label="流程图 " name="second">
  141. <div style="width: 100%">
  142. <el-row>
  143. <el-col :span="24">
  144. <div class="node_info">
  145. <div>节点说明:</div>
  146. <div v-for="item in nodeColor" class="dis_flex">
  147. <div class="node_class" :style="{backgroundColor: item.nodeback}" />
  148. {{ item.name }}
  149. </div>
  150. </div>
  151. <div v-show="true" id="containeraddwork" style="width: 100%" />
  152. </el-col>
  153. </el-row>
  154. </div>
  155. </el-tab-pane>
  156. </el-tabs>
  157. </div>
  158. <div slot="footer">
  159. <el-button @click="dialogVisible=false">取消</el-button>
  160. <el-button :loading="loading" type="primary" @click="handelConfirm">确定</el-button>
  161. </div>
  162. </el-dialog>
  163. </template>
  164. <script>
  165. import { upload } from '@/static/utils/channel'
  166. import Base from '@/views/base/base'
  167. import BaseData from '@/views/base/baseData'
  168. import UserSelect from '@/views/components/UserSelect'
  169. const applyAddWorkTime = { useTime: 0 }
  170. export default {
  171. name: 'ApplyPay',
  172. components: {
  173. upload, UserSelect
  174. },
  175. mixins: [Base, BaseData],
  176. data() {
  177. return {
  178. row: {},
  179. loading: false,
  180. dc_key: ['ORDER_STATUS', 'PAY_TYPE', 'BUDGET_FY'],
  181. ProjectData: [],
  182. dialogVisible: false,
  183. applyAddWorkTime: [{ ...applyAddWorkTime }],
  184. formData: {
  185. proId: '',
  186. totalAddTime: 0,
  187. applyReasons: '',
  188. position: '',
  189. applyAddWorkTime: [
  190. {
  191. useTime: 0
  192. }
  193. ]
  194. },
  195. userinfo: {},
  196. activeName: 'first',
  197. rules: {
  198. proId: [{
  199. required: true,
  200. message: '请选择关联项目',
  201. trigger: 'change'
  202. }],
  203. applyReasons: [{
  204. required: true,
  205. message: '请输入加班事由',
  206. trigger: 'change'
  207. }],
  208. position: [{
  209. required: true,
  210. message: '加班位置不能为空',
  211. trigger: 'change'
  212. }]
  213. },
  214. positionOptions: [
  215. {
  216. 'label': '公司',
  217. 'value': 1
  218. },
  219. {
  220. 'label': '客户处',
  221. 'value': 2
  222. }, {
  223. 'label': '居家',
  224. 'value': 3
  225. }]
  226. }
  227. },
  228. computed: {},
  229. watch: {
  230. 'applyAddWorkTime': {
  231. deep: true,
  232. handler(newValue, oldValue) {
  233. let totalAddTime = 0
  234. for (let i = 0; i < this.applyAddWorkTime.length; i++) {
  235. if (this.applyAddWorkTime[i].useTime === 0 || this.applyAddWorkTime[i].useTime) {
  236. totalAddTime = totalAddTime + Number(this.applyAddWorkTime[i].useTime)
  237. }
  238. }
  239. console.log(totalAddTime)
  240. this.changeAddWorkTime(totalAddTime.toFixed(1))
  241. }
  242. }
  243. },
  244. created() {
  245. },
  246. mounted() {
  247. this.initDict(this.dc_key).then((res) => {
  248. })
  249. // this.initProject({ /* signstatus: '2,3'*/ })
  250. },
  251. methods: {
  252. handlePictureRemove(file, fileUrlList) {
  253. var index = fileUrlList.indexOf(file)
  254. fileUrlList.splice(index, 1)
  255. },
  256. uploadFile: function(param) {
  257. const _this = this
  258. upload(param, true).then((res) => {
  259. _this.formData.fileUrlList.push(res)
  260. })
  261. },
  262. swapper(n) {
  263. // console.log('ddd',n)
  264. if (!/^(0|[1-9]\d*)(\.\d+)?$/.test(n)) { return '数据非法' }
  265. var unit = '千百拾亿千百拾万千百拾元角分'; var str = ''
  266. n += '00'
  267. var p = n.indexOf('.')
  268. if (p >= 0) { n = n.substring(0, p) + n.substr(p + 1, 2) }
  269. unit = unit.substr(unit.length - n.length)
  270. for (var i = 0; i < n.length; i++) { str += '零壹贰叁肆伍陆柒捌玖'.charAt(n.charAt(i)) + unit.charAt(i) }
  271. // console.log('end',str.replace(/零(千|百|拾|角)/g, '零').replace(/(零)+/g, '零').replace(/零(万|亿|元)/g, '$1').replace(/(亿)万|壹(拾)/g, '$1$2').replace(/^元零?|零分/g, '').replace(/元$/g, '元整'))
  272. this.formData.applyPayMoneyUppercase = str.replace(/零(千|百|拾|角)/g, '零').replace(/(零)+/g, '零').replace(/零(万|亿|元)/g, '$1').replace(/(亿)万|壹(拾)/g, '$1$2').replace(/^元零?|零分/g, '').replace(/元$/g, '元整')
  273. // console.log('end',this.formData.applyPayMoneyUppercase)
  274. this.$forceUpdate()
  275. },
  276. beforeClose() {
  277. // eslint-disable-next-line no-mixed-spaces-and-tabs
  278. this.formData = {
  279. // payerName: '无锡市安居投资发展有限公司'
  280. // eslint-disable-next-line no-mixed-spaces-and-tabs
  281. }
  282. this.dialogVisible = false
  283. this.activeName = 'first'
  284. this.$forceUpdate()
  285. },
  286. handleClick(tab, event) {
  287. this.canVasStatus = false
  288. if (this.activeName == 'second') {
  289. this.canVasStatus = true
  290. this.$nextTick(() => {
  291. this.$refs.addWorkCanvas.createNodeCanvas(this.row)
  292. })
  293. }
  294. },
  295. changeAddWorkTime(totalAddTime) {
  296. this.formData.totalAddTime = totalAddTime
  297. },
  298. getHour(s1, s2) {
  299. var reDate = /\d{4}-\d{1,2}-\d{1,2} /
  300. s1 = new Date((reDate.test(s1) ? s1 : '2018-1-1 ' + s1).replace(/-/g, '/'))
  301. s2 = new Date((reDate.test(s2) ? s2 : '2018-1-1 ' + s2).replace(/-/g, '/'))
  302. var ms = s2.getTime() - s1.getTime()
  303. if (ms < 0) return 0
  304. console.log(ms)
  305. return (ms / 1000 / 60 / 60).toFixed(1) // 小时
  306. },
  307. getTimeRange(event, i) {
  308. this.$nextTick(() => {
  309. this.applyAddWorkTime[i].startTime = this.applyAddWorkTime[i].startDay + ' ' + event[0] + ':00'
  310. this.applyAddWorkTime[i].endTime = this.applyAddWorkTime[i].startDay + ' ' + event[1] + ':00'
  311. const timeRang = this.getHour(event[0], event[1])
  312. this.applyAddWorkTime[i].useTime = timeRang
  313. })
  314. },
  315. async getUserInfo() {
  316. const { data: userinfo } = await this.baseRequest1('ApplyPaymentSettleController', 'getUserInfoByUserId', { userId: '' })
  317. this.userinfo = userinfo
  318. console.log(this.userinfo)
  319. },
  320. baseRequest1(prefix, opUrl, postData) {
  321. return this.$channel.globleRequest(prefix, opUrl, postData, 'project task')
  322. },
  323. addListRow() {
  324. this.applyAddWorkTime.push({ ...applyAddWorkTime })
  325. },
  326. spliceListRow(index) {
  327. this.applyAddWorkTime.splice(index, 1)
  328. },
  329. async setVisible(status, row) {
  330. this.row = row
  331. this.activeName = 'first'
  332. this.getUserInfo(row.applyUser)
  333. const { data } = await this.baseRequest1('ApplyPaymentSettleController', 'getInfoByFlowMainId', { flowMainId: row.id })
  334. this.formData = data
  335. this.formData.flowMainId = data.flowMainId
  336. this.dialogVisible = status
  337. },
  338. onOpen() {
  339. },
  340. onClose() {
  341. this.$refs['elForm'].resetFields()
  342. },
  343. close() {
  344. this.$emit('update:visible', false)
  345. },
  346. async handelConfirm() {
  347. this.$refs['elForm'].validate(async valid => {
  348. if (!valid) return
  349. const formData = {
  350. ...this.formData,
  351. applyAddWorkTimeString: JSON.stringify(this.applyAddWorkTime)
  352. }
  353. delete formData.applyAddWorkTime
  354. delete formData.applyAddWorkTimeList
  355. console.error('formDataformDataformDataformDataformData', formData)
  356. this.loading = true
  357. const { data } = await this.baseRequest1('ApplyPaymentSettleController', 'addApplyPaymentSettleAgain', { ...formData })
  358. this.loading = false
  359. if (data.code == 200) {
  360. this.$message.success('加班申请发起成功')
  361. this.dialogVisible = false
  362. this.$emit('getData')
  363. }
  364. this.close()
  365. })
  366. }
  367. }
  368. }
  369. </script>
  370. <style lang="scss">
  371. .cclist {
  372. .col-input {
  373. padding: 0;
  374. }
  375. }
  376. .pdr10px {
  377. padding-right: 10px;
  378. }
  379. .mgb10px {
  380. margin-bottom: 10px;
  381. }
  382. .mb25 {
  383. margin-bottom: 25px;
  384. }
  385. .pdtopbottom16 {
  386. padding: 0px 16px;
  387. }
  388. .pdtop16px {
  389. padding-top: 16px;
  390. }
  391. .totalApplyTime {
  392. font-size: 16px;
  393. font-family: 微软雅黑;
  394. font-weight: 400;
  395. color: #1890FF;
  396. text-align: right;
  397. margin: 15px 0 15px 0;
  398. width: 100%;
  399. }
  400. .cost_form {
  401. .col-input {
  402. font-weight: 400;
  403. }
  404. .el-form-item__label .moneydetails {
  405. text-align: right;
  406. font-size: 16px;
  407. font-family: 微软雅黑;
  408. padding-right: 10px;
  409. line-height: 40px;
  410. word-break: keep-all;
  411. white-space: nowrap;
  412. color: #606266;
  413. text-rendering: optimizeLegibility;
  414. font-weight: 400;
  415. }
  416. .moneydetails {
  417. text-align: right;
  418. font-size: 16px;
  419. font-family: 微软雅黑;
  420. padding-right: 10px;
  421. word-break: keep-all;
  422. white-space: nowrap;
  423. color: #606266;
  424. text-rendering: optimizeLegibility;
  425. font-weight: 400;
  426. }
  427. .moneydetails:before {
  428. content: "*";
  429. color: #ff4949;
  430. }
  431. }
  432. .txtc {
  433. text-align: center
  434. }
  435. .ml5 {
  436. margin-left: 5px;
  437. }
  438. .eltype {
  439. margin-bottom: 15px;
  440. }
  441. .tabsdom {
  442. .el-input {
  443. width: 100%;
  444. }
  445. .el-tabs__header {
  446. text-align: center !important;
  447. width: 139px !important;
  448. text-align: center !important;
  449. display: block !important;
  450. margin: auto !important;
  451. margin-bottom: 15px !important;
  452. }
  453. .el-tabs__nav-wrap::after {
  454. display: none;
  455. }
  456. .el-upload {
  457. width: 100%;
  458. }
  459. }
  460. .feeMoneyTotal {
  461. width: 100%;
  462. height: 14px;
  463. font-size: 14px;
  464. font-weight: 400;
  465. color: #1890FF;
  466. margin-top: 31px;
  467. margin-bottom: 13px;
  468. }
  469. </style>