From 4cab569dd18677a4e50398a7992ed0c1ebaf5970 Mon Sep 17 00:00:00 2001
From: huangli865118801 <865118801@qq.com>
Date: Fri, 13 Aug 2021 16:16:35 +0800
Subject: [PATCH] ddd
---
api/user.js | 13 ++
pages/stopLine/stopLine.vue | 261 ++++++++++++++++++++++++++++--------
2 files changed, 215 insertions(+), 59 deletions(-)
diff --git a/api/user.js b/api/user.js
index 2986bb4..fe5f7a5 100644
--- a/api/user.js
+++ b/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
+ });
}
\ No newline at end of file
diff --git a/pages/stopLine/stopLine.vue b/pages/stopLine/stopLine.vue
index 06d6bb3..43bc739 100644
--- a/pages/stopLine/stopLine.vue
+++ b/pages/stopLine/stopLine.vue
@@ -31,11 +31,13 @@
-
+
停线原因
- {{reason[reasonIds]}}
+ 请选择
+ {{reason[reasonIds].item}}
+
@@ -43,11 +45,11 @@
设备维修
-
+
设备编号
- {{deviceNo[froms.device[0].device_id-1]}}
+ {{deviceNo[devIds].name}}
@@ -61,78 +63,96 @@
+
原因分析
-
+ {{deviceCauseAnalysis[devYyIds].name}}
+
+
+
维修描述
-
+ {{deviceRepairDescription[devRepairids].name}}
+
-
+
+
+
维修人员
-
+ {{staffList[staffIdx].name}}
+
+
模具维修
-
+
模具编号
- {{mould[froms.mode[0].mode_id-1]}}
+ {{mould[modeIds].title}}
-
+
异常现象
- {{mould[froms.mode[0].mode_id-1]}}
+ {{modeUnnormal[modeUnIds].name}}
+
原因分析
-
+ {{modeCauseAnalysis[devYyIds].name}}
+
+
+
维修描述
-
+ {{modeRepairDescription[modeRepairids].name}}
+
-
+
+
+
维修人员
-
+ {{modestaffList[modestaffIdx].name}}
+
+
@@ -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=='模具维修'){