提交至本地分支

This commit is contained in:
weinan2087
2023-02-09 14:39:44 +08:00
parent 736cb14f63
commit d4953ee701

View File

@@ -28,7 +28,7 @@
<div class="publish"> <div class="publish">
<el-button @click="saveBack" type="primary" size="large">取消</el-button> <el-button @click="saveBack" type="primary" size="large">取消</el-button>
<el-button @click="saveBack(0)" type="primary" size="large">保存</el-button> <el-button @click="saveBack(0)" type="primary" size="large">保存</el-button>
<el-button @click="saveBack(1)" type="primary" size="large">保存并发布</el-button> <el-button @click="saveBack(2)" type="primary" size="large">保存并发布</el-button>
</div> </div>
<el-dialog title="添加人员" :visible.sync="addUserShow" :close-on-click-modal="false" width="800px" custom-class="g-dialog"> <el-dialog title="添加人员" :visible.sync="addUserShow" :close-on-click-modal="false" width="800px" custom-class="g-dialog">
<el-row style="height: 400px;"> <el-row style="height: 400px;">
@@ -46,7 +46,7 @@
</el-col> </el-col>
<el-col :span="18"> <el-col :span="18">
<div class="action"> <div class="action">
<el-input clearable style="width: 30%;margin-left: 10px;" v-model="userQueryForm.keyWord" placeholder="请输入姓名或工号"></el-input> <el-input clearable style="width: 30%;margin-left: 10px;" v-model="userQueryForm.keyword" placeholder="请输入姓名或工号"></el-input>
<el-button type="primary" size="medium" @click="queryUserData">搜索</el-button> <el-button type="primary" size="medium" @click="queryUserData">搜索</el-button>
<el-button type="primary" class="findBtn" size="medium" @click="reset">重置</el-button> <el-button type="primary" class="findBtn" size="medium" @click="reset">重置</el-button>
</div> </div>
@@ -72,7 +72,7 @@
<div style="padding: 10px 0px;color: #009ae7; ">单个导入文件受众成员请勿超过5000条记录以员工号为准必须是本系统人员</div> <div style="padding: 10px 0px;color: #009ae7; ">单个导入文件受众成员请勿超过5000条记录以员工号为准必须是本系统人员</div>
<el-row type="flex" align="middle" justify="start" style="margin-bottom: 10px;"> <el-row type="flex" align="middle" justify="start" style="margin-bottom: 10px;">
文件名称<el-input style="width: 200px;" disabled v-model="selectFile"></el-input> 文件名称<el-input style="width: 200px;" disabled v-model="selectFile"></el-input>
<el-upload <!-- <el-upload
class="upload-demo" class="upload-demo"
ref="upload" ref="upload"
action="/systemapi/xboe/usergroup/import" action="/systemapi/xboe/usergroup/import"
@@ -86,7 +86,22 @@
:file-list="fileList" :file-list="fileList"
:show-file-list="false" :show-file-list="false"
:auto-upload="false" :auto-upload="false"
> > -->
<el-upload
class="upload-demo"
ref="upload"
:action="importUrl"
:headers="{'token':token}"
accept=".xlsx"
name="file"
:on-change="selectFileFun"
:limit="1"
:on-exceed="uploadExceed"
:on-success="uploadSuccess"
:file-list="fileList"
:show-file-list="false"
:auto-upload="false"
>
<el-button slot="trigger" style="margin-left: 10px;" size="small" type="primary">选择</el-button> <el-button slot="trigger" style="margin-left: 10px;" size="small" type="primary">选择</el-button>
<el-button style="margin-left: 10px;" size="small" type="success" @click="submitUpload">上传</el-button> <el-button style="margin-left: 10px;" size="small" type="success" @click="submitUpload">上传</el-button>
</el-upload> </el-upload>
@@ -122,6 +137,7 @@
import userApi from "@/api/system/user"; import userApi from "@/api/system/user";
import orgApi from "@/api/system/organiza"; import orgApi from "@/api/system/organiza";
import apiUserBasic from "@/api/boe/userbasic"; import apiUserBasic from "@/api/boe/userbasic";
import apiAudience from "@/api/boe/audience.js";
export default{ export default{
data(){ data(){
return{ return{
@@ -133,6 +149,8 @@
description:'', description:'',
userGroupItems:[] userGroupItems:[]
}, },
isUpdate:false,
importUrl:process.env.VUE_APP_AUDIENCE_IMPORT_URL,
searchValue:'', searchValue:'',
tableData:[], tableData:[],
tableDataShow:[], tableDataShow:[],
@@ -149,7 +167,7 @@
label: 'name' label: 'name'
}, },
userData:[], userData:[],
userQueryForm:{keyWord:'',departId:''}, userQueryForm:{keyword:'',departId:''},
userDataLoading:false, userDataLoading:false,
userDataPage:{ userDataPage:{
total:0, total:0,
@@ -166,14 +184,23 @@
mounted() { mounted() {
let that = this; let that = this;
if (that.$route.query.id) { if (that.$route.query.id) {
usergroupApi.detail(that.$route.query.id).then((res) => { let req = {audienceId:that.$route.query.id}
if (res.status == 200) { this.isUpdate = true;
that.form = res.result; apiAudience.detail(req).then((res) => {
// that.oldUserGroupItems = JSON.parse(JSON.stringify( res.result.userGroupItems )); if (res.status == 200) {
that.tableData = res.result.userGroupItems; that.form = res.result;
that.queryTableData(); that.tableData = res.result.memberList;
} that.queryTableData();
}
}); });
// usergroupApi.detail(that.$route.query.id).then((res) => {
// if (res.status == 200) {
// that.form = res.result;
// // that.oldUserGroupItems = JSON.parse(JSON.stringify( res.result.userGroupItems ));
// that.tableData = res.result.userGroupItems;
// that.queryTableData();
// }
// });
} }
}, },
methods:{ methods:{
@@ -228,7 +255,7 @@
}, },
openDialog(){ openDialog(){
this.addUserShow = true; this.addUserShow = true;
this.userQueryForm.keyWord = ''; this.userQueryForm.keyword = '';
this.userQueryForm.departId = ''; this.userQueryForm.departId = '';
// orgApi.treeList({}).then(res => { // orgApi.treeList({}).then(res => {
// if (res.status == 200) { // if (res.status == 200) {
@@ -239,7 +266,7 @@
//this.loadUserData(this.userDataPage); //this.loadUserData(this.userDataPage);
}, },
reset() { reset() {
this.userQueryForm.keyWord = ''; this.userQueryForm.keyword = '';
this.userQueryForm.departId = ''; this.userQueryForm.departId = '';
this.userDataPage.pageIndex = 1; this.userDataPage.pageIndex = 1;
this.loadUserData(this.userDataPage, this.userQueryForm); this.loadUserData(this.userDataPage, this.userQueryForm);
@@ -247,6 +274,8 @@
userSelectionChange(val) { userSelectionChange(val) {
this.userSelection = val; this.userSelection = val;
}, },
//搜索员工事件
queryUserData(){ queryUserData(){
this.userDataPage.pageIndex = 1; this.userDataPage.pageIndex = 1;
this.loadUserData(this.userDataPage, this.userQueryForm); this.loadUserData(this.userDataPage, this.userQueryForm);
@@ -255,13 +284,30 @@
this.userDataLoading = true; this.userDataLoading = true;
params.pageIndex = page.pageIndex; params.pageIndex = page.pageIndex;
params.pageSize = page.pageSize; params.pageSize = page.pageSize;
userApi.list(Object.assign(params, this.userQueryForm)).then(res => {
let req = {
page:page.pageIndex,
pageSize:page.pageSize,
keyword:this.userQueryForm.keyword,
departId:this.userQueryForm.departId
}
apiAudience.userList(req).then(res => {
if (res.status == 200) { if (res.status == 200) {
this.userData = res.result.list; console.log("搜索用户信息");
this.userDataPage.total = res.result.count; console.log(res);
this.userData = res.result.userInfoList;
this.userDataPage.total = res.result.totalPage;
this.userDataLoading = false; this.userDataLoading = false;
} }
}) })
// userApi.list(Object.assign(params, this.userQueryForm)).then(res => {
// if (res.status == 200) {
// this.userData = res.result.list;
// this.userDataPage.total = res.result.count;
// this.userDataLoading = false;
// }
// })
}, },
userDataCurrentChange(pageIndex){ userDataCurrentChange(pageIndex){
this.userDataPage.pageIndex = pageIndex; this.userDataPage.pageIndex = pageIndex;
@@ -279,7 +325,7 @@
for(let i = 0; i < this.userSelection.length; i++){ for(let i = 0; i < this.userSelection.length; i++){
let isAdd = true; let isAdd = true;
for(let j = 0; j < this.tableData.length; j++){ for(let j = 0; j < this.tableData.length; j++){
if(this.userSelection[i].id == this.tableData[j].aid){ if(this.userSelection[i].id == this.tableData[j].id){
isAdd = false; isAdd = false;
break; break;
} }
@@ -287,12 +333,15 @@
if(isAdd){ if(isAdd){
let userItem = {} let userItem = {}
userItem.aid = this.userSelection[i].id; userItem.aid = this.userSelection[i].id;
userItem.id = this.userSelection[i].id;
userItem.name = this.userSelection[i].name; userItem.name = this.userSelection[i].name;
userItem.userNo = this.userSelection[i].userNo; userItem.userNo = this.userSelection[i].userNo;
userItem.departId = this.userSelection[i].departId; userItem.departId = this.userSelection[i].departId;
userItem.departName = this.userSelection[i].departName; userItem.departName = this.userSelection[i].departName;
userItem.position = this.userSelection[i].duty; userItem.position = this.userSelection[i].duty;
this.tableData.push(userItem); this.tableData.push(userItem);
console.log(111);
console.log(this.tableData);
} }
} }
this.queryTableData(); this.queryTableData();
@@ -443,8 +492,10 @@
this.queryTableData(); this.queryTableData();
this.importUserShow = false; this.importUserShow = false;
}, },
// 保存、保存并发布事件
saveBack(status){ saveBack(status){
if(status === 1 || status === 0){ if(status === 2 || status === 0){
this.form.status = status; this.form.status = status;
}else{ }else{
this.$router.push('/manage/ugroups'); this.$router.push('/manage/ugroups');
@@ -455,33 +506,70 @@
this.form.userGroupItems = []; this.form.userGroupItems = [];
if(this.tableData.length > 0){ if(this.tableData.length > 0){
for(let i = 0; i < this.tableData.length; i++){ for(let i = 0; i < this.tableData.length; i++){
this.form.userGroupItems.push({aid:this.tableData[i].aid}); // this.form.userGroupItems.push({aid:this.tableData[i].aid});
this.form.userGroupItems.push(this.tableData[i].id);
} }
} }
if (this.form.id != null && this.form.id != "") { if (this.form.id != null && this.form.id != "") { // 修改受众
usergroupApi let req = {
.update(this.form) audienceId:this.form.id,
.then((res) => { audienceName:this.form.name,
if (res.status == 200) { description:this.form.description,
this.$message({ type: "success", message: "修改成功",offset:50 }); type:this.form.gtype,
this.$router.push('/manage/ugroups'); status:this.form.status,
} memberIdList:this.form.userGroupItems
}) }
.catch((res) => { apiAudience.update(req).then((res) => {
this.$message({ type: "error", message: res.message ,offset:50}); if (res.status == 200) {
}); this.$message({ type: "success", message: "修改成功",offset:50 });
} else { this.$router.push('/manage/ugroups');
usergroupApi }else{
.save(this.form) console.log("更新受众异常");
.then((res) => { }
if (res.status == 200) { })
this.$message({ type: "success", message: "新增成功" ,offset:50});
this.$router.push('/manage/ugroups'); // usergroupApi
} // .update(this.form)
}) // .then((res) => {
.catch((res) => { // if (res.status == 200) {
this.$message({ type: "error", message: res.message ,offset:50}); // this.$message({ type: "success", message: "修改成功",offset:50 });
}); // this.$router.push('/manage/ugroups');
// }
// })
// .catch((res) => {
// this.$message({ type: "error", message: res.message ,offset:50});
// });
} else { // 新增受众
let req = {
audienceId:this.form.id,
audienceName:this.form.name,
description:this.form.description,
type:this.form.gtype,
status:this.form.status,
memberIdList:this.form.userGroupItems
}
apiAudience.update(req).then((res) => {
if (res.status == 200) {
this.$message({ type: "success", message: "新增成功",offset:50 });
this.$router.push('/manage/ugroups');
}else{
console.log("新增受众异常");
}
})
// usergroupApi
// .save(this.form)
// .then((res) => {
// if (res.status == 200) {
// this.$message({ type: "success", message: "新增成功" ,offset:50});
// this.$router.push('/manage/ugroups');
// }
// })
// .catch((res) => {
// this.$message({ type: "error", message: res.message ,offset:50});
// });
} }
} }
}); });