|
|
|
<template>
|
|
|
|
<view>
|
|
|
|
<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">
|
|
|
|
<view style="font-weight: bold;">产线:</view><text style="color: red;font-weight: bold;">{{item.line_title}}</text>
|
|
|
|
</view>
|
|
|
|
|
|
|
|
<view class="card-right" @tap="open(item.plan_id,item.frequency)">
|
|
|
|
人员统计
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
<view class="card-up-list">
|
|
|
|
|
|
|
|
<view class="card-up-list-list">
|
|
|
|
<view>物料名称:</view><text>{{item.product_name}}</text>
|
|
|
|
</view>
|
|
|
|
|
|
|
|
</view>
|
|
|
|
<view class="card-up-list">
|
|
|
|
<view class="card-up-list-list">
|
|
|
|
<view>物料编号:</view><text>{{item.product_number}}</text>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
<view class="card-up-list">
|
|
|
|
<view class="card-up-list-list">
|
|
|
|
<view>工时投入:</view><text>{{item.tr?item.tr:'0'}}</text>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
<view class="card-dow-list">
|
|
|
|
<view class="card-up-list-list">
|
|
|
|
<view>班次:</view>
|
|
|
|
<text v-if="item.frequency==0">夜班</text>
|
|
|
|
<text v-if="item.frequency==1">白班</text>
|
|
|
|
</view>
|
|
|
|
|
|
|
|
</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 v-if="item.status==1" class="btn-xx" @tap="offLine(item.plan_id,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">
|
|
|
|
<view class="card-pop">
|
|
|
|
<view class="pop-list">
|
|
|
|
<text>班次:</text>
|
|
|
|
<view class="right-pic">
|
|
|
|
<text v-if="frequencyId==0">夜班</text>
|
|
|
|
<text v-if="frequencyId==1">白班</text>
|
|
|
|
<!-- <image src="../../static/next.png"></image> -->
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
<view class="pop-list">
|
|
|
|
<text>上线人数:</text>
|
|
|
|
<input type="number" v-model="froms.in_line" placeholder="请输入上线人数" />
|
|
|
|
</view>
|
|
|
|
<!-- <view class="pop-list">
|
|
|
|
<text>工时投入:</text>
|
|
|
|
<input type="number" v-model="froms.peoples" placeholder="请输入工时投入" />
|
|
|
|
</view> -->
|
|
|
|
<!-- <picker @change="bindStatus" :value="froms.status" :range="status">
|
|
|
|
<view class="pop-list">
|
|
|
|
<text>状态:</text>
|
|
|
|
<view class="right-pic">
|
|
|
|
<text>{{status[froms.status-1]}}</text>
|
|
|
|
<image src="../../static/next.png"></image>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</picker> -->
|
|
|
|
<view class="submit" :disabled="buttonState==false?true:false" @tap="tjrsBtn()">提交</view>
|
|
|
|
</view>
|
|
|
|
</uni-popup>
|
|
|
|
</view>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import {
|
|
|
|
firstCheckLists,
|
|
|
|
openLine,
|
|
|
|
trtj,
|
|
|
|
putInDetail,
|
|
|
|
noDetail
|
|
|
|
} from "../../api/user.js";
|
|
|
|
import {
|
|
|
|
mapGetters,
|
|
|
|
mapMutations
|
|
|
|
} from 'vuex';
|
|
|
|
import moment from "moment";
|
|
|
|
export default {
|
|
|
|
computed: {
|
|
|
|
...mapGetters(['userInfo', 'roleType'])
|
|
|
|
},
|
|
|
|
onLoad() {
|
|
|
|
|
|
|
|
this.getArr();
|
|
|
|
this.isMenu();
|
|
|
|
this.getTime()
|
|
|
|
},
|
|
|
|
onShow() {
|
|
|
|
this.getData()
|
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
list: [],
|
|
|
|
status: ["冲压", "喷涂"],
|
|
|
|
frequency: ["夜班", "白班"],
|
|
|
|
buttonState: false,
|
|
|
|
froms: {
|
|
|
|
plan_id: '',
|
|
|
|
in_line: '',
|
|
|
|
//peoples:'',
|
|
|
|
status: 1,
|
|
|
|
frequency: 0
|
|
|
|
},
|
|
|
|
frequencyId: '',
|
|
|
|
power: [],
|
|
|
|
jurisdiction: [],
|
|
|
|
};
|
|
|
|
},
|
|
|
|
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)
|
|
|
|
},
|
|
|
|
isMenu(title) {
|
|
|
|
return this.jurisdiction.includes(title);
|
|
|
|
},
|
|
|
|
bindline: function(e) {
|
|
|
|
this.froms.frequency = e.target.value
|
|
|
|
},
|
|
|
|
bindStatus: function(e) {
|
|
|
|
console.log("状态", e.target.value)
|
|
|
|
this.froms.status = e.target.value + 1
|
|
|
|
},
|
|
|
|
openLine(plan_id, item) {
|
|
|
|
if (item.status == 1) {
|
|
|
|
this.$functions.error("已开线,请勿重复操作");
|
|
|
|
return false;
|
|
|
|
} else {
|
|
|
|
openLine({
|
|
|
|
id: plan_id
|
|
|
|
}).then(res => {
|
|
|
|
this.getData()
|
|
|
|
this.$functions.success('操作成功').then(() => {
|
|
|
|
this.getData()
|
|
|
|
});
|
|
|
|
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
},
|
|
|
|
getData() {
|
|
|
|
firstCheckLists({
|
|
|
|
type: 1
|
|
|
|
}).then(res => {
|
|
|
|
this.list = res;
|
|
|
|
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) {
|
|
|
|
uni.navigateTo({
|
|
|
|
url: `../stopLineList/stopLineList?planInfo=${encodeURIComponent(JSON.stringify(item))}`
|
|
|
|
});
|
|
|
|
},
|
|
|
|
offLine(plan_id,item) {
|
|
|
|
uni.navigateTo({
|
|
|
|
url: `../offLine/offLine?plan_id=${plan_id}&planInfo=${encodeURIComponent(JSON.stringify(item))}`
|
|
|
|
});
|
|
|
|
},
|
|
|
|
badProduct(item) {
|
|
|
|
uni.navigateTo({
|
|
|
|
url: `../badProduct/badProduct?badProduct=${encodeURIComponent(JSON.stringify(item))}`
|
|
|
|
});
|
|
|
|
},
|
|
|
|
rework(item) {
|
|
|
|
uni.navigateTo({
|
|
|
|
url: `../rework/rework?badProduct=${encodeURIComponent(JSON.stringify(item))}`
|
|
|
|
});
|
|
|
|
},
|
|
|
|
open(e) {
|
|
|
|
|
|
|
|
this.froms.plan_id = e;
|
|
|
|
|
|
|
|
// 通过组件定义的ref调用uni-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() {
|
|
|
|
|
|
|
|
this.buttonState = false;
|
|
|
|
trtj(this.froms).then(res => {
|
|
|
|
this.$functions.success('提交成功').then(() => {
|
|
|
|
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;
|
|
|
|
|
|
|
|
},
|
|
|
|
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&&day>0) {
|
|
|
|
return month + '月' + day + '天' + hour + '小时' + minute + '分' + second + "秒";
|
|
|
|
} else {
|
|
|
|
return hour + '小时' + minute + '分' + second + "秒";
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss">
|
|
|
|
@import "./index.scss";
|
|
|
|
</style>
|