<template>
|
<view>
|
<!-- 主表区域 -->
|
<view class="bill-main-area">
|
<!-- 主表页签 -->
|
<view class="bill-main-tabs">
|
<view :class="mainTabSelected == 1 ? 'selected' : ''" @tap="mainTabSelected = 1">基本信息</view>
|
<view :class="mainTabSelected == 2 ? 'selected' : ''" @tap="mainTabSelected = 2">其他信息</view>
|
<view :class="mainTabSelected == 3 ? 'selected' : ''" @tap="mainTabSelected = 3">制单信息</view>
|
</view>
|
<!-- 主表内容 -->
|
<view class="bill-main-contents">
|
<!-- 基本信息 -->
|
<view class="bill-main-content" v-if="mainTabSelected == 1">
|
<view class="form-item">
|
<view class="left">单据号</view>
|
<view class="right disabled">
|
<input type="text" :value="hform.HBillNo" disabled />
|
</view>
|
</view>
|
|
<view class="form-item">
|
<view class="left">日期</view>
|
<view class="right">
|
<uni-datetime-picker type="date" :clear-icon="false" v-model="hform.HDate">
|
<view>{{ hform.HDate }}</view>
|
</uni-datetime-picker>
|
</view>
|
</view>
|
<view class="form-item">
|
<view class="left">责任部门</view>
|
<view class="right">
|
<uni-combox :candidates="DeptNameList" placeholder="请选择责任部门" v-model="hform.HDisposeDeptID"
|
@input="DeptChange"></uni-combox>
|
</view>
|
</view>
|
<view class="form-item">
|
<view class="left">工作中心</view>
|
<view class="right">
|
<uni-combox :candidates="WorkCenterList" placeholder="请选择工作中心" v-model="hform.HCenterWorkName"
|
@input="WorkCenterChange"></uni-combox>
|
</view>
|
</view>
|
<view class="form-item">
|
<view class="left">发起人</view>
|
<view class="right">
|
<uni-combox :candidates="GyFirstCheckEmpNameList" placeholder="请选择发起人"
|
v-model="hform.HSendMan"
|
@update:modelValue="HFirstCheckEmpChange"></uni-combox>
|
</view>
|
</view>
|
<view class="righton" v-show="!showHMainSourceBillType">
|
<input name="HMainSourceBillType" disabled v-model="HMainSourceBillType"
|
placeholder="请选择源单类型" />
|
</view>
|
<view class="form-item">
|
<view class="left">检测方案</view>
|
<view class="right" :class="{ 'disabled': hasSourceBill }">
|
<input
|
type="text"
|
v-model="hform.HQCSchemeName"
|
:disabled="hasSourceBill"
|
@confirm="searchSchemeByInput"
|
@blur="searchSchemeByInput"
|
placeholder="请输入单据号"
|
/>
|
</view>
|
<view class="icon-wrapper-big">
|
<uni-icons type="search" size="20" @click="showSelectorModule(hform, 7)"></uni-icons>
|
</view>
|
<!-- 添加扫描图标 -->
|
<view class="icon-wrapper-big" style="margin-left: 10rpx;">
|
<uni-icons type="scan" size="20" @click="scanScheme"></uni-icons>
|
</view>
|
</view>
|
<view class="form-item">
|
<view class="left">工序</view>
|
<view class="right disabled">
|
<input type="text" disabled :value="hform.HProcName" />
|
</view>
|
<view class="icon-wrapper-big"><uni-icons type="search" size="20" :class="!hasSourceBill?'enable-icon-button':'disable-icon-button'"
|
:disabled="hasSourceBill"
|
@click="showSelectorModule(hform, 8)"></uni-icons></view>
|
</view>
|
</view>
|
<!-- 其他信息 -->
|
<view class="bill-main-content" v-if="mainTabSelected == 2">
|
<view class="form-item">
|
<view class="left">改善对策</view>
|
<view class="right">
|
<input type="text" v-model="hform.HNote" value="" />
|
</view>
|
</view>
|
<view class="form-item">
|
<view class="left">异常原因</view>
|
<view class="right">
|
<input type="text" v-model="hform.HErrMsgBack" />
|
</view>
|
</view>
|
<view class="form-item">
|
<view class="left">备注</view>
|
<view class="right">
|
<input type="text" v-model="hform.HRemark" value="" />
|
</view>
|
</view>
|
<view class="form-item">
|
<view class="left">组织</view>
|
<view class="right disabled">
|
<input type="text" v-model="hform.Organization" value="" disabled />
|
</view>
|
</view>
|
</view>
|
<!-- 制单信息 -->
|
<view class="bill-main-content" v-if="mainTabSelected == 3">
|
<view class="form-item">
|
<view class="left">制单人</view>
|
<view class="right disabled">
|
<input type="text" :value="hform.HMaker" disabled />
|
</view>
|
</view>
|
<view class="form-item">
|
<view class="left">制单日期</view>
|
<view class="right disabled">
|
<input type="text" :value="hform.HMakeDate" disabled />
|
</view>
|
</view>
|
<view class="form-item">
|
<view class="left">审核人</view>
|
<view class="right disabled">
|
<input type="text" :value="hform.HChecker" disabled />
|
</view>
|
</view>
|
<view class="form-item">
|
<view class="left">审核日期</view>
|
<view class="right disabled">
|
<input type="text" :value="hform.HCheckDate" disabled />
|
</view>
|
</view>
|
<view class="form-item">
|
<view class="left">关闭人</view>
|
<view class="right disabled">
|
<input type="text" :value="hform.HCloseMan" disabled />
|
</view>
|
</view>
|
<view class="form-item">
|
<view class="left">关闭日期</view>
|
<view class="right disabled">
|
<input type="text" :value="hform.HCloseDate" disabled />
|
</view>
|
</view>
|
<view class="form-item">
|
<view class="left">修改人</view>
|
<view class="right disabled">
|
<input type="text" :value="hform.HUpDater" disabled />
|
</view>
|
</view>
|
<view class="form-item">
|
<view class="left">修改日期</view>
|
<view class="right disabled">
|
<input type="text" :value="hform.HUpDateDate" disabled />
|
</view>
|
</view>
|
<view class="form-item">
|
<view class="left">作废人</view>
|
<view class="right disabled">
|
<input type="text" :value="hform.HDeleteMan" disabled />
|
</view>
|
</view>
|
<view class="form-item">
|
<view class="left">作废日期</view>
|
<view class="right disabled">
|
<input type="text" :value="hform.HDeleteDate" disabled />
|
</view>
|
</view>
|
</view>
|
</view>
|
</view>
|
<view style="height: 120rpx"></view>
|
<view class="bottom-btn">
|
<button class="btn-a" size="mini" @tap="submit">提交</button>
|
<view style="flex: 1"></view>
|
<button class="btn-a" size="mini" @tap="addNew">新增</button>
|
<button class="btn-c" size="mini" @tap="goBack">退出</button>
|
</view>
|
<CheckEnvironmentTestItemPopupVue v-if="enablePopupModule == PopupModuleNameList[2]" ref="checkItemPopup"
|
@update="CheckItemComplete" :bindKey="currentChechItemIDCache">
|
</CheckEnvironmentTestItemPopupVue>
|
<ProcessPopupVue v-if="enablePopupModule == PopupModuleNameList[8]" ref="processPopup" @update="HProcComplete"
|
:bindKey="0"></ProcessPopupVue>
|
<CheckSchemePopupVue v-if="enablePopupModule == PopupModuleNameList[7]" ref="checkSchemePopup"
|
@update="HQCSchemeComplete" :bindKey="0"></CheckSchemePopupVue>
|
</view>
|
</template>
|
|
<script>
|
import dayjs from "dayjs";
|
import {
|
CommonUtils
|
} from "../../../utils/common";
|
import CheckEnvironmentTestItemPopupVue from "../../../components/ZLGL/CheckEnvironmentTestItemPopup.vue";
|
import ProcessPopupVue from "../../../components/ZLGL/ProcessPopup.vue";
|
import CheckSchemePopupVue from "../../../components/ZLGL/CheckSchemePopup.vue";
|
import {
|
getUserInfo
|
} from "../../../utils/auth";
|
export default {
|
components: {
|
CheckEnvironmentTestItemPopupVue,
|
ProcessPopupVue,
|
CheckSchemePopupVue,
|
},
|
data() {
|
return {
|
operationType: 1,
|
mainTabSelected: 1,
|
subTabSelected: 1,
|
hasSourceBill: false,
|
enablePopupModule: "",
|
PopupModuleNameList: [
|
"",
|
"",
|
"CheckItem",
|
"",
|
"",
|
"",
|
"",
|
"QCScheme",
|
"Process",
|
],
|
currentChechItemIDCache: -1,
|
GyFirstCheckEmpList: [],
|
GyFirstCheckEmpNameList: [],
|
DeptNameList: [],
|
DeptList: [],
|
WorkCenter:[],
|
WorkCenterList:[],
|
HMainSourceBillType: '不良品评审申请单',
|
arrayHMainSourceBillType: ['不良品评审申请单', '工序出站汇报单'],
|
subTabs: {
|
1: {
|
id: "1",
|
name: "检验项目",
|
},
|
},
|
hform: {
|
HBillType: '7514',
|
HBillSubType: '7514',
|
HInterID: "0",
|
HDate: dayjs(new Date()).format("YYYY-MM-DD"),
|
HBillNo: "",
|
HBillStatus: "1",
|
HYear: String(dayjs(new Date()).year()),
|
HPeriod: String(dayjs(new Date()).month() + 1),
|
HDeptID: String(getUserInfo()["HDeptID"] || "0"),
|
HDeptName: getUserInfo()["HDeptName"] || "",
|
Organization: getUserInfo()["Organization"] || "",
|
HCenterWorkID: "",
|
HCenterWorkName: "",
|
HProcID: "0",
|
HProcName: "",
|
HCleanType: 'A',
|
HEmpID: String(getUserInfo().HEmpID || "0"),
|
HEmpName: getUserInfo().HEmpName || "",
|
HEnvironmentTestSchemeID: "0",
|
HEnvironmentTestSchemeName: "",
|
HErrMsgBack: "",
|
HNote: "",
|
HRemark: "",
|
HOrgID: uni.getStorageSync('OrganizationID') || "0",
|
HMaker: getUserInfo()["Czymc"] || "",
|
HMakeDate: dayjs(new Date()).format("YYYY-MM-DDTHH:mm:ss"),
|
HChecker: "",
|
HCheckDate: "",
|
HCloseMan: "",
|
HCloseDate: "",
|
HUpDater: "",
|
HUpDateDate: "",
|
HDeleteMan: "",
|
HDeleteDate: "",
|
HQCSchemeName: "",
|
HQCSchemeID: "0",
|
},
|
checkItems: {},
|
searchTimer: null, // 添加搜索防抖定时器
|
};
|
},
|
methods: {
|
async showSelectorModule(item, index) {
|
console.log('showSelectorModule called with index:', index);
|
|
// 根据不同的模块类型设置不同的缓存值
|
if (index === 7) { // 检测方案
|
this.currentChechItemIDCache = 0;
|
} else if (index === 2) { // 检测项目
|
this.currentChechItemIDCache = item.num || 0;
|
} else if (index === 8) { // 工序
|
this.currentChechItemIDCache = 0;
|
} else {
|
this.currentChechItemIDCache = 0;
|
}
|
|
this.enablePopupModule = this.PopupModuleNameList[index];
|
console.log('enablePopupModule set to:', this.enablePopupModule);
|
|
await this.$nextTick();
|
|
// 根据不同的模块类型调用不同的 ref
|
let popupRef = null;
|
if (index === 2) {
|
popupRef = this.$refs.checkItemPopup;
|
console.log('checkItemPopup ref:', popupRef);
|
} else if (index === 7) {
|
popupRef = this.$refs.checkSchemePopup;
|
console.log('checkSchemePopup ref:', popupRef);
|
} else if (index === 8) {
|
popupRef = this.$refs.processPopup;
|
console.log('processPopup ref:', popupRef);
|
}
|
|
if (popupRef) {
|
console.log('Calling showPopup on ref');
|
popupRef.showPopup();
|
} else {
|
console.error('Popup ref not found for index:', index);
|
// 尝试重新设置 enablePopupModule
|
setTimeout(() => {
|
this.enablePopupModule = this.PopupModuleNameList[index];
|
this.$nextTick(() => {
|
const retryRef = index === 2 ? this.$refs.checkItemPopup :
|
index === 7 ? this.$refs.checkSchemePopup :
|
index === 8 ? this.$refs.processPopup : null;
|
if (retryRef) {
|
retryRef.showPopup();
|
} else {
|
uni.showToast({
|
title: '弹出框加载失败',
|
icon: 'none'
|
});
|
}
|
});
|
}, 100);
|
}
|
},
|
async InitDept() {
|
try {
|
let res = await CommonUtils.doRequest2Async({
|
url: '/PublicPageMethod/DeptList',
|
data: {
|
sWhere: 'where 1=1',
|
}
|
})
|
let { count, code, Message, data } = res.data
|
if (count == 1) {
|
this.DeptList = data
|
this.DeptNameList = Array.from(data).map(elem => elem['HName'])
|
} else {
|
CommonUtils.showTips({
|
title: '错误提示',
|
message: "初始化部门错误: " + Message,
|
})
|
}
|
} catch (err) {
|
CommonUtils.showTips({
|
title: '错误提示',
|
message: "初始化部门错误: " + err,
|
})
|
}
|
},
|
DeptChange(elem) {
|
let index = this.DeptNameList.findIndex(e => e == elem)
|
if (index == -1) {
|
this.hform.HDeptName = ''
|
this.hform.HDeptID = 0
|
return
|
}
|
this.hform.HDeptName = this.DeptList[index]['HName']
|
this.hform.HDeptID = this.DeptList[index]['HItemID']
|
},
|
async WorkCenter1() {
|
try {
|
let res = await CommonUtils.doRequest2Async({
|
url: '/Gy_WorkCenter/list',
|
data: {
|
sWhere : "",
|
user: getUserInfo()["Czymc"],
|
}
|
})
|
let { count, code, Message, data } = res.data
|
if (count == 1) {
|
this.WorkCenter = data
|
this.WorkCenterList = Array.from(data).map(elem => elem['工作中心名称'])
|
} else {
|
CommonUtils.showTips({
|
title: '错误提示',
|
message: "初始化生产中心错误: " + Message,
|
})
|
}
|
} catch (err) {
|
CommonUtils.showTips({
|
title: '错误提示',
|
message: "初始生产中心错误: " + err,
|
})
|
}
|
},
|
|
// 手动输入搜索检测方案
|
searchSchemeByInput() {
|
if (!this.hform.HQCSchemeName || this.hform.HQCSchemeName.trim() === '') {
|
return;
|
}
|
|
// 清除之前的定时器
|
if (this.searchTimer) {
|
clearTimeout(this.searchTimer);
|
}
|
|
// 设置防抖,避免频繁请求
|
this.searchTimer = setTimeout(() => {
|
this.getSchemeByNo(this.hform.HQCSchemeName.trim());
|
}, 500);
|
},
|
|
// 扫描检测方案
|
scanScheme() {
|
// 调用扫描功能
|
uni.scanCode({
|
success: (res) => {
|
if (res.result) {
|
this.getSchemeByNo(res.result);
|
}
|
},
|
fail: (err) => {
|
console.error('扫描失败:', err);
|
uni.showToast({
|
title: '扫描失败',
|
icon: 'none'
|
});
|
}
|
});
|
},
|
|
// 根据单据号获取检测方案
|
async getSchemeByNo(schemeNo) {
|
if (!schemeNo) return;
|
|
uni.showLoading({
|
title: '加载中...',
|
mask: true
|
});
|
|
try {
|
let res = await CommonUtils.doRequest2Async({
|
url: "/Gy_BaseInformation/getGy_EnvironmentTestSchemeBillMainList",
|
data: {
|
sWhere: ` and 单据号 = '${schemeNo}'`,
|
user: getUserInfo()['Czymc']
|
}
|
});
|
|
let { data, count, Message } = res.data;
|
|
if (count == 1 && data && data.length > 0) {
|
// 处理检测方案数据
|
this.processSchemeData(data);
|
|
uni.showToast({
|
title: `已加载 ${data.length} 条数据`,
|
icon: 'success'
|
});
|
} else {
|
// 未找到时清空相关字段
|
this.clearSchemeData();
|
uni.showToast({
|
title: '未找到检测方案',
|
icon: 'none'
|
});
|
}
|
} catch (err) {
|
console.error('加载检测方案失败:', err);
|
uni.showToast({
|
title: '加载失败',
|
icon: 'none'
|
});
|
} finally {
|
uni.hideLoading();
|
}
|
},
|
|
// 清空检测方案相关数据
|
clearSchemeData() {
|
this.hform.HQCSchemeName = '';
|
this.hform.HEnvironmentTestSchemeID = '0';
|
this.hform.HProcName = '';
|
this.hform.HProcID = '0';
|
this.checkItems = {};
|
this.$forceUpdate();
|
},
|
|
// 处理检测方案数据
|
processSchemeData(data) {
|
// 获取主表数据(第一条记录)
|
let mainData = data[0];
|
|
// 更新主表信息
|
this.hform.HQCSchemeName = mainData.单据号 || "";
|
this.hform.HEnvironmentTestSchemeID = mainData.HInterID || 0;
|
|
// 如果有部门信息,自动填充
|
if (mainData.生产部门) {
|
let deptIndex = this.DeptList.findIndex(dept => dept.HName == mainData.生产部门);
|
if (deptIndex != -1) {
|
this.hform.HDeptName = mainData.生产部门;
|
this.hform.HDeptID = this.DeptList[deptIndex].HItemID;
|
}
|
}
|
|
// 如果有工作中心信息,自动填充
|
if (mainData.工作中心) {
|
let workCenterIndex = this.WorkCenter.findIndex(wc => wc.工作中心名称 == mainData.工作中心);
|
if (workCenterIndex != -1) {
|
this.hform.HCenterWorkName = mainData.工作中心;
|
this.hform.HCenterWorkID = this.WorkCenter[workCenterIndex].HItemID;
|
}
|
}
|
|
// 如果有工序信息,自动填充
|
if (mainData.工序) {
|
this.hform.HProcName = mainData.工序;
|
if (mainData.HProcID) {
|
this.hform.HProcID = mainData.HProcID;
|
}
|
}
|
|
// 清空并重新加载检验项目
|
this.checkItems = {};
|
|
// 加载所有检验项目(子表数据)
|
let mainInterID = mainData.HInterID;
|
let details = data.filter(item => item.HInterID === mainInterID);
|
|
if (details.length > 0) {
|
details.forEach((item, index) => {
|
let ordinal = index + 1;
|
let checkItem = {
|
num: ordinal,
|
HInterID: this.hform.HInterID,
|
HBillNo_bak: this.hform.HBillNo || "",
|
HEntryID: ordinal,
|
HCloseMan: "",
|
HEntryCloseDate: item.HEntryCloseDate === "0" ? "2000-01-01" : item.HEntryCloseDate,
|
HCloseType: 0,
|
HRemark: item.备注 || "",
|
HSourceInterID: 0,
|
HSourceEntryID: 0,
|
HSourceBillNo: "",
|
HSourceBillType: "",
|
HRelationQty: 0,
|
HRelationMoney: 0,
|
HQCCheckItemName: item.检测项目,
|
HEnvironmentItemID: item.HEnvironmentItemID || "",
|
HMeasure: item.实际值 || "",
|
HTargetVal: item.目标值 || "",
|
HUpLimit: item.上限值 || "",
|
HDownLimit: item.下限值 || "",
|
HEnvironmentItemName: item.检测项目 || "",
|
};
|
this.$set(this.checkItems, ordinal, checkItem);
|
});
|
}
|
|
this.$forceUpdate();
|
},
|
WorkCenterChange(elem) {
|
let index = this.WorkCenterList.findIndex(e => e == elem)
|
if (index == -1) {
|
this.hform.HCenterWorkName = ''
|
this.hform.HCenterWorkID = 0
|
return
|
}
|
this.hform.HCenterWorkID = this.WorkCenter[index]['HItemID']
|
},
|
async InitHEmp() {
|
try {
|
let res = await CommonUtils.doRequest2Async({
|
url: "/Gy_Employee/list",
|
data: {
|
sWhere: ` and 组织名称 = '${uni.getStorageSync("Organization")}' and 禁用标记 = ''and 审核人 !='' order by 部门代码`,
|
user: getUserInfo()["Czymc"],
|
Organization: uni.getStorageSync("Organization"),
|
},
|
});
|
|
let { data, Message, count } = res.data;
|
|
if (count == 1) {
|
this.GyFirstCheckEmpList = data;
|
this.GyFirstCheckEmpNameList = Array.from(data).map((e) => e["职员名称"]);
|
} else {
|
CommonUtils.showTips({
|
title: "温馨提示",
|
message: `初始化检验员失败: ${Message}`,
|
});
|
}
|
} catch (err) {
|
CommonUtils.showTips({
|
title: "温馨提示",
|
message: `初始化检验员失败: ${err}`,
|
});
|
}
|
},
|
async HFirstCheckEmpChange(e) {
|
let index = this.GyFirstCheckEmpList.findIndex((elem) => elem["职员名称"] == e);
|
if (index == -1) {
|
this.hform.HEmpID = 0;
|
this.hform.HEmpName = "";
|
return;
|
}
|
this.hform.HEmpID = this.GyFirstCheckEmpList[index]["HItemID"];
|
this.hform.HEmpName = this.GyFirstCheckEmpList[index]["职员名称"];
|
},
|
cleanlinessChange(e) {
|
this.hform.HCleanType = e;
|
},
|
addCheckItem(resource) {
|
let ordinal = this.getObjLength(this.checkItems) + 1;
|
let checkItem = {
|
num: ordinal,
|
HInterID: this.hform.HInterID,
|
HBillNo_bak: this.hform.HBillNo || "",
|
HEntryID: ordinal,
|
HCloseMan: "",
|
HEntryCloseDate: "",
|
HCloseType: 0,
|
HRemark: "",
|
HSourceInterID: 0,
|
HSourceEntryID: 0,
|
HSourceBillNo: "",
|
HSourceBillType: "",
|
HRelationQty: 0,
|
HRelationMoney: 0,
|
HEnvironmentItemID: "",
|
HMeasure: "",
|
HTargetVal: "",
|
HUpLimit: "",
|
HDownLimit: "",
|
HEnvironmentItemName: "",
|
HQCCheckItemName: "",
|
};
|
|
if (resource) {
|
Object.assign(checkItem, resource);
|
}
|
|
this.$set(this.checkItems, ordinal, checkItem);
|
},
|
removeCheckItem(item) {
|
uni.showModal({
|
title: "温馨提示",
|
content: `确认要删除第${item.num}行吗?删除后不能恢复`,
|
success: (res) => {
|
if (res.confirm) {
|
this.$delete(this.checkItems, item.num);
|
this.$forceUpdate();
|
this.refreshCheckItemNum();
|
}
|
},
|
});
|
},
|
async refreshCheckItemNum() {
|
await this.$nextTick();
|
let num = 1;
|
let checkItemsCache = {};
|
for (let s in this.checkItems) {
|
checkItemsCache[num] = this.checkItems[s];
|
checkItemsCache[num].num = num;
|
num++;
|
}
|
this.checkItems = checkItemsCache;
|
},
|
getObjLength(obj) {
|
return Object.keys(obj).length;
|
},
|
async CheckItemComplete(e) {
|
for (var key in e["retVal"]) {
|
let data = e["retVal"][key];
|
Object.assign(this.checkItems[key], {
|
HEnvironmentItemID: data["HItemID"],
|
HQCCheckItemName: data["环境检测项目名称"],
|
});
|
await this.$nextTick();
|
// 修改这里:使用 checkItemPopup 而不是 listPopup
|
if (this.$refs.checkItemPopup) {
|
this.$refs.checkItemPopup.exit();
|
}
|
await this.$nextTick();
|
this.enablePopupModule = this.PopupModuleNameList[0];
|
}
|
},
|
async HQCSchemeComplete(e) {
|
let allItems = Object.values(e.retVal);
|
if (allItems.length === 0) return;
|
|
let selectedMainData = e.selectedMainData || allItems[0];
|
|
this.hform.HQCSchemeName = selectedMainData.单据号 || "";
|
this.hform.HEnvironmentTestSchemeID = selectedMainData.HInterID || 0;
|
|
if (selectedMainData.生产部门) {
|
let deptIndex = this.DeptList.findIndex(dept => dept.HName == selectedMainData.生产部门);
|
if (deptIndex != -1) {
|
this.hform.HDeptName = selectedMainData.生产部门;
|
this.hform.HDeptID = this.DeptList[deptIndex].HItemID;
|
}
|
}
|
|
if (selectedMainData.工作中心) {
|
let workCenterIndex = this.WorkCenter.findIndex(wc => wc.工作中心名称 == selectedMainData.工作中心);
|
if (workCenterIndex != -1) {
|
this.hform.HCenterWorkName = selectedMainData.工作中心;
|
this.hform.HCenterWorkID = this.WorkCenter[workCenterIndex].HItemID;
|
}
|
}
|
|
if (selectedMainData.工序) {
|
this.hform.HProcName = selectedMainData.工序;
|
if (selectedMainData.HProcID) {
|
this.hform.HProcID = selectedMainData.HProcID;
|
}
|
}
|
|
this.checkItems = {};
|
this.enablePopupModule = this.PopupModuleNameList[0];
|
await this.$nextTick();
|
|
let mainInterID = selectedMainData.HInterID;
|
let details = allItems.filter(item => item.HInterID === mainInterID);
|
|
if (details.length > 0) {
|
details.forEach((item, index) => {
|
let ordinal = index + 1;
|
let checkItem = {
|
num: ordinal,
|
HInterID: this.hform.HInterID,
|
HBillNo_bak: this.hform.HBillNo || "",
|
HEntryID: ordinal,
|
HCloseMan: "",
|
HEntryCloseDate: item.HEntryCloseDate === "0" ? "2000-01-01" : item.HEntryCloseDate,
|
HCloseType: 0,
|
HRemark: item.备注 || "",
|
HSourceInterID: 0,
|
HSourceEntryID: 0,
|
HSourceBillNo: "",
|
HSourceBillType: "",
|
HRelationQty: 0,
|
HRelationMoney: 0,
|
HQCCheckItemName: item.检测项目,
|
HEnvironmentItemID: item.HEnvironmentItemID || "",
|
HMeasure: item.实际值 || "",
|
HTargetVal: item.目标值 || "",
|
HUpLimit: item.上限值 || "",
|
HDownLimit: item.下限值 || "",
|
HEnvironmentItemName: item.检测项目 || "",
|
};
|
this.$set(this.checkItems, ordinal, checkItem);
|
});
|
|
uni.showToast({
|
title: `已添加 ${details.length} 条检验项目`,
|
icon: 'success'
|
});
|
}
|
|
this.$forceUpdate();
|
},
|
async HProcComplete(e) {
|
for (var key in e["retVal"]) {
|
let data = e["retVal"][key];
|
Object.assign(this.hform, {
|
HProcName: data["工序名称"],
|
HProcID: data["HItemID"],
|
});
|
await this.$nextTick();
|
// 修改这里:使用 processPopup 而不是 listPopup
|
if (this.$refs.processPopup) {
|
this.$refs.processPopup.exit();
|
}
|
await this.$nextTick();
|
this.enablePopupModule = this.PopupModuleNameList[0];
|
}
|
},
|
async getMaxBillNo() {
|
try {
|
let res = await CommonUtils.doRequest2Sync({
|
url: "/Web/GetMAXNum",
|
data: {
|
HBillType: "7514",
|
},
|
});
|
|
if (!res) return;
|
|
let { data, count, Message } = res.data;
|
if (count == 1) {
|
this.hform.HInterID = data[0].HInterID;
|
this.hform.HBillNo = data[0].HBillNo;
|
} else {
|
throw Message;
|
}
|
} catch (err) {
|
CommonUtils.showTips({
|
title: "温馨提示",
|
message: "获取单据号异常: " + err,
|
});
|
}
|
},
|
checkSubmitValidate() {
|
if (this.hform.HEmpID == 0) {
|
CommonUtils.showTips({ message: "记录人未选择!" });
|
return false;
|
}
|
|
for (let key in this.checkItems) {
|
if (!this.checkItems[key].HEnvironmentItemID) {
|
CommonUtils.showTips({
|
message: `第${this.checkItems[key].num}行检验项目不能为空!`,
|
});
|
return false;
|
}
|
}
|
return true;
|
},
|
async submit() {
|
if (!this.checkSubmitValidate()) return;
|
|
try {
|
let checkItemsArray = [];
|
for (var key in this.checkItems) {
|
let checkItem = JSON.parse(JSON.stringify(this.checkItems[key]));
|
delete checkItem.num;
|
delete checkItem.HEnvironmentItemName;
|
delete checkItem.HQCCheckItemName;
|
checkItemsArray.push(checkItem);
|
}
|
|
let operation = this.operationType == 1 ? "Add" : "3";
|
|
let sMainSub = `${JSON.stringify(this.hform)};${JSON.stringify(
|
checkItemsArray
|
)};${operation};${getUserInfo()["Czymc"]};{}`;
|
|
let res = await CommonUtils.doRequest2Sync({
|
url: "/QC_EnvironmentTestDotCheckBill/SaveQC_EnvironmentTestDotCheckBillMain",
|
data: { sMainSub: sMainSub },
|
method: "POST",
|
});
|
|
if (!res) return;
|
|
let { count, Message } = res.data;
|
if (count == 1) {
|
uni.showModal({
|
title: "提示",
|
content: res.data.Message + "。是否继续新增?",
|
success: (res) => {
|
if (res.confirm) {
|
uni.redirectTo({
|
url: "/pages/ZLGL/QcenvironmentTestDotCheckBill/QcenvironmentTestDotCheckBill?operationType=1",
|
});
|
}
|
},
|
});
|
} else {
|
CommonUtils.showTips({
|
title: "温馨提示",
|
message: `环境检测单保存错误: ${Message}`,
|
});
|
}
|
} catch (err) {
|
CommonUtils.showTips({
|
title: "温馨提示",
|
message: `环境检测单保存错误: ${err}`,
|
});
|
}
|
},
|
|
addNew() {
|
|
uni.showLoading({
|
title: '加载中...',
|
mask: true
|
});
|
|
// 延迟一点再跳转,让用户能看到加载提示
|
setTimeout(() => {
|
uni.redirectTo({
|
url: "/pages/ZLGL/QcenvironmentTestDotCheckBill/QcenvironmentTestDotCheckBill?operationType=1",
|
complete: () => {
|
uni.hideLoading();
|
}
|
});
|
}, 300);
|
},
|
goBack() {
|
uni.navigateBack();
|
},
|
},
|
async onLoad(e) {
|
this.operationType = e.operationType || 1;
|
this.hform.HInterID = e.linterid || 0;
|
this.hform.HCleanType = 'A';
|
const organization = uni.getStorageSync('Organization');
|
this.hform.Organization = organization || '';
|
if (this.operationType == 1) {
|
await this.getMaxBillNo();
|
}
|
|
await this.InitHEmp();
|
await this.InitDept();
|
await this.WorkCenter1();
|
},
|
// 组件销毁时清除定时器
|
beforeDestroy() {
|
if (this.searchTimer) {
|
clearTimeout(this.searchTimer);
|
}
|
}
|
};
|
</script>
|
|
<style lang="scss" scoped>
|
input { width: inherit; font-size: 26rpx; }
|
.uni-input { padding: 0; }
|
|
.bill-main-tabs, .bill-sub-tabs {
|
box-sizing: border-box;
|
width: 730rpx;
|
display: flex;
|
flex-direction: row;
|
flex-wrap: nowrap;
|
gap: 20rpx;
|
flex-shrink: 0;
|
overflow-x: auto;
|
border-bottom: 1px solid #ddd;
|
padding: 20rpx 10rpx;
|
white-space: nowrap;
|
|
view {
|
width: auto;
|
font-size: 26rpx;
|
color: #555;
|
text-align: center;
|
padding: 16rpx 0;
|
}
|
|
.selected {
|
color: #3a78ff;
|
font-weight: bold;
|
border-bottom: 3px solid #3a78ff;
|
}
|
}
|
|
.bill-main-content, .bill-sub-content {
|
box-sizing: border-box;
|
padding: 0 30rpx 0 30rpx;
|
display: flex;
|
flex-direction: column;
|
|
.form-item {
|
width: 100%;
|
display: flex;
|
align-items: center;
|
font-size: 26rpx;
|
padding: 6rpx 0;
|
|
.left { width: 208rpx; }
|
.right {
|
padding: 8rpx 20rpx;
|
font-size: 26rpx;
|
flex: 1;
|
border-radius: 22rpx;
|
border: 1px solid #acacac;
|
|
.uni-combox { padding: 0; height: auto; }
|
.uni-combox::v-deep input { height: inherit; font-size: 26rpx; }
|
|
input {
|
width: 100%;
|
border: none;
|
outline: none;
|
background: transparent;
|
}
|
}
|
.disabled { border: 1px solid #e4e4e4; background-color: #e4e4e4; }
|
.none-border { border: none; }
|
}
|
}
|
|
.bottom-btn {
|
box-sizing: border-box;
|
width: 100%;
|
height: 120rpx;
|
position: fixed;
|
bottom: 0;
|
left: 0;
|
background-color: #fff;
|
box-shadow: 0 2rpx 10rpx 2rpx rgba(0,0,0,0.4);
|
padding: 30rpx 40rpx 40rpx 40rpx;
|
display: flex;
|
flex-direction: row;
|
gap: 10rpx;
|
|
button {
|
border-radius: 50rpx;
|
width: 180rpx;
|
height: 66rpx;
|
line-height: 66rpx;
|
font-size: 28rpx;
|
}
|
.btn-a { background-color: #3a78ff; color: #fff; }
|
.btn-c { background-color: #acacac; color: #fff; }
|
}
|
|
.buttons {
|
box-sizing: border-box;
|
width: 100%;
|
display: flex;
|
justify-content: center;
|
padding: 10rpx 0;
|
}
|
|
.select-border {
|
border: 1px solid #acacac !important;
|
border-radius: 22rpx !important;
|
padding: 8rpx 20rpx !important;
|
}
|
|
.no-border-select {
|
::v-deep .uni-select {
|
border: none !important;
|
border-radius: 0 !important;
|
}
|
}
|
|
.list {
|
width: 100%;
|
|
.card-detail {
|
width: 100%;
|
display: flex;
|
flex-wrap: wrap;
|
justify-content: space-between;
|
align-items: center;
|
line-height: 120%;
|
gap: 10rpx 0;
|
|
input { font-size: 26rpx; }
|
|
.detail {
|
box-sizing: border-box;
|
font-size: 26rpx;
|
color: #555;
|
padding-right: 20rpx;
|
|
text { color: #999; font-size: 26rpx; }
|
}
|
|
.editable {
|
width: 50%;
|
display: inline-flex;
|
flex-direction: row;
|
align-items: center;
|
|
text { flex-shrink: 0; }
|
.editable-input {
|
border: 1px solid #acacac;
|
border-radius: 5rpx;
|
padding: 0 12rpx;
|
}
|
}
|
}
|
}
|
|
.icon-wrapper {
|
background-color: #3a78ff;
|
border-radius: 100%;
|
width: 40rpx;
|
height: 40rpx;
|
display: flex;
|
justify-content: center;
|
align-items: center;
|
flex-shrink: 0;
|
.uni-icons { color: #fff !important; }
|
}
|
|
.icon-wrapper-big {
|
background-color: #3a78ff;
|
border-radius: 100%;
|
width: 50rpx;
|
height: 50rpx;
|
display: flex;
|
justify-content: center;
|
align-items: center;
|
flex-shrink: 0;
|
margin-left: 20rpx;
|
.uni-icons { color: #fff !important; }
|
}
|
|
.more {
|
color: #888;
|
font-size: 22rpx;
|
display: flex;
|
border-top: 1px solid #eee;
|
padding-top: 10rpx;
|
|
.part {
|
width: 100%;
|
text-align: center;
|
}
|
}
|
|
.enable-icon-button {
|
background-color: #3a78ff;
|
padding: 6rpx;
|
color: #fff;
|
border-radius: 100%;
|
}
|
|
.disable-icon-button {
|
background-color: lightgray;
|
padding: 6rpx;
|
color: #fff;
|
border-radius: 100%;
|
pointer-events: none;
|
}
|
|
.card-detail {
|
width: 100%;
|
display: flex;
|
flex-direction: column;
|
gap: 16rpx;
|
}
|
|
.detail-row {
|
width: 100%;
|
display: flex;
|
align-items: center;
|
justify-content: space-between;
|
gap: 20rpx;
|
}
|
|
.values-row {
|
width: 100%;
|
display: flex;
|
justify-content: space-between;
|
background-color: #f9f9f9;
|
padding: 16rpx 20rpx;
|
border-radius: 12rpx;
|
margin-top: 8rpx;
|
}
|
|
.value-item {
|
font-size: 26rpx;
|
color: #555;
|
display: flex;
|
align-items: center;
|
|
text { color: #999; margin-right: 8rpx; }
|
.value { color: #3a78ff; font-weight: bold; }
|
}
|
|
.actual-input {
|
border: 1px solid #acacac;
|
border-radius: 10rpx;
|
padding: 6rpx 12rpx;
|
font-size: 26rpx;
|
width: 140rpx;
|
background-color: #fff;
|
margin-left: 8rpx;
|
z-index: 10;
|
position: relative;
|
}
|
</style>
|