bomDialog.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521
  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. :close-on-click-modal="false"
  8. :append-to-body="true"
  9. width="70%"
  10. @close="cancel"
  11. :maxable="true"
  12. :resizable="true"
  13. title="确认属性类型"
  14. >
  15. <ele-pro-table
  16. ref="table"
  17. :columns="columns"
  18. :datasource="tableList"
  19. class="dict-table"
  20. tool-class="ele-toolbar-actions"
  21. :needPage="false"
  22. >
  23. <template v-slot:componentAttribute="{ row }">
  24. <div>
  25. <el-select
  26. v-model="row.componentAttribute"
  27. filterable
  28. :multiple="true"
  29. :multiple-limit="1"
  30. class="ele-block"
  31. size="mini"
  32. >
  33. <el-option
  34. v-for="item in sxtList"
  35. :key="item.value"
  36. :value="item.value"
  37. :label="item.label"
  38. ></el-option>
  39. </el-select>
  40. </div>
  41. </template>
  42. <template v-slot:demandQuantity="{ row }">
  43. <el-input
  44. v-model="row.demandQuantity"
  45. placeholder="请输入"
  46. :readonly="type == 'detail'"
  47. @input="
  48. (value) =>
  49. (row.demandQuantity = value.replace(
  50. /^(-)*(\d+)\.(\d\d\d\d\d\d).*$/,
  51. '$1$2.$3'
  52. ))
  53. "
  54. ></el-input>
  55. </template>
  56. <template v-slot:purchasingCycle="{ row }">
  57. {{ row.purchasingCycle }}{{ row.purchasingCycleUnit }}
  58. </template>
  59. <template v-slot:purchaseQuantity="{ row }">
  60. <el-input
  61. v-model="row.purchaseQuantity"
  62. placeholder="请输入"
  63. :readonly="type == 'detail'"
  64. @input="
  65. (value) =>
  66. (row.purchaseQuantity = value.replace(
  67. /^(-)*(\d+)\.(\d\d\d\d\d\d).*$/,
  68. '$1$2.$3'
  69. ))
  70. "
  71. ></el-input>
  72. </template>
  73. <template v-slot:deliveryMethod="{ row, $index }">
  74. <el-select
  75. clearable
  76. class="ele-block"
  77. v-model="row.deliveryMethod"
  78. placeholder="请选择"
  79. :disabled="type == 'detail'"
  80. >
  81. <el-option
  82. label="一次性到货"
  83. :value="1"
  84. @click.native="row.timeList = null"
  85. />
  86. <el-option
  87. label="分批到货"
  88. :value="2"
  89. @click.native="
  90. handleMethod(row, $index);
  91. row.requireDeliveryTime = null;
  92. "
  93. />
  94. </el-select>
  95. </template>
  96. <template v-slot:dosage="{ row, $index }">
  97. <el-input
  98. v-model="row.dosage"
  99. placeholder="请输入"
  100. :readonly="type == 'detail'"
  101. type="number"
  102. ></el-input>
  103. </template>
  104. <template v-slot:requireDeliveryTime="{ row, $index }">
  105. <el-date-picker
  106. style="width: 100%"
  107. clearable
  108. v-model="row.requireDeliveryTime"
  109. type="date"
  110. v-show="row.deliveryMethod == 1"
  111. value-format="yyyy-MM-dd"
  112. placeholder="请选择日期"
  113. :pickerOptions="{
  114. disabledDate: (time) =>
  115. time.getTime() <
  116. new Date(new Date().setHours(0, 0, 0, 0)).getTime()
  117. }"
  118. :readonly="type == 'detail'"
  119. >
  120. </el-date-picker>
  121. <el-link
  122. type="primary"
  123. :underline="false"
  124. v-show="row.deliveryMethod == 2"
  125. @click.native="handleMethod(row, $index)"
  126. >
  127. 设置分批时间
  128. </el-link>
  129. </template>
  130. <template v-slot:imgUrl="{ row }">
  131. <fileMain
  132. v-model="row.imgUrl"
  133. module="main"
  134. :showLib="false"
  135. :limit="1"
  136. :disabled="type == 'detail'"
  137. />
  138. </template>
  139. <template v-slot:files="{ row }">
  140. <fileMain
  141. v-model="row.files"
  142. module="main"
  143. :showLib="false"
  144. :limit="1"
  145. :disabled="type == 'detail'"
  146. />
  147. </template>
  148. <template v-slot:action="{ row }" v-if="type != 'detail'">
  149. <el-popconfirm
  150. class="ele-action"
  151. title="确定要删除当前物料吗?"
  152. @confirm="remove2(row)"
  153. >
  154. <template v-slot:reference>
  155. <el-link type="danger" :underline="false" icon="el-icon-delete">
  156. 删除
  157. </el-link>
  158. </template>
  159. </el-popconfirm>
  160. </template>
  161. </ele-pro-table>
  162. <div slot="footer" class="footer">
  163. <el-button type="primary" @click="save" v-click-once>确认</el-button>
  164. <el-button @click="cancel">返回</el-button>
  165. </div>
  166. <timeDialog
  167. @chooseTime="chooseTime"
  168. ref="timeDialogRef"
  169. :isBatch="true"
  170. ></timeDialog>
  171. </ele-modal>
  172. </template>
  173. <script>
  174. import timeDialog from '@/components/timeDialog/index.vue';
  175. const statusOpt = {
  176. '': '全部',
  177. 0: '草稿',
  178. 1: '已发布'
  179. };
  180. const rootCategoryLevelIdList = {
  181. 9: '产品',
  182. 1: '物料',
  183. 4: '生产设备',
  184. 5: '模具',
  185. 6: '备品备件',
  186. 3: '零部件',
  187. 8: '舟皿',
  188. 10: '消耗材料',
  189. 13: '包装材料',
  190. 14: '生产辅助设备',
  191. 15: '仪表计量设备',
  192. 23: '会计科目',
  193. 26: '周转盘',
  194. 28: '废品'
  195. };
  196. export default {
  197. components: { timeDialog },
  198. data() {
  199. return {
  200. tableList: [],
  201. // 表格列配置
  202. columns: [
  203. {
  204. label: '序号',
  205. columnKey: 'index',
  206. type: 'index',
  207. width: 55,
  208. align: 'center',
  209. showOverflowTooltip: true
  210. },
  211. {
  212. prop: 'code',
  213. label: '物品编码',
  214. showOverflowTooltip: true,
  215. width: 120
  216. },
  217. {
  218. prop: 'name',
  219. label: '名称',
  220. width: 150
  221. },
  222. // {
  223. // prop: 'level',
  224. // label: '层级'
  225. // },
  226. {
  227. prop: 'brandNum',
  228. label: '牌号'
  229. },
  230. {
  231. prop: 'modelType',
  232. label: '型号',
  233. align: 'center',
  234. showOverflowTooltip: true
  235. },
  236. {
  237. prop: 'specification',
  238. label: '规格',
  239. align: 'center',
  240. showOverflowTooltip: true
  241. },
  242. {
  243. prop: 'dosage',
  244. label: '用量',
  245. slot: 'dosage',
  246. width: 150
  247. },
  248. {
  249. prop: 'componentAttribute',
  250. label: '属性类型',
  251. slot: 'componentAttribute',
  252. width: 260
  253. },
  254. {
  255. prop: 'materialsCode',
  256. label: '物料代号',
  257. width: 150
  258. },
  259. {
  260. prop: 'versions',
  261. label: '版本',
  262. formatter: (row) => {
  263. return row.versions + '.0';
  264. }
  265. },
  266. {
  267. prop: 'status ',
  268. label: '状态',
  269. formatter: (row) => {
  270. return statusOpt[+row.status];
  271. }
  272. },
  273. {
  274. prop: 'createName',
  275. label: '创建人',
  276. showOverflowTooltip: true
  277. },
  278. // {
  279. // prop: 'createTime',
  280. // label: '创建日期',
  281. // width: 160
  282. // }
  283. // {
  284. // columnKey: 'selection',
  285. // type: 'selection',
  286. // width: 50,
  287. // align: 'center',
  288. // fixed: 'left'
  289. // },
  290. // {
  291. // columnKey: 'index',
  292. // label: '序号',
  293. // type: 'index',
  294. // width: 55,
  295. // align: 'center',
  296. // showOverflowTooltip: true,
  297. // fixed: 'left'
  298. // },
  299. // {
  300. // prop: 'componentAttribute',
  301. // label: '属性类型',
  302. // slot: 'componentAttribute',
  303. // width: 260
  304. // },
  305. // {
  306. // label: '物料名称',
  307. // prop: 'name',
  308. // align: 'center',
  309. // minWidth: 120,
  310. // fixed: 'left'
  311. // },
  312. // {
  313. // label: '物料编码',
  314. // prop: 'code',
  315. // align: 'center',
  316. // minWidth: 120,
  317. // fixed: 'left'
  318. // },
  319. // {
  320. // label: '牌号',
  321. // prop: 'brandNum',
  322. // align: 'center'
  323. // },
  324. // {
  325. // prop: 'specification',
  326. // label: '规格',
  327. // align: 'center',
  328. // showOverflowTooltip: true,
  329. // minWidth: 110
  330. // },
  331. // {
  332. // label: '型号',
  333. // prop: 'modelType',
  334. // align: 'center'
  335. // },
  336. // {
  337. // prop: 'inventoryQuantity',
  338. // label: '库存',
  339. // showOverflowTooltip: true
  340. // },
  341. // {
  342. // prop: 'secureInventory',
  343. // label: '安全库存',
  344. // showOverflowTooltip: true
  345. // },
  346. // {
  347. // prop: 'lockQuantity',
  348. // label: '锁库数量',
  349. // showOverflowTooltip: true
  350. // },
  351. // {
  352. // prop: 'inTransitNum',
  353. // label: '在途数量',
  354. // showOverflowTooltip: true
  355. // },
  356. // {
  357. // prop: 'inTransitOrdersNum',
  358. // label: '在途已关联数量',
  359. // showOverflowTooltip: true
  360. // },
  361. // {
  362. // prop: 'availableQuantity',
  363. // label: '可用数量',
  364. // showOverflowTooltip: true
  365. // },
  366. // {
  367. // prop: 'unit',
  368. // label: '计量单位',
  369. // showOverflowTooltip: true,
  370. // action: 'unit',
  371. // slot: 'unit'
  372. // },
  373. // {
  374. // label: '需求数量',
  375. // slot: 'demandQuantity',
  376. // action: 'demandQuantity',
  377. // align: 'center',
  378. // minWidth: 120
  379. // },
  380. // {
  381. // label: '采购数量',
  382. // slot: 'purchaseQuantity',
  383. // action: 'purchaseQuantity',
  384. // align: 'center',
  385. // minWidth: 120
  386. // },
  387. // {
  388. // label: '采购周期',
  389. // slot: 'purchasingCycle',
  390. // action: 'purchasingCycle',
  391. // align: 'center',
  392. // minWidth: 160
  393. // },
  394. // {
  395. // label: '到货方式',
  396. // slot: 'deliveryMethod',
  397. // action: 'deliveryMethod',
  398. // align: 'center',
  399. // minWidth: 140
  400. // },
  401. // {
  402. // label: '要求到货时间',
  403. // slot: 'requireDeliveryTime',
  404. // action: 'requireDeliveryTime',
  405. // align: 'center',
  406. // minWidth: 180
  407. // },
  408. // {
  409. // label: '图纸',
  410. // slot: 'imgUrl',
  411. // action: ' imgUrl',
  412. // align: 'center',
  413. // minWidth: 140
  414. // },
  415. // {
  416. // label: '附件',
  417. // slot: 'files',
  418. // action: ' files',
  419. // align: 'center',
  420. // minWidth: 140
  421. // },
  422. // {
  423. // columnKey: 'action',
  424. // label: '操作',
  425. // width: 80,
  426. // align: 'center',
  427. // resizable: false,
  428. // slot: 'action',
  429. // showOverflowTooltip: true
  430. // }
  431. ],
  432. visible: false,
  433. loading: false,
  434. sxtList: [
  435. {
  436. label: '自制件',
  437. value: 1
  438. },
  439. {
  440. label: '采购件',
  441. value: 2
  442. },
  443. {
  444. label: '外协件',
  445. value: 3
  446. }
  447. // {
  448. // label: '受托件',
  449. // value: 4
  450. // }
  451. ]
  452. };
  453. },
  454. computed: {},
  455. created() {},
  456. methods: {
  457. open(tableList) {
  458. this.visible = true;
  459. this.tableList = tableList.map((item) => {
  460. if (item.componentAttribute?.length > 1) {
  461. item.componentAttribute = [];
  462. }
  463. return item;
  464. });
  465. },
  466. //设置分批到货时间
  467. handleMethod(row, index) {
  468. row.arrivalBatch = row.timeList;
  469. this.$refs.timeDialogRef.open(row, index);
  470. },
  471. chooseTime({ arrivalBatch, index }) {
  472. this.$set(this.tableList[index], 'timeList', copyObj(arrivalBatch));
  473. },
  474. save() {
  475. const arr = this.tableList.filter(
  476. (item) => !item.componentAttribute.length
  477. );
  478. if (arr.length) {
  479. return this.$message.warning('请选择属性类型');
  480. }
  481. this.$emit('handleSubmit', this.tableList);
  482. this.cancel();
  483. },
  484. cancel() {
  485. this.visible = false;
  486. this.tableList = [];
  487. }
  488. }
  489. };
  490. </script>
  491. <style scoped lang="scss"></style>