detailDialog.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463
  1. <template>
  2. <div>
  3. <el-form ref="form" :model="form" label-width="120px">
  4. <headerTitle title="基本信息">
  5. <!-- <el-button
  6. size="small"
  7. type="primary"
  8. icon="el-icon-s-grid"
  9. class="ele-btn-icon"
  10. @click="exportTable"
  11. >
  12. 导出
  13. </el-button> -->
  14. </headerTitle>
  15. <el-row>
  16. <el-col :span="12" style="height: 40px">
  17. <el-form-item label="需求单名称:" prop="requirementName">
  18. <el-link
  19. type="primary"
  20. :underline="false"
  21. @click="openDetail(form)"
  22. >
  23. {{ form.requirementName }}
  24. </el-link>
  25. <!-- {{ form.requirementCode }} -->
  26. </el-form-item>
  27. </el-col>
  28. <el-col :span="12" style="height: 46px">
  29. <el-form-item label="计划单名称:" prop="planName">
  30. {{ form.planName }}
  31. <!-- {{ form.requirementCode }} -->
  32. </el-form-item>
  33. </el-col>
  34. <el-col :span="12">
  35. <el-form-item label="负责人:" prop="responsibleName">
  36. {{ form.responsibleName }}
  37. </el-form-item>
  38. </el-col>
  39. <el-col :span="12">
  40. <el-form-item label="需求类型:" prop="sourceTypeName">
  41. {{ form.sourceTypeName }}
  42. </el-form-item>
  43. </el-col>
  44. <el-col :span="12">
  45. <el-form-item label="需求部门:" prop="requireDeptName">
  46. {{ form.requireDeptName }}
  47. </el-form-item>
  48. </el-col>
  49. <el-col :span="12">
  50. <el-form-item label="需求人:" prop="requireUserName">
  51. {{ form.requireUserName }}
  52. </el-form-item>
  53. </el-col>
  54. <el-col :span="12">
  55. <el-form-item prop="remark" label="是否接受拆单:">
  56. {{ form.acceptUnpack === 1 ? '接受' : '不接受' }}
  57. </el-form-item>
  58. </el-col>
  59. <el-col :span="12">
  60. <el-form-item prop="remark" label="是否需要核价:">
  61. {{ form.acceptUnpack === 1 ? '是' : '否' }}
  62. </el-form-item>
  63. </el-col>
  64. <!-- <el-col :span="12">
  65. <el-form-item
  66. label="用途"
  67. prop="requireUserName"
  68. style="margin-bottom: 22px"
  69. >
  70. {{ form.requireUserName }}
  71. </el-form-item>
  72. </el-col> -->
  73. <el-col :span="12">
  74. <el-form-item label="完结日期:" prop="receiveDate">
  75. {{ form.receiveDate }}
  76. </el-form-item>
  77. </el-col>
  78. <el-col :span="12">
  79. <el-form-item prop="remark" label="备注:">
  80. {{ form.remark }}
  81. </el-form-item>
  82. </el-col>
  83. <el-col :span="12">
  84. <el-form-item prop="files" label="附件:">
  85. <fileMain v-model="form.files" type="view"></fileMain>
  86. </el-form-item>
  87. </el-col>
  88. </el-row>
  89. <headerTitle title="计划清单" style="margin-top: 15px"></headerTitle>
  90. <el-tabs v-model="activeName" style="margin-top: 15px" type="border-card">
  91. <el-tab-pane label="物品清单" name="1">
  92. <ele-pro-table
  93. ref="table"
  94. :needPage="false"
  95. :columns="columns"
  96. :toolkit="[]"
  97. :datasource="form.detailList"
  98. row-key="id"
  99. height="500px"
  100. >
  101. <template v-slot:totalCount="scope">
  102. <el-input-number
  103. :controls="false"
  104. :min="1"
  105. style="width: 100%"
  106. v-model="scope.row.totalCount"
  107. ></el-input-number>
  108. </template>
  109. <template v-slot:expectReceiveDate="scope">
  110. <div v-if="scope.row.arrivalWay == 1">
  111. {{ scope.row.expectReceiveDate }}
  112. </div>
  113. <div v-if="scope.row.arrivalWay == 2">
  114. <el-link
  115. type="primary"
  116. :underline="false"
  117. @click.native="handleMethod(scope.row)"
  118. >
  119. 查看分批时间
  120. </el-link>
  121. </div>
  122. </template>
  123. <template v-slot:technicalDrawings="{ row }">
  124. <fileMain v-model="row.technicalDrawings" type="view"></fileMain>
  125. </template>
  126. <template v-slot:files="{ row }">
  127. <fileMain v-model="row.files" type="view"></fileMain>
  128. </template>
  129. </ele-pro-table>
  130. </el-tab-pane>
  131. <el-tab-pane
  132. label="带料清单"
  133. name="2"
  134. v-if="['3', '4', '5', '6', '7'].includes(form.sourceType)"
  135. >
  136. <ele-pro-table
  137. ref="table"
  138. :needPage="false"
  139. :columns="columns"
  140. :toolkit="[]"
  141. :datasource="form.rawDetailList"
  142. row-key="id"
  143. >
  144. <template v-slot:totalCount="scope">
  145. <el-input-number
  146. :controls="false"
  147. :min="1"
  148. style="width: 100%"
  149. v-model="scope.row.totalCount"
  150. ></el-input-number>
  151. </template>
  152. </ele-pro-table>
  153. </el-tab-pane>
  154. <el-tab-pane
  155. label="产出品清单"
  156. name="3"
  157. v-if="['3', '4', '5', '6', '7'].includes(form.sourceType)"
  158. >
  159. <ele-pro-table
  160. ref="table"
  161. :needPage="false"
  162. :columns="columns"
  163. :toolkit="[]"
  164. :datasource="form.outputDetailList"
  165. row-key="id"
  166. >
  167. <template v-slot:totalCount="scope">
  168. <el-input-number
  169. :controls="false"
  170. :min="1"
  171. style="width: 100%"
  172. v-model="scope.row.totalCount"
  173. ></el-input-number>
  174. </template>
  175. </ele-pro-table>
  176. </el-tab-pane>
  177. </el-tabs>
  178. </el-form>
  179. <timeDialog ref="timeDialogRef" :view="true"></timeDialog>
  180. </div>
  181. </template>
  182. <script>
  183. import { getplanDetail } from '@/api/bpm/components/purchasingManage/purchasePlanManage';
  184. import { getFile } from '@/api/system/file';
  185. import dictMixins from '@/mixins/dictMixins';
  186. import { getInventoryTotalAPI } from '@/api/bpm/components/wms';
  187. // import fileMain from '@/components/addDoc/index.vue';
  188. import timeDialog from '@/components/timeDialog/index.vue';
  189. export default {
  190. mixins: [dictMixins],
  191. components: {
  192. // fileMain,
  193. timeDialog },
  194. props: {
  195. taskDefinitionKey: {
  196. type: String,
  197. default: 'starter'
  198. },
  199. businessId: {
  200. default: ''
  201. }
  202. },
  203. data() {
  204. return {
  205. activeName: '1',
  206. visible: false,
  207. detailId: '',
  208. title: '详情',
  209. row: {},
  210. form: {
  211. files: []
  212. },
  213. columns: [
  214. {
  215. width: 45,
  216. type: 'index',
  217. columnKey: 'index',
  218. align: 'center',
  219. fixed: 'left'
  220. },
  221. {
  222. width: 150,
  223. prop: 'productCategoryName',
  224. label: '分类',
  225. align: 'center',
  226. slot: 'productCategoryName'
  227. },
  228. {
  229. width: 140,
  230. prop: 'productCode',
  231. label: '编码',
  232. align: 'center',
  233. slot: 'productCode'
  234. },
  235. {
  236. width: 240,
  237. prop: 'productName',
  238. label: '名称',
  239. align: 'center',
  240. slot: 'productName'
  241. },
  242. {
  243. width: 110,
  244. prop: 'batchNo',
  245. label: '批次号',
  246. slot: 'batchNo',
  247. align: 'center'
  248. },
  249. {
  250. prop: 'provenance',
  251. label: '产地',
  252. slot: 'provenance',
  253. align: 'center',
  254. minWidth: 200,
  255. showOverflowTooltip: true,
  256. formatter: (row, column) => {
  257. return row.provenance && row.provenance.length
  258. ? row.provenance
  259. .map((item) => this.getDictValue('产地', item))
  260. .join(',')
  261. : '';
  262. }
  263. },
  264. {
  265. width: 150,
  266. prop: 'taskName',
  267. label: '工序',
  268. slot: 'taskName',
  269. align: 'center'
  270. },
  271. {
  272. width: 150,
  273. prop: 'productBrand',
  274. label: '牌号',
  275. align: 'center',
  276. slot: 'productBrand'
  277. },
  278. {
  279. width: 100,
  280. prop: 'totalCount',
  281. label: '数量',
  282. align: 'center',
  283. slot: 'totalCount'
  284. },
  285. {
  286. width: 80,
  287. prop: 'availableCountBase',
  288. label: '库存数量',
  289. align: 'center',
  290. slot: 'availableCountBase'
  291. },
  292. {
  293. width: 120,
  294. prop: 'totalWeight',
  295. label: '重量',
  296. slot: 'totalWeight',
  297. align: 'center'
  298. },
  299. {
  300. width: 100,
  301. prop: 'measuringUnit',
  302. label: '单位',
  303. align: 'center',
  304. slot: 'measuringUnit'
  305. },
  306. {
  307. width: 130,
  308. prop: 'modelType',
  309. label: '型号',
  310. align: 'center',
  311. slot: 'modelType'
  312. },
  313. {
  314. width: 120,
  315. prop: 'specification',
  316. label: '规格',
  317. align: 'center',
  318. slot: 'specification'
  319. },
  320. {
  321. width: 150,
  322. prop: 'arrivalWay',
  323. label: '到货方式',
  324. formatter: (row, column, cellValue) => {
  325. return cellValue == 1 ? '一次性到货' : '分批到货';
  326. },
  327. align: 'center'
  328. },
  329. {
  330. width: 170,
  331. prop: 'receiveDate',
  332. label: '到货日期',
  333. slot: 'expectReceiveDate',
  334. align: 'center'
  335. },
  336. {
  337. width: 130,
  338. prop: 'supplierName',
  339. label: '供应商',
  340. slot: 'supplierName',
  341. headerSlot: 'headerSupplierName',
  342. align: 'center'
  343. },
  344. {
  345. width: 120,
  346. prop: 'packingSpecification',
  347. align: 'center',
  348. label: '包装规格',
  349. showOverflowTooltip: true
  350. },
  351. {
  352. width: 160,
  353. prop: 'technicalDrawings',
  354. label: '图纸附件',
  355. slot: 'technicalDrawings',
  356. align: 'center'
  357. },
  358. {
  359. width: 140,
  360. prop: 'files',
  361. label: '附件',
  362. slot: 'files',
  363. align: 'center'
  364. },
  365. {
  366. minWidth: 220,
  367. prop: 'remark',
  368. label: '备注',
  369. align: 'center',
  370. slot: 'remark'
  371. }
  372. ]
  373. };
  374. },
  375. created() {
  376. this.requestDict('产地');
  377. this.getPlanData(this.businessId);
  378. },
  379. methods: {
  380. downloadFile(file) {
  381. getFile({ objectName: file.storePath }, file.name);
  382. },
  383. async getPlanData(id) {
  384. this.loading = true;
  385. const data = await getplanDetail(id);
  386. this.loading = false;
  387. if (data) {
  388. let codeList = data.detailList.map((item) => item.productCode);
  389. let inventoryTotalList = await getInventoryTotalAPI(codeList);
  390. data.detailList.forEach((item) => {
  391. let find =
  392. inventoryTotalList.find((key) => key.code == item.productCode) ||
  393. {};
  394. item.availableCountBase = find.availableCountBase;
  395. });
  396. this.form = data;
  397. // if (data.files && data.files.length > 0) {
  398. // this.form.files = data.files[0];
  399. // } else {
  400. // this.form.files = null;
  401. // }
  402. }
  403. },
  404. handleMethod(row) {
  405. this.$refs.timeDialogRef.open(row);
  406. },
  407. //查看详情
  408. openDetail(row) {
  409. this.$refs.contactDetailDialogRef.open(row);
  410. },
  411. async getTableValue() {
  412. try {
  413. if (this.form.detailList.some((item) => !!item.totalCount == '')) {
  414. this.$message.warning('数量不能为空');
  415. return '';
  416. }
  417. // 表单验证通过,执行保存操作
  418. this.loading = true;
  419. this.form.detailList = [
  420. ...this.form.detailList,
  421. ...this.form.rawDetailList,
  422. ...this.form.outputDetailList
  423. ];
  424. return Object.assign({}, this.form);
  425. } catch (error) {
  426. console.log(error);
  427. // 表单验证未通过,不执行保存操作
  428. }
  429. }
  430. }
  431. };
  432. </script>
  433. <style scoped lang="scss">
  434. .ele-dialog-form {
  435. .el-form-item {
  436. margin-bottom: 10px;
  437. }
  438. }
  439. .headbox {
  440. display: flex;
  441. justify-content: space-between;
  442. align-items: center;
  443. .amount {
  444. font-size: 14px;
  445. font-weight: bold;
  446. }
  447. }
  448. </style>