|
@@ -113,20 +113,40 @@
|
|
|
</template>
|
|
|
</van-field>
|
|
|
<van-icon v-if="index != 0 && canEdit" class="delete_executor" name="delete-o" @click.stop="deleteExecutor(index)" />
|
|
|
+
|
|
|
+ <van-cell-group v-if="user.companyId == '3092'">
|
|
|
+ <van-cell title="项目服务" :value="`${item.serviceName || ''} - ${item.serviceCode || ''}`" is-link @click="searchServiceCli(item,index)">
|
|
|
+ <template #right-icon>
|
|
|
+ <div class="iconBox">
|
|
|
+ <!-- <van-icon name="close" size="18" class="iconRight" /> -->
|
|
|
+ <!-- <van-icon name="arrow" size="18" class="iconRight" /> -->
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </van-cell>
|
|
|
+ </van-cell-group>
|
|
|
</div>
|
|
|
|
|
|
+ <!-- 选择项目服务 -->
|
|
|
+ <van-popup v-model="select_sapServiceList_show" position="bottom" style="height: 90%">
|
|
|
+ <div class="popupDiv">
|
|
|
+ <div class="popupSearch">
|
|
|
+ <van-search v-model.trim="sapServiceVal" placeholder="搜索" @search="onSearchService" @clear="onSearchService" shape="round" background="#F4F4F4"></van-search>
|
|
|
+ </div>
|
|
|
+ <div class="popupCon conBorder">
|
|
|
+ <van-radio-group v-model="sapServiceChange" class="popupItem marginNone borderNone">
|
|
|
+ <van-radio v-for="uitem in sapServiceList" :key="uitem.id" :name="uitem" style="padding:10px">
|
|
|
+ <span class="userNameClass_left">{{ uitem.serviceName }}</span>
|
|
|
+ <span class="userNameClass_right">{{ uitem.serviceCode }}</span>
|
|
|
+ </van-radio>
|
|
|
+ </van-radio-group>
|
|
|
+ </div>
|
|
|
+ <div class="popupBtn">
|
|
|
+ <van-button style="width:100%;background: #1989fa;color: #ffffff;position: -webkit-sticky;position: sticky;bottom: 0;" round @click="searchExecutorBtn()">确定</van-button>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </van-popup>
|
|
|
+
|
|
|
<van-popup v-model="executor.show" position="bottom" v-if="canEdit" style="height: 90%">
|
|
|
- <!-- <van-search v-model="executor.searchText" placeholder="输入员工姓名搜索" @input="onSearch"></van-search>
|
|
|
- <div style="minHeight:300px;">
|
|
|
- <van-radio-group v-model="executor.item">
|
|
|
- <van-radio v-for="uitem in executor.searchList" :key="uitem.id" :name="uitem" style="padding:10px">
|
|
|
- <span v-if="user.userNameNeedTranslate != 1">{{uitem.name}}</span>
|
|
|
- <span v-else><ww-open-data type='userName' :openid='uitem.name'></ww-open-data></span>
|
|
|
- <span class="xinmingghao">{{uitem.jobNumber}}</span>
|
|
|
- </van-radio>
|
|
|
- </van-radio-group>
|
|
|
- <van-button style="width:100%;position: -webkit-sticky;position: sticky;bottom: 0;" @click="searchExecutor()">确定</van-button>
|
|
|
- </div> -->
|
|
|
<div class="popupDiv">
|
|
|
<div class="popupSearch" v-if="user.userNameNeedTranslate != '1'">
|
|
|
<van-search v-model="executor.searchText" placeholder="输入员工姓名搜索" @search="onSearch" shape="round" background="#F4F4F4"></van-search>
|
|
@@ -180,6 +200,8 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
+import { S } from 'core-js/modules/_export'
|
|
|
+
|
|
|
export default {
|
|
|
data() {
|
|
|
return {
|
|
@@ -239,7 +261,13 @@ export default {
|
|
|
select_list_array: [],
|
|
|
select_project_show_searchText: '',
|
|
|
|
|
|
- integrationProjectList: []
|
|
|
+ integrationProjectList: [],
|
|
|
+
|
|
|
+ sapServiceList:[], // 项目服务
|
|
|
+ sapServiceListCoper:[], // 项目服务
|
|
|
+ select_sapServiceList_show: false,
|
|
|
+ sapServiceVal: '',
|
|
|
+ sapServiceChange: {}
|
|
|
}
|
|
|
},
|
|
|
mounted() {
|
|
@@ -270,6 +298,11 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
this.getUsersList()
|
|
|
+
|
|
|
+ const { companyId } = this.user
|
|
|
+ if(companyId == 3092) {
|
|
|
+ this.getSapServiceList()
|
|
|
+ }
|
|
|
console.log('mounted',this.taskId,null);
|
|
|
},
|
|
|
methods: {
|
|
@@ -456,20 +489,57 @@ export default {
|
|
|
this.taskLevel.show = false
|
|
|
},
|
|
|
|
|
|
+ executorProjectJudgment(arr) {
|
|
|
+ let arrList = JSON.parse(JSON.stringify(arr))
|
|
|
+ // 将填写的数据以执行人id相同处理成二维数据
|
|
|
+ const result = Object.values(arrList.reduce((acc, obj) => {
|
|
|
+ const { executorId } = obj;
|
|
|
+ if (!acc[executorId]) {
|
|
|
+ acc[executorId] = [];
|
|
|
+ }
|
|
|
+ acc[executorId].push(obj);
|
|
|
+ return acc;
|
|
|
+ }, {}));
|
|
|
+ console.log(result, '<== 去重后的数据')
|
|
|
+ // 更具二维数据去判断项目服务是否相同
|
|
|
+ for(var i in result) {
|
|
|
+ const item = result[i]
|
|
|
+ if(item.length > 1) {
|
|
|
+ let size=new Set(item.map(item=>item.serviceId)).size
|
|
|
+ if(size != item.length) {
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return true
|
|
|
+ },
|
|
|
+
|
|
|
submitTask(){
|
|
|
console.log('submitTask');
|
|
|
+ const { companyId } = this.user
|
|
|
if(!this.taskform.name.replace(/^\s*|\s*$/g,"")){
|
|
|
return
|
|
|
}
|
|
|
|
|
|
// 执行人查重
|
|
|
- let arr = this.taskform.executorList
|
|
|
- let json={};
|
|
|
- for(let i in arr){
|
|
|
- if(!json[arr[i].executorId]){
|
|
|
- json[arr[i].executorId]=1;
|
|
|
- }else{
|
|
|
- this.$toast.fail("执行人存在重复");
|
|
|
+ if(companyId != '3092') {
|
|
|
+ let arr = this.taskform.executorList
|
|
|
+ let json={};
|
|
|
+ for(let i in arr){
|
|
|
+ if(!json[arr[i].executorId]){
|
|
|
+ json[arr[i].executorId]=1;
|
|
|
+ }else{
|
|
|
+ this.$toast.fail("执行人存在重复");
|
|
|
+ return
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 针对依斯倍排除执行人相同和项目服务相同的任务
|
|
|
+ if(companyId == '3092') {
|
|
|
+ if(!this.executorProjectJudgment(this.taskform.executorList)) {
|
|
|
+ this.$toast.fail("同一个项目服务执行人相同");
|
|
|
return
|
|
|
}
|
|
|
}
|
|
@@ -495,6 +565,7 @@ export default {
|
|
|
delete this.taskform.subTaskList;
|
|
|
delete this.taskform.refTaskList;
|
|
|
delete this.taskform.progress;
|
|
|
+
|
|
|
this.submitTaskBtn = true
|
|
|
// return
|
|
|
this.$axios.post("/task/save", this.taskform)
|
|
@@ -575,6 +646,49 @@ export default {
|
|
|
this.$toast.fail('获取失败');
|
|
|
}
|
|
|
}).catch(err=> {this.$toast.clear();console.log(err)});
|
|
|
+ },
|
|
|
+ getSapServiceList() {
|
|
|
+ this.$axios.post("/sap-project-service/sapServiceList", {})
|
|
|
+ .then(res => {
|
|
|
+ if(res.code == "ok") {
|
|
|
+ this.sapServiceList = res.data
|
|
|
+ this.sapServiceListCoper = JSON.parse(JSON.stringify(res.data))
|
|
|
+ } else {
|
|
|
+ this.$toast.fail('获取失败');
|
|
|
+ }
|
|
|
+ }).catch(err=> {this.$toast.clear();console.log(err)});
|
|
|
+ },
|
|
|
+ onSearchService() {
|
|
|
+ if(!this.sapServiceVal) {
|
|
|
+ this.sapServiceList = JSON.parse(JSON.stringify(this.sapServiceListCoper))
|
|
|
+ return
|
|
|
+ }
|
|
|
+ let arr = JSON.parse(JSON.stringify(this.sapServiceListCoper.filter(item => item.serviceName.indexOf(this.sapServiceVal) != -1 || item.serviceCode.indexOf(this.sapServiceVal) != -1)))
|
|
|
+ this.sapServiceList = arr
|
|
|
+ },
|
|
|
+ searchExecutorBtn() {
|
|
|
+ console.log(this.sapServiceChange)
|
|
|
+ const { serviceName, serviceCode, id } = this.sapServiceChange
|
|
|
+ this.taskform.executorList[this.executor.index].serviceId = id
|
|
|
+ this.taskform.executorList[this.executor.index].serviceName = `${serviceName}`
|
|
|
+ this.taskform.executorList[this.executor.index].serviceCode = `${serviceCode}`
|
|
|
+ this.select_sapServiceList_show = false
|
|
|
+ console.log(this.taskform.executorList)
|
|
|
+ },
|
|
|
+ searchServiceCli(item,index) {
|
|
|
+ const { companyId } = this.user
|
|
|
+ this.executor.index = index
|
|
|
+ this.sapServiceListCoper.forEach(u=>{if (u.id == item.serviceId) {
|
|
|
+ console.log(u)
|
|
|
+ this.sapServiceChange = {
|
|
|
+ serviceName: u.serviceName,
|
|
|
+ serviceCode: u.serviceCode,
|
|
|
+ id: u.id,
|
|
|
+ companyId
|
|
|
+ }
|
|
|
+ }})
|
|
|
+ console.log(this.sapServiceChange, item)
|
|
|
+ this.select_sapServiceList_show = true
|
|
|
}
|
|
|
},
|
|
|
}
|
|
@@ -606,6 +720,14 @@ export default {
|
|
|
display: inline-block;
|
|
|
float: right;
|
|
|
}
|
|
|
+
|
|
|
+.iconBox {
|
|
|
+ position: relative;
|
|
|
+ top: 2px;
|
|
|
+}
|
|
|
+.iconRight {
|
|
|
+ margin-left: 10px;
|
|
|
+}
|
|
|
.ewProjectlist {
|
|
|
padding: 10px 10px 10px 20px;
|
|
|
border-bottom: 1px solid #666;
|