<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-select" style="position: relative" :class="!hasSourceBill?'':'disabled'">
|
<!-- <picker mode="selector" :range="HSourceBillTypeNameList" :disabled="hasSourceBill"
|
@change="HSourceBillTypeNameChange">
|
<input type="text" placeholder="请选择源单类型" v-model="HSourceBillType" />
|
<view class="picker-overlay"></view>
|
</picker> -->
|
<zxz-uni-data-select
|
v-model="hform.HSourceBillType"
|
dataKey="typeName"
|
dataValue="typeID"
|
:filterable="true"
|
:localdata="HSourceBillTypeList"
|
:clear="false"
|
:disabled="hasSourceBill"
|
@change="HSourceBillTypeNameChange"
|
></zxz-uni-data-select>
|
</view>
|
|
</view>
|
<view class="form-item">
|
|
<view class="left">源单单号</view>
|
<view class="right" :class="!hasSourceBill?'':'disabled'">
|
<input type="text" :disabled="hasSourceBill" placeholder="请输入或扫描源单号"
|
v-model="hform.HSourceBillNo" @confirm="getSourceBillInfo(hform.HSourceBillNo)" />
|
</view>
|
<view class="icon-wrapper-big">
|
<uni-icons class="right-icon" type="scan"
|
:class="!hasSourceBill?'enable-icon-button':'disable-icon-button'"
|
:disabled="hasSourceBill" size="20" @click="toScanCode"></uni-icons>
|
</view>
|
<view class="icon-wrapper-big">
|
<uni-icons class="right-icon" type="search"
|
:class="!hasSourceBill?'enable-icon-button':'disable-icon-button'"
|
:disabled="hasSourceBill" size="20" @click="toBillSelector"></uni-icons>
|
</view>
|
</view>
|
|
|
<view class="form-item">
|
<view class="left">产品代码</view>
|
<view class="right disabled">
|
<input type="text" disabled :value="hform.HMaterNumber" />
|
</view>
|
</view>
|
<view class="form-item">
|
<view class="left">产品名称</view>
|
<view class="right disabled">
|
<input type="text" disabled :value="hform.HMaterName" />
|
</view>
|
</view>
|
<view class="form-item">
|
<view class="left">源单数量</view>
|
<view class="right disabled">
|
<input type="number" v-model="hform.HSourceBillQty" />
|
</view>
|
</view>
|
<view class="form-item">
|
<view class="left">检验数量</view>
|
<view class="right">
|
<input type="number" v-model="hform.HCheckQty" :disabled="hasCheckQty" />
|
</view>
|
</view>
|
<view class="form-item">
|
<view class="left">生产班组</view>
|
<view class="right-select">
|
<zxz-uni-data-select
|
v-model="hform.HGroupID"
|
dataKey="班组名称"
|
dataValue="HItemID"
|
:filterable="true"
|
:localdata="HGroupList"
|
:clear="false"
|
></zxz-uni-data-select>
|
</view>
|
</view>
|
<view class="form-item">
|
<view class="left">检验员</view>
|
<view class="right-select">
|
<zxz-uni-data-select
|
v-model="hform.HEmpID"
|
dataKey="职员名称"
|
dataValue="HItemID"
|
:filterable="true"
|
:localdata="HCheckEmpList"
|
:clear="false"
|
></zxz-uni-data-select>
|
</view>
|
</view>
|
|
<view class="form-item">
|
<view class="left">工序</view>
|
<view class="right disabled">
|
<input type="text" disabled :value="hform.HProcName" />
|
</view>
|
|
</view>
|
|
<view class="form-item">
|
<view class="left">生产资源</view>
|
<view class="right-select">
|
<zxz-uni-data-select
|
v-model="hform.HSourceID"
|
dataKey="生产资源名称"
|
dataValue="HItemID"
|
:filterable="true"
|
:localdata="HSourceList"
|
:clear="false"
|
></zxz-uni-data-select>
|
</view>
|
</view>
|
|
<view class="form-item">
|
<view class="left">备注</view>
|
<view class="right">
|
<input type="text" v-model="hform.HRemark" value="" />
|
</view>
|
</view>
|
</view>
|
<!-- 其他信息 -->
|
<view class="bill-main-content" v-if="mainTabSelected == 2">
|
<view class="list" v-for="(item,index) in HisReportList" :key="index">
|
<uni-card :title="item.HBadReasonName" style="margin: 10px;" @tap="delReason(item, $event)">
|
<view class="card-detail">
|
<view
|
class="detail"
|
v-for="(value, key,keyIndex) in item"
|
:key="key"
|
v-if="shouldShowField(key, value)"
|
>
|
<text>{{ formatFieldName(key) }}:</text>{{ value }}
|
</view>
|
</view>
|
</uni-card>
|
</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 class="bill-sub-area">
|
<!-- 子表页签 -->
|
<view class="bill-sub-tabs">
|
<view v-for="subTab in subTabs" :key="subTab.typeID" :class="subTab.typeID == subTabSelected ? 'selected' : ''"
|
@tap="subTabSelected = subTab.typeID">{{ subTab.typeName }}</view>
|
</view>
|
<!-- 子表内容 -->
|
<view class="reason-container-flex">
|
<!-- 检测值 呈现 -->
|
<view v-for="item in HBadReasonList"
|
v-if="item.不良类型id==subTabSelected"
|
:key="item.HItemID"
|
class="reason-item-flex"
|
:class="{ 'double-clicked': item.isDoubleClicked }"
|
@click="reasonClick(item)"
|
>
|
<view >
|
<view>{{ item.不良原因代码 }}</view>
|
<view>{{ item.不良原因名称 }}</view>
|
<view>汇报总数:{{ item.num }}</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>
|
|
<BillListPopupVue ref="billList" :HBillType="hform.HBillType" :HSourceBillType="hform.HSourceBillType"
|
:HStockOrgID="hform.HStockOrgID" @BillSelectComplete="HandleBillSelectComplete"></BillListPopupVue>
|
</view>
|
</template>
|
|
<script>
|
import dayjs from "dayjs";
|
import {
|
CommonUtils
|
} from "../../../utils/common";
|
|
import BillListPopupVue from "../../../components/BillListPopup/BillListPopup.vue";
|
import {
|
getUserInfo
|
} from "../../../utils/auth";
|
import {
|
MpaasScan
|
} from "../../../utils/mpaasScan";
|
export default {
|
components: {
|
|
BillListPopupVue,
|
},
|
computed: {
|
},
|
data() {
|
return {
|
serverUrl: uni.getStorageSync('serverUrl') || 'http://47.96.97.237/API',
|
//上一次点击时间
|
lastClickTime: 0,
|
operationType: 1,
|
|
mainTabSelected: 1,
|
subTabSelected: 0,
|
|
// 源单状态控制
|
hasSourceBill: false,
|
hasCheckQty:false,
|
// 子表 页签信息
|
subTabs: {
|
0: {
|
typeID: "0",
|
typeName: "其它类型",
|
},
|
},
|
HBadReasonList:[],
|
//源单类型
|
HSourceBillTypeList:[{typeID:"3772",typeName:"工序流转卡"},{typeID:"0",typeName:"历史缓存"}],
|
//生产资源
|
HSourceList:[],
|
//检验员
|
HCheckEmpList:[],
|
//班组
|
HGroupList:[],
|
//历史扫码记录
|
HisReportList:[],
|
// 主表属性
|
hform: {
|
HBillType: '3717',
|
HBillNo: "",
|
HInterID: "0",
|
HDate: dayjs(new Date()).format("YYYY-MM-DD"),
|
HSourceID: getUserInfo().HSourceID,
|
HEmpID:getUserInfo().HEmpID,
|
HGroupID:getUserInfo().HGroupID,
|
HDeptID:0,
|
HMaterNumber: "",
|
HMaterID: "0",
|
HMaterName: "",
|
HProcID: "0",
|
|
HRemark: "",
|
HMaker: getUserInfo()["Czymc"] || "",
|
HChecker: "",
|
HCloseMan: "",
|
HMakeDate: dayjs(new Date()).format("YYYY-MM-DDTHH:mm:ss"),
|
HCheckDate: "",
|
HCloseDate: "",
|
HUpDater: "",
|
HDeleteMan: "",
|
HUpDateDate: "",
|
HDeleteDate: "",
|
|
HCheckQty: 0,
|
//源单信息
|
HSourceBillQty: 0,
|
HSourceBillType: "3772",
|
//流转卡信息
|
HICMOBillNo: "",
|
HICMOInterID: "0",
|
HICMOEntryID: "1",
|
HICMOQty: "0",
|
HProcExchBillNo: "",
|
HProcExchInterID: "0",
|
HProcExchEntryID: "0",
|
HProcExchQty: "0",
|
HMainSourceBillType: "",
|
HMainSourceInterID: "0",
|
HMainSourceEntryID: "1",
|
HMainSourceBillNo: "",
|
HStockOrgID: uni.getStorageSync('OrganizationID'),
|
},
|
};
|
},
|
methods: {
|
// 判断哪些字段需要显示
|
shouldShowField(key, value) {
|
// 排除不需要显示的字段
|
const excludeKeys = ['单据号', '日期']; // 这些字段已经在其他地方显示了
|
|
// 判断key是否全英文(不包含中文)
|
const isAllEnglish = /^[a-zA-Z]+$/.test(key);
|
|
// 判断key是否包含"ID"(不区分大小写)
|
const containsID = key.toUpperCase().includes('ID');
|
|
return !excludeKeys.includes(key) &&
|
//!isAllEnglish && // 排除全英文的key
|
!containsID && // 排除包含ID的key
|
value !== null &&
|
value !== undefined &&
|
value !== '';
|
},
|
|
// 格式化字段名显示
|
formatFieldName(key) {
|
// 你可以根据需求自定义显示名称
|
const nameMap = {
|
'HBadReasonNumber': '不良原因代码',
|
'HBadReasonHName': '不良原因名称',
|
'HCheckMan': '检验员',
|
'HGroupName': '班组',
|
'HSourceName': '生产资源',
|
// ... 其他字段映射
|
};
|
return nameMap[key] || key;
|
},
|
//不良原因单击
|
reasonClick(item) {
|
const now = Date.now();
|
if (now - this.lastClickTime < 300) {
|
// 双击逻辑
|
this.handleDoubleClick(item);
|
this.lastClickTime = 0;
|
} else {
|
// 单击逻辑
|
this.handleSingleClick(item);
|
this.lastClickTime = now;
|
}
|
},
|
handleSingleClick(item) {
|
console.log('单击:', item.不良原因名称);
|
},
|
handleDoubleClick(item) {
|
|
|
// 设置双击状态
|
this.$set(item, 'isDoubleClicked', true);
|
|
// 300ms后移除动画类(与动画时长匹配)
|
setTimeout(() => {
|
this.$set(item, 'isDoubleClicked', false);
|
}, 300);
|
|
// 实际业务逻辑
|
console.log('双击:', item.不良原因名称);
|
|
this.submitBarCode(item);
|
uni.vibrateShort(); // 可选:震动反馈
|
},
|
// 源单类型选择
|
HSourceBillTypeNameChange(e) {
|
|
const pages = getCurrentPages()
|
// 获取页面栈中的最后一个元素,也就是当前显示的页面
|
const currentPage = pages[pages.length - 1]
|
// 选择源单类型后 缓存当前页面选择
|
uni.setStorageSync(`${currentPage.route.split("/").pop()}_HSourceBillTypeCache`, {
|
HSourceBillType: this.hform.HSourceBillType
|
})
|
},
|
// 读取缓存
|
loadCache() {
|
const pages = getCurrentPages()
|
// 获取页面栈中的最后一个元素,也就是当前显示的页面
|
const currentPage = pages[pages.length - 1]
|
let HBillTypeCache = uni.getStorageSync(`${currentPage.route.split("/").pop()}_HSourceBillTypeCache`)
|
if (HBillTypeCache) {
|
this.hform.HSourceBillType = HBillTypeCache.HSourceBillType
|
}
|
},
|
// 根据源单类型选择单据
|
toBillSelector() {
|
this.$refs['billList'].showPopup()
|
},
|
toScanCode() {
|
MpaasScan.scanCode((res) => {
|
if (res) {
|
this.getSourceBillInfo(res);
|
}
|
});
|
},
|
async getGy_BadReasonList() {
|
let sWhere = ` and HUSEORGID = '${uni.getStorageSync('OrganizationID')}' and ISNULL(审核人,'') != '' `
|
if (this.serverUrl == 'http://122.228.39.234:7177/API/') {
|
//海诚根据物料分组设置不良原因
|
sWhere += " and 不良类型 like '%成品%' order by 不良原因代码"
|
}else{
|
sWhere += " order by 不良原因代码"
|
}
|
let res = await CommonUtils.doRequest2Async({
|
url: "/Gy_BadReason/list",
|
data: {
|
sWhere:sWhere,
|
user:getUserInfo()["Czymc"]
|
}
|
})
|
|
console.log(res)
|
let {
|
data,
|
Message,
|
count
|
} = res.data
|
if (count == 1) {
|
data.forEach(item=>{
|
const typeID = item["不良类型id"]
|
const typeName = item["不良类型"]
|
if (!this.subTabs[typeID]) {
|
this.subTabs[typeID] = {
|
typeID: typeID,
|
typeName: typeName
|
}
|
}
|
})
|
this.HBadReasonList = data;
|
|
} else {
|
CommonUtils.showTips({
|
title: '温馨提示',
|
message: Message
|
})
|
}
|
},
|
async getSourceBillInfo(HBarCode) {
|
console.log('HBarCode: ', HBarCode);
|
let res = await CommonUtils.doRequest2Async({
|
url: "/WEBSController/get_CheckBillBarCode_Json_CheckItem",
|
data: {
|
HBillType: this.hform.HBillType,
|
HSourceBillType: this.hform.HSourceBillType,
|
HBarCode: HBarCode,
|
HInterID: 0,
|
HEntryID: 0,
|
Mode: 1 ,//扫码模式
|
user:getUserInfo()["Czymc"]
|
}
|
})
|
|
console.log(res)
|
let {
|
data,
|
Message,
|
count
|
} = res.data
|
if (count == 1) {
|
this.hform.HMaterID = data[0]['HMaterID']
|
this.hform.HMaterName = data[0]['产品名称']
|
this.hform.HMaterNumber = data[0]['产品代码']
|
//源单信息
|
this.hform.HMainSourceBillNo = data[0]['HBillNo']
|
this.hform.HSourceBillNo = data[0]['HBillNo']
|
this.hform.HMainSourceInterID = data[0].HInterID
|
this.hform.HMainSourceEntryID = data[0].HEntryID
|
this.hform.HSourceBillQty = data[0].流转卡数量
|
this.hform.HICMOBillNo= data[0].任务单号
|
this.hform.HICMOInterID= data[0].HICMOInterID
|
this.hform.HICMOEntryID= data[0].HICMOEntryID
|
this.hform.HICMOQty= data[0].生产数量
|
this.hform.HProcExchBillNo= data[0].单据号
|
this.hform.HProcExchInterID= data[0].HInterID
|
this.hform.HProcExchEntryID= data[0].HEntryID
|
this.hform.HProcExchQty= data[0].流转卡数量
|
this.hasSourceBill = true
|
|
this.hform.HSourceName= data[0].生产资源
|
this.hform.HSourceID= data[0].HSourceID
|
this.hform.HProcID= data[0].HProcID
|
this.hform.HProcName= data[0].当前工序
|
this.hform.HDeptID= data[0].HWorkShopID
|
|
} else {
|
CommonUtils.showTips({
|
title: '温馨提示',
|
message: Message
|
})
|
}
|
},
|
async HandleBillSelectComplete(e) {
|
if(this.hform.HSourceBillType=="0"){
|
this.hform.HSourceBillType = e.billInfo["HSourceBillType"];
|
this.hform.HBillNo = e.billInfo["缓存单据号"];
|
this.hform.HInterID = e.billInfo["HInterID"];
|
this.hform.HCheckQty = e.billInfo["检验数量"];
|
await this.getHisReportList();
|
}
|
try {
|
let res = await CommonUtils.doRequest2Async({
|
url: "/WEBSController/get_CheckBillBarCode_Json_CheckItem",
|
data: {
|
HBillType: this.hform.HBillType,
|
HSourceBillType: this.hform.HSourceBillType,
|
HBarCode: "",
|
HInterID: e?.HInterID,
|
HEntryID: e?.HEntryID,
|
Mode: 2 ,//选单模式
|
user:getUserInfo()["Czymc"]
|
}
|
})
|
|
let {
|
data,
|
Message,
|
count
|
} = res.data
|
if (count == 1) {
|
console.log('获取源单:', data)
|
this.hform.HMaterID = data[0]['HMaterID']
|
this.hform.HMaterName = data[0]['产品名称']
|
this.hform.HMaterNumber = data[0]['产品代码']
|
//源单信息
|
this.hform.HMainSourceBillNo = data[0]['HBillNo']
|
this.hform.HSourceBillNo = data[0]['HBillNo']
|
this.hform.HMainSourceInterID = data[0].HInterID
|
this.hform.HMainSourceEntryID = data[0].HEntryID
|
this.hform.HSourceBillQty = data[0].流转卡数量
|
this.hform.HICMOBillNo= data[0].任务单号
|
this.hform.HICMOInterID= data[0].HICMOInterID
|
this.hform.HICMOEntryID= data[0].HICMOEntryID
|
this.hform.HICMOQty= data[0].生产数量
|
this.hform.HProcExchBillNo= data[0].单据号
|
this.hform.HProcExchInterID= data[0].HInterID
|
this.hform.HProcExchEntryID= data[0].HEntryID
|
this.hform.HProcExchQty= data[0].流转卡数量
|
|
this.hasSourceBill = true
|
|
this.hform.HSourceName= data[0].生产资源
|
this.hform.HSourceID= data[0].HSourceID
|
this.hform.HProcID= data[0].HProcID
|
this.hform.HProcName= data[0].当前工序
|
this.hform.HDeptID= data[0].HWorkShopID
|
this.$refs['billList'].exit()
|
} else {
|
CommonUtils.showTips({
|
title: '温馨提示',
|
message: Message
|
})
|
}
|
|
|
} catch (err) {
|
CommonUtils.showTips({
|
title: '温馨提示',
|
message: "源单下推错误: " + err
|
})
|
}
|
|
},
|
// 历史扫码记录获取初始化
|
async getHisReportList() {
|
try {
|
let res = await CommonUtils.doRequest2Async({
|
url: "/Sc_QualityReportBill/get_BarCodeDetail",
|
data: {
|
HInterID: this.hform.HInterID,
|
|
},
|
});
|
|
let {
|
data,
|
Message,
|
count
|
} = res.data;
|
|
if (count == 1) {
|
console.log("data: ", data);
|
this.HisReportList = data;
|
|
} else {
|
this.HisReportList = [];
|
CommonUtils.showTips({
|
title: "温馨提示",
|
message: `获取历史扫码记录失败: ${Message}`,
|
});
|
}
|
} catch (err) {
|
CommonUtils.showTips({
|
title: "温馨提示",
|
message: `获取历史扫码记录失败: ${err}`,
|
});
|
}
|
},
|
//删除历史记录
|
delReason(item) {
|
uni.showModal({
|
title: '提示',
|
content: '确认要删除 "' + item.HBadReasonHName + '" 的扫码记录?删除后将不可恢复!',
|
success: (res) => {
|
if (res.confirm) {
|
uni.request({
|
url: this.serverUrl +
|
'/Sc_QualityReportBill/del_BarCodeDetail',
|
data: {
|
HItemID: item.HItemID,
|
|
},
|
success: (res) => {
|
if (res.data.count == 1) {
|
this.getHisReportList()
|
uni.showToast({
|
title: "删除成功",
|
icon: 'none'
|
})
|
} else {
|
uni.showToast({
|
title: res.data.Message,
|
icon: 'none'
|
})
|
}
|
},
|
fail: (res) => {
|
console.log(res);
|
uni.showToast({
|
title: '接口请求失败',
|
icon: 'none'
|
})
|
}
|
});
|
|
}
|
}
|
});
|
},
|
|
// 检验员初始化
|
async InitHEmp() {
|
try {
|
let res = await CommonUtils.doRequest2Async({
|
url: "/Gy_Employee/list",
|
data: {
|
sWhere: ` and 禁用标记 = '' order by 部门代码`,
|
user: getUserInfo()["Czymc"],
|
Organization: uni.getStorageSync("Organization"),
|
},
|
});
|
|
let {
|
data,
|
Message,
|
count
|
} = res.data;
|
|
if (count == 1) {
|
console.log("data: ", data);
|
this.HCheckEmpList = data;
|
|
} else {
|
CommonUtils.showTips({
|
title: "温馨提示",
|
message: `初始化检验员失败: ${Message}`,
|
});
|
}
|
} catch (err) {
|
CommonUtils.showTips({
|
title: "温馨提示",
|
message: `初始化检验员失败: ${err}`,
|
});
|
}
|
},
|
// 生产资源初始化
|
async InitHSource() {
|
try {
|
let res = await CommonUtils.doRequest2Async({
|
url: "/Gy_Source/list",
|
data: {
|
sWhere: `and 禁用标记 != 'Y' and 组织 = '${uni.getStorageSync("Organization")}'`,
|
user: getUserInfo()["Czymc"],
|
},
|
});
|
|
let {
|
data,
|
Message,
|
count
|
} = res.data;
|
|
if (count == 1) {
|
this.HSourceList = data;
|
} else {
|
CommonUtils.showTips({
|
title: "温馨提示",
|
message: `初始化生产资源失败: ${Message}`,
|
});
|
}
|
} catch (err) {
|
CommonUtils.showTips({
|
title: "温馨提示",
|
message: `初始化生产资源失败: ${err}`,
|
});
|
}
|
},
|
// 班组初始化
|
async InitHGroup() {
|
try {
|
let res = await CommonUtils.doRequest2Async({
|
url: "/Gy_Group/list",
|
data: {
|
sWhere: `and 禁用标记 != 'Y' and 组织 = '${uni.getStorageSync("Organization")}'`,
|
user: getUserInfo()["Czymc"],
|
},
|
});
|
|
let {
|
data,
|
Message,
|
count
|
} = res.data;
|
|
if (count == 1) {
|
this.HGroupList = data;
|
} else {
|
CommonUtils.showTips({
|
title: "温馨提示",
|
message: `初始化班组失败: ${Message}`,
|
});
|
}
|
} catch (err) {
|
CommonUtils.showTips({
|
title: "温馨提示",
|
message: `初始化班组失败: ${err}`,
|
});
|
}
|
},
|
async getMaxBillNo() {
|
try {
|
let res = await CommonUtils.doRequest2Sync({
|
url: "/Web/GetMAXNum",
|
data: {
|
HBillType: "3717",
|
},
|
});
|
|
if (!res) {
|
return;
|
}
|
|
let {
|
data,
|
Message,
|
count
|
} = 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,
|
});
|
}
|
},
|
//提交不良原因扫码记录缓存
|
async submitBarCode(item){
|
if(!this.checkSubmitValidate()){
|
return
|
}
|
try {
|
let oMainObject = {
|
HInterID:this.hform.HInterID//递入type得到的单据ID
|
,HBillNo:this.hform.HBillNo
|
,HBillType:this.hform.HBillType
|
,HDate:new Date()
|
,HICMOBillNo:this.hform.HICMOBillNo
|
,HICMOInterID:this.hform.HICMOInterID
|
,HICMOEntryID:this.hform.HICMOEntryID
|
,HProcExchBillNo:this.hform.HProcExchBillNo
|
,HProcExchInterID:this.hform.HProcExchInterID
|
,HProcExchEntryID:this.hform.HProcExchEntryID
|
,HProcID:this.hform.HProcID
|
,HMaterID:this.hform.HMaterID
|
,HSourceID:this.hform.HSourceID
|
,HGroupID:this.hform.HGroupID
|
,HDeptID:this.hform.HDeptID
|
,HCheckManID:this.hform.HEmpID
|
,HBadReasonID:item.HItemID
|
,HBarCode:item.不良原因代码
|
,HMaker:this.hform.HMaker
|
,HMakeDate:this.hform.HMakeDate
|
,HReportType:1
|
,HSourceBillType:this.hform.HSourceBillType
|
,HBadReasonHQty:1
|
,HQty:this.hform.HCheckQty
|
}
|
var sMainStr = JSON.stringify(oMainObject);
|
var oMain = sMainStr + ';' + this.operationType;
|
|
let res = await CommonUtils.doRequest2Sync({
|
url: "/Sc_QualityReportBill/set_SaveBarCode",
|
data: {
|
oMain: oMain,
|
},
|
method: "POST",
|
});
|
|
if (!res) {
|
return;
|
}
|
|
let {
|
count,
|
Message,
|
data
|
} = res.data;
|
if (count == 1) {
|
CommonUtils.showTips({
|
title: "保存成功",
|
message: `保存成功`,
|
});
|
if(!item.num){
|
this.$set(item, 'num', 1);
|
}else{
|
this.$set(item, 'num', item.num+1);
|
}
|
console.log(item.num)
|
//this.$set(item, 'num', newValue);
|
this.getHisReportList();
|
this.hasCheckQty=true;
|
} else {
|
CommonUtils.showTips({
|
title: "温馨提示",
|
message: `不良原因保存错误: ${Message}`,
|
});
|
}
|
} catch (err) {
|
CommonUtils.showTips({
|
title: "温馨提示",
|
message: `不良原因保存错误: ${err}`,
|
});
|
}
|
},
|
checkSubmitValidate() {
|
// if (this.hform.HICMOQty == "" || this.hform.HICMOQty <= 0) {
|
// CommonUtils.showTips({
|
// message: "任务单数量不能为空且不能小于等于0!",
|
// });
|
// return false;
|
// }
|
|
if (this.hform.HCheckQty==0||this.hform.HCheckQty=="") {
|
CommonUtils.showTips({
|
message: "请输入检验数量!",
|
});
|
return false;
|
}
|
if (this.hform.HEmpID == 0) {
|
CommonUtils.showTips({
|
message: "检验员未选择!",
|
});
|
return false;
|
}
|
if (!this.hasSourceBill) {
|
CommonUtils.showTips({
|
message: "源单未选择!",
|
});
|
return false;
|
}
|
|
return true;
|
},
|
async submit() {
|
// if (!this.checkSubmitValidate()) {
|
// return;
|
// }
|
if(this.HisReportList.length<=0){
|
CommonUtils.showTips({
|
title: "温馨提示",
|
message: `请输入检验信息`,
|
});
|
return
|
}
|
try {
|
console.log('this.$refs: ', this.$refs);
|
|
let res = await CommonUtils.doRequest2Sync({
|
url: "/Sc_QualityReportBill/set_SaveBill",
|
data: {
|
HInterID: this.hform.HInterID,
|
HBillNo: this.hform.HBillNo,
|
HChecker: getUserInfo()["Czymc"],
|
HBillSubType: this.hform.HBillType
|
},
|
method: "Get",
|
});
|
|
if (!res) {
|
return;
|
}
|
|
let {
|
count,
|
Message,
|
data
|
} = res.data;
|
if (count == 1) {
|
uni.showModal({
|
title: "提示",
|
content: res.data.Message + "。是否继续新增?",
|
success: (res) => {
|
if (res.confirm) {
|
console.log("用户点击确定");
|
uni.redirectTo({
|
url: "/pages/ZLGL/QualityReportStep/QualityReportStepBill?operationType=1",
|
});
|
} else if (res.cancel) {
|
console.log("用户点击取消");
|
// setTimeout(() => {
|
// uni.navigateBack();
|
// }, 50)
|
}
|
},
|
});
|
} else {
|
CommonUtils.showTips({
|
title: "温馨提示",
|
message: `全检检验单单保存错误: ${Message}`,
|
});
|
}
|
} catch (err) {
|
CommonUtils.showTips({
|
title: "温馨提示",
|
message: `全检检验单单保存错误: ${err}`,
|
});
|
}
|
},
|
addNew() {
|
uni.redirectTo({
|
url: "/pages/ZLGL/QualityReportStep/QualityReportStepBill",
|
});
|
},
|
goBack() {
|
uni.navigateBack();
|
},
|
|
},
|
async onLoad(e) {
|
this.operationType = e.operationType || 1;
|
this.hform.HInterID = e.linterid || 0;
|
if (this.operationType == 1) {
|
await this.getMaxBillNo();
|
} else if (this.operationType == 2) {
|
|
}
|
this.getGy_BadReasonList();
|
await this.InitHSource();
|
await this.InitHEmp();
|
await this.InitHGroup();
|
await this.loadCache();
|
},
|
};
|
</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: 100%;
|
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: row;
|
flex-wrap: wrap; /* 超出自动换行 */
|
/* 可选:设置换行后的对齐方式 */
|
align-content: flex-start; /* 多行对齐方式 */
|
.form-item {
|
width: 600rpx;
|
display: flex;
|
align-items: center;
|
font-size: 26rpx;
|
padding: 6rpx 0;
|
margin-right: 20rpx;
|
.left {
|
width: 208rpx;
|
|
text {
|
color: red;
|
font-weight: bold;
|
}
|
}
|
|
.right {
|
// width: 450rpx;
|
padding: 8rpx 20rpx;
|
font-size: 26rpx;
|
flex: 1;
|
border-radius: 22rpx;
|
border: 1px solid #acacac;
|
|
.uni-combox {
|
padding: 0;
|
height: auto;
|
|
.uni-input-placeholder,
|
.uni-input-input {
|
font-size: 26rpx;
|
}
|
}
|
|
.uni-combox::v-deep input {
|
height: inherit;
|
font-size: 26rpx;
|
}
|
}
|
.right-select {
|
//padding: 8rpx 20rpx;
|
font-size: 26rpx;
|
flex: 1;
|
|
}
|
.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-b {
|
background-color: #41a863;
|
color: #fff;
|
}
|
|
.btn-c {
|
background-color: #acacac;
|
color: #fff;
|
// position: absolute;
|
// right: 120rpx;
|
}
|
|
.btn-d {
|
background-color: #ff8901;
|
color: #fff;
|
}
|
}
|
|
.buttons {
|
box-sizing: border-box;
|
width: 100%;
|
display: flex;
|
justify-content: center;
|
padding: 10rpx 0;
|
|
button {
|
border-radius: 50rpx;
|
width: 180rpx;
|
height: 66rpx;
|
line-height: 66rpx;
|
font-size: 26rpx;
|
}
|
|
.btn-a {
|
background-color: #acacac;
|
color: #fff;
|
}
|
|
.btn-b {
|
background-color: #41a863;
|
color: #fff;
|
}
|
|
.btn-c {
|
background-color: #3a78ff;
|
color: #fff;
|
}
|
}
|
|
.list {
|
width: 50%;
|
|
.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 {
|
// width: 50%;
|
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;
|
}
|
|
.sampleDestory {
|
border: 1px solid #acacac;
|
border-radius: 10%;
|
padding: 0 12rpx;
|
}
|
.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;
|
}
|
}
|
|
.pass-background {
|
background-color: #cee3f2;
|
border: none;
|
}
|
|
.unpass-background {
|
background-color: #f0d6e3;
|
border: none;
|
}
|
.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;
|
}
|
/* 基础样式 */
|
.reason-container-flex {
|
display: flex;
|
flex-wrap: wrap;
|
justify-content: flex-start;
|
align-items: flex-start;
|
gap: 10px; /* 方块间距 */
|
padding: 10px;
|
box-sizing: border-box;
|
}
|
|
.reason-item-flex {
|
/* 方块基础样式 */
|
background-color: #f5f5f5;
|
border-radius: 8px;
|
padding: 12px 16px;
|
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
|
transition: all 0.3s ease;
|
|
/* 文字样式 */
|
font-size: 14px;
|
color: #333;
|
text-align: center;
|
|
width: 300rpx;
|
|
/* 确保内容不换行时居中 */
|
display: flex;
|
justify-content: center;
|
align-items: center;
|
}
|
/* 双击动画效果 */
|
@keyframes doubleClickPulse {
|
0% {
|
transform: scale(1);
|
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
|
}
|
50% {
|
transform: scale(0.95);
|
box-shadow: 0 0 0 3px rgba(24, 144, 255, 0.3);
|
}
|
100% {
|
transform: scale(1);
|
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
|
}
|
}
|
.reason-item-flex.double-clicked {
|
animation: doubleClickPulse 0.5s ease-out;
|
background-color: #e6f7ff;
|
border: 1px solid #91d5ff;
|
}
|
</style>
|