mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/learning-system-portal.git
synced 2025-12-10 19:36:43 +08:00
提交至本地分支
This commit is contained in:
@@ -28,7 +28,7 @@
|
||||
<div class="publish">
|
||||
<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(1)" type="primary" size="large">保存并发布</el-button>
|
||||
<el-button @click="saveBack(2)" type="primary" size="large">保存并发布</el-button>
|
||||
</div>
|
||||
<el-dialog title="添加人员" :visible.sync="addUserShow" :close-on-click-modal="false" width="800px" custom-class="g-dialog">
|
||||
<el-row style="height: 400px;">
|
||||
@@ -46,7 +46,7 @@
|
||||
</el-col>
|
||||
<el-col :span="18">
|
||||
<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" class="findBtn" size="medium" @click="reset">重置</el-button>
|
||||
</div>
|
||||
@@ -72,7 +72,7 @@
|
||||
<div style="padding: 10px 0px;color: #009ae7; ">注:单个导入文件受众成员请勿超过5000条记录,以员工号为准。必须是本系统人员</div>
|
||||
<el-row type="flex" align="middle" justify="start" style="margin-bottom: 10px;">
|
||||
文件名称:<el-input style="width: 200px;" disabled v-model="selectFile"></el-input>
|
||||
<el-upload
|
||||
<!-- <el-upload
|
||||
class="upload-demo"
|
||||
ref="upload"
|
||||
action="/systemapi/xboe/usergroup/import"
|
||||
@@ -86,7 +86,22 @@
|
||||
:file-list="fileList"
|
||||
:show-file-list="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 style="margin-left: 10px;" size="small" type="success" @click="submitUpload">上传</el-button>
|
||||
</el-upload>
|
||||
@@ -122,6 +137,7 @@
|
||||
import userApi from "@/api/system/user";
|
||||
import orgApi from "@/api/system/organiza";
|
||||
import apiUserBasic from "@/api/boe/userbasic";
|
||||
import apiAudience from "@/api/boe/audience.js";
|
||||
export default{
|
||||
data(){
|
||||
return{
|
||||
@@ -133,6 +149,8 @@
|
||||
description:'',
|
||||
userGroupItems:[]
|
||||
},
|
||||
isUpdate:false,
|
||||
importUrl:process.env.VUE_APP_AUDIENCE_IMPORT_URL,
|
||||
searchValue:'',
|
||||
tableData:[],
|
||||
tableDataShow:[],
|
||||
@@ -149,7 +167,7 @@
|
||||
label: 'name'
|
||||
},
|
||||
userData:[],
|
||||
userQueryForm:{keyWord:'',departId:''},
|
||||
userQueryForm:{keyword:'',departId:''},
|
||||
userDataLoading:false,
|
||||
userDataPage:{
|
||||
total:0,
|
||||
@@ -166,14 +184,23 @@
|
||||
mounted() {
|
||||
let that = this;
|
||||
if (that.$route.query.id) {
|
||||
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();
|
||||
}
|
||||
let req = {audienceId:that.$route.query.id}
|
||||
this.isUpdate = true;
|
||||
apiAudience.detail(req).then((res) => {
|
||||
if (res.status == 200) {
|
||||
that.form = res.result;
|
||||
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:{
|
||||
@@ -228,7 +255,7 @@
|
||||
},
|
||||
openDialog(){
|
||||
this.addUserShow = true;
|
||||
this.userQueryForm.keyWord = '';
|
||||
this.userQueryForm.keyword = '';
|
||||
this.userQueryForm.departId = '';
|
||||
// orgApi.treeList({}).then(res => {
|
||||
// if (res.status == 200) {
|
||||
@@ -239,7 +266,7 @@
|
||||
//this.loadUserData(this.userDataPage);
|
||||
},
|
||||
reset() {
|
||||
this.userQueryForm.keyWord = '';
|
||||
this.userQueryForm.keyword = '';
|
||||
this.userQueryForm.departId = '';
|
||||
this.userDataPage.pageIndex = 1;
|
||||
this.loadUserData(this.userDataPage, this.userQueryForm);
|
||||
@@ -247,6 +274,8 @@
|
||||
userSelectionChange(val) {
|
||||
this.userSelection = val;
|
||||
},
|
||||
|
||||
//搜索员工事件
|
||||
queryUserData(){
|
||||
this.userDataPage.pageIndex = 1;
|
||||
this.loadUserData(this.userDataPage, this.userQueryForm);
|
||||
@@ -255,13 +284,30 @@
|
||||
this.userDataLoading = true;
|
||||
params.pageIndex = page.pageIndex;
|
||||
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) {
|
||||
this.userData = res.result.list;
|
||||
this.userDataPage.total = res.result.count;
|
||||
console.log("搜索用户信息");
|
||||
console.log(res);
|
||||
this.userData = res.result.userInfoList;
|
||||
this.userDataPage.total = res.result.totalPage;
|
||||
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){
|
||||
this.userDataPage.pageIndex = pageIndex;
|
||||
@@ -279,7 +325,7 @@
|
||||
for(let i = 0; i < this.userSelection.length; i++){
|
||||
let isAdd = true;
|
||||
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;
|
||||
break;
|
||||
}
|
||||
@@ -287,12 +333,15 @@
|
||||
if(isAdd){
|
||||
let userItem = {}
|
||||
userItem.aid = this.userSelection[i].id;
|
||||
userItem.id = this.userSelection[i].id;
|
||||
userItem.name = this.userSelection[i].name;
|
||||
userItem.userNo = this.userSelection[i].userNo;
|
||||
userItem.departId = this.userSelection[i].departId;
|
||||
userItem.departName = this.userSelection[i].departName;
|
||||
userItem.position = this.userSelection[i].duty;
|
||||
this.tableData.push(userItem);
|
||||
console.log(111);
|
||||
console.log(this.tableData);
|
||||
}
|
||||
}
|
||||
this.queryTableData();
|
||||
@@ -443,8 +492,10 @@
|
||||
this.queryTableData();
|
||||
this.importUserShow = false;
|
||||
},
|
||||
|
||||
// 保存、保存并发布事件
|
||||
saveBack(status){
|
||||
if(status === 1 || status === 0){
|
||||
if(status === 2 || status === 0){
|
||||
this.form.status = status;
|
||||
}else{
|
||||
this.$router.push('/manage/ugroups');
|
||||
@@ -455,33 +506,70 @@
|
||||
this.form.userGroupItems = [];
|
||||
if(this.tableData.length > 0){
|
||||
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 != "") {
|
||||
usergroupApi
|
||||
.update(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});
|
||||
});
|
||||
} else {
|
||||
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});
|
||||
});
|
||||
if (this.form.id != null && this.form.id != "") { // 修改受众
|
||||
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
|
||||
// .update(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});
|
||||
// });
|
||||
} 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});
|
||||
// });
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user