<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.HDisposeDeptName"
|
@input="HDisposeDeptChange"></uni-combox>
|
</view>
|
</view>
|
|
<!-- 发起人 -->
|
<view class="form-item">
|
<view class="left">发起人</view>
|
<view class="right">
|
<uni-combox :candidates="GyEmpNameList" placeholder="请选择发起人"
|
v-model="hform.HSendMan" @input="HSendManChange"></uni-combox>
|
</view>
|
</view>
|
|
<!-- 接收人 -->
|
<view class="form-item">
|
<view class="left">接收人</view>
|
<view class="right">
|
<uni-combox :candidates="GyEmpNameList" placeholder="请选择接收人"
|
v-model="hform.HReceiveMan" @input="HReceiveManChange"></uni-combox>
|
</view>
|
</view>
|
|
<!-- 处理人 -->
|
<view class="form-item">
|
<view class="left">处理人</view>
|
<view class="right">
|
<uni-combox :candidates="GyEmpNameList" placeholder="请选择处理人"
|
v-model="hform.HDisposeEmpName" @input="HDisposeEmpChange"></uni-combox>
|
</view>
|
</view>
|
|
<!-- 抄送人 - 改为下拉框 -->
|
<view class="form-item">
|
<view class="left">抄送人</view>
|
<view class="right">
|
<uni-combox :candidates="GyEmpNameList" placeholder="请选择抄送人"
|
v-model="hform.HCopyMan" @input="HCopyManChange"></uni-combox>
|
</view>
|
</view>
|
|
<!-- 源单类型 - 修复版 -->
|
<view class="form-item">
|
<view class="left">源单类型</view>
|
<view class="right" v-show="showHMainSourceBillType">
|
<picker :range="arrayHMainSourceBillType" @change="HMainSourceBillTypeChange" mode="selector">
|
<view class="picker-value">{{ HMainSourceBillTypeDisplay || '请选择源单类型' }}</view>
|
</picker>
|
</view>
|
<view class="right disabled" v-show="!showHMainSourceBillType">
|
<view class="picker-value">{{ HMainSourceBillTypeDisplay }}</view>
|
</view>
|
</view>
|
|
<!-- 源单单号 -->
|
<view class="form-item">
|
<view class="left">源单号</view>
|
<view class="right">
|
<input type="text" v-model="hform.HMainSourceBillNo" placeholder="请输入或扫描源单号"
|
@confirm="GetMessageByHSourceBillNo" />
|
</view>
|
<view class="icon-wrapper" @click="openSourceBillSelector">
|
<uni-icons type="search" size="20"></uni-icons>
|
</view>
|
<view class="icon-wrapper" @click="scanSourceBill">
|
<uni-icons type="scan" size="20"></uni-icons>
|
</view>
|
</view>
|
|
<!-- 处理工序 -->
|
<view class="form-item">
|
<view class="left">处理工序</view>
|
<view class="right disabled">
|
<input type="text" disabled v-model="hform.HDisposeProcName" />
|
</view>
|
<view class="icon-wrapper-big">
|
<uni-icons type="search" size="20" :class="!hasSourceBill?'enable-icon-button':'disable-icon-button'"
|
:disabled="hasSourceBill"
|
@click="showSelectorModule(8)"></uni-icons>
|
</view>
|
</view>
|
|
<!-- 不良类型 -->
|
<view class="form-item">
|
<view class="left">不良类型</view>
|
<view class="right disabled">
|
<input type="text" disabled v-model="hform.HBadTypeName" />
|
</view>
|
<view class="icon-wrapper-big">
|
<uni-icons type="search" size="20" :class="!hasSourceBill?'enable-icon-button':'disable-icon-button'"
|
:disabled="hasSourceBill"
|
@click="showSelectorModule(7)"></uni-icons>
|
</view>
|
</view>
|
|
<!-- 不良原因 -->
|
<view class="form-item">
|
<view class="left">不良原因</view>
|
<view class="right disabled">
|
<input type="text" disabled v-model="hform.HBadReasonName" />
|
</view>
|
<view class="icon-wrapper-big">
|
<uni-icons type="search" size="20" :class="!hasSourceBill?'enable-icon-button':'disable-icon-button'"
|
:disabled="hasSourceBill"
|
@click="showSelectorModule(2)"></uni-icons>
|
</view>
|
</view>
|
|
<!-- 处理结论详情 -->
|
<view class="form-item">
|
<view class="left">处理结论详情</view>
|
<view class="right">
|
<input type="text" v-model="hform.HDisposeNote" />
|
</view>
|
</view>
|
|
<!-- 纠正及预防措施 -->
|
<view class="form-item">
|
<view class="left">纠正及预防措施</view>
|
<view class="right">
|
<input type="text" v-model="hform.HNote" />
|
</view>
|
</view>
|
|
<!-- 处理结论 -->
|
<view class="form-item">
|
<view class="left">处理结论</view>
|
<view class="right select-border">
|
<uni-data-select
|
v-model="hform.HCheckerResult"
|
:localdata="conclusionList"
|
:clear="false"
|
placeholder="请选择处理结论"
|
:disabled="hasSourceBill"
|
class="no-border-select"
|
></uni-data-select>
|
</view>
|
</view>
|
</view>
|
|
<!-- 其他信息 -->
|
<view class="bill-main-content" v-if="mainTabSelected == 2">
|
<!-- 从源单获取的信息 - 全部只读 -->
|
<view class="form-item">
|
<view class="left">申请单号</view>
|
<view class="right disabled">
|
<input type="text" v-model="hform.HBillNos" disabled />
|
</view>
|
</view>
|
|
<view class="form-item">
|
<view class="left">申请日期</view>
|
<view class="right disabled">
|
<input type="text" v-model="hform.HDates" disabled />
|
</view>
|
</view>
|
|
<view class="form-item">
|
<view class="left">发生时间</view>
|
<view class="right disabled">
|
<input type="text" v-model="hform.HHappendDates" disabled />
|
</view>
|
</view>
|
|
<view class="form-item">
|
<view class="left">生产订单</view>
|
<view class="right disabled">
|
<input type="text" v-model="hform.HICMOBillNos" disabled />
|
</view>
|
</view>
|
|
<view class="form-item">
|
<view class="left">工序流转卡</view>
|
<view class="right disabled">
|
<input type="text" v-model="hform.HProcExchBillNos" disabled />
|
</view>
|
</view>
|
|
<view class="form-item">
|
<view class="left">产品编码</view>
|
<view class="right disabled">
|
<input type="text" v-model="hform.HMaterNumbers" disabled />
|
</view>
|
</view>
|
|
<view class="form-item">
|
<view class="left">产品名称</view>
|
<view class="right disabled">
|
<input type="text" v-model="hform.HMaterNames" disabled />
|
</view>
|
</view>
|
|
<view class="form-item">
|
<view class="left">规格型号</view>
|
<view class="right disabled">
|
<input type="text" v-model="hform.HMaterModels" disabled />
|
</view>
|
</view>
|
|
<view class="form-item">
|
<view class="left">计量单位</view>
|
<view class="right disabled">
|
<input type="text" v-model="hform.HUnitNames" disabled />
|
</view>
|
</view>
|
|
<view class="form-item">
|
<view class="left">产品类型</view>
|
<view class="right disabled">
|
<input type="text" v-model="hform.HMaterTypes" disabled />
|
</view>
|
</view>
|
|
<view class="form-item">
|
<view class="left">不良数量</view>
|
<view class="right disabled">
|
<input type="text" v-model="hform.HUnRightQtys" disabled />
|
</view>
|
</view>
|
|
<view class="form-item">
|
<view class="left">车间</view>
|
<view class="right disabled">
|
<input type="text" v-model="hform.HDeptNames" disabled />
|
</view>
|
</view>
|
|
<view class="form-item">
|
<view class="left">发生工序</view>
|
<view class="right disabled">
|
<input type="text" v-model="hform.HProcNames" disabled />
|
</view>
|
</view>
|
|
<view class="form-item">
|
<view class="left">不良现象</view>
|
<view class="right disabled">
|
<input type="text" v-model="hform.HBadPhenomenaNames" disabled />
|
</view>
|
</view>
|
|
<view class="form-item">
|
<view class="left">不良品SN码</view>
|
<view class="right disabled">
|
<input type="text" v-model="hform.HBarCodes" disabled />
|
</view>
|
</view>
|
|
<view class="form-item">
|
<view class="left">销售订单</view>
|
<view class="right disabled">
|
<input type="text" v-model="hform.HSeOrderBillNos" disabled />
|
</view>
|
</view>
|
|
<view class="form-item">
|
<view class="left">问题现象简述</view>
|
<view class="right disabled">
|
<input type="text" v-model="hform.HReasonNotes" disabled />
|
</view>
|
</view>
|
|
<!-- 紧急程度 - 显示文本 -->
|
<view class="form-item">
|
<view class="left">紧急程度</view>
|
<view class="right disabled">
|
<input type="text" v-model="hform.HLevs" disabled />
|
</view>
|
</view>
|
|
<!-- 是否停线 - 显示文本 -->
|
<view class="form-item">
|
<view class="left">是否停线</view>
|
<view class="right disabled">
|
<input type="text" v-model="hform.HIsStops" disabled />
|
</view>
|
</view>
|
|
<!-- 是否批量问题 - 显示文本 -->
|
<view class="form-item">
|
<view class="left">是否批量问题</view>
|
<view class="right disabled">
|
<input type="text" v-model="hform.HIsBatchUnRights" disabled />
|
</view>
|
</view>
|
|
<!-- 原有的备注和组织字段 -->
|
<view class="form-item">
|
<view class="left">备注</view>
|
<view class="right">
|
<input type="text" v-model="hform.HRemark" />
|
</view>
|
</view>
|
|
<view class="form-item">
|
<view class="left">组织</view>
|
<view class="right disabled">
|
<input type="text" v-model="hform.Organization" 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" v-model="hform.HMaker" disabled />
|
</view>
|
</view>
|
<view class="form-item">
|
<view class="left">制单日期</view>
|
<view class="right disabled">
|
<input type="text" v-model="hform.HMakeDate" disabled />
|
</view>
|
</view>
|
<view class="form-item">
|
<view class="left">修改人</view>
|
<view class="right disabled">
|
<input type="text" v-model="hform.HUpDater" disabled />
|
</view>
|
</view>
|
<view class="form-item">
|
<view class="left">修改日期</view>
|
<view class="right disabled">
|
<input type="text" v-model="hform.HUpDateDate" disabled />
|
</view>
|
</view>
|
<view class="form-item">
|
<view class="left">审核人</view>
|
<view class="right disabled">
|
<input type="text" v-model="hform.HChecker" disabled />
|
</view>
|
</view>
|
<view class="form-item">
|
<view class="left">审核日期</view>
|
<view class="right disabled">
|
<input type="text" v-model="hform.HCheckDate" disabled />
|
</view>
|
</view>
|
<view class="form-item">
|
<view class="left">关闭人</view>
|
<view class="right disabled">
|
<input type="text" v-model="hform.HCloseMan" disabled />
|
</view>
|
</view>
|
<view class="form-item">
|
<view class="left">关闭日期</view>
|
<view class="right disabled">
|
<input type="text" v-model="hform.HCloseDate" disabled />
|
</view>
|
</view>
|
<view class="form-item">
|
<view class="left">作废人</view>
|
<view class="right disabled">
|
<input type="text" v-model="hform.HDeleteMan" disabled />
|
</view>
|
</view>
|
<view class="form-item">
|
<view class="left">作废日期</view>
|
<view class="right disabled">
|
<input type="text" v-model="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>
|
|
<!-- 弹窗组件 -->
|
<GyBadReasonPopup ref="GyBadReasonPopup" @update="CheckItemComplete" :bindKey="currentChechItemIDCache">
|
</GyBadReasonPopup>
|
<ProcessPopupVue ref="processPopup" @update="HProcComplete" :bindKey="0"></ProcessPopupVue>
|
<GyBadTypePopupVue ref="GyBadTypePopupVue" @update="HQCSchemeComplete" :bindKey="0"></GyBadTypePopupVue>
|
<BillListPopupVue ref="billList" :HBillType="hform.HBillType" :HSourceBillType="hform.HMainSourceBillType"
|
:HStockOrgID="hform.HStockOrgID" @BillSelectComplete="handleSourceBill"></BillListPopupVue>
|
</view>
|
</template>
|
|
<script>
|
import dayjs from "dayjs";
|
import {
|
CommonUtils
|
} from "../../../utils/common";
|
import GyBadReasonPopup from "../../../components/ZLGL/GyBadReasonPopup.vue";
|
import ProcessPopupVue from "../../../components/ZLGL/ProcessPopup.vue";
|
import GyBadTypePopupVue from "../../../components/ZLGL/GyBadTypePopup.vue";
|
import BillListPopupVue from "@/components/BillListPopup/BillListPopup.vue";
|
import {
|
getUserInfo
|
} from "../../../utils/auth";
|
|
export default {
|
components: {
|
GyBadReasonPopup,
|
ProcessPopupVue,
|
GyBadTypePopupVue,
|
BillListPopupVue,
|
},
|
data() {
|
return {
|
operationType: 1,
|
mainTabSelected: 1,
|
hasSourceBill: false,
|
|
enablePopupModule: "",
|
PopupModuleNameList: [
|
"", "", "GyBadReasonPopup", "", "", "", "", "GyBadTypePopupVue", "ProcessPopupVue"
|
],
|
conclusionList: [
|
{ value: '处理完成', text: '处理完成' },
|
{ value: '无法处理', text: '无法处理' },
|
{ value: '处理失败', text: '处理失败' }
|
],
|
emergencyList: [
|
{ value: '普通', text: '普通' },
|
{ value: '紧急', text: '紧急' }
|
],
|
yesNoList: [
|
{ value: '否', text: '否' },
|
{ value: '是', text: '是' }
|
],
|
currentChechItemIDCache: -1,
|
GyEmpList: [],
|
GyEmpNameList: [],
|
DeptNameList: [],
|
DeptList: [],
|
|
HMainSourceBillTypeDisplay: "", // 用于显示的源单类型
|
arrayHMainSourceBillType: ["不良品评审申请单", "工序出站汇报单"],
|
arrayHMainSourceBillTypeID: ["7512", "3791"],
|
showHMainSourceBillType: true,
|
|
hform: {
|
// 单据信息
|
HInterID: "0",
|
HEntryID: "0",
|
HBillNo: "",
|
HDate: dayjs(new Date()).format("YYYY-MM-DD"),
|
HBillType: '7514',
|
|
// 申请信息
|
HBillNos: "",
|
HDates: "",
|
HHappendDates: "",
|
|
// 生产订单
|
HICMOBillNos: "",
|
HICMOInterIDs: "0",
|
HICMOEntryIDs: "0",
|
|
// 产品信息
|
HMaterNumbers: "",
|
HMaterNames: "",
|
HMaterModels: "",
|
HMaterIDs: "0",
|
HUnitNames: "",
|
HUnitIDs: "0",
|
HMaterTypes: "",
|
|
// 工序流转卡
|
HProcExchBillNos: "",
|
HProcExchInterIDs: "0",
|
HProcExchEntryIDs: "0",
|
|
// 不良信息
|
HUnRightQtys: "",
|
HLevs: "普通",
|
HIsStops: "否",
|
HIsBatchUnRights: "否",
|
HBarCodes: "",
|
HBadPhenomenaNames: "",
|
HBadPhenomenaIDs: "0",
|
HReasonNotes: "",
|
|
// 部门工序
|
HDeptNames: "",
|
HDeptIDs: "0",
|
HProcNames: "",
|
HProcIDs: "0",
|
|
// 销售订单
|
HSeOrderBillNos: "",
|
|
// 源单信息
|
HMainSourceBillType: "",
|
HMainSourceBillNo: "",
|
HMainSourceInterID: "0",
|
HMainSourceEntryID: "0",
|
|
// 人员信息
|
HSendMan: "",
|
HReceiveMan: "",
|
HCopyMan: "",
|
|
// 处理信息
|
HDisposeDeptName: "",
|
HDisposeDeptID: "0",
|
HDisposeProcName: "",
|
HDisposeProcID: "0",
|
HDisposeEmpName: "",
|
HSendManID: "0", // 发起人ID
|
HReceiveManID: "0", // 接收人ID
|
HDisposeEmpID: "0",
|
HCheckerResult: "处理完成",
|
HDisposeNote: "",
|
|
// 不良原因类型
|
HBadTypeName: "",
|
HBadTypeID: "0",
|
HBadReasonName: "",
|
HBadReasonID: "0",
|
|
// 备注
|
HNote: "",
|
HRemark: "",
|
|
// 组织信息
|
Organization: getUserInfo()["Organization"] || "",
|
HStockOrgID: uni.getStorageSync('OrganizationID') || "0",
|
|
// 制单信息
|
HMaker: getUserInfo()["Czymc"] || "",
|
HMakeDate: dayjs(new Date()).format("YYYY-MM-DD HH:mm:ss"),
|
HUpDater: "",
|
HUpDateDate: "",
|
HChecker: "",
|
HCheckDate: "",
|
HCloseMan: "",
|
HCloseDate: "",
|
HDeleteMan: "",
|
HDeleteDate: "",
|
},
|
};
|
},
|
methods: {
|
// 显示选择器弹窗
|
async showSelectorModule(index) {
|
if (this.hasSourceBill) {
|
uni.showToast({ title: '已有源单,不能修改', icon: 'none' });
|
return;
|
}
|
|
this.currentChechItemIDCache = 0;
|
this.enablePopupModule = this.PopupModuleNameList[index];
|
|
await this.$nextTick();
|
|
let popupRef = null;
|
if (index === 2) popupRef = this.$refs.GyBadReasonPopup;
|
else if (index === 7) popupRef = this.$refs.GyBadTypePopupVue;
|
else if (index === 8) popupRef = this.$refs.processPopup;
|
|
if (popupRef) {
|
popupRef.showPopup();
|
}
|
},
|
// 初始化职员数据的方法(仿照 InitHEmp)
|
async InitGyEmp() {
|
try {
|
let res = await CommonUtils.doRequest2Async({
|
url: "/Gy_Employee/list",
|
data: {
|
sWhere: ` and 组织名称 = '${uni.getStorageSync("Organization")}' and 禁用标记 = ''`,
|
user: getUserInfo()["Czymc"],
|
Organization: uni.getStorageSync("Organization"),
|
},
|
});
|
|
let { data, Message, count } = res.data;
|
|
if (count == 1) {
|
this.GyEmpList = data;
|
this.GyEmpNameList = Array.from(data).map((e) => e["职员名称"]);
|
} else {
|
CommonUtils.showTips({
|
title: "温馨提示",
|
message: `初始化职员失败: ${Message}`,
|
});
|
}
|
} catch (err) {
|
CommonUtils.showTips({
|
title: "温馨提示",
|
message: `初始化职员失败: ${err}`,
|
});
|
}
|
},
|
// 不良原因选择完成
|
// 新增:扫码获取源单号
|
scanSourceBill() {
|
// 调用微信扫码功能
|
uni.scanCode({
|
scanType: ['barCode', 'qrCode'],
|
success: (res) => {
|
// 将扫码结果赋值给源单号
|
this.hform.HMainSourceBillNo = res.result;
|
// 自动触发查询
|
this.GetMessageByHSourceBillNo();
|
},
|
fail: (err) => {
|
console.error('扫码失败:', err);
|
uni.showToast({
|
title: '扫码失败',
|
icon: 'none'
|
});
|
}
|
});
|
},
|
CheckItemComplete(e) {
|
if (e && e.retVal) {
|
let data = Object.values(e.retVal)[0];
|
this.hform.HBadReasonID = String(data.HItemID || 0);
|
this.hform.HBadReasonName = data.不良原因名称 || "";
|
}
|
this.$refs.GyBadReasonPopup?.exit();
|
this.enablePopupModule = "";
|
},
|
|
// 不良类型选择完成
|
HQCSchemeComplete(e) {
|
if (e && e.retVal) {
|
let data = Object.values(e.retVal)[0];
|
this.hform.HBadTypeID = String(data.HItemID || 0);
|
this.hform.HBadTypeName = data.不良类型名称 || "";
|
}
|
this.$refs.GyBadTypePopupVue?.exit();
|
this.enablePopupModule = "";
|
},
|
|
// 工序选择完成
|
HProcComplete(e) {
|
if (e && e.retVal) {
|
let data = Object.values(e.retVal)[0];
|
this.hform.HDisposeProcID = String(data.HItemID || 0);
|
this.hform.HDisposeProcName = data.工序名称 || "";
|
}
|
this.$refs.processPopup?.exit();
|
this.enablePopupModule = "";
|
},
|
|
// 初始化部门
|
async InitDept() {
|
try {
|
let res = await CommonUtils.doRequest2Async({
|
url: '/PublicPageMethod/DeptList',
|
data: { sWhere: 'where 1=1' }
|
});
|
if (res.data.count == 1) {
|
this.DeptList = res.data.data;
|
this.DeptNameList = res.data.data.map(e => e['HName']);
|
}
|
} catch (err) {
|
console.error('初始化部门错误:', err);
|
}
|
},
|
|
// 初始化职员
|
async InitHEmp() {
|
try {
|
let res = await CommonUtils.doRequest2Async({
|
url: "/Gy_Employee/list",
|
data: {
|
sWhere: ` and 组织名称 = '${uni.getStorageSync("Organization")}' and 禁用标记 = ''`,
|
},
|
});
|
|
if (res.data.count == 1) {
|
this.GyEmpList = res.data.data;
|
this.GyEmpNameList = res.data.data.map(e => e["职员名称"]);
|
}
|
} catch (err) {
|
console.error('初始化职员失败:', err);
|
}
|
},
|
|
// 打开源单选择器
|
openSourceBillSelector() {
|
if (!this.hform.HMainSourceBillType) {
|
uni.showToast({ title: '请先选择源单类型', icon: 'none' });
|
return;
|
}
|
this.$refs.billList.showPopup();
|
},
|
|
// 接收源单
|
handleSourceBill(e) {
|
this.hform.HMainSourceBillNo = e.HBillNo;
|
|
this.GetMessageByHSourceBillNo();
|
this.$refs.billList?.exit();
|
|
},
|
|
// 获取源单数据
|
async GetMessageByHSourceBillNo() {
|
if (!this.hform.HMainSourceBillType) {
|
uni.showToast({ title: '请选择源单类型', icon: 'none' });
|
return;
|
}
|
if (!this.hform.HMainSourceBillNo ) {
|
uni.showToast({ title: '请输入或者扫码源单号', icon: 'none' });
|
return;
|
}
|
|
try {
|
let res;
|
let user = getUserInfo()["Czymc"] || "";
|
let Organization = uni.getStorageSync('OrganizationID') || "";
|
|
// 根据源单类型调用不同的接口
|
if (this.hform.HMainSourceBillType === "7512") {
|
|
res = await CommonUtils.doRequest2Async({
|
url: "/Sc_ProcessMangement/Get_QC_NoPassProdRequestBillList",
|
type: "GET",
|
data: {
|
"sWhere": ` and 单据号 = '${this.hform.HMainSourceBillNo}'`,
|
"user": user
|
}
|
});
|
} else if (this.hform.HMainSourceBillType === "3791") {
|
|
res = await CommonUtils.doRequest2Async({
|
url: "/Cj_StationOutBill/get_Display_byPage",
|
type: "GET",
|
data: {
|
"sWhere": `and 单据号 = ''${this.hform.HMainSourceBillNo}''`,
|
"user": user,
|
"Organization": Organization,
|
"page": 1,
|
"size": 1,
|
"HBillSubType": "3791"
|
}
|
});
|
}
|
|
uni.hideLoading();
|
|
// 获取第一条数据
|
let data = null;
|
if (res.data) {
|
if (Array.isArray(res.data) && res.data.length > 0) {
|
data = res.data[0];
|
} else if (res.data.data && res.data.data.length > 0) {
|
data = res.data.data[0];
|
} else if (res.data.rows && res.data.rows.length > 0) {
|
data = res.data.rows[0];
|
} else if (res.data.list && res.data.list.length > 0) {
|
data = res.data.list[0];
|
}
|
}
|
|
if (data) {
|
// 根据源单类型处理数据
|
if (this.hform.HMainSourceBillType === "7512") {
|
// 处理不良品评审申请单数据(第一组数据)
|
this.hform.HBillNos = data.单据号 || "";
|
this.hform.HDates = data.日期 ? data.日期.split('T')[0] : "";
|
this.hform.HHappendDates = data.发生时间 ? data.发生时间.replace('T', ' ') : "";
|
this.hform.HICMOBillNos = data.任务单号 || "";
|
this.hform.HProcExchBillNos = data.工序流转卡号 || "";
|
this.hform.HMaterNumbers = data.产品代码 || "";
|
this.hform.HMaterNames = data.产品名称 || "";
|
this.hform.HMaterModels = data.规格型号 || "";
|
this.hform.HUnitNames = data.计量单位名称 || "";
|
this.hform.HMaterTypes = data.产品类型 === "1" ? "产成品" : data.产品类型 || "";
|
this.hform.HUnRightQtys = data.不良数量 || "0";
|
this.hform.HDeptNames = data.车间名称 || "";
|
this.hform.HProcNames = data.工序 || "";
|
this.hform.HBadPhenomenaNames = data.不良现象 || "";
|
this.hform.HBarCodes = data.不良品SN码 || "";
|
this.hform.HSeOrderBillNos = data.销售订单 || "";
|
this.hform.HReasonNotes = data.问题现象简述 || "";
|
this.hform.HLevs = data.紧急程度 || "普通";
|
this.hform.HIsStops = data.是否停线 || "否";
|
this.hform.HIsBatchUnRights = data.是否批量问题 || "否";
|
|
// 源单ID信息
|
this.hform.HMainSourceInterID = data.hmainid || "0";
|
this.hform.HMainSourceEntryID = data.任务单子内码 || "0";
|
|
} else if (this.hform.HMainSourceBillType === "3791") {
|
// 处理工序出站汇报单数据(第二组数据)
|
this.hform.HBillNos = data.单据号 || "";
|
this.hform.HDates = data.日期 ? data.日期.split('T')[0] : "";
|
this.hform.HHappendDates = data.出站时间 ? data.出站时间.replace('T', ' ') : "";
|
this.hform.HICMOBillNos = data.任务单 || "";
|
this.hform.HProcExchBillNos = data.工序流转卡号 || "";
|
this.hform.HMaterNumbers = data.产品代码 || "";
|
this.hform.HMaterNames = data.产品名称 || "";
|
this.hform.HMaterModels = data.规格型号 || "";
|
this.hform.HUnitNames = data.计量单位 || "";
|
this.hform.HMaterTypes = data.产品类型 || "";
|
|
// 不良数量 - 第二组数据中可能是不良数量字段
|
this.hform.HUnRightQtys = data.不良数量 || data.报废数量 || "0";
|
this.hform.HDeptNames = data.车间 || data.部门 || "";
|
this.hform.HProcNames = data.当前工序 || "";
|
|
// 不良现象 - 第二组数据可能没有这个字段
|
this.hform.HBadPhenomenaNames = data.不良现象 || "";
|
|
// 其他字段
|
this.hform.HBarCodes = data.批次号 || data.不良品SN码 || "";
|
this.hform.HSeOrderBillNos = data.销售订单 || "";
|
this.hform.HReasonNotes = data.问题现象简述 || "";
|
this.hform.HLevs = data.紧急程度 || "普通";
|
this.hform.HIsStops = data.是否停线 || "否";
|
this.hform.HIsBatchUnRights = data.是否批量问题 || "否";
|
|
// 源单ID信息
|
this.hform.HMainSourceInterID = data.hmainid || data.HProcExchInterID || "0";
|
this.hform.HMainSourceEntryID = data.HProcExchEntryID || "1";
|
}
|
|
// 设置源单类型显示
|
let index = this.arrayHMainSourceBillTypeID.findIndex(id => id == this.hform.HMainSourceBillType);
|
if (index != -1) {
|
this.HMainSourceBillTypeDisplay = this.arrayHMainSourceBillType[index];
|
}
|
|
this.hasSourceBill = false;
|
uni.showToast({ title: '加载成功', icon: 'success' });
|
|
// 强制更新视图
|
this.$forceUpdate();
|
|
} else {
|
uni.showToast({ title: '未找到源单', icon: 'none' });
|
}
|
} catch (err) {
|
uni.hideLoading();
|
console.error('获取失败:', err);
|
|
// 显示更详细的错误信息
|
if (err.response && err.response.data) {
|
console.error('错误详情:', err.response.data);
|
uni.showToast({ title: err.response.data.Message || '获取失败', icon: 'none' });
|
} else {
|
uni.showToast({ title: '获取失败', icon: 'none' });
|
}
|
}
|
},
|
|
// 处理部门选择
|
HDisposeDeptChange(val) {
|
let index = this.DeptNameList.findIndex(e => e == val);
|
if (index == -1) {
|
this.hform.HDisposeDeptName = '';
|
this.hform.HDisposeDeptID = '0';
|
return;
|
}
|
this.hform.HDisposeDeptName = this.DeptList[index]['HName'];
|
this.hform.HDisposeDeptID = String(this.DeptList[index]['HItemID']);
|
},
|
|
// 发起人选择
|
HSendManChange(val) {
|
let index = this.GyEmpList.findIndex(e => e["职员名称"] == val);
|
if (index == -1) {
|
this.hform.HSendMan = "";
|
return;
|
}
|
this.hform.HSendMan = this.GyEmpList[index]["职员名称"];
|
},
|
|
// 接收人选择
|
HReceiveManChange(val) {
|
let index = this.GyEmpList.findIndex(e => e["职员名称"] == val);
|
if (index == -1) {
|
this.hform.HReceiveMan = "";
|
return;
|
}
|
this.hform.HReceiveMan = this.GyEmpList[index]["职员名称"];
|
},
|
|
// 处理人选择
|
HDisposeEmpChange(val) {
|
let index = this.GyEmpList.findIndex(e => e["职员名称"] == val);
|
if (index == -1) {
|
this.hform.HDisposeEmpName = "";
|
this.hform.HDisposeEmpID = "0";
|
return;
|
}
|
this.hform.HDisposeEmpName = this.GyEmpList[index]["职员名称"];
|
this.hform.HDisposeEmpID = String(this.GyEmpList[index]["HItemID"]);
|
},
|
|
// 抄送人选择 -
|
HCopyManChange(val) {
|
let index = this.GyEmpList.findIndex(e => e["职员名称"] == val);
|
if (index == -1) {
|
this.hform.HCopyMan = "";
|
return;
|
}
|
this.hform.HCopyMan = this.GyEmpList[index]["职员名称"];
|
},
|
|
// 源单类型选择
|
HMainSourceBillTypeChange(e) {
|
let index = e.detail.value;
|
this.HMainSourceBillTypeDisplay = this.arrayHMainSourceBillType[index];
|
this.hform.HMainSourceBillType = this.arrayHMainSourceBillTypeID[index];
|
},
|
|
// 获取单据号
|
async getMaxBillNo() {
|
try {
|
let res = await CommonUtils.doRequest2Sync({
|
url: "/Web/GetMAXNum",
|
data: { HBillType: "7514" },
|
});
|
|
if (res?.data?.count == 1) {
|
this.hform.HInterID = res.data.data[0].HInterID;
|
this.hform.HBillNo = res.data.data[0].HBillNo;
|
}
|
} catch (err) {
|
console.error('获取单据号异常:', err);
|
}
|
},
|
|
// 验证
|
checkSubmitValidate() {
|
if (!this.hform.HBillNo) {
|
uni.showToast({ title: '单据号不能为空', icon: 'none' });
|
return false;
|
}
|
if (!this.hform.HSendMan) {
|
uni.showToast({ title: '发起人不能为空', icon: 'none' });
|
return false;
|
}
|
if (!this.hform.HReceiveMan) {
|
uni.showToast({ title: '接收人不能为空', icon: 'none' });
|
return false;
|
}
|
return true;
|
},
|
|
async getEditData(HInterID) {
|
if (!HInterID || HInterID === "0") return;
|
|
uni.showLoading({ title: '加载中...' });
|
|
try {
|
let res = await CommonUtils.doRequest2Async({
|
url: "/Sc_ProcessMangement/Edit_QC_NoPassProdDisposeBill",
|
type: "GET",
|
data: { "HID": HInterID }
|
});
|
|
if (res.data && res.data.data && res.data.data.length > 0) {
|
let data = res.data.data[0];
|
|
this.hform = {
|
...this.hform, // 保留原有的默认值
|
|
HInterID: data.hmainid || "0",
|
HEntryID: data.HEntryID || "0",
|
HBillNo: data.单据号 || "",
|
HDate: data.日期 ? data.日期.split('T')[0] : dayjs().format("YYYY-MM-DD"),
|
HBillType: data.HBillType || '7513',
|
|
|
HBillNos: data.源单号 || "", // 这是源单号
|
HDates: data.日期 ? data.日期.split('T')[0] : "", // 源单日期
|
HHappendDates: data.发生时间 ? data.发生时间.replace('T', ' ') : "",
|
|
|
HICMOBillNos: data.生产订单|| "",
|
HICMOInterIDs: data.HICMOInterIDs || "0",
|
HICMOEntryIDs: data.HICMOEntryIDs || "0",
|
|
|
HMaterNumbers: data.产品代码 || "",
|
HMaterNames: data.产品名称 || "",
|
HMaterModels: data.规格型号 || "",
|
HMaterIDs: data.HMaterID || "0",
|
HUnitNames: data.计量单位名称 || "",
|
HUnitIDs: data.HUnitID || "0",
|
HMaterTypes: data.产品类型 === "1" ? "产品类型" : data.产品类型 || "",
|
|
|
HProcExchBillNos: data.工序流转卡号 || "",
|
HProcExchInterIDs: data.HProcExchInterIDs || "0",
|
HProcExchEntryIDs: data.HProcExchEntryIDs || "0",
|
|
HDisposeEmpName:data.处理人 ,
|
HUnRightQtys: data.不良数量 || "0",
|
HLevs: data.紧急程度 || "普通",
|
HIsStops: data.是否停线 || "否",
|
HIsBatchUnRights: data.是否批量问题 || "否",
|
HBarCodes: data.不良品SN码 || "",
|
HBadPhenomenaNames: data.不良现象 || "",
|
HBadPhenomenaIDs: data.HBadPhenomenaID || "0",
|
HReasonNotes: data.问题现象简述 || "",
|
HNote:data.纠正及预防措施,
|
HDeptNames: data.车间名称 || "",
|
HDeptIDs: data.HDeptID || "0",
|
HProcNames: data.工序 || "",
|
HProcIDs: data.HProcID || "0",
|
|
|
HSeOrderBillNos: data.销售订单 || "",
|
HMainSourceBillType: data.源单类型 || "",
|
HMainSourceBillNo: data.源单号 || "",
|
HMainSourceInterID: data.源单ID || data.hmainid || "0",
|
HMainSourceEntryID: data.源单子ID || data.任务单子内码 || "0",
|
HSendMan: data.发送人 || "",
|
HReceiveMan: data.接收人 || "",
|
HCopyMan: data.抄送 || "",
|
HDisposeDeptName: data.处理部门 || "",
|
HDisposeDeptID: data.HDisposeDeptID || "0",
|
HDisposeProcID:data.HDisposeProcID || "0",
|
HDisposeProcName: data.处理工序 || "",
|
HDisposeEmpID: data.HDisposeEmpID || "0",
|
HCheckerResult: data.处理结论 || "",
|
HDisposeNote: data.处理结论详情 || "",
|
HBadTypeName: data.不良类型 || "",
|
HBadTypeID: data.HBadTypeID || "0",
|
HBadReasonName: data.不良原因 || "",
|
HBadReasonID: data.HBadReasonID || "0",
|
HRemark: data.表头备注 || "",
|
|
|
Organization: data.Organization || getUserInfo()["Organization"] || "",
|
HStockOrgID: data.HStockOrgID || uni.getStorageSync('OrganizationID') || "0",
|
HMaker: data.制单人 || "",
|
HMakeDate: data.制单日期 ? data.制单日期.replace('T', ' ') : "",
|
HUpDater: data.修改人 || "",
|
HUpDateDate: data.修改日期 ? data.修改日期.replace('T', ' ') : "",
|
HChecker: data.审核人 || "",
|
HCheckDate: data.审核日期 ? data.审核日期.replace('T', ' ') : "",
|
HCloseMan: data.关闭人 || "",
|
HCloseDate: data.关闭日期 ? data.关闭日期.replace('T', ' ') : "",
|
HDeleteMan: data.作废人 || "",
|
HDeleteDate: data.作废日期 ? data.作废日期.replace('T', ' ') : "",
|
};
|
|
|
if (data.源单类型) {
|
let index = this.arrayHMainSourceBillTypeID.findIndex(id => id == data.源单类型);
|
if (index != -1) {
|
this.HMainSourceBillTypeDisplay = this.arrayHMainSourceBillType[index];
|
}
|
}
|
|
|
this.hasSourceBill = false;
|
|
|
this.$forceUpdate();
|
|
console.log('赋值后的hform:', this.hform);
|
}
|
} catch (err) {
|
console.error('获取数据失败:', err);
|
uni.showToast({ title: '获取数据失败', icon: 'none' });
|
} finally {
|
uni.hideLoading();
|
}
|
},
|
|
// 保存
|
async submit() {
|
if (!this.checkSubmitValidate()) return;
|
|
let operation = this.operationType == 1 ? "Add" : "Update";
|
|
// 编辑时设置修改人和修改时间
|
if (this.operationType == 3) {
|
this.hform.HUpDater = getUserInfo()["Czymc"];
|
this.hform.HUpDateDate = dayjs(new Date()).format("YYYY-MM-DD HH:mm:ss");
|
}
|
|
try {
|
let sMainStr = JSON.stringify(this.hform);
|
let sMainSub = sMainStr + ';' + operation + ';' + getUserInfo()["Czymc"];
|
|
let res = await CommonUtils.doRequest2Sync({
|
url: "/Sc_ProcessMangement/SaveQC_NoPassProdDisposeBill",
|
data: { "msg": sMainSub },
|
method: "POST",
|
});
|
|
if (res?.data?.count == 1) {
|
uni.showModal({
|
title: '提示',
|
content: '保存成功,是否继续新增?',
|
success: (r) => {
|
if (r.confirm) {
|
uni.redirectTo({
|
url: "/pages/ZLGL/QCNoPassProdDisposeBillMainList/QCNoPassProdDisposeBillMain?operationType=1",
|
});
|
} else {
|
uni.navigateBack();
|
}
|
}
|
});
|
} else {
|
uni.showToast({ title: res?.data?.Message || '保存失败', icon: 'none' });
|
}
|
} catch (err) {
|
console.error('保存失败:', err);
|
uni.showToast({ title: '保存失败', icon: 'none' });
|
}
|
},
|
|
// 新增
|
addNew() {
|
uni.redirectTo({
|
url: "/pages/ZLGL/QCNoPassProdDisposeBillMainList/QCNoPassProdDisposeBillMain?operationType=1",
|
});
|
},
|
|
// 返回
|
goBack() {
|
uni.navigateBack();
|
},
|
},
|
|
async onLoad(e) {
|
this.operationType = parseInt(e.operationType) || 1;
|
this.hform.HInterID = e.HInterID || "0";
|
|
const organization = uni.getStorageSync('Organization');
|
this.hform.Organization = organization || '';
|
|
|
await this.InitGyEmp();
|
await this.InitDept();
|
|
if (this.operationType == 1) {
|
await this.getMaxBillNo();
|
this.hform.HSendMan = getUserInfo()["Czymc"] || "";
|
} else if (this.operationType == 3) {
|
await this.getEditData(e.HInterID);
|
}
|
}
|
};
|
</script>
|
|
<style lang="scss" scoped>
|
/* 样式保持不变 */
|
input { width: inherit; font-size: 26rpx; }
|
.uni-input { padding: 0; }
|
|
.bill-main-tabs {
|
box-sizing: border-box;
|
width: 730rpx;
|
display: flex;
|
flex-direction: row;
|
flex-wrap: nowrap;
|
gap: 20rpx;
|
border-bottom: 1px solid #ddd;
|
padding: 20rpx 10rpx;
|
|
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 {
|
box-sizing: border-box;
|
padding: 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: #f5f5f5; }
|
}
|
}
|
|
.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;
|
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; }
|
}
|
|
.select-border {
|
border: 1px solid #acacac !important;
|
border-radius: 22rpx !important;
|
}
|
|
.no-border-select ::v-deep .uni-select {
|
border: none !important;
|
}
|
|
.icon-wrapper, .icon-wrapper-big {
|
background-color: #3a78ff;
|
border-radius: 100%;
|
display: flex;
|
justify-content: center;
|
align-items: center;
|
flex-shrink: 0;
|
margin-left: 20rpx;
|
.uni-icons { color: #fff !important; }
|
}
|
|
.icon-wrapper { width: 40rpx; height: 40rpx; }
|
.icon-wrapper-big { width: 50rpx; height: 50rpx; }
|
|
.enable-icon-button { background-color: #3a78ff; }
|
.disable-icon-button { background-color: lightgray; pointer-events: none; }
|
|
|
</style>
|