applyAgainContract.vue 16 KB

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