detailDialog.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488
  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. height="400"
  122. full-height="calc(100vh - 76px)"
  123. :datasource="detailData.detailList"
  124. @columns-change="handleColumnChange"
  125. :cache-key="cacheKeyUrl"
  126. row-key="id"
  127. >
  128. <template v-slot:expectReceiveDate="scope">
  129. <div v-if="scope.row.arrivalWay == 1">
  130. {{ scope.row.expectReceiveDate }}
  131. </div>
  132. <div v-if="scope.row.arrivalWay == 2">
  133. <el-link
  134. type="primary"
  135. :underline="false"
  136. @click.native="handleMethod(scope.row)"
  137. >
  138. 查看分批时间
  139. </el-link>
  140. </div>
  141. </template>
  142. <template v-slot:technicalDrawings="{ row }">
  143. <fileMain v-model="row.technicalDrawings" type="view"></fileMain>
  144. </template>
  145. <template v-slot:files="{ row }">
  146. <fileMain v-model="row.files" type="view"></fileMain>
  147. </template>
  148. </ele-pro-table>
  149. </div>
  150. <bpmDetail
  151. v-if="activeComp === 'bpm' && form.processInstanceId"
  152. :id="form.processInstanceId"
  153. ></bpmDetail>
  154. <timeDialog ref="timeDialogRef" :view="true"></timeDialog>
  155. <div slot="footer" class="footer">
  156. <el-button @click="cancel">返回</el-button>
  157. </div>
  158. </ele-modal>
  159. </template>
  160. <script>
  161. import { getDetail } from '@/api/purchasingManage/purchaseNeedManage';
  162. import { getFile } from '@/api/system/file';
  163. import dictMixins from '@/mixins/dictMixins';
  164. import { copyObj } from '@/utils/util';
  165. import bpmDetail from '@/views/bpm/processInstance/detail.vue';
  166. import timeDialog from '@/components/timeDialog/index.vue';
  167. // import fileMain from '@/components/addDoc/index';
  168. import { lbjtList } from '@/enum/dict.js';
  169. import tabMixins from '@/mixins/tableColumnsMixin';
  170. import { levelList } from '@/enum/dict.js';
  171. export default {
  172. mixins: [dictMixins, tabMixins],
  173. props: {
  174. isModal: {
  175. default: true
  176. }
  177. },
  178. components: {
  179. bpmDetail,
  180. timeDialog
  181. // fileMain
  182. },
  183. data() {
  184. return {
  185. cacheKeyUrl: 'eos-purchaseNeedManage-inventoryTableDetail',
  186. activeComp: 'main',
  187. tabOptions: [
  188. { key: 'main', name: '需求详情' },
  189. { key: 'bpm', name: '流程详情' }
  190. ],
  191. visible: false,
  192. title: '详情',
  193. row: {},
  194. form: {},
  195. detailData: {},
  196. columns: [
  197. {
  198. width: 45,
  199. type: 'index',
  200. columnKey: 'index',
  201. align: 'center',
  202. fixed: 'left'
  203. },
  204. {
  205. width: 150,
  206. prop: 'productCategoryName',
  207. label: '分类',
  208. slot: 'productCategoryName',
  209. align: 'center'
  210. },
  211. {
  212. width: 140,
  213. prop: 'productCode',
  214. label: '编码',
  215. slot: 'productCode',
  216. align: 'center'
  217. },
  218. {
  219. width: 240,
  220. prop: 'productName',
  221. label: '名称',
  222. slot: 'productName',
  223. align: 'center'
  224. },
  225. {
  226. width: 150,
  227. prop: 'productBrand',
  228. label: '牌号',
  229. slot: 'productBrand',
  230. align: 'center'
  231. },
  232. {
  233. width: 150,
  234. prop: 'purchaseCount',
  235. label: '数量',
  236. align: 'center'
  237. },
  238. {
  239. width: 150,
  240. prop: 'purchaseUnit',
  241. label: '单位',
  242. align: 'center'
  243. },
  244. {
  245. minWidth: 180,
  246. prop: 'packingSpecification',
  247. align: 'center',
  248. label: '包装规格',
  249. showOverflowTooltip: true
  250. },
  251. {
  252. width: 80,
  253. prop: 'totalCount',
  254. label: '计量数量',
  255. slot: 'totalCount',
  256. align: 'center'
  257. },
  258. {
  259. minWidth: 120,
  260. prop: 'goodsLevel',
  261. label: '物品级别',
  262. formatter: (_row, _column, cellValue) => {
  263. return levelList.find((item) => item.value == _row.goodsLevel)
  264. ?.label;
  265. },
  266. align: 'center'
  267. },
  268. {
  269. width: 80,
  270. prop: 'doneTotalCount',
  271. label: '已采数量',
  272. align: 'center'
  273. },
  274. {
  275. width: 80,
  276. prop: 'waitTotalCount',
  277. label: '待采数量',
  278. align: 'center'
  279. },
  280. {
  281. width: 100,
  282. prop: 'measuringUnit',
  283. label: '计量单位',
  284. slot: 'measuringUnit',
  285. align: 'center'
  286. },
  287. {
  288. minWidth: 120,
  289. prop: 'taskName',
  290. label: '工序',
  291. slot: 'taskName',
  292. align: 'center'
  293. },
  294. {
  295. width: 110,
  296. prop: 'batchNo',
  297. label: '批次号',
  298. slot: 'batchNo',
  299. align: 'center'
  300. },
  301. {
  302. width: 180,
  303. prop: 'supplierName',
  304. label: '供应商',
  305. slot: 'supplierName',
  306. // headerSlot: 'headerSupplierName',
  307. align: 'center'
  308. },
  309. {
  310. prop: 'provenance',
  311. label: '产地',
  312. slot: 'provenance',
  313. align: 'center',
  314. minWidth: 200,
  315. showOverflowTooltip: true,
  316. formatter: (row, column) => {
  317. return row.provenance && row.provenance.length
  318. ? row.provenance
  319. .map((item) => this.getDictValue('产地', item))
  320. .join(',')
  321. : '';
  322. }
  323. },
  324. {
  325. width: 130,
  326. prop: 'modelType',
  327. label: '型号',
  328. slot: 'modelType',
  329. align: 'center'
  330. },
  331. {
  332. width: 120,
  333. prop: 'specification',
  334. label: '规格',
  335. slot: 'specification',
  336. align: 'center'
  337. },
  338. {
  339. width: 130,
  340. prop: 'brand',
  341. label: '品牌',
  342. slot: 'brand',
  343. align: 'center'
  344. },
  345. {
  346. width: 150,
  347. prop: 'arrivalWay',
  348. label: ' 到货方式',
  349. formatter: (row, column, cellValue) => {
  350. return cellValue == 1 ? '一次性到货' : '分批到货';
  351. },
  352. align: 'center'
  353. },
  354. {
  355. width: 170,
  356. prop: 'expectReceiveDate',
  357. label: '到货日期',
  358. slot: 'expectReceiveDate',
  359. align: 'center'
  360. },
  361. {
  362. width: 120,
  363. prop: 'produceType',
  364. align: 'center',
  365. label: '属性类型',
  366. showOverflowTooltip: true,
  367. formatter: (row, column) => {
  368. if (row.produceType) {
  369. return row.produceType
  370. .map((item) => {
  371. return lbjtList[item];
  372. })
  373. .toString();
  374. }
  375. }
  376. },
  377. // {
  378. // width: 120,
  379. // prop: 'approvalNumber',
  380. // align: 'center',
  381. // label: '批准文号',
  382. // showOverflowTooltip: true
  383. // },
  384. // {
  385. // width: 120,
  386. // prop: 'packingSpecification',
  387. // align: 'center',
  388. // label: '包装规格',
  389. // showOverflowTooltip: true
  390. // },
  391. {
  392. width: 160,
  393. prop: 'technicalDrawings',
  394. label: '图纸附件',
  395. slot: 'technicalDrawings',
  396. align: 'center'
  397. },
  398. {
  399. width: 140,
  400. prop: 'files',
  401. label: '附件',
  402. slot: 'files',
  403. align: 'center'
  404. },
  405. {
  406. width: 220,
  407. prop: 'remark',
  408. label: '备注',
  409. slot: 'remark',
  410. align: 'center'
  411. }
  412. ]
  413. };
  414. },
  415. created() {
  416. this.requestDict('产地');
  417. this.requestDict('生产类型');
  418. },
  419. methods: {
  420. async open(row) {
  421. this.visible = true;
  422. this.getDetailData(row.requirementId || row.id);
  423. },
  424. cancel() {
  425. this.$nextTick(() => {
  426. // 关闭后,销毁所有的表单数据
  427. (this.form = copyObj(this.formDef)),
  428. (this.otherForm = copyObj(this.otherFormDef)),
  429. (this.tableBankData = []);
  430. this.tableLinkData = [];
  431. this.visible = false;
  432. });
  433. },
  434. downloadFile(file) {
  435. getFile({ objectName: file.storePath }, file.name);
  436. },
  437. handleMethod(row) {
  438. this.$refs.timeDialogRef.open(row);
  439. },
  440. async getDetailData(id) {
  441. this.loading = true;
  442. const data = await getDetail(id);
  443. this.loading = false;
  444. if (data) {
  445. this.form = data;
  446. if (this.form.fileId) {
  447. this.form.fileId = JSON.parse(this.form.fileId);
  448. }
  449. this.detailData = data;
  450. if (data.files && data.files.length > 0) {
  451. this.form.files = data.files[0];
  452. } else {
  453. this.form.files = null;
  454. }
  455. }
  456. }
  457. }
  458. };
  459. </script>
  460. <style scoped lang="scss">
  461. .ele-dialog-form {
  462. .el-form-item {
  463. margin-bottom: 10px;
  464. }
  465. }
  466. .headbox {
  467. display: flex;
  468. justify-content: space-between;
  469. align-items: center;
  470. .amount {
  471. font-size: 14px;
  472. font-weight: bold;
  473. }
  474. }
  475. </style>