detailDialog.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447
  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="80%"
  10. @close="cancel"
  11. :maxable="true"
  12. :resizable="true"
  13. :modal="isModal"
  14. >
  15. <div class="switch">
  16. <div class="switch_left">
  17. <ul>
  18. <li
  19. v-for="item in tabOptions"
  20. :key="item.key"
  21. :class="{ active: activeComp == item.key }"
  22. @click="activeComp = item.key"
  23. >
  24. {{ item.name }}
  25. </li>
  26. </ul>
  27. </div>
  28. </div>
  29. <div v-show="activeComp == 'main'">
  30. <el-form ref="form" :model="form" class="el-form-box" label-width="120px">
  31. <headerTitle title="基本信息">
  32. <!-- <el-button
  33. size="small"
  34. type="primary"
  35. icon="el-icon-s-grid"
  36. class="ele-btn-icon"
  37. @click="exportTable"
  38. >
  39. 导出
  40. </el-button> -->
  41. </headerTitle>
  42. <el-row>
  43. <el-col :span="12">
  44. <el-form-item label="需求类型:" prop="sourceTypeName">
  45. <el-input v-model="form.sourceTypeName" disabled></el-input>
  46. </el-form-item>
  47. </el-col>
  48. <el-col :span="12">
  49. <el-form-item label="需求单名称:" prop="requirementName">
  50. <el-input v-model="form.requirementName" disabled></el-input>
  51. </el-form-item>
  52. </el-col>
  53. <el-col :span="12">
  54. <el-form-item label="需求部门:" prop="requireDeptName">
  55. <el-input v-model="form.requireDeptName" disabled></el-input>
  56. </el-form-item>
  57. </el-col>
  58. <el-col :span="12">
  59. <el-form-item label="需求人:" prop="requireUserName">
  60. <el-input v-model="form.requireUserName" disabled></el-input>
  61. </el-form-item>
  62. </el-col>
  63. <el-col v-if="form.sourceType == 1" :span="12">
  64. <el-form-item label="销售合同">
  65. <el-input v-model="form.saleContractName" disabled></el-input>
  66. </el-form-item>
  67. </el-col>
  68. <el-col v-if="form.sourceType == 1" :span="12">
  69. <el-form-item label="销售订单">
  70. <el-input v-model="form.saleOrderNo" disabled></el-input>
  71. </el-form-item>
  72. </el-col>
  73. <el-col :span="12">
  74. <el-form-item prop="remark" label="是否接受拆单">
  75. <el-select
  76. v-model="form.acceptUnpack"
  77. placeholder="请选择"
  78. disabled
  79. style="width: 100%"
  80. >
  81. <el-option label="接受" :value="1"></el-option>
  82. <el-option label="不接受" :value="0"></el-option>
  83. </el-select>
  84. </el-form-item>
  85. </el-col>
  86. <!-- <el-col :span="12">
  87. <el-form-item label="完成日期:" prop="finishDate">
  88. <el-input v-model="form.finishDate" disabled></el-input>
  89. </el-form-item>
  90. </el-col> -->
  91. <el-col :span="12">
  92. <el-form-item label="用途:" prop="useTo">
  93. <el-input
  94. type="textarea"
  95. v-model="form.useTo"
  96. disabled
  97. ></el-input>
  98. </el-form-item>
  99. </el-col>
  100. <el-col :span="12">
  101. <el-form-item prop="remark" label="备注:">
  102. <el-input
  103. type="textarea"
  104. v-model="form.remark"
  105. disabled
  106. ></el-input>
  107. </el-form-item>
  108. </el-col>
  109. <el-col :span="12">
  110. <el-form-item prop="askFile" label="附件:">
  111. <fileMain v-model="form.fileId" type="view"></fileMain>
  112. </el-form-item>
  113. </el-col>
  114. </el-row>
  115. </el-form>
  116. <headerTitle title="需求清单"></headerTitle>
  117. <ele-pro-table
  118. ref="table"
  119. :needPage="false"
  120. :columns="columns"
  121. :max-height="500"
  122. :datasource="detailData.detailList"
  123. @columns-change="handleColumnChange"
  124. :cache-key="cacheKeyUrl"
  125. row-key="id"
  126. >
  127. <template v-slot:expectReceiveDate="scope">
  128. <div v-if="scope.row.arrivalWay == 1">
  129. {{ scope.row.expectReceiveDate }}
  130. </div>
  131. <div v-if="scope.row.arrivalWay == 2">
  132. <el-link
  133. type="primary"
  134. :underline="false"
  135. @click.native="handleMethod(scope.row)"
  136. >
  137. 查看分批时间
  138. </el-link>
  139. </div>
  140. </template>
  141. <template v-slot:technicalDrawings="{ row }">
  142. <fileMain v-model="row.technicalDrawings" type="view"></fileMain>
  143. </template>
  144. <template v-slot:files="{ row }">
  145. <fileMain v-model="row.files" type="view"></fileMain>
  146. </template>
  147. </ele-pro-table>
  148. </div>
  149. <bpmDetail
  150. v-if="activeComp === 'bpm' && form.processInstanceId"
  151. :id="form.processInstanceId"
  152. ></bpmDetail>
  153. <timeDialog ref="timeDialogRef" :view="true"></timeDialog>
  154. <div slot="footer" class="footer">
  155. <el-button @click="cancel">返回</el-button>
  156. </div>
  157. </ele-modal>
  158. </template>
  159. <script>
  160. import { getDetail } from '@/api/purchasingManage/purchaseNeedManage';
  161. import { getFile } from '@/api/system/file';
  162. import dictMixins from '@/mixins/dictMixins';
  163. import { copyObj } from '@/utils/util';
  164. import bpmDetail from '@/views/bpm/processInstance/detail.vue';
  165. import timeDialog from '@/components/timeDialog/index.vue';
  166. // import fileMain from '@/components/addDoc/index';
  167. import { lbjtList } from '@/enum/dict.js';
  168. import tabMixins from '@/mixins/tableColumnsMixin';
  169. export default {
  170. mixins: [dictMixins,tabMixins],
  171. props: {
  172. isModal: {
  173. default: true
  174. }
  175. },
  176. components: {
  177. bpmDetail,
  178. timeDialog,
  179. // fileMain
  180. },
  181. data() {
  182. return {
  183. cacheKeyUrl:'eos-purchaseNeedManage-inventoryTableDetail',
  184. activeComp: 'main',
  185. tabOptions: [
  186. { key: 'main', name: '需求详情' },
  187. { key: 'bpm', name: '流程详情' }
  188. ],
  189. visible: false,
  190. title: '详情',
  191. row: {},
  192. form: {},
  193. detailData: {},
  194. columns: [
  195. {
  196. width: 45,
  197. type: 'index',
  198. columnKey: 'index',
  199. align: 'center',
  200. fixed: 'left'
  201. },
  202. {
  203. width: 150,
  204. prop: 'productCategoryName',
  205. label: '分类',
  206. slot: 'productCategoryName',
  207. align: 'center'
  208. },
  209. {
  210. width: 140,
  211. prop: 'productCode',
  212. label: '编码',
  213. slot: 'productCode',
  214. align: 'center'
  215. },
  216. {
  217. width: 240,
  218. prop: 'productName',
  219. label: '名称',
  220. slot: 'productName',
  221. align: 'center'
  222. },
  223. {
  224. width: 150,
  225. prop: 'productBrand',
  226. label: '牌号',
  227. slot: 'productBrand',
  228. align: 'center'
  229. },
  230. {
  231. width: 80,
  232. prop: 'totalCount',
  233. label: '数量',
  234. slot: 'totalCount',
  235. align: 'center'
  236. },
  237. {
  238. width: 80,
  239. prop: 'doneTotalCount',
  240. label: '已采数量',
  241. align: 'center'
  242. },
  243. {
  244. width: 80,
  245. prop: 'waitTotalCount',
  246. label: '待采数量',
  247. align: 'center'
  248. },
  249. {
  250. minWidth: 120,
  251. prop: 'taskName',
  252. label: '工序',
  253. slot: 'taskName',
  254. align: 'center'
  255. },
  256. {
  257. width: 110,
  258. prop: 'batchNo',
  259. label: '批次号',
  260. slot: 'batchNo',
  261. align: 'center'
  262. },
  263. {
  264. prop: 'provenance',
  265. label: '产地',
  266. slot: 'provenance',
  267. align: 'center',
  268. minWidth: 200,
  269. showOverflowTooltip: true,
  270. formatter: (row, column) => {
  271. return row.provenance && row.provenance.length
  272. ? row.provenance
  273. .map((item) => this.getDictValue('产地', item))
  274. .join(',')
  275. : '';
  276. }
  277. },
  278. {
  279. width: 100,
  280. prop: 'measuringUnit',
  281. label: '单位',
  282. slot: 'measuringUnit',
  283. align: 'center'
  284. },
  285. {
  286. width: 130,
  287. prop: 'modelType',
  288. label: '型号',
  289. slot: 'modelType',
  290. align: 'center'
  291. },
  292. {
  293. width: 120,
  294. prop: 'specification',
  295. label: '规格',
  296. slot: 'specification',
  297. align: 'center'
  298. },
  299. {
  300. width: 130,
  301. prop: 'brand',
  302. label: '品牌',
  303. slot: 'brand',
  304. align: 'center'
  305. },
  306. {
  307. width: 150,
  308. prop: 'arrivalWay',
  309. label: ' 到货方式',
  310. formatter: (row, column, cellValue) => {
  311. return cellValue == 1 ? '一次性到货' : '分批到货';
  312. },
  313. align: 'center'
  314. },
  315. {
  316. width: 170,
  317. prop: 'expectReceiveDate',
  318. label: '到货日期',
  319. slot: 'expectReceiveDate',
  320. align: 'center'
  321. },
  322. {
  323. width: 120,
  324. prop: 'produceType',
  325. align: 'center',
  326. label: '属性类型',
  327. showOverflowTooltip: true,
  328. formatter: (row, column) => {
  329. if (row.produceType) {
  330. return row.produceType
  331. .map((item) => {
  332. return lbjtList[item];
  333. })
  334. .toString();
  335. }
  336. }
  337. },
  338. // {
  339. // width: 120,
  340. // prop: 'approvalNumber',
  341. // align: 'center',
  342. // label: '批准文号',
  343. // showOverflowTooltip: true
  344. // },
  345. {
  346. width: 120,
  347. prop: 'packingSpecification',
  348. align: 'center',
  349. label: '包装规格',
  350. showOverflowTooltip: true
  351. },
  352. {
  353. width: 160,
  354. prop: 'technicalDrawings',
  355. label: '图纸附件',
  356. slot: 'technicalDrawings',
  357. align: 'center'
  358. },
  359. {
  360. width: 140,
  361. prop: 'files',
  362. label: '附件',
  363. slot: 'files',
  364. align: 'center'
  365. },
  366. {
  367. width: 220,
  368. prop: 'remark',
  369. label: '备注',
  370. slot: 'remark',
  371. align: 'center'
  372. }
  373. ]
  374. };
  375. },
  376. created() {
  377. this.requestDict('产地');
  378. this.requestDict('生产类型');
  379. },
  380. methods: {
  381. async open(row) {
  382. this.visible = true;
  383. this.getDetailData(row.requirementId || row.id);
  384. },
  385. cancel() {
  386. this.$nextTick(() => {
  387. // 关闭后,销毁所有的表单数据
  388. (this.form = copyObj(this.formDef)),
  389. (this.otherForm = copyObj(this.otherFormDef)),
  390. (this.tableBankData = []);
  391. this.tableLinkData = [];
  392. this.visible = false;
  393. });
  394. },
  395. downloadFile(file) {
  396. getFile({ objectName: file.storePath }, file.name);
  397. },
  398. handleMethod(row) {
  399. this.$refs.timeDialogRef.open(row);
  400. },
  401. async getDetailData(id) {
  402. this.loading = true;
  403. const data = await getDetail(id);
  404. this.loading = false;
  405. if (data) {
  406. this.form = data;
  407. if (this.form.fileId) {
  408. this.form.fileId = JSON.parse(this.form.fileId);
  409. }
  410. this.detailData = data;
  411. if (data.files && data.files.length > 0) {
  412. this.form.files = data.files[0];
  413. } else {
  414. this.form.files = null;
  415. }
  416. }
  417. }
  418. }
  419. };
  420. </script>
  421. <style scoped lang="scss">
  422. .ele-dialog-form {
  423. .el-form-item {
  424. margin-bottom: 10px;
  425. }
  426. }
  427. .headbox {
  428. display: flex;
  429. justify-content: space-between;
  430. align-items: center;
  431. .amount {
  432. font-size: 14px;
  433. font-weight: bold;
  434. }
  435. }
  436. </style>