erp 新洋电子
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

358 lines
10 KiB

<template>
<view>
<view class="sm-box">
<view class="card">
<view class="title">:</view>
<view class="content">1.量化的需填写真实测量数据</view>
<view class="content">2.无量化检查项填写检查结果结果判定合格的填写OK不合格的填NG</view>
</view>
<view class="content-box-card">
<view class="content-box-card-ul-two">
<view class="content-box-card-list">
<view class="content-box-card-title">物料编号:</view>
<text>{{ CyInfo.product_number }}</text>
</view>
<view class="content-box-card-list">
<view class="content-box-card-title">生产日期:</view>
<text>{{ CyInfo.production }}</text>
</view>
</view>
<view class="content-box-card-ul-two">
<view class="content-box-card-list">
<view class="content-box-card-title">机型:</view>
<text>{{ CyInfo.product_size }}</text>
</view>
<view class="content-box-card-list">
<view class="content-box-card-title">班次:</view>
<picker @change="bindline" :value="froms.frequency" :range="line">
<view class="lin-div">
<text>{{ line[froms.frequency] }}</text>
<image src="../../static/xiala.png"></image>
</view>
</picker>
</view>
</view>
<view class="content-box-card-ul-two">
<!-- <view class="content-box-card-list">
<view class="content-box-card-title">时间段:</view>
<text>2021-07-15</text>
</view> -->
<view class="content-box-card-list">
<view class="content-box-card-title">检测员:</view>
<text>{{ info ? info.name : '' }}</text>
</view>
<!-- <view class="content-box-card-list">
<view class="content-box-card-title">生产数量:</view>
<input type="number" v-if="type==1" v-model="froms.product_number" />
<input type="number" v-else disabled="false" v-model="info.product_number" />
</view> -->
</view>
<view class="content-box-card-ul-two">
<!-- <view class="content-box-card-list">
<view class="content-box-card-title">不合格数:</view>
<input type="number" v-if="type==1" v-model="froms.no_number" />
<input type="number" v-else disabled="false" v-model="info.no_number" />
</view> -->
<!-- <view class="content-box-card-list">
<view class="content-box-card-title">报废数:</view>
<input type="number" v-if="type==1" v-model="froms.scrap" />
<input type="number" v-else disabled="false" v-model="info.scrap" />
</view> -->
</view>
</view>
</view>
<view v-for="(item, index) in configSet" :key="index">
<view class="big-title">{{ item.title }}</view>
<view v-for="(value, idx) in item.check_conf_msg" :key="idx" class="cyxj-content">
<view class="cyxj-content-card" v-if="item.check_conf_msg[idx].status == 1">
<view class="xx-card">
<view class="xx-title">{{ value.title }}</view>
<view class="xx-ul">
<view class="xx-list" v-for="(va, i) in ifcomplete" :key="i" @tap="value.choice = va">
<image :src="va == value.choice ? '../../static/xz.png' : '../../static/wxz.png'"
mode=""></image>
<text>{{ va }}</text>
</view>
</view>
<view class="czyj-text" v-show="value.choice == 'NG'"><textarea v-model="value.content"
placeholder="不良情况分析" /></view>
<view class="xx-title" v-show="value.choice == 'NG'">不良处置情况</view>
<picker :value="value.choiceIndex" v-show="value.choice == 'NG'"
@change="pickerChange($event, index, idx)" :range="methList">
<view class="slect-list">
<text>{{ value.situation || '请选择' }}</text>
<image src="../../static/xiala.png"></image>
</view>
</picker>
</view>
</view>
<view class="cyxj-content-card" v-else>
<view class="tx-ul">
<view class="tx-title">{{ value.title }}</view>
<view class="tx-in-nav">
<view>{{value.bottom}}</view>
<input :class="value.inputState==false?'re-bor':''" :disabled="type==2?true:false" type="number" @input="inputListener($event,index, idx)" v-model="value.input"
placeholder="请输入" />
<view>{{value.top}}</view>
</view>
</view>
</view>
</view>
</view>
<view class="content-box">
<view class="content-box-card">
<view class="content-box-card-ul">
<view class="content-box-card-list">
<view class="content-box-card-title">最终判定:</view>
<view class="right-check" >
<view class="check-list" v-if="type==1" v-for="(item,index) in ifQualified" :key="index"
@tap="ifQualifiedChange(index+1)">
<image :src="froms.result==index+1?'../../static/xz.png':'../../static/wxz.png'">
</image>
<text>{{item}}</text>
</view>
<view v-if="type!=1">
<text v-if="info.result==1">OK</text>
<text v-if="info.result==2">NG</text>
</view>
</view>
</view>
</view>
</view>
</view>
<view class="cyxj-content" style="margin-top: 24upx;">
<view class="bzqk-card"><textarea v-model="froms.remake" placeholder="备注情况说明" /></view>
<view class="submit-btn">
<button v-if="type==1" type="primary" :disabled="buttonState==false?true:false" @tap="submits">提交</button>
<button v-if="type==3" @tap="applys()" type="primary">审核</button>
</view>
</view>
</view>
</template>
<script>
import {
tcqCheckAdd,
tcqCheckDetail,
bad,
getCheckConfSet,
tcqCheckSure
} from '../../api/user.js';
import {
mapGetters,
mapMutations
} from 'vuex';
export default {
data() {
return {
power: [],
jurisdiction: [],
type: 0,
id: 0,
ifSubmit: false,
line: ['夜班', '白班'],
ifcomplete: ['OK', 'NG'],
ifcompleteIds: 0,
methList: [],
methIds: 0,
planId: 0,
CyInfo: {},
info: {},
froms: {
result:0,
item: [],
plan_id: '',
//model: '',
frequency: 0, //班次
remake: '' //,备注
},
configSet: [],
buttonState: true,
productId: 0,
ifQualified: ["OK", "NG"],
ifQualifiedIds: 0,
};
},
onShow() {
this.isMenu();
},
computed: {
...mapGetters(['userInfo', 'roleType'])
},
onLoad(e) {
this.type = e.type;
this.pId = e.plan_id;
this.id = e.id;
this.productId = e.product_id;
this.froms.plan_id = this.pId;
this.CyInfo = JSON.parse(decodeURIComponent(e.planInfo));
//this.froms.model = this.CyInfo.product_size;
this.power = this.userInfo.power
this.getArr();
if (this.CyInfo.check != 0 && this.type != 1) {
this.getInfo();
}
bad({}).then(res => {
for (let b in res) {
this.methList.push(res[b]);
}
});
this.getConfig();
},
methods: {
ifQualifiedChange(index) {
this.froms.result = index
},
getArr() {
let newArr = this.power.map(item => {
if (item.children) {
item.children.map(items => {
this.jurisdiction.push(items.title)
return items
})
}
})
console.log("xinshuzu", this.jurisdiction)
},
isMenu(title) {
return this.jurisdiction.includes(title);
},
inputListener(e, index, idx) {
let item = this.configSet[index].check_conf_msg[idx];
if (!item.input) {
this.configSet[index].check_conf_msg[idx].inputState = false;
} else {
if (item.input < item.bottom || item.input > item.top) {
this.configSet[index].check_conf_msg[idx].inputState = false;
}
else {
this.configSet[index].check_conf_msg[idx].inputState = true;
}
}
},
getConfig() {
getCheckConfSet({
type: 1,
product_id: this.CyInfo.product_id
}).then(res => {
this.configSet = res.map(item => {
item.check_conf_msg = item.check_conf_msg.map(value => {
return this.matchingConfig(value);
});
return item;
});
});
},
matchingConfig(value) {
value.choice = 'OK';
value.content = '';
value.situation = '';
value.input = '';
value.inputState = true;
let CheckCyMsg = this.info.CheckCyMsg ? this.info.CheckCyMsg : [];
for (let b in CheckCyMsg) {
if (CheckCyMsg[b].check_tcq_id == value.id) {
let json = JSON.parse(CheckCyMsg[b].json);
value.choice = json.choice;
value.content = json.content;
value.situation = json.situation;
value.input = json.input;
break;
}
}
return value;
},
getInfo() {
tcqCheckDetail({
plan_id: this.pId,
id: this.id,
product_id:this.productId
}).then(res => {
this.info = res;
this.froms.plan_id = this.pId;
this.froms.model = res.model;
this.froms.frequency = res.frequency;
this.froms.remake = res.remake;
});
},
bindline: function(e) {
this.froms.frequency = e.target.value;
},
pickerChange(e, index, idx) {
this.configSet[index].check_conf_msg[idx].situation = this.methList[e.detail.value];
},
submits() {
if (!this.buttonState) {
return false;
}
for (let b in this.configSet) {
for (let i in this.configSet[b].check_conf_msg) {
let items = this.configSet[b].check_conf_msg[i];
if (this.configSet[b].check_conf_msg[i].status == 1) {
if (items.choice == 'NG' && (!items.content || !items.situation)) {
this.$functions.error('请完整填写信息');
return false;
}
} else {
if (!items.input) {
this.$functions.error('请完整填写信息');
return false;
}
}
this.froms.item.push({
check_tcq_id: items.id,
json: {
choice: items.choice,
content: items.content,
situation: items.situation,
input: items.input
}
});
}
}
this.buttonState = false;
this.$functions.confirm("是否进行此操作?").then(()=>{
tcqCheckAdd(this.froms).then(res => {
this.$functions.success('提交成功').then(() => {
uni.navigateBack();
}).catch(res => {
this.buttonState = true;
});
});
})
},
applys() {
this.$functions.confirm('是否确定操作?').then(res => {
tcqCheckSure({
plan_id: this.info.plan_id,
play_id: this.info.play_id,
id:this.info.id
}).then(res => {
this.$functions.success('操作成功').then(() => {
uni.navigateBack({});
});
});
});
}
}
};
</script>
<style lang="scss">
@import './index.scss';
</style>