|
@@ -1,4 +1,5 @@
|
|
<template>
|
|
<template>
|
|
|
|
+<div>
|
|
<div class="distribution">
|
|
<div class="distribution">
|
|
<van-nav-bar :title="titleText" left-text="返回" :right-text="!todayAndTomorrow ? '下发计划' : ''" @click-left="back" @click-right="placeAnOrder" fixed left-arrow/>
|
|
<van-nav-bar :title="titleText" left-text="返回" :right-text="!todayAndTomorrow ? '下发计划' : ''" @click-left="back" @click-right="placeAnOrder" fixed left-arrow/>
|
|
<div class="distribution_header">
|
|
<div class="distribution_header">
|
|
@@ -9,14 +10,11 @@
|
|
<div class="distribution_con contentRoll">
|
|
<div class="distribution_con contentRoll">
|
|
<div class="distribution_box" v-for="item,index in distributionList" :key="index">
|
|
<div class="distribution_box" v-for="item,index in distributionList" :key="index">
|
|
<div class="distribution_ItemBom">
|
|
<div class="distribution_ItemBom">
|
|
|
|
+ <van-checkbox v-model="item.prodProcedure.isSelected" @click="itemChecked" shape="square">
|
|
|
|
+ </van-checkbox>
|
|
<div class="PlanItem">
|
|
<div class="PlanItem">
|
|
<span>{{ item.prodProcedure.name }}</span>
|
|
<span>{{ item.prodProcedure.name }}</span>
|
|
</div>
|
|
</div>
|
|
- <div class="PlanItem" v-show="todayAndTomorrow">
|
|
|
|
- <div>组员:</div>
|
|
|
|
- <span class="" v-if="item.teamNames" @click="distributionProp(item,index)">{{ item.teamNames }} <van-icon name="edit" color="#1989fa" /> </span>
|
|
|
|
- <span style="color: #1989fa;" v-if="!item.teamNames && beDeptList" @click="distributionProp(item,index)">分配</span>
|
|
|
|
- </div>
|
|
|
|
<div class="PlanItem">
|
|
<div class="PlanItem">
|
|
<div>单件工价:</div><span class="textBeyondHiding">{{ item.prodProcedure.workingTime }}</span>
|
|
<div>单件工价:</div><span class="textBeyondHiding">{{ item.prodProcedure.workingTime }}</span>
|
|
</div>
|
|
</div>
|
|
@@ -37,25 +35,68 @@
|
|
{{ item.prodProcedure.checkType == 0 ? '自检' : item.prodProcedure.checkType == 1 ? '互检' : '专检' }}
|
|
{{ item.prodProcedure.checkType == 0 ? '自检' : item.prodProcedure.checkType == 1 ? '互检' : '专检' }}
|
|
</span>
|
|
</span>
|
|
</div>
|
|
</div>
|
|
|
|
+ <div class="PlanItem" v-show="todayAndTomorrow" style="width:100%">
|
|
|
|
+ <div>组员:</div>
|
|
|
|
+ <span class="" v-if="item.teamNames">{{ item.teamNames }}</span>
|
|
|
|
+ <span style="color: #1989fa;" v-if="!item.teamNames && beDeptList" @click="distributionProp(item,index)">分配</span>
|
|
|
|
+ <div>
|
|
|
|
+ <span style="color: #1989fa;" v-if="item.prodProcedureTeamList" @click="workShowHide(index)">{{ item.flg ? paiArr[0] : paiArr[1] }}</span>
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+ <div>
|
|
|
|
+ <collapse>
|
|
|
|
+ <div v-if="item.flg">
|
|
|
|
+ <div>
|
|
|
|
+ <div class="distribution_box" v-for="second_item,index in item.prodProcedureTeamList " :key="index">
|
|
|
|
+ <div class="distribution_ItemBom">
|
|
|
|
+ <div class="PlanItem">
|
|
|
|
+ <span>{{ second_item.user.name }}</span>
|
|
|
|
+ <span>{{ second_item.status==0?"待接收":second_item.status==1?"进行中":second_item.status==2?"已完工":"已终止"}}</span>
|
|
|
|
+ <span class="" v-if="second_item.status==3" @click="changePeople(second_item)" style="color: #1989fa;">换人</span>
|
|
|
|
+ <span class="" v-if="second_item.status==0" @click="deletePeople(second_item.id)" style="color: #1989fa;">删除</span>
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+ <div class="PlanItem">
|
|
|
|
+ <span class="" v-if="item.teamNames" @click="distributionProp(item,index)" style="color: #1989fa;">新增</span>
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+ </collapse>
|
|
|
|
+ </div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
+
|
|
<!-- 弹出层选人 -->
|
|
<!-- 弹出层选人 -->
|
|
<van-popup v-model="popupShow" round position="bottom" :style="{ height: '80%',background: '#F4F4F4' }" >
|
|
<van-popup v-model="popupShow" round position="bottom" :style="{ height: '80%',background: '#F4F4F4' }" >
|
|
<ChooseSomeone ref="ChooseSomeone" :groupView="2" :groupViewBack="true" :peopleList="peopleList" @ChooseSomeoneChanhe="chooseSomeoneChanhe" :peopleListId="peopleListId"></ChooseSomeone>
|
|
<ChooseSomeone ref="ChooseSomeone" :groupView="2" :groupViewBack="true" :peopleList="peopleList" @ChooseSomeoneChanhe="chooseSomeoneChanhe" :peopleListId="peopleListId"></ChooseSomeone>
|
|
</van-popup>
|
|
</van-popup>
|
|
</div>
|
|
</div>
|
|
|
|
+<div class="formBatch">
|
|
|
|
+ <van-checkbox v-model="isAllChecked" :disabled="distributionList.length == 0" @click="allChecked" shape="square" style="padding-left:3vw"></van-checkbox>
|
|
|
|
+ <div style="padding:1vh 2vw">
|
|
|
|
+ <van-button @click="batchReceive()" :disabled="!isCanAgree || distributionList.length == 0" type="info" size="small">批量接收</van-button>
|
|
|
|
+ <!-- <van-button @click="batchAgree(false)" :disabled="!isCanAgree || distributionList.length == 0" type="danger" size="small" style="margin-left:2vw">批量驳回</van-button> -->
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+</div>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script>
|
|
<script>
|
|
import ChooseSomeone from '../../../components/chooseSomeone.vue'
|
|
import ChooseSomeone from '../../../components/chooseSomeone.vue'
|
|
|
|
+import collapse from '../../../assets/collapse.js'
|
|
|
|
+import { CellGroup } from 'vant';
|
|
export default {
|
|
export default {
|
|
props: {},
|
|
props: {},
|
|
components: {
|
|
components: {
|
|
|
|
+ collapse,
|
|
ChooseSomeone
|
|
ChooseSomeone
|
|
},
|
|
},
|
|
data() {
|
|
data() {
|
|
return {
|
|
return {
|
|
|
|
+ isAllChecked: false,
|
|
|
|
+ activeNames: ['1'],
|
|
beDeptList: JSON.parse(localStorage.getItem('beDeptList')), // 是否为工长
|
|
beDeptList: JSON.parse(localStorage.getItem('beDeptList')), // 是否为工长
|
|
distributionList: [],
|
|
distributionList: [],
|
|
distributionIndex: null,
|
|
distributionIndex: null,
|
|
@@ -70,13 +111,16 @@ export default {
|
|
|
|
|
|
dates: '',
|
|
dates: '',
|
|
productSchedulingNum: '',
|
|
productSchedulingNum: '',
|
|
- productName: ''
|
|
|
|
|
|
+ productName: '',
|
|
|
|
+ isCanAgree:false,
|
|
|
|
+ user: JSON.parse(localStorage.userInfo)
|
|
};
|
|
};
|
|
},
|
|
},
|
|
computed: {},
|
|
computed: {},
|
|
watch: {},
|
|
watch: {},
|
|
created() {},
|
|
created() {},
|
|
mounted() {
|
|
mounted() {
|
|
|
|
+ this.paiArr = ['收起', '展开'],
|
|
this.id = this.$route.query.id
|
|
this.id = this.$route.query.id
|
|
this.type = this.$route.query.type
|
|
this.type = this.$route.query.type
|
|
this.departmentId = this.$route.query.departmentId
|
|
this.departmentId = this.$route.query.departmentId
|
|
@@ -94,12 +138,102 @@ export default {
|
|
this.getPeople()
|
|
this.getPeople()
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
|
|
+ // 批量操作
|
|
|
|
+ allChecked(){
|
|
|
|
+ if(this.isAllChecked){
|
|
|
|
+ for(let i in this.distributionList){
|
|
|
|
+ this.distributionList[i].prodProcedure.isSelected = true
|
|
|
|
+ console.log('===============');
|
|
|
|
+ }
|
|
|
|
+ this.isCanAgree = true
|
|
|
|
+ }else{
|
|
|
|
+ for(let i in this.distributionList){
|
|
|
|
+ this.distributionList[i].prodProcedure.isSelected = false
|
|
|
|
+ }
|
|
|
|
+ this.isCanAgree = false
|
|
|
|
+ }
|
|
|
|
+ this.$forceUpdate();
|
|
|
|
+ },
|
|
|
|
+ itemChecked(){
|
|
|
|
+ let isall = true
|
|
|
|
+ let iscan = false
|
|
|
|
+ for(let i in this.distributionList){
|
|
|
|
+ if(!this.distributionList[i].prodProcedure.isSelected){
|
|
|
|
+ isall = false
|
|
|
|
+ }else {
|
|
|
|
+ iscan = true
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ this.isAllChecked = isall
|
|
|
|
+ this.isCanAgree = iscan
|
|
|
|
+ },
|
|
|
|
+ batchReceive(bol){
|
|
|
|
+ let ids = ''
|
|
|
|
+ console.log(this.user)
|
|
|
|
+ let resArr= this.distributionList.map(item=>{
|
|
|
|
+ if(item.prodProcedure.isSelected){
|
|
|
|
+ if(item.prodProcedureTeamList.filter(i=>i.userId==this.user.id).length>0){
|
|
|
|
+ return item.prodProcedureTeamList.filter(i=>i.userId==this.user.id)[0].id
|
|
|
|
+ }else{
|
|
|
|
+ return ""
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ console.log('res===============',resArr)
|
|
|
|
+ if(resArr.length > 0){
|
|
|
|
+ ids = resArr.join(",").trim()
|
|
|
|
+ this.$axios.post(
|
|
|
|
+ "/plan/receivePlan",
|
|
|
|
+ {
|
|
|
|
+ ids:ids
|
|
|
|
+ }
|
|
|
|
+ ).then(res => {
|
|
|
|
+ if (res.code == "ok") {
|
|
|
|
+ this.isAllChecked=false
|
|
|
|
+ this.isCanAgree=false
|
|
|
|
+ this.getDistributionList()
|
|
|
|
+ } else {
|
|
|
|
+ this.$toast.clear();
|
|
|
|
+ this.$toast.fail(res.msg);
|
|
|
|
+ }
|
|
|
|
+ }).catch(err => { this.$toast.clear(); })
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ workShowHide(index) {
|
|
|
|
+ this.distributionList[index].flg = !this.distributionList[index].flg;
|
|
|
|
+ console.log('=========>',this.distributionList[index].flg)
|
|
|
|
+ },
|
|
back() {
|
|
back() {
|
|
this.$router.go(-1);
|
|
this.$router.go(-1);
|
|
},
|
|
},
|
|
|
|
+ // 删除分配人员
|
|
|
|
+ deletePeople(item) {
|
|
|
|
+ const _this=this
|
|
|
|
+ this.$axios.post(
|
|
|
|
+ "/plan/deletePeople",
|
|
|
|
+ {
|
|
|
|
+ id:item
|
|
|
|
+ }
|
|
|
|
+ ).then(res => {
|
|
|
|
+ if (res.code == "ok") {
|
|
|
|
+ this.getDistributionList()
|
|
|
|
+ } else {
|
|
|
|
+ this.$toast.clear();
|
|
|
|
+ this.$toast.fail(res.msg);
|
|
|
|
+ }
|
|
|
|
+ }).catch(err => { this.$toast.clear(); })
|
|
|
|
+ },
|
|
// 下单计划
|
|
// 下单计划
|
|
placeAnOrder() {
|
|
placeAnOrder() {
|
|
- console.log('点击了下单计划')
|
|
|
|
|
|
+ let ids=[this.id];
|
|
|
|
+
|
|
|
|
+ this.$axios.post(
|
|
|
|
+ "/plan/allocationPlan",
|
|
|
|
+ {
|
|
|
|
+ ids: ids.join(","),
|
|
|
|
+ planType: this.type
|
|
|
|
+ }
|
|
|
|
+ )
|
|
},
|
|
},
|
|
distributionProp(item, index) {
|
|
distributionProp(item, index) {
|
|
if(this.beDeptList) {
|
|
if(this.beDeptList) {
|
|
@@ -120,6 +254,7 @@ export default {
|
|
})
|
|
})
|
|
.then(res => {
|
|
.then(res => {
|
|
if (res.code == "ok") {
|
|
if (res.code == "ok") {
|
|
|
|
+ res.data.forEach(item => { item.flg = false })
|
|
this.distributionList = res.data
|
|
this.distributionList = res.data
|
|
} else {
|
|
} else {
|
|
this.$toast.clear();
|
|
this.$toast.clear();
|
|
@@ -127,6 +262,27 @@ export default {
|
|
}
|
|
}
|
|
}).catch(err => { this.$toast.clear(); });
|
|
}).catch(err => { this.$toast.clear(); });
|
|
},
|
|
},
|
|
|
|
+ //换人
|
|
|
|
+ changePeople(item,newPeopleId){
|
|
|
|
+ this.$axios.post('/plan/changePeople', {
|
|
|
|
+ departmentId: this.departmentId,
|
|
|
|
+ })
|
|
|
|
+ .then(res => {
|
|
|
|
+ if (res.code == "ok") {
|
|
|
|
+ this.peopleList = res.data.map(item => {
|
|
|
|
+ return {
|
|
|
|
+ name: item.name,
|
|
|
|
+ id: item.id,
|
|
|
|
+ phone: item.phone,
|
|
|
|
+ jobNumber: item.jobNumber
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ } else {
|
|
|
|
+ this.$toast.clear();
|
|
|
|
+ this.$toast.fail(res.msg);
|
|
|
|
+ }
|
|
|
|
+ }).catch(err => { this.$toast.clear(); });
|
|
|
|
+ },
|
|
// 获取人员
|
|
// 获取人员
|
|
getPeople() {
|
|
getPeople() {
|
|
this.$axios.post('/user/getSimpleActiveUserList', {
|
|
this.$axios.post('/user/getSimpleActiveUserList', {
|
|
@@ -151,6 +307,7 @@ export default {
|
|
teamAllocation(item, nameArr){
|
|
teamAllocation(item, nameArr){
|
|
let newDistributionList = JSON.parse(JSON.stringify(this.distributionList[this.distributionIndex]))
|
|
let newDistributionList = JSON.parse(JSON.stringify(this.distributionList[this.distributionIndex]))
|
|
delete newDistributionList.prodProcedure
|
|
delete newDistributionList.prodProcedure
|
|
|
|
+ delete newDistributionList.prodProcedureTeamList
|
|
this.$axios.post('/plan/teamAllocation', {
|
|
this.$axios.post('/plan/teamAllocation', {
|
|
...newDistributionList,
|
|
...newDistributionList,
|
|
teamIds: item.join(","),
|
|
teamIds: item.join(","),
|
|
@@ -161,6 +318,7 @@ export default {
|
|
this.$refs.ChooseSomeone['loadingBtn'] = false
|
|
this.$refs.ChooseSomeone['loadingBtn'] = false
|
|
if (res.code == "ok") {
|
|
if (res.code == "ok") {
|
|
this.distributionList[this.distributionIndex].teamNames = nameArr.join(',')
|
|
this.distributionList[this.distributionIndex].teamNames = nameArr.join(',')
|
|
|
|
+ this.getDistributionList()
|
|
this.popupShow = false
|
|
this.popupShow = false
|
|
} else {
|
|
} else {
|
|
this.$toast.clear();
|
|
this.$toast.clear();
|
|
@@ -188,6 +346,18 @@ export default {
|
|
* {
|
|
* {
|
|
box-sizing: border-box;
|
|
box-sizing: border-box;
|
|
}
|
|
}
|
|
|
|
+ .formBatch{
|
|
|
|
+ position: fixed;
|
|
|
|
+ bottom: 0;
|
|
|
|
+ width: 100%;
|
|
|
|
+ z-index: 2;
|
|
|
|
+ background-color: #fff;
|
|
|
|
+ display: flex;
|
|
|
|
+ justify-content: space-between;
|
|
|
|
+ align-items: center;
|
|
|
|
+ height: 1.2rem;
|
|
|
|
+ border-top: 1px solid #ebebeb;
|
|
|
|
+ }
|
|
.distribution {
|
|
.distribution {
|
|
width: 100%;
|
|
width: 100%;
|
|
height: 100%;
|
|
height: 100%;
|