Commit 67a1f09c authored by mengmeng's avatar mengmeng

Merge branch 'fwl' into 'master'

差不多结尾

See merge request !4
parents bb8b9c12 eca9161e
......@@ -10,7 +10,7 @@
window.SITE_CONFIG = {};
window.SITE_CONFIG['version'] = 'v1.0.0';
window.SITE_CONFIG['nodeEnv'] = '<%= process.env.VUE_APP_NODE_ENV %>';
window.SITE_CONFIG['apiURL'] = 'http://192.168.10.169:8080/hmit-admin'; // api请求地址
window.SITE_CONFIG['apiURL'] = 'http://192.168.10.164:8080/hmit-admin'; // api请求地址
window.SITE_CONFIG['storeState'] = {}; // vuex本地储存初始化状态(用于不刷新页面的情况下,也能重置初始化项目中所有状态)
window.SITE_CONFIG['contentTabDefault'] = { // 内容标签页默认属性对象
'name': '', // 名称, 由 this.$route.name 自动赋值(默认,名称 === 路由名称 === 路由路径)
......
......@@ -10,11 +10,13 @@ import {
} from "../utils/request";
//会议详情
export function getwoFaultTypeList() {
return getData("/workorder/wofaulttype/woFaultTypeList");
export function getMeetingDetail(id) {
return getData(`/meeting/meeting/${id}`);
}
//会议保存
export function getMeeting(dto) {
return postData("/meeting/meeting", dto);
}
//会议修改/meeting/meeting
\ No newline at end of file
......@@ -37,7 +37,7 @@ export const moduleRoutes = {
{ path: '/memberManageDetail', component: () => import('@/views/modules/memberManage/memberManageDetail'), name: '会员信息详情', meta: { title: '会员信息详情', isTab: false } },
{ path: '/meetingsAdd', component: () => import('@/views/modules/meeting/meetingsAdd'), name: '会议新增', meta: { title: '会议新增', isTab: false } },
{ path: '/meetingsDetail', component: () => import('@/views/modules/meeting/meetingsDetail'), name: '会议详情', meta: { title: '会议详情', isTab: true } },
{ path: '/meetingsDetail', component: () => import('@/views/modules/meeting/meetingsDetail'), name: '会议详情', meta: { title: '会议详情', isTab: false } },
{ path: '/member', component: () => import('@/views/modules/user/user'), name: '会员信息管理', meta: { title: '会员信息管理', isTab: true } },
{ path: '/shenhe', component: () => import('@/views/modules/auditInformationManage/auditInformationManage'), name: '审核信息管理', meta: { title: '审核信息管理', isTab: true } },
]
......
<template>
<div v-loading.fullscreen.lock="loading" :element-loading-text="$t('loading')" :class="['aui-wrapper', { 'aui-sidebar--fold': $store.state.sidebarFold }]">
<div
v-loading.fullscreen.lock="loading"
:element-loading-text="$t('loading')"
:class="['aui-wrapper', { 'aui-sidebar--fold': $store.state.sidebarFold }]"
>
<template v-if="!loading">
<main-navbar />
<main-sidebar />
......@@ -12,94 +16,106 @@
</template>
<script>
import MainNavbar from './main-navbar'
import MainSidebar from './main-sidebar'
import MainContent from './main-content'
import MainThemeTools from './main-theme-tools'
import debounce from 'lodash/debounce'
import MainNavbar from "./main-navbar";
import MainSidebar from "./main-sidebar";
import MainContent from "./main-content";
import MainThemeTools from "./main-theme-tools";
import debounce from "lodash/debounce";
export default {
provide () {
provide() {
return {
// 刷新
refresh () {
this.$store.state.contentIsNeedRefresh = true
refresh() {
this.$store.state.contentIsNeedRefresh = true;
this.$nextTick(() => {
this.$store.state.contentIsNeedRefresh = false
})
}
}
this.$store.state.contentIsNeedRefresh = false;
});
},
};
},
data () {
data() {
return {
loading: true
}
loading: true,
};
},
components: {
MainNavbar,
MainSidebar,
MainContent,
MainThemeTools
MainThemeTools,
},
watch: {
$route: 'routeHandle'
$route: "routeHandle",
},
created () {
this.windowResizeHandle()
this.routeHandle(this.$route)
Promise.all([
this.getUserInfo(),
this.getPermissions()
]).then(() => {
this.loading = false
})
created() {
this.windowResizeHandle();
this.routeHandle(this.$route);
Promise.all([this.getUserInfo(), this.getPermissions()]).then(() => {
this.loading = false;
});
},
methods: {
// 窗口改变大小
windowResizeHandle () {
this.$store.state.sidebarFold = document.documentElement['clientWidth'] <= 992 || false
window.addEventListener('resize', debounce(() => {
this.$store.state.sidebarFold = document.documentElement['clientWidth'] <= 992 || false
}, 150))
windowResizeHandle() {
this.$store.state.sidebarFold =
document.documentElement["clientWidth"] <= 992 || false;
window.addEventListener(
"resize",
debounce(() => {
this.$store.state.sidebarFold =
document.documentElement["clientWidth"] <= 992 || false;
}, 150)
);
},
// 路由, 监听
routeHandle (route) {
routeHandle(route) {
if (!route.meta.isTab) {
return false
return false;
}
var tab = this.$store.state.contentTabs.filter(item => item.name === route.name)[0]
var tab = this.$store.state.contentTabs.filter(
(item) => item.name === route.name
)[0];
if (!tab) {
tab = {
...window.SITE_CONFIG['contentTabDefault'],
...window.SITE_CONFIG["contentTabDefault"],
...route.meta,
'name': route.name,
'params': { ...route.params },
'query': { ...route.query }
}
this.$store.state.contentTabs = this.$store.state.contentTabs.concat(tab)
name: route.name,
params: { ...route.params },
query: { ...route.query },
};
this.$store.state.contentTabs = this.$store.state.contentTabs.concat(
tab
);
}
this.$store.state.sidebarMenuActiveName = tab.menuId
this.$store.state.contentTabsActiveName = tab.name
this.$store.state.sidebarMenuActiveName = tab.menuId;
this.$store.state.contentTabsActiveName = tab.name;
},
// 获取当前管理员信息
getUserInfo () {
return this.$http.get('/sys/user/info').then(({ data: res }) => {
getUserInfo() {
return this.$http
.get("/sys/user/info")
.then(({ data: res }) => {
if (res.code !== 0) {
return this.$message.error(res.msg)
return this.$message.error(res.msg);
}
this.$store.state.user.id = res.data.id
this.$store.state.user.name = res.data.username
this.$store.state.user.superAdmin = res.data.superAdmin
}).catch(() => {})
this.$store.state.user.id = res.data.id;
this.$store.state.user.name = res.data.username;
this.$store.state.user.superAdmin = res.data.superAdmin;
})
.catch(() => {});
},
// 获取权限
getPermissions () {
return this.$http.get('/sys/menu/permissions').then(({ data: res }) => {
getPermissions() {
return this.$http
.get("/sys/menu/permissions")
.then(({ data: res }) => {
if (res.code !== 0) {
return this.$message.error(res.msg)
}
window.SITE_CONFIG['permissions'] = res.data
}).catch(() => {})
}
return this.$message.error(res.msg);
}
}
window.SITE_CONFIG["permissions"] = res.data;
})
.catch(() => {});
},
},
};
</script>
......@@ -95,6 +95,7 @@ export default {
pid: "",
parentName: "",
sort: 0,
type: 0,
},
};
},
......@@ -170,6 +171,12 @@ export default {
},
// 上级部门树, 选中
deptListTreeCurrentChangeHandle(data) {
// console.log(data);
/* if (data.children.length <0) {
this.dataForm.type = 0;
} else {
this.dataForm.type = 1;
} */
this.dataForm.pid = data.id;
this.dataForm.parentName = data.name;
this.deptListVisible = false;
......
......@@ -143,7 +143,7 @@ export default {
data() {
return {
mixinViewModuleOptions: {
getDataListURL: "/user/user/page",
getDataListURL: "/user/user/page?check=0",
getDataListIsPage: true,
exportURL: "/user/user/export",
deleteURL: "/user/user",
......
......@@ -33,10 +33,16 @@
<el-form-item label="职位">
<el-input v-model="dataForm.position"></el-input>
</el-form-item>
<el-form-item label="联系电话">
<el-form-item
label="联系电话"
prop="mobile"
>
<el-input v-model="dataForm.mobile"></el-input>
</el-form-item>
<el-form-item label="邮箱">
<el-form-item
label="邮箱"
prop="email"
>
<el-input v-model="dataForm.email"></el-input>
</el-form-item>
......@@ -66,7 +72,7 @@
v-if="dataForm.ifCheck==1"
label="所属市区级"
>
<el-select
<!-- <el-select
style="width:100%"
v-model="dataForm.areaName"
placeholder="请选择所属市区级"
......@@ -78,34 +84,37 @@
:value="item.value"
>
</el-option>
</el-select>
<!-- <el-cascader
</el-select> -->
<el-cascader
style="width:100%"
v-model="dataForm.areaName"
v-model="dataForm.areaId"
placeholder="请选择所属市区级"
:options="optionsOfLocation"
:props="{ checkStrictly: true }"
:props="props"
ref="myCascader"
@change="changearea"
clearable
></el-cascader> -->
></el-cascader>
</el-form-item>
<el-form-item
required
prop="committeeName"
prop="committeeId"
v-if="dataForm.ifCheck==1"
label="所属委员会"
>
<el-select
style="width:100%"
v-model="dataForm.committeeName"
@change="changename"
v-model="dataForm.committeeId"
placeholder="请选择所属委员会"
clearable
>
<el-option
v-for="item in optionsOfCommittee"
:key="item.value"
:label="item.label"
:value="item.value"
:key="item.id"
:label="item.name"
:value="item.id"
>
</el-option>
</el-select>
......@@ -140,7 +149,12 @@ export default {
data() {
return {
type: this.$route.query.type,
props: {
checkStrictly: true,
value: "id",
label: "name",
children: "children",
},
dataForm: {
id: "",
name: "",
......@@ -155,7 +169,7 @@ export default {
uploadDate: "", //上传日期 */
},
optionsOfLocation: [
{
/* {
value: "宁波市",
label: "宁波市",
},
......@@ -174,7 +188,7 @@ export default {
{
value: "镇海区",
label: "镇海区",
},
}, */
/* {
value: "ningbo",
label: "宁波市",
......@@ -198,28 +212,7 @@ export default {
],
}, */
],
optionsOfCommittee: [
{
value: "网络安全协会",
label: "网络安全协会",
},
{
value: "网络安全协会1",
label: "网络安全协会1",
},
{
value: "网络安全协会2",
label: "网络安全协会2",
},
{
value: "网络安全协会3",
label: "网络安全协会3",
},
{
value: "网络安全协会4",
label: "网络安全协会4",
},
],
optionsOfCommittee: [],
};
},
computed: {
......@@ -232,6 +225,20 @@ export default {
trigger: "blur",
},
], */
email: [
{
required: true,
trigger: "blur",
validator: this.checkEmail,
},
],
mobile: [
{
required: true,
trigger: "blur",
validator: this.checkPhone,
},
],
ifCheck: [
{
required: true,
......@@ -246,7 +253,7 @@ export default {
trigger: "blur",
},
],
committeeName: [
committeeId: [
{
required: true,
message: this.$t("validate.required"),
......@@ -263,6 +270,38 @@ export default {
this.init();
},
methods: {
checkPhone(rule, value, callback) {
if (!value) {
return callback(new Error("请输入正确的手机号"));
} else if (value == null) {
return callback(new Error("手机号不能为空"));
} else {
const reg = /^((0\d{2,3}-\d{7,8})|(1[35789]\d{9}))$/;
console.log(reg.test(value));
if (reg.test(value)) {
callback();
} else {
return callback(new Error("请输入正确的手机号或座机号"));
}
}
},
checkEmail(rule, value, callback) {
if (!value) {
return callback(new Error("请输入正确的邮箱号"));
} else if (value == null) {
return callback(new Error("邮箱号不能为空"));
} else {
const reg = /^[a-zA-Z0-9]+([-_.][a-zA-Z0-9]+)*@[a-zA-Z0-9]+([-_.][a-zA-Z0-9]+)*\.[a-z]{2,}$/;
console.log(reg.test(value));
if (reg.test(value)) {
callback();
} else {
return callback(new Error("请输入正确的邮箱号"));
}
}
},
init() {
this.dataForm.id = this.$route.query.id;
this.$nextTick(() => {
......@@ -272,7 +311,10 @@ export default {
}
});
},
// 获取信息
///committee/committee/list
getInfo() {
this.$http
.get(`/user/user/${this.dataForm.id}`)
......@@ -294,7 +336,44 @@ export default {
console.log(this.dataForm);
})
.catch(() => {});
this.$http
.get("/committee/committee/list")
.then(({ data: res }) => {
if (res.code !== 0) {
return this.$message.error(res.msg);
}
this.optionsOfCommittee = res.data;
})
.catch(() => {});
this.$http
.get("/area/area/list")
.then(({ data: res }) => {
if (res.code !== 0) {
return this.$message.error(res.msg);
}
this.optionsOfLocation = this.getTreeData(res.data);
console.log(res.data);
})
.catch(() => {});
},
getTreeData(data) {
// 循环遍历json数据
for (var i = 0; i < data.length; i++) {
if (data[i].children.length < 1) {
// children若为空数组,则将children设为undefined
data[i].children = undefined;
} else {
// children若不为空数组,则继续 递归调用 本方法
this.getTreeData(data[i].children);
}
}
return data;
},
// 表单提交
dataFormSubmitHandle: function () {
this.$refs["dataForm"].validate((valid) => {
......@@ -304,6 +383,13 @@ export default {
this.$confirm("确定提交吗?")
.then((_) => {
if (this.dataForm.ifCheck == 1) {
this.dataForm.member = 1;
} else if (this.dataForm.ifCheck == 2) {
this.dataForm.member = 2;
}
console.log("data", this.dataForm);
this.$http[!this.dataForm.id ? "post" : "put"](
"/user/user/",
this.dataForm
......@@ -348,9 +434,28 @@ export default {
})
.catch((_) => {});
}, */
changeAuditStatus(value) {
this.dataForm.ifCheck = value;
},
changename(value) {
this.optionsOfCommittee.forEach((ele) => {
if (value == ele.id) {
this.dataForm.committeeName = ele.name;
}
});
},
changearea(value) {
console.log(value);
if (value.length > 0) {
this.dataForm.areaId = value[value.length - 1];
let areaNames = this.$refs.myCascader.getCheckedNodes()[0].pathLabels;
this.dataForm.areaName = areaNames[areaNames.length - 1];
}
// console.log(this.$refs.myCascader.getCheckedNodes()[0].pathLabels);
},
//返回按钮事件
goback() {
this.$router.go(-1);
......
......@@ -22,13 +22,15 @@
></el-input>
</el-form-item>
<el-form-item
label="排序"
prop="sort"
label="排序"
>
<el-input
<el-input-number
v-model="dataForm.sort"
placeholder="排序"
></el-input>
controls-position="right"
:min="0"
label="排序"
></el-input-number>
</el-form-item>
</el-form>
<template slot="footer">
......
......@@ -48,6 +48,7 @@
label="排序"
header-align="center"
align="center"
width="150"
></el-table-column>
<el-table-column
......
......@@ -3,14 +3,23 @@
<el-form
:inline="true"
:model="dataForm"
@keyup.enter.native="getDataList()"
@keyup.enter.native="getdatalist()"
>
<el-form-item>
<el-input
<el-select
style="width:100%"
v-model="dataForm.committee"
placeholder="委员会名称"
placeholder="请选择所属委员会"
clearable
></el-input>
>
<el-option
v-for="item in optionsOfCommittee"
:key="item.id"
:label="item.name"
:value="item.id"
>
</el-option>
</el-select>
</el-form-item>
<el-form-item>
......@@ -23,7 +32,7 @@
<el-form-item>
<el-button
@click="getDataList()"
@click="getdatalist()"
type="primary"
>{{ $t('query') }}</el-button>
</el-form-item>
......@@ -59,11 +68,12 @@
row-key="id"
border
:indent="16"
:default-expand-all="true"
:select-on-indeterminate="false"
@select="select"
@select-all="selectAll"
@selection-change="selectionChange"
:tree-props="{children: 'childList'}"
:tree-props="{children: 'userInfoList'}"
>
<el-table-column
type="selection"
......@@ -78,7 +88,7 @@
</el-table-column>
</el-table>
{{ selectArr.map(el => el.id) }}
<!-- {{ selectArr.map(el => el.id) }} -->
</div>
</template>
......@@ -87,42 +97,46 @@ import mixinViewModule from "@/mixins/view-module";
export default {
name: "committee-table",
mixins: [mixinViewModule],
props: ["invitedUserNames"],
data() {
return {
mixinViewModuleOptions: {
getDataListURL: "/sys/dept/list",
deleteURL: "/sys/dept",
getDataListURL: "/user/user/committeeList",
// deleteURL: "/sys/dept",
},
tableData: [
{
id: 1,
/* {
id: "10",
name: "会长及副会长",
childList: [
{
id: 31,
name: "王小虎",
id: "1",
name: "小明",
},
{
id: 32,
name: "王小虎",
id: "2",
name: "小明",
},
],
},
{
id: 2,
id: "3",
name: "协会监事",
childList: [
{
id: 3,
name: "张亮亮",
id: "4",
name: "小明同学",
},
{
id: 4,
name: "王小虎",
id: "5",
name: "小明的同学小红",
},
],
},
}, */
],
tempaalist: [],
tempbblist: [],
optionsOfCommittee: [],
selectArr: [],
dataForm: {
committee: "",
......@@ -130,21 +144,130 @@ export default {
},
};
},
mounted() {
this.getdatalist();
this.getInfo();
},
methods: {
getInfo() {
this.$http
.get("/committee/committee/list")
.then(({ data: res }) => {
if (res.code !== 0) {
return this.$message.error(res.msg);
}
this.optionsOfCommittee = res.data;
})
.catch(() => {});
},
getdatalist() {
this.$http
.get(
"/user/user/committeeList?committee=" +
this.dataForm.committee +
"&name=" +
this.dataForm.name
)
.then(({ data: res }) => {
if (res.code !== 0) {
return this.$message.error(res.msg);
}
this.tableData = res.data;
// console.log("this.tableData", this.tableData);
})
.then(() => {
this.toggleSelections(this.tableData);
})
.catch(() => {});
},
getInclude1(arr1, arr2) {
let temp = [];
for (const item of arr2) {
arr1.find((i) => i.id === item.id) ? temp.push(item) : "";
}
return temp;
},
toggleSelections(rows) {
// console.log("Wodoap", this.tableData);
if (rows) {
rows.forEach((row) => {
if (row.userInfoList) {
row.userInfoList.map((j) => {
// console.log("Wodoapjjj", j);
this.invitedUserNames.map((i) => {
if (i.id == j.id) {
this.toggleSelection(j, true);
}
});
});
let templist = this.getInclude1(
this.invitedUserNames,
row.userInfoList
);
if (templist.length == row.userInfoList.length) {
this.$refs.table.toggleRowSelection(row);
}
// console.log("log", templist);
}
// console.log(row);
});
} else {
this.$refs.table.clearSelection();
}
},
getTreeData(data) {
// 循环遍历json数据
for (var i = 0; i < data.length; i++) {
if (data[i].userInfoList.length < 1) {
// children若为空数组,则将children设为undefined
data[i].userInfoList = undefined;
} else {
// children若不为空数组,则继续 递归调用 本方法
this.getTreeData(data[i].userInfoList);
}
}
return data;
},
select(selection, row) {
// console.log("selection", selection);
//this.$refs.table.toggleRowSelection(1, false);
let aatemplist = [];
let bbtemplist = [];
selection.some((el) => {
if (el.userInfoList) {
aatemplist.push(el);
} else {
bbtemplist.push(el);
}
});
aatemplist.some((ele, index) => {
ele.userInfoList.forEach((el) => {
// console.log("el", el.id);
if (el.id == row.id) {
this.$refs.table.toggleRowSelection(this.tableData[index], false);
}
});
});
// console.log("temp", templist);
if (
selection.some((el) => {
return row.id === el.id;
})
) {
if (row.childList) {
row.childList.map((j) => {
if (row.userInfoList) {
row.userInfoList.map((j) => {
this.toggleSelection(j, true);
});
}
} else {
if (row.childList) {
row.childList.map((j) => {
if (row.userInfoList) {
row.userInfoList.map((j) => {
this.toggleSelection(j, false);
});
}
......@@ -163,8 +286,8 @@ export default {
});
if (isSelect) {
selection.map((el) => {
if (el.childList) {
el.childList.map((j) => {
if (el.userInfoList) {
el.userInfoList.map((j) => {
this.toggleSelection(j, true);
});
}
......@@ -172,8 +295,8 @@ export default {
}
if (isCancel) {
this.tableData.map((el) => {
if (el.childList) {
el.childList.map((j) => {
if (el.userInfoList) {
el.userInfoList.map((j) => {
this.toggleSelection(j, false);
});
}
......@@ -182,6 +305,43 @@ export default {
},
selectionChange(selection) {
this.selectArr = selection;
let childByValueContent = [];
selection.forEach((ele) => {
if (ele.userInfoList == undefined) {
childByValueContent.push(ele);
}
});
let aatemplist = [];
let bbtemplist = [];
selection.some((el) => {
if (el.userInfoList) {
aatemplist.push(el);
} else {
bbtemplist.push(el);
}
});
/* let templist2 = [];
templist2 = this.getInclude1(this.tableData, aa);
console.log("aaa", this.tableData.length);
console.log("bbb", templist2.length); */
this.tableData.forEach((ele, index) => {
let templist = [];
templist = this.getInclude1(ele.userInfoList, bbtemplist);
/* console.log("aaa", ele.userInfoList.length);
console.log("bbb", templist.length); */
if (ele.userInfoList.length == templist.length) {
this.$refs.table.toggleRowSelection(this.tableData[index], true);
} else {
this.$refs.table.toggleRowSelection(this.tableData[index], false);
}
});
this.$emit("childByValue", childByValueContent);
},
toggleSelection(row, select) {
if (row) {
......
......@@ -3,14 +3,14 @@
<el-form
:inline="true"
:model="dataForm"
@keyup.enter.native="getDataList()"
@keyup.enter.native="getdatalist()"
>
<el-form-item>
<el-cascader
v-model="dataForm.location"
v-model="dataForm.area"
placeholder="请选择所属市区级"
:options="optionsOfLocation"
:props="{ checkStrictly: true }"
:props="props"
clearable
></el-cascader>
</el-form-item>
......@@ -23,7 +23,7 @@
</el-form-item>
<el-form-item>
<el-button
@click="getDataList()"
@click="getdatalist()"
type="primary"
>{{ $t('query') }}</el-button>
</el-form-item>
......@@ -64,27 +64,29 @@
style="width: 100%;margin-bottom: 20px;"
row-key="id"
border
:indent="16"
:indent="50"
:select-on-indeterminate="false"
@select="select"
@select-all="selectAll"
@selection-change="selectionChange"
:tree-props="{children: 'childList'}"
default-expand-all
:tree-props="{children: 'userInfo'}"
>
<el-table-column
type="selection"
width="55"
>
</el-table-column>
<el-table-column
prop="name"
label="委员会人员"
header-align="center"
>
</el-table-column>
</el-table>
{{ selectArr.map(el => el.id) }}
<!-- {{ selectArr.map(el => el.id) }} -->
<!-- <div style="margin-top: 20px">
<el-button @click="cancelAll()">取消选择</el-button>
</div> -->
......@@ -95,38 +97,100 @@
import mixinViewModule from "@/mixins/view-module";
export default {
name: "location-table",
props: ["invitedUserNames"],
mixins: [mixinViewModule],
data() {
return {
tableData: [
{
id: 1,
/* {
id: "10",
name: "鄞州区",
childList: [
{
id: 31,
name: "王小虎",
areaId: "1343843631169024001",
areaName: null,
committeeId: "1343392971822821377",
committeeName: null,
company: "邻家",
createDate: null,
creator: null,
email: "222",
id: "4",
ifCheck: 1,
member: 1,
mobile: "333",
name: "小明同学",
openid: null,
position: "小喽喽",
sex: 1,
updateDate: "2020-12-31 00:42:46",
},
{
id: 32,
name: "王小虎",
areaId: "1343843631169024001",
areaName: null,
committeeId: "1343392971822821377",
committeeName: null,
company: "哦哦哦",
createDate: null,
creator: null,
email: "22",
id: "5",
ifCheck: 1,
member: 1,
mobile: "133",
name: "小明的朋友小红",
openid: null,
position: "客服",
sex: 2,
updateDate: "2020-12-31 00:42:48",
},
],
},
{
id: 2,
id: "3",
name: "海曙区",
childList: [
{
id: 311,
name: "张亮亮",
areaId: "1343843631169024001",
areaName: null,
committeeId: "1343392971822821377",
committeeName: null,
company: "哦哦哦",
createDate: null,
creator: null,
email: "22",
id: "1",
ifCheck: 1,
member: 1,
mobile: "133",
name: "小明",
openid: null,
position: "客服",
sex: 2,
updateDate: "2020-12-31 00:42:48",
},
{
id: 321,
name: "王小虎",
areaId: "1",
areaName: null,
committeeId: "1344173596351778818",
committeeName: null,
company: "金网",
createDate: null,
creator: null,
email: "1111",
id: "2",
ifCheck: 1,
member: 1,
mobile: "11111",
name: "小小明",
openid: null,
position: "大Boss",
sex: 1,
updateDate: "2021-01-01 06:17:06",
},
],
},
}, */
],
selectArr: [],
......@@ -137,10 +201,16 @@ export default {
dataListSelections: [],
dataForm: {
name: "",
location: "",
area: "",
},
props: {
checkStrictly: true,
value: "id",
label: "name",
children: "children",
},
optionsOfLocation: [
{
/* {
value: "ningbo",
label: "宁波",
children: [
......@@ -161,29 +231,150 @@ export default {
label: "镇海区",
},
],
},
}, */
],
};
},
mounted() {
this.getInfo();
this.getdatalist();
//this.toggleSelections(this.tableData);
},
watch: {
tableData: function (newval, oldval) {
// console.log(newval);
},
},
methods: {
getInfo() {
this.$http
.get("/area/area/list")
.then(({ data: res }) => {
if (res.code !== 0) {
return this.$message.error(res.msg);
}
// console.log("parent", this.invitedUserNames);
let selectlist = this.invitedUserNames;
// this.selectionChange(selectlist);
//this.$refs.table.toggleRowSelection(2, true);
this.optionsOfLocation = this.getTreeData(res.data);
})
.catch(() => {});
},
getdatalist() {
let area = "";
if (this.dataForm.area.length > 0) {
area = this.dataForm.area[1];
} else {
area = "";
}
this.$http
.get("/user/user/areaList?area=" + area + "&name=" + this.dataForm.name)
.then(({ data: res }) => {
if (res.code !== 0) {
return this.$message.error(res.msg);
}
this.tableData = res.data;
// console.log("this.tableData", this.tableData);
})
.then(() => {
this.toggleSelections(this.tableData);
})
.catch(() => {});
},
getInclude1(arr1, arr2) {
let temp = [];
for (const item of arr2) {
arr1.find((i) => i.id === item.id) ? temp.push(item) : "";
}
return temp;
},
toggleSelections(rows) {
// console.log("Wodoap", this.tableData);
if (rows) {
rows.forEach((row) => {
if (row.userInfo) {
row.userInfo.map((j) => {
// console.log("Wodoapjjj", j);
this.invitedUserNames.map((i) => {
if (i.id == j.id) {
this.toggleSelection(j, true);
}
});
});
let templist = this.getInclude1(
this.invitedUserNames,
row.userInfo
);
if (templist.length == row.userInfo.length) {
this.$refs.table.toggleRowSelection(row);
}
// console.log("log", templist);
}
// console.log(row);
});
} else {
this.$refs.table.clearSelection();
}
},
getTreeData(data) {
// 循环遍历json数据
for (var i = 0; i < data.length; i++) {
if (data[i].children.length < 1) {
// children若为空数组,则将children设为undefined
data[i].children = undefined;
} else {
// children若不为空数组,则继续 递归调用 本方法
this.getTreeData(data[i].children);
}
}
return data;
},
dataListSelectionChangeHandle1(val) {
this.dataListSelections = val;
console.log(val);
// console.log(val);
},
select(selection, row) {
// console.log("selection", selection);
//this.$refs.table.toggleRowSelection(1, false);
let aatemplist = [];
let bbtemplist = [];
selection.some((el) => {
if (el.userInfo) {
aatemplist.push(el);
} else {
bbtemplist.push(el);
}
});
aatemplist.some((ele, index) => {
ele.userInfo.forEach((el) => {
// console.log("el", el.id);
if (el.id == row.id) {
this.$refs.table.toggleRowSelection(this.tableData[index], false);
}
});
});
// console.log("temp", templist);
if (
selection.some((el) => {
return row.id === el.id;
})
) {
if (row.childList) {
row.childList.map((j) => {
if (row.userInfo) {
row.userInfo.map((j) => {
this.toggleSelection(j, true);
});
}
} else {
if (row.childList) {
row.childList.map((j) => {
if (row.userInfo) {
row.userInfo.map((j) => {
this.toggleSelection(j, false);
});
}
......@@ -202,8 +393,8 @@ export default {
});
if (isSelect) {
selection.map((el) => {
if (el.childList) {
el.childList.map((j) => {
if (el.userInfo) {
el.userInfo.map((j) => {
this.toggleSelection(j, true);
});
}
......@@ -211,8 +402,8 @@ export default {
}
if (isCancel) {
this.tableData.map((el) => {
if (el.childList) {
el.childList.map((j) => {
if (el.userInfo) {
el.userInfo.map((j) => {
this.toggleSelection(j, false);
});
}
......@@ -221,7 +412,45 @@ export default {
},
selectionChange(selection) {
this.selectArr = selection;
let childByValueContent = [];
selection.forEach((ele) => {
if (ele.userInfo == undefined) {
childByValueContent.push(ele);
}
});
let aatemplist = [];
let bbtemplist = [];
selection.some((el) => {
if (el.userInfo) {
aatemplist.push(el);
} else {
bbtemplist.push(el);
}
});
/* let templist2 = [];
templist2 = this.getInclude1(this.tableData, aa);
console.log("aaa", this.tableData.length);
console.log("bbb", templist2.length); */
this.tableData.forEach((ele, index) => {
let templist = [];
templist = this.getInclude1(ele.userInfo, bbtemplist);
/* console.log("aaa", ele.userInfoList.length);
console.log("bbb", templist.length); */
if (ele.userInfo.length == templist.length) {
this.$refs.table.toggleRowSelection(this.tableData[index], true);
} else {
this.$refs.table.toggleRowSelection(this.tableData[index], false);
}
});
this.$emit("childByValue", childByValueContent);
},
toggleSelection(row, select) {
if (row) {
this.$nextTick(() => {
......
......@@ -39,9 +39,7 @@
@click="deleteHandle()"
>{{ $t('deleteBatch') }}</el-button>
</el-form-item>
<el-form-item>
<el-button @click="detail()">详情测试</el-button>
</el-form-item>
</el-form>
<el-table
v-loading="dataListLoading"
......@@ -57,7 +55,7 @@
width="50"
></el-table-column>
<el-table-column
prop="name"
prop="title"
label="会议名称"
header-align="center"
align="center"
......
......@@ -15,9 +15,9 @@
class="meeting"
style="width:100%;border:2px solid #ccc;border-radius:5px;margin-bottom:20px"
>
<el-form-item prop="name">
<el-form-item prop="title">
<el-input
v-model="dataForm.name"
v-model="dataForm.title"
style="font-size:22px;border:0"
placeholder="请在这里输入会议标题"
></el-input>
......@@ -39,25 +39,25 @@
</div>
<el-form-item
label="选择发送人员:"
prop="allPeople"
prop="invitedUserIDs"
>
<el-tooltip
:content="dataForm.allPeople"
<!-- <el-tooltip
:content="allPeople"
placement="left"
:disabled="people.length>0?false:true"
>
:disabled="dataForm.invitedUserNames.length>0?false:true"
> -->
<div class="peoplehide">
<span
v-for="(item,index) in people.slice(0,200)"
v-for="(item,index) in dataForm.invitedUserNames.slice(0,200)"
:key="index"
>
{{item}}
<span v-if="index<199&&index<people.length-1"></span>
{{item.name}}
<span v-if="index<199&&index<dataForm.invitedUserNames.length-1"></span>
</span>
<span v-if="people.length>200">...</span>
<span v-if="dataForm.invitedUserNames.length>200">...</span>
<el-button
@click="isShow=true"
class="sendbtn"
......@@ -66,7 +66,7 @@
></el-button>
</div>
</el-tooltip>
<!-- </el-tooltip> -->
</el-form-item>
......@@ -86,13 +86,19 @@
label="委员会选择"
name="first"
>
<committeeTable />
<committeeTable
v-on:childByValue="childByValue"
:invitedUserNames="dataForm.invitedUserNames"
/>
</el-tab-pane>
<el-tab-pane
label="市区级选择"
name="second"
>
<locationTable />
<locationTable
v-on:childByValue="childByValue"
:invitedUserNames="dataForm.invitedUserNames"
/>
</el-tab-pane>
</el-tabs>
......@@ -139,19 +145,28 @@ export default {
isShow: false,
activeName: "first",
people: ["111", "222"],
allPeople: "",
peoplelist: [],
dataForm: {
id: "",
name: "",
title: "",
content: "",
allPeople: "",
/* allPeople: "", */
invitedUserIDs: [],
invitedUserNames: [],
},
};
},
/* watch: {
invitedUserNames: function (newval, oldval) {
console.log("11", newval);
},
}, */
computed: {
dataRule() {
return {
name: [
title: [
{
required: true,
message: this.$t("validate.required"),
......@@ -165,41 +180,83 @@ export default {
trigger: "blur",
},
],
allPeople: [
/* allPeople: [
{
required: true,
message: this.$t("validate.required"),
trigger: "blur",
},
],
], */
};
},
},
created() {
this.init();
this.dataForm.allPeople = this.people.join(",");
},
methods: {
init() {
this.$nextTick(() => {
this.$refs["dataForm"].resetFields();
if (this.$route.query.id) {
// console.log("uuuuuuu", this.$route.query.id);
if (this.$route.query.id != undefined) {
this.dataForm.id = this.$route.query.id;
// console.log(this.dataForm.id);
if (this.dataForm.id) {
this.getInfo();
}
}
});
},
unique(arr) {
return Array.from(new Set(arr));
},
unique2(arr) {
const res = new Map();
return arr.filter((arr) => !res.has(arr.id) && res.set(arr.id, 1));
},
//确定选择人员
sub() {
this.$confirm("确定提交吗?")
.then((_) => {
this.isShow = false;
this.dataForm.invitedUserNames = this.peoplelist;
// console.log("pppp", this.peoplelist);
this.dataForm.invitedUserNames = this.unique2(
this.dataForm.invitedUserNames
);
/* console.log(
"this.dataForm.invitedUserNames",
this.dataForm.invitedUserNames
); */
})
.catch((_) => {});
},
childByValue: function (childValue) {
// childValue就是子组件传过来的值
if (childValue) {
//console.log("childValue", childValue);
/* childValue.forEach((ele) => {
this.peoplelist.push(ele);
this.dataForm.invitedUserIDs.push(ele.id);
// this.dataForm.invitedUserNames.push(ele.name);
}); */
this.peoplelist = childValue;
this.dataForm.invitedUserIDs = childValue.map((el) => el.id);
// this.dataForm.invitedUserIDs = childValue;
this.peoplelist = this.unique2(this.peoplelist);
this.dataForm.invitedUserIDs = this.unique(
this.dataForm.invitedUserIDs
);
}
/* this.dataForm.invitedUserNames = this.unique(
this.dataForm.invitedUserNames
); */
// this.allPeople = this.dataForm.invitedUserNames.join(",");
},
// 获取信息
getInfo() {
this.$http
......@@ -208,11 +265,17 @@ export default {
if (res.code !== 0) {
return this.$message.error(res.msg);
}
this.dataForm = {
...this.dataForm,
...res.data,
};
console.log(this.dataForm);
// console.log(this.dataForm);
// this.peoplelist=this.dataForm.
//this.allPeople = this.dataForm.invitedUserNames.join(",");
/* if (this.dataForm.invitedUserIDs == null) {
this.dataForm.invitedUserIDs = [];
} */
})
.catch(() => {});
},
......@@ -238,6 +301,9 @@ export default {
type: "success",
});
})
.then(() => {
this.$router.go(-1);
})
.catch(() => {});
})
.catch((_) => {});
......@@ -276,7 +342,7 @@ export default {
.catch((_) => {});
},
handleClick(tab, event) {
console.log(tab, event);
//console.log(tab, event);
},
//返回按钮事件
......
......@@ -7,7 +7,36 @@
<div class="title"><span class="substyle">会议内容 </span> </div>
<div class="meetingsContent">
<el-form>
<el-form-item label="">
<div
class="meeting"
style="width:100%;border:2px solid #ccc;border-radius:5px;margin-bottom:20px"
>
<el-form-item prop="title">
<el-input
v-model="dataform1.title"
style="font-size:22px;border:0"
disabled
placeholder="暂无标题"
></el-input>
</el-form-item>
<el-form-item
prop="content"
label=""
>
<el-input
type="textarea"
:rows="14"
resize="none"
v-model="dataform1.content"
disabled
:autosize="{ minRows: 6, maxRows: 14 }"
placeholder="暂无内容"
></el-input>
</el-form-item>
</div>
<!-- <el-form-item label="">
<el-input
type="textarea"
:autosize="{ minRows: 6, maxRows: 14 }"
......@@ -16,15 +45,13 @@
placeholder="暂无"
disabled
></el-input>
</el-form-item>
<el-form-item
required
label="发送人员:"
>
</el-form-item> -->
<el-form-item label="已发送人员:">
<el-input
disabled
type="textarea"
:rows="4"
resize="none"
class="sendpeople"
placeholder="暂无"
v-model="dataform1.people"
......@@ -83,43 +110,44 @@
width="50"
></el-table-column>
<el-table-column
prop="company"
prop="userInfo.company"
label="单位"
header-align="center"
align="center"
></el-table-column>
<el-table-column
prop="name"
prop="userInfo.name"
label="姓名"
header-align="center"
align="center"
></el-table-column>
<el-table-column
prop="email"
prop="userInfo.email"
label="邮箱"
header-align="center"
align="center"
></el-table-column>
<el-table-column
prop="mobile"
prop="userInfo.mobile"
label="手机号"
sortable="custom"
header-align="center"
align="center"
></el-table-column>
<el-table-column
prop="gender"
prop="userInfo.sex"
label="性别"
sortable="custom"
header-align="center"
align="center"
>
<template slot-scope="scope">
{{ $getDictLabel("gender", scope.row.gender) }}
<span v-if="scope.row.userInfo.sex==1"></span>
<span v-if="scope.row.userInfo.sex==2"></span>
</template>
</el-table-column>
<el-table-column
prop="position"
prop="userInfo.position"
label="职位"
header-align="center"
align="center"
......@@ -144,6 +172,16 @@
>
</el-pagination>
</div>
<div class="footer">
<el-button
style="border:1px solid #17B3A3;color:#17B3A3;width:100px;float:right;margin-top:20px"
@click="goback"
>
返回
</el-button>
</div>
</div>
</el-card>
......@@ -157,16 +195,17 @@ export default {
data() {
return {
mixinViewModuleOptions: {
getDataListURL: "/sys/user/page",
getDataListURL:
"/meeting/wlmeetingstaff/page?registrationState=1&meetingId=" +
this.$route.query.id,
getDataListIsPage: true,
deleteURL: "/sys/user",
deleteIsBatch: true,
exportURL: "/sys/user/export",
exportURL: "/meeting/wlmeetingstaff/export",
},
dataform1: {
meetingContent: "1111",
people:
"张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧,张网吧",
people: "",
},
dataForm: {
company: "",
......@@ -174,35 +213,38 @@ export default {
},
};
},
created() {
this.init();
},
methods: {
//返回按钮事件
goback() {
this.$router.go(-1);
},
init() {
console.log(this.$route.query.id);
this.dataForm.id = this.$route.query.id;
this.dataform1.id = this.$route.query.id;
this.$nextTick(() => {
this.$refs["dataForm"].resetFields();
if (this.dataForm.id) {
// this.$refs["dataForm"].resetFields();
if (this.dataform1.id) {
this.getInfo();
}
});
console.log("ppp", this.dataForm.sex);
console.log("pppo", typeof this.dataForm.sex);
},
// 获取信息
getInfo() {
this.$http
.get(`/meeting/meeting/${this.dataForm.id}`)
.get(`/meeting/meeting/${this.dataform1.id}`)
.then(({ data: res }) => {
if (res.code !== 0) {
return this.$message.error(res.msg);
}
this.dataForm = {
...this.dataForm,
this.dataform1 = {
...this.dataform1,
...res.data,
};
console.log("ppppppp", this.dataForm);
console.log("ppp", this.dataForm.sex);
this.dataForm.sex = this.dataForm.sex + "";
console.log("ppppppp", this.dataform1);
this.dataform1.people = this.dataform1.invitedUserNames.join(",");
})
.catch(() => {});
},
......@@ -211,9 +253,18 @@ export default {
</script>
<style lang="less" scoped>
/deep/.el-textarea__inner {
font-size: 22px;
.meeting {
/deep/.el-input__inner {
font-size: 22px !important;
border: 0;
}
/deep/.el-textarea__inner {
font-size: 16px;
border: 0;
padding: 0 0 0 30px;
}
}
/deep/.el-input.is-disabled .el-input__inner {
color: #000;
background: #fff;
......@@ -245,6 +296,9 @@ export default {
padding-left: 10px;
}
}
.footer {
width: 100%;
}
.other {
//background: #eee;
......
<template>
<el-dialog :visible.sync="visible" :title="!dataForm.id ? $t('add') : $t('update')" :close-on-click-modal="false" :close-on-press-escape="false">
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmitHandle()" label-width="120px">
<el-form-item prop="username" :label="$t('user.username')">
<el-input v-model="dataForm.username" :placeholder="$t('user.username')"></el-input>
<el-dialog
:visible.sync="visible"
:title="!dataForm.id ? $t('add') : $t('update')"
:close-on-click-modal="false"
:close-on-press-escape="false"
>
<el-form
:model="dataForm"
:rules="dataRule"
ref="dataForm"
@keyup.enter.native="dataFormSubmitHandle()"
label-width="120px"
>
<el-form-item
prop="username"
:label="$t('user.username')"
>
<el-input
v-model="dataForm.username"
:placeholder="$t('user.username')"
></el-input>
</el-form-item>
<el-form-item prop="deptName" :label="$t('user.deptName')">
<!-- <el-form-item prop="deptName" :label="$t('user.deptName')">
<ren-dept-tree v-model="dataForm.deptId" :placeholder="$t('dept.title')" :dept-name.sync="dataForm.deptName"></ren-dept-tree>
</el-form-item> -->
<el-form-item
prop="password"
:label="$t('user.password')"
:class="{ 'is-required': !dataForm.id }"
>
<el-input
v-model="dataForm.password"
type="password"
:placeholder="$t('user.password')"
></el-input>
</el-form-item>
<el-form-item prop="password" :label="$t('user.password')" :class="{ 'is-required': !dataForm.id }">
<el-input v-model="dataForm.password" type="password" :placeholder="$t('user.password')"></el-input>
<el-form-item
prop="confirmPassword"
:label="$t('user.confirmPassword')"
:class="{ 'is-required': !dataForm.id }"
>
<el-input
v-model="dataForm.confirmPassword"
type="password"
:placeholder="$t('user.confirmPassword')"
></el-input>
</el-form-item>
<el-form-item prop="confirmPassword" :label="$t('user.confirmPassword')" :class="{ 'is-required': !dataForm.id }">
<el-input v-model="dataForm.confirmPassword" type="password" :placeholder="$t('user.confirmPassword')"></el-input>
<el-form-item
prop="realName"
:label="$t('user.realName')"
>
<el-input
v-model="dataForm.realName"
:placeholder="$t('user.realName')"
></el-input>
</el-form-item>
<el-form-item prop="realName" :label="$t('user.realName')">
<el-input v-model="dataForm.realName" :placeholder="$t('user.realName')"></el-input>
<el-form-item
prop="gender"
:label="$t('user.gender')"
>
<ren-radio-group
v-model="dataForm.gender"
dict-type="gender"
></ren-radio-group>
</el-form-item>
<el-form-item prop="gender" :label="$t('user.gender')">
<ren-radio-group v-model="dataForm.gender" dict-type="gender"></ren-radio-group>
<el-form-item
prop="email"
:label="$t('user.email')"
>
<el-input
v-model="dataForm.email"
:placeholder="$t('user.email')"
></el-input>
</el-form-item>
<el-form-item prop="email" :label="$t('user.email')">
<el-input v-model="dataForm.email" :placeholder="$t('user.email')"></el-input>
<el-form-item
prop="mobile"
:label="$t('user.mobile')"
>
<el-input
v-model="dataForm.mobile"
:placeholder="$t('user.mobile')"
></el-input>
</el-form-item>
<el-form-item prop="mobile" :label="$t('user.mobile')">
<el-input v-model="dataForm.mobile" :placeholder="$t('user.mobile')"></el-input>
</el-form-item>
<el-form-item prop="roleIdList" :label="$t('user.roleIdList')" class="role-list">
<el-select v-model="dataForm.roleIdList" multiple :placeholder="$t('user.roleIdList')">
<el-option v-for="role in roleList" :key="role.id" :label="role.name" :value="role.id"></el-option>
<!-- <el-form-item
prop="roleIdList"
:label="$t('user.roleIdList')"
class="role-list"
>
<el-select
v-model="dataForm.roleIdList"
multiple
:placeholder="$t('user.roleIdList')"
>
<el-option
v-for="role in roleList"
:key="role.id"
:label="role.name"
:value="role.id"
></el-option>
</el-select>
</el-form-item>
<el-form-item prop="status" :label="$t('user.status')" size="mini">
</el-form-item> -->
<el-form-item
prop="status"
:label="$t('user.status')"
size="mini"
>
<el-radio-group v-model="dataForm.status">
<el-radio :label="0">{{ $t('user.status0') }}</el-radio>
<el-radio :label="1">{{ $t('user.status1') }}</el-radio>
......@@ -39,166 +113,244 @@
</el-form>
<template slot="footer">
<el-button @click="visible = false">{{ $t('cancel') }}</el-button>
<el-button type="primary" @click="dataFormSubmitHandle()">{{ $t('confirm') }}</el-button>
<el-button
type="primary"
@click="dataFormSubmitHandle()"
>{{ $t('confirm') }}</el-button>
</template>
</el-dialog>
</template>
<script>
import debounce from 'lodash/debounce'
import { isEmail, isMobile } from '@/utils/validate'
import debounce from "lodash/debounce";
import { isEmail, isMobile } from "@/utils/validate";
export default {
data () {
data() {
return {
visible: false,
roleList: [],
roleIdListDefault: [],
dataForm: {
id: '',
username: '',
deptId: '',
deptName: '',
password: '',
confirmPassword: '',
realName: '',
id: "",
username: "",
deptId: "",
deptName: "",
password: "",
confirmPassword: "",
realName: "",
gender: 0,
email: '',
mobile: '',
email: "",
mobile: "",
roleIdList: [],
status: 1
}
}
status: 1,
},
};
},
computed: {
dataRule () {
dataRule() {
var validatePassword = (rule, value, callback) => {
if (!this.dataForm.id && !/\S/.test(value)) {
return callback(new Error(this.$t('validate.required')))
}
callback()
return callback(new Error(this.$t("validate.required")));
}
callback();
};
var validateConfirmPassword = (rule, value, callback) => {
if (!this.dataForm.id && !/\S/.test(value)) {
return callback(new Error(this.$t('validate.required')))
return callback(new Error(this.$t("validate.required")));
}
if (this.dataForm.password !== value) {
return callback(new Error(this.$t('user.validate.confirmPassword')))
}
callback()
return callback(new Error(this.$t("user.validate.confirmPassword")));
}
callback();
};
var validateEmail = (rule, value, callback) => {
if (value && !isEmail(value)) {
return callback(new Error(this.$t('validate.format', { 'attr': this.$t('user.email') })))
}
callback()
return callback(
new Error(
this.$t("validate.format", { attr: this.$t("user.email") })
)
);
}
callback();
};
var validateMobile = (rule, value, callback) => {
if (value && !isMobile(value)) {
return callback(new Error(this.$t('validate.format', { 'attr': this.$t('user.mobile') })))
}
callback()
return callback(
new Error(
this.$t("validate.format", { attr: this.$t("user.mobile") })
)
);
}
callback();
};
return {
username: [
{ required: true, message: this.$t('validate.required'), trigger: 'blur' }
],
deptName: [
{ required: true, message: this.$t('validate.required'), trigger: 'change' }
],
password: [
{ validator: validatePassword, trigger: 'blur' }
{
required: true,
trigger: "blur",
validator: this.checkName,
},
],
/* deptName: [
{
required: true,
message: this.$t("validate.required"),
trigger: "change",
},
], */
password: [{ validator: validatePassword, trigger: "blur" }],
confirmPassword: [
{ validator: validateConfirmPassword, trigger: 'blur' }
{ validator: validateConfirmPassword, trigger: "blur" },
],
realName: [
{ required: true, message: this.$t('validate.required'), trigger: 'blur' }
],
email: [
{ validator: validateEmail, trigger: 'blur' }
{
required: true,
message: this.$t("validate.required"),
trigger: "blur",
},
],
mobile: [
{ validator: validateMobile, trigger: 'blur' }
]
email: [{ validator: validateEmail, trigger: "blur" }],
mobile: [{ validator: validateMobile, trigger: "blur" }],
};
},
},
methods: {
checkName(rule, value, callback) {
if (!value) {
return callback(new Error("请输入英文字符"));
} else if (value == null) {
return callback(new Error("请输入英文字符"));
} else {
const reg = /[a-zA-z]$/;
console.log(reg.test(value));
if (reg.test(value)) {
callback();
} else {
return callback(new Error("请输入英文字符"));
}
}
},
methods: {
init () {
this.visible = true
this.dataForm.deptId = ''
checkPhone(rule, value, callback) {
if (!value) {
return callback(new Error("请输入正确的手机号"));
} else if (value == null) {
return callback(new Error("手机号不能为空"));
} else {
const reg = /^((0\d{2,3}-\d{7,8})|(1[35789]\d{9}))$/;
console.log(reg.test(value));
if (reg.test(value)) {
callback();
} else {
return callback(new Error("请输入正确的手机号或座机号"));
}
}
},
checkEmail(rule, value, callback) {
if (!value) {
return callback(new Error("请输入正确的邮箱号"));
} else if (value == null) {
return callback(new Error("邮箱号不能为空"));
} else {
const reg = /^[a-zA-Z0-9]+([-_.][a-zA-Z0-9]+)*@[a-zA-Z0-9]+([-_.][a-zA-Z0-9]+)*\.[a-z]{2,}$/;
console.log(reg.test(value));
if (reg.test(value)) {
callback();
} else {
return callback(new Error("请输入正确的邮箱号"));
}
}
},
init() {
this.visible = true;
this.dataForm.deptId = "";
this.$nextTick(() => {
this.$refs['dataForm'].resetFields()
this.roleIdListDefault = []
Promise.all([
this.getRoleList()
]).then(() => {
this.$refs["dataForm"].resetFields();
this.roleIdListDefault = [];
Promise.all([this.getRoleList()]).then(() => {
if (this.dataForm.id) {
this.getInfo()
this.getInfo();
}
})
})
});
});
},
// 获取角色列表
getRoleList () {
return this.$http.get('/sys/role/list').then(({ data: res }) => {
getRoleList() {
return this.$http
.get("/sys/role/list")
.then(({ data: res }) => {
if (res.code !== 0) {
return this.$message.error(res.msg)
return this.$message.error(res.msg);
}
this.roleList = res.data
}).catch(() => {})
this.roleList = res.data;
})
.catch(() => {});
},
// 获取信息
getInfo () {
this.$http.get(`/sys/user/${this.dataForm.id}`).then(({ data: res }) => {
getInfo() {
this.$http
.get(`/sys/user/${this.dataForm.id}`)
.then(({ data: res }) => {
if (res.code !== 0) {
return this.$message.error(res.msg)
return this.$message.error(res.msg);
}
this.dataForm = {
...this.dataForm,
...res.data,
roleIdList: []
}
roleIdList: [],
};
// 角色配置, 区分是否为默认角色
for (var i = 0; i < res.data.roleIdList.length; i++) {
if (this.roleList.filter(item => item.id === res.data.roleIdList[i])[0]) {
this.dataForm.roleIdList.push(res.data.roleIdList[i])
continue
if (
this.roleList.filter(
(item) => item.id === res.data.roleIdList[i]
)[0]
) {
this.dataForm.roleIdList.push(res.data.roleIdList[i]);
continue;
}
this.roleIdListDefault.push(res.data.roleIdList[i])
this.roleIdListDefault.push(res.data.roleIdList[i]);
}
}).catch(() => {})
})
.catch(() => {});
},
// 表单提交
dataFormSubmitHandle: debounce(function () {
this.$refs['dataForm'].validate((valid) => {
dataFormSubmitHandle: debounce(
function () {
this.$refs["dataForm"].validate((valid) => {
if (!valid) {
return false
return false;
}
this.$http[!this.dataForm.id ? 'post' : 'put']('/sys/user', {
this.$http[!this.dataForm.id ? "post" : "put"]("/sys/user", {
...this.dataForm,
roleIdList: [
...this.dataForm.roleIdList,
...this.roleIdListDefault
]
}).then(({ data: res }) => {
...this.roleIdListDefault,
],
})
.then(({ data: res }) => {
if (res.code !== 0) {
return this.$message.error(res.msg)
return this.$message.error(res.msg);
}
this.$message({
message: this.$t('prompt.success'),
type: 'success',
message: this.$t("prompt.success"),
type: "success",
duration: 500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
}).catch(() => {})
this.visible = false;
this.$emit("refreshDataList");
},
});
})
}, 1000, { 'leading': true, 'trailing': false })
}
}
.catch(() => {});
});
},
1000,
{ leading: true, trailing: false }
),
},
};
</script>
<style lang="scss">
......
......@@ -26,10 +26,11 @@
<el-form-item>
<el-form-item>
<el-cascader
v-model="dataForm.location"
v-model="dataForm.area"
placeholder="请选择所属市区级"
:options="optionsOfLocation"
:props="{ checkStrictly: true }"
@change="changearea"
:props="props"
clearable
></el-cascader>
</el-form-item>
......@@ -195,8 +196,14 @@ export default {
deleteIsBatch: true,
exportURL: "/sys/user/export",
},
props: {
checkStrictly: true,
value: "id",
label: "name",
children: "children",
},
optionsOfLocation: [
{
/* {
value: "ningbo",
label: "宁波",
children: [
......@@ -217,15 +224,50 @@ export default {
label: "镇海区",
},
],
},
}, */
],
dataForm: {
username: "",
deptId: "",
area: "",
gender: "",
},
};
},
methods: {
getInfo() {
this.$http
.get("/area/area/list")
.then(({ data: res }) => {
if (res.code !== 0) {
return this.$message.error(res.msg);
}
this.optionsOfLocation = this.getTreeData(res.data);
console.log(res.data);
})
.catch(() => {});
},
changearea(value) {
console.log(value);
this.dataForm.area = value[value.length - 1];
},
getTreeData(data) {
// 循环遍历json数据
for (var i = 0; i < data.length; i++) {
if (data[i].children.length < 1) {
// children若为空数组,则将children设为undefined
data[i].children = undefined;
} else {
// children若不为空数组,则继续 递归调用 本方法
this.getTreeData(data[i].children);
}
}
return data;
},
},
created() {
this.getInfo();
},
components: {
AddOrUpdate,
},
......
......@@ -29,21 +29,23 @@
v-model="dataForm.area"
placeholder="请选择所属市区级"
:options="optionsOfLocation"
:props="{ checkStrictly: true }"
@change="changearea"
:props="props"
clearable
></el-cascader>
</el-form-item>
<el-form-item>
<el-select
@change="changename"
v-model="dataForm.committee"
placeholder="请选择所属委员会"
clearable
>
<el-option
v-for="item in optionsOfCommittee"
:key="item.value"
:label="item.label"
:value="item.value"
:key="item.id"
:label="item.name"
:value="item.id"
>
</el-option>
</el-select>
......@@ -191,12 +193,18 @@ export default {
data() {
return {
mixinViewModuleOptions: {
getDataListURL: "/user/user/page",
getDataListURL: "/user/user/page?check=1",
getDataListIsPage: true,
exportURL: "/user/user/export",
deleteURL: "/user/user",
deleteIsBatch: true,
},
props: {
checkStrictly: true,
value: "id",
label: "name",
children: "children",
},
dataForm: {
company: "",
name: "",
......@@ -204,7 +212,7 @@ export default {
committee: "",
},
optionsOfLocation: [
{
/* {
value: "ningbo",
label: "宁波",
children: [
......@@ -225,10 +233,10 @@ export default {
label: "镇海区",
},
],
},
}, */
],
optionsOfCommittee: [
{
/* {
value: "网络安全协会",
label: "网络安全协会",
},
......@@ -247,11 +255,61 @@ export default {
{
value: "网络安全协会4",
label: "网络安全协会4",
},
}, */
],
};
},
created() {
this.getInfo();
},
methods: {
getInfo() {
this.$http
.get("/committee/committee/list")
.then(({ data: res }) => {
if (res.code !== 0) {
return this.$message.error(res.msg);
}
this.optionsOfCommittee = res.data;
})
.catch(() => {});
this.$http
.get("/area/area/list")
.then(({ data: res }) => {
if (res.code !== 0) {
return this.$message.error(res.msg);
}
this.optionsOfLocation = this.getTreeData(res.data);
})
.catch(() => {});
},
getTreeData(data) {
// 循环遍历json数据
for (var i = 0; i < data.length; i++) {
if (data[i].children.length < 1) {
// children若为空数组,则将children设为undefined
data[i].children = undefined;
} else {
// children若不为空数组,则继续 递归调用 本方法
this.getTreeData(data[i].children);
}
}
return data;
},
changename(value) {
/* this.optionsOfCommittee.forEach((ele) => {
if (value == ele.id) {
this.dataForm.committeeName = ele.name;
}
}); */
this.dataForm.committee = value;
},
changearea(value) {
console.log(value);
this.dataForm.area = value[value.length - 1];
},
taozhuan(id) {
this.$router.push({
path: "/memberManageExamine",
......
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