contract-add-or-update.vue 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267
  1. <template>
  2. <div>
  3. <!-- <el-dialog
  4. :title="!id ? '发起评审': display ? '评审详情' : '修改'"
  5. width="70%"
  6. :close-on-click-modal="false"
  7. :visible.sync="visible"> -->
  8. <div class="my-title">{{ !id ? '发起评审': display ? '评审详情' : '修改' }}</div>
  9. <!-- 工作流 -->
  10. <div v-show="display && dataForm.workFlowBusinessExt">
  11. <el-steps :active="dataForm.workFlowBusinessExt&&dataForm.workFlowBusinessExt.workFlowProcessStepList?dataForm.workFlowBusinessExt.workFlowProcessStepList.length + 2:0" align-center style="margin-bottom: 20px">
  12. <template v-for="(item, i) in stepList">
  13. <el-step :icon="item.icon" :title="item.title" :description="item.description"></el-step>
  14. </template>
  15. </el-steps>
  16. <el-collapse style="margin-bottom: 20px">
  17. <el-collapse-item>
  18. <template slot="title">
  19. <span style="color: red">审批日志(展开查看更多):</span>
  20. </template>
  21. <template v-for="(item, i) in logList">
  22. <div>{{++i}}:{{item.approverName}} {{item.createTime}} {{item.approvalValue}}</div>
  23. </template>
  24. </el-collapse-item>
  25. </el-collapse>
  26. </div>
  27. <!-- 表单 -->
  28. <el-form :model="dataForm" :rules="dataRule" ref="dataForm" label-width="auto">
  29. <el-row class="my-row">
  30. <el-col :span="8">
  31. <el-form-item label="评审编码" prop="reCode">
  32. <el-input v-model="dataForm.reCode" :disabled="true" placeholder="系统自动生成,无需填写"></el-input>
  33. </el-form-item>
  34. </el-col>
  35. <el-col :span="8" style="padding-left: 20px">
  36. <el-form-item label="沟通编码" prop="coCode">
  37. <el-select
  38. v-model="dataForm.coCode"
  39. :disabled="display"
  40. remote
  41. placeholder="请选择"
  42. @change="coListSelected">
  43. <el-option
  44. v-for="item in options1"
  45. :key="item.value"
  46. :label="item.coCode + ' (' + item.customerName + ')'"
  47. :value="item.coCode">
  48. </el-option>
  49. </el-select>
  50. </el-form-item>
  51. </el-col>
  52. <el-col :span="8" style="padding-left: 20px">
  53. <el-form-item label="评审类别" prop="reType">
  54. <el-select
  55. v-model="dataForm.reType"
  56. :disabled="display"
  57. remote
  58. placeholder="请选择">
  59. <el-option
  60. v-for="item in options"
  61. :key="item.code"
  62. :label="item.value"
  63. :value="item.code">
  64. </el-option>
  65. </el-select>
  66. </el-form-item>
  67. </el-col>
  68. </el-row>
  69. <el-row class="my-row">
  70. <el-col :span="8">
  71. <el-form-item label="客户名称" prop="name">
  72. <el-input v-model="dataForm.name" disabled placeholder="客户名称"></el-input>
  73. </el-form-item>
  74. </el-col>
  75. <el-col :span="8" style="padding-left: 20px">
  76. <el-form-item label="联系人" prop="cellName">
  77. <el-input v-model="dataForm.cellName" disabled placeholder="联系人"></el-input>
  78. </el-form-item>
  79. </el-col>
  80. <el-col :span="8" style="padding-left: 20px">
  81. </el-col>
  82. </el-row>
  83. <el-row class="my-row">
  84. <el-form-item label="备注说明">
  85. <el-input v-model="dataForm.notes" :disabled="display" placeholder="备注说明"></el-input>
  86. </el-form-item>
  87. </el-row>
  88. <el-row class="my-row">
  89. <upload-component :display="true" :title="'沟通信息表附件'" :accept="'*'" :file-obj-list="fileList1"/>
  90. </el-row>
  91. <el-row class="my-row">
  92. <upload-component :display="display" :title="'合同评审表'" :accept="'*'" :file-obj-list="fileList" @uploadSuccess="uploadSuccess"/>
  93. </el-row>
  94. </el-form>
  95. <span slot="footer" class="dialog-footer">
  96. <el-button @click="onChose">取消</el-button>
  97. <el-button v-if="!display" type="primary" @click="dataFormSubmit()">确定</el-button>
  98. </span>
  99. <!-- </el-dialog> -->
  100. </div>
  101. </template>
  102. <script>
  103. import { getCoCode, geTreDetail } from '@/api/cus'
  104. import { getDictList } from '@/api/dict'
  105. import { dealStepData, dealStepLogs } from '@/api/util'
  106. import UploadComponent from '../common/upload-component'
  107. export default {
  108. name: 'stock-order-inbound',
  109. components: {UploadComponent},
  110. computed: {
  111. orgId: {
  112. get () { return this.$store.state.user.orgId }
  113. }
  114. },
  115. data () {
  116. return {
  117. visible: false,
  118. dictType: 'material_type',
  119. options: [],
  120. options1: [],
  121. dataList: [],
  122. fileList: [],
  123. fileList1: [],
  124. stepList: [],
  125. logList: [],
  126. id: 0,
  127. dataForm: {
  128. coCode: '',
  129. name: '',
  130. cellName: '',
  131. reType: '',
  132. notes: '',
  133. attachList: []
  134. },
  135. dataRule: {
  136. coCode: [{ required: true, message: '沟通编码不能为空', trigger: 'change' }],
  137. reType: [{ required: true, message: '评审类别不能为空', trigger: 'change' }]
  138. // name: [{ required: true, message: '客户名称不能为空', trigger: 'blur' }],
  139. // cellName: [{ required: true, message: '联系人不能为空', trigger: 'blur' }]
  140. },
  141. display: false
  142. }
  143. },
  144. watch: {
  145. 'dataForm.coCode' (value) {
  146. let v = this.options1.find((item) => { return item.coCode === value })
  147. if (v) {
  148. this.dataForm.name = v.customerName
  149. this.dataForm.cellName = v.contact
  150. if (v.attachList) {
  151. this.fileList1 = []
  152. v.attachList.forEach((item) => {
  153. this.fileList1.push({
  154. name: item.fileName,
  155. url: item.url,
  156. id: item.url
  157. })
  158. })
  159. }
  160. }
  161. }
  162. },
  163. methods: {
  164. onChose () {
  165. this.$emit('onChose')
  166. },
  167. async init (id, disable) {
  168. this.dataForm = {}
  169. this.display = disable
  170. this.fileList = []
  171. this.stepList = []
  172. this.logList = []
  173. this.visible = true
  174. this.id = id || 0
  175. // 获取评审类别
  176. await getDictList({type: 'review_type'}).then(({data}) => {
  177. if (data) {
  178. this.options = data
  179. }
  180. })
  181. await getCoCode().then(({data}) => {
  182. if (data && data.code === '200') {
  183. this.options1 = data.data
  184. }
  185. })
  186. if (!id) return
  187. await geTreDetail(id).then(({data}) => {
  188. if (data && data.code === '200') {
  189. this.dataForm = data.data
  190. // 流程图展示
  191. dealStepData(data.data.workFlowBusinessExt.workFlowProcessStepList, this.stepList)
  192. dealStepLogs(data.data.workFlowBusinessExt.processLogList, this.logList)
  193. // 附件显示
  194. this.fileList = []
  195. data.data.attachList.forEach((item) => {
  196. this.fileList.push({
  197. name: item.fileName,
  198. url: item.url,
  199. id: item.url
  200. })
  201. })
  202. }
  203. })
  204. },
  205. uploadSuccess (fileList) {
  206. this.fileList = fileList
  207. },
  208. // 表单提交
  209. dataFormSubmit () {
  210. this.$refs['dataForm'].validate((valid) => {
  211. if (valid) {
  212. let fList = this.fileList
  213. if (fList.length > 0) {
  214. this.dataForm.attachList = []
  215. for (let i = 0; i < fList.length; i++) {
  216. this.dataForm.attachList.push({
  217. fileName: fList[i].name,
  218. url: fList[i].url
  219. })
  220. }
  221. } else {
  222. this.$message.error('请上传文件')
  223. return
  224. }
  225. this.$http({
  226. url: this.$http.adornUrl(`/biz-service/flow/cusContractReview/submit`),
  227. method: 'post',
  228. data: this.$http.adornData({...this.dataForm, orgId: this.orgId})
  229. }).then(({data}) => {
  230. if (data && data.code === '200') {
  231. this.$message({
  232. message: '操作成功',
  233. type: 'success',
  234. duration: 1500,
  235. onClose: () => {
  236. this.onChose()
  237. this.$emit('refreshDataList')
  238. }
  239. })
  240. } else {
  241. this.$message.error(data.msg)
  242. }
  243. })
  244. }
  245. })
  246. },
  247. validateField (type) {
  248. this.$refs.dataForm.validateField(type)
  249. },
  250. coListSelected (item) {
  251. // todo
  252. // console.log('item = ' + JSON.stringify(item))
  253. }
  254. }
  255. }
  256. </script>
  257. <style scoped>
  258. .my-line{
  259. border-bottom: 1px solid #c0c4cc;
  260. margin-bottom: 10px;
  261. }
  262. .title{
  263. padding: 10px 0 ;
  264. }
  265. </style>