parent
9d3d68148e
commit
b85b12209d
18 changed files with 1196 additions and 100 deletions
@ -0,0 +1,76 @@ |
||||
import request from '@/axios'; |
||||
|
||||
// 工艺能力下拉
|
||||
export const getCapability = () =>{ |
||||
return request({ |
||||
url:'/api/blade-desk/BA/craftAbility/findList', |
||||
method:'get' |
||||
}) |
||||
} |
||||
|
||||
// 生产标识下拉
|
||||
export const getProduction = () =>{ |
||||
return request({ |
||||
url:'/api/blade-scheduling/qualityGrade/getGrades', |
||||
method:'get' |
||||
}) |
||||
} |
||||
|
||||
// 外协厂商下拉
|
||||
export const getOutsourcing = () =>{ |
||||
return request({ |
||||
url:'/api/blade-desk/BA/Oem/listForSelect', |
||||
method:'get' |
||||
}) |
||||
} |
||||
|
||||
// 作业中心下拉
|
||||
export const getWorkCenter = () =>{ |
||||
return request({ |
||||
url:'/api/blade-desk/BA/WorkCenter/listForSelect', |
||||
method:'get' |
||||
}) |
||||
} |
||||
|
||||
// 分派规则列表
|
||||
export const getList = (params) => { |
||||
return request({ |
||||
url: '/api/blade-desk/bsAssign/page', |
||||
method: 'get', |
||||
params |
||||
}); |
||||
}; |
||||
|
||||
// 获取指定类型字典
|
||||
export const getPointRule = () => { |
||||
return request({ |
||||
url: '/api/blade-system/dict/dictionary?code=AssignPoint', |
||||
method: 'get', |
||||
}); |
||||
}; |
||||
|
||||
// 获取限制类型字典
|
||||
export const getLimitRule = () => { |
||||
return request({ |
||||
url: '/api/blade-system/dict/dictionary?code=AssignLimit', |
||||
method: 'get', |
||||
}); |
||||
}; |
||||
|
||||
// 保存分派规则
|
||||
export const saveRules = (data) => { |
||||
return request({ |
||||
url: '/api/blade-desk/bsAssign/saveBat', |
||||
method: 'post', |
||||
data, |
||||
}); |
||||
}; |
||||
|
||||
// 删除分派规则
|
||||
export const deleteRules = (params) => { |
||||
return request({ |
||||
url: '/api/blade-desk/bsAssign/remove', |
||||
method: 'post', |
||||
params, |
||||
}); |
||||
}; |
||||
@ -0,0 +1,159 @@ |
||||
export function calcTank(data,row,equation){ |
||||
|
||||
// 1. 获取最后一条
|
||||
const lastItem = row; |
||||
const tankId = lastItem.workTankId; |
||||
|
||||
// 2. 构建同 tankId 的药剂映射
|
||||
const chemMap = {}; |
||||
data.forEach(item => { |
||||
if (item.workTankId === tankId) { |
||||
chemMap[item.testElement] = { |
||||
actualAddValue: item.actualAddValue || 0, |
||||
fillingLocation: item.fillingLocation || 0, |
||||
firstTestValue:item.firstTestValue || 0 |
||||
}; |
||||
} |
||||
}); |
||||
|
||||
// 3. 本条自身值
|
||||
const self = { |
||||
'实际添加量': row.actualAddValue || 0, |
||||
'体积': row.volume || 0, |
||||
'测量值': row.firstTestValue || 0, |
||||
'添加点': row.fillingLocation || 0 |
||||
}; |
||||
|
||||
// 4. 替换公式
|
||||
let formula = equation |
||||
|
||||
// 替换 <药剂名>实际添加量 和 <药剂名>添加点,找不到则为 0
|
||||
formula = formula.replace(/([^\s+*/\-(){}[\]]+?)(实际添加量|添加点|测量值)/g, (match, name, suffix) => { |
||||
const chem = chemMap[name]; |
||||
console.log('name--------',name) |
||||
console.log('chem--------',chem) |
||||
if(name != ''){ |
||||
if (chem) { |
||||
if (suffix === '实际添加量') { |
||||
return String(chem.actualAddValue); |
||||
} else if (suffix === '添加点') { |
||||
return String(chem.fillingLocation); |
||||
}else if (suffix === '测量值') { |
||||
return String(chem.firstTestValue); |
||||
} |
||||
// return String(suffix === '实际添加量' ? chem.actualValue : chem.addPoint);
|
||||
}else{ |
||||
return '0' |
||||
} |
||||
}else{ |
||||
return '0' |
||||
} |
||||
|
||||
// return '0'; // 未找到,替换为 0
|
||||
}); |
||||
|
||||
// 替换通用字段
|
||||
const globalReplacements = { |
||||
'实际添加量': self['实际添加量'], |
||||
'体积': self['体积'], |
||||
'测量值': self['测量值'], |
||||
'添加点': self['添加点'], |
||||
}; |
||||
|
||||
for (const [key, value] of Object.entries(globalReplacements)) { |
||||
const escapedKey = key.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); |
||||
formula = formula.replace(new RegExp(escapedKey, 'g'), String(value)); |
||||
} |
||||
|
||||
// 5. 转为合法 JS 表达式
|
||||
let expr = formula |
||||
.replace(/{/g, '(') |
||||
.replace(/}/g, ')') |
||||
.replace(/\s+/g, ''); |
||||
console.log('expo--------',expr) |
||||
return expr; |
||||
|
||||
// const tankId = row.workTankId;
|
||||
|
||||
// // 2. 构建同 tankId 下 name -> { actualAddValue, fillingLocation }
|
||||
// const chemMap = {};
|
||||
// data.forEach(item => {
|
||||
// if (item.workTankId === tankId) {
|
||||
// chemMap[item.testElement] = {
|
||||
// actualAddValue: item.actualAddValue || 0,
|
||||
// fillingLocation: item.fillingLocation || 0,
|
||||
// firstTestValue:item.firstTestValue || 0
|
||||
// };
|
||||
// }
|
||||
// });
|
||||
|
||||
// // 3. 本条自身值
|
||||
// const self = {
|
||||
// '实际添加量': row.actualAddValue || 0,
|
||||
// '体积': row.volume || 0,
|
||||
// '测量值': row.firstTestValue || 0,
|
||||
// '添加点': row.fillingLocation || 0
|
||||
// };
|
||||
|
||||
// // 4. 复制公式
|
||||
// let formula = equation;
|
||||
|
||||
// // 5. 先处理 "<药剂名>实际添加量" 和 "<药剂名>添加点"
|
||||
// // 使用正则匹配:连续非运算符字符 + "实际添加量" 或 "添加点"
|
||||
// formula = formula.replace(/([^\s+*/\-(){}[\]]+?)(实际添加量|添加点|添加量|测量值)/g, (match, name, suffix) => {
|
||||
// const chem = chemMap[name];
|
||||
// console.log('chem---------',chem)
|
||||
// // if (chem) {
|
||||
// // return String(suffix === '实际添加量' ? chem.actualValue : chem.addPoint);
|
||||
// // } else {
|
||||
// // // 未找到对应药剂,替换为 0
|
||||
// // return '0';
|
||||
// // }
|
||||
// if (chem) {
|
||||
// if (suffix === '实际添加量') {
|
||||
// return String(chem.actualAddValue);
|
||||
// } else if (suffix === '添加点') {
|
||||
// return String(chem.fillingLocation);
|
||||
// }else if (suffix === '添加量') {
|
||||
// return String(chem.actualAddValue);
|
||||
// }else if (suffix === '测量值') {
|
||||
// return String(chem.firstTestValue);
|
||||
// }
|
||||
// }
|
||||
// // 如果找不到,保留原样(避免破坏公式)
|
||||
// return match;
|
||||
// });
|
||||
|
||||
// // 6. 再替换通用字段(注意顺序:先长后短,但这里无包含关系)
|
||||
// const globalReplacements = {
|
||||
// '实际添加量': self['实际添加量'],
|
||||
// '体积': self['体积'],
|
||||
// '测量值': self['测量值'],
|
||||
// '添加点': self['添加点'],
|
||||
// };
|
||||
|
||||
// for (const [key, value] of Object.entries(globalReplacements)) {
|
||||
// // 转义特殊字符(虽然中文一般不需要,但安全起见)
|
||||
// const escapedKey = key.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
||||
// const regex = new RegExp(escapedKey, 'g');
|
||||
// formula = formula.replace(regex, String(value));
|
||||
// }
|
||||
// let jsExpr = formula
|
||||
// .replace(/{/g, '(')
|
||||
// .replace(/}/g, ')')
|
||||
// .replace(/\s+/g, ''); // 去掉空格(可选,但更安全)
|
||||
// return jsExpr;
|
||||
} |
||||
|
||||
export function safeEval(expr) { |
||||
// 只允许数字、括号、+ - * / . 等安全字符
|
||||
if (!/^[\d+\-*/().]+$/.test(expr)) { |
||||
throw new Error("公式包含非法字符"); |
||||
} |
||||
try { |
||||
// 使用 Function 而非 eval 更安全(无作用域访问)
|
||||
return new Function('return (' + expr + ')')(); |
||||
} catch (e) { |
||||
throw new Error("公式计算失败: " + e.message); |
||||
} |
||||
} |
||||
@ -0,0 +1,352 @@ |
||||
<template> |
||||
<el-dialog title="新增" append-to-body :modelValue="openShow" fullscreen @close="closeDialog"> |
||||
<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> |
||||
<el-table-column type="selection" width="55"></el-table-column> |
||||
<el-table-column align="center" label="工艺能力" prop="craftAbilityId"> |
||||
<template #header> |
||||
<span><i style="color: red">*</i>工艺能力</span> |
||||
</template> |
||||
<template #default="scope"> |
||||
<el-form-item :prop="`tableData[${scope.$index}].craftAbilityId`" :rules="formRules.craftAbilityId"> |
||||
<el-select |
||||
v-model="scope.row.craftAbilityId" |
||||
placeholder="请选择" |
||||
style="width: 100%" |
||||
> |
||||
<el-option |
||||
v-for="item in capabilityData" |
||||
: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="零件号" prop="partCode"> |
||||
<template #default="scope"> |
||||
<el-form-item :prop="`tableData[${scope.$index}].partCode`" :rules="formRules.partCode"> |
||||
<el-input v-model="scope.row.partCode" placeholder="请输入零件号"></el-input> |
||||
</el-form-item> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column align="center" label="生产标识" prop="prodMarkId"> |
||||
<template #default="scope"> |
||||
<el-form-item :prop="`tableData[${scope.$index}].prodMarkId`" :rules="formRules.prodMarkId"> |
||||
<el-select |
||||
multiple |
||||
v-model="scope.row.prodMarkId" |
||||
placeholder="请选择生产标识" |
||||
style="width: 100%" |
||||
> |
||||
<el-option |
||||
v-for="item in identificationData" |
||||
:key="item.id" |
||||
:value="item.id" |
||||
:label="item.qualityGrade" |
||||
></el-option> |
||||
</el-select> |
||||
</el-form-item> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column align="center" label="单件面积上限(dm²)" prop="upArea"> |
||||
<template #default="scope"> |
||||
<el-form-item :prop="`tableData[${scope.$index}].upArea`" :rules="formRules.upArea"> |
||||
<el-input v-model="scope.row.upArea" placeholder="请输入单件面积上限"></el-input> |
||||
</el-form-item> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column align="center" label="单件面积下限(dm²)" prop="lowArea"> |
||||
<template #default="scope"> |
||||
<el-form-item :prop="`tableData[${scope.$index}].lowArea`" :rules="formRules.lowArea"> |
||||
<el-input v-model="scope.row.lowArea" placeholder="请输入单件面积下限"></el-input> |
||||
</el-form-item> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column align="center" label="单批面积上限(dm²)" prop="singleUpArea"> |
||||
<template #default="scope"> |
||||
<el-form-item :prop="`tableData[${scope.$index}].singleUpArea`" :rules="formRules.singleUpArea"> |
||||
<el-input v-model="scope.row.singleUpArea" placeholder="请输入单批面积上限"></el-input> |
||||
</el-form-item> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column align="center" label="单批面积下限(dm²)" prop="singleDownArea"> |
||||
<template #default="scope"> |
||||
<el-form-item :prop="`tableData[${scope.$index}].singleDownArea`" :rules="formRules.singleDownArea"> |
||||
<el-input v-model="scope.row.singleDownArea" placeholder="请输入单批面积下限"></el-input> |
||||
</el-form-item> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column align="center" label="限制类型" prop="limitType"> |
||||
<template #header> |
||||
<span><i style="color: red">*</i>限制类型</span> |
||||
</template> |
||||
<template #default="scope"> |
||||
<el-form-item :prop="`tableData[${scope.$index}].limitType`" :rules="formRules.limitType"> |
||||
<el-select |
||||
v-model="scope.row.limitType" |
||||
placeholder="请选择限制类型" |
||||
style="width: 100%" |
||||
> |
||||
<el-option v-for="item in limitRule" :key="item.id" :value="item.dictKey" :label="item.dictValue"></el-option> |
||||
<!-- <el-option label="必须" :value="1"></el-option> --> |
||||
</el-select> |
||||
</el-form-item> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column align="center" label="指定类型" prop="pointType"> |
||||
<template #header> |
||||
<span><i style="color: red">*</i>指定类型</span> |
||||
</template> |
||||
<template #default="scope"> |
||||
<el-form-item :prop="`tableData[${scope.$index}].pointType`" :rules="formRules.pointType"> |
||||
<el-select |
||||
v-model="scope.row.pointType" |
||||
placeholder="请选择指定类型" |
||||
style="width: 100%" |
||||
> |
||||
<el-option v-for="item in pointRule" :key="item.id" :value="item.dictKey" :label="item.dictValue"></el-option> |
||||
<!-- <el-option label="厂内" value="1"></el-option> |
||||
<el-option label="外协" value="2"></el-option> --> |
||||
</el-select> |
||||
</el-form-item> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column align="center" label="外协厂商" prop="oemId"> |
||||
<!-- <template #header v-if="showOem"> |
||||
<span><i style="color: red">*</i>外协厂商</span> |
||||
</template> --> |
||||
<template #default="scope"> |
||||
<el-form-item :prop="`tableData[${scope.$index}].oemId`" :rules="formRules.oemId"> |
||||
<el-select |
||||
v-model="scope.row.oemId" |
||||
placeholder="请选择外协厂商" |
||||
style="width: 100%" |
||||
> |
||||
<el-option v-for="item in companyData" :label="item.ocName" :key="item.id" :value="item.id"></el-option> |
||||
</el-select> |
||||
</el-form-item> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column align="center" label="作业中心" prop="centerId"> |
||||
<!-- <template #header v-if="showCenter"> |
||||
<span><i style="color: red">*</i>作业中心</span> |
||||
</template> --> |
||||
<template #default="scope"> |
||||
<el-form-item :prop="`tableData[${scope.$index}].centerId`" :rules="formRules.centerId"> |
||||
<el-select |
||||
v-model="scope.row.centerId" |
||||
placeholder="请选择作业中心" |
||||
style="width: 100%" |
||||
> |
||||
<el-option v-for="item in workCenterData" :label="item.wcName" :key="item.id" :value="item.id"></el-option> |
||||
</el-select> |
||||
</el-form-item> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column align="center" label="备注" prop="remark"> |
||||
<template #default="scope"> |
||||
<el-form-item :prop="`tableData[${scope.$index}].remark`" :rules="formRules.remark"> |
||||
<el-input v-model="scope.row.remark" placeholder="请输入备注"></el-input> |
||||
</el-form-item> |
||||
</template> |
||||
</el-table-column> |
||||
</el-table> |
||||
</el-form> |
||||
<template #footer> |
||||
<span class="dialog-footer"> |
||||
<el-button @click="closeDialog">取 消</el-button> |
||||
<el-button type="primary" @click="submit">保 存</el-button> |
||||
</span> |
||||
</template> |
||||
</el-dialog> |
||||
</template> |
||||
|
||||
<script> |
||||
import {getCapability,getProduction,getOutsourcing,getWorkCenter,getLimitRule, |
||||
getPointRule,saveRules} from "@/api/basicData/ruleMaintenance" |
||||
export default { |
||||
props:{ |
||||
isOpen:{ |
||||
type:Boolean, |
||||
default:false |
||||
}, |
||||
moldAddMore:{ |
||||
type:Boolean, |
||||
default:false |
||||
}, |
||||
row:{ |
||||
type:Object, |
||||
default:{} |
||||
} |
||||
}, |
||||
data(){ |
||||
return{ |
||||
openShow:false, |
||||
formError:'', |
||||
showOem:false, |
||||
showCenter:false, |
||||
form:{ |
||||
tableData:[] |
||||
}, |
||||
formRules:{ |
||||
craftAbilityId:[ |
||||
{ required: true, message: '请选择工艺能力', trigger: ['change', 'submit'] } |
||||
], |
||||
limitType:[ |
||||
{ required: true, message: '请选择限制类型', trigger: ['change', 'submit'] } |
||||
], |
||||
pointType:[ |
||||
{ required: true, message: '请选择指定类型', trigger: ['change', 'submit'] } |
||||
], |
||||
}, |
||||
capabilityData:[], |
||||
identificationData:[], |
||||
companyData:[], |
||||
workCenterData:[], |
||||
pointRule:[], |
||||
limitRule:[] |
||||
} |
||||
}, |
||||
async mounted(){ |
||||
// this.getCapability(); |
||||
// this.getProduction(); |
||||
// this.getOutsourcing(); |
||||
// this.getWorkCenter(); |
||||
// this.getPointRule() |
||||
// this.getLimitRule() |
||||
const pointData = await getPointRule() |
||||
this.pointRule = pointData.data.data |
||||
const limitData = await getLimitRule() |
||||
this.limitRule = limitData.data.data |
||||
const capaRes = await getCapability() |
||||
this.capabilityData = capaRes.data.data |
||||
const companyRes = await getOutsourcing() |
||||
this.companyData = companyRes.data.data |
||||
const idenRes = await getProduction() |
||||
this.identificationData = idenRes.data.data |
||||
const worlRes = await getWorkCenter() |
||||
this.workCenterData = worlRes.data.data |
||||
if(JSON.stringify(this.row) != '{}'){ |
||||
this.row.craftAbilityId = this.row.craftAbilityId + '' |
||||
this.row.centerId = this.row.centerId == -1 ? '' : this.row.centerId + '' |
||||
this.row.oemId = this.row.oemId == -1 ? '' : this.row.oemId + '' |
||||
this.form.tableData[0] = this.row |
||||
} |
||||
console.log('this.row', this.row) |
||||
this.openShow = this.isOpen; |
||||
|
||||
}, |
||||
methods:{ |
||||
getPointRule(){ |
||||
getPointRule().then(res =>{ |
||||
this.pointRule = res.data.data |
||||
}) |
||||
}, |
||||
getLimitRule(){ |
||||
getLimitRule().then(res =>{ |
||||
this.limitRule = res.data.data |
||||
}) |
||||
}, |
||||
getCapability(){ |
||||
getCapability().then(res =>{ |
||||
this.capabilityData = res.data.data; |
||||
}) |
||||
}, |
||||
getProduction(){ |
||||
getProduction().then(res =>{ |
||||
this.identificationData = res.data.data; |
||||
}) |
||||
}, |
||||
getOutsourcing(){ |
||||
getOutsourcing().then(res =>{ |
||||
this.companyData = res.data.data; |
||||
}) |
||||
}, |
||||
getWorkCenter(){ |
||||
getWorkCenter().then(res =>{ |
||||
this.workCenterData = res.data.data; |
||||
}) |
||||
}, |
||||
selectChange(list, row) { |
||||
row._select = !row._select; |
||||
}, |
||||
// 删除选中行 |
||||
delTable() { |
||||
this.form.tableData = this.form.tableData.filter(row => !row._select); |
||||
}, |
||||
addTable(){ |
||||
this.form.tableData.push({ |
||||
_select:false |
||||
}) |
||||
}, |
||||
submit(){ |
||||
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; |
||||
} |
||||
this.form.tableData.map(item =>{ |
||||
if(item.pointType == 1 && (!item.oemId || item.oemId == '')){ |
||||
this.formError = '指定类型为外协时,请选择外协厂商'; |
||||
return |
||||
} |
||||
if(item.pointType == 0 && (!item.centerId || item.centerId == '')){ |
||||
this.formError = '指定类型为厂内时,请选择作业中心'; |
||||
return |
||||
} |
||||
}) |
||||
|
||||
console.log('form----------',this.form.tableData) |
||||
// 校验通过:准备提交数据(过滤无用字段) |
||||
const submitData = this.form.tableData.map(row => { |
||||
row.prodMarkId = row.prodMarkId && row.prodMarkId.length != 0 && row.prodMarkId.join(',') |
||||
const { _select, ...validData } = row; // 剔除选择状态字段 |
||||
return validData; |
||||
}); |
||||
saveRules(submitData).then(res =>{ |
||||
if(res.data.code == 200){ |
||||
this.$message.success('保存成功'); |
||||
this.closeDialog(true); |
||||
} |
||||
}) |
||||
}) |
||||
}, |
||||
closeDialog(val){ |
||||
this.openShow = false; |
||||
this.$emit('closeDialog',val); |
||||
} |
||||
} |
||||
} |
||||
</script> |
||||
|
||||
<style lang="scss" scoped> |
||||
::v-deep .el-form-item{ |
||||
margin-top: 15px !important; |
||||
} |
||||
</style> |
||||
@ -0,0 +1,352 @@ |
||||
<template> |
||||
<basic-container> |
||||
<avue-crud |
||||
:option="option" |
||||
:table-loading="loading" |
||||
:data="data" |
||||
v-model="form" |
||||
v-model:page="page" |
||||
ref="crud" |
||||
@search-change="searchChange" |
||||
@search-reset="searchReset" |
||||
@selection-change="selectionChange" |
||||
@current-change="currentChange" |
||||
@size-change="sizeChange" |
||||
@refresh-change="refreshChange" |
||||
@on-load="onLoad" |
||||
> |
||||
<template #singleArea="{row}"> |
||||
{{row.lowArea + '~' + row.upArea }} |
||||
</template> |
||||
<template #batchArea="{row}"> |
||||
{{row.singleDownArea + '~' + row.singleUpArea }} |
||||
</template> |
||||
<template #menu-left> |
||||
<el-button type="primary" @click="handleAdd">新增</el-button> |
||||
<el-button type="danger" @click="handleDelete">删除</el-button> |
||||
</template> |
||||
<template #menu="scope"> |
||||
<el-button type="text" @click="editRow(scope.row)">编辑</el-button> |
||||
<el-button type="text" @click="rowDel(scope.row)">删除</el-button> |
||||
</template> |
||||
</avue-crud> |
||||
<add-rule-dialog v-if="showDialog" :isOpen="showDialog" :row="checkRow" :moldAddMore="moldAddMore" @closeDialog="closeDialog"></add-rule-dialog> |
||||
</basic-container> |
||||
</template> |
||||
|
||||
<script> |
||||
import addRuleDialog from './components/addRuleDialog.vue' |
||||
import {getList,deleteRules} from "@/api/basicData/ruleMaintenance" |
||||
export default { |
||||
components: { addRuleDialog }, |
||||
data() { |
||||
return { |
||||
moldAddMore:false, |
||||
loading: false, |
||||
showDialog:false, |
||||
page: { |
||||
total: 0, |
||||
currentPage: 1, |
||||
pageSize: 10, |
||||
}, |
||||
data: [], |
||||
form: {}, |
||||
selectionList:[], |
||||
option: { |
||||
height: "auto", |
||||
calcHeight: 32, |
||||
tip: false, |
||||
size: "medium", |
||||
simplePage: true, |
||||
searchShow: true, |
||||
searchMenuSpan: 6, |
||||
searchIcon: true, |
||||
searchIndex: 3, |
||||
tree: false, |
||||
border: true, |
||||
index: true, |
||||
selection: true, |
||||
viewBtn: false, |
||||
delBtn: false, |
||||
editBtn: false, |
||||
addBtn: false, |
||||
editBtnText: "修改", |
||||
viewBtnIcon: " ", |
||||
delBtnIcon: " ", |
||||
editBtnIcon: " ", |
||||
viewBtnText: "详情", |
||||
labelWidth: 120, |
||||
menuWidth: 120, |
||||
dialogWidth: 1040, |
||||
dialogClickModal: false, |
||||
searchEnter: true, |
||||
excelBtn: false, |
||||
filterBtn: true, |
||||
searchShowBtn: false, |
||||
columnSort: true, |
||||
excelBtn: true, |
||||
columnSort: true, |
||||
index: false, |
||||
showOverflowTooltip: true, |
||||
searchLabelPosition: "left", |
||||
searchLabelPosition: "left", |
||||
searchGutter: 24, |
||||
searchSpan: 6, |
||||
menuAlign: "center", |
||||
gridBtn: false, |
||||
searchMenuPosition: "right", |
||||
addBtnIcon: " ", |
||||
viewBtnIcon: " ", |
||||
delBtnIcon: " ", |
||||
editBtnIcon: " ", |
||||
align: "center", |
||||
column: [ |
||||
{ |
||||
label: "工艺能力", |
||||
prop: "craftAbilityId", |
||||
type:"select", |
||||
sortable: false, |
||||
filter: true, |
||||
span: 12, |
||||
search: true, |
||||
dicUrl:"/blade-desk/BA/craftAbility/findList", |
||||
props:{ |
||||
label:"caName", |
||||
value:"id" |
||||
}, |
||||
width:200, |
||||
}, |
||||
{ |
||||
label: "零件号", |
||||
prop: "partCode", |
||||
sortable: false, |
||||
filter: true, |
||||
span: 12, |
||||
width:150, |
||||
search: true, |
||||
}, |
||||
{ |
||||
label: "生产标识", |
||||
prop: "prodMark", |
||||
// type:"select", |
||||
sortable: false, |
||||
filter: true, |
||||
span: 12, |
||||
width:150, |
||||
search: false, |
||||
multiple: true, |
||||
// dicUrl:"/blade-scheduling/qualityGrade/getGrades", |
||||
// props:{ |
||||
// label:"qualityGrade", |
||||
// value:"id" |
||||
// } |
||||
}, |
||||
{ |
||||
label: "单件面积上下限(dm²)", |
||||
prop: "singleArea", |
||||
sortable: false, |
||||
filter: true, |
||||
span: 12, |
||||
width:200, |
||||
search: false, |
||||
multiple: true, |
||||
}, |
||||
{ |
||||
label: "单批面积上下限(dm²)", |
||||
prop: "batchArea", |
||||
sortable: false, |
||||
filter: true, |
||||
width:200, |
||||
span: 12, |
||||
search: false, |
||||
multiple: true, |
||||
}, |
||||
{ |
||||
label: "限制类型", |
||||
prop: "limitType", |
||||
type:"select", |
||||
sortable: false, |
||||
filter: true, |
||||
span: 12, |
||||
search: true, |
||||
width:200, |
||||
dicUrl:'/api/blade-system/dict/dictionary?code=AssignLimit', |
||||
props:{ |
||||
label:"dictValue", |
||||
value:"dictKey" |
||||
} |
||||
// dicData:[ |
||||
// {label:"必须",value:1} |
||||
// ] |
||||
}, |
||||
{ |
||||
label: "指定类型", |
||||
prop: "pointType", |
||||
type:"select", |
||||
sortable: false, |
||||
filter: true, |
||||
span: 12, |
||||
search: true, |
||||
width:200, |
||||
dicUrl:'/api/blade-system/dict/dictionary?code=AssignPoint', |
||||
props:{ |
||||
label:"dictValue", |
||||
value:"dictKey" |
||||
} |
||||
// dicData:[ |
||||
// {label:"厂内",value:1}, |
||||
// {label:"外协",value:2}, |
||||
// ] |
||||
}, |
||||
{ |
||||
label: "外协厂商", |
||||
prop: "oemId", |
||||
type:'select', |
||||
sortable: false, |
||||
filter: true, |
||||
span: 12, |
||||
search: true, |
||||
width:200, |
||||
dicUrl:"/api/blade-desk/BA/Oem/listForSelect", |
||||
props:{ |
||||
label:"ocName", |
||||
value:"id" |
||||
} |
||||
}, |
||||
{ |
||||
label: "作业中心", |
||||
prop: "centerId", |
||||
type:'select', |
||||
sortable: false, |
||||
filter: true, |
||||
span: 12, |
||||
search: true, |
||||
width:200, |
||||
dicUrl:"/api/blade-desk/BA/WorkCenter/listForSelect", |
||||
props:{ |
||||
label:"wcName", |
||||
value:"id" |
||||
} |
||||
}, |
||||
{ |
||||
label: "备注", |
||||
prop: "remark", |
||||
sortable: false, |
||||
filter: true, |
||||
width:150, |
||||
span: 12, |
||||
search: false, |
||||
}, |
||||
{ |
||||
label: "维护人", |
||||
prop: "createUserName", |
||||
sortable: false, |
||||
filter: true, |
||||
width:150, |
||||
span: 12, |
||||
search: false, |
||||
}, |
||||
{ |
||||
label: "维护时间", |
||||
prop: "createTime", |
||||
sortable: false, |
||||
width:200, |
||||
filter: true, |
||||
span: 12, |
||||
search: false, |
||||
}, |
||||
] |
||||
}, |
||||
checkRow:{} |
||||
} |
||||
}, |
||||
mounted() { |
||||
}, |
||||
methods:{ |
||||
handleAdd(){ |
||||
this.checkRow = {} |
||||
this.moldAddMore = true |
||||
this.showDialog = true |
||||
}, |
||||
selectionChange(list){ |
||||
this.selectionList = list |
||||
}, |
||||
handleDelete(){ |
||||
if(this.selectionList.length == 0){ |
||||
this.$message.error('请至少选择一条数据') |
||||
return |
||||
} |
||||
this.$confirm('确定删除数据吗?', { |
||||
confirmButtonText: '确定', |
||||
cancelButtonText: '取消', |
||||
type: 'warning', |
||||
}).then(() => { |
||||
deleteRules({ |
||||
ids:this.selectionList.map(item => item.id).join(',') |
||||
}).then(res =>{ |
||||
this.$message.success('删除成功') |
||||
this.onLoad() |
||||
}) |
||||
}) |
||||
}, |
||||
editRow(row){ |
||||
this.moldAddMore = false |
||||
this.checkRow = row |
||||
this.showDialog = true |
||||
}, |
||||
rowDel(row){ |
||||
this.$confirm('确定删除数据吗?', { |
||||
confirmButtonText: '确定', |
||||
cancelButtonText: '取消', |
||||
type: 'warning', |
||||
}).then(() => { |
||||
deleteRules({ |
||||
ids:row.id |
||||
}).then(res =>{ |
||||
this.$message.success('删除成功') |
||||
this.onLoad() |
||||
}) |
||||
}) |
||||
}, |
||||
closeDialog(val){ |
||||
this.showDialog = false |
||||
if(val){ |
||||
this.onLoad() |
||||
} |
||||
}, |
||||
searchChange(params, done){ |
||||
this.query = params; |
||||
this.page.currentPage = 1 |
||||
this.onLoad() |
||||
done() |
||||
}, |
||||
searchReset(){ |
||||
this.query = {} |
||||
this.onLoad() |
||||
}, |
||||
currentChange(currentPage){ |
||||
this.page.currentPage = currentPage |
||||
}, |
||||
sizeChange( pageSize){ |
||||
this.page.pageSize = pageSize |
||||
}, |
||||
refreshChange(){ |
||||
this.onLoad() |
||||
}, |
||||
onLoad(){ |
||||
getList({ |
||||
current:this.page.currentPage, |
||||
size:this.page.pageSize, |
||||
...this.query |
||||
}).then(res =>{ |
||||
this.data = res.data.data.records |
||||
this.page.total = res.data.data.total |
||||
}) |
||||
} |
||||
} |
||||
} |
||||
</script> |
||||
|
||||
<style> |
||||
|
||||
</style> |
||||
Loading…
Reference in new issue