From 1e653db94c24389cc7615fd4a7ef1d63b00af534 Mon Sep 17 00:00:00 2001 From: cuilei <ray_tsu1@163.com> Date: 星期五, 13 六月 2025 11:39:32 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- src/views/tms/modules/preparationOrder/PreparationOrderModal.vue | 328 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 328 insertions(+), 0 deletions(-) diff --git a/src/views/tms/modules/preparationOrder/PreparationOrderModal.vue b/src/views/tms/modules/preparationOrder/PreparationOrderModal.vue new file mode 100644 index 0000000..95121b5 --- /dev/null +++ b/src/views/tms/modules/preparationOrder/PreparationOrderModal.vue @@ -0,0 +1,328 @@ +<template> + <j-modal + :title="title" + :width="width" + :visible="visible" + :confirmLoading="confirmLoading" + switchFullscreen + @ok="handleOk" + @cancel="handleCancel" + cancelText="鍏抽棴"> + <a-spin :spinning="confirmLoading"> + <a-form-model ref="form" :model="model" :rules="validatorRules"> + <a-row> + <a-col :span="12"> + <a-form-model-item label="鍑嗗鍗曠紪鍙�" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="preparationOrderNum"> + <a-input v-model="model.preparationOrderNum" placeholder="璇疯緭鍏ュ噯澶囧崟缂栧彿" disabled></a-input> + </a-form-model-item> + </a-col> + <a-col :span="12"> + <a-form-model-item label="闆朵欢鍥惧彿" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="partDrawingNo"> + <a-input v-model="model.partDrawingNo" placeholder="璇疯緭鍏ラ浂浠跺浘鍙�" disabled></a-input> + </a-form-model-item> + </a-col> + <a-col :span="12"> + <a-form-model-item label="闆朵欢鍚嶇О" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="partName"> + <a-input v-model="model.partName" placeholder="璇疯緭鍏ラ浂浠跺悕绉�" disabled></a-input> + </a-form-model-item> + </a-col> + <a-col :span="12"> + <a-form-model-item label="闆朵欢鏉愭枡" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="partMaterial"> + <a-input v-model="model.partMaterial" placeholder="璇疯緭鍏ラ浂浠舵潗鏂�" disabled></a-input> + </a-form-model-item> + </a-col> + <a-col :span="12"> + <a-form-model-item label="宸ュ簭锛堝伐姝ュ彿锛�" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="productionProcessesNo"> + <a-input v-model="model.productionProcessesNo" placeholder="璇疯緭鍏ュ伐搴忥紙宸ユ鍙凤級" disabled></a-input> + </a-form-model-item> + </a-col> + <a-col :span="12"> + <a-form-model-item label="鍔犲伐鎵规" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="batchCode"> + <a-input v-model="model.batchCode" placeholder="璇疯緭鍏ュ姞宸ユ壒娆�" disabled></a-input> + </a-form-model-item> + </a-col> + <a-col :span="12"> + <a-form-model-item label="鍔犲伐璁惧" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="equipmentCode"> + <a-input v-model="model.equipmentCode" placeholder="璇疯緭鍏ュ姞宸ヨ澶�" disabled></a-input> + </a-form-model-item> + </a-col> + <a-col :span="12"> + <a-form-model-item label="绋嬪簭鍚�" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="ncName"> + <a-input v-model="model.ncName" placeholder="璇疯緭鍏ョ▼搴忓悕" disabled></a-input> + </a-form-model-item> + </a-col> + <a-col :span="12"> + <a-form-model-item label="鍔犲伐鏁伴噺" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="machiningCount"> + <a-input v-model="model.machiningCount" placeholder="璇疯緭鍏ュ姞宸ユ暟閲�" disabled></a-input> + </a-form-model-item> + </a-col> + <a-col :span="12"> + <a-form-model-item label="澶囨敞" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="remark"> + <a-textarea :disable="disableSubmit" v-model="model.remark" placeholder="璇疯緭鍏ュ娉�" ></a-textarea> + </a-form-model-item> + </a-col> + </a-row> + </a-form-model> + + <a-table + ref="table" + size="middle" + bordered + rowKey="id" + :scroll="{x:true}" + :columns="columns" + :dataSource="dataSource" + :pagination="ipagination" + :loading="loading" + :rowSelection="null"> + + <template v-for="col in columns" :slot="col.dataIndex" slot-scope="text, record, index"> + <div :key="col.dataIndex"> + <a-input-number + v-if="col.dataIndex === 'outboundQuantity'" + :value="text" + @change="(e) => handleChange(e, record.key, col, index)" + :min="1" + /> + </div> + </template> + <span slot="action" v-if="disableSubmit === false" slot-scope="text, record, index"> + <a-popconfirm title="纭畾鍒犻櫎鍚�?" @confirm="() => handleDelete(record, index)"> + <a>鍒犻櫎</a> + </a-popconfirm> + </span> + + </a-table> + </a-spin> + + <template slot="footer"> + <a-button :style="{ marginRight: '8px' }" @click="handleCancel">鍏抽棴</a-button> + <a-button @click="handleOk" v-if="disableSubmit === false" type="primary">纭畾</a-button> + </template> + </j-modal> +</template> + +<script> + + import { httpAction } from '@/api/manage' + import { validateDuplicateValue } from '@/utils/util' + import { getAction } from '../../../../api/manage' + + export default { + name: "PreparationOrderModal", + components: { + }, + data () { + return { + title: "鎿嶄綔", + width: 1200, + visible: false, + model:{ + }, + labelCol: { + xs: { span: 24 }, + sm: { span: 5 }, + }, + wrapperCol: { + xs: { span: 24 }, + sm: { span: 16 }, + }, + loading: false, + dataSource: [], + /* 鍒嗛〉鍙傛暟 */ + ipagination:{ + current: 1, + pageSize: 10, + pageSizeOptions: ['10', '20', '30'], + showTotal: (total, range) => { + return range[0] + "-" + range[1] + " 鍏�" + total + "鏉�" + }, + showQuickJumper: true, + showSizeChanger: true, + total: 0 + }, + // 琛ㄥご + columns: [ + { + title: '#', + dataIndex: '', + key:'rowIndex', + width:60, + align:"center", + customRender:function (t,r,index) { + return parseInt(index)+1; + } + }, + { + title:'宸ュ叿缂栫爜', + align:"left", + dataIndex: 'toolNum' + }, + { + title:'宸ュ叿绫诲瀷', + align:"center", + dataIndex: 'applicationType_dictText' + }, + { + title:'涓枃鍚嶇О', + align:"center", + dataIndex: 'chineseName' + }, + { + title:'鍨嬪彿/鍥惧彿', + align:"left", + dataIndex: 'toolModel' + }, + { + title:'鍒�鍏锋潗鏂�', + align:"center", + dataIndex: 'toolMaterial' + }, + { + title:'闆朵欢鏉愭枡', + align:"center", + dataIndex: 'partMaterial' + }, + { + title:'鍘傚', + align:"center", + dataIndex: 'supplierId' + }, + { + title:'鍑哄簱鏁伴噺', + align:"left", + dataIndex: 'outboundQuantity', + scopedSlots: { customRender: 'outboundQuantity' } + }, + { + title: '鎿嶄綔', + dataIndex: 'action', + align:"center", + fixed:"right", + width:147, + scopedSlots: { customRender: 'action' }, + } + ], + confirmLoading: false, + validatorRules: { + outboundQuantity: [ + { required: true, message: '璇疯緭鍏ュ噯澶囧崟鍑哄簱鏁伴噺!'}, + ], + orderStatus: [ + { required: true, message: '璇疯緭鍏ュ崟瀛愮姸鎬�;1.鏈鏍革紱2.璋冩満鍛樺凡瀹℃牳锛�3.宸茶浆鍑哄簱鐢宠!'}, + ], + outboundTime: [ + { required: true, message: '璇疯緭鍏ュ噯澶囧崟鎻愪氦鏃堕棿;鎻愪氦鑷冲嚭搴撶敵璇峰崟鐨勬椂闂�!'}, + ], + }, + url: { + list: "/tms/preparationOrder/listPreparationOrderDetailByMainId", + add: "/tms/preparationOrder/add", + edit: "/tms/preparationOrder/editTotal", + delete: "/tms/preparationOrder/deletePreparationOrderDetail" + } + + } + }, + created () { + //澶囦唤model鍘熷鍊� + this.modelDefault = JSON.parse(JSON.stringify(this.model)); + }, + methods: { + handleChange(value, key, column, index) { + console.log(value, key, column, index) + const temp = [...this.dataSource] + const target = temp.filter(item => key === item.key)[index]; + if (target) { + target[column.dataIndex] = value + this.dataSource = temp + if(column.dataIndex === 'outboundQuantity'){ + if(target['quantity']<value){ + this.$message.error('鐢宠鍑哄簱鏁伴噺涓嶈兘澶т簬鍙敤搴撳瓨!') + this.isDisabled = true + }else{ + this.isDisabled = false + } + } + this.dataSource = temp + } + }, + add () { + this.edit(this.modelDefault); + }, + edit (record) { + this.model = Object.assign({}, record); + getAction(this.url.list, { preparationOrderId: record.id}).then(res => { + if (res.success) { + this.dataSource = res.result.records || res.result; + if (res.result.total) + { + this.ipagination.total = res.result.total; + } else { + this.ipagination.total = 0; + } + } else { + this.$message.warning(res.message) + } + }) + this.visible = true; + }, + handleDelete(record, index) { + deleteAction(this.url.delete, { id: record.id }).then((res) => { + if (res.success) { + this.dataSource.splice(index, 1); + this.$message.success(res.message) + } else { + this.$message.warning(res.message) + } + }); + }, + close () { + this.$emit('close'); + this.visible = false; + this.$refs.form.clearValidate(); + }, + handleOk () { + const that = this; + // 瑙﹀彂琛ㄥ崟楠岃瘉 + this.$refs.form.validate(valid => { + if (valid) { + that.confirmLoading = true; + let httpurl = ''; + let method = ''; + this.model.preparationOrderDetailList = this.dataSource + if(!this.model.id){ + httpurl+=this.url.add; + method = 'post'; + }else{ + httpurl+=this.url.edit; + method = 'put'; + if (this.title === '瀹℃牳') { + this.model.orderStatus = '2'; + } + } + console.log(this.model) + httpAction(httpurl,this.model,method).then((res)=>{ + if(res.success){ + that.$message.success(res.message); + that.$emit('ok'); + }else{ + that.$message.warning(res.message); + } + }).finally(() => { + that.confirmLoading = false; + that.close(); + }) + }else{ + return false + } + }) + }, + handleCancel () { + this.close() + }, + + + } + } +</script> \ No newline at end of file -- Gitblit v1.9.3