From 4f5a3aebd78761fb16323fd61c6732a8779307bf Mon Sep 17 00:00:00 2001 From: wanglei Date: Tue, 3 Jun 2025 17:19:07 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8C=85=E6=B4=BB=E6=B4=BE=E5=B7=A5=E5=8D=95?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ruoyi-ui/package.json | 13 +- .../src/views/pay/workOrderBaohuo/index.vue | 1070 ++++++++++++++--- 2 files changed, 890 insertions(+), 193 deletions(-) diff --git a/ruoyi-ui/package.json b/ruoyi-ui/package.json index 45f249b..bb8a553 100644 --- a/ruoyi-ui/package.json +++ b/ruoyi-ui/package.json @@ -38,8 +38,10 @@ "@babel/parser": "7.7.4", "@riophae/vue-treeselect": "0.4.0", "axios": "0.24.0", + "bpmn-js-token-simulation": "0.10.0", "clipboard": "2.0.8", "core-js": "3.25.3", + "decimal.js": "^10.5.0", "echarts": "5.4.0", "element-ui": "2.15.12", "file-saver": "2.0.5", @@ -59,8 +61,7 @@ "vue-router": "3.4.9", "vuedraggable": "2.24.3", "vuex": "3.6.0", - "xml-js": "1.6.11", - "bpmn-js-token-simulation": "0.10.0" + "xml-js": "1.6.11" }, "devDependencies": { "@vue/cli-plugin-babel": "4.4.6", @@ -68,6 +69,9 @@ "@vue/cli-service": "4.4.6", "babel-eslint": "10.1.0", "babel-plugin-dynamic-import-node": "2.3.3", + "bpmn-js": "7.5.0", + "bpmn-js-properties-panel": "0.37.2", + "camunda-bpmn-moddle": "4.4.1", "chalk": "4.1.0", "compression-webpack-plugin": "5.0.2", "connect": "3.6.6", @@ -79,10 +83,7 @@ "sass-loader": "10.1.1", "script-ext-html-webpack-plugin": "2.1.5", "svg-sprite-loader": "5.1.1", - "vue-template-compiler": "2.6.12", - "bpmn-js": "7.5.0", - "bpmn-js-properties-panel": "0.37.2", - "camunda-bpmn-moddle": "4.4.1" + "vue-template-compiler": "2.6.12" }, "engines": { "node": ">=8.9", diff --git a/ruoyi-ui/src/views/pay/workOrderBaohuo/index.vue b/ruoyi-ui/src/views/pay/workOrderBaohuo/index.vue index 74a9d51..95a45e6 100644 --- a/ruoyi-ui/src/views/pay/workOrderBaohuo/index.vue +++ b/ruoyi-ui/src/views/pay/workOrderBaohuo/index.vue @@ -187,93 +187,527 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 添加员工 + + + + + + + + + + + + + + + 删除 + + + + + 新增产品 + + + + + + + + + + +
+ {{pro.minPrice !== null ? pro.minPrice+'元 - '+ pro.maxPrice+ '元' : null}} +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 删除 + +
+
+ + 新增时间段 + + + + + + + + + + + + + + + + + + + + + + + + 删除 + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {{pro.minPrice !== null ? pro.minPrice+'元 - '+ pro.maxPrice+ '元' : null}} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + +
+ + + + + + 搜索 + + + + + + + + + + + + + + + + + + + +
+
+ + + +
+ + + + + + 搜索 + + + + + + + + + + + + + + + + + +
+
+ @@ -281,13 +715,15 @@ import { listWorkOrderBaohuo, getWorkOrderBaohuo, delWorkOrderBaohuo, addWorkOrderBaohuo, updateWorkOrderBaohuo } from "@/api/pay/workOrderBaohuo"; import { listTenant } from "@/api/pay/tenant"; import { listEmployeeInfo } from "@/api/pay/employeeInfo"; +import { listProducts } from "@/api/pay/products"; import { deptTreeSelect } from "@/api/system/user"; import Treeselect from "@riophae/vue-treeselect"; import "@riophae/vue-treeselect/dist/vue-treeselect.css"; +import Decimal from "decimal.js"; export default { name: "WorkOrderBaohuo", - dicts: ['pay_workshop'], + dicts: ['pay_workshop', 'sys_user_sex', 'pay_del_status'], components: { Treeselect }, data() { return { @@ -339,72 +775,77 @@ export default { qualityName: undefined, qualityRemark: undefined, instorageTime: undefined, + instorageDate: null, instorageName: undefined, instorageNum: undefined, managerName: undefined, deleted: undefined, + workDate: null, + empId: null, + exportDate: null, }, - // 选择员工 - employeeList: [], // 表单参数 form: {}, // 表单校验 rules: { - /*deptId: [ - { required: true, message: "部门ID不能为空", trigger: "blur" } - ], - workshop: [ - { required: true, message: "车间不能为空", trigger: "blur" } - ], name: [ - { required: true, message: "包活工单名称不能为空", trigger: "blur" } - ], - content: [ - { required: true, message: "工作内容不能为空", trigger: "blur" } - ], - productNum: [ - { required: true, message: "加工数量不能为空", trigger: "blur" } + { required: true, message: "工单名称不能为空", trigger: "blur" } ], - price: [ - { required: true, message: "产品单价不能为空", trigger: "blur" } - ], - unit: [ - { required: true, message: "单位不能为空", trigger: "blur" } - ], - amount: [ - { required: true, message: "加工总金额不能为空", trigger: "blur" } - ], - beginTime: [ - { required: true, message: "开始时间不能为空", trigger: "blur" } - ], - endTime: [ - { required: true, message: "结束时间不能为空", trigger: "blur" } - ], - qualityName: [ - { required: true, message: "质检人员不能为空", trigger: "blur" } - ], - qualityRemark: [ - { required: true, message: "检验说明不能为空", trigger: "blur" } + deptId: [ + { required: true, message: "部门不能为空", trigger: "change" } ], instorageTime: [ { required: true, message: "入库时间不能为空", trigger: "blur" } - ], - instorageName: [ - { required: true, message: "入库人员不能为空", trigger: "blur" } - ], - instorageNum: [ - { required: true, message: "实际入库数量不能为空", trigger: "blur" } - ], - managerName: [ - { required: true, message: "项目经理不能为空", trigger: "blur" } - ], - deleted: [ - { required: true, message: "删除标志不能为空", trigger: "blur" } - ], - remark: [ - { required: true, message: "备注不能为空", trigger: "blur" } - ]*/ - } + ] + }, + // 选择员工 + employeeList: [], + opena: false, + queform: { + date: null, + deptId: null + }, + baohuogsList: [], + // 员工选择框 + emps: [], + // 产品选择框 + prods: [], + /** 选择员工*/ + emp: { + // 是否显示弹出层 + open: false, + // 列表遮罩层 + loading: true, + // 列表查询参数 + queryParams: { + pageNum: 1, + pageSize: 10, + name: undefined + }, + // 表格数据 + list: [], + // 总条数 + total: 0, + index: 0 + }, + /** 选择产品*/ + product: { + // 是否显示弹出层 + open: false, + // 列表遮罩层 + loading: true, + // 列表查询参数 + queryParams: { + pageNum: 1, + pageSize: 10, + name: undefined + }, + // 表格数据 + list: [], + // 总条数 + total: 0, + index: 0 + }, }; }, created() { @@ -443,7 +884,7 @@ export default { }, /** 查询时员工 */ getlistEmployee() { - listEmployeeInfo({pageSize: 100000}).then(response => { + listEmployeeInfo({ pageSize: 1000000000 }).then(response => { this.employeeList = response.rows }); }, @@ -471,32 +912,53 @@ export default { // 表单重置 reset() { this.form = { - id: undefined, - tenantId: undefined, - archiveId: undefined, - productId: undefined, - deptId: undefined, - workshop: undefined, - name: undefined, - content: undefined, - productNum: undefined, - price: undefined, - unit: undefined, - amount: undefined, - beginTime: undefined, - endTime: undefined, - qualityName: undefined, - qualityRemark: undefined, - instorageTime: undefined, - instorageName: undefined, - instorageNum: undefined, - managerName: undefined, - deleted: undefined, - createBy: undefined, - createTime: undefined, - updateBy: undefined, - updateTime: undefined, - remark: undefined + id: null, + archiveId: null, + name: null, + deptId: null, + deptName: null, + workshop: null, + content: null, + qualityName: null, + qualityRemark: null, + instorageTime: null, + instorageName: null, + instorageNum: null, + managerName: null, + deleted: null, + createBy: null, + createTime: null, + updateBy: null, + updateTime: null, + remark: null, + empId: null, + empList: [{ + empId: null, + deptId: null, + empName: null, + helper: 0 + }], + prodList: [{ + productId: null, + productName: null, + productNum: null, + price: null, + minPrice: null, + maxPrice: null, + amount: null, + unit: null, + productSpecification: null, + process: null, + productMaterial: null, + }], + worktimeList: [{ + date: null, + beginTime: null, + stime: null, + endTime: null, + etime: null, + validHours: null + }] }; this.resetForm("form"); }, @@ -530,35 +992,151 @@ export default { getWorkOrderBaohuo(id).then(response => { this.loading = false; this.form = response.data; + this.form.worktimeList.forEach(item => { + var sh = new Date(item.stime).getHours(); + sh = sh < 10 ? sh : sh; + var sminute = new Date(item.stime).getMinutes(); + sminute = sminute < 10 ? '0' + sminute : sminute; + var xh = new Date(item.etime).getHours(); + xh = xh < 10 ? xh : xh; + var xminute = new Date(item.etime).getMinutes(); + xminute = xminute < 10 ? '0' + xminute : xminute; + this.$set(item,"beginTime",sh+":"+sminute); + this.$set(item,"endTime",xh+":"+xminute); + }) this.open = true; this.title = "修改包活派工单"; }); }, + /** 详情按钮操作 */ + handleDetails(row) { + this.reset(); + const id = row.id || this.ids; + getWorkOrderBaohuo(id).then(response => { + this.form = response.data; + this.form.worktimeList.forEach(item => { + var sh = new Date(item.stime).getHours(); + sh = sh < 10 ? sh : sh; + var sminute = new Date(item.stime).getMinutes(); + sminute = sminute < 10 ? '0' + sminute : sminute; + var xh = new Date(item.etime).getHours(); + xh = xh < 10 ? xh : xh; + var xminute = new Date(item.etime).getMinutes(); + xminute = xminute < 10 ? '0' + xminute : xminute; + this.$set(item,"beginTime",sh+":"+sminute); + this.$set(item,"endTime",xh+":"+xminute); + }) + this.open = true; + this.title = "包活派工单详情"; + }); + }, + validator(rule, value, callback) { + if(value == 0){ + return callback(new Error("加工数量不能为0")); + } + return callback(); + }, + /** 删除产品 */ + removePro(pro) { + var index = this.form.prodList.indexOf(pro) + if (index !== -1) { + this.form.prodList.splice(index, 1) + } + }, + /** 新增产品 */ + addPro() { + this.form.prodList.push({ + productId: null, + productName: null, + productNum: null, + price: null, + minPrice: null, + maxPrice: null, + amount: null, + unit: null, + productSpecification: null, + process: null, + productMaterial: null + }) + }, + /** 删除时间段 */ + removeWork(item) { + var index = this.form.worktimeList.indexOf(item) + if (index !== -1) { + this.form.worktimeList.splice(index, 1) + } + }, + /** 新增时间段 */ + addWork() { + this.form.worktimeList.push({ + date: null, + stime: null, + etime: null, + validHours: null + }) + }, /** 提交按钮 */ submitForm() { - this.$refs["form"].validate(valid => { - if (valid) { - this.buttonLoading = true; - this.form.tenantId = this.gsInfo.active_id; - if (this.form.id != null) { - updateWorkOrderBaohuo(this.form).then(response => { - this.$modal.msgSuccess("修改成功"); - this.open = false; - this.getList(); - }).finally(() => { - this.buttonLoading = false; - }); - } else { - addWorkOrderBaohuo(this.form).then(response => { - this.$modal.msgSuccess("新增成功"); - this.open = false; - this.getList(); - }).finally(() => { - this.buttonLoading = false; - }); + this.form.worktimeList.forEach(item => { + item.stime = item.date + ' ' + item.beginTime + ':00'; + item.etime = item.date + ' ' + item.endTime + ':00'; + }) + var isHour = true + if(this.form.worktimeList.length > 0){ + for(var i=0; i { + console.log(err) + }) + break; } } - }); + } + if(this.form.empList.length > 1){ + for(var i=0; i { + console.log(err) + }) + break; + } + } + } + } + if(isHour){ + this.$refs["form"].validate(valid => { + if (valid) { + this.buttonLoading = true; + this.form.tenantId = this.gsInfo.active_id; + if (this.form.id != null) { + updateWorkOrderBaohuo(this.form).then(response => { + this.$modal.msgSuccess("修改成功"); + this.open = false; + this.getList(); + }).finally(() => { + this.buttonLoading = false; + }); + } else { + addWorkOrderBaohuo(this.form).then(response => { + this.$modal.msgSuccess("新增成功"); + this.open = false; + this.getList(); + }).finally(() => { + this.buttonLoading = false; + }); + } + } + }); + } }, /** 删除按钮操作 */ handleDelete(row) { @@ -577,10 +1155,112 @@ export default { }, /** 导出按钮操作 */ handleExport() { - this.download('pay/workOrderBaohuo/export', { - ...this.queryParams - }, `workOrderBaohuo_${new Date().getTime()}.xlsx`) - } + if(this.queform.date == null) { + this.$message({ + message: '请选择导出月份', + type: 'warning' + }); + } else { + this.queryParams.exportDate = this.queform.date + this.download('pay/workOrderBaohuo/export', { + ...this.queryParams + }, `workOrderBaohuo_${new Date().getTime()}.xlsx`) + } + }, + // 新增员工 + addEmp() { + this.form.empList.push({ + empId: null, + deptId: null, + empName: null, + helper: 0 + }) + }, + removeEmp(emp) { + var index = this.form.empList.indexOf(emp) + if (index !== -1) { + this.form.empList.splice(index, 1) + } + }, + changeProductNum(index) { + if(this.form.prodList[index].price != null && this.form.prodList[index].price != '') { + this.form.prodList[index].amount = JSON.parse(new Decimal(this.form.prodList[index].productNum).mul(new Decimal(this.form.prodList[index].price))); + }else{ + this.form.prodList[index].amount = null + } + }, + inputProductNum(index) { + if(this.form.prodList[index].price != null && this.form.prodList[index].price != '') { + this.form.prodList[index].amount = JSON.parse(new Decimal(this.form.prodList[index].productNum).mul(new Decimal(this.form.prodList[index].price))); + }else{ + this.form.prodList[index].amount = null + } + }, + // 添加包活派工单 选择员工 + changeEmp(val,index){ + console.log(val,index,222); + this.emp.open = true; + this.emp.index = index; + this.emp.queryParams.pageNum = 1; + this.empQuery(); + }, + /** 员工列表查询 */ + empQuery() { + this.emp.loading = true; + this.emp.queryParams.tenantId = this.gsInfo.active_id + listEmployeeInfo(this.emp.queryParams).then(response => { + this.emp.list = response.rows; + this.emp.total = response.total; + this.emp.loading = false; + }); + }, + /** 员工选择弹出框关闭*/ + empCancel() { + this.emp.open = false + }, + // 员工选择 选中数据 + empRowChange(val) { + this.form.empList[this.emp.index].empName = val.name; + this.form.empList[this.emp.index].empId = val.id; + this.form.empList[this.emp.index].deptId = val.deptId + console.log(this.form.empList); + this.emp.open = false; + }, + // 添加包活派工单 选择产品 + changeProduct(val,index){ + console.log(val,index,333); + this.product.open = true; + this.product.index = index; + this.product.queryParams.pageNum = 1; + this.productQuery(); + }, + /** 产品列表查询 */ + productQuery() { + this.product.loading = true; + this.product.queryParams.tenantId = this.gsInfo.active_id + listProducts(this.emp.queryParams).then(response => { + this.product.list = response.rows; + this.product.total = response.total; + this.product.loading = false; + }); + }, + /** 产品选择弹出框关闭*/ + productCancel() { + this.product.open = false + }, + // 产品选择 选中数据 + productRowChange(val) { + this.form.prodList[this.product.index].productName = val.productName; + this.form.prodList[this.product.index].productId = val.id; + this.form.prodList[this.product.index].minPrice = val.minPrice; + this.form.prodList[this.product.index].maxPrice = val.maxPrice; + this.form.prodList[this.product.index].productSpecification = val.model; + this.form.prodList[this.product.index].process = val.process; + this.form.prodList[this.product.index].productMaterial = val.materialName; + this.form.prodList[this.product.index].process = val.process; + console.log(this.form.prodList); + this.product.open = false; + }, } }; @@ -623,4 +1303,20 @@ export default { } } } + +.my-dialog1 { + ::v-deep .el-form-item{ + margin-bottom: 15px!important; + } + + .el-dialog__header { + border-bottom: 1px solid #e5e7eb; + } + .el-dialog__title { + font-size: 15px; + } + .el-dialog__body { + border-bottom: 1px solid #e5e7eb; + } +}