detailDialog.vue 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354
  1. <template>
  2. <div>
  3. <headerTitle title="采购信息"></headerTitle>
  4. <el-form
  5. :model="formData"
  6. ref="formRef"
  7. label-width="120px"
  8. class="ele-body"
  9. :rules="rules"
  10. >
  11. <el-row :gutter="32">
  12. <el-col :span="12">
  13. <el-form-item label="配料计划名称" prop="name">
  14. <el-input placeholder="请选择" v-model="formData.name"></el-input>
  15. </el-form-item>
  16. </el-col>
  17. <el-col :span="12">
  18. <el-form-item label="备注" prop="remark">
  19. <el-input placeholder="备注" v-model="formData.remark"></el-input>
  20. </el-form-item>
  21. </el-col>
  22. </el-row>
  23. </el-form>
  24. <el-form :model="formData" ref="tableForm">
  25. <ele-pro-table
  26. ref="table"
  27. :needPage="false"
  28. :columns="columns"
  29. row-key="id"
  30. >
  31. <!-- 展开内容 -->
  32. <template v-slot:expand="{ row }">
  33. <div
  34. style="
  35. width: calc(100% - 95px);
  36. min-height: 60px;
  37. margin-left: 95px;
  38. "
  39. v-if="row.materialList.length > 0"
  40. >
  41. <ele-pro-table
  42. :toolbar="false"
  43. toolsTheme="none"
  44. ref="table2"
  45. :need-page="false"
  46. :datasource="row.materialList"
  47. :columns="columns2"
  48. row-key="id"
  49. >
  50. <template v-slot:sort="{ $index }">
  51. {{ $index }}
  52. </template>
  53. <template v-slot:deliveryMethod="{ row }">
  54. {{ row.deliveryMethod == 1 ? '一次性到货' : '分批到货' }}
  55. </template>
  56. <template v-slot:requireDeliveryTime="{ row }">
  57. <span v-if="row.deliveryMethod == 1">{{
  58. row.requireDeliveryTime
  59. }}</span>
  60. <el-link
  61. type="primary"
  62. :underline="false"
  63. v-if="row.deliveryMethod == 2"
  64. @click.native="handleMethod(row)"
  65. >
  66. 设置分批时间
  67. </el-link>
  68. </template>
  69. <template v-slot:imgUrl="{ row }">
  70. <div v-if="row.imgUrl && row.imgUrl?.length">
  71. <el-link
  72. v-for="link in row.imgUrl"
  73. :key="link.id"
  74. type="primary"
  75. :underline="false"
  76. @click="downloadFile(link)"
  77. >
  78. {{ link.name }}</el-link
  79. >
  80. </div>
  81. </template>
  82. <template v-slot:files="{ row }">
  83. <div v-if="row.files && row.files?.length">
  84. <el-link
  85. v-for="link in row.files"
  86. :key="link.id"
  87. type="primary"
  88. :underline="false"
  89. @click="downloadFile(link)"
  90. >
  91. {{ link.name }}</el-link
  92. >
  93. </div>
  94. </template>
  95. </ele-pro-table>
  96. </div>
  97. </template>
  98. </ele-pro-table>
  99. </el-form>
  100. <timeDialog ref="timeDialogRef"></timeDialog>
  101. </div>
  102. </template>
  103. <script>
  104. import { getById } from '@/api/bpm/components/materialPlan/index';
  105. import { getFile } from '@/api/system/file';
  106. import timeDialog from './timeDialog';
  107. export default {
  108. components: {
  109. timeDialog
  110. },
  111. props: {
  112. businessId: {
  113. default: ''
  114. }
  115. },
  116. mixins: [],
  117. data() {
  118. return {
  119. visible: false,
  120. title: '采购配料计划',
  121. // 表格列配置
  122. columns: [
  123. {
  124. width: 45,
  125. type: 'expand',
  126. columnKey: 'materialList',
  127. align: 'center',
  128. slot: 'expand'
  129. },
  130. {
  131. width: 50,
  132. label: '序号',
  133. type: 'index',
  134. align: 'center',
  135. slot: 'index'
  136. },
  137. {
  138. prop: 'salesOrderCode',
  139. label: '销售订单号',
  140. showOverflowTooltip: true,
  141. align: 'center',
  142. minWidth: 170
  143. },
  144. {
  145. prop: 'customerName',
  146. label: '客户名称',
  147. align: 'center',
  148. showOverflowTooltip: true
  149. },
  150. {
  151. prop: 'serialNo',
  152. label: '客户代号',
  153. align: 'center',
  154. showOverflowTooltip: true
  155. },
  156. {
  157. prop: 'productCode',
  158. label: '产品编码',
  159. align: 'center',
  160. showOverflowTooltip: true,
  161. minWidth: 140
  162. },
  163. {
  164. prop: 'productName',
  165. label: '产品名称',
  166. align: 'center',
  167. minWidth: 120
  168. },
  169. {
  170. prop: 'model',
  171. label: '型号',
  172. align: 'center',
  173. minWidth: 120
  174. },
  175. {
  176. prop: 'brandNo',
  177. label: '牌号',
  178. align: 'center'
  179. },
  180. {
  181. prop: 'deliveryTime',
  182. label: '交付日期',
  183. align: 'center',
  184. showOverflowTooltip: true
  185. },
  186. {
  187. prop: 'contractNum',
  188. label: '订单数量',
  189. align: 'center'
  190. },
  191. {
  192. prop: 'lackNum',
  193. label: '欠交数量',
  194. align: 'center'
  195. }
  196. ],
  197. columns2: [
  198. {
  199. width: 50,
  200. label: '序号',
  201. prop: 'sort',
  202. slot: 'sort',
  203. align: 'center'
  204. },
  205. {
  206. label: '物料名称',
  207. prop: 'name',
  208. align: 'center'
  209. },
  210. {
  211. label: '物料编码',
  212. prop: 'code',
  213. align: 'center'
  214. },
  215. {
  216. label: '牌号',
  217. prop: 'brandNum',
  218. align: 'center'
  219. },
  220. {
  221. label: '型号',
  222. prop: 'modelType',
  223. align: 'center'
  224. },
  225. {
  226. prop: 'inventoryQuantity',
  227. label: '库存',
  228. showOverflowTooltip: true
  229. },
  230. {
  231. prop: 'unit',
  232. label: '计量单位',
  233. showOverflowTooltip: true,
  234. action: 'unit'
  235. },
  236. {
  237. label: '需求数量',
  238. prop: 'demandQuantity',
  239. align: 'center'
  240. },
  241. // {
  242. // label: '采购数量',
  243. // prop: 'purchaseQuantity',
  244. // align: 'center'
  245. // },
  246. {
  247. label: '到货方式',
  248. slot: 'deliveryMethod',
  249. action: 'deliveryMethod',
  250. align: 'center'
  251. },
  252. {
  253. label: '要求到货时间',
  254. slot: 'requireDeliveryTime',
  255. action: 'requireDeliveryTime',
  256. align: 'center'
  257. },
  258. {
  259. label: '供应商',
  260. slot: 'supplierName',
  261. action: 'supplierName',
  262. align: 'center'
  263. },
  264. {
  265. label: '图纸',
  266. slot: 'imgUrl',
  267. action: 'imgUrl',
  268. align: 'center'
  269. },
  270. {
  271. label: '附件',
  272. slot: 'files',
  273. action: ' files',
  274. align: 'center',
  275. minWidth: 140
  276. }
  277. ],
  278. rules: {},
  279. formData: {
  280. name: '',
  281. remark: '',
  282. detailRemoveIds: [],
  283. materialRemoveIds: []
  284. }
  285. };
  286. },
  287. created() {
  288. this.getDetailData(this.businessId);
  289. },
  290. methods: {
  291. downloadFile(file) {
  292. getFile({ objectName: file.storePath }, file.name);
  293. },
  294. async getDetailData(id) {
  295. this.loading = true;
  296. const res = await getById(id);
  297. this.loading = false;
  298. if (res) {
  299. this.$set(this.formData, 'name', res.name);
  300. this.$set(this.formData, 'remark', res.remark);
  301. this.formData['id'] = res.id;
  302. this.$refs.table.setData([...res.salesOrderList]);
  303. this.$nextTick(() => {
  304. this.$refs.table.toggleRowExpansionAll();
  305. this.$forceUpdate();
  306. });
  307. }
  308. },
  309. handleMethod(row) {
  310. this.$refs.timeDialogRef.open(row);
  311. }
  312. }
  313. };
  314. </script>
  315. <style lang="scss" scoped>
  316. :deep(.el-table__expanded-cell) {
  317. padding-bottom: 30px !important;
  318. border-bottom: 12px solid #ccffcc !important;
  319. }
  320. </style>