Commit 93bc2ef0 authored by zhengke's avatar zhengke

修改

parent 36eba2e3
<style>
.stuCloseBtn {
position: absolute;
right: -8px;
top: -9px;
width: 20px;
height: 20px;
border: 1px solid red;
background-color: red;
color: #fff;
line-height: 18px;
text-align: center;
border-radius: 50%;
cursor:pointer;
}
</style>
<template> <template>
<div> <div>
<q-card flat class="q-pa-lg q-my-lg" v-loading="loading"> <q-card flat class="q-pa-lg q-my-lg" v-loading="loading">
<div class="text-h6 text-weight-bold">分配给以下部门/成员</div> <div class="text-h6 text-weight-bold">分配给以下部门/成员</div>
<div class="text-subtitle1 text-weight-bold q-my-md"> <div style="display:flex;justify-content:end;width:600px;margin-bottom:10px;">
<span>适用部门/成员</span> <q-btn round color="primary" icon="iconfont icon-img_haha" @click="addEmployee()" />
<span class="text-negative">*</span>
</div> </div>
<div class="q-mb-md row"> <div style="display:flex;margin-bottom:10px;position:relative;width:620px;" v-for="(item,index) in List" :key="index">
<div class="col"> <q-select class="col-6 q-pb" v-model="item.Content" @input="getName(item.Content,index)"
<q-btn outline color="primary" class="q-px-lg" @click="outerVisible = true">选择部门/成员</q-btn> style="width:300px;margin-right:10px;" clearable filled stack-label use-input option-value="Id"
option-label="EmployeeName" ref="ManagerId" :options="EmployeeList" label="留学顾问" :dense="false" emit-value
map-options @filter="filterFn">
<template v-slot:no-option>
<q-item>
<q-item-section class="text-grey">
未找到相关数据
</q-item-section>
</q-item>
</template>
</q-select>
<q-select filled v-model="item.CodeList" multiple option-value="Id" option-label="Name" :options="NeedData"
label="客户需求" style="width: 300px" emit-value map-options />
<div class="stuCloseBtn">
<i @click="delStepStu(index)" class="iconfont icon-guanbi"></i>
</div> </div>
<div class="col">已选择:{{ chosenUser.length }}</div>
</div>
<div class="q-mb-xl">
<q-badge color="primary" class="q-mr-md" v-for="(x, i) in chosenUser" :key="i">
{{ x.DeptName }}
</q-badge>
</div> </div>
<q-select filled v-model="multiCheck" multiple option-value="Id" option-label="Name" :options="NeedData"
label="客户需求" style="width: 300px" emit-value map-options />
<q-btn class="q-mt-xl q-px-lg" unelevated color="primary" :loading="saving" @click="saveHandler">立即保存</q-btn> <q-btn class="q-mt-xl q-px-lg" unelevated color="primary" :loading="saving" @click="saveHandler">立即保存</q-btn>
</q-card> </q-card>
<choiceapproval v-if="outerVisible" @close="getclose()" :singleCheck="true" @success="getsuccess2" :byval="chosenUser" cptype="0"> <choiceapproval v-if="outerVisible" @close="getclose()" :singleCheck="true" @success="getsuccess2"
:byval="chosenUser" cptype="0">
</choiceapproval> </choiceapproval>
</div> </div>
</template> </template>
...@@ -37,6 +60,9 @@ ...@@ -37,6 +60,9 @@
import { import {
GetNeedsList GetNeedsList
} from "../../api/school/index"; } from "../../api/school/index";
import {
queryEmployee
} from "../../api/users/user"; //获取员工
export default { export default {
components: { components: {
choiceapproval choiceapproval
...@@ -56,14 +82,68 @@ ...@@ -56,14 +82,68 @@
Name: "留学客户分配规则", Name: "留学客户分配规则",
}, },
multiCheck: [], multiCheck: [],
NeedData: [] //多选 NeedData: [], //多选
EmployeeList: [], // 员工
AllemployeeList: [],
List: [{
CodeList: [],
Code: '',
Content: '',
Mask: ""
}]
}; };
}, },
created() { created() {
this.getGetNeedsList(); this.getGetNeedsList();
this.getEmployee();
this.init(); this.init();
}, },
methods: { methods: {
//点击添加
addEmployee() {
let obj = {
CodeList: [],
Code: '',
Content: '',
Mask: ""
}
this.List.push(obj);
},
delStepStu(index){
this.List.splice(index,1);
},
//选择Name
getName(Id, index) {
this.EmployeeList.forEach(x => {
if (x.Id == Id) {
this.List[index].Mask = x.EmployeeName;
}
})
},
//获取业务员
getEmployee() {
var qMsg = {
EmployeeName: ''
}
queryEmployee(qMsg).then(res => {
if (res.Code == 1) {
this.EmployeeList = res.Data;
this.AllemployeeList = res.Data;
}
})
},
//筛选员工
filterFn(val, update) {
update(() => {
if (val === '') {
this.EmployeeList = JSON.parse(JSON.stringify(this.AllemployeeList))
} else {
const needle = val.toLowerCase();
this.EmployeeList = this.AllemployeeList.filter(v => v.EmployeeName.toLowerCase().indexOf(needle) > -1);
}
})
},
//获取客户需求 //获取客户需求
getGetNeedsList() { getGetNeedsList() {
GetNeedsList().then(res => { GetNeedsList().then(res => {
...@@ -88,70 +168,70 @@ ...@@ -88,70 +168,70 @@
}).then(res => { }).then(res => {
this.loading = false; this.loading = false;
if (res.Code == 1) { if (res.Code == 1) {
var tempObj=res.Data; var tempObj = res.Data;
if (tempObj) { if (tempObj) {
this.dictObjEmp.ID=tempObj.ID; this.dictObjEmp.ID = tempObj.ID;
this.dictObjEmp.Code=tempObj.Code; this.dictObjEmp.Content = tempObj.Content;
this.dictObjEmp.Content=tempObj.Content; if (tempObj.Content) {
this.dictObjEmp.Mask=tempObj.Mask; this.List = JSON.parse(tempObj.Content);
this.chosenUser=[];
if(tempObj.Content&&tempObj.Mask){
this.chosenUser.push({
DeptId:tempObj.Content,
DeptName:tempObj.Mask
})
}
if(tempObj.Code){
this.multiCheck = tempObj.Code.split(',');
this.multiCheck=this.multiCheck.map(item => {
return +item;
});
} }
} }
} }
}); });
}, },
saveHandler() { saveHandler() {
if (this.chosenUser.length > 0) { if(this.List.length==0){
this.saving = true; this.$q.notify({
let contentTemp = ""; type: 'negative',
let maskTemp = ""; position: "top",
this.chosenUser.forEach(x => { message: `请添加数据`
contentTemp += "," + x.DeptId;
maskTemp += "," + x.DeptName;
}); });
this.dictObjEmp.Content = this.chosenUser[0].DeptId; return
this.dictObjEmp.Mask = this.chosenUser[0].DeptName; }
if (this.multiCheck && this.multiCheck.length > 0) { if(this.List.length>0){
this.dictObjEmp.Code = this.multiCheck.toString() for(let i=0;i<this.List.length;i++){
} if(this.List[i].Content==''||this.List[i].Content==null){
saveDict(this.dictObjEmp).then(r => {
this.saving = false;
if (r.Code == 1) {
this.$q.notify({ this.$q.notify({
icon: "iconfont icon-chenggong", type: 'negative',
color: "accent", position: "top",
timeout: 2000, message: `请选择第${i+1}条留学顾问`
message: "数据保存成功!",
position: "top"
}); });
this.init(); return
} else {
this.saving = false;
} }
}); if(this.List[i].CodeList.length==0){
} else { this.$q.notify({
this.$q.notify({ type: 'negative',
icon: "", position: "top",
color: "negative", message: `请选择第${i+1}条客户需求`
timeout: 2000, });
message: "请选择适用的部门成员", return
position: "top" }
}); }
this.List.forEach(x => {
x.Code = x.CodeList.toString();
})
} }
this.dictObjEmp.Content = JSON.stringify(this.List);
this.saving = true;
saveDict(this.dictObjEmp).then(r => {
this.saving = false;
if (r.Code == 1) {
this.$q.notify({
icon: "iconfont icon-chenggong",
color: "accent",
timeout: 2000,
message: "数据保存成功!",
position: "top"
});
this.init();
} else {
this.saving = false;
}
});
} }
} }
}; };
</script> </script>
<style></style> <style></style>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment