Browse Source

提交

master
865118801@qq.com 4 years ago
parent
commit
4a39e053f9
  1. 184
      pages/badProduct/badProduct.vue
  2. 55
      pages/modeMaintainAdd/index.scss
  3. 114
      pages/modeMaintainAdd/modeMaintainAdd.vue
  4. 10
      pages/modeMaintainList/modeMaintainList.vue
  5. 260
      pages/stampingRecordList/stampingRecordList.vue
  6. 2
      utils/request.js

184
pages/badProduct/badProduct.vue

@ -21,7 +21,8 @@
</view>
</view>
</view>
<view v-for="(item, index) in froms" :key="index" class="white-card" style="margin-top: 24upx;padding-top: 30upx;padding-bottom: 30upx;">
<view v-for="(item, index) in froms" :key="index" class="white-card"
style="margin-top: 24upx;padding-top: 30upx;padding-bottom: 30upx;">
<view class="mid-card">
<picker @change="frequencyChange($event, index)" :value="item.frequency" :range="frequency">
<view class="list-reson">
@ -32,7 +33,8 @@
</view>
</view>
</picker>
<picker @change="reasonChange($event, index)" :value="item.reason_no_id" range-key="title" :range="reason">
<picker @change="reasonChange($event, index)" :value="item.reason_no_id" range-key="title"
:range="reason">
<view class="list-reson">
<view class="left">不良原因</view>
<view class="right">
@ -59,106 +61,116 @@
<image src="../../static/jia.png"></image>
<text>添加</text>
</view>
<view class="submit-btn"><button :disabled="buttonState==false?true:false" type="primary" @tap="submit">提交</button></view>
<view class="submit-btn"><button :disabled="buttonState==false?true:false" type="primary"
@tap="submit">提交</button></view>
</view>
</template>
<script>
import { reasonNo, badReasons } from '../../api/index.js';
import {noDetail} from "../../api/user.js";
export default {
onLoad(e) {
this.planInfo = JSON.parse(decodeURIComponent(e.badProduct));
this.froms[0].plan_id = this.planInfo.plan_id;
reasonNo({ status: 1 }).then(res => {
this.reason = res;
});
this.getInfo()
},
data() {
return {
planInfo: {},
ifEdit:0,
frequency: ['白班', '夜班'],
reason: [],
froms: [
{
import {
reasonNo,
badReasons
} from '../../api/index.js';
import {
noDetail
} from "../../api/user.js";
export default {
onLoad(e) {
this.planInfo = JSON.parse(decodeURIComponent(e.badProduct));
this.froms[0].plan_id = this.planInfo.plan_id;
reasonNo({
status: 1
}).then(res => {
this.reason = res;
});
this.getInfo()
},
data() {
return {
planInfo: {},
ifEdit: 0,
frequency: ['白班', '夜班'],
reason: [],
froms: [{
plan_id: 0,
reason_no_id: 0,
math: "",
remake: '',
status: 1,
frequency: 0
}
],
buttonState:true,
};
},
methods: {
frequencyChange(e, index) {
this.froms[index].frequency = e.detail.value;
},
getReasonContent(id) {
let info = this.reason.find(item => {
return (item.id = id);
});
if (info) {
return info.title;
}
return '请选择';
},
reasonChange(e, index) {
this.froms[index].reason_no_id = e.detail.value;
}],
buttonState: true,
};
},
add() {
this.froms.push({
plan_id: this.planInfo.plan_id,
reason_no_id: 0,
math: '',
remake: '',
status: 1,
frequency: 0
});
},
getInfo(){
noDetail({plan_id:this.planInfo.plan_id}).then(res=>{
if(res){
res.map(items=>{
console.log("不良品详情id",items.id)
this.froms.map(its=>{
its.id=items.id
})
})
this.froms=res
this.ifEdit=1
console.log("不良品详情",this.froms)
methods: {
frequencyChange(e, index) {
this.froms[index].frequency = e.detail.value;
},
getReasonContent(id) {
let info = this.reason.find(item => {
return (item.id = id);
});
if (info) {
return info.title;
}
})
},
submit() {
let params = JSON.parse(JSON.stringify(this.froms));
params = params.map(item => {
item.reason_no_id = this.reason[item.reason_no_id].id;
return item;
});
this.buttonState = false;
this.$functions.confirm("是否进行此操作?").then(()=>{
badReasons({data: params}).then(res => {
this.$functions.success('提交成功').then(() => {
uni.navigateBack();
return '请选择';
},
reasonChange(e, index) {
this.froms[index].reason_no_id = e.detail.value;
},
add() {
this.froms.push({
plan_id: this.planInfo.plan_id,
reason_no_id: 0,
math: '',
remake: '',
status: 1,
frequency: 0
});
},
getInfo() {
noDetail({
plan_id: this.planInfo.plan_id
}).then(res => {
if (res) {
res.map(items => {
console.log("不良品详情id", items.id)
this.froms.map(its => {
its.id = items.id
})
})
this.froms = res
this.ifEdit = 1
console.log("不良品详情", this.froms)
}
})
},
submit() {
let params = JSON.parse(JSON.stringify(this.froms));
params = params.map(item => {
item.reason_no_id = this.reason[item.reason_no_id].id;
return item;
});
this.buttonState = false;
this.$functions.confirm("是否进行此操作?").then(() => {
badReasons({
data: params
}).then(res => {
this.$functions.success('提交成功').then(() => {
uni.navigateBack();
})
}).catch(res => {
this.buttonState = true;
});
});
})
});;
})
}
}
}
};
};
</script>
<style lang="scss">
@import './index.scss';
@import './index.scss';
</style>

55
pages/modeMaintainAdd/index.scss

@ -0,0 +1,55 @@
.content{
background-color: white;
padding-bottom: 20upx;
.card-up{
@include wh(710upx,auto);
margin: auto;
padding-top: 1upx;
.mode-up{
@include flex(center,flex-start);
margin-top: 20upx;
view{
font-size: 24upx;
@include flex(center,flex-start);
view{
border: 1upx solid #808080;
font-size: 24upx;
margin-left: 40upx;
text-indent: 20upx;
width: 200upx;
}
input{
width: 200upx;
border: 1upx solid #808080;
font-size: 24upx;
margin-left: 40upx;
text-indent: 20upx;
}
}
}
}
.card-down{
@include wh(710upx,auto);
margin: auto;
padding-top: 20upx;
border: 1upx solid #808080;
margin-top: 20upx;
padding-bottom: 20upx;
.list{
@include flex(center,flex-start);
margin-top: 20upx;
view{
@include fonts(26upx,#333)
width:180upx;
}
text{
@include fonts(24upx,#999999);
margin-left: 20upx;
}
.bor{
width:200upx;
border: 1upx solid #808080;
}
}
}
}

114
pages/modeMaintainAdd/modeMaintainAdd.vue

@ -1,19 +1,125 @@
<template>
<view>
<view class="content">
<view class="card-up">
<view class="mode-up">
<view>
<text>模具编号</text>
<input disabled="true" v-model="modeNo" />
</view>
</view>
<view class="mode-up">
<view>
<text>模具名称</text>
<input disabled="true" v-model="modeName" />
</view>
</view>
<picker @change="modeStaff($event,staffList)" :value="staffId" :range="staffList" :range-key="'name'">
<view class="mode-up">
<view>
<text>保养人员</text>
<view>{{staffList[staffId]?staffList[staffId].name:''}}</view>
</view>
</view>
</picker>
<picker mode="date" :value="date" :start="startDate" :end="endDate" @change="bindDateChange">
<view class="mode-up">
<view>
<text>保养时间</text>
<input disabled="true" v-model="date" />
</view>
</view>
</picker>
</view>
<view class="card-down">
<view class="list">
<view>检测部位</view>
<text>各模板</text>
</view>
<view class="list">
<view>检测内容</view>
<text>各模板</text>
</view>
<view class="list">
<view>检测结果</view>
<text class="bor">各模板</text>
</view>
<view class="list">
<view>问题位置</view>
<text class="bor">各模板</text>
</view>
<view class="list">
<view>措施</view>
<text class="bor">各模板</text>
</view>
</view>
</view>
</template>
<script>
import {
staff
} from "../../api/user.js"
export default {
data() {
const currentDate = this.getDate({
format: true
})
return {
modeId: '',
modeNo: '',
modeName: '',
staffList: [],
staffId: 0,
date: currentDate
};
},
onLoad(e) {
this.modeId = e.id;
this.modeNo = e.no
this.modeName = e.name
this.getStaff()
},
computed: {
startDate() {
return this.getDate('start');
},
endDate() {
return this.getDate('end');
}
},
methods: {
getStaff() {
staff().then(res => {
this.staffList = res;
console.log("员工", res)
})
},
modeStaff(e, item) {
this.staffId = e.detail.value
},
bindDateChange: function(e) {
this.date = e.target.value
},
getDate(type) {
const date = new Date();
let year = date.getFullYear();
let month = date.getMonth() + 1;
let day = date.getDate();
if (type === 'start') {
year = year - 60;
} else if (type === 'end') {
year = year + 2;
}
month = month > 9 ? month : '0' + month;
day = day > 9 ? day : '0' + day;
return `${year}-${month}-${day}`;
}
}
}
</script>
<style lang="scss">
@import "./index.scss"
</style>

10
pages/modeMaintainList/modeMaintainList.vue

@ -1,6 +1,6 @@
<template>
<view>
<view class="card" v-for="(item,index) in list" :key="index" @tap="firstInspectionInfo(item.plan_id,item)">
<view class="card" v-for="(item,index) in list" :key="index" @tap="modeMaintainAdd(item.id,item.no,item.name)">
<view class="card-left">
<view class="card-up-list">
<view class="card-up-list-list">
@ -52,6 +52,14 @@
modeList().then(res=>{
this.list=res
})
},
modeMaintainAdd(id,no,name){
uni.navigateTo({
url: `../modeMaintainAdd/modeMaintainAdd?id=${id}&no=${no}&name=${name}`,
success: res => {},
fail: () => {},
complete: () => {}
});
}
}
}

260
pages/stampingRecordList/stampingRecordList.vue

@ -1,6 +1,6 @@
<template>
<view>
<view class="card" v-for="(item,index) in list" :key="index" >
<view class="card" v-for="(item,index) in list" :key="index">
<view class="card-left">
<view class="card-up-list">
<view class="card-up-list-list">
@ -17,7 +17,7 @@
</view>
<view class="card-up-list">
<view class="card-up-list-list">
<view>工时投入:</view><text></text>
<view>工时投入:</view><text>{{item.tr}}</text>
</view>
</view>
<view class="card-dow-list">
@ -32,11 +32,11 @@
</view>
</view>
<view class="btn-grounp">
<view :class="item.status!=1?'':'dis-btn'" v-if="" @tap="openLine(item.plan_id,item)">开线</view>
<view class="btn-tx" @tap="stopLine(item)">停线</view>
<view :class="item.status!=1?'':'dis-btn'" v-if="" @tap="openLine(item.plan_id,item)">开线</view>
<view class="btn-tx" @tap="stopLine(item)">停线</view>
<view v-if="item.status==1" class="btn-xx" @tap="offLine(item.plan_id)">下线</view>
<view class="btn-blp" @tap="badProduct(item)">不良品统计</view>
<view class="btn-back" @tap="rework(item)">返修</view>
<view class="btn-blp" @tap="badProduct(item)">不良品统计</view>
<view class="btn-back" @tap="rework(item)">返修</view>
</view>
</view>
<uni-popup ref="popup" type="center">
@ -46,7 +46,7 @@
<view class="right-pic">
<text v-if="frequencyId==0">夜班</text>
<text v-if="frequencyId==1">白班</text>
<!-- <image src="../../static/next.png"></image> -->
<!-- <image src="../../static/next.png"></image> -->
</view>
</view>
<view class="pop-list">
@ -84,13 +84,13 @@
mapGetters,
mapMutations
} from 'vuex';
import moment from "moment";
export default {
computed: {
...mapGetters(['userInfo', 'roleType'])
},
onLoad() {
this.getArr();
this.isMenu();
this.getTime()
@ -100,32 +100,33 @@
},
data() {
return {
list:[],
status:["冲压","喷涂"],
frequency:["夜班", "白班"],
buttonState:false,
froms:{
plan_id:'',
in_line:'',
list: [],
status: ["冲压", "喷涂"],
frequency: ["夜班", "白班"],
buttonState: false,
froms: {
plan_id: '',
in_line: '',
//peoples:'',
status:1,
frequency:0
status: 1,
frequency: 0
},
frequencyId:'',
frequencyId: '',
power: [],
jurisdiction: [],
};
},methods:{
},
methods: {
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)
},
@ -136,162 +137,139 @@
this.froms.frequency = e.target.value
},
bindStatus: function(e) {
console.log("状态",e.target.value)
this.froms.status = e.target.value+1
console.log("状态", e.target.value)
this.froms.status = e.target.value + 1
},
openLine(plan_id,item){
if(item.status==1){
openLine(plan_id, item) {
if (item.status == 1) {
this.$functions.error("已开线,请勿重复操作");
return false;
}
else{
openLine({id:plan_id}).then(res=>{
} else {
openLine({
id: plan_id
}).then(res => {
this.$functions.success('操作成功').then(() => {
this.getData()
});
})
}
},
getData(){
firstCheckLists({type:1}).then(res => {
getData() {
firstCheckLists({
type: 1
}).then(res => {
this.list = res;
this.list.map(item=>{
console.log("时间",moment(item.open_time).format('MMMM Do YYYY, h:mm:ss a'))
this.list.map(item => {
if (item.open_time > 0) {
let openTime = moment(item.open_time * 1000).format("YYYY-MM-DD hh:mm:ss");
item.tr = this.getRemainderTime(openTime);
} else {
item.tr = "";
}
})
})
},
stopLine(item){
stopLine(item) {
uni.navigateTo({
url: `../stopLineList/stopLineList?planInfo=${encodeURIComponent(JSON.stringify(item))}`
url: `../stopLineList/stopLineList?planInfo=${encodeURIComponent(JSON.stringify(item))}`
});
},
offLine(plan_id){
offLine(plan_id) {
uni.navigateTo({
url: `../offLine/offLine?plan_id=${plan_id}`
url: `../offLine/offLine?plan_id=${plan_id}`
});
},
badProduct(item){
badProduct(item) {
uni.navigateTo({
url: `../badProduct/badProduct?badProduct=${encodeURIComponent(JSON.stringify(item))}`
url: `../badProduct/badProduct?badProduct=${encodeURIComponent(JSON.stringify(item))}`
});
}
,
rework(item){
},
rework(item) {
uni.navigateTo({
url: `../rework/rework?badProduct=${encodeURIComponent(JSON.stringify(item))}`
url: `../rework/rework?badProduct=${encodeURIComponent(JSON.stringify(item))}`
});
},
open(e){
this.froms.plan_id=e;
// refuni-popup , type ['top','left','bottom','right','center']
this.$refs.popup.open('center')
putInDetail({plan_id:e}).then(res=>{
if(res){
this.froms.frequency=res.frequency
this.froms.in_line=res.in_line
console.log("投入详情", this.froms.in_line)
}
})
open(e) {
this.froms.plan_id = e;
// refuni-popup , type ['top','left','bottom','right','center']
this.$refs.popup.open('center')
putInDetail({
plan_id: e
}).then(res => {
if (res) {
this.froms.frequency = res.frequency
this.froms.in_line = res.in_line
console.log("投入详情", this.froms.in_line)
}
})
},
tjrsBtn(){
tjrsBtn() {
this.buttonState = false;
trtj(this.froms).then(res=>{
trtj(this.froms).then(res => {
this.$functions.success('提交成功').then(() => {
this.$refs.popup.close('center')
this.$refs.popup.close('center')
}).catch(res => {
this.buttonState = true;
});
})
},
getTime:function(){
var date = new Date(),
year = date.getFullYear(),
month = date.getMonth() + 1,
day = date.getDate(),
hour = date.getHours() < 10 ? "0" + date.getHours() : date.getHours(),
minute = date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes(),
second = date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds();
month >= 1 && month <= 9 ? (month = "0" + month) : "";
day >= 0 && day <= 9 ? (day = "0" + day) : "";
var timer = year + '-' + month + '-' + day + ' ' + hour + ':' + minute + ':' + second;
console.log("当前时间",timer)
return timer;
getTime: function() {
var date = new Date(),
year = date.getFullYear(),
month = date.getMonth() + 1,
day = date.getDate(),
hour = date.getHours() < 10 ? "0" + date.getHours() : date.getHours(),
minute = date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes(),
second = date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds();
month >= 1 && month <= 9 ? (month = "0" + month) : "";
day >= 0 && day <= 9 ? (day = "0" + day) : "";
var timer = year + '-' + month + '-' + day + ' ' + hour + ':' + minute + ':' + second;
console.log("当前时间", timer)
return timer;
},
// dateFormat(second){
// console.log("线",second)
// var dd,hh,mm,ss;
// second = typeof second === 'string' ? parseInt(second) : second;
// if(!second || second < 0){
// return;
// }
// //
// dd = second / (24 * 3600) | 0;
// second = Math.round(second) - dd * 24 * 3600;
// //
// hh = second / 3600 | 0;
// second = Math.round(second) - hh * 3600;
// //
// mm = second / 60 | 0;
// //
// ss = Math.round(second) - mm * 60;
// if(Math.round(dd) < 10){
// dd = dd > 0 ? '0' + dd : '';
// }
// if(Math.round(hh) < 10){
// hh = '0' + hh;
// }
// if(Math.round(mm) < 10){
// mm = '0' + mm;
// }
// if(Math.round(ss) < 10){
// ss = '0' + ss;
// }
// // alert( dd + ' ' + hh + ':' + mm + ':' + ss);
// }
getRemainderTime: function(startTime) {
var s1 = new Date(startTime.replace(/-/g, "/")),
s2 = new Date(),
runTime = parseInt((s2.getTime() - s1.getTime()) / 1000);
var year = Math.floor(runTime / 86400 / 365);
runTime = runTime % (86400 * 365);
var month = Math.floor(runTime / 86400 / 30);
runTime = runTime % (86400 * 30);
var day = Math.floor(runTime / 86400);
runTime = runTime % 86400;
var hour = Math.floor(runTime / 3600);
runTime = runTime % 3600;
var minute = Math.floor(runTime / 60);
runTime = runTime % 60;
var second = runTime;
// console.log(year,month,day,hour,minute,second);
if (month > 0) {
return month + '月' + day + '天' + hour + '小时' + minute + '分' + second + "秒";
} else {
return day + '天' + hour + '小时' + minute + '分' + second + "秒";
}
}
}
}
</script>
<style lang="scss">
@import "./index.scss";
@import "./index.scss";
</style>

2
utils/request.js

@ -38,11 +38,11 @@ const service = (params) => {
case 200:
relove(data.data);
break;
case 203:
functions.logout();
break;
default:
reject(data);
functions.error(data.msg);
}

Loading…
Cancel
Save