Browse Source

提交

master
865118801@qq.com 4 years ago
parent
commit
e7061c2e39
  1. 16
      api/user.js
  2. 115
      pages/modeMaintainAdd/modeMaintainAdd.vue

16
api/user.js

@ -630,4 +630,18 @@ export function deviceRecord(data) {
method: "post", method: "post",
data data
}); });
} }
/**
* 模具保养
* @param {Object} data
*/
export function modeMaintain(data) {
console.log(data)
return request({
url: `${functions.getDomain()}/api/mode-maintain`,
method: "post",
data
});
}

115
pages/modeMaintainAdd/modeMaintainAdd.vue

@ -28,52 +28,53 @@
</view> </view>
</picker> </picker>
</view> </view>
<view class="card-down"> <view class="card-down" v-for="(item,index) in forms.item" :key="index">
<view class="list"> <view class="list">
<view class="title">检测部位</view> <view class="title">检测部位</view>
<text></text> <text>{{item.mode_check_item}}</text>
</view> </view>
<view class="list"> <view class="list">
<view class="title">检测目的</view> <view class="title">检测目的</view>
<text>各模板</text> <text>{{item.mode_check_aim}}</text>
</view> </view>
<view class="list"> <view class="list">
<view class="title">检测结果</view> <view class="title">检测结果</view>
<view class="check-ul"> <view class="check-ul">
<view class="xx-list" @tap="checkResult(index)" v-for="(item,index) in result"> <view class="xx-list" @tap="item.mode_check_result=value" v-for="(value,idx) in result" :key="idx">
<image :src="resId==index?'../../static/xz.png':'../../static/wxz.png'" mode=""></image> <image :src="item.mode_check_result==value?'../../static/xz.png':'../../static/wxz.png'"
<text>{{item}}</text> mode=""></image>
<text>{{value}}</text>
</view> </view>
</view> </view>
</view> </view>
<view class="list"> <view class="list">
<view class="title">问题位置</view> <view class="title">问题位置</view>
<input placeholder="请输入" /> <input placeholder="请输入" v-model="item.question_position" />
</view> </view>
<picker :range="stepList" @change="bindStep"> <picker :range="stepList" @change="bindStep($event,index)">
<view class="list"> <view class="list">
<view class="title">措施</view> <view class="title">措施</view>
<view class="step-list"> <view class="step-list">
<text>{{stepList[stepIds]}}</text> <text>{{stepList[item.step]}}</text>
<image src="../../static/next.png"></image> <image src="../../static/next.png"></image>
</view> </view>
</view> </view>
</picker> </picker>
<view class="add-lingjian">新增零件记录</view> <view class="add-lingjian" @tap="addRecord(index)">新增零件记录</view>
<view class="components-ul"> <view class="components-ul" v-for="(value,idx) in item.components" :key="idx">
<view class="components-list"> <view class="components-list">
<view>零件编号</view> <view>零件编号</view>
<input placeholder="请输入" /> <input placeholder="请输入" v-model="value.number" />
</view> </view>
<view class="components-list"> <view class="components-list">
<view>零件名字</view> <view>零件名字</view>
<input placeholder="请输入" /> <input placeholder="请输入" v-model="value.name" />
</view> </view>
<view class="components-list"> <view class="components-list">
<view>零件数量</view> <view>零件数量</view>
<input type="number" placeholder="请输入" /> <input type="number" placeholder="请输入" v-model="value.amount" />
</view> </view>
<view class="btn-jian" > <view class="btn-jian" @tap="item.components.splice(idx,1)" v-if="idx>0">
<image src="../../static/jian.png"></image> <image src="../../static/jian.png"></image>
<text>删除</text> <text>删除</text>
</view> </view>
@ -81,8 +82,8 @@
</view> </view>
<view class="cyxj-content" style="margin-top: 24upx;"> <view class="cyxj-content" style="margin-top: 24upx;">
<view class="submit-btn"> <view class="submit-btn">
<button type="primary" @tap="submits">提交</button> <button type="primary" :disabled="buttonState==false?true:false" @tap="submits">提交</button>
</view> </view>
</view> </view>
</view> </view>
@ -91,7 +92,8 @@
<script> <script>
import { import {
staff, staff,
dictionary dictionary,
modeMaintain
} from "../../api/user.js" } from "../../api/user.js"
import { import {
mapGetters, mapGetters,
@ -110,20 +112,27 @@
staffId: 0, staffId: 0,
date: currentDate, date: currentDate,
result: ["OK", "NG"], result: ["OK", "NG"],
resId:0, resId: 0,
stepList:["无","抛光研磨","更换零件","修割/补镶件"], stepList: ["无", "抛光研磨", "更换零件", "修割/补镶件"],
stepIds:0, stepIds: 0,
forms:{ forms: {
item:[] no: '',
} mode_id: 0,
remake: '',
remake_step: '',
item: []
},
buttonState: true
}; };
}, },
onLoad(e) { onLoad(e) {
this.modeId = e.id; this.modeId = e.id;
this.modeNo = e.no this.modeNo = e.no;
this.modeName = e.name this.modeName = e.name
this.getStaff(); this.getStaff();
this.getDictionary() this.getDictionary();
this.forms.no = e.no;
this.forms.mode_id = e.id;
}, },
computed: { computed: {
...mapGetters(['userInfo', 'roleType']), ...mapGetters(['userInfo', 'roleType']),
@ -135,15 +144,35 @@
} }
}, },
methods: { methods: {
getDictionary(){ getDictionary() {
dictionary().then(res=>{ dictionary().then(res => {
this.forms.item.mode_check_item=res.mode_check_item; let mode_check_item = res.mode_check_item;
this.forms.item.mode_check_aim=res.mode_check_aim let mode_check_position = res.mode_check_position;
console.log("就按",this.forms.item.mode_check_item) for (let b in mode_check_item) {
this.forms.item.push({
mode_check_item: mode_check_position[b].name,
mode_check_aim: mode_check_item[b].name,
mode_check_result: 'OK',
question_position: '',
step: 0,
components: [{
number: '',
name: '',
amount: ''
}]
});
}
}) })
}, },
bindStep(e){ bindStep(e, index) {
this.stepIds=e.detail.value this.forms.item[index].step = e.detail.value;
},
addRecord(index) {
this.forms.item[index].components.push({
number: '',
name: '',
amount: ''
});
}, },
getStaff() { getStaff() {
staff().then(res => { staff().then(res => {
@ -159,7 +188,7 @@
this.date = e.target.value this.date = e.target.value
}, },
checkResult(e) { checkResult(e) {
this.resId=e this.resId = e
}, },
getDate(type) { getDate(type) {
const date = new Date(); const date = new Date();
@ -175,6 +204,24 @@
month = month > 9 ? month : '0' + month; month = month > 9 ? month : '0' + month;
day = day > 9 ? day : '0' + day; day = day > 9 ? day : '0' + day;
return `${year}-${month}-${day}`; return `${year}-${month}-${day}`;
},
submits() {
this.$functions.confirm("是否进行此操作").then(()=>{
modeMaintain(this.forms).then(res => {
this.$functions.success('提交成功').then(() => {
uni.navigateBack();
})
}).catch(res => {
this.buttonState = true;
});
})
// modeMaintain(this.forms).then(res => {
// this.$functions.success("").then(() => {
// uni.navigateBack({
// })
// });
// })
} }
} }
} }

Loading…
Cancel
Save