applyPurchase.vue 44 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163
  1. <template>
  2. <div>
  3. <div class="tabsdomPurchase">
  4. <el-tabs v-model="activeName" @tab-click="handleClick">
  5. <el-tab-pane label="采购申请" name="first">
  6. <el-form
  7. ref="form"
  8. v-loading="loading"
  9. :model="form"
  10. :rules="rules"
  11. class="cost_form"
  12. label-width="150px"
  13. style="width: 100%;padding: 5px"
  14. >
  15. <el-row>
  16. <el-col>
  17. <el-card shadow="always" style="padding: 15px 5px 5px 15px">
  18. <el-row>
  19. <el-col :span="24">
  20. <el-form-item prop="purchaseCode" label="采购单号">
  21. <el-input v-model="form.purchaseCode" placeholder="请输入" :readonly="formDisable" />
  22. </el-form-item>
  23. </el-col>
  24. </el-row>
  25. <el-row>
  26. <el-col :span="12">
  27. <el-form-item prop="proId" label="关联项目名称">
  28. <el-select
  29. v-if="!formDisable"
  30. v-model="form.proId"
  31. filterable
  32. placeholder="请选择项目"
  33. :disabled="formDisable"
  34. @change="selectProMain()"
  35. >
  36. <el-option
  37. v-for="item in proData"
  38. :key="item.id"
  39. :label="item.proname"
  40. :value="item.id"
  41. >
  42. <span style="float: left">{{ item.proname }}</span>
  43. <span style="float: right; color: #8492a6; font-size: 13px">{{ item.custname }}</span>
  44. </el-option>
  45. </el-select>
  46. <el-input v-else v-model="form.proName" readonly />
  47. </el-form-item>
  48. </el-col>
  49. <el-col :span="12">
  50. <el-form-item prop="custName" label="客户名称">
  51. <el-input v-model="form.custName" placeholder="请选择项目带出" readonly />
  52. </el-form-item>
  53. </el-col>
  54. </el-row>
  55. <el-row>
  56. <el-col :span="12">
  57. <el-form-item prop="placeDate" label="下单日期">
  58. <el-date-picker
  59. v-model="form.placeDate"
  60. type="datetime"
  61. value-format="yyyy-MM-dd HH:mm:ss"
  62. placeholder="请选择"
  63. style="width: 100%"
  64. :disabled="formDisable"
  65. />
  66. </el-form-item>
  67. </el-col>
  68. <el-col :span="12">
  69. <el-form-item prop="requireCompleteTime" label="要求完成时间">
  70. <el-date-picker
  71. v-model="form.requireCompleteTime"
  72. type="datetime"
  73. value-format="yyyy-MM-dd HH:mm:ss"
  74. placeholder="请选择"
  75. style="width: 100%"
  76. :disabled="formDisable"
  77. />
  78. </el-form-item>
  79. </el-col>
  80. </el-row>
  81. <!-- <el-row>
  82. <el-col :span="12">
  83. <el-form-item prop="supplierId" label="供应商">
  84. <el-select
  85. v-model="form.supplierId"
  86. filterable
  87. clearable
  88. placeholder="请选择供应商"
  89. :disabled="formDisable"
  90. @change="changeSupplier"
  91. >
  92. <el-option
  93. v-for="item in supplierData"
  94. :key="item.id"
  95. :label="item.supplierName"
  96. :value="item.id"
  97. />
  98. </el-select>
  99. </el-form-item>
  100. </el-col>
  101. <el-col :span="12">
  102. <el-form-item prop="contactUser" label="联系人">
  103. <el-input v-model="form.contactUser" placeholder="请选择供应商带出" readonly />
  104. </el-form-item>
  105. </el-col>
  106. </el-row>-->
  107. <el-row>
  108. <el-col :span="24">
  109. <el-form-item prop="purchaseContent" label="采购内容">
  110. <el-input v-model="form.purchaseContent" type="textarea" :rows="3" :readonly="formDisable" />
  111. </el-form-item>
  112. </el-col>
  113. </el-row>
  114. <el-row>
  115. <el-col :span="24">
  116. <el-form-item prop="purchaseFile" label="附件">
  117. <el-upload
  118. v-if="!formDisable"
  119. ref="upload"
  120. class="upload-demo"
  121. :action="$constant.BASE_URI+'/FileController/uploadImage'"
  122. :http-request="uploadFile"
  123. :before-remove="beforeRemove"
  124. multiple
  125. :file-list="fileUrlList"
  126. >
  127. <el-button size="small" type="primary">点击上传</el-button>
  128. <div slot="tip" class="el-upload__tip">请上传50MB以内的文件</div>
  129. <div slot="file" slot-scope="{file}">
  130. <a :href="file.url">{{ file.name }}</a>
  131. <span class="el-upload-list__item-actions">
  132. <i class="el-icon-delete" @click="handlePictureRemove(file,fileUrlList)" />
  133. </span>
  134. </div>
  135. </el-upload>
  136. <div v-else>
  137. <div v-for="(item, index) in fileUrlList" :key="index">
  138. <a :href="item.url">{{ item.name }}</a>
  139. </div>
  140. </div>
  141. </el-form-item>
  142. </el-col>
  143. </el-row>
  144. <!-- <el-row>
  145. <el-col :span="12">
  146. <el-form-item prop="orderAmount" label="订单总金额(元)">
  147. <el-input v-model="form.orderAmount" type="number" placeholder="请输入" :readonly="formDisable" />
  148. </el-form-item>
  149. </el-col>
  150. <el-col :span="3" class="col-txt"><span /></el-col>
  151. <el-col :span="12">
  152. <el-form-item prop="taxRate" label="税率(%)">
  153. <el-select v-model="form.taxRate" placeholder="请选择" :disabled="formDisable">
  154. <el-option
  155. v-for="item in dc_data.PURCHASE_TAX_RATE"
  156. :key="item.value"
  157. :label="item.label"
  158. :value="item.value"
  159. />
  160. </el-select>
  161. </el-form-item>
  162. </el-col>
  163. </el-row>
  164. <el-row>
  165. <el-col :span="24">
  166. <el-form-item prop="amountBelong" label="费用|成本归属">
  167. <el-select
  168. ref="amountBelong"
  169. v-model="form.amountBelong"
  170. placeholder="请选择"
  171. :disabled="formDisable"
  172. @change="belongChange()"
  173. >
  174. <el-option
  175. v-for="item in belongData"
  176. :key="item.value"
  177. :label="item.value"
  178. :value="item.value"
  179. >
  180. <span style="float: left">{{ item.value }}</span>
  181. <span style="float: right; color: #8492a6; font-size: 13px">{{ item.type }}</span>
  182. </el-option>
  183. </el-select>
  184. </el-form-item>
  185. </el-col>
  186. </el-row>
  187. <el-row>
  188. <el-col :span="12">
  189. <el-form-item prop="payType" label="支付方式">
  190. <el-select v-model="form.payType" placeholder="请选择" :disabled="formDisable">
  191. <el-option
  192. v-for="item in dc_data.PAY_TYPE"
  193. :key="item.value"
  194. :label="item.label"
  195. :value="item.value"
  196. />
  197. </el-select>
  198. </el-form-item>
  199. </el-col>
  200. <el-col :span="12">
  201. <el-form-item prop="placeUser" label="下单人">
  202. <el-input v-model="form.placeUser" :disabled="formDisable" />
  203. </el-form-item>
  204. </el-col>
  205. </el-row>
  206. <el-row>
  207. <el-col :span="24">
  208. <el-form-item prop="payContent" label="支付说明">
  209. <el-input v-model="form.payContent" type="textarea" :rows="3" :readonly="formDisable" />
  210. </el-form-item>
  211. </el-col>
  212. </el-row>-->
  213. </el-card>
  214. </el-col>
  215. </el-row>
  216. </el-form>
  217. <h3 v-show="formDisable">流程历史</h3>
  218. <el-card v-show="formDisable" style="padding: 15px 5px 5px 15px">
  219. <div class="tableDom">
  220. <el-table
  221. :data="historyList"
  222. :header-cell-style="{
  223. background:'#1890FF !important',
  224. color:'white'
  225. }"
  226. border
  227. style="width: 100%"
  228. >
  229. <el-table-column fixed label="序号" type="index" width="60" />
  230. <el-table-column
  231. label="节点名称"
  232. prop="nodeName"
  233. width="180"
  234. />
  235. <el-table-column
  236. label="处理人"
  237. prop="auditUserName"
  238. width="180"
  239. />
  240. <el-table-column
  241. label="审核结果"
  242. prop="auditResultString"
  243. />
  244. <el-table-column
  245. label="审核意见"
  246. prop="auditContent"
  247. />
  248. <el-table-column
  249. label="发起/审核时间"
  250. prop="createdAt"
  251. >
  252. <template slot-scope="scope">
  253. {{ $common.transTime(scope.row.createdAt) }}
  254. </template>
  255. </el-table-column>
  256. </el-table>
  257. </div>
  258. </el-card>
  259. <h3 v-if="isAudit">处理</h3>
  260. <el-card v-if="isAudit" shadow="always" style="padding: 15px 5px 5px 15px">
  261. <el-form
  262. ref="confirmForm"
  263. :model="confirmForm"
  264. class="cost_form"
  265. label-width="100px"
  266. style="width: 100%;padding: 5px"
  267. >
  268. <el-row :gutter="10">
  269. <el-col :span="24">
  270. <el-form-item label="处理结果" style="margin-bottom: 15px">
  271. <el-radio-group v-model="confirmForm.confirmResult">
  272. <el-radio :label="1">同意</el-radio>
  273. <el-radio v-if="agreeNoStatus" :label="2">退回发起人</el-radio>
  274. <el-radio v-if="agreeBackStatus" :label="3">退回上节点</el-radio>
  275. </el-radio-group>
  276. </el-form-item>
  277. </el-col>
  278. <el-col :span="24">
  279. <el-form-item label="处理意见">
  280. <el-input v-model="confirmForm.confirmContent" style="margin-top:10px" type="textarea" />
  281. <el-dropdown size="mini" split-button trigger="hover" type="primary">
  282. 常用语选择
  283. <el-dropdown-menu slot="dropdown">
  284. <el-dropdown-item
  285. v-for="(item, index) in dc_data.COMMON_PHRASES"
  286. :key="index"
  287. @click.native="selectCommonPhrases(item.label)"
  288. >
  289. {{ item.label }}
  290. </el-dropdown-item>
  291. </el-dropdown-menu>
  292. </el-dropdown>
  293. </el-form-item>
  294. </el-col>
  295. <el-col :span="24">
  296. <el-form-item label="审核人抄送">
  297. <user-select
  298. :default-select="confirmList"
  299. :multiple="true"
  300. class="cclist"
  301. @selectValue="parentMethod"
  302. />
  303. </el-form-item>
  304. </el-col>
  305. </el-row>
  306. </el-form>
  307. </el-card>
  308. </el-tab-pane>
  309. <el-tab-pane label="流程图" name="second">
  310. <div style="width: 100%">
  311. <el-row>
  312. <el-col :span="24">
  313. <div class="node_info">
  314. <div>节点说明:</div>
  315. <div v-for="(item, index) in nodeColor" :key="index" class="dis_flex">
  316. <div class="node_class" :style="{backgroundColor: item.nodeback}" />
  317. {{ item.name }}
  318. </div>
  319. </div>
  320. <div id="containerPurchase" ref="containerPurchase" style="width: 100%" />
  321. </el-col>
  322. </el-row>
  323. </div>
  324. </el-tab-pane>
  325. </el-tabs>
  326. </div>
  327. <div slot="footer" style="text-align: right;padding-top: 10px">
  328. <el-button @click="closeDialog">{{ isDetail ? '关 闭' : '取 消' }}</el-button>
  329. <el-button v-show="!isDetail" :loading="btnLoading" type="primary" @click.native="confirmSubmit()">确 定</el-button>
  330. </div>
  331. </div>
  332. </template>
  333. <script>
  334. import { upload } from '@/static/utils/channel'
  335. import Base from '@/views/base/base'
  336. import UserSelect from '@/views/components/UserSelect'
  337. import constant from '@/static/utils/constant'
  338. import * as echarts from 'echarts'
  339. const lineStyle = {
  340. color: '#00116a',
  341. width: 2
  342. }
  343. export default {
  344. name: 'ApplyPurchase',
  345. components: { UserSelect },
  346. mixins: [Base],
  347. data() {
  348. return {
  349. loading: false,
  350. btnLoading: false,
  351. activeName: 'first',
  352. dc_key: ['PURCHASE_TAX_RATE', 'PAY_TYPE', 'COMMON_PHRASES'],
  353. form: {
  354. id: '',
  355. purchaseCode: '',
  356. proId: '',
  357. customerId: '',
  358. placeDate: this.$common.transDate(new Date(), constant.DATE_PATTERN.DATE_TIME_h),
  359. requireCompleteTime: '',
  360. // supplierId: '',
  361. // contactUser: '',
  362. // orderAmount: '',
  363. // taxRate: '',
  364. // amountBelong: '',
  365. // amountBelongType: '',
  366. // payType: '',
  367. // placeUser: this.$common.currUser() ? this.$common.currUser().truename : '',
  368. purchaseContent: '',
  369. purchaseFile: '',
  370. // payContent: ''
  371. },
  372. rules: {
  373. proId: [{ required: true, message: '请选择项目', trigger: 'change' }],
  374. purchaseContent: [{ required: true, message: '请输入采购内容', trigger: 'blur' }],
  375. // supplierId: [{ required: true, message: '请选择供应商', trigger: 'change' }],
  376. // orderAmount: [{ required: true, message: '请输入订单总金额(员)', trigger: 'blur' }],
  377. // taxRate: [{ required: true, message: '请选择税率(%)', trigger: 'change' }],
  378. // payContent: [{ required: true, message: '请输入支付说明', trigger: 'blur' }]
  379. },
  380. proData: [],
  381. belongData: [],
  382. supplierData: [],
  383. fileUrlList: [],
  384. selectList: [],
  385. linesData: [],
  386. id: '',
  387. isAudit: false,
  388. isAgain: false,
  389. isDetail: false,
  390. formDisable: false,
  391. confirmForm: {
  392. flowMainPushId: '',
  393. confirmContent: '',
  394. confirmResult: 1
  395. },
  396. flowRow: {},
  397. agreeNoStatus: false,
  398. agreeBackStatus: false,
  399. historyList: [],
  400. confirmList: [],
  401. nodeColor: [
  402. { name: '审核通过', nodeback: '#2A3980' },
  403. { name: '未经过', nodeback: '#999999' },
  404. { name: '退回', nodeback: '#E04242' },
  405. { name: '审核中', nodeback: '#E08E42' },
  406. { name: '撤回', nodeback: '#4294E0' }
  407. ]
  408. }
  409. },
  410. mounted() {
  411. this.initDict(this.dc_key).then((res) => {})
  412. // this.supplierRequest('listAllAndOaListAll', { supplierStatus: '0' }).then(res => {
  413. // this.supplierData = res.data || []
  414. // })
  415. },
  416. methods: {
  417. initData(id, isAudit, isDetail, isAgain, flowRow) {
  418. this.id = id
  419. this.isAudit = isAudit || false
  420. this.isDetail = isDetail || false
  421. this.isAgain = isAgain || false
  422. this.formDisable = (isAudit || isDetail)
  423. this.flowRow = flowRow || {}
  424. if (this.isAudit) {
  425. this.confirmForm.flowMainPushId = this.flowRow.flowMainPushId
  426. const data = { flowMainPushId: this.flowRow.flowMainPushId }
  427. this.flowMainRequest('getOutgoingFlowsByFlowMainPushId', data).then(res => {
  428. if (res.data) {
  429. res.data.forEach(item => {
  430. if (item.conditionExpression === '${agree==\'no\'}') {
  431. this.agreeNoStatus = true
  432. }
  433. if (item.conditionExpression === '${agree==\'back\'}') {
  434. this.agreeBackStatus = true
  435. }
  436. })
  437. }
  438. })
  439. }
  440. if (this.formDisable) {
  441. const data = { flowMainId: this.flowRow.id }
  442. this.flowMainRequest('getFlowHistroyByFlowMainId', data).then(res => {
  443. this.historyList = res.data || []
  444. })
  445. } else {
  446. this.ourOrderMainRequest('getSelectProject', {}).then(res => {
  447. this.proData = res.data || []
  448. })
  449. }
  450. if (id) {
  451. this.getData()
  452. } else {
  453. this.getCGNo()
  454. }
  455. },
  456. getData() {
  457. this.loading = true
  458. this.baseRequest('getById', { id: this.id }).then(res => {
  459. if (res.data) {
  460. this.form = res.data
  461. if (this.form.purchaseFile) {
  462. this.fileUrlList = JSON.parse(this.form.purchaseFile)
  463. }
  464. // this.getBelongData()
  465. }
  466. this.loading = false
  467. })
  468. },
  469. closeDialog() {
  470. this.$emit('closeDialog', false)
  471. },
  472. handleClick(tab, event) {
  473. if (this.activeName === 'second') this.createNodeCanvas(this.flowRow)
  474. },
  475. getCGNo() {
  476. this.baseRequest('getCGNo', {}).then((res) => {
  477. if (res.data) {
  478. this.form.purchaseCode = res.data.msg
  479. }
  480. })
  481. },
  482. selectProMain() {
  483. this.form.proName = ''
  484. this.form.custName = ''
  485. this.form.customerId = ''
  486. // this.form.amountBelong = ''
  487. // this.form.amountBelongType = ''
  488. const obj = this.proData.find(item => item.id === this.form.proId)
  489. if (obj) {
  490. this.form.proName = obj.proname
  491. this.form.custName = obj.custname
  492. this.form.customerId = obj.custid
  493. }
  494. // if (this.form.proId) {
  495. // this.getBelongData()
  496. // } else {
  497. // this.belongData = []
  498. // }
  499. },
  500. getBelongData() {
  501. this.belongData = []
  502. this.ourOrderMainRequest('getBelongData', { proId: this.form.proId }).then(res => {
  503. this.belongData = res.data || []
  504. })
  505. },
  506. changeSupplier(val) {
  507. const obj = this.supplierData.find(x => x.id === val)
  508. if (obj) {
  509. this.form.contactUser = obj.contactUser
  510. } else {
  511. this.form.contactUser = ''
  512. }
  513. },
  514. uploadFile(param) {
  515. upload(param, true).then((res) => {
  516. if (res.key === 200) {
  517. this.fileUrlList.push(res)
  518. this.form.purchaseFile = JSON.stringify(this.fileUrlList)
  519. this.$message.info('文件上传成功')
  520. } else {
  521. const uid = param.file.uid
  522. const idx = this.$refs.upload.uploadFiles.findIndex(item => item.uid === uid)
  523. this.$refs.upload.uploadFiles.splice(idx, 1)
  524. this.$message.error('文件上传失败')
  525. }
  526. }).catch(() => {
  527. this.$message.error('文件上传异常!')
  528. const uid = param.file.uid
  529. const idx = this.$refs.upload.uploadFiles.findIndex(item => item.uid === uid)
  530. this.$refs.upload.uploadFiles.splice(idx, 1)
  531. })
  532. },
  533. belongChange() {
  534. const obj = this.belongData.find(item => item.value === this.form.amountBelong)
  535. if (obj) {
  536. this.form.amountBelongType = obj.type
  537. } else {
  538. this.form.amountBelongType = ''
  539. }
  540. },
  541. selectCommonPhrases(e) {
  542. if (!this.confirmForm.confirmContent) this.confirmForm.confirmContent = ''
  543. this.confirmForm.confirmContent += e
  544. },
  545. parentMethod(val) {
  546. if (val.length > 0) {
  547. this.form.ccList = val.join(',')
  548. }
  549. },
  550. confirmSubmit() {
  551. this.$refs.form.validate((valid) => {
  552. if (valid) {
  553. let formData
  554. let url
  555. let successMsg
  556. if (this.isAudit) {
  557. formData = { ...this.confirmForm }
  558. url = 'auditApplyPurchase'
  559. successMsg = '处理成功'
  560. } else if (this.isAgain) {
  561. formData = { ...this.form, flowMainId: this.flowRow.id }
  562. this.$delete(formData, 'flowMainCcList')
  563. url = 'reApplyPurchase'
  564. successMsg = '流程发起成功'
  565. } else {
  566. formData = { ...this.form }
  567. url = 'addApplyPurchase'
  568. successMsg = '流程发起成功'
  569. }
  570. this.btnLoading = true
  571. this.baseRequest(url, formData).then(res => {
  572. this.btnLoading = false
  573. if (res.data.key === 200) {
  574. this.$message.success(successMsg)
  575. this.$emit('closeDialog', true)
  576. } else {
  577. this.$message.error(res.data.msg)
  578. }
  579. })
  580. }
  581. })
  582. },
  583. async createNodeCanvas(row) {
  584. const node = [ // 节点
  585. {
  586. nodeKey: 'curr_user',
  587. name: '申请人发起',
  588. value: [45, 250],
  589. symbol: 'image://' + require('../asste/huifangkuai.png'),
  590. symbolSize: [110, 60]
  591. },
  592. {
  593. nodeKey: 'dept_superior_1_0_1',
  594. name: '直接上级审核',
  595. value: [125, 250],
  596. symbol: 'image://' + require('../asste/huifangkuai.png'),
  597. symbolSize: [110, 60]
  598. },
  599. {
  600. nodeKey: 'dept_head_1_0_1',
  601. name: '部门负责人审核',
  602. value: [205, 250],
  603. symbol: 'image://' + require('../asste/huifangkuai.png'),
  604. symbolSize: [110, 60]
  605. },
  606. {
  607. nodeKey: 'flow_fgld_1_0_1',
  608. name: '分管领导审核',
  609. value: [285, 250],
  610. symbol: 'image://' + require('../asste/huifangkuai.png'),
  611. symbolSize: [110, 60]
  612. },
  613. {
  614. nodeKey: 'flow_sjfgld_1_0_1',
  615. name: '上级分管领导\n审核',
  616. value: [365, 250],
  617. symbol: 'image://' + require('../asste/huifangkuai.png'),
  618. symbolSize: [110, 60]
  619. },
  620. {
  621. nodeKey: 'flow_zyld_1_0_1',
  622. name: '主要领导\n审核',
  623. value: [445, 250],
  624. symbol: 'image://' + require('../asste/huifangkuai.png'),
  625. symbolSize: [110, 60]
  626. },
  627. {
  628. nodeKey: 'flow_cgzy_1_0_1',
  629. name: '采购专员\n审核',
  630. value: [525, 250],
  631. symbol: 'image://' + require('../asste/huifangkuai.png'),
  632. symbolSize: [110, 60]
  633. },
  634. {
  635. name: '结束',
  636. value: [525, 100],
  637. symbol: 'image://' + require('../asste/huifangkuai.png'),
  638. symbolSize: [110, 60]
  639. },
  640. {
  641. label: {
  642. show: true,
  643. color: 'red', // 节点文字颜色
  644. backgroundColor: '#f5f5f5'
  645. },
  646. itemStyle: {
  647. color: '#f5f5f5'
  648. },
  649. name: '退回发起人 ',
  650. value: [450, 600],
  651. symbolSize: [70, 20]
  652. },
  653. {
  654. label: {
  655. show: true,
  656. color: 'red', // 节点文字颜色
  657. backgroundColor: '#f5f5f5'
  658. },
  659. itemStyle: {
  660. color: '#f5f5f5'
  661. },
  662. name: '退回发起人',
  663. value: [350, 550],
  664. symbolSize: [70, 20]
  665. },
  666. {
  667. label: {
  668. show: true,
  669. color: 'red', // 节点文字颜色
  670. backgroundColor: '#f5f5f5'
  671. },
  672. itemStyle: {
  673. color: '#f5f5f5'
  674. },
  675. name: ' 退回发起人 ',
  676. value: [300, 500],
  677. symbolSize: [20, 20]
  678. },
  679. {
  680. label: {
  681. show: true,
  682. color: 'red', // 节点文字颜色
  683. backgroundColor: '#f5f5f5'
  684. },
  685. itemStyle: {
  686. color: '#f5f5f5'
  687. },
  688. name: ' 退回发起人 ',
  689. value: [250, 450],
  690. symbolSize: [20, 20]
  691. },
  692. {
  693. label: {
  694. show: true,
  695. color: 'red', // 节点文字颜色
  696. backgroundColor: '#f5f5f5'
  697. },
  698. itemStyle: {
  699. color: '#f5f5f5'
  700. },
  701. name: ' 退回发起人 ',
  702. value: [250, 450],
  703. symbolSize: [20, 20]
  704. },
  705. {
  706. label: {
  707. show: true,
  708. color: 'red', // 节点文字颜色
  709. backgroundColor: '#f5f5f5'
  710. },
  711. itemStyle: {
  712. color: '#f5f5f5'
  713. },
  714. name: ' 退回发起人 ',
  715. value: [175, 400],
  716. symbolSize: [20, 20]
  717. },
  718. {
  719. label: {
  720. show: true,
  721. color: 'red', // 节点文字颜色
  722. backgroundColor: '#f5f5f5'
  723. },
  724. itemStyle: {
  725. color: '#f5f5f5'
  726. },
  727. name: ' 退回发起人 ',
  728. value: [100, 350],
  729. symbolSize: [20, 20]
  730. }
  731. ]
  732. this.linesData = [ // 连线
  733. {
  734. nodeKey: 'curr_user',
  735. lineStyle: lineStyle,
  736. coords: [[45, 250], [105, 250]]
  737. },
  738. {
  739. nodeKey: 'dept_superior_1_0_1',
  740. lineStyle: lineStyle,
  741. coords: [[125, 250], [185, 250]]
  742. },
  743. {
  744. nodeKey: 'dept_head_1_0_1',
  745. lineStyle: lineStyle,
  746. coords: [[205, 250], [265, 250]]
  747. },
  748. {
  749. nodeKey: 'flow_fgld_1_0_1',
  750. lineStyle: lineStyle,
  751. coords: [[285, 250], [345, 250]]
  752. },
  753. {
  754. nodeKey: 'flow_sjfgld_1_0_1',
  755. lineStyle: lineStyle,
  756. coords: [[365, 250], [425, 250]]
  757. },
  758. {
  759. nodeKey: 'flow_zyld_1_0_1',
  760. lineStyle: lineStyle,
  761. coords: [[445, 250], [505, 250]]
  762. },
  763. {
  764. nodeKey: 'flow_zyld_1_0_1_back',
  765. lineStyle: lineStyle,
  766. coords: [[450, 250], [450, 550]],
  767. symbol: 'none'
  768. },
  769. {
  770. nodeKey: 'flow_sjfgld_1_0_1_back',
  771. lineStyle: lineStyle,
  772. coords: [[370, 250], [370, 500]],
  773. symbol: 'none'
  774. },
  775. {
  776. nodeKey: 'flow_fgld_1_0_1_back',
  777. lineStyle: lineStyle,
  778. coords: [[290, 250], [290, 450]],
  779. symbol: 'none'
  780. },
  781. {
  782. nodeKey: 'dept_head_1_0_1_back',
  783. lineStyle: lineStyle,
  784. coords: [[210, 250], [210, 400]],
  785. symbol: 'none'
  786. },
  787. {
  788. nodeKey: 'dept_superior_1_0_1_back',
  789. lineStyle: lineStyle,
  790. coords: [[130, 250], [130, 350]],
  791. symbol: 'none'
  792. },
  793. {
  794. nodeKey: 'flow_cgzy_1_0_1_back',
  795. lineStyle: lineStyle,
  796. coords: [[50, 250], [50, 600]],
  797. symbol: 'none'
  798. },
  799. {
  800. nodeKey: 'flow_zyld_1_0_1_back',
  801. lineStyle: lineStyle,
  802. coords: [[450, 550], [50, 550]],
  803. symbol: 'none'
  804. },
  805. {
  806. nodeKey: 'flow_sjfgld_1_0_1_back',
  807. lineStyle: lineStyle,
  808. coords: [[370, 500], [50, 500]],
  809. symbol: 'none'
  810. },
  811. {
  812. nodeKey: 'flow_fgld_1_0_1_back',
  813. lineStyle: lineStyle,
  814. coords: [[290, 450], [50, 450]],
  815. symbol: 'none'
  816. },
  817. {
  818. nodeKey: 'dept_head_1_0_1_back',
  819. lineStyle: lineStyle,
  820. coords: [[210, 400], [50, 400]],
  821. symbol: 'none'
  822. },
  823. {
  824. nodeKey: 'dept_superior_1_0_1_back',
  825. lineStyle: lineStyle,
  826. coords: [[130, 350], [50, 350]],
  827. symbol: 'none'
  828. },
  829. {
  830. nodeKey: 'flow_cgzy_1_0_1_back',
  831. lineStyle: lineStyle,
  832. coords: [[50, 600], [530, 600]],
  833. symbol: 'none'
  834. },
  835. {
  836. nodeKey: 'flow_cgzy_1_0_1_back',
  837. lineStyle: lineStyle,
  838. coords: [[530, 600], [530, 250]],
  839. symbol: 'none'
  840. },
  841. {
  842. lineStyle: lineStyle,
  843. coords: [[530, 250], [530, 130]]
  844. }
  845. ]
  846. if (row.id) {
  847. const { data } = await this.flowMainRequest('getIMGFlowHistroyByFlowMainId', { flowMainId: row.id })
  848. for (let i = 0; i < data.length; i++) {
  849. const index = node.findIndex((e) => e.nodeKey === data[i].nodeKey)
  850. switch (data[i].nodeKey) {
  851. case 'curr_user':
  852. if (data[i].type === '1') {
  853. this.getImgUrl(index, data[i].type, node)
  854. this.getLineStyle(data[i].nodeKey)
  855. }
  856. break
  857. case 'dept_superior_1_0_1':
  858. if (data[i].type === '1' || data[i].type === '3') {
  859. this.getImgUrl(index, data[i].type, node)
  860. }
  861. if (data[i].type === '1') {
  862. this.getLineStyle(data[i].nodeKey)
  863. }
  864. if (data[i].type === '2') {
  865. this.getLineStyle('dept_superior_1_0_1_back')
  866. this.getImgUrl(index, data[i].type, node)
  867. }
  868. break
  869. case 'dept_head_1_0_1':
  870. if (data[i].type === '1' || data[i].type === '3') {
  871. this.getImgUrl(index, data[i].type, node)
  872. }
  873. if (data[i].type === '1') {
  874. this.getLineStyle(data[i].nodeKey)
  875. }
  876. if (data[i].type === '2') {
  877. this.getLineStyle('dept_head_1_0_1_back')
  878. this.getLineStyle('dept_superior_1_0_1_back')
  879. this.getImgUrl(index, data[i].type, node)
  880. }
  881. break
  882. case 'flow_fgld_1_0_1':
  883. this.getImgUrl(index, data[i].type, node)
  884. if (data[i].type === '1') {
  885. this.getLineStyle('flow_fgld_1_0_1')
  886. }
  887. if (data[i].type === '2') {
  888. this.getLineStyle('flow_fgld_1_0_1_back')
  889. this.getLineStyle('dept_superior_1_0_1_back')
  890. this.getLineStyle('dept_head_1_0_1_back')
  891. }
  892. break
  893. case 'flow_sjfgld_1_0_1':
  894. this.getLineStyle(data[i].nodeKey)
  895. this.getImgUrl(index, data[i].type, node)
  896. if (data[i].type === '2') {
  897. this.getLineStyle('flow_sjfgld_1_0_1_back')
  898. this.getLineStyle('flow_fgld_1_0_1_back')
  899. this.getLineStyle('dept_head_1_0_1_back')
  900. this.getLineStyle('dept_superior_1_0_1_back')
  901. }
  902. break
  903. case 'flow_zyld_1_0_1':
  904. if (data[i].type === '1') {
  905. this.getLineStyle(data[i].nodeKey)
  906. this.getImgUrl(index, data[i].type, node)
  907. }
  908. if (data[i].type === '2') {
  909. this.getLineStyle('flow_zyld_1_0_1_back')
  910. this.getLineStyle('flow_sjfgld_1_0_1_back')
  911. this.getLineStyle('flow_fgld_1_0_1_back')
  912. this.getLineStyle('dept_head_1_0_1_back')
  913. this.getLineStyle('dept_superior_1_0_1_back')
  914. this.getLineStyle('flow_sjfgld_1_0_1_back')
  915. }
  916. break
  917. case 'flow_cgzy_1_0_1':
  918. this.getImgUrl(index, data[i].type, node)
  919. if (data[i].type === '1') {
  920. this.getLineStyle(data[i].nodeKey)
  921. const endIndex = node.findIndex((e) => e.name === '结束')
  922. this.getImgUrl(endIndex, '1', node)
  923. }
  924. if (data[i].type === '2') {
  925. this.getLineStyle('flow_cgzy_1_0_1_back')
  926. this.getLineStyle('flow_zyld_1_0_1_back')
  927. this.getLineStyle('flow_sjfgld_1_0_1_back')
  928. this.getLineStyle('flow_fgld_1_0_1_back')
  929. this.getLineStyle('dept_head_1_0_1_back')
  930. this.getLineStyle('dept_superior_1_0_1_back')
  931. this.getLineStyle('flow_sjfgld_1_0_1_back')
  932. }
  933. break
  934. default:
  935. }
  936. }
  937. }
  938. this.$nextTick(() => {
  939. const chartDom = document.getElementById('containerPurchase')
  940. var myCharts = echarts.init(chartDom)
  941. const charts = {
  942. nodes: node,
  943. linesData: this.linesData
  944. }
  945. const option = {
  946. xAxis: {
  947. min: 0,
  948. max: 600,
  949. padding: [0, 50, 0, 50],
  950. show: false,
  951. type: 'value'
  952. },
  953. yAxis: {
  954. min: 0,
  955. max: 650,
  956. show: false,
  957. type: 'value'
  958. },
  959. grid: {
  960. left: 50,
  961. right: 0,
  962. bottom: 0,
  963. top: 0
  964. },
  965. series: [
  966. {
  967. type: 'graph',
  968. coordinateSystem: 'cartesian2d',
  969. symbol: 'rect',
  970. symbolSize: [80, 40],
  971. itemStyle: {
  972. color: 'rgb(225,7,7)'
  973. },
  974. symbolOffset: [10, 0],
  975. // force: {
  976. // edgeLength: 100,//连线的长度
  977. // repulsion: 200 //子节点之间的间距
  978. // },
  979. label: {
  980. show: true,
  981. color: 'white' // 节点文字颜色
  982. },
  983. data: charts.nodes
  984. },
  985. {
  986. type: 'lines',
  987. polyline: false,
  988. coordinateSystem: 'cartesian2d',
  989. symbol: ['', 'arrow'],
  990. symbolSize: 10,
  991. data: charts.linesData
  992. }
  993. ]
  994. }
  995. myCharts.clear()
  996. myCharts.setOption(option)
  997. window.addEventListener('resize', () => {
  998. myCharts.resize()
  999. })
  1000. })
  1001. },
  1002. getLineStyle(nodeKey) {
  1003. for (let i = 0; i < this.linesData.length; i++) {
  1004. if (this.linesData[i].nodeKey === nodeKey) {
  1005. this.linesData[i].lineStyle = {
  1006. color: '#2A3980',
  1007. width: 2
  1008. }
  1009. }
  1010. }
  1011. },
  1012. getImgUrl(index, type, node) {
  1013. if (index === -1) return
  1014. switch (type) {
  1015. case '1':
  1016. node[index].symbol = 'image://' + require('../asste/lanfangkuai.png')
  1017. break
  1018. case '2':
  1019. node[index].symbol = 'image://' + require('../asste/hongfangkuai.jpg')
  1020. break
  1021. case '3':
  1022. node[index].symbol = 'image://' + require('../asste/huangfanmgkuai.png')
  1023. break
  1024. case '4' || '5':
  1025. node[index].symbol = 'image://' + require('../asste/qianlanfangkuai.jpg')
  1026. break
  1027. default:
  1028. }
  1029. },
  1030. baseRequest(opUrl, postData) {
  1031. return this.$channel.globleRequest('ApplyPurchaseController', opUrl, postData, 'project task')
  1032. },
  1033. flowMainRequest(opUrl, postData) {
  1034. return this.$channel.globleRequest('FlowMainController', opUrl, postData, 'project')
  1035. },
  1036. ourOrderMainRequest(opUrl, postData) {
  1037. return this.$channel.globleRequest('OutOrderMainController', opUrl, postData, 'project')
  1038. },
  1039. supplierRequest(opUrl, postData) {
  1040. return this.$channel.globleRequest('SupplierController', opUrl, postData, 'project')
  1041. }
  1042. }
  1043. }
  1044. </script>
  1045. <style lang="scss">
  1046. #containerPurchase {
  1047. width: 100%;
  1048. height: 600px;
  1049. background: #F5F5F5;
  1050. }
  1051. .cclist {
  1052. .col-input {
  1053. padding: 0;
  1054. }
  1055. }
  1056. .mb25 {
  1057. margin-bottom: 25px;
  1058. }
  1059. .pdtopbottom16 {
  1060. padding: 0px 16px;
  1061. }
  1062. .pdtop16px {
  1063. padding-top: 16px;
  1064. }
  1065. .cost_form {
  1066. .col-input {
  1067. font-weight: 400;
  1068. }
  1069. .el-form-item__label .moneydetails {
  1070. text-align: right;
  1071. font-size: 16px;
  1072. font-family: 微软雅黑;
  1073. padding-right: 10px;
  1074. line-height: 40px;
  1075. word-break: keep-all;
  1076. white-space: nowrap;
  1077. color: #606266;
  1078. text-rendering: optimizeLegibility;
  1079. font-weight: 400;
  1080. }
  1081. .moneydetails {
  1082. text-align: right;
  1083. font-size: 16px;
  1084. font-family: 微软雅黑;
  1085. padding-right: 10px;
  1086. word-break: keep-all;
  1087. white-space: nowrap;
  1088. color: #606266;
  1089. text-rendering: optimizeLegibility;
  1090. font-weight: 400;
  1091. }
  1092. .moneydetails:before {
  1093. content: "*";
  1094. color: #ff4949;
  1095. }
  1096. }
  1097. .txtc {
  1098. text-align: center
  1099. }
  1100. .ml5 {
  1101. margin-left: 5px;
  1102. }
  1103. .eltype {
  1104. margin-bottom: 5px;
  1105. }
  1106. .tabsdomPurchase {
  1107. .el-tabs__header {
  1108. text-align: center !important;
  1109. width: 139px !important;
  1110. text-align: center !important;
  1111. display: block !important;
  1112. margin: auto !important;
  1113. margin-bottom: 15px !important;
  1114. }
  1115. .el-tabs__nav-wrap::after {
  1116. display: none;
  1117. }
  1118. .el-upload {
  1119. width: 100%;
  1120. text-align: left;
  1121. }
  1122. }
  1123. .feeMoneyTotal {
  1124. width: 100%;
  1125. height: 14px;
  1126. font-size: 14px;
  1127. font-weight: 400;
  1128. color: #1890FF;
  1129. margin-top: 31px;
  1130. margin-bottom: 13px;
  1131. }
  1132. </style>