huangli865118801 3 years ago
parent
commit
4cab569dd1
  1. 13
      api/user.js
  2. 261
      pages/stopLine/stopLine.vue

13
api/user.js

@ -500,4 +500,17 @@ export function rawFormDetail(data) {
method: "get",
data
});
}
/**
* 员工
* @param {Object} data
*/
export function staff(data) {
console.log(data)
return request({
url: `${functions.getDomain()}/api/staff`,
method: "get",
data
});
}

261
pages/stopLine/stopLine.vue

@ -31,11 +31,13 @@
</picker>
</view>
<view class="white-card" style="margin-top: 30upx;">
<picker @change="bindReason" :value="reasonIds" :range="reason">
<picker @change="bindReason($event,reason)" :value="reasonIds" :range="reason" :range-key="'item'">
<view class="list-list">
<view class="list-title">停线原因</view>
<view class="list-right">
<text>{{reason[reasonIds]}}</text>
<text v-if="reasonIds==-1">请选择</text>
<text v-else>{{reason[reasonIds].item}}</text>
<image class="next" src="../../static/next.png"></image>
</view>
</view>
@ -43,11 +45,11 @@
</view>
<view class="big-titlt" v-if="crrentReson=='设备维修'">设备维修</view>
<view class="white-card" v-if="crrentReson=='设备维修'">
<picker @change="bindmouldIds" :value="froms.device[0].device_id" :range="deviceNo">
<picker @change="bindmouldIds($event,deviceNo)" :value="devIds" :range-key="'name'" :range="deviceNo">
<view class="list-list">
<view class="list-title">设备编号</view>
<view class="list-right">
<text>{{deviceNo[froms.device[0].device_id-1]}}</text>
<text>{{deviceNo[devIds].name}}</text>
<image class="next" src="../../static/next.png"></image>
</view>
</view>
@ -61,78 +63,96 @@
</view>
</view>
</picker>
<picker @change="decYyfx($event,deviceCauseAnalysis)" :value="devYyIds" :range-key="'name'" :range="deviceCauseAnalysis">
<view class="list-list">
<view class="list-title">原因分析</view>
<view class="list-right">
<input placeholder="请输入原因分析" v-model="froms.device[0].cause_analysis" />
<text>{{deviceCauseAnalysis[devYyIds].name}}</text>
<image class="next" src="../../static/next.png"></image>
</view>
</view>
</picker>
<picker @change="deviceDescription($event,deviceRepairDescription)" :value="devRepairids" :range-key="'name'" :range="deviceRepairDescription">
<view class="list-list">
<view class="list-title">维修描述</view>
<view class="list-right">
<input placeholder="请输入维修描述" v-model="froms.device[0].repair_description" />
<text>{{deviceRepairDescription[devRepairids].name}}</text>
<image class="next" src="../../static/next.png"></image>
</view>
</view>
<view class="list-list">
</picker>
<!-- <view class="list-list">
<view class="list-title">维修时长</view>
<view class="list-right">
<input placeholder="请输入维修时长" v-model="froms.device[0].repair_time" />
</view>
</view>
</view> -->
<picker @change="deviceStaff($event,staffList)" :value="staffIdx" :range-key="'name'" :range="staffList">
<view class="list-list">
<view class="list-title">维修人员</view>
<view class="list-right">
<input placeholder="请输入维修人员" v-model="froms.device[0].repair_staff" />
<text>{{staffList[staffIdx].name}}</text>
<image class="next" src="../../static/next.png"></image>
</view>
</view>
</picker>
<view class="bzqk-card">
<textarea value="" v-model="froms.device[0].remark" placeholder="备注情况说明" />
</view>
</view>
<view class="big-titlt" v-if="crrentReson=='模具维修'">模具维修</view>
<view class="white-card" v-if="crrentReson=='模具维修'">
<picker @change="bindmodeIds" :value="froms.mode[0].mode_id" :range="mould">
<picker @change="bindmodeIds($event,mould)" :value="modeIds" :range="mould" :range-key="'title'">
<view class="list-list">
<view class="list-title">模具编号</view>
<view class="list-right">
<text>{{mould[froms.mode[0].mode_id-1]}}</text>
<text>{{mould[modeIds].title}}</text>
<image class="next" src="../../static/next.png"></image>
</view>
</view>
</picker>
<picker @change="ycxx()" :value="index" :range="mould">
<picker @change="modeYcxx($event,modeUnnormal)" :value="modeUnIds" :range-key="'name'" :range="modeUnnormal">
<view class="list-list">
<view class="list-title">异常现象</view>
<view class="list-right">
<text>{{mould[froms.mode[0].mode_id-1]}}</text>
<text>{{modeUnnormal[modeUnIds].name}}</text>
<image class="next" src="../../static/next.png"></image>
</view>
</view>
</picker>
<picker @change="modeYyfx($event,modeCauseAnalysis)" :value="modeYyIds" :range-key="'name'" :range="modeCauseAnalysis">
<view class="list-list">
<view class="list-title">原因分析</view>
<view class="list-right">
<input placeholder="请输入原因分析" v-model="froms.mode[0].cause_analysis" />
<text>{{modeCauseAnalysis[devYyIds].name}}</text>
<image class="next" src="../../static/next.png"></image>
</view>
</view>
</picker>
<picker @change="modeDescription($event,modeRepairDescription)" :value="modeRepairids" :range-key="'name'" :range="modeRepairDescription">
<view class="list-list">
<view class="list-title">维修描述</view>
<view class="list-right">
<input placeholder="请输入维修描述" v-model="froms.mode[0].repair_description" />
<text>{{modeRepairDescription[modeRepairids].name}}</text>
<image class="next" src="../../static/next.png"></image>
</view>
</view>
<view class="list-list">
</picker>
<!-- <view class="list-list">
<view class="list-title">维修时长</view>
<view class="list-right">
<input placeholder="请输入维修时长" v-model="froms.mode[0].repair_time" />
</view>
</view>
</view> -->
<picker @change="modeStaff($event,staffList)" :value="modestaffIdx" :range-key="'name'" :range="modestaffList">
<view class="list-list">
<view class="list-title">维修人员</view>
<view class="list-right">
<input placeholder="请输入维修人员" v-model="froms.mode[0].repair_staff" />
<text>{{modestaffList[modestaffIdx].name}}</text>
<image class="next" src="../../static/next.png"></image>
</view>
</view>
</picker>
</view>
<view class="white-card" v-if="crrentReson!='设备维修'&&crrentReson!='模具维修'">
<view class="list-list" style="align-items: flex-start;">
@ -160,7 +180,8 @@
device,
mode,
stopRecord,
dictionary
dictionary,
staff
} from "../../api/user.js"
export default {
data() {
@ -169,17 +190,33 @@
lineIndex: 0,
frequency: ["白班", "夜班"],
frequencyIds: 0,
reason: ["模具维修", "设备维修", "品质待定", "辅料短缺", "偶发停电"],
reasonIds: 0,
mould: ["1", "2", "3"],
reason: [],
reasonIds: -1,
mould: [],
mouldIds: 0,
deviList: [],
CyInfo: {},
resonList: [],
deviceNo: [],
devIds:0,
modeIds:0,
AbnormalPhenomenon:[],
index:0,
crrentReson:'',
modeUnnormal:[],
modeUnIds:0,
devYyIds:0,
deviceCauseAnalysis:[],
modeYyIds:0,
modeCauseAnalysis:[],
deviceRepairDescription:[],
devRepairids:0,
modeRepairDescription:[],
modeRepairids:0,
staffList:[],
staffIdx:0,
modestaffList:[],
modestaffIdx:0,
froms: {
plan_id: "",
frequency: '1',
@ -190,7 +227,7 @@
unusual_phenomenon: '',
cause_analysis: '',
repair_description: '',
repair_time: '',
//repair_time: '',
repair_staff: '',
remark: ''
}],
@ -199,7 +236,7 @@
unusual_phenomenon: '',
cause_analysis: '',
repair_description: '',
repair_time: '',
//repair_time: '',
repair_staff: '',
remark: ''
}],
@ -214,23 +251,56 @@
this.froms.plan_id = this.CyInfo.plan_id;
this.crrentReson="设备维修"
console.log('picker发送选择改变,携带值为', this.CyInfo)
this.getdeviceException();
this.getdeviceException();//
this.getModeException();//
this.getDecYyfx();//
this.getDeviceRepairDescription();//
this.getModeRepairDescription()
this.getStaff()
},
methods: {
getStaff(){
staff().then(res=>{
if(res.length>0){
this.staffList=res;
this.modestaffList=res;
}
console.log("员工",res)
})
},
getDevice() {
device().then(res => {
let newArr = []
newArr = res.map(item => item.name)
this.deviceNo = newArr
//this.deviceNo=res
this.deviceNo=res
console.log("设备编号11", this.deviceNo)
})
},
getDeviceRepairDescription() {
dictionary({key:'device_repair_description'}).then(res=>{
this.deviceRepairDescription=res
console.log("设备维修描述",res)
})
},
getModeRepairDescription() {
dictionary({key:'mode_repair_description'}).then(res=>{
this.modeRepairDescription=res
console.log("模具维修描述",res)
})
},
getDecYyfx(){
dictionary({key:'device_cause_analysis'}).then(res=>{
this.deviceCauseAnalysis=res
console.log("设备异常原因分析",res)
})
},
getModeYyfx(){
dictionary({key:'device_cause_analysis'}).then(res=>{
this.modeCauseAnalysis=res
console.log("模具异常原因分析",res)
})
},
getMode() {
mode().then(res => {
let newArr = []
newArr = res.map(item => item.title)
this.mould = newArr
this.mould=res
console.log("mode", this.mould)
})
},
@ -240,43 +310,116 @@
console.log("异常现象",res)
})
},
getModeException(){
dictionary({key:'mode_exception'}).then(res=>{
this.modeUnnormal=res
console.log("异常现象11",this.modeUnnormal)
})
},
ycxx(e,storage){
this.index = e.target.value
this.froms.device[0].unusual_phenomenon=storage[this.index].value
console.log("aaa",this.froms.device[0].unusual_phenomenon)
if(storage.length>0){
this.index = e.target.value
this.froms.device[0].unusual_phenomenon=storage[this.index].value
console.log("aaa",this.froms.device[0].unusual_phenomenon)
}
},
modeYcxx(e,item){
if(item.length>0){
this.modeUnIds = e.target.value
this.froms.mode[0].unusual_phenomenon=item[this.modeUnIds].value
}
},
decYyfx(e,item){
if(item.length>0){
this.devYyIds=e.detail.value;
this.froms.device[0].cause_analysis=item[this.devYyIds].value
console.log("aaa",this.froms.device[0].cause_analysis)
}
},
getReson() {
modeYyfx(e,item){
if(item.length>0){
this.modeYyIds=e.detail.value;
this.froms.mode[0].cause_analysis=item[this.modeYyIds].value
console.log("aaa",this.froms.mode[0].cause_analysis)
}
},
deviceDescription(e,item){
if(item.length>0){
this.devRepairids=e.detail.value;
this.froms.device[0].repair_description=item[this.devRepairids].value
}
},
modeDescription(e,item){
if(item.length>0){
this.modeRepairids=e.detail.value;
this.froms.mode[0].repair_description=item[this.modeRepairids].value
}
},
deviceStaff(e,items){
this.staffIdx=e.detail.value;
this.froms.device[0].repair_staff=this.staffList[this.staffIdx].id;
},
modexStaff(e,items){
this.staffIdx=e.detail.value;
this.froms.mode[0].repair_staff=this.modestaffList[this.modestaffIdx].id;
},
getReson() {
stopLineReason({status:1}).then(res => {
let arr = [];
for (let i in res) {
arr.push(res[i])
}
this.reason = arr
let arr1=Object.values(res)
let arr2=Object.keys(res)
const f1 = (key, arr) => arr.map(item => ({
[key]: item
}))
const getMaxArr = (arr1, arr2) => (arr1.length >= arr2.length) ? arr1 : arr2;
const mergeArr = (oldArr, arr) => oldArr.map((item, index) => ({
item,
...arr[index]
}))
let list1 = f1('item', arr1)
let list2 = f1('id', arr2)
let newArr = mergeArr(getMaxArr(arr1, arr2), list2)
this.reason=newArr
console.log("停线原因", this.reason)
})
},
bindline: function(e) {
this.froms.frequency = e.target.value;
console.log("forms", this.froms)
},
// bindfrequencyIds(e){
// this.froms.frequency = e.target.value
// console.log("forms",this.froms)
// },
bindReason(e) {
this.reasonIds = e.target.value;
this.froms.reason_id = e.target.value + 1;
this.crrentReson=this.reason[e.target.value]
console.log("当前原因",this.crrentReson)
bindReason(e,items) {
if(items.length>0){
this.reasonIds = e.target.value;
this.froms.reason_id = items[this.reasonIds].id;
this.crrentReson=items[this.reasonIds].item;
console.log("当前原因",this.froms.reason_id)
}
},
bindmouldIds(e) {
this.froms.device[0].device_id = e.target.value +1
// this.froms.device[0].device_id = e.target.value + 1
console.log("设备id", this.froms.device[0].device_id)
bindmouldIds(e,item) {
if(item.length>0){
this.devIds=e.detail.value
this.froms.device[0].device_id =item[this.devIds].id
// this.froms.device[0].device_id = e.target.value + 1
console.log("设备id",this.froms.device[0].device_id)
}
},
bindmodeIds(e) {
this.froms.mode[0].mode_id = e.target.value + 1
bindmodeIds(e,item) {
if(item.length>0){
this.modeIds = e.target.value ;
this.froms.mode[0].mode_id=item[this.modeIds].id;
console.log("磨具id", this.froms.mode[0].mode_id)
}
},
stopLine() {
if(this.crrentReson=='设备维修'||this.crrentReson=='模具维修'){

Loading…
Cancel
Save