|
|
@@ -146,7 +146,7 @@
|
|
|
|
|
|
<el-tab-pane label="当班产量明细" @click="showTable('印版资料')" name="third">
|
|
|
<el-table ref="multipleTable" highlight-current-row="true"
|
|
|
- :show-overflow-tooltip="true" :row-style="{ height: '20px' }"
|
|
|
+ :show-overflow-tooltip="true" :row-style="{ height: '20px' }"
|
|
|
:cell-style="{ padding: '0px' }" :header-row-style="{ height: '20px' }"
|
|
|
:header-cell-style="{ padding: '0px' }" @row-dblclick="ybupdateCompanyFunc"
|
|
|
style="width: 100%;height: 400px" border tooltip-effect="dark" :data="CLMXData" row-key="ID"
|
|
|
@@ -877,10 +877,10 @@
|
|
|
v-if="! isJPJT"
|
|
|
:show-overflow-tooltip="true"
|
|
|
@selection-change="selectionChange($event)"
|
|
|
- :row-style="{ height: '20px' }"
|
|
|
+ :row-style="{ height: '20px' }" :selectable="checkboxT"
|
|
|
:cell-style="{ padding: '0px' }" :header-row-style="{ height: '20px' }"
|
|
|
:header-cell-style="{ padding: '0px' }" @row-click="getUid"
|
|
|
- highlight-current-row="true" @row-dblclick="gytableDatadoubleClick"
|
|
|
+ highlight-current-row="true" @row-dblclick="gytableDatadoubleClick"
|
|
|
style="width: 100%;height: 70vh" border tooltip-effect="dark" :data="gytableData" row-key="ID" >
|
|
|
<el-table-column type="selection" width="55" />
|
|
|
<!-- <el-table-column align="left" label="选择" prop="工单编号" width="100"/> -->
|
|
|
@@ -2871,7 +2871,7 @@ const InspectionRecord = async () => {
|
|
|
const dbclSelection = ref('')
|
|
|
//当班产量明细复选框
|
|
|
const dbclmxSelectionChange = (selection, type) => {
|
|
|
- console.log(selection)
|
|
|
+ console.log("selection",selection)
|
|
|
if (selection.length > 1) {
|
|
|
ElMessage({type: 'warning',message: '您只能选择一条进行删除!'})
|
|
|
// 重置选择项
|
|
|
@@ -3934,13 +3934,30 @@ const JPent = async (event,key,val) => {
|
|
|
|
|
|
|
|
|
const Selection_ids = ref('')
|
|
|
+const customer = ref('')
|
|
|
// 印件资料多选、工艺资料多选
|
|
|
const selectionChange = (selection) => {
|
|
|
+ console.log(selection)
|
|
|
+ if(selection.length !==0){
|
|
|
+ customer.value = selection[0].工单编号
|
|
|
+ }else{
|
|
|
+ customer.value = ''
|
|
|
+ }
|
|
|
const ids = selection.map(item => {
|
|
|
return item.UniqId
|
|
|
})
|
|
|
Selection_ids.value = ids.join(',')
|
|
|
+ console.log(Selection_ids.value)
|
|
|
+}
|
|
|
+
|
|
|
+const checkboxT = (row, index) => {
|
|
|
+ if(customer.value != ''){
|
|
|
+ return row.工单编号 === customer.value
|
|
|
+ }else{
|
|
|
+ return true
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
//删除
|
|
|
function onDel() {
|
|
|
Chanliangdel()
|
|
|
@@ -3969,6 +3986,7 @@ const Chanliangdel = async() => {
|
|
|
})
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
//核算调整
|
|
|
function hesuan(){
|
|
|
hesuanVisible.value=true
|
|
|
@@ -4754,61 +4772,74 @@ function updateTotal() {
|
|
|
|
|
|
const addBz = async() => {
|
|
|
//数据初始化
|
|
|
- initfordata3()
|
|
|
updateTotal()
|
|
|
+ //判断机台和班组是否为空
|
|
|
if(!selectedOption.value || !BZMC.value){
|
|
|
ElMessage({
|
|
|
type: 'warning',
|
|
|
- message: '机台或者班组不能为空'
|
|
|
+ message: '机台或者班组编号不能为空'
|
|
|
})
|
|
|
return;
|
|
|
}
|
|
|
const jt = selectedOption.value.split('|')[0]//获取车间数据
|
|
|
- //判断车间分配比例【SY、PM】
|
|
|
+ //判断车间是否是【SY、PM】
|
|
|
const shouldCheckLessThanOne = !jt.includes('SY') && !jt.includes('PM');
|
|
|
console.log(fpsum.value)
|
|
|
const relevantKeys = ['percentage1', 'percentage2', 'percentage3', 'percentage4', 'percentage5', 'percentage6', 'percentage7', 'percentage8'];
|
|
|
- const values = relevantKeys.reduce((acc, key) => {
|
|
|
- const value = parseFloat(formDatas.value[key], 10);
|
|
|
- if (!isNaN(value)) {
|
|
|
- acc.push(value); // 只有当 value 不是 NaN 时才添加到数组中
|
|
|
- }
|
|
|
- return acc;
|
|
|
- }, []); // 初始化为空数组
|
|
|
+ let hasValidMember = false; // 标志变量,用于检查是否有有效的组员
|
|
|
+
|
|
|
+ // 循环检查每个成员
|
|
|
+ for (let i = 1; i <= relevantKeys.length; i++) {
|
|
|
+ const codeKey = `code${i}`;
|
|
|
+ const nameKey = `name${i}`;
|
|
|
+ const percentageKey = `percentage${i}`;
|
|
|
+ const percentageValue = parseFloat(formDatas.value[percentageKey], 10); //获取分配系数的值
|
|
|
+ //编号为空时清空名称和分配系数
|
|
|
+ (function(index) {
|
|
|
+ watch(
|
|
|
+ () => formDatas.value[codeKey],
|
|
|
+ (newVal, oldVal) => {
|
|
|
+ if (!newVal) {
|
|
|
+ formDatas.value[nameKey] = '';
|
|
|
+ formDatas.value[percentageKey] = '';
|
|
|
+ }
|
|
|
+ }
|
|
|
+ );
|
|
|
+ })(i); // 使用立即执行的函数表达式(IIFE)来捕获当前的i值
|
|
|
|
|
|
-// for(let i=0;i<relevantKeys.length;i++){
|
|
|
-// if(formDatas.code[i] && formDatas.name[i]){
|
|
|
-// console.log('有组员')
|
|
|
-// }
|
|
|
-// }
|
|
|
- //判断分配系数是否在0-1之间
|
|
|
- const hasInvalidValue = values.some(value => value <= 0 || value > 1);
|
|
|
- console.log(hasInvalidValue);
|
|
|
- if (hasInvalidValue) {
|
|
|
- ElMessage({
|
|
|
- type: "error",
|
|
|
- message: "组员分配系数有误",
|
|
|
- });
|
|
|
- return;
|
|
|
+ if (formDatas.value[codeKey] || formDatas.value[nameKey]) {
|
|
|
+ console.log('有组员');
|
|
|
+ if (isNaN(percentageValue) || percentageValue <= 0 || percentageValue > 1) {
|
|
|
+ console.log('分配系数不能小于等于0或者大于1,或者该值为NaN');
|
|
|
+ } else {
|
|
|
+ hasValidMember = true; // 如果有有效的百分比值,则设置标志变量为true
|
|
|
+ }
|
|
|
}
|
|
|
-
|
|
|
- //全部机台组员合计不能大于1
|
|
|
- if (fpsum.value > 1) {
|
|
|
+}
|
|
|
+
|
|
|
+// 循环结束后检查标志变量
|
|
|
+if (!hasValidMember) {
|
|
|
+ // 如果没有有效的组员(即所有百分比值都无效或为空),则显示错误消息
|
|
|
+ ElMessage({
|
|
|
+ type: "error",
|
|
|
+ message: "所有组员的分配系数必须填写且值应在0到1之间",
|
|
|
+ });
|
|
|
+}else if (shouldCheckLessThanOne && fpsum.value < 1) {//如果有组员,并且 shouldCheckLessThanOne 为 true(不是PM和SY机器),则检查 fpsum.value < 1
|
|
|
ElMessage({
|
|
|
type: "error",
|
|
|
- message: "分配系数相加不能大于1",
|
|
|
- });
|
|
|
+ message: "分配系数相加不能小于1",
|
|
|
+ });
|
|
|
return;
|
|
|
- }
|
|
|
-
|
|
|
- // 只有当 shouldCheckLessThanOne 为 true 时才检查 fpsum.value < 1
|
|
|
- if (shouldCheckLessThanOne && fpsum.value < 1) {
|
|
|
+ }else if(fpsum.value > 1) { //所有机器的分配系数之和不能大于1
|
|
|
ElMessage({
|
|
|
type: "error",
|
|
|
- message: "分配系数相加不能小于1",
|
|
|
- });
|
|
|
+ message: "分配系数相加不能大于1",
|
|
|
+ });
|
|
|
return;
|
|
|
}
|
|
|
+ return;
|
|
|
+
|
|
|
+
|
|
|
|
|
|
const response = await MachineTeamAdd({
|
|
|
sczl_jtbh: selectedOption.value.split('|')[0],
|
|
|
@@ -4857,7 +4888,7 @@ const selectBz = async() => {
|
|
|
return;
|
|
|
}
|
|
|
const jt = selectedOption.value.split('|')[0]//获取车间数据
|
|
|
- //判断车间分配比例【SY、PM、WY】
|
|
|
+ //判断车间分配比例【SY、PM】
|
|
|
const shouldCheckLessThanOne = !jt.includes('SY') && !jt.includes('PM');
|
|
|
const relevantKeys = ['percentage1', 'percentage2', 'percentage3', 'percentage4', 'percentage5', 'percentage6', 'percentage7', 'percentage8'];
|
|
|
const values = relevantKeys.reduce((acc, key) => {
|