detailDialog.vue 7.4 KB

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