dev
yujialong 3 years ago
parent 5f306c9ffd
commit e77d966beb
  1. 7
      src/views/Login.vue
  2. 85
      src/views/data/Product.vue
  3. 127
      src/views/user/AddUser.vue

@ -119,12 +119,13 @@ export default {
// //
param: { param: {
account: 'admin', account: '',
password: '111aaa', password: '',
code:'', code:'',
platform:3, platform:3,
random:'', random:'',
distinguish:1 distinguish:1,
type: 2
}, },
rules: { rules: {
account: [{ required: true, message: '请输入账号', trigger: 'blur' }], account: [{ required: true, message: '请输入账号', trigger: 'blur' }],

@ -83,7 +83,7 @@
<el-form-item label="已选数据"> <el-form-item label="已选数据">
<el-button type="primary" @click="configData">配置数据权限</el-button> <el-button type="primary" @click="configData">配置数据权限</el-button>
<div class="type-wrap" ref="typeWrap" @scroll="loadType"> <div class="type-wrap" ref="typeWrap" @scroll="loadType">
<el-tree ref="type" :data="typeList" accordion node-key="id" :props="defaultProps" @node-expand="typeExpand"> <el-tree ref="type" :data="typeList" show-checkbox accordion node-key="id" :default-expanded-keys="checkedIds" :default-checked-keys="checkedIds" :props="defaultProps" @node-expand="typeExpand">
<span class="custom-tree-node" slot-scope="{ node, data }"> <span class="custom-tree-node" slot-scope="{ node, data }">
<span :title="node.label">{{ node.label }}</span> <span :title="node.label">{{ node.label }}</span>
</span> </span>
@ -93,7 +93,7 @@
</el-form> </el-form>
<span slot="footer" class="dialog-footer" v-if="!isDetail"> <span slot="footer" class="dialog-footer" v-if="!isDetail">
<el-button @click="productVisible = false"> </el-button> <el-button @click="productVisible = false"> </el-button>
<el-button type="primary" :loading="loading" @click="confirm"> </el-button> <el-button type="primary" :loading="submited" @click="confirm"> </el-button>
</span> </span>
</el-dialog> </el-dialog>
@ -211,7 +211,7 @@ export default {
previewVisible: false, previewVisible: false,
previewHead: [], previewHead: [],
previewData: [], previewData: [],
loading: false submited: false,
}; };
}, },
watch: { watch: {
@ -307,6 +307,7 @@ export default {
getTable(res) getTable(res)
setTimeout(() => { setTimeout(() => {
console.log(11, res)
this.typeList = res this.typeList = res
},500) },500)
this.importVisible = true this.importVisible = true
@ -376,17 +377,20 @@ export default {
}, },
getDetail(){ getDetail(){
this.$post(`${this.api.findById}?id=${this.id}`).then(res => { this.$post(`${this.api.findById}?id=${this.id}`).then(res => {
this.productVisible = true
let data = res.product let data = res.product
this.productName = data.productName this.productName = data.productName
this.market = data.market this.market = data.market
this.checkedIds = this.handleType(data.tableId.split(','),this.typeList)
this.$refs.type.setCheckedNodes(this.checkedIds)
}).catch(res => {}) }).catch(res => {})
}, },
add(){ add(){
this.productVisible = true this.getType()
this.id = '' this.id = ''
this.checkedIds = []
}, },
edit(row){ edit(row){
this.getType()
this.id = row.id this.id = row.id
this.userId = row.userId this.userId = row.userId
this.getDetail() this.getDetail()
@ -410,7 +414,7 @@ export default {
}, },
preview(row){ preview(row){
this.isDetail = true this.isDetail = true
// this.getType() this.getType()
this.id = row.id this.id = row.id
this.getDetail() this.getDetail()
}, },
@ -455,34 +459,46 @@ export default {
this.typeIndex = 100000 this.typeIndex = 100000
this.typeList = [] this.typeList = []
this.tableId = [] this.tableId = []
this.configIds = []
}, },
// tableId, // tableId,
getIds(){ getIds(){
// //
let list = this.configIds let list = this.$refs.type.getCheckedNodes()
let len = list.length
return new Promise((resolve,reject) => { 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) => { list.map((n,i) => {
this.$post(`${this.api.getIdQueryTable}?categoryId=${n}&showName=&pageNum=1&pageSize=10000&updateTime=`).then(res => { if(n.tableLen && n.tableLen > n.children.length){
res.pageList.records.map(n => { // pageSize10000,,
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)) this.tableId.push(String(n.id))
}) })
// 1,-1 // 1,-1
len-- getLen--
// 0,resolve // 0,resolve
if(!len) resolve() if(!getLen) resolve()
}).catch(res => {}) }).catch(res => {})
}else if(n.name && !this.tableId.includes(n.id)){ // ,,
this.tableId.push(n.id)
if(!getLen) resolve()
}
}) })
}) })
}, },
confirm(){ confirm(){
if(this.loading) return false if(this.submited) return false
if(!this.productName) return this.$message.warning('请输入数据产品名称') if(!this.productName) return this.$message.warning('请输入数据产品名称')
if(!this.market) return this.$message.warning('请输入市场价格') if(!this.market) return this.$message.warning('请输入市场价格')
if(isNaN(this.market)) return this.$message.warning('市场价格请输入数字') if(isNaN(this.market)) return this.$message.warning('市场价格请输入数字')
if(!this.configIds.length) return this.$message.warning('请选择数据') if(!this.$refs.type.getCheckedNodes().length) return this.$message.warning('请选择数据')
this.loading = true
this.submited = true
this.getIds().then(() => { this.getIds().then(() => {
let tableId = Array.from(new Set(this.tableId)) let tableId = Array.from(new Set(this.tableId))
if(!tableId.length) return this.$message.warning('请选择数据') if(!tableId.length) return this.$message.warning('请选择数据')
@ -499,24 +515,23 @@ export default {
tableNum: tableId.length, tableNum: tableId.length,
updateTime: '', updateTime: '',
} }
this.$refs.typeConfig.setCheckedNodes([])
if(this.id){ if(this.id){
this.$post(this.api.updateProduct,data).then(res => { this.$post(this.api.updateProduct,data).then(res => {
this.$message.success('新增成功') this.$message.success('新增成功')
this.productVisible = false this.productVisible = false
this.getData() this.getData()
this.loading = false this.submited = false
}).catch(res => { }).catch(res => {
this.loading = false this.submited = false
}) })
}else{ }else{
this.$post(this.api.saveProduct,data).then(res => { this.$post(this.api.saveProduct,data).then(res => {
this.$message.success('新增成功') this.$message.success('新增成功')
this.productVisible = false this.productVisible = false
this.getData() this.getData()
this.loading = false this.submited = false
}).catch(res => { }).catch(res => {
this.loading = false this.submited = false
}) })
} }
}) })
@ -525,6 +540,13 @@ export default {
configData(){ configData(){
this.configVisible = true this.configVisible = true
this.getConfigType() 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){ typeConfigClick(data,node){
this.categoryId = data.id this.categoryId = data.id
@ -610,24 +632,11 @@ export default {
}) })
}, },
confirmConfig(){ confirmConfig(){
this.configIds = this.$refs.typeConfig.getCheckedKeys() this.configChecked = this.$refs.typeConfig.getCheckedKeys().map(n => Number(n))
const list = this.$refs.typeConfig.getCheckedNodes() this.getTableId(this.typeList)
function uniqData(e, i) { this.checkedIds = Array.from(new Set(this.configCheckedTableId))
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.configVisible = false this.configVisible = false
this.$refs.type.setCheckedNodes(this.checkedIds)
} }
} }
}; };

@ -12,19 +12,17 @@
</div> </div>
</el-card> </el-card>
<!-- 用户信息 --> <!-- 个人信息 -->
<el-card shadow="hover" class="mgb20"> <el-card shadow="hover" class="mgb20">
<div> <div>
<div class="flex-between mgb20 user_header"> <div class="flex-between mgb20 user_header">
<div class="flex-center mgb20 user_header"> <div class="flex-center">
<p class="addhr_tag"></p> <p class="addhr_tag"></p>
<span>用户信息</span> <span>个人信息</span>
</div> </div>
</div> </div>
<div> <div>
<div>
<p class="font_same">个人信息</p>
<el-form <el-form
ref="form" ref="form"
:model="form" :model="form"
@ -114,9 +112,9 @@
></el-input> ></el-input>
</el-form-item> </el-form-item>
<el-form-item prop="IDNumber" label="证件号码"> <el-form-item prop="idNumber" label="证件号码">
<el-input <el-input
v-model="form.IDNumber" v-model="form.idNumber"
placeholder="请输入证件号码" placeholder="请输入证件号码"
maxlength="18" maxlength="18"
></el-input> ></el-input>
@ -165,9 +163,20 @@
</el-col> </el-col>
</el-form> </el-form>
</div> </div>
</div>
</el-card>
<!-- 账号信息 -->
<el-card shadow="hover" class="mgb20">
<div>
<div class="flex-between mgb20 user_header">
<div class="flex-center">
<p class="addhr_tag"></p>
<span>账号信息</span>
</div>
</div>
<div class="mgb20_top"> <div>
<p class="font_same">账号信息</p>
<el-form <el-form
ref="form" ref="form"
:model="form" :model="form"
@ -195,7 +204,6 @@
</el-form> </el-form>
</div> </div>
</div> </div>
</div>
</el-card> </el-card>
<!-- 个人档案 --> <!-- 个人档案 -->
@ -229,7 +237,7 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="院校"> <el-form-item label="院校">
<el-select v-model="item.schoolId" filterable clearable placeholder="请选择院校" @change="schoolitemChange"> <el-select v-model="item.schoolId" filterable clearable placeholder="请选择院校" @change="id => getSchoolName(id,index)">
<el-option v-for="(item,index) in schoolList" :key="index" :label="item.schoolName" :value="item.schoolId"></el-option> <el-option v-for="(item,index) in schoolList" :key="index" :label="item.schoolName" :value="item.schoolId"></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
@ -441,7 +449,7 @@ export default {
userName: '', // userName: '', //
uniqueIdentification: '', // uniqueIdentification: '', //
documentType: 1, // documentType: 1, //
IDNumber: '', // idNumber: '', //
cityId: '', // cityId: '', //
countries: '中国', // countries: '中国', //
provinceId: '', // provinceId: '', //
@ -489,7 +497,7 @@ export default {
trigger: 'blur' trigger: 'blur'
} }
], ],
IDNumber: [ idNumber: [
// { required: true, message: '', trigger: 'blur' }, // { 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]$)/, 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() { mounted() {
this.getSchoolData()
if(this.userId){ if(this.userId){
this.getdata();
}
this.getSchoolData();
this.getSubject();
},
methods: {
getdata() {
this.$get(this.api.queryUserInfoDetails,{ userId: this.userId }).then(res => { this.$get(this.api.queryUserInfoDetails,{ userId: this.userId }).then(res => {
let userInfo = res.result.hrUserInfo let userInfo = res.result.hrUserInfo
let personalFileList = res.result.personalFileList let schoolId = userInfo.schoolId
let platformList = res.result.platformList this.form = Object.assign(userInfo,res.result.userAccountList[0])
let userAccount = res.result.userAccountList this.form.schoolId = schoolId
this.form.accountId = userInfo.id
this.form.userName = userInfo.userName this.originAccount = this.form.account
this.form.uniqueIdentification = userInfo.uniqueIdentification this.archivesList = res.result.personalFileList
this.form.IDNumber = userInfo.iDNumber
this.form.cityId = userInfo.cityId this.$nextTick(() => {
this.form.provinceId = userInfo.provinceId if(this.form.provinceId){
this.form.dateBirth = userInfo.dateBirth this.getCityData(1)
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(this.archivesList.length != 0){
if(personalFileList.length != 0){ this.archivesList.forEach((e,k) =>{
personalFileList.map(e =>{
this.$set(e, 'subjectList', this.subjectList); 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){ if(e.disciplineId){
this.$get(this.api.queryCourseProfessionalClass, { disciplineId: e.disciplineId }).then(res => { this.$get(this.api.queryCourseProfessionalClass, { disciplineId: e.disciplineId }).then(res => {
this.$set(e, 'ProfessionalClassList', res.list); this.$set(e, 'ProfessionalClassList', res.list);
}).catch(res => {}); }).catch(res => {});
}else{
this.$set(e, 'ProfessionalClassList', []);
} }
if(e.professionalClassId){ if(e.professionalClassId){
this.$get(this.api.queryCourseProfessional,{ professionalClassId: e.professionalClassId }).then(res => { this.$get(this.api.queryCourseProfessional,{ professionalClassId: e.professionalClassId }).then(res => {
this.$set(e, 'ProfessionalList', res.list); this.$set(e, 'ProfessionalList', res.list);
}).catch(res => {}); }).catch(res => {});
}else{
this.$set(e, 'ProfessionalList', []);
} }
}) })
}else{
this.concatArch(1)
} }
this.archivesList = personalFileList });
// //
let platformList = res.result.platformList
platformList.map(e =>{ platformList.map(e =>{
this.regionOption.map((r,index) =>{ this.regionOption.map((r,index) =>{
if(r.regionId == e.platformId){ if(r.regionId == e.platformId){
@ -645,9 +667,25 @@ export default {
}) })
this.platformList = platformList this.platformList = platformList
}).catch((res) => {}) }).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(){ getCity(){
if(this.form.provinceId){ if(this.form.provinceId){
this.getCityData() this.getCityData()
@ -658,19 +696,8 @@ export default {
this.cityList = res.list this.cityList = res.list
}).catch(res => {}); }).catch(res => {});
}, },
// getSchoolName(id,index){
schoolitemChange(item){ this.archivesList[index].schoolName = this.schoolList[id-1].schoolName
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
}
})
}
}, },
// //
getSchoolData(){ getSchoolData(){

Loading…
Cancel
Save