detailDialog.vue 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299
  1. <template>
  2. <ele-modal
  3. custom-class="ele-dialog-form long-dialog-form"
  4. :centered="true"
  5. v-if="visible"
  6. :visible.sync="visible"
  7. :title="title"
  8. :close-on-click-modal="false"
  9. width="60%"
  10. @close="cancel"
  11. :modal="isModal"
  12. >
  13. <div class="switch">
  14. <div class="switch_left">
  15. <ul>
  16. <li
  17. v-for="item in tabOptions"
  18. :key="item.key"
  19. :class="{ active: activeComp == item.key }"
  20. @click="activeComp = item.key"
  21. >
  22. {{ item.name }}
  23. </li>
  24. </ul>
  25. </div>
  26. </div>
  27. <div v-if="activeComp == 'main'">
  28. <el-form ref="form" :model="form" label-width="120px">
  29. <headerTitle title="基本信息">
  30. <!-- <el-button
  31. size="small"
  32. type="primary"
  33. icon="el-icon-s-grid"
  34. class="ele-btn-icon"
  35. @click="exportTable"
  36. >
  37. 导出
  38. </el-button> -->
  39. </headerTitle>
  40. <el-row>
  41. <el-col :span="12">
  42. <el-form-item label="需求来源类型:" prop="contactTel">
  43. {{ form.sourceName }}
  44. </el-form-item>
  45. </el-col>
  46. <el-col :span="12">
  47. <el-form-item label="需求部门:" prop="requireDeptName">
  48. {{ detailData.requireDeptName }}
  49. </el-form-item>
  50. </el-col>
  51. <el-col :span="12">
  52. <el-form-item label="需求人:" prop="requireUserName">
  53. {{ form.requireUserName }}
  54. </el-form-item>
  55. </el-col>
  56. <el-col :span="12">
  57. <el-form-item prop="remark" label="是否接受拆单">
  58. {{
  59. form.acceptUnpack === 1
  60. ? '接受'
  61. : form.cceptUnpack === 1
  62. ? '不接受'
  63. : ''
  64. }}
  65. </el-form-item>
  66. </el-col>
  67. <el-col :span="12">
  68. <el-form-item label="用途:" prop="useTo">
  69. {{ form.useTo }}
  70. </el-form-item>
  71. </el-col>
  72. <el-col :span="12">
  73. <el-form-item label="完成日期:" prop="finishDate">
  74. {{ form.finishDate }}
  75. </el-form-item>
  76. </el-col>
  77. <el-col :span="12">
  78. <el-form-item prop="remark" label="备注:">
  79. {{ form.remark }}
  80. </el-form-item>
  81. </el-col>
  82. <el-col :span="12">
  83. <el-form-item prop="askFile" label="附件:">
  84. <el-link
  85. v-if="form.files && form.files !== ''"
  86. type="primary"
  87. :underline="false"
  88. @click="downloadFile(form.files)"
  89. >
  90. {{ form.files.name }}</el-link
  91. >
  92. </el-form-item>
  93. </el-col>
  94. </el-row>
  95. </el-form>
  96. <headerTitle title="需求清单"></headerTitle>
  97. <ele-pro-table
  98. ref="table"
  99. :needPage="false"
  100. :columns="columns"
  101. :toolkit="[]"
  102. :datasource="detailData.detailList"
  103. row-key="id"
  104. >
  105. <template v-slot:files="{ row }">
  106. <div v-if="row.files && row.files?.length">
  107. <el-link
  108. v-for="link in row.files"
  109. :key="link.id"
  110. type="primary"
  111. :underline="false"
  112. @click="downloadFile(link)"
  113. >
  114. {{ link.name }}</el-link
  115. >
  116. </div>
  117. </template>
  118. </ele-pro-table>
  119. </div>
  120. <bpmDetail
  121. v-if="activeComp === 'bpm' && form.processInstanceId"
  122. :id="form.processInstanceId"
  123. ></bpmDetail>
  124. <div slot="footer" class="footer">
  125. <el-button @click="cancel">返回</el-button>
  126. </div>
  127. </ele-modal>
  128. </template>
  129. <script>
  130. import { getDetail } from '@/api/purchasingManage/purchaseNeedManage';
  131. import { getFile } from '@/api/system/file';
  132. import dictMixins from '@/mixins/dictMixins';
  133. import { copyObj } from '@/utils/util';
  134. import bpmDetail from '@/views/bpm/processInstance/detail.vue';
  135. export default {
  136. mixins: [dictMixins],
  137. props: {
  138. isModal: {
  139. default: true
  140. }
  141. },
  142. components: {
  143. bpmDetail
  144. },
  145. data() {
  146. return {
  147. activeComp: 'main',
  148. tabOptions: [
  149. { key: 'main', name: '需求详情' },
  150. { key: 'bpm', name: '流程详情' }
  151. ],
  152. visible: false,
  153. title: '详情',
  154. row: {},
  155. form: {},
  156. detailData: {},
  157. columns: [
  158. {
  159. width: 45,
  160. type: 'index',
  161. columnKey: 'index',
  162. align: 'center',
  163. fixed: 'left'
  164. },
  165. {
  166. width: 150,
  167. prop: 'productCategoryName',
  168. label: '分类',
  169. slot: 'productCategoryName'
  170. },
  171. {
  172. width: 140,
  173. prop: 'productCode',
  174. label: '编码',
  175. slot: 'productCode'
  176. },
  177. {
  178. width: 240,
  179. prop: 'productName',
  180. label: '名称',
  181. slot: 'productName'
  182. },
  183. {
  184. width: 150,
  185. prop: 'productBrand',
  186. label: '牌号',
  187. slot: 'productBrand'
  188. },
  189. {
  190. width: 80,
  191. prop: 'totalCount',
  192. label: '数量',
  193. slot: 'totalCount'
  194. },
  195. {
  196. width: 100,
  197. prop: 'measuringUnit',
  198. label: '单位',
  199. slot: 'measuringUnit'
  200. },
  201. {
  202. width: 130,
  203. prop: 'modelType',
  204. label: '型号',
  205. slot: 'modelType'
  206. },
  207. {
  208. width: 120,
  209. prop: 'specification',
  210. label: '规格',
  211. slot: 'specification'
  212. },
  213. {
  214. width: 130,
  215. prop: 'brand',
  216. label: '品牌',
  217. slot: 'brand'
  218. },
  219. {
  220. width: 170,
  221. prop: 'expectReceiveDate',
  222. label: '到货日期',
  223. slot: 'expectReceiveDate'
  224. },
  225. {
  226. width: 140,
  227. prop: 'files',
  228. label: '附件',
  229. slot: 'files'
  230. },
  231. {
  232. width: 220,
  233. prop: 'remark',
  234. label: '备注',
  235. slot: 'remark'
  236. }
  237. ]
  238. };
  239. },
  240. methods: {
  241. async open(row) {
  242. this.visible = true;
  243. this.getDetailData(row.requirementId || row.id);
  244. },
  245. cancel() {
  246. this.$nextTick(() => {
  247. // 关闭后,销毁所有的表单数据
  248. (this.form = copyObj(this.formDef)),
  249. (this.otherForm = copyObj(this.otherFormDef)),
  250. (this.tableBankData = []);
  251. this.tableLinkData = [];
  252. this.visible = false;
  253. });
  254. },
  255. downloadFile(file) {
  256. getFile({ objectName: file.storePath }, file.name);
  257. },
  258. async getDetailData(id) {
  259. this.loading = true;
  260. const data = await getDetail(id);
  261. this.loading = false;
  262. if (data) {
  263. this.form = data;
  264. this.detailData = data;
  265. if (data.files && data.files.length > 0) {
  266. this.form.files = data.files[0];
  267. } else {
  268. this.form.files = null;
  269. }
  270. }
  271. }
  272. }
  273. };
  274. </script>
  275. <style scoped lang="scss">
  276. .ele-dialog-form {
  277. .el-form-item {
  278. margin-bottom: 10px;
  279. }
  280. }
  281. .headbox {
  282. display: flex;
  283. justify-content: space-between;
  284. align-items: center;
  285. .amount {
  286. font-size: 14px;
  287. font-weight: bold;
  288. }
  289. }
  290. </style>