mouldDialog.vue 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335
  1. <template>
  2. <ele-modal width="1160px" :visible="visible" v-if="visible" :append-to-body="true" :close-on-click-modal="true"
  3. custom-class="ele-dialog-form" title="选择物料" @update:visible="updateVisible">
  4. <header-title title="基本信息"></header-title>
  5. <el-form ref="form" :model="form" :rules="rules" label-width="120px">
  6. <el-row>
  7. <el-col :span="8">
  8. <el-form-item label="产品名称:" prop="name">
  9. <el-input disabled v-model="form.name" readonly />
  10. </el-form-item>
  11. </el-col>
  12. <el-col :span="8">
  13. <el-form-item label="产品编码:" prop="code">
  14. <el-input disabled v-model="form.code" placeholder="自动带入" />
  15. </el-form-item>
  16. </el-col>
  17. <el-col :span="8">
  18. <el-form-item label="型号:" prop="modelType">
  19. <el-input disabled v-model="form.modelType" placeholder="自动带入" />
  20. </el-form-item>
  21. </el-col>
  22. <el-col :span="8">
  23. <el-form-item label="牌号:" prop="brandNum">
  24. <el-input disabled v-model="form.brandNum" placeholder="自动带入" />
  25. </el-form-item>
  26. </el-col>
  27. <el-col :span="8">
  28. <el-form-item label="规格:" prop="specification">
  29. <el-input disabled v-model="form.specification" placeholder="自动带入" />
  30. </el-form-item>
  31. </el-col>
  32. <el-col :span="8">
  33. <el-form-item label="计量单位:" prop="measuringUnit">
  34. <el-input disabled v-model="form.measuringUnit" placeholder="自动带入" />
  35. </el-form-item>
  36. </el-col>
  37. </el-row>
  38. <header-title title="工序">
  39. </header-title>
  40. <ele-pro-table ref="table" :needPage="false" :columns="columns" :datasource="datasource" row-key="id">
  41. <!-- 表头工具栏 -->
  42. <template v-slot:toolbar>
  43. <el-button size="small" type="primary" icon="el-icon-plus" class="ele-btn-icon"
  44. @click="openEdit">新增</el-button>
  45. </template>
  46. <template v-slot:palletName="{ row, $index }">
  47. <el-input :value="row.palletName" placeholder="请选择"
  48. @click.native="palletSelect(row, $index)"></el-input>
  49. </template>
  50. <template v-slot:palletCode="{ row }">
  51. <el-input :value="row.palletCode" disabled placeholder="自动带入"></el-input>
  52. </template>
  53. <template v-slot:palletModelType="{ row }">
  54. <el-input :value="row.palletModelType" disabled placeholder="自动带入"></el-input>
  55. </template>
  56. <!-- 操作列 -->
  57. <template v-slot:action="{ row, $index }">
  58. <el-popconfirm class="ele-action" title="确定要删除当前工序吗?" @confirm="handleDel(row, $index)">
  59. <template v-slot:reference>
  60. <el-link type="danger" :underline="false" icon="el-icon-delete">
  61. 删除
  62. </el-link>
  63. </template>
  64. </el-popconfirm>
  65. </template>
  66. </ele-pro-table>
  67. </el-form>
  68. <div slot="footer" class="footer">
  69. <el-button type="primary" @click="save">保存</el-button>
  70. <el-button @click="visible = false">返回</el-button>
  71. </div>
  72. <processModal ref="processRefs" @chooseProcess="chooseProcess"></processModal>
  73. <ProductModal ref="productRefs" @changeProduct='determineChoose' />
  74. </ele-modal>
  75. </template>
  76. <script>
  77. import processModal from '@/views/technology/productParam/components/processModal.vue'
  78. import ProductModal from '@/views/technology/productParam/components/ProductModal.vue'
  79. import { categoryTaskPallet } from '@/api/material/list'
  80. export default {
  81. components: {
  82. processModal,
  83. ProductModal
  84. },
  85. props: {
  86. // 弹窗是否打开
  87. visible: Boolean,
  88. // 修改回显的数据
  89. data: Object
  90. },
  91. data() {
  92. const defaultForm = {
  93. id: null,
  94. code: '',
  95. name: '',
  96. modelType: '',
  97. brandNum: '',
  98. specification: '',
  99. measuringUnit: '',
  100. routeList: []
  101. };
  102. return {
  103. defaultForm,
  104. // 表单数据
  105. form: {
  106. ...defaultForm
  107. },
  108. // 表单验证规则
  109. rules: {
  110. categoryName: [
  111. { required: true, message: '请输入产品名称', trigger: 'blur' }
  112. ]
  113. },
  114. // 提交状态
  115. loading: false,
  116. current: null,
  117. columns: [
  118. {
  119. label: '模具名称',
  120. prop: 'palletName',
  121. slot: 'palletName',
  122. minWidth: 110
  123. },
  124. {
  125. label: '模具编码',
  126. prop: 'palletCode',
  127. slot: 'palletCode',
  128. minWidth: 110
  129. },
  130. {
  131. label: '模具型号',
  132. prop: 'palletModelType',
  133. slot: 'palletModelType',
  134. minWidth: 110
  135. },
  136. {
  137. prop: 'code',
  138. label: '工序编码',
  139. // sortable: 'custom',
  140. showOverflowTooltip: true,
  141. align: 'center',
  142. minWidth: 110
  143. },
  144. {
  145. prop: 'name',
  146. label: '工序名称',
  147. showOverflowTooltip: true,
  148. align: 'center',
  149. minWidth: 110
  150. },
  151. {
  152. align: 'center',
  153. prop: 'controlName',
  154. label: '工序控制码',
  155. showOverflowTooltip: true,
  156. minWidth: 110
  157. },
  158. {
  159. prop: 'workCenterName',
  160. label: '所属工作中心',
  161. align: 'center',
  162. showOverflowTooltip: true,
  163. minWidth: 110
  164. },
  165. {
  166. columnKey: 'action',
  167. label: '操作',
  168. width: 160,
  169. align: 'center',
  170. resizable: false,
  171. slot: 'action',
  172. showOverflowTooltip: true
  173. }
  174. ],
  175. removeList: [],
  176. categoryId: null
  177. };
  178. },
  179. computed: {
  180. // 是否开启响应式布局
  181. styleResponsive() {
  182. return this.$store.state.theme.styleResponsive;
  183. }
  184. },
  185. methods: {
  186. /* 表格数据源 */
  187. datasource({ page, limit, where }) {
  188. return [];
  189. },
  190. /* 更新visible */
  191. updateVisible(value) {
  192. this.$emit('update:visible', value);
  193. },
  194. openEdit() {
  195. this.$refs.processRefs.open(this.$refs.table.getData())
  196. },
  197. chooseProcess(data) {
  198. this.$refs.table.setData([...data, ...this.$refs.table.getData()]);
  199. },
  200. handleDel(row, index) {
  201. let _arr = this.$refs.table.getData()
  202. _arr.splice(index, 1)
  203. this.$refs.table.setData(_arr)
  204. if (row?.id) {
  205. this.removeList.push(row.id)
  206. }
  207. },
  208. palletSelect(row, idx) {
  209. let _arr = this.$refs.table.getData()
  210. let param = {
  211. categoryId: _arr[idx].palletId,
  212. categoryName: _arr[idx].palletName,
  213. categoryCode: _arr[idx].palletCode
  214. }
  215. this.$refs.productRefs.open(param, '模具', '5', idx)
  216. },
  217. determineChoose(title, row, idx) {
  218. if (title == '模具') {
  219. let _arr = this.$refs.table.getData()
  220. this.$set(_arr[idx], 'palletId', row.id)
  221. this.$set(_arr[idx], 'palletName', row.name)
  222. this.$set(_arr[idx], 'palletCode', row.code)
  223. this.$set(_arr[idx], 'palletModelType', row.modelType)
  224. this.$nextTick(() => {
  225. this.$refs.table.setData(_arr);
  226. })
  227. }
  228. },
  229. save() {
  230. let _arr = this.$refs.table.getData()
  231. let param = {
  232. categoryId: this.categoryId,
  233. takeList: _arr
  234. }
  235. categoryTaskPallet(param).then((res) => {
  236. console.log(res)
  237. })
  238. },
  239. },
  240. watch: {
  241. async visible(visible) {
  242. if (visible) {
  243. if (this.data) {
  244. this.categoryId = this.data.id
  245. this.$util.assignObject(this.form, {
  246. ...this.data
  247. });
  248. } else {
  249. }
  250. } else {
  251. this.$refs.form.clearValidate();
  252. this.form = { ...this.defaultForm };
  253. }
  254. }
  255. }
  256. };
  257. </script>