|
|
|
|
@ -12,6 +12,11 @@
|
|
|
|
|
<u-input @click="clickShowList" v-model="form.materialName" placeholder="请选择物料清单" :show-action="false" readonly ></u-input>
|
|
|
|
|
<u-icon name="close-circle-fill" @click="clearMaterial" color="rgb(96, 98, 102)" size="28"></u-icon>
|
|
|
|
|
</u-form-item>
|
|
|
|
|
|
|
|
|
|
<u-form-item label="来料批号">
|
|
|
|
|
<u-input placeholder="请输入来料批号" v-model="form.incomeBatchNo" :show-action="false"></u-input>
|
|
|
|
|
</u-form-item>
|
|
|
|
|
|
|
|
|
|
<u-form-item required label="检查数量">
|
|
|
|
|
<u-input placeholder="请输入检查数量(PC)" v-model="form.checkNum" :show-action="false"></u-input>
|
|
|
|
|
</u-form-item>
|
|
|
|
|
@ -20,12 +25,14 @@
|
|
|
|
|
<jPicker sureColor="#ff0000" moren="请选择是否合格" @bindpicker="selectIsQualified" showKey="key" valKey="value" :val="form.isQualified" :options="optionResults" />
|
|
|
|
|
</u-form-item>
|
|
|
|
|
|
|
|
|
|
<u-form-item label="不良数量">
|
|
|
|
|
<u-input placeholder="请输入不良数量(PC)" v-model="form.badNum" :show-action="false"></u-input>
|
|
|
|
|
<u-form-item label="不良数量(PC)" label-width="230rpx">
|
|
|
|
|
<span style="width: 100%;color: #c0c4cc" @click="checkShowDefects" v-if="!form.badNum">请选择不良项</span>
|
|
|
|
|
<span v-if="form.badNum">{{form.badNum}}</span>
|
|
|
|
|
</u-form-item>
|
|
|
|
|
|
|
|
|
|
<u-form-item label="不良选项">
|
|
|
|
|
<jPicker sureColor="#ff0000" moren="请选择不良选项" @bindpicker="selectBadItem" showKey="className" valKey="id" :val="form.badItem" :options="optionDefects" />
|
|
|
|
|
<span style="width: 100%;color: #c0c4cc" @click="checkShowDefects" v-if="defectList.length === 0">请选择不良项</span>
|
|
|
|
|
<span style="width: 100%;color: #2979ff" @click="checkShowDefects" v-if="defectList.length > 0">点击查看</span>
|
|
|
|
|
</u-form-item>
|
|
|
|
|
|
|
|
|
|
<u-form-item label="不合格原因">
|
|
|
|
|
@ -36,7 +43,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<view id="button" class="bottom-bar">
|
|
|
|
|
<view class="bottom-bar">
|
|
|
|
|
<u-button type="primary" @click="submit" >提交</u-button>
|
|
|
|
|
</view>
|
|
|
|
|
|
|
|
|
|
@ -56,6 +63,89 @@
|
|
|
|
|
</scroll-view>
|
|
|
|
|
|
|
|
|
|
</u-popup>
|
|
|
|
|
|
|
|
|
|
<u-popup
|
|
|
|
|
id="popup-content"
|
|
|
|
|
v-model="showDefects"
|
|
|
|
|
mode="center"
|
|
|
|
|
:mask-close-able="false"
|
|
|
|
|
width="600rpx"
|
|
|
|
|
height="60%"
|
|
|
|
|
borderRadius="12rpx"
|
|
|
|
|
>
|
|
|
|
|
<view class="popup-content" >
|
|
|
|
|
|
|
|
|
|
<!-- 表格容器(带滚动) -->
|
|
|
|
|
<scroll-view
|
|
|
|
|
class="table-scroll"
|
|
|
|
|
scroll-y
|
|
|
|
|
:style="{height: `${tableHeight}rpx`}"
|
|
|
|
|
>
|
|
|
|
|
<view class="table" id="table">
|
|
|
|
|
<!-- 表头 -->
|
|
|
|
|
<view class="table-header">
|
|
|
|
|
<view class="table-th" style=" flex: 1;">数量</view>
|
|
|
|
|
<view class="table-th" style=" flex: 3;">缺陷类型</view>
|
|
|
|
|
<view class="table-th" style=" flex: 1;">操作</view>
|
|
|
|
|
</view>
|
|
|
|
|
|
|
|
|
|
<!-- 表格内容行 -->
|
|
|
|
|
<view class="table-body">
|
|
|
|
|
<view class="table-tr" v-for="(item, index) in defectList" :key="index">
|
|
|
|
|
<view class="table-td" style=" flex: 1;">
|
|
|
|
|
<u-input
|
|
|
|
|
v-model.number="item.quantity"
|
|
|
|
|
type="number"
|
|
|
|
|
placeholder="数量"
|
|
|
|
|
min="1"
|
|
|
|
|
/>
|
|
|
|
|
</view>
|
|
|
|
|
<view class="table-td" style=" flex: 3;" @click="clickDefectsIndex(index)">
|
|
|
|
|
<jPicker sureColor="#ff0000" moren="请选择不良项" @bindpicker="selectBadItem" showKey="className" valKey="id" :val="item.badItem" :options="optionDefects" />
|
|
|
|
|
</view>
|
|
|
|
|
<view class="table-td" style=" flex: 1;">
|
|
|
|
|
<u-icon
|
|
|
|
|
name="close"
|
|
|
|
|
color="#ff4d4f"
|
|
|
|
|
size="24rpx"
|
|
|
|
|
class="delete-icon"
|
|
|
|
|
@click="removeRow(index)"
|
|
|
|
|
/>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
|
|
|
|
|
<!-- 新增行按钮 -->
|
|
|
|
|
<view class="add-row" @click="addRow">
|
|
|
|
|
<u-icon name="plus" color="#8c8c8c" size="32rpx" />
|
|
|
|
|
<view class="add-text">新增缺陷记录
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
</scroll-view>
|
|
|
|
|
|
|
|
|
|
<!-- 底部按钮区 -->
|
|
|
|
|
<view class="popup-footer" id="footer">
|
|
|
|
|
<u-button
|
|
|
|
|
@click="showDefects = false"
|
|
|
|
|
type="default"
|
|
|
|
|
class="footer-btn cancel-btn"
|
|
|
|
|
:style="{width: '160rpx'}"
|
|
|
|
|
>
|
|
|
|
|
取消
|
|
|
|
|
</u-button>
|
|
|
|
|
<u-button
|
|
|
|
|
type="primary"
|
|
|
|
|
class="footer-btn confirm-btn"
|
|
|
|
|
:style="{width: '160rpx'}"
|
|
|
|
|
@click="confirmDefectList"
|
|
|
|
|
>
|
|
|
|
|
确认
|
|
|
|
|
</u-button>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
</u-popup>
|
|
|
|
|
|
|
|
|
|
</view>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
@ -86,6 +176,7 @@ export default class checkBp extends BasePage {
|
|
|
|
|
checkDate:undefined,
|
|
|
|
|
materialCode:undefined,
|
|
|
|
|
materialName:undefined,
|
|
|
|
|
incomeBatchNo:undefined,
|
|
|
|
|
checkNum:undefined,
|
|
|
|
|
badNum:undefined,
|
|
|
|
|
isQualified:undefined,
|
|
|
|
|
@ -94,12 +185,14 @@ export default class checkBp extends BasePage {
|
|
|
|
|
createBy: this.userinfo.userName,
|
|
|
|
|
createUserName: this.userinfo.nickName,
|
|
|
|
|
factoryCode: session.FactoryCode,
|
|
|
|
|
defectList:[]
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
resetForm = {
|
|
|
|
|
checkDate:undefined,
|
|
|
|
|
materialCode:undefined,
|
|
|
|
|
materialName:undefined,
|
|
|
|
|
incomeBatchNo:undefined,
|
|
|
|
|
checkNum:undefined,
|
|
|
|
|
badNum:undefined,
|
|
|
|
|
isQualified:undefined,
|
|
|
|
|
@ -108,6 +201,7 @@ export default class checkBp extends BasePage {
|
|
|
|
|
createBy: this.userinfo.userName,
|
|
|
|
|
createUserName: this.userinfo.nickName,
|
|
|
|
|
factoryCode: session.FactoryCode,
|
|
|
|
|
defectList:[]
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
showCalendar = false
|
|
|
|
|
@ -127,14 +221,17 @@ export default class checkBp extends BasePage {
|
|
|
|
|
isQualified:"请选择是否合格"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
unqualifiedRules = {
|
|
|
|
|
badNum:"请填写不良数量",
|
|
|
|
|
badItem:"请选择不良项"
|
|
|
|
|
}
|
|
|
|
|
showDefects = false
|
|
|
|
|
|
|
|
|
|
tableHeight = 300
|
|
|
|
|
|
|
|
|
|
defectList = []
|
|
|
|
|
|
|
|
|
|
defectIndex = 0
|
|
|
|
|
|
|
|
|
|
onReady() {
|
|
|
|
|
getQcDefectTypeClassList(
|
|
|
|
|
{defectCode:"20240822001"}
|
|
|
|
|
{defectCode:"20240822001",pageSize:100}
|
|
|
|
|
).then(res=>{
|
|
|
|
|
if (res){
|
|
|
|
|
for (const item of res.rows){
|
|
|
|
|
@ -143,7 +240,6 @@ export default class checkBp extends BasePage {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -186,8 +282,6 @@ export default class checkBp extends BasePage {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
submit(){
|
|
|
|
|
console.log(this.form)
|
|
|
|
|
|
|
|
|
|
for (const key in this.form){
|
|
|
|
|
if (!this.form[key] && this.rules[key]){
|
|
|
|
|
uni.showToast({
|
|
|
|
|
@ -199,18 +293,15 @@ export default class checkBp extends BasePage {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//不合格
|
|
|
|
|
if (this.form.isQualified === "N"){
|
|
|
|
|
for (const key in this.form){
|
|
|
|
|
if (!this.form[key] && this.unqualifiedRules[key]){
|
|
|
|
|
uni.showToast({
|
|
|
|
|
title: this.unqualifiedRules[key],
|
|
|
|
|
icon: 'none',
|
|
|
|
|
});
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (this.form.isQualified === "N" && this.defectList.length === 0){
|
|
|
|
|
uni.showToast({
|
|
|
|
|
title: "请填写不良项",
|
|
|
|
|
icon: 'none',
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.form.defectList = this.defectList
|
|
|
|
|
|
|
|
|
|
submitCheckResult(this.form).then(res=>{
|
|
|
|
|
if (res.code === 200){
|
|
|
|
|
uni.showToast({
|
|
|
|
|
@ -221,6 +312,7 @@ export default class checkBp extends BasePage {
|
|
|
|
|
});
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
this.form = this.resetForm;
|
|
|
|
|
this.defectList = []
|
|
|
|
|
}, 1000);
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
@ -237,10 +329,76 @@ export default class checkBp extends BasePage {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
selectBadItem(res : any){
|
|
|
|
|
this.form.badItem = res.pickerName.id
|
|
|
|
|
this.defectList[this.defectIndex].badItem = res.pickerName.id
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
clickDefectsIndex(index){
|
|
|
|
|
console.log(index)
|
|
|
|
|
this.defectIndex = index
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
checkShowDefects(){
|
|
|
|
|
this.showDefects = true
|
|
|
|
|
this.calcTableHeight()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
addRow(){
|
|
|
|
|
this.defectList.push({ quantity: undefined, badItem: undefined });
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 计算表格滚动区域高度
|
|
|
|
|
calcTableHeight() {
|
|
|
|
|
//等待页面加载完成
|
|
|
|
|
this.$nextTick(() => {
|
|
|
|
|
const query = uni.createSelectorQuery().in(this);
|
|
|
|
|
query
|
|
|
|
|
.select('#popup-content')
|
|
|
|
|
.boundingClientRect((data) => {
|
|
|
|
|
this.tableHeight = data.height
|
|
|
|
|
})
|
|
|
|
|
.exec();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
removeRow(index) {
|
|
|
|
|
if (this.defectList.length <= 1) {
|
|
|
|
|
uni.showToast({ title: '至少保留一条记录', icon: 'none', duration: 1500 });
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
this.defectList.splice(index, 1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
confirmDefectList(){
|
|
|
|
|
if (this.defectList.length === 0){
|
|
|
|
|
uni.showToast({ title: '无缺陷记录', icon: 'none', duration: 1500 });
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
let quantity = 0
|
|
|
|
|
let i = 1
|
|
|
|
|
for (const item of this.defectList){
|
|
|
|
|
if (!item.quantity){
|
|
|
|
|
uni.showToast({ title: '第'+i+'未填写缺陷数量', icon: 'none', duration: 1500 });
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!item.badItem){
|
|
|
|
|
uni.showToast({ title: '第'+i+'未选择缺陷', icon: 'none', duration: 1500 });
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
quantity = quantity + item.quantity
|
|
|
|
|
item.badNum = item.quantity
|
|
|
|
|
item.defectCode = "20240822001"
|
|
|
|
|
item.defectSubclass = "A类"
|
|
|
|
|
|
|
|
|
|
i++;
|
|
|
|
|
}
|
|
|
|
|
this.form.badNum = quantity
|
|
|
|
|
|
|
|
|
|
this.showDefects = false
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -278,4 +436,104 @@ export default class checkBp extends BasePage {
|
|
|
|
|
::v-deep .list-item {
|
|
|
|
|
width: 100% !important;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.popup-content {
|
|
|
|
|
box-sizing: border-box;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.table-scroll {
|
|
|
|
|
border-radius: 8rpx;
|
|
|
|
|
background-color: #fafafa;
|
|
|
|
|
margin-bottom: 30rpx;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.table {
|
|
|
|
|
width: 100%;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.table-header {
|
|
|
|
|
display: flex;
|
|
|
|
|
background-color: #e8f4f8;
|
|
|
|
|
border-radius: 8rpx 8rpx 0 0;
|
|
|
|
|
height: 80rpx;
|
|
|
|
|
line-height: 80rpx;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.table-th {
|
|
|
|
|
text-align: center;
|
|
|
|
|
font-size: 28rpx;
|
|
|
|
|
font-weight: 500;
|
|
|
|
|
color: #333;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.table-body {
|
|
|
|
|
background-color: #fff;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.table-tr {
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
height: 100rpx;
|
|
|
|
|
border-bottom: 1rpx solid #f5f5f5;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.table-td {
|
|
|
|
|
padding: 0 20rpx;
|
|
|
|
|
box-sizing: border-box;
|
|
|
|
|
text-align: center;
|
|
|
|
|
border: 1rpx solid #e5e5e5;
|
|
|
|
|
line-height: 75rpx;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.input-item {
|
|
|
|
|
width: 100%;
|
|
|
|
|
border-radius: 8rpx;
|
|
|
|
|
border: 1rpx solid #e5e5e5;
|
|
|
|
|
padding: 0 16rpx;
|
|
|
|
|
box-sizing: border-box;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.delete-icon {
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.add-row {
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
justify-content: center;
|
|
|
|
|
height: 100rpx;
|
|
|
|
|
background-color: #fafafa;
|
|
|
|
|
border-radius: 0 0 8rpx 8rpx;
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.add-text {
|
|
|
|
|
font-size: 28rpx;
|
|
|
|
|
color: #8c8c8c;
|
|
|
|
|
margin-left: 16rpx;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.popup-footer {
|
|
|
|
|
display: flex;
|
|
|
|
|
justify-content: center;
|
|
|
|
|
gap: 40rpx;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.footer-btn {
|
|
|
|
|
height: 80rpx;
|
|
|
|
|
line-height: 80rpx;
|
|
|
|
|
border-radius: 40rpx;
|
|
|
|
|
font-size: 32rpx;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.cancel-btn {
|
|
|
|
|
border: 1rpx solid #e5e5e5;
|
|
|
|
|
color: #333;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.confirm-btn {
|
|
|
|
|
background-color: #1989fa;
|
|
|
|
|
color: #fff;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
</style>
|