排产管理页面问题修改

dev-scheduling
zhangdi 4 weeks ago
parent 5b32aba892
commit a22a1d64e8
  1. 2
      index.html
  2. 3
      public/config.js
  3. 2
      src/api/productionSchedulingPlan/basic.js
  4. 2
      src/views/processManagement/bathRefine/components/addQuantityDialog.vue
  5. 5
      src/views/processManagement/components/inPlantMaintenance.vue
  6. 3
      src/views/processManagement/components/processMainte/partDetails.vue
  7. 12
      src/views/productionManagement/components/batchesDialog.vue
  8. 707
      src/views/productionSchedulingPlan/basic/components/addEquipment.vue
  9. 444
      src/views/productionSchedulingPlan/basic/components/addPersonnel.vue
  10. 239
      src/views/productionSchedulingPlan/basic/equipmentCapacity.vue
  11. 118
      src/views/productionSchedulingPlan/basic/personnelCapacity.vue
  12. 1
      src/views/productionSchedulingPlan/basic/principalProducer.vue

@ -22,7 +22,7 @@
<!-- 导入需要的包 (一定要放到index.html中的head标签里) -->
<script src="/js/Sortable.min.js"></script>
<script src="/js/xlsx.full.min.js"></script>
<script src="/public/config.js"></script>
<script src="/config.js"></script>
<title>电镀智能化生产管理系统</title>
</head>

@ -1,6 +1,7 @@
window.LOAD_Remind = 86400000
window.TIMED_Trigger=86400000
window.YINGDU_Trigger=3000 //硬度检测 轮巡时间
window.PROCESS_FLOW_CARD_HEAT_METER="http://192.168.169.172:9000/jmreport/view/1154214123878776832"//工艺流程卡地址 热表公用
window.PROCESS_FLOW_CARD_HEAT_SINTER="http://192.168.169.172:9000/jmreport/view/1154632438942031872"//工艺流程卡地址 烧结
@ -19,8 +20,6 @@ window.COMPANION = "http://192.168.169.172:9000/jmreport/view/118870568359470694
// 领料单打印
window.WARE_MATERIAL_PRINT = "http://192.168.169.172:9000/jmreport/view/1181486341205573632"
// 领料单明细打印
// 库存汇总标签打印
window.WARE_MATERIAL_STOCK_TAG = "http://192.168.169.172:9000/jmreport/view/1181492297180168192"

@ -384,7 +384,7 @@ export const getDetailSintTempCurve = params => {
// 获取证书类型列表数据/personAbility/selectCertificateList
export const getSelectCertificateList = params => {
return request({
url: '/personAbility/selectCertificateList',
url: '/blade-scheduling/personAbility/selectCertificateList',
method: 'get',
params: params,
});

@ -211,7 +211,7 @@ export default {
row => row.id == this.form.tableData[index].batchNo
);
console.log(select, 'select');
this.form.tableData[index].batchNoName = select[0].name;
this.form.tableData[index].batchName = select[0].name;
},
//
changeWorkCenter(index) {

@ -26,7 +26,8 @@
<el-button type="primary" @click="handleImport">导入 </el-button>
</template>
<template #menu="scope">
<el-button type="text" @click="handleEdit(scope.row)">修改 </el-button>
<el-button type="text" @click="rowDel(scope.row)" v-if="scope.row.syncStatus==0">删除 </el-button>
<el-button type="text" @click="handleEdit(scope.row)" v-if="scope.row.syncStatus==0">修改 </el-button>
</template>
<template #fileUrls="scope">
<el-button v-if="scope.row.fileUrl != null&&scope.row.fileUrl != ''" type="text" @click="uploadUrl(scope.row)" >
@ -94,7 +95,7 @@ export default {
viewBtn: false,
addBtn: false,
editBtn: false,
delBtn: true,
delBtn: false,
editBtnText: '修改',
viewBtnText: '详情',
labelWidth: 120,

@ -969,7 +969,8 @@ export default {
};
getPartManagementDetail(query).then(res => {
this.formData = res.data.data.dsPartEntity;
this.dataTable = res.data.data.dsPartVOList;
res.data.data.dsPartVOList=null
this.dataTable = res.data.data.dsPartVOList==null?[]:res.data.data.dsPartVOList;
this.tabLoading = false;
if (this.dataTable.length > 0) {
this.dataTable.forEach(item => {

@ -51,11 +51,12 @@
<el-button type="primary" @click="submit()" :loading="saveLoading"> </el-button>
</span>
</template>
</el-dialog>
</template>
<script>
import { inBatches } from '@/api/productionManagement/productionMonitoring';
import { inBatches,batchesPrepare } from '@/api/productionManagement/productionMonitoring';
export default {
props: {
showBatches: {
@ -78,8 +79,15 @@ export default {
},
};
},
mounted() {},
mounted() {
this.init()
},
methods: {
init(){
batchesPrepare(this.itemData[0].woId).then(res => {
console.log(res,98989898);
});
},
//
closeDialog() {
this.$emit('closeDialog');

@ -0,0 +1,707 @@
<template>
<el-dialog
:title="title"
append-to-body
:modelValue="openShow"
width="70%"
@close="closeDialog"
fullscreen
>
<div style="margin-bottom: 12px" v-if="moldAddMore">
<el-button type="primary" @click="addTable">插入一行</el-button>
<el-button type="danger" @click="delTable">删除选中行</el-button>
</div>
<!-- 单个 Form 包裹整个表格 -->
<el-form ref="tableForm" :model="form" :rules="formRules" label-width="0px">
<!-- 全局错误提示 -->
<div v-if="formError" class="error-message" style="color: #f56c6c; margin-bottom: 10px">
{{ formError }}
</div>
<el-table :data="form.tableData" @select="selectChange" border :height="tableHeight">
<el-table-column type="selection" width="55"></el-table-column>
<!-- 作业中心绑定数组字段 -->
<el-table-column align="center" label="作业中心" width="150">
<template #header>
<span><i style="color: red">*</i>作业中心</span>
</template>
<template #default="scope">
<el-form-item
:prop="`tableData[${scope.$index}].workCenterId`"
:rules="formRules.workCenterId"
>
<el-select
v-model="scope.row.workCenterId"
placeholder="请选择"
style="width: 100%"
clearable
filterable
@change="value => onChangeData(value, scope.$index, 'workCenterId')"
>
<el-option
v-for="item in wcData"
:key="item.id"
:value="item.id"
:label="item.wcName"
></el-option>
</el-select>
</el-form-item>
</template>
</el-table-column>
<el-table-column align="center" label="设备名称" width="150">
<template #header>
<span><i style="color: red">*</i>设备名称</span>
</template>
<template #default="scope">
<el-form-item
:prop="`tableData[${scope.$index}].equipCode`"
:rules="formRules.equipCode"
>
<el-select
v-model="scope.row.equipCode"
placeholder="请选择"
style="width: 100%"
clearable
filterable
@change="value => onChangeData(value, scope.$index, 'equipCode')"
>
<el-option
v-for="item in equipData"
:key="item.deviceCode"
:value="item.deviceCode"
:label="`${item.deviceName}/${item.deviceCode}`"
></el-option>
</el-select>
</el-form-item>
</template>
</el-table-column>
<el-table-column align="center" label="设备型号" width="150">
<template #default="scope">
<el-form-item :prop="`tableData[${scope.$index}].equipNameType`">
{{ scope.row.equipNameType }}
</el-form-item>
</template>
</el-table-column>
<el-table-column align="center" label="设备分类" width="150">
<template #header>
<span><i style="color: red">*</i>设备分类</span>
</template>
<template #default="scope">
<el-form-item
:prop="`tableData[${scope.$index}].equipType`"
:rules="formRules.equipType"
>
<el-select
v-model="scope.row.equipType"
placeholder="请选择"
style="width: 100%"
clearable
filterable
>
<el-option
v-for="item in equipTypeData"
:key="item.value"
:value="item.value"
:label="item.label"
></el-option>
</el-select>
</el-form-item>
</template>
</el-table-column>
<el-table-column align="center" label="工艺能力" width="150">
<template #header>
<span><i style="color: red">*</i>工艺能力</span>
</template>
<template #default="scope">
<el-form-item :prop="`tableData[${scope.$index}].craftId`" :rules="formRules.craftId">
<el-select
v-model="scope.row.craftId"
placeholder="请选择"
style="width: 100%"
clearable
filterable
@change="value => onChangeData(value, scope.$index, 'craftId')"
>
<el-option
v-for="item in craftData"
:key="item.id"
:value="item.id"
:label="item.caName"
></el-option>
</el-select>
</el-form-item>
</template>
</el-table-column>
<el-table-column align="center" label="加工能力类型" width="280">
<template #header>
<span><i style="color: red">*</i>加工能力类型</span>
</template>
<template #default="scope">
<el-form-item :prop="`tableData[${scope.$index}].partType`" :rules="formRules.partType">
<el-radio-group v-model="scope.row.partType" @change="onPartTypeChange(scope.$index)">
<el-radio :label="0">默认</el-radio>
<el-radio :label="1">壳体外径</el-radio>
<el-radio :label="2">玻璃饼直径</el-radio>
</el-radio-group>
</el-form-item>
</template>
</el-table-column>
<el-table-column align="center" label="额定加工能力(烧结-个/热表-面积)" width="360">
<template #header>
<span><i style="color: red">*</i>额定加工能力</span>
</template>
<template #default="scope">
<el-form-item
:prop="`tableData[${scope.$index}].standardProcessAbility`"
:rules="formRules.standardProcessAbility"
>
<div class="ability-input-group" v-if="scope.row.partType != 0">
<template v-for="(item, idx) in scope.row.abilityList" :key="idx">
<div class="ability-row">
<!-- 左边大于等于 -->
<el-input
v-model="item.startNum"
placeholder="最小值"
style="width: 80px"
type="number"
@change="onAbilityChange(scope.$index)"
/>
<span class="operator-label"></span>
<!-- 中间逻辑符 -->
<span class="logic-label">φ</span>
<!-- 右边小于 -->
<span class="operator-label">&lt;</span>
<el-input
v-model="item.endNum"
placeholder="最大值"
style="width: 80px"
type="number"
@change="onAbilityChange(scope.$index)"
/>
<el-input
v-model="item.standardProcessAbility"
placeholder="min/件"
style="width: 80px"
type="number"
/>
<el-button
v-if="scope.row.abilityList.length > 1"
type="danger"
icon="Minus"
circle
size="small"
@click="removeAbilityItem(scope.$index, idx)"
title="删除条件"
/>
<el-button
v-if="idx === scope.row.abilityList.length - 1"
type="primary"
icon="Plus"
circle
size="small"
@click="addAbilityItem(scope.$index)"
title="添加条件"
/>
</div>
</template>
</div>
<div v-else>
<el-input-number
v-model="scope.row.standardProcessAbility"
style="width: 100%"
:min="0"
></el-input-number>
</div>
</el-form-item>
</template>
</el-table-column>
<el-table-column align="center" label="额定工时" width="150">
<template #header>
<span><i style="color: red">*</i>额定工时</span>
</template>
<template #default="scope">
<el-form-item
:prop="`tableData[${scope.$index}].standardTime`"
:rules="formRules.standardTime"
>
<el-input-number
v-model="scope.row.standardTime"
style="width: 100%"
:min="0"
></el-input-number>
</el-form-item>
</template>
</el-table-column>
<el-table-column align="center" label="准备工时" width="150">
<template #header>
<span><i style="color: red">*</i>准备工时</span>
</template>
<template #default="scope">
<el-form-item
:prop="`tableData[${scope.$index}].prepareTime`"
:rules="formRules.prepareTime"
>
<el-input-number
v-model="scope.row.prepareTime"
style="width: 100%"
:min="0"
></el-input-number>
</el-form-item>
</template>
</el-table-column>
<el-table-column align="center" label="轮次间隔" width="150">
<template #header>
<span><i style="color: red">*</i>轮次间隔</span>
</template>
<template #default="scope">
<el-form-item :prop="`tableData[${scope.$index}].interval`" :rules="formRules.interval">
<el-input-number
v-model="scope.row.interval"
style="width: 100%"
:min="0"
></el-input-number>
</el-form-item>
</template>
</el-table-column>
<el-table-column align="center" label="指定使用" width="150">
<template #default="scope">
<el-form-item :prop="`tableData[${scope.$index}].assignUse`">
<el-input v-model="scope.row.assignUse" placeholder="请输入内容"></el-input>
</el-form-item>
</template>
</el-table-column>
<el-table-column align="center" label="备注" width="150">
<template #default="scope">
<el-form-item :prop="`tableData[${scope.$index}].remarks`">
<el-input v-model="scope.row.remarks" placeholder="请输入内容"></el-input>
</el-form-item>
</template>
</el-table-column>
</el-table>
</el-form>
<template #footer>
<span class="dialog-footer">
<el-button @click="closeDialog" :loading="subLoading"> </el-button>
<el-button type="primary" @click="submitForm" :loading="subLoading"> </el-button>
</span>
</template>
</el-dialog>
</template>
<script>
import { getWorkCenterList } from '@/api/processManagement/addQuantity.js';
import {
getEquipment,
getCraftAbility,
addEquipAbility,
updateEquipAbility,
} from '@/api/productionSchedulingPlan/basic.js';
export default {
props: {
showDialog: { type: Boolean, default: false },
moldAddMore: { type: Boolean, default: false },
tabPosition: { type: String, default: '' },
title: { type: String, default: '' },
rowData: { type: Array, default: [] },
},
data() {
return {
subLoading: false,
tableHeight: 100,
openShow: false,
wcData: [],
formError: '', //
//
form: {
tableData: [], // Form
},
//
formRules: {
// 1
tableData: [
{
required: true,
message: '请至少添加一行数据',
trigger: 'submit',
type: 'array', //
},
{
validator: (rule, value, callback) => {
if (value.length === 0) {
callback(new Error('请至少添加一行数据'));
} else {
callback();
}
},
trigger: 'submit',
},
],
//
workCenterId: [
{ required: true, message: '请选择作业中心', trigger: ['change', 'submit'] },
],
equipCode: [
{ required: true, message: '请选择设备名称/编码', trigger: ['change', 'submit'] },
],
equipType: [{ required: true, message: '请选择设备类型', trigger: ['change', 'submit'] }],
craftId: [{ required: true, message: '请选择工艺能力', trigger: ['change', 'submit'] }],
// standardProcessAbility: [
// { required: true, message: '', trigger: ['change', 'submit'] },
// ],
standardTime: [
{ required: true, message: '请输入额定工时', trigger: ['change', 'submit'] },
],
prepareTime: [{ required: true, message: '请输入准备工时', trigger: ['change', 'submit'] }],
interval: [{ required: true, message: '请输入轮次间隔', trigger: ['change', 'submit'] }],
partType: [{ required: true, message: '请选择加工类型', trigger: ['change', 'submit'] }],
},
equipTypeData: [
{
label: '产线设备',
value: '0',
},
{
label: '普通设备',
value: '1',
},
],
equipData: [],
};
},
mounted() {
this.openShow = this.showDialog;
this.getWorkCenterList();
this.getEquipment();
this.getCraftAbility();
//
if (this.title == '新增') {
this.addTable();
} else {
this.form.tableData = this.rowData;
}
this.calcTableHeight();
window.addEventListener('resize', this.calcTableHeight);
},
beforeUnmount() {
window.removeEventListener('resize', this.calcTableHeight);
},
methods: {
validateRange() {
const tableData = this.form.tableData || [];
for (let i = 0; i < tableData.length; i++) {
const row = tableData[i];
// partType 0
if (row.partType === 0) continue;
const list = row.abilityList || [];
for (let j = 0; j < list.length; j++) {
const item = list[j];
const nextItem = list[j + 1];
//
if (
item.startNum !== null &&
item.startNum !== '' &&
item.endNum !== null &&
item.endNum !== ''
) {
const start = parseFloat(item.startNum);
const end = parseFloat(item.endNum);
console.log(start, end, 89898989);
// <
if (start >= end) {
this.$message.error(`${i + 1}行,第${j + 1}组:最小值必须小于最大值`);
return false;
}
//
if (start < 0 || end < 0) {
this.$message.error(`${i + 1}行,第${j + 1}组:值不能为负数`);
return false;
}
if (j < list.length - 1) {
const nextItem = list[j + 1];
if (item.endNum && nextItem.startNum) {
if (parseFloat(item.endNum) !== parseFloat(nextItem.startNum)) {
this.$message.error(
`${i + 1}行,第${j + 1}组的结束值 (${item.endNum}) 必须等于第${
j + 2
}组的开始值 (${nextItem.startNum})`
);
return false;
}
}
}
}
}
}
return true;
}, //
getCraftAbility() {
getCraftAbility().then(res => {
this.craftData = res.data.data;
});
},
//
getEquipment() {
getEquipment().then(res => {
this.equipData = res.data.data;
console.log(res.data.data, 'data');
});
},
//
calcTableHeight() {
this.$nextTick(() => {
const container = document.querySelector('.el-dialog__body');
console.log(container.offsetHeight);
this.tableHeight = container.offsetHeight - 36 - 90 - 30;
});
},
//
getWorkCenterList() {
getWorkCenterList().then(res => {
this.wcData = res.data.data || [];
});
},
//
onChangeData(value, index, type) {
console.log(value, index, type);
if (type == 'workCenterId') {
// this.form.workCenterName = val.wcCode;
const selectedItem = this.wcData.find(item => item.id === value);
if (selectedItem) {
this.form.tableData[index].workCenterName = selectedItem.wcName;
} else {
this.form.tableData[index].workCenterName = '';
}
}
if (type == 'equipCode') {
const selectedItem = this.equipData.find(item => item.deviceCode === value);
if (selectedItem) {
this.form.tableData[index].equipName = selectedItem.deviceName; //
this.form.tableData[index].equipNameType = selectedItem.macSpec; //
} else {
this.form.tableData[index].workCenterName = '';
}
}
if (type == 'craftId') {
const selectedItem = this.craftData.find(item => item.id === value);
if (selectedItem) {
this.form.tableData[index].craftName = selectedItem.caName;
} else {
this.form.tableData[index].craftName = '';
}
}
},
onPartTypeChange(index) {
const row = this.form.tableData[index];
// partType 0 abilityList
if (row.partType !== 0) {
if (!row.abilityList || row.abilityList.length === 0) {
row.abilityList = [{ min: null, max: null }];
}
}
},
//
addAbilityItem(index) {
this.form.tableData[index].abilityList.push({
startNum: null,
endNum: null,
standardTime: null,
});
this.onAbilityChange(index);
},
//
removeAbilityItem(tableIndex, itemIndex) {
this.form.tableData[tableIndex].abilityList.splice(itemIndex, 1);
this.onAbilityChange(tableIndex);
},
//
onAbilityChange(index) {
const row = this.form.tableData[index];
const list = row.abilityList || [];
// min && <max || min && <max
const result = list
.filter(item => item.min !== null || item.max !== null)
.map(item => {
const parts = [];
if (item.min !== null && item.min !== '') {
parts.push(`${item.min}`);
}
if (item.max !== null && item.max !== '') {
parts.push(`<${item.max}`);
}
return parts.join(' && ');
})
.filter(str => str)
.join(' || ');
row.standardProcessAbility = result;
},
selectChange(list, row) {
row._select = !row._select;
},
// push tableData
addTable() {
this.form.tableData.push({
_select: false, //
partType: 0,
standardProcessAbility: null,
abilityList: [{ startNum: null, endNum: null, standardTime: null }],
});
},
//
delTable() {
this.form.tableData = this.form.tableData.filter(row => !row._select);
},
closeDialog() {
this.openShow = false;
this.$emit('closeDialog', true);
//
this.form.tableData = [];
this.formError = '';
this.$refs.tableForm?.resetFields();
},
//
submitForm() {
this.formError = '';
// Form
this.$refs.tableForm.validate((isValid, invalidFields) => {
if (!isValid) {
//
this.formError = '存在未完善的字段,请检查表格中的红色提示';
this.$nextTick(() => {
//
const firstError = document.querySelector('.el-form-item.is-error');
if (firstError) {
firstError.scrollIntoView({ behavior: 'smooth', block: 'center' });
}
});
return;
}
console.log('提交数据:', this.form.tableData);
if (!this.validateRange()) return;
this.subLoading = true;
//
const submitData = this.form.tableData.map(row => {
if (row.partType != 0) {
// abilityList
const list = row.abilityList || [];
// endNum 1000
if (list.length > 0) {
const lastItem = list[list.length - 1];
if (
lastItem.endNum === null ||
lastItem.endNum === '' ||
lastItem.endNum === undefined
) {
lastItem.endNum = 1000;
}
}
row.standardProcessAbility = JSON.stringify(row.abilityList);
} else {
row.standardProcessAbility = row.standardProcessAbility;
}
return row;
});
if (this.title == '新增') {
addEquipAbility(submitData).then(
() => {
this.subLoading = false;
this.$message.success('提交成功');
this.closeDialog();
this.$emit('submitSuccess', submitData);
done();
},
error => {
this.subLoading = false;
window.console.log(error);
}
);
} else {
updateEquipAbility(submitData).then(
() => {
this.$message.success('提交成功');
this.closeDialog();
this.$emit('submitSuccess', submitData);
this.subLoading = false;
done();
},
error => {
window.console.log(error);
this.subLoading = false;
}
);
}
});
},
},
};
</script>
<style lang="scss" scoped>
//
:deep(.el-table .el-form-item) {
margin-bottom: 0; //
}
//
:deep(.el-form-item__error) {
font-size: 12px;
white-space: nowrap;
z-index: 10;
background: #fff;
padding: 2px 4px;
border: 1px solid #f56c6c;
border-radius: 4px;
}
// textarea
.el-table__row {
height: 80px !important;
}
.el-table__cell {
vertical-align: middle !important;
}
.error-message {
font-size: 14px;
line-height: 1.5;
}
:deep(.el-table .el-table__cell) {
height: 50px !important;
padding: 0 !important;
line-height: 50px !important;
}
.ability-row {
margin-bottom: 10px;
}
</style>

@ -0,0 +1,444 @@
<template>
<el-dialog :title="title" append-to-body :modelValue="openShow" width="50%" @close="closeDialog">
<el-form
:model="ruleForm"
:rules="rules"
ref="ruleForm"
label-width="100px"
class="demo-ruleForm"
>
<el-row>
<el-col :span="12">
<el-form-item label="作业中心:" prop="workCenterId">
<el-select
v-model="ruleForm.workCenterId"
placeholder="请选择"
@change="value => onChangeData(value, 'workCenterId')"
clearable
filterable
>
<el-option
v-for="item in wcData"
:key="item.id"
:value="item.id"
:label="item.wcName"
></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="工序:" prop="processId">
<el-select
v-model="ruleForm.processId"
placeholder="请选择"
style="width: 100%"
clearable
filterable
@change="value => onChangeData(value, 'processId')"
>
<el-option
v-for="item in processData"
:key="item.id"
:value="item.id"
:label="item.name"
></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="工艺能力:" prop="craftId">
<el-select
v-model="ruleForm.craftId"
placeholder="请选择"
style="width: 100%"
clearable
filterable
@change="value => onChangeData(value, 'craftId')"
>
<el-option
v-for="item in craftData"
:key="item.id"
:value="item.id"
:label="item.caName"
></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="统计类型:" prop="type">
<el-select
v-model="ruleForm.type"
placeholder="请选择"
style="width: 100%"
clearable
filterable
>
<el-option
v-for="item in typeData"
:key="item.value"
:value="item.value"
:label="item.label"
></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="额定工时类型:" prop="partType" label-width="140px">
<el-radio-group v-model="ruleForm.partType" @change="onPartTypeChange">
<el-radio :label="0">默认</el-radio>
<el-radio :label="1">壳体外径</el-radio>
<el-radio :label="2">玻璃饼直径</el-radio>
<el-radio :label="3">芯数</el-radio>
</el-radio-group>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="额定工时(分钟/每人每个):" prop="standardTime" label-width="180px">
<div v-if="ruleForm.partType != 0">
<div
class="ability-input-group"
v-for="(item, idx) in ruleForm.abilityList"
:key="idx"
>
<div class="ability-row">
<el-input
v-model="item.startNum"
placeholder="最小值"
style="width: 80px"
type="number"
/>
<span class="operator-label"></span>
<span class="logic-label">φ</span>
<span class="operator-label">&lt;</span>
<el-input
v-model="item.endNum"
placeholder="最大值"
style="width: 80px"
type="number"
/>
<el-input
v-model="item.standardTime"
placeholder="min/件"
style="width: 80px"
type="number"
/>
<!-- 添加/删除按钮 -->
<el-button
v-if="ruleForm.abilityList.length > 1"
type="danger"
icon="Minus"
circle
size="small"
@click="removeAbilityItem(idx)"
title="删除条件"
/>
<el-button
v-if="idx === ruleForm.abilityList.length - 1"
type="primary"
icon="Plus"
circle
size="small"
@click="addAbilityItem"
title="添加条件"
/>
</div>
</div>
</div>
<div v-else>
<el-input-number v-model="ruleForm.standardTime"></el-input-number>
</div>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="准备工时(分钟):" prop="prepareTime" label-width="140px">
<el-input-number v-model="ruleForm.prepareTime"></el-input-number>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="生产标识:" prop="productIdent">
<el-input v-model="ruleForm.productIdent" placeholder="请输入"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="证书类型:" prop="certificateId">
<el-select
v-model="ruleForm.certificateId"
placeholder="请选择"
style="width: 100%"
clearable
filterable
@change="value => onChangeData(value, 'certificateId')"
>
<el-option
v-for="item in certificateData"
:key="item.id"
:value="item.id"
:label="item.name"
></el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
</el-form>
<template #footer>
<span class="dialog-footer">
<el-button @click="closeDialog" :loading="subLoading"> </el-button>
<el-button type="primary" @click="submit" :loading="subLoading"> </el-button>
</span>
</template>
</el-dialog>
</template>
<script>
import { getWorkCenterList } from '@/api/processManagement/addQuantity.js';
import {
getCraftAbility,
getProcessSet,
getSelectCertificateList,
addPersonAbility,
updatePersonAbility,
} from '@/api/productionSchedulingPlan/basic.js';
export default {
props: {
showDialog: {
type: Boolean,
default: false,
},
title: {
type: String,
default: '',
},
rowData: {
type: Object,
default: () => ({}),
},
},
data() {
return {
subLoading:false,
openShow: false,
wcData: [],
craftData: [], //
processData: [],
certificateData: [], //
typeData: [
{
label: '单个零件',
value: '0',
},
{
label: '订单',
value: '1',
},
],
ruleForm: {},
rules: {
workCenterId: [{ required: true, message: '请选择作业中心', trigger: 'blur' }],
processId: [{ required: true, message: '请选择工序', trigger: 'blur' }],
craftId: [{ required: true, message: '请选择工艺能力', trigger: 'blur' }],
type: [{ required: true, message: '请选择统计类型', trigger: 'blur' }],
prepareTime: [{ required: true, message: '请输入准备工时', trigger: 'blur' }],
partType: [{ required: true, message: '请选择额定工时类型', trigger: 'blur' }],
},
};
},
mounted() {
this.openShow = this.showDialog;
this.getWorkCenterList();
this.getCraftAbility();
this.getProcessSet();
this.getSelectCertificateList();
if (this.title == '修改') {
this.ruleForm = this.rowData;
}
},
methods: {
validateRange() {
if (this.ruleForm.partType === 0) return true;
const list = this.ruleForm.abilityList || [];
for (let i = 0; i < list.length; i++) {
const item = list[i];
//
if (
item.startNum !== null &&
item.startNum !== '' &&
item.endNum !== null &&
item.endNum !== ''
) {
const start = parseFloat(item.startNum);
const end = parseFloat(item.endNum);
// <
if (start >= end) {
this.$message.error(`${i + 1}组:最小值必须小于最大值`);
return false;
}
//
if (start < 0 || end < 0) {
this.$message.error(`${i + 1}组:值不能为负数`);
return false;
}
//
if (i < list.length - 1) {
const nextItem = list[i + 1];
if (item.endNum && nextItem.startNum) {
if (parseFloat(item.endNum) !== parseFloat(nextItem.startNum)) {
this.$message.error(
`${i + 1}行,第${i + 1}组的结束值 (${item.endNum}) 必须等于第${
i + 2
}组的开始值 (${nextItem.startNum})`
);
return false;
}
}
}
}
}
return true;
},
//
onPartTypeChange() {
if (this.ruleForm.partType !== 0) {
if (!this.ruleForm.abilityList || this.ruleForm.abilityList.length === 0) {
this.ruleForm.abilityList = [{ startNum: null, endNum: null, standardTime: null }];
}
}
},
//
addAbilityItem() {
this.ruleForm.abilityList.push({
startNum: null,
endNum: null,
standardTime: null,
});
this.onAbilityChange();
},
//
removeAbilityItem(index) {
this.ruleForm.abilityList.splice(index, 1);
this.onAbilityChange();
},
//
getSelectCertificateList() {
getSelectCertificateList().then(res => {
this.certificateData = res.data.data;
});
},
//
getWorkCenterList() {
getWorkCenterList().then(res => {
this.wcData = res.data.data || [];
});
},
//
getCraftAbility() {
getCraftAbility().then(res => {
this.craftData = res.data.data;
});
},
//
getProcessSet() {
getProcessSet().then(res => {
this.processData = res.data.data;
});
},
onChangeData(value, type) {
if (type == 'workCenterId') {
const selectedItem = this.wcData.find(item => item.id === value);
if (selectedItem) {
this.ruleForm.workCenterName = selectedItem.wcName;
} else {
this.ruleForm.workCenterName = '';
}
}
if (type == 'craftId') {
const selectedItem = this.craftData.find(item => item.id === value);
if (selectedItem) {
this.ruleForm.craftName = selectedItem.caName;
} else {
this.ruleForm.craftName = '';
}
}
if (type == 'processId') {
const selectedItem = this.craftData.find(item => item.id === value);
if (selectedItem) {
this.ruleForm.processName = selectedItem.name;
} else {
this.ruleForm.processName = '';
}
}
if (type == 'certificateId') {
const selectedItem = this.certificateData.find(item => item.id === value);
if (selectedItem) {
this.ruleForm.certificateName = selectedItem.name;
} else {
this.ruleForm.certificateName = '';
}
}
},
closeDialog() {
this.openShow = false;
this.$emit('closeDialog');
},
submit() {
this.$refs.ruleForm.validate((isValid, invalidFields) => {
if (isValid) {
//
if (!this.validateRange()) return;
this.subLoading = true
if (this.ruleForm.partType == 0) {
this.ruleForm.standardTime = this.ruleForm.standardTime;
} else {
// abilityList
const list = this.ruleForm.abilityList || [];
// endNum 1000
if (list.length > 0) {
const lastItem = list[list.length - 1];
if (
lastItem.endNum === null ||
lastItem.endNum === '' ||
lastItem.endNum === undefined
) {
lastItem.endNum = 1000;
}
}
this.ruleForm.standardTime = JSON.stringify(this.ruleForm.abilityList);
}
if (this.title == '新增') {
addPersonAbility(this.ruleForm).then(res => {
this.subLoading = false
this.closeDialog();
}).catch(err=>{
this.subLoading = false
})
}
if (this.title == '修改') {
updatePersonAbility(this.ruleForm).then(res => {
this.closeDialog();
this.subLoading = false
}).catch(err=>{
this.subLoading = false
})
}
}
});
},
},
};
</script>
<style lang="scss" scoped>
.ability-row {
margin-bottom: 10px;
}
</style>

@ -18,21 +18,41 @@
@refresh-change="refreshChange"
@on-load="onLoad"
:before-open="beforeOpen"
:span-method="spanMethod"
>
<template #menu-left> </template>
<template #menu-left>
<el-button type="primary" @click="handleAdd">新增</el-button>
</template>
<template #menu-right> </template>
<template #menu="{ row }"> </template>
<template #menu="{ row }">
<el-button type="text" @click="handleEdit(row)">修改</el-button>
</template>
<template #standardProcessAbility="scope">
<span v-if="scope.row.partType==1||scope.row.partType==2||scope.row.partType==3">
<!-- <i v-for="(item,index) in JSON.parse(scope.row.standardProcessAbility)" :key="index">
{{ }}
</i> -->
{{ JSON.parse(scope.row.standardProcessAbility) }}
<template #standardProcessAbility="scope">
<span v-if="scope.row.partType == 0">
{{ scope.row.standardProcessAbility }}
</span>
<span v-else>
<p v-for="(item, index) in scope.row.abilityList" :key="index">
{{ `${item.startNum}≤φ<${item.endNum}`
}}{{ item.standardProcessAbility ? `,${item.standardProcessAbility}min/件` : '' }}
</p>
</span>
<span v-else>{{ scope.row.standardProcessAbility }}</span>
</template>
</avue-crud>
<!-- 新增 -->
<addEquipment
v-if="addShow"
:showDialog="addShow"
:moldAddMore="moldAddMore"
:title="title"
:rowData="rowData"
ref="addEquipment"
@closeDialog="closeDialog"
@refresh="refreshChange"
@success="success"
></addEquipment>
</basic-container>
</template>
@ -43,8 +63,12 @@ import {
addEquipAbility,
updateEquipAbility,
} from '@/api/productionSchedulingPlan/basic';
import addEquipment from './components/addEquipment.vue';
import { ElButton } from 'element-plus';
export default {
components: {},
components: {
addEquipment,
},
data() {
return {
form: {},
@ -70,8 +94,8 @@ export default {
border: true,
index: true,
selection: false,
addBtn: true,
editBtn: true,
addBtn: false,
editBtn: false,
viewBtn: false,
delBtn: true,
editBtnText: '修改',
@ -98,75 +122,32 @@ export default {
searchMenuPosition: 'right',
align: 'center',
column: [
{
label: '作业中心',
prop: 'workCenterId',
search: true,
sortable: true,
span: 12,
width: 120,
type: 'select',
filterable: true,
dicUrl: '/blade-scheduling/workCenter/findList',
rules: [
{
required: true,
message: '请选择',
trigger: 'blur',
},
],
props: {
label: 'wcName',
value: 'id',
},
change: val => {
this.onChangeData(val.item, 'workCenterId');
},
},
{
label: '作业中心',
prop: 'workCenterName',
search: false,
search: true,
sortable: true,
span: 12,
hide: true,
display: false,
},
{
label: '设备编码',
prop: 'equipCode',
label: '设备名称',
prop: 'equipName',
search: true,
sortable: true,
span: 12,
width: 120,
type: 'select',
// hide:true,
filterable: true,
dicUrl: '/blade-scheduling/equipment/findList',
props: {
label: 'deviceCode',
value: 'deviceCode',
},
rules: [
{
required: true,
message: '请选择',
trigger: 'blur',
},
],
change: val => {
this.onChangeData(val.item, 'equipName');
},
disabled: true,
},
{
label: '设备名称',
prop: 'equipName',
search: false,
label: '设备编码',
prop: 'equipCode',
search: true,
sortable: true,
span: 12,
width: 120,
disabled: true,
// display:false,
},
{
label: '设备型号',
@ -177,15 +158,6 @@ export default {
width: 120,
disabled: true,
},
// {
// label: '',
// prop: 'equipCode',
// search: true,
// sortable: true,
// span: 12,
// width: 120,
// disabled:true,
// },
{
label: '设备分类',
@ -213,31 +185,7 @@ export default {
},
],
},
{
label: '工艺能力',
prop: 'craftId',
search: false,
sortable: true,
span: 12,
width: 120,
type: 'select',
filterable: true,
dicUrl: '/blade-scheduling/craftAbility/findList',
props: {
label: 'caName',
value: 'id',
},
rules: [
{
required: true,
message: '请选择',
trigger: 'blur',
},
],
change: val => {
this.onChangeData(val.item, 'craftId');
},
},
{
label: '工艺能力',
prop: 'craftName',
@ -248,7 +196,7 @@ export default {
display: false,
},
{
label: '额定加工能力(烧结-个/热表-面积)',
label: '额定加工能力(烧结-件/热表-dm²)',
prop: 'standardProcessAbility',
search: false,
sortable: true,
@ -336,9 +284,100 @@ export default {
},
data: [],
addShow: false,
moldAddMore: false,
title: '新增',
rowData: [], //
spanArr: [
{
prop: 'workCenterName',
span: [],
},
{
prop: 'equipName',
span: [],
},
{
prop: 'equipCode',
span: [],
},
],
};
},
methods: {
//
getSpanArr() {
this.spanArr = [
{ prop: 'workCenterName', span: [] },
{ prop: 'equipName', span: [] },
{ prop: 'equipCode', span: [] },
];
this.spanArr.forEach(item => {
item.span = [];
item.pos = 0; //
for (let i = 0; i < this.data.length; i++) {
if (i === 0) {
//
item.span.push(1);
item.pos = 1;
} else {
//
if (this.data[i][item.prop] === this.data[i - 1][item.prop]) {
// +1
item.span[this.pos] += 1;
item.span.push(0);
} else {
//
item.span.push(1);
item.pos = i;
}
}
}
});
},
//
spanMethod({ row, column, rowIndex, columnIndex }) {
//
const mergeProps = ['workCenterName', 'equipName', 'equipCode'];
if (!mergeProps.includes(column.property)) {
return [1, 1];
}
//
const spanData = this.spanArr.find(item => item.prop === column.property);
console.log(9999999, column.property);
if (!spanData) {
return [1, 1];
}
const rowspan = spanData.span[rowIndex] || 1;
const colspan = rowspan > 0 ? 1 : 0;
return {
rowspan: rowspan,
colspan: colspan,
};
},
//
handleAdd() {
this.addShow = true;
this.moldAddMore = true;
this.title = '新增';
},
//
handleEdit(row) {
this.addShow = true;
this.moldAddMore = true;
this.rowData = [row];
this.title = '修改';
},
closeDialog() {
this.addShow = false;
this.onLoad(this.page, this.query);
},
beforeOpen(done, type) {
if (['edit', 'view'].includes(type)) {
// this.form.processId = this.form.processId+''
@ -442,7 +481,11 @@ export default {
this.data = res.data.data.records;
this.loading = false;
this.page.total = res.data.data.total;
this.selectionClear();
this.data.forEach(item => {
if (item.partType != 0) {
item.abilityList = JSON.parse(item.standardProcessAbility);
}
});
}
);
},

@ -18,14 +18,35 @@
@refresh-change="refreshChange"
@on-load="onLoad"
:before-open="beforeOpen"
>
<template #menu-left> </template>
<template #menu-left>
<el-button type="primary" @click="handleAdd">新增</el-button>
</template>
<template #menu-right> </template>
<template #menu="{ row }"> </template>
<template #menu="{ row }">
<el-button type="text" @click="handleEdit(row)">修改</el-button>
</template>
<template #heatTreat="scope"> </template>
<template #standardTime="scope">
<span v-if="scope.row.partType == 0">
{{ scope.row.standardTime }}
</span>
<span v-else>
<p v-for="(item, index) in scope.row.abilityList" :key="index">
{{ `${item.startNum}≤φ<${item.endNum}` }}{{ item.standardTime!=null?`,${item.standardTime}`:'' }}
</p>
</span>
</template>
</avue-crud>
<!-- 新增 -->
<addPersonnel
v-if="showDialog"
:showDialog="showDialog"
:title="title"
:rowData="rowData"
@closeDialog="closeDialog"
></addPersonnel>
</basic-container>
</template>
@ -37,8 +58,11 @@ import {
updatePersonAbility,
getSelectCertificateList,
} from '@/api/productionSchedulingPlan/basic';
import addPersonnel from './components/addPersonnel.vue';
export default {
components: {},
components: {
addPersonnel,
},
data() {
return {
form: {},
@ -64,8 +88,8 @@ export default {
border: true,
index: true,
selection: false,
addBtn: true,
editBtn: true,
addBtn: false,
editBtn: false,
viewBtn: false,
delBtn: true,
editBtnText: '修改',
@ -108,7 +132,7 @@ export default {
change: (val, row) => {
this.onChangeData(val.item, 'workCenterId');
},
rules: [
rules: [
{
required: true,
message: '请选择',
@ -197,7 +221,7 @@ export default {
search: false,
sortable: true,
span: 12,
type:'select',
type: 'select',
rules: [
{
required: true,
@ -205,16 +229,16 @@ export default {
trigger: 'blur',
},
],
dicData:[
dicData: [
{
label:'单个零件',
value:'0'
label: '单个零件',
value: '0',
},
{
label:'订单',
value:'1'
}
]
label: '订单',
value: '1',
},
],
},
{
label: '额定工时(分钟/每人每个)',
@ -222,7 +246,7 @@ export default {
search: false,
sortable: true,
span: 12,
width:250,
width: 250,
labelWidth: 220,
type: 'number',
rules: [
@ -240,17 +264,9 @@ export default {
sortable: true,
span: 12,
labelWidth: 180,
width:180,
type: 'number',
rules: [
{
required: true,
message: '请输入',
trigger: 'blur',
},
],
width: 180,
},
{
{
label: '生产标识',
prop: 'productIdent',
search: false,
@ -265,7 +281,7 @@ export default {
sortable: true,
span: 12,
type: 'select',
hide:true,
hide: true,
filterable: true,
dicUrl: '/blade-scheduling/personAbility/selectCertificateList',
props: {
@ -282,21 +298,36 @@ export default {
search: true,
sortable: true,
span: 12,
display:false,
display: false,
},
],
},
data: [],
showDialog: false,
title: '新增',
rowData: {},
};
},
methods: {
handleAdd() {
this.showDialog = true;
this.title = '新增';
},
handleEdit(row) {
this.showDialog = true;
this.title = '修改';
this.rowData = row;
},
closeDialog() {
this.showDialog = false;
this.onLoad(this.page, this.query);
},
beforeOpen(done, type) {
if (['edit', 'view'].includes(type)) {
this.form.processId = this.form.processId+''
this.form.craftId = this.form.craftId+''
this.form.workCenterId = this.form.workCenterId+''
this.form.processId = this.form.processId + '';
this.form.craftId = this.form.craftId + '';
this.form.workCenterId = this.form.workCenterId + '';
}
done();
},
@ -310,14 +341,14 @@ export default {
if (val && type == 'craftId') {
this.form.craftName = val.caName;
}
if(val && type == 'certificateId'){
if (val && type == 'certificateId') {
this.form.certificateName = val.name;
}
},
rowSave(row, done, loading) {
if(row.productIdent != ''&&row.certificateId == ''){
if (row.productIdent != '' && row.certificateId == '') {
loading();
return this.$message.error('请选择证书类型')
return this.$message.error('请选择证书类型');
}
addPersonAbility(row).then(
() => {
@ -335,10 +366,13 @@ export default {
);
},
rowUpdate(row, index, done, loading) {
console.log(row,row.productIdent != ''&&(row.certificateId == ''||row.certificateId == undefined));
if(row.productIdent != ''&&(row.certificateId == ''||row.certificateId == undefined)){
console.log(
row,
row.productIdent != '' && (row.certificateId == '' || row.certificateId == undefined)
);
if (row.productIdent != '' && (row.certificateId == '' || row.certificateId == undefined)) {
loading();
return this.$message.error('请选择证书类型')
return this.$message.error('请选择证书类型');
}
updatePersonAbility(row).then(
() => {
@ -407,7 +441,11 @@ export default {
this.data = res.data.data.records;
this.loading = false;
this.page.total = res.data.data.total;
this.selectionClear();
this.data.forEach(item => {
if (item.partType != 0) {
item.abilityList = JSON.parse(item.standardTime);
}
});
}
);
},

@ -120,7 +120,6 @@ export default {
search: true,
sortable: true,
span: 12,
hide: true,
display: false,
},
{

Loading…
Cancel
Save