applyAgainInvoiceRed.vue 16 KB

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