diff --git a/src/views/Login.vue b/src/views/Login.vue index 63015a6..bc75ac1 100644 --- a/src/views/Login.vue +++ b/src/views/Login.vue @@ -119,12 +119,13 @@ export default { // 账号 param: { - account: 'admin', - password: '111aaa', + account: '', + password: '', code:'', platform:3, random:'', - distinguish:1 + distinguish:1, + type: 2 }, rules: { account: [{ required: true, message: '请输入账号', trigger: 'blur' }], diff --git a/src/views/data/Product.vue b/src/views/data/Product.vue index 8f58281..58f0dc2 100644 --- a/src/views/data/Product.vue +++ b/src/views/data/Product.vue @@ -83,7 +83,7 @@ 配置数据权限
- + {{ node.label }} @@ -93,7 +93,7 @@ 取 消 - 确 定 + 确 定 @@ -211,7 +211,7 @@ export default { previewVisible: false, previewHead: [], previewData: [], - loading: false + submited: false, }; }, watch: { @@ -307,6 +307,7 @@ export default { getTable(res) setTimeout(() => { + console.log(11, res) this.typeList = res },500) this.importVisible = true @@ -376,17 +377,20 @@ export default { }, getDetail(){ this.$post(`${this.api.findById}?id=${this.id}`).then(res => { - this.productVisible = true let data = res.product this.productName = data.productName this.market = data.market + this.checkedIds = this.handleType(data.tableId.split(','),this.typeList) + this.$refs.type.setCheckedNodes(this.checkedIds) }).catch(res => {}) }, add(){ - this.productVisible = true + this.getType() this.id = '' + this.checkedIds = [] }, edit(row){ + this.getType() this.id = row.id this.userId = row.userId this.getDetail() @@ -410,7 +414,7 @@ export default { }, preview(row){ this.isDetail = true - // this.getType() + this.getType() this.id = row.id this.getDetail() }, @@ -455,34 +459,46 @@ export default { this.typeIndex = 100000 this.typeList = [] this.tableId = [] - this.configIds = [] }, // 获取tableId,提交的时候需要 getIds(){ // 获取已经勾选的分类 - let list = this.configIds - let len = list.length + let list = this.$refs.type.getCheckedNodes() return new Promise((resolve,reject) => { + let getLen = 0 + list.map(n => { + // 如果tableLen大于子级的数量,则表示这个分类下的子级是没有全部加载出来的,要在下面去查询出来,这里先记载要查询的分类数量 + if(n.tableLen && n.tableLen > n.children.length) getLen++ + }) list.map((n,i) => { - this.$post(`${this.api.getIdQueryTable}?categoryId=${n}&showName=&pageNum=1&pageSize=10000&updateTime=`).then(res => { - res.pageList.records.map(n => { - this.tableId.push(String(n.id)) - }) - // 查询完1个,则数量-1 - len-- - // 清0后,才执行resolve - if(!len) resolve() - }).catch(res => {}) + if(n.tableLen && n.tableLen > n.children.length){ + // pageSize传10000是要查询全部表,后续如果数据多了,则按需调整 + this.$post(`${this.api.getIdQueryTable}?categoryId=${n.originId}&showName=&pageNum=1&pageSize=10000&updateTime=`).then(res => { + let tableList = res.pageList.records + tableList.map(n => { + this.tableId.push(String(n.id)) + }) + // 查询完1个,则数量-1 + getLen-- + // 清0后,才执行resolve + if(!getLen) resolve() + }).catch(res => {}) + }else if(n.name && !this.tableId.includes(n.id)){ // 如果是表,并且没重复,则添加进去 + this.tableId.push(n.id) + if(!getLen) resolve() + } }) }) }, confirm(){ - if(this.loading) return false + if(this.submited) return false if(!this.productName) return this.$message.warning('请输入数据产品名称') if(!this.market) return this.$message.warning('请输入市场价格') if(isNaN(this.market)) return this.$message.warning('市场价格请输入数字') - if(!this.configIds.length) return this.$message.warning('请选择数据') - this.loading = true + if(!this.$refs.type.getCheckedNodes().length) return this.$message.warning('请选择数据') + + this.submited = true + this.getIds().then(() => { let tableId = Array.from(new Set(this.tableId)) if(!tableId.length) return this.$message.warning('请选择数据') @@ -499,24 +515,23 @@ export default { tableNum: tableId.length, updateTime: '', } - this.$refs.typeConfig.setCheckedNodes([]) if(this.id){ this.$post(this.api.updateProduct,data).then(res => { this.$message.success('新增成功') this.productVisible = false this.getData() - this.loading = false + this.submited = false }).catch(res => { - this.loading = false + this.submited = false }) }else{ this.$post(this.api.saveProduct,data).then(res => { this.$message.success('新增成功') this.productVisible = false this.getData() - this.loading = false + this.submited = false }).catch(res => { - this.loading = false + this.submited = false }) } }) @@ -525,6 +540,13 @@ export default { configData(){ this.configVisible = true this.getConfigType() + + let list = this.$refs.type.getCheckedNodes() + let configIds = [] + list.map(n => { + if(!n.name) configIds.push(n.originId) + }) + this.configIds = configIds }, typeConfigClick(data,node){ this.categoryId = data.id @@ -610,24 +632,11 @@ export default { }) }, confirmConfig(){ - this.configIds = this.$refs.typeConfig.getCheckedKeys() - const list = this.$refs.typeConfig.getCheckedNodes() - function uniqData(e, i) { - e.children.map(n => { - const index = list.findIndex(e => e.id === n.id) - if (index) { - list.splice(index, 1) - } - if (n.children && n.children.length) { - uniqData(n, i) - } - }) - } - list.map((e, i) => { - uniqData(e, i) - }) - this.typeList = list + this.configChecked = this.$refs.typeConfig.getCheckedKeys().map(n => Number(n)) + this.getTableId(this.typeList) + this.checkedIds = Array.from(new Set(this.configCheckedTableId)) this.configVisible = false + this.$refs.type.setCheckedNodes(this.checkedIds) } } }; diff --git a/src/views/user/AddUser.vue b/src/views/user/AddUser.vue index 60ad6a1..d0ce199 100644 --- a/src/views/user/AddUser.vue +++ b/src/views/user/AddUser.vue @@ -12,188 +12,196 @@
- +
-
+

- 用户信息 + 个人信息
-
-

个人信息

- - - - - + + + + + - - - - - + + + + + - - - - - + + + + + - - - - - + + + + + - - - - - + + + + + - - - - - - + + + + + + - - - - + + + + - - - + + + - - - - - + + + + + - - - + + + - - - - + + + + + + + +
+
+ + + + +
+
+
+

+ 账号信息 +
+
+ +
+ + + + + - -
-
-

账号信息

- - - - - - - - - - - - - + + + + - -
+ +
@@ -229,7 +237,7 @@ - + @@ -441,7 +449,7 @@ export default { userName: '', //用户姓名 uniqueIdentification: '', //唯一识别码 documentType: 1, //证件类型 - IDNumber: '', //证件号码 + idNumber: '', //证件号码 cityId: '', //省份 countries: '中国', //国家 provinceId: '', //城市 @@ -489,7 +497,7 @@ export default { trigger: 'blur' } ], - IDNumber: [ + idNumber: [ // { required: true, message: '请输入证件号码', trigger: 'blur' }, { pattern: /(^[1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$)/, @@ -595,47 +603,61 @@ export default { }; }, mounted() { - this.getSchoolData() if(this.userId){ + this.getdata(); + } + this.getSchoolData(); + this.getSubject(); + }, + methods: { + getdata() { this.$get(this.api.queryUserInfoDetails,{ userId: this.userId }).then(res => { let userInfo = res.result.hrUserInfo - let personalFileList = res.result.personalFileList - let platformList = res.result.platformList - let userAccount = res.result.userAccountList - - this.form.userName = userInfo.userName - this.form.uniqueIdentification = userInfo.uniqueIdentification - this.form.IDNumber = userInfo.iDNumber - this.form.cityId = userInfo.cityId - this.form.provinceId = userInfo.provinceId - this.form.dateBirth = userInfo.dateBirth - this.form.educationDegree = userInfo.educationDegree - this.form.sex = userInfo.sex - this.form.schoolId = userInfo.schoolId - this.form.phone = userInfo.phone - this.form.WeChatID = userAccount[0].wechatId - if(userInfo.provinceId){ - this.getCityData() - } - // 个人档案 - if(personalFileList.length != 0){ - personalFileList.map(e =>{ - this.$set(e, 'subjectList', this.subjectList); - if(e.disciplineId){ - this.$get(this.api.queryCourseProfessionalClass, { disciplineId: e.disciplineId }).then(res => { - this.$set(e, 'ProfessionalClassList', res.list); - }).catch(res => {}); - } - if(e.professionalClassId){ - this.$get(this.api.queryCourseProfessional,{ professionalClassId: e.professionalClassId }).then(res => { - this.$set(e, 'ProfessionalList', res.list); - }).catch(res => {}); - } - }) - } - this.archivesList = personalFileList + let schoolId = userInfo.schoolId + this.form = Object.assign(userInfo,res.result.userAccountList[0]) + this.form.schoolId = schoolId + this.form.accountId = userInfo.id + this.originAccount = this.form.account + this.archivesList = res.result.personalFileList + + this.$nextTick(() => { + if(this.form.provinceId){ + this.getCityData(1) + } + if(this.archivesList.length != 0){ + this.archivesList.forEach((e,k) =>{ + this.$set(e, 'subjectList', this.subjectList); + this.$set(e, 'disciplineId', e.disciplineId ? e.disciplineId : ''); + this.$set(e, 'disciplineName', e.disciplineName ? e.disciplineName : ''); + this.$set(e, 'professionalClassId', e.professionalClassId ? e.professionalClassId : ''); + this.$set(e, 'professionalClassName', e.professionalClassName ? e.professionalClassName : ''); + this.$set(e, 'professionalId', e.professionalId ? e.professionalId : ''); + this.$set(e, 'professionalName', e.professionalName ? e.professionalName : ''); + this.$set(e, 'schoolId', e.schoolId ? e.schoolId : ''); + this.$set(e, 'schoolName', e.schoolName ? e.schoolName : ''); + + if(e.disciplineId){ + this.$get(this.api.queryCourseProfessionalClass, { disciplineId: e.disciplineId }).then(res => { + this.$set(e, 'ProfessionalClassList', res.list); + }).catch(res => {}); + }else{ + this.$set(e, 'ProfessionalClassList', []); + } + if(e.professionalClassId){ + this.$get(this.api.queryCourseProfessional,{ professionalClassId: e.professionalClassId }).then(res => { + this.$set(e, 'ProfessionalList', res.list); + }).catch(res => {}); + }else{ + this.$set(e, 'ProfessionalList', []); + } + }) + }else{ + this.concatArch(1) + } + }); // 平台系统 + let platformList = res.result.platformList platformList.map(e =>{ this.regionOption.map((r,index) =>{ if(r.regionId == e.platformId){ @@ -645,9 +667,25 @@ export default { }) this.platformList = platformList }).catch((res) => {}) - } - }, - methods: { + }, + concatArch() { + this.archivesList = this.archivesList.concat({ + isNew: true, + personalCareerId: '', + schoolId: '', + schoolName: '', + subjectList: this.subjectList, + disciplineId: '', + disciplineName: '', + ProfessionalClassList: [], + professionalClassId: '', + professionalClassName: '', + ProfessionalList: [], + professionalId: '', + professionalName: '', + personalFileId: '' + }) + }, getCity(){ if(this.form.provinceId){ this.getCityData() @@ -658,19 +696,8 @@ export default { this.cityList = res.list }).catch(res => {}); }, - // 获取列表学校名称 - schoolitemChange(item){ - if(item){ - this.archivesList.map(e =>{ - if(e.schoolId == item){ - let obj = {}; - obj = this.schoolList.find(r =>{ - return r.schoolId === item; - }); - e.schoolName = obj.schoolName - } - }) - } + getSchoolName(id,index){ + this.archivesList[index].schoolName = this.schoolList[id-1].schoolName }, // 获取学校名称 getSchoolData(){