|
|
|
<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)">
|
|
|
|
人员统计
|
|
|
|
</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.production}}{{item.week}}</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="isMenu(69)" @tap="openLine(item.plan_id,item)">开线</view>
|
|
|
|
<view class="btn-tx" v-if="isMenu(70)" @tap="stopLine(item)">停线</view>
|
|
|
|
<view v-if="item.status==1&&item.o_id==null&&isMenu(71)" class="btn-xx" @tap="offLine(item.plan_id,item)">下线</view>
|
|
|
|
<view v-if="item.o_id!=null&&isMenu(72)&&item.n_id == 0" class="btn-xx" @tap="offLineExeam(item)">下线审核</view>
|
|
|
|
<view class="btn-blp" v-if="isMenu(73)" @tap="badProduct(item,1)">不良品统计</view>
|
|
|
|
<view class="btn-back" v-if="isMenu(74)&&item.n_id !=0" @tap="badProduct(item,2)">不良品审核</view>
|
|
|
|
<!-- <view class="btn-back" v-if="isMenu(75)" @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="froms.frequency==0">夜班</text>
|
|
|
|
<text v-if="froms.frequency==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,
|
|
|
|
xxExamine,
|
|
|
|
planList
|
|
|
|
} from "../../api/user.js";
|
|
|
|
import {
|
|
|
|
mapGetters,
|
|
|
|
mapMutations
|
|
|
|
} from 'vuex';
|
|
|
|
import moment from "moment";
|
|
|
|
export default {
|
|
|
|
computed: {
|
|
|
|
...mapGetters(['userInfo', 'roleType'])
|
|
|
|
|
|
|
|
},
|
|
|
|
onLoad() {
|
|
|
|
|
|
|
|
this.power = this.userInfo.power
|
|
|
|
this.getTime()
|
|
|
|
this.getArr();
|
|
|
|
this.isMenu();
|
|
|
|
|
|
|
|
},
|
|
|
|
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() {
|
|
|
|
if (this.power.length > 0) {
|
|
|
|
let newArr = this.power.map(item => {
|
|
|
|
this.jurisdiction.push(item.id)
|
|
|
|
})
|
|
|
|
|
|
|
|
}
|
|
|
|
console.log("id",this.jurisdiction)
|
|
|
|
},
|
|
|
|
isMenu(id) {
|
|
|
|
|
|
|
|
return this.jurisdiction.includes(id);
|
|
|
|
},
|
|
|
|
// 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() {
|
|
|
|
planList({
|
|
|
|
type: 3
|
|
|
|
}).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,type) {
|
|
|
|
uni.navigateTo({
|
|
|
|
url: `../assembleBadProdct/assembleBadProdct?badProduct=${encodeURIComponent(JSON.stringify(item))}&&type=${type}`
|
|
|
|
});
|
|
|
|
},
|
|
|
|
offLineExeam(item){
|
|
|
|
uni.navigateTo({
|
|
|
|
url: `../offLine/offLine?planInfo=${encodeURIComponent(JSON.stringify(item))}&type=2`
|
|
|
|
});
|
|
|
|
},
|
|
|
|
rework(item) {
|
|
|
|
uni.navigateTo({
|
|
|
|
url: `../rework/rework?badProduct=${encodeURIComponent(JSON.stringify(item))}`
|
|
|
|
});
|
|
|
|
},
|
|
|
|
open(item) {
|
|
|
|
console.log("投入详情1", item)
|
|
|
|
this.froms.plan_id = item.plan_id;
|
|
|
|
this.froms.frequency=item.frequency;
|
|
|
|
console.log("投入详情2", this.froms)
|
|
|
|
// 通过组件定义的ref调用uni-popup方法 ,如果传入参数 ,type 属性将失效 ,仅支持 ['top','left','bottom','right','center']
|
|
|
|
this.$refs.popup.open('center')
|
|
|
|
putInDetail({
|
|
|
|
plan_id: item.plan_id
|
|
|
|
}).then(res => {
|
|
|
|
console.log("res", res)
|
|
|
|
if (JSON.stringify(res)==="{}") {
|
|
|
|
|
|
|
|
this.froms.plan_id = item.plan_id;
|
|
|
|
this.froms.frequency=item.frequency;
|
|
|
|
console.log("空的")
|
|
|
|
}
|
|
|
|
else{
|
|
|
|
this.froms.frequency = res.frequency
|
|
|
|
this.froms.in_line = res.in_line
|
|
|
|
console.log("有东西")
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
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>
|