新增
This commit is contained in:
		| @@ -0,0 +1,37 @@ | ||||
| <template> | ||||
|   <div class="tableInner"> | ||||
|     <el-input v-model="list[itemProp]" @blur="changeInput" /> | ||||
|   </div> | ||||
| </template> | ||||
| <script> | ||||
| export default { | ||||
|   name: 'InputArea', | ||||
|   props: { | ||||
|     injectData: { | ||||
|       type: Object, | ||||
|       default: () => ({}) | ||||
|     }, | ||||
|     itemProp: { | ||||
|       type: String | ||||
|     } | ||||
|   }, | ||||
|   data() { | ||||
|     return { | ||||
|       list: this.injectData | ||||
|     } | ||||
|   }, | ||||
|   methods: { | ||||
|     changeInput() { | ||||
|       console.log(this.list) | ||||
|       this.$emit('emitData', this.list) | ||||
|     } | ||||
|   } | ||||
| } | ||||
| </script> | ||||
| <style> | ||||
| .tableInner .el-input__inner { | ||||
|   border: none; | ||||
|   padding: 0; | ||||
|   height: 33px; | ||||
| } | ||||
| </style> | ||||
| @@ -1,29 +1,105 @@ | ||||
| <!-- | ||||
|  * @Author: zhp | ||||
|  * @Date: 2024-08-01 16:27:30 | ||||
|  * @LastEditTime: 2024-08-01 16:29:31 | ||||
|  * @LastEditTime: 2024-08-02 15:27:58 | ||||
|  * @LastEditors: zhp | ||||
|  * @Description: | ||||
| --> | ||||
| <template> | ||||
|   <el-form ref="orderAddForm" :rules="rules" label-width="130px" :model="form" label-position='top'> | ||||
|     <el-row :gutter="20"> | ||||
|       <el-col :span='6'> | ||||
|         <el-form-item label="订单名称" prop="name"> | ||||
|           <el-input v-model="form.name"></el-input> | ||||
|         </el-form-item> | ||||
|       </el-col> | ||||
|     </el-row> | ||||
|   <el-form ref="orderAddForm" :rules="rules" :model="form" :inline="true" class="demo-form-inline"> | ||||
|     <!-- <el-row :gutter="20"> --> | ||||
|     <!-- <el-col :span='6'> --> | ||||
|     <el-form-item label="拆分数量" prop="attr3"> | ||||
|       <el-input v-model.number="form.attr3" oninput="value=value.replace(/[^\d]/g,'')"></el-input> | ||||
|     </el-form-item> | ||||
|     <el-form-item> | ||||
|       <el-button type="primary" @click="handleSplit">确定</el-button> | ||||
|     </el-form-item> | ||||
|     <!-- </el-col> --> | ||||
|     <!-- </el-row> --> | ||||
|     <base-table @emitFun="inputChange" :table-props="tableProps" :table-data="list" :max-height="tableH"> | ||||
|       <!-- <method-btn v-if="tableBtn.length" slot="handleBtn" :width="240" label="操作" :method-list="tableBtn" | ||||
|         @clickBtn="handleClick" /> --> | ||||
|     </base-table> | ||||
|   </el-form> | ||||
| </template> | ||||
| <script> | ||||
| import { getOrderCode, getOrderById, getProcessFlowList, orderUpdate, orderCreate } from '@/api/base/orderManage' | ||||
| import { getOrderCode, getOrderById, getProcessFlowList, orderUpdate, orderCreate, orderSplit } from '@/api/base/orderManage' | ||||
| import { getProductAll } from '@/api/base/product' | ||||
| import { getCustomerList } from '@/api/base/customer' | ||||
| import { parseTime } from '@/utils/ruoyi' | ||||
| // import { publicFormatter } from '@/utils/dict' | ||||
| import inputArea from './inputArea.vue' | ||||
| const tableProps = [ | ||||
|   { | ||||
|     prop: 'name', | ||||
|     label: '订单名称', | ||||
|     minWidth: 120, | ||||
|     showOverflowtooltip: true, | ||||
|     subcomponent: inputArea | ||||
|   }, | ||||
|   { | ||||
|     prop: 'code', | ||||
|     label: '订单编码', | ||||
|     minWidth: 180, | ||||
|     subcomponent: inputArea | ||||
|   }, | ||||
|   { | ||||
|     prop: 'productName', | ||||
|     label: '产品', | ||||
|     showOverflowtooltip: true, | ||||
|     subcomponent: inputArea | ||||
|   }, | ||||
|   // { | ||||
|   //   prop: 'priority', | ||||
|   //   label: '优先级', | ||||
|   //   filter: publicFormatter('order_priority') | ||||
|   // }, | ||||
|   { | ||||
|     prop: 'planQuantity', | ||||
|     label: '计划加工量', | ||||
|     width: 100, | ||||
|     subcomponent: inputArea | ||||
|   }, | ||||
|   { | ||||
|     prop: 'deliveTime', | ||||
|     label: '交货日期', | ||||
|     filter: parseTime, | ||||
|     minWidth: 160, | ||||
|     subcomponent: inputArea | ||||
|   }, | ||||
|   { | ||||
|     prop: 'customerId', | ||||
|     label: '客户', | ||||
|     showOverflowtooltip: true, | ||||
|     subcomponent: inputArea | ||||
|   }, | ||||
|   { | ||||
|     prop: 'price', | ||||
|     label: '单价', | ||||
|     width: 100, | ||||
|     subcomponent: inputArea | ||||
|   }, | ||||
|   { | ||||
|     prop: 'packSpec', | ||||
|     label: '包装规格', | ||||
|     width: 100, | ||||
|     subcomponent: inputArea | ||||
|   }, | ||||
|   { | ||||
|     prop: 'remark', | ||||
|     label: '备注', | ||||
|     width: 100, | ||||
|     subcomponent: inputArea | ||||
|   }, | ||||
| ] | ||||
| export default { | ||||
|   name: 'OrderAdd', | ||||
|   data() { | ||||
|     return { | ||||
|       tableProps, | ||||
|       list: [], | ||||
|       tableH: this.tableHeight(260), | ||||
|       form: { | ||||
|         id: '', | ||||
|         name: '', | ||||
| @@ -32,6 +108,7 @@ export default { | ||||
|         planProductId: '', | ||||
|         price: '', | ||||
|         customerId: '', | ||||
|         attr3:undefined, | ||||
|         priority: '', | ||||
|         packSpec: '', | ||||
|         workers: '', | ||||
| @@ -42,10 +119,7 @@ export default { | ||||
|         planStartTime: '', | ||||
|       }, | ||||
|       rules: { | ||||
|         name: [{ required: true, message: "订单名称不能为空", trigger: "blur" }], | ||||
|         code: [{ required: true, message: "订单号不能为空", trigger: "blur" }], | ||||
|         planQuantity: [{ required: true, message: "计划加工数量不能为空", trigger: "blur" }], | ||||
|         planProductId: [{ required: true, message: "产品名称不能为空", trigger: "change" }] | ||||
|         attr3: [{ required: true, message: "拆分数量不能为空", trigger: "blur" }], | ||||
|       }, | ||||
|       productList: [], | ||||
|       customerList: [], | ||||
| @@ -53,12 +127,26 @@ export default { | ||||
|       isEdit: false //是否是编辑 | ||||
|     } | ||||
|   }, | ||||
|   created () { | ||||
|     window.addEventListener('resize', () => { | ||||
|       this.tableH = this.tableHeight(260) | ||||
|     }) | ||||
|   }, | ||||
|   methods: { | ||||
|     init(id) { | ||||
|       this.getList() | ||||
|       if (id) { | ||||
|     handleSplit() { | ||||
|       let obj = { | ||||
|         attr3: this.form.attr3, | ||||
|         id:this.form.id | ||||
|       } | ||||
|       orderSplit(obj).then((res) => { | ||||
|         this.list = res.data | ||||
|       }) | ||||
|     }, | ||||
|     init(obj) { | ||||
|       // this.getList() | ||||
|       if (obj) { | ||||
|         this.isEdit = true | ||||
|         this.form.id = id | ||||
|         this.form.id = obj.id | ||||
|         getOrderById({id: this.form.id}).then(res => { | ||||
|           if (res.code === 0) { | ||||
|             this.form.name = res.data.name | ||||
| @@ -87,73 +175,80 @@ export default { | ||||
|         }) | ||||
|       } | ||||
|     }, | ||||
|     getList() { | ||||
|       // 产品 | ||||
|       getProductAll().then(res => { | ||||
|         this.productList = res.data || [] | ||||
|       }) | ||||
|       // 客户 | ||||
|       getCustomerList().then(res => { | ||||
|         this.customerList = res.data || [] | ||||
|       }) | ||||
|       // 工艺 | ||||
|       getProcessFlowList().then(res => { | ||||
|         this.processFlowList = res.data || [] | ||||
|       }) | ||||
|     }, | ||||
|     timeChange() { | ||||
|       if (this.form.planStartTime && this.form.planFinishTime) { | ||||
|         if (this.form.planStartTime > this.form.planFinishTime) { | ||||
|           this.$modal.msgError('计划开始时间不能大于结束时间') | ||||
|         } | ||||
|       } | ||||
|     }, | ||||
|     // 工艺变更 | ||||
|     materialMethodChange(val) { | ||||
|       if (val === 2 && !this.form.processFlowId) { | ||||
|         this.form.materialMethod = 1 | ||||
|         this.$modal.msgError("请先选择关联工艺"); | ||||
|       } | ||||
|     }, | ||||
|     // 工艺变更 | ||||
|     processFlowIdChange(val) { | ||||
|       console.log(val) | ||||
|       if (!val) { | ||||
|         this.form.materialMethod = 1 | ||||
|       } | ||||
|     }, | ||||
|     // getList() { | ||||
|     //   // 产品 | ||||
|     //   getProductAll().then(res => { | ||||
|     //     this.productList = res.data || [] | ||||
|     //   }) | ||||
|     //   // 客户 | ||||
|     //   getCustomerList().then(res => { | ||||
|     //     this.customerList = res.data || [] | ||||
|     //   }) | ||||
|     //   // 工艺 | ||||
|     //   getProcessFlowList().then(res => { | ||||
|     //     this.processFlowList = res.data || [] | ||||
|     //   }) | ||||
|     // }, | ||||
|     // timeChange() { | ||||
|     //   if (this.form.planStartTime && this.form.planFinishTime) { | ||||
|     //     if (this.form.planStartTime > this.form.planFinishTime) { | ||||
|     //       this.$modal.msgError('计划开始时间不能大于结束时间') | ||||
|     //     } | ||||
|     //   } | ||||
|     // }, | ||||
|     // // 工艺变更 | ||||
|     // materialMethodChange(val) { | ||||
|     //   if (val === 2 && !this.form.processFlowId) { | ||||
|     //     this.form.materialMethod = 1 | ||||
|     //     this.$modal.msgError("请先选择关联工艺"); | ||||
|     //   } | ||||
|     // }, | ||||
|     // // 工艺变更 | ||||
|     // processFlowIdChange(val) { | ||||
|     //   console.log(val) | ||||
|     //   if (!val) { | ||||
|     //     this.form.materialMethod = 1 | ||||
|     //   } | ||||
|     // }, | ||||
|     submitForm() { | ||||
|       this.$refs['orderAddForm'].validate((valid) => { | ||||
|         if (valid) { | ||||
|           if (this.form.planStartTime && this.form.planFinishTime) { | ||||
|             if (this.form.planStartTime > this.form.planFinishTime) { | ||||
|               this.$modal.msgError('计划开始时间不能大于结束时间') | ||||
|               return false | ||||
|             } | ||||
|           } | ||||
|           // console.log(this.form) | ||||
|           if (this.isEdit) { | ||||
|             //编辑 | ||||
|             orderUpdate({ ...this.form }).then((res) => { | ||||
|               if (res.code === 0) { | ||||
|                 this.$modal.msgSuccess("操作成功"); | ||||
|                 this.$emit('successSubmit') | ||||
|               } | ||||
|             }) | ||||
|           } else { | ||||
|             this.form.status = 1 | ||||
|             this.form.triggerOrigin = 1 | ||||
|             orderCreate({ ...this.form }).then((res) => { | ||||
|               if (res.code === 0) { | ||||
|                 this.$modal.msgSuccess("操作成功"); | ||||
|                 this.$emit('successSubmit') | ||||
|               } | ||||
|             }) | ||||
|           } | ||||
|         } else { | ||||
|           return false | ||||
|         } | ||||
|       Promise.all(this.list.forEach((ele) => { | ||||
|         orderCreate(ele) | ||||
|       })).then((res) => { | ||||
|         this.$modal.msgSuccess("操作成功"); | ||||
|         this.$emit('successSubmit') | ||||
|       }) | ||||
|  | ||||
|       // this.$refs['orderAddForm'].validate((valid) => { | ||||
|       //   if (valid) { | ||||
|       //     if (this.form.planStartTime && this.form.planFinishTime) { | ||||
|       //       if (this.form.planStartTime > this.form.planFinishTime) { | ||||
|       //         this.$modal.msgError('计划开始时间不能大于结束时间') | ||||
|       //         return false | ||||
|       //       } | ||||
|       //     } | ||||
|       //     // console.log(this.form) | ||||
|       //     if (this.isEdit) { | ||||
|       //       //编辑 | ||||
|       //       orderUpdate({ ...this.form }).then((res) => { | ||||
|       //         if (res.code === 0) { | ||||
|       //           this.$modal.msgSuccess("操作成功"); | ||||
|       //           this.$emit('successSubmit') | ||||
|       //         } | ||||
|       //       }) | ||||
|       //     } else { | ||||
|       //       this.form.status = 1 | ||||
|       //       this.form.triggerOrigin = 1 | ||||
|       //       orderCreate({ ...this.form }).then((res) => { | ||||
|       //         if (res.code === 0) { | ||||
|       //           this.$modal.msgSuccess("操作成功"); | ||||
|       //           this.$emit('successSubmit') | ||||
|       //         } | ||||
|       //       }) | ||||
|       //     } | ||||
|       //   } else { | ||||
|       //     return false | ||||
|       //   } | ||||
|       // }) | ||||
|     }, | ||||
|     formClear() { | ||||
|       this.$refs.orderAddForm.resetFields() | ||||
|   | ||||
| @@ -1,57 +1,30 @@ | ||||
| <template> | ||||
|   <div class="app-container"> | ||||
|     <!-- 搜索工作栏 --> | ||||
|     <search-bar | ||||
|       :formConfigs="formConfig" | ||||
|       ref="searchBarForm" | ||||
|       @headBtnClick="buttonClick" | ||||
|     /> | ||||
|     <search-bar :formConfigs="formConfig" ref="searchBarForm" @headBtnClick="buttonClick" /> | ||||
|     <!-- 列表 --> | ||||
|     <base-table | ||||
|       :page="queryParams.pageNo" | ||||
|       :limit="queryParams.pageSize" | ||||
|       :table-props="tableProps" | ||||
|       :table-data="list" | ||||
|       :max-height="tableH" | ||||
|     > | ||||
|       <method-btn | ||||
|         v-if="tableBtn.length" | ||||
|         slot="handleBtn" | ||||
|         :width="240" | ||||
|         label="操作" | ||||
|         :method-list="tableBtn" | ||||
|         @clickBtn="handleClick" | ||||
|       /> | ||||
|     <base-table :page="queryParams.pageNo" :limit="queryParams.pageSize" :table-props="tableProps" :table-data="list" | ||||
|       :max-height="tableH"> | ||||
|       <method-btn v-if="tableBtn.length" slot="handleBtn" :width="240" label="操作" :method-list="tableBtn" | ||||
|         @clickBtn="handleClick" /> | ||||
|     </base-table> | ||||
|     <pagination | ||||
|       :page.sync="queryParams.pageNo" | ||||
|       :limit.sync="queryParams.pageSize" | ||||
|       :total="total" | ||||
|       @pagination="getList" | ||||
|     /> | ||||
|     <pagination :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize" :total="total" | ||||
|       @pagination="getList" /> | ||||
|     <!-- 新增&编辑 --> | ||||
|     <base-dialog | ||||
|       :dialogTitle="addOrEditTitle" | ||||
|       :dialogVisible="centervisible" | ||||
|       @cancel="handleCancel" | ||||
|       @confirm="handleConfirm" | ||||
|       :before-close="handleCancel" | ||||
|       width='60%' | ||||
|     > | ||||
|     <base-dialog :dialogTitle="addOrEditTitle" :dialogVisible="centervisible" @cancel="handleCancel" | ||||
|       @confirm="handleConfirm" :before-close="handleCancel" width='60%'> | ||||
|       <order-add ref="orderAdd" @successSubmit="successSubmit" /> | ||||
|     </base-dialog> | ||||
|     <!-- 查看详情 --> | ||||
|     <!-- 新增工单 --> | ||||
|     <base-dialog | ||||
|       :dialogTitle="workIssueTitle" | ||||
|       :dialogVisible="addWorkOrdervisible" | ||||
|       @cancel="addWorkOrderCancel" | ||||
|       @confirm="addWorkOrderConfirm" | ||||
|       :before-close="addWorkOrderCancel" | ||||
|       width='70%' | ||||
|     > | ||||
|     <base-dialog :dialogTitle="workIssueTitle" :dialogVisible="addWorkOrdervisible" @cancel="addWorkOrderCancel" | ||||
|       @confirm="addWorkOrderConfirm" :before-close="addWorkOrderCancel" width='70%'> | ||||
|       <add-work-order ref="addWorkOrder" @addWorkOrderSubmit="addWorkOrderSubmit" /> | ||||
|     </base-dialog> | ||||
|     <base-dialog :dialogTitle="splitTitle" :dialogVisible="splitWorkOrdervisible" @cancel="splitWorkOrderCancel" | ||||
|       @confirm="splitWorkOrderConfirm" :before-close="splitWorkOrderCancel" width='70%'> | ||||
|       <order-split ref="splitWorkOrder" @splitWorkOrderSubmit="splitWorkOrderSubmit" /> | ||||
|     </base-dialog> | ||||
|   </div> | ||||
| </template> | ||||
| <script> | ||||
| @@ -175,6 +148,8 @@ export default { | ||||
|           plain: true | ||||
|         } | ||||
|       ], | ||||
|       splitTitle: '拆分订单', | ||||
|       splitWorkOrdervisible:false, | ||||
|       // 查询参数 | ||||
|       queryParams: { | ||||
|         pageNo: 1, | ||||
| @@ -338,7 +313,7 @@ export default { | ||||
|       orderDetailVisible: false | ||||
|     } | ||||
|   }, | ||||
|   components: { OrderAdd, AddWorkOrder }, | ||||
|   components: { OrderAdd, AddWorkOrder,orderSplit }, | ||||
|   created() { | ||||
|     window.addEventListener('resize', () => { | ||||
|       this.tableH = this.tableHeight(260) | ||||
| @@ -419,6 +394,16 @@ export default { | ||||
|             console.log(res) | ||||
|           }) | ||||
|           break | ||||
|         case 'split': | ||||
|           this.splitTitle = '拆分订单' | ||||
|           this.splitWorkOrdervisible = true | ||||
|           this.$nextTick(() => { | ||||
|             this.$refs.splitWorkOrder.init(val.data) | ||||
|           }) | ||||
|           // orderVoid({ id: val.data.id }).then((res) => { | ||||
|           //   console.log(res) | ||||
|           // }) | ||||
|           break | ||||
|         case 'bind': | ||||
|           this.workIssueTitle = '绑定工单' | ||||
|           this.addWorkOrdervisible = true | ||||
| @@ -468,12 +453,23 @@ export default { | ||||
|       this.$refs.addWorkOrder.formClear() | ||||
|       this.addWorkOrdervisible = false | ||||
|     }, | ||||
|     splitWorkOrderCancel() { | ||||
|       this.$refs.splitWorkOrder.formClear() | ||||
|       this.splitWorkOrdervisible = false | ||||
|     }, | ||||
|     addWorkOrderConfirm() { | ||||
|       this.$refs.addWorkOrder.addWorkOrderSubmit() | ||||
|     }, | ||||
|     addWorkOrderSubmit() { | ||||
|       this.addWorkOrderCancel() | ||||
|       this.getList() | ||||
|     }, | ||||
|     splitWorkOrderConfirm() { | ||||
|       this.$refs.splitWorkOrder.splitWorkOrderSubmit() | ||||
|     }, | ||||
|     splitWorkOrderSubmit() { | ||||
|       this.splitWorkOrderCancel() | ||||
|       this.getList() | ||||
|     } | ||||
|     // bindWorkOrderCancel() { | ||||
|     //   this.$refs.bindWorkOrder.formClear() | ||||
|   | ||||
		Reference in New Issue
	
	Block a user