Merge pull request '生产管理bug修改' (#411) from projects/mes-zjl into projects/mes-test

Reviewed-on: #411
This commit is contained in:
朱菊兰 2024-12-27 15:05:29 +08:00
commit 466c822b0f
13 changed files with 603 additions and 343 deletions

View File

@ -161,3 +161,12 @@ export function createConCoreWOr(data) {
data: data
})
}
// 更新分配产量
export function updateBatch(data) {
return request({
url: '/base/core-order-con-work-order/updateBatch',
method: 'put',
data: data
})
}

View File

@ -1,8 +1,16 @@
import request from '@/utils/request'
// 获得产品列表
// 获得物料列表(包括产品)
export function getProductAll() {
return request({
url: '/base/core-product-material/listAll',
method: 'get'
})
}
// 获得产品列表
export function getProductList() {
return request({
url: '/base/core-product-material/listAllProduct',
method: 'get'
})
}

View File

@ -8,7 +8,7 @@
<el-row :gutter="20">
<el-col :span="6">
<el-form-item label="工单模式">
<el-radio-group v-model="isBind">
<el-radio-group v-model="isBind" @input='toggleWay'>
<el-radio :label="true">绑定工单</el-radio>
<el-radio :label="false">新增工单</el-radio>
</el-radio-group>
@ -48,16 +48,19 @@
<el-option
v-for="item in productList"
:key="item.id"
:label="item.name + ' | ' + item.specifications"
:value="item.id">
<span style="float: left">{{ item.name }}</span>
<span style="float: right; color: #8492a6; font-size: 13px">
{{ item.specifications }}
</span>
</el-option>
:label="item.name"
:value="item.id"/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="产品规格" prop="specifications">
<el-input
v-model="form.specifications"
placeholder="请输入产品规格"
disabled />
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="计划开始时间">
<el-date-picker
@ -100,33 +103,6 @@
style="width: 100%"></el-input-number>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="关联工艺" prop="processFlowId">
<el-select
v-model="form.processFlowId"
placeholder="请选择"
disabled
style="width: 100%">
<el-option
v-for="item in processFlowList"
:key="item.id"
:label="item.name"
:value="item.id"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="物料计算方式" prop="materialMethod">
<el-select
v-model="form.materialMethod"
placeholder="请选择"
style="width: 100%"
disabled>
<el-option label="产品基础BOM" :value="1"></el-option>
<el-option label="工艺扩展BOM" :value="2"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="优先级" prop="priority">
<el-select
@ -158,15 +134,14 @@
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="关联产线" prop="productLineId">
<el-form-item label="负责部门" prop="deptId">
<el-select
v-model="form.productLineId"
placeholder="请选择"
multiple
v-model="form.deptId"
placeholder="请选择关联产线"
style="width: 100%"
:disabled="isBind">
<el-option
v-for="item in productLineList"
v-for="item in deptList"
:key="item.id"
:label="item.name"
:value="item.id"></el-option>
@ -178,37 +153,123 @@
<el-input v-model="form.workers" :disabled="isBind"></el-input>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="负责部门" prop="deptId">
</el-row>
<el-row :gutter="20">
<el-col :span="24">
<span class="add-type">物料计算方式</span>
<el-radio-group
v-model="form.materialMethod"
:disabled="isBind"
@change="materialMethodChange">
<el-radio :label="1">产品基础BOM</el-radio>
<el-radio :label="2">工艺扩展BOM</el-radio>
</el-radio-group>
</el-col>
</el-row>
<div v-if="form.materialMethod === 1">
<el-row :gutter="20">
<el-col :span="24">
<span style="margin: 8px 0;" class="add-type">关联产线</span>
<el-button style="margin-left: 20px" type="text" @click="addBind" :disabled="isBind">
新增
</el-button>
</el-col>
</el-row>
<el-row
:gutter="20"
v-for="(item, index) in form.productLineIds"
:key="index + 'line'"
style="margin-bottom: 8px">
<el-col :span="8">
<el-select
v-model="form.deptId"
placeholder="请选择关联产线"
v-model="item.lineId"
placeholder="请选择产线"
:disabled="isBind"
style="width: 100%">
<el-option
v-for="item in deptList"
v-for="item in productLineList"
:key="item.id"
:label="item.name"
:value="item.id"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="计划分配订单量" prop="planAssignmentQuantity">
</el-col>
<el-col :span="8">
<el-tooltip effect="dark" content="该产线分配生产数量" placement="top-end">
<el-input-number
v-model="form.planAssignmentQuantity"
style="width: 100%"
v-model="item.num"
placeholder="请输入数量"
:step="1"
:min="0"
:max="9999999999999"
style="width: 100%"></el-input-number>
</el-form-item>
</el-col>
</el-row>
:disabled="isBind"
step-strictly />
</el-tooltip>
</el-col>
</el-row>
</div>
<div v-else>
<el-row :gutter="20">
<el-col :span="24">
<span style="margin: 8px 0; display: inline-block">
关联产线及工艺
</span>
<el-button style="margin-left: 20px" type="text" @click="addBind" :disabled="isBind">
新增
</el-button>
</el-col>
</el-row>
<el-row
:gutter="20"
v-for="(item, index) in form.productLineIds"
:key="index + 'process'"
style="margin-bottom: 8px">
<el-col :span="8">
<el-select
v-model="item.lineId"
placeholder="请选择产线"
style="width: 100%"
:disabled="isBind"
@change="processLineIdChange">
<el-option
v-for="item in productLineList"
:key="item.id"
:label="item.name"
:value="item.id"></el-option>
</el-select>
</el-col>
<el-col :span="8">
<el-select
v-model="item.processId"
placeholder="请选择工艺"
filterable
:disabled="isBind"
style="width: 100%">
<el-option
v-for="item in processFlowList"
:key="item.id"
:label="item.name"
:value="item.id"></el-option>
</el-select>
</el-col>
<el-col :span="8">
<el-tooltip effect="dark" content="该产线分配生产数量" placement="top-end">
<el-input-number
style="width: 100%"
v-model="item.num"
:step="1"
:min="0"
:disabled="isBind"
step-strictly />
</el-tooltip>
</el-col>
</el-row>
</div>
</el-form>
</template>
<script>
import { getProductAll } from '@/api/base/product';
import { getProductList } from '@/api/base/product';
import {
getProcessFlowList,
getWorkOrderCode,
getProcessFlowPage,
orderIssue,
workOrderList,
getWorkOrderById,
@ -216,13 +277,13 @@ import {
import { getLineAll } from '@/api/base/productionLine';
import { listDept } from '@/api/system/dept';
import moment from 'moment';
import { getCode } from '@/api/base/coreWorkOrder';
export default {
name: 'AddWorkOrder',
data() {
return {
form: {
workOrderId: '',
orderId: '',
name: '',
code: '',
planProductId: '',
@ -231,10 +292,9 @@ export default {
planAssignQuantity: 0,
deptId: undefined,
planQuantity: 0,
processFlowId: '',
materialMethod: 1,
priority: '',
productLineId: [],
productLineIds: [{ lineId: null, processId: null, num: null }],
type: '',
workers: '',
planAssignmentQuantity: '',
@ -253,9 +313,6 @@ export default {
planQuantity: [
{ required: true, message: '计划生产数量不能为空', trigger: 'blur' },
],
productLineId: [
{ required: true, message: '产线不能为空', trigger: 'change' },
],
planAssignmentQuantity: [
{
required: true,
@ -271,58 +328,73 @@ export default {
processFlowList: [],
productLineList: [],
workOrderTypeList: [
{ id: 1, name: '标准工单' },
{ id: 2, name: '特殊工单' },
{ id: 1, name: '普通' },
{ id: 2, name: '特殊' },
],
planStartTime: '',
planFinishTime: '',
isBind: false,
isBind: true,
workOrderList: [],
orderData: {},
};
},
methods: {
//
materialMethodChange(val) {
console.log(val);
this.processFlowList = [];
this.form.productLineIds = [];
const obj = { lineId: null, processId: null, num: null };
this.form.productLineIds.push(obj);
},
// 线
processLineIdChange(val) {
const params = {
pageNo: 1,
pageSize: 100,
lineId: val,
};
//
getProcessFlowPage(params).then((res) => {
this.processFlowList = res.data.list || [];
console.log(this.processFlowList);
});
},
init(data, param) {
this.isBind = true;
this.orderData = data;
this.form.orderId = data.id;
this.getList();
},
changeAdd() {
if (this.isBind) {
this.isBind = false;
getWorkOrderCode().then((res) => {
this.form.code = res.data || '';
});
this.form.orderId = null;
this.form.planProductId = this.orderData.planProductId;
this.form.processFlowId = this.orderData.processFlowId;
this.form.materialMethod = this.orderData.materialMethod;
} else {
this.isBind = true;
this.form.orderId = this.orderData.id;
this.form.planProductId = null;
this.form.processFlowId = null;
this.form.materialMethod = null;
this.form.code = null;
toggleWay(val) {
console.log(val);
this.formClear()
if (!val) {
//
getCode().then((res) => {
this.form.code = res.data;
this.form.planProductId = this.orderData.planProductId;
this.form.name = '';
this.selectProduct(this.form.planProductId)
})
}else{
this.form.code = '';
this.form.planProductId = '';
}
this.form.materialMethod = 1;
this.form.productLineIds = [];
},
getList() {
listDept().then((res) => {
this.deptList = res.data || [];
});
//
getProductAll().then((res) => {
getProductList().then((res) => {
this.productList = res.data || [];
});
// 线
getLineAll().then((res) => {
this.productLineList = res.data || [];
});
//
getProcessFlowList().then((res) => {
this.processFlowList = res.data || [];
});
// list
workOrderList({
status: 1,
@ -330,6 +402,18 @@ export default {
this.workOrderList = res.data || [];
});
},
//
selectProduct(val) {
if (val) {
this.productList.map((item) => {
if (val === item.id) {
this.form.specifications = item.specifications;
}
});
} else {
this.form.specifications = '';
}
},
addWorkOrderSubmit() {
this.$refs['addWorkOrder'].validate((valid) => {
if (valid) {
@ -337,8 +421,7 @@ export default {
//
orderIssue({
workOrderId: this.form.workOrderId,
orderId: this.form.orderId,
planAssignmentQuantity: this.form.planAssignmentQuantity,
orderId: this.orderData.id,
}).then((res) => {
if (res.code === 0) {
this.$modal.msgSuccess('操作成功');
@ -347,24 +430,19 @@ export default {
});
} else {
//
let _this = this;
_this.form.planStartTime = _this.planStartTime
? new Date(_this.planStartTime).valueOf()
this.form.planStartTime = this.planStartTime
? new Date(this.planStartTime).valueOf()
: '';
_this.form.planFinishTime = _this.planFinishTime
? new Date(_this.planFinishTime).valueOf()
this.form.planFinishTime = this.planFinishTime
? new Date(this.planFinishTime).valueOf()
: '';
orderIssue({ ..._this.form }).then((res) => {
orderIssue({
...this.form,
orderId: this.orderData.id,
}).then((res) => {
if (res.code === 0) {
_this.$modal.msgSuccess('操作成功');
let name = this.form.name;
_this.$emit('addWorkOrderSubmit');
// 使
// _this.$modal.confirm('使?').then(function() {
// _this.$router.push({
// path: '/core/core-work-order?workOrderName='+encodeURI(name)
// })
// })
this.$modal.msgSuccess('操作成功');
this.$emit('addWorkOrderSubmit');
}
});
}
@ -382,39 +460,52 @@ export default {
this.planStartTime = '';
this.form.planFinishTime = '';
this.form.planStartTime = '';
this.isBind = false;
},
//
getWorkOrderMsg() {
if (this.form.workOrderId) {
getWorkOrderById({ id: this.form.workOrderId }).then((res) => {
if (res.code === 0) {
this.form.code = res.data.code;
this.form.planProductId = res.data.planProductId;
this.form = res.data;
this.form.workOrderId = res.data.id;
this.planStartTime = res.data.planStartTime
? moment
.unix(res.data.planStartTime)
? moment(res.data.planStartTime)
.format('YYYY-MM-DD HH:mm:ss')
: null;
this.planFinishTime = res.data.planFinishTime
? moment
.unix(res.data.planFinishTime)
? moment(res.data.planFinishTime)
.format('YYYY-MM-DD HH:mm:ss')
: null;
this.form.planAssignQuantity = res.data.planAssignQuantity;
this.form.planQuantity = res.data.planQuantity;
this.form.processFlowId = res.data.processFlowId;
this.form.materialMethod = res.data.materialMethod;
this.form.priority = res.data.priority
? res.data.priority + ''
: '';
this.form.productLineId = res.data.productLineIds;
this.form.type = res.data.type;
this.form.workers = res.data.workers;
// 线
if (this.form.materialMethod === 2) {
this.form.productLineIds.forEach((item) => {
if (item.lineId) {
this.processLineIdChange(item.lineId);
}
})
}
}
});
}
},
addBind() {
const obj = { lineId: null, processId: null, num: null };
this.form.productLineIds.push(obj);
},
},
};
</script>
<style scoped>
.add-type {
margin: 0 20px 15px 0;
display: inline-block;
}
.add-type::before {
content: '*';
color: #ff4949;
margin-right: 4px;
}
</style>

View File

@ -19,6 +19,12 @@
</el-col>
<el-col :span='6'>
<el-form-item label="产品名称" prop="planProductId">
<el-select @change="getSpec" v-model="form.planProductId" placeholder="请选择" style="width: 100%;" filterable>
<el-option v-for="item in productList" :key="item.id" :label="item.name"
:value="item.id"/>
</el-select>
</el-form-item>
<!-- <el-form-item label="产品名称" prop="planProductId">
<el-select @change="getSpec" v-model="form.planProductId" placeholder="请选择" style="width: 100%;" filterable>
<el-option v-for="item in productList" :key="item.id" :label="item.name+' | '+(item.specifications || '')"
:value="item.id">
@ -26,7 +32,7 @@
<span style="float: right; color: #8492a6; font-size: 13px">{{ item.specifications }}</span>
</el-option>
</el-select>
</el-form-item>
</el-form-item> -->
</el-col>
</el-row>
<el-row :gutter="20">
@ -79,7 +85,7 @@
</template>
<script>
import { getOrderCode, getOrderById, getProcessFlowList, orderUpdate, orderCreate } from '@/api/base/orderManage'
import { getProductAll } from '@/api/base/product'
import { getProductList } from '@/api/base/product'
import { getCustomerList } from '@/api/base/customer'
export default {
name: 'OrderAdd',
@ -160,7 +166,7 @@ export default {
},
getList() {
//
getProductAll().then(res => {
getProductList().then(res => {
this.productList = res.data || []
})
//

View File

@ -69,7 +69,7 @@ const tableProps = [
showOverflowtooltip: true,
},
{
prop: 'specifications',
prop: 'productSpec',
label: '产品规格',
showOverflowtooltip: true,
},

View File

@ -117,14 +117,14 @@
<el-button
type="text"
:disabled="
!(scope.row.status === 1 && scope.row.triggerOrigin === 1)
!(scope.row.status === 1)
"
@click="handleClick({ data: scope.row, type: 'edit' })"
v-hasPermi="['base:order-manage:edit']">
<span
class="iconfont icon-edit"
:class="
!(scope.row.status === 1 && scope.row.triggerOrigin === 1)
!(scope.row.status === 1)
? ''
: 'primary-color'
" />
@ -193,7 +193,6 @@
import { parseTime } from '@/utils/ruoyi';
import {
getOrderPage,
orderDelete,
orderAssignmentList,
orderFinish,
orderVoid,
@ -380,7 +379,6 @@ export default {
}
},
handleClick(val) {
console.log(val);
switch (val.type) {
case 'edit':
this.addOrEditTitle = '编辑';
@ -389,21 +387,11 @@ export default {
this.$refs.orderAdd.init(val.data.id);
});
break;
case 'delete':
this.handleDelete(val.data);
break;
case 'detail':
this.$router.push({
path: 'order-detail-data?orderId=' + val.data.id,
});
break;
case 'add':
this.workIssueTitle = '新增工单';
this.addWorkOrdervisible = true;
this.$nextTick(() => {
this.$refs.addWorkOrder.init(val.data, 'add');
});
break;
case 'void':
orderVoid({ id: val.data.id }).then((res) => {
console.log(res);
@ -437,19 +425,6 @@ export default {
default:
}
},
//
handleDelete(val) {
this.$modal
.confirm('是否确认删除"' + val.name + '"的数据项?')
.then(function () {
return orderDelete({ id: val.id });
})
.then(() => {
this.getList();
this.$modal.msgSuccess('操作成功');
})
.catch(() => {});
},
//
handleComplete(val) {
this.$modal

View File

@ -81,7 +81,7 @@ export default {
this.chartList[i].workOrder.map(item => {
colorList.push(item.color)
})
let percentage = (this.chartList[i].sunNum/this.chartList[i].num*100).toFixed(0)
let percentage = (this.chartList[i].sunNum/this.chartList[i].num*100).toFixed(2)
var option = {
color: colorList,
series: [

View File

@ -249,14 +249,14 @@ export default {
let sunNum = 0
for (let i = 0; i < tempArr[key].length; i++) {
let subObj = {}
subObj.value = tempArr[key][i].actualAssignmentQuantity
subObj.value = tempArr[key][i].actualAssignmentQuantity || 0
subObj.name = tempArr[key][i].woName
if (i < 5) {
subObj.color = color[i]
} else {
subObj.color = color[i%5]
}
sunNum+=tempArr[key][i].actualAssignmentQuantity
sunNum+=(tempArr[key][i].actualAssignmentQuantity || 0)
tempArr3.push(subObj)
}
tempArr3.push({
@ -268,6 +268,7 @@ export default {
obj.workOrder = tempArr3
tempArr2.push(obj)
}
console.log(tempArr2)
this.chartList = tempArr2
if (this.activeName === 'barChart' && this.chartList.length > 0) {
this.$nextTick(() => {

View File

@ -43,7 +43,8 @@
<el-form-item label="产品规格" prop="specifications">
<el-input
v-model="dataForm.specifications"
placeholder="请输入产品规格" />
placeholder="请输入产品规格"
disabled/>
</el-form-item>
</el-col>
<el-col :span="8">
@ -149,11 +150,6 @@
<el-radio :label="1">产品基础BOM</el-radio>
<el-radio :label="2">工艺扩展BOM</el-radio>
</el-radio-group>
<!-- <el-select v-model="dataForm.materialMethod" placeholder="请选择物料计算方式" style="width: 100%;"
@change="materialMethodChange">
<el-option key="1" label="产品基础BOM" :value="1" />
<el-option key="2" label="工艺扩展BOM" :value="2" />
</el-select> -->
</el-col>
</el-row>
<div v-if="dataForm.materialMethod === 1">
@ -249,17 +245,10 @@
</el-col>
</el-row>
</div>
<!-- <el-row>
<el-col :span='12'>
<el-form-item label="计划分配订单量" prop="planAssignmentQuantity">
<el-input-number v-model="form.planAssignmentQuantity" :min="0" :max="9999999999999" style="width: 100%;"></el-input-number>
</el-form-item>
</el-col>
</el-row> -->
</el-form>
</template>
<script>
import { getProductAll } from '@/api/base/product';
import { getProductList } from '@/api/base/product';
import { getProcessFlowPage, workOrderList } from '@/api/base/orderManage';
import {
createCoreWO,
@ -327,7 +316,6 @@ export default {
{ id: 1, name: '普通' },
{ id: 2, name: '特殊' },
],
isBind: false,
workOrderList: [],
};
},
@ -342,10 +330,6 @@ export default {
this.dataForm.productLineIds = [];
const obj = { lineId: null, processId: null, num: null };
this.dataForm.productLineIds.push(obj);
// if (val === 2 && !this.dataForm.processFlowId) {
// this.dataForm.materialMethod = 1;
// this.$modal.msgError('');
// }
},
// 线
processLineIdChange(val) {
@ -357,6 +341,7 @@ export default {
//
getProcessFlowPage(params).then((res) => {
this.processFlowList = res.data.list || [];
console.log(this.processFlowList);
});
},
init(id) {
@ -379,6 +364,14 @@ export default {
this.dataForm.priority = String(this.dataForm.priority);
}
this.dataForm.priority;
// 线
if (this.dataForm.materialMethod === 2) {
this.dataForm.productLineIds.forEach((item) => {
if (item.lineId) {
this.processLineIdChange(item.lineId);
}
})
}
});
} else {
if (this.urlOptions.isGetCode) {
@ -423,21 +416,7 @@ export default {
this.urlOptions.createURL(this.dataForm).then((response) => {
this.$modal.msgSuccess('新增成功');
this.visible = false;
this.$confirm('是否添加预使用主原料信息?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
})
.then(() => {
console.log('121', this.dataForm.name);
this.$emit('refreshDataList', {
id: response.data,
name: this.dataForm.name,
});
})
.catch(() => {
this.$emit('refreshDataList');
});
this.$emit('refreshDataList');
});
}
});
@ -452,7 +431,7 @@ export default {
},
getDict() {
//
getProductAll().then((res) => {
getProductList().then((res) => {
this.productList = res.data || [];
});
// 线

View File

@ -0,0 +1,311 @@
<!--
* @Author: zwq
* @Date: 2021-11-18 14:16:25
* @LastEditors: DY
* @LastEditTime: 2024-07-19 18:59:13
* @Description:
-->
<template>
<el-drawer
:visible.sync="visible"
:show-close="false"
:wrapper-closable="false"
class="drawer"
size="55%">
<small-title slot="title" :no-padding="true">
{{ '分配产量' }}
</small-title>
<div class="content">
<div class='formContainer'>
<el-row :gutter="20">
<el-col :span="12"><span class='label'>工单名称</span><span class='text'>{{ dataForm.name }}</span></el-col>
<el-col :span="12"><span class='label'>工单编码</span><span class='text'>{{ dataForm.code }}</span></el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12"><span class='label'>产品名称</span><span class='text'>{{ dataForm.productName }}</span></el-col>
<el-col :span="12"><span class='label'>产品规格</span><span class='text'>{{ dataForm.specifications }}</span></el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12"><span class='label'>实际生产数量</span><span class='text'>{{ dataForm.actualQuantity }}</span></el-col>
</el-row>
</div>
<div class="attr-list">
<!-- <el-button v-show="!isdetail" type="success" size="small" style="float: right" @click="addRow()">添加一行</el-button> -->
<el-table
border
:data="tableData"
:header-cell-style="{
background: '#F2F4F9',
color: '#606266'
}"
style="width: 100%">
<el-table-column type="index" label="序号" width='50' align="center" />
<el-table-column prop="orderName" label="订单名称" />
<el-table-column prop="orderCode" label="订单编码" />
<el-table-column prop="priority" label="优先级" />
<el-table-column prop="planAssignmentQuantity" label="计划分配数量" >
<template slot-scope="scope">
<el-input v-model="scope.row.planAssignmentQuantity" :disabled="scope.row.actualAssignmentQuantity"></el-input>
</template>
</el-table-column>
<el-table-column prop="actualAssignmentQuantity" label="实际分配数量">
<template slot-scope="scope">
<el-input v-model="scope.row.actualAssignmentQuantity" :disabled="scope.row.actualAssignmentQuantity"></el-input>
</template>
</el-table-column>
<el-table-column label="操作" width='50' align="center" fixed='right'>
<template slot-scope="scope">
<el-button type="text" size="small" @click="saveData(scope.row)">保存</el-button>
<!-- <el-tooltip v-if="!scope.row.isEdit" placement="top" content="编辑">
<el-button
type="text"
:style="{color:'#0B58FF'}"
size="mini"
@click="edit(scope.row)"
>
<svg-icon style="width: 18px; height: 18px" class="item-icon" icon-class="edit" />
</el-button>
</el-tooltip> -->
<!-- <el-tooltip placement="top" content="删除">
<el-button
type="text"
:style="{color:'#FF5454'}"
size="mini"
@click="deleteDetail(scope.row)"
>
<svg-icon style="width: 18px; height: 18px" class="item-icon" icon-class="table_delete" />
</el-button>
</el-tooltip> -->
</template>
</el-table-column>
</el-table>
<pagination
v-show="listQuery.total > 0"
:total="listQuery.total"
:page.sync="listQuery.pageNo"
:limit.sync="listQuery.pageSize"
:page-sizes="[5, 10, 15]"
@pagination="getList" />
</div>
<div class="drawer-body__footer">
<el-button style="" type="primary" @click="goback()">关闭</el-button>
<!-- <el-button v-if="isdetail" type="primary" @click="goEdit()">
编辑
</el-button>
<el-button v-else type="primary" @click="dataFormSubmit()">确定</el-button> -->
</div>
</div>
<!-- <attr-add
v-if="addOrUpdateVisible"
ref="addOrUpdate"
:material-id="dataForm.id"
@refreshDataList="getList" /> -->
</el-drawer>
</template>
<script>
import basicAdd from '../../core/mixins/basic-add';
import { getConOrderList, createConCoreWOr, getCoreWO } from '@/api/base/coreWorkOrder';
import SmallTitle from './SmallTitle';
// import { parseTime } from '../../core/mixins/code-filter';
// import attrAdd from './attr-add';
export default {
mixins: [basicAdd],
components: { SmallTitle },
data() {
return {
addOrUpdateVisible: false,
urlOptions: {
infoURL: getCoreWO,
},
listQuery: {
pageSize: 10,
pageNo: 1,
total: 0,
},
dataForm: {
id: undefined,
code: undefined,
productId: '',
remark: undefined,
},
productList: [],
materialAttrList: [],
materialList: [],
tableData: [],
visible: false,
isdetail: false,
idAttrShow: false
};
},
mounted() {},
methods: {
initData() {
// this.materialAttrList.splice(0);
this.listQuery.total = 0;
},
edit(row) {
row.isEdit = true
},
saveData(row) {
if (row.actualAssignmentQuantity) {
if (row.id) {
// updateMaterialPBDet({
// ...row
// }).then((response) => {
// this.$modal.msgSuccess('');
// // this.visible = false;
// this.getList();
// });
// return;
}
//
createConCoreWOr({
...row,
workOrderId: this.dataForm.id
}).then((response) => {
this.$modal.msgSuccess('分配成功');
// this.visible = false;
this.getList();
});
} else {
this.$message.warning('请填写实际分配数量');
}
},
getList() {
// Bom
getConOrderList({
...this.listQuery,
workOrderId: this.dataForm.id
}).then((response) => {
this.tableData = response.data.map(item => {
item.isEdit = false
return item
});
this.listQuery.total = response.data.total;
});
},
//
// addRow() {
// const row = {
// bomId: this.dataForm.id,
// materialId: '',
// num: 0,
// materialCode: undefined,
// unit: undefined,
// remark: '',
// isEdit: true
// }
// this.tableData.push(row)
// },
init(id, isdetail) {
this.initData();
this.isdetail = isdetail || false;
this.dataForm.id = id || undefined;
this.visible = true;
// if (id) {
// this.idAttrShow = true
// } else {
// this.idAttrShow = false
// }
this.$nextTick(() => {
// this.$refs['dataForm'].resetFields();
if (this.dataForm.id) {
//
this.urlOptions.infoURL(id).then(response => {
this.dataForm = response.data;
});
//
this.getList();
} else {}
});
},
goback() {
this.$emit('refreshDataList');
this.visible = false;
// this.initData();
},
goEdit() {
this.isdetail = false;
},
// /
addNew(id) {
this.addOrUpdateVisible = true;
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id);
});
}
}
};
</script>
<style scoped>
.drawer >>> .el-drawer {
border-radius: 8px 0 0 8px;
display: flex;
flex-direction: column;
}
.drawer >>> .el-form-item__label {
padding: 0;
}
.drawer >>> .el-drawer__header {
margin: 0;
padding: 32px 32px 24px;
border-bottom: 1px solid #dcdfe6;
}
.drawer >>> .el-drawer__body {
flex: 1;
height: 1px;
display: flex;
flex-direction: column;
}
.drawer >>> .content {
padding: 30px 24px;
flex: 1;
display: flex;
flex-direction: column;
/* height: 100%; */
}
.drawer >>> .visual-part {
flex: 1 auto;
max-height: 30vh;
overflow: hidden;
overflow-y: scroll;
padding-right: 10px; /* 调整滚动条样式 */
}
.drawer >>> .el-form {
padding: 0 16px;
}
.drawer-body__footer {
display: flex;
justify-content: flex-end;
padding: 18px;
}
.formContainer {
.label {
display: inline-block;
padding: 5px 0px;
font-size: 14px;
font-weight: 600;
}
.text {
display: inline-block;
padding: 5px 0px;
font-size: 14px;
color:rgba(102, 102, 102, 0.75);
}
margin-bottom: 10px;
}
</style>

View File

@ -31,7 +31,6 @@
</div>
<div class="attr-list">
<!-- <el-button v-show="!isdetail" type="success" size="small" style="float: right" @click="addRow()">添加一行</el-button> -->
<el-table
border
:data="tableData"
@ -43,76 +42,32 @@
<el-table-column type="index" label="序号" width='50' align="center" />
<el-table-column prop="orderName" label="订单名称" />
<el-table-column prop="orderCode" label="订单编码" />
<el-table-column prop="priority" label="优先级" />
<el-table-column prop="planAssignmentQuantity" label="计划分配数量" >
<el-table-column prop="priority" label="优先级">
<template slot-scope="scope">
<el-input v-model="scope.row.planAssignmentQuantity" :disabled="scope.row.actualAssignmentQuantity"></el-input>
{{scope.row.priority == 1 ? '低' : scope.row.priority == 2 ? '正常' : scope.row.priority == 3 ? '高' : ''}}
</template>
</el-table-column>
<el-table-column prop="planAssignmentQuantity" label="计划分配数量" />
<el-table-column prop="actualAssignmentQuantity" label="实际分配数量">
<template slot-scope="scope">
<el-input v-model="scope.row.actualAssignmentQuantity" :disabled="scope.row.actualAssignmentQuantity"></el-input>
</template>
</el-table-column>
<el-table-column label="操作" width='50' align="center" fixed='right'>
<template slot-scope="scope">
<el-button type="text" size="small" @click="saveData(scope.row)">保存</el-button>
<!-- <el-tooltip v-if="!scope.row.isEdit" placement="top" content="编辑">
<el-button
type="text"
:style="{color:'#0B58FF'}"
size="mini"
@click="edit(scope.row)"
>
<svg-icon style="width: 18px; height: 18px" class="item-icon" icon-class="edit" />
</el-button>
</el-tooltip> -->
<!-- <el-tooltip placement="top" content="删除">
<el-button
type="text"
:style="{color:'#FF5454'}"
size="mini"
@click="deleteDetail(scope.row)"
>
<svg-icon style="width: 18px; height: 18px" class="item-icon" icon-class="table_delete" />
</el-button>
</el-tooltip> -->
<el-input-number :disabled='isSaved' v-model="scope.row.actualAssignmentQuantity" style='width: 100%;' controls-position="right" :min="0" :max="dataForm.actualQuantity"></el-input-number>
</template>
</el-table-column>
</el-table>
<pagination
v-show="listQuery.total > 0"
:total="listQuery.total"
:page.sync="listQuery.pageNo"
:limit.sync="listQuery.pageSize"
:page-sizes="[5, 10, 15]"
@pagination="getList" />
</div>
<div class="drawer-body__footer">
<el-button style="" type="primary" @click="goback()">关闭</el-button>
<!-- <el-button v-if="isdetail" type="primary" @click="goEdit()">
编辑
</el-button>
<el-button v-else type="primary" @click="dataFormSubmit()">确定</el-button> -->
<el-button plain type="primary" @click="goback()">关闭</el-button>
<el-button type="primary" @click="saveData()" :disabled='isSaved'>保存</el-button>
</div>
</div>
<!-- <attr-add
v-if="addOrUpdateVisible"
ref="addOrUpdate"
:material-id="dataForm.id"
@refreshDataList="getList" /> -->
</el-drawer>
</template>
<script>
import basicAdd from '../../core/mixins/basic-add';
import { getConOrderList, createConCoreWOr, getCoreWO } from '@/api/base/coreWorkOrder';
import { getConOrderList, updateBatch, getCoreWO } from '@/api/base/coreWorkOrder';
import SmallTitle from './SmallTitle';
// import { parseTime } from '../../core/mixins/code-filter';
// import attrAdd from './attr-add';
export default {
mixins: [basicAdd],
@ -123,100 +78,51 @@ export default {
urlOptions: {
infoURL: getCoreWO,
},
listQuery: {
pageSize: 10,
pageNo: 1,
total: 0,
},
dataForm: {
id: undefined,
code: undefined,
productId: '',
remark: undefined,
},
productList: [],
materialAttrList: [],
materialList: [],
tableData: [],
visible: false,
isdetail: false,
idAttrShow: false
isSaved:false
};
},
mounted() {},
methods: {
initData() {
// this.materialAttrList.splice(0);
this.listQuery.total = 0;
},
edit(row) {
row.isEdit = true
},
saveData(row) {
if (row.actualAssignmentQuantity) {
if (row.id) {
// updateMaterialPBDet({
// ...row
// }).then((response) => {
// this.$modal.msgSuccess('');
// // this.visible = false;
// this.getList();
// });
// return;
}
//
createConCoreWOr({
...row,
workOrderId: this.dataForm.id
}).then((response) => {
this.$modal.msgSuccess('分配成功');
// this.visible = false;
this.getList();
});
} else {
this.$message.warning('请填写实际分配数量');
saveData() {
console.log(this.tableData)
let sunNum = 0
this.tableData.forEach(row => {
sunNum+=(row.actualAssignmentQuantity || 0)
})
if (sunNum > this.dataForm.actualQuantity) {
this.$message.warning('各订单实际分配数量之和不能大于实际生产数量');
return
}
updateBatch(this.tableData).then((response) => {
this.$modal.msgSuccess('分配成功');
this.isSaved = true;
});
},
getList() {
// Bom
getConOrderList({
...this.listQuery,
workOrderId: this.dataForm.id
}).then((response) => {
this.tableData = response.data.map(item => {
item.isEdit = false
item.actualAssignmentQuantity = item.actualAssignmentQuantity || 0
item.workOrderId = this.dataForm.id
return item
});
this.listQuery.total = response.data.total;
});
},
//
// addRow() {
// const row = {
// bomId: this.dataForm.id,
// materialId: '',
// num: 0,
// materialCode: undefined,
// unit: undefined,
// remark: '',
// isEdit: true
// }
// this.tableData.push(row)
// },
init(id, isdetail) {
this.initData();
this.isdetail = isdetail || false;
init(id) {
this.dataForm.id = id || undefined;
this.visible = true;
// if (id) {
// this.idAttrShow = true
// } else {
// this.idAttrShow = false
// }
this.isSaved = false;
this.$nextTick(() => {
// this.$refs['dataForm'].resetFields();
if (this.dataForm.id) {
//
this.urlOptions.infoURL(id).then(response => {
@ -230,17 +136,6 @@ export default {
goback() {
this.$emit('refreshDataList');
this.visible = false;
// this.initData();
},
goEdit() {
this.isdetail = false;
},
// /
addNew(id) {
this.addOrUpdateVisible = true;
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id);
});
}
}
};

View File

@ -27,6 +27,7 @@
<div class="content">
<div>
<h1 class='orderTitle'>工单编码{{ dataForm.code }}</h1>
<el-button type="primary" plain style='position: absolute;right: 16px;top:5px' v-show="workOrderButton.length === 0" @click='goWorkOrderList()'><svg-icon icon-class="return" />返回</el-button>
</div>
<small-title style="margin: 16px 0" size="sm" :no-padding="true">
基本信息
@ -94,10 +95,10 @@
@clickBtn="handleClick" />
</base-table>
</el-tab-pane>
<!-- <el-tab-pane label="预计用料信息" name="material">
<el-tab-pane label="预计用料" name="material">
<base-table :max-height="tableH" :table-props="tableProps1" :page="listQuery1.pageNo"
:limit="listQuery1.pageSize" :table-data="materialList" />
</el-tab-pane> -->
</el-tab-pane>
<el-tab-pane label="质量信息" name="quality">
<base-table :max-height="tableH" :table-props="tablePropsQuality" :table-data="qualityList" :page="1"
:limit="10" />
@ -352,6 +353,9 @@ export default {
}
},
methods: {
goWorkOrderList() {
this.$router.go(-1);
},
getId(val) {
this.workOrderId = val
},

View File

@ -4,7 +4,6 @@
:formConfigs="formConfig"
ref="searchBarForm"
@headBtnClick="buttonClick" />
<el-button @click='testtest'>test测试分配产量的按钮</el-button>
<base-table
v-loading="dataListLoading"
:table-props="tableProps"
@ -131,17 +130,7 @@ export default {
{
name: 'status',
type: 'equal',
value: 2
},
{
name: 'status',
type: 'equal',
value: 3
},
{
name: 'status',
type: 'equal',
value: 4
value: 1
}
]
}
@ -359,12 +348,6 @@ export default {
this.getDataList()
},
methods: {
testtest() {
this.allocationVisible = true;
this.$nextTick(() => {
this.$refs.allocation.init("1854697306771206146", true);
});
},
getWorkOrder() {
getCoreWOList().then(res => {
this.formConfig[0].selectOptions = res.data.map(item => {
@ -489,7 +472,6 @@ export default {
switch (val.btnName) {
case 'search':
this.listQuery.pageNo = 1;
this.listQuery.pageSize = 10;
this.listQuery.name = val.name ? val.name : undefined;
this.listQuery.status = val.status ? val.status : undefined;
this.listQuery.startProduceTime = val.time ? val.time : undefined
@ -498,7 +480,6 @@ export default {
case 'reset':
this.$refs.searchBarForm.resetForm();
this.listQuery = {
pageSize: 10,
pageNo: 1,
total: 1,
};