Browse Source

调整动力主轴下拉菜单样式

shibei_master
YUJT 3 years ago
parent
commit
0872beb612
  1. 122
      src/views/modules/plugins/power/poweraxis-add-or-update.vue
  2. 5
      src/views/modules/plugins/power/poweraxis.vue

122
src/views/modules/plugins/power/poweraxis-add-or-update.vue

@ -20,35 +20,23 @@
<el-input v-model="dataForm.name" placeholder="请输入名称" style="width:250px"></el-input> <el-input v-model="dataForm.name" placeholder="请输入名称" style="width:250px"></el-input>
</el-form-item> </el-form-item>
<!-- 下拉框组织的参数 --> <!-- 下拉框组织的参数 -->
<el-form-item prop="orgId" label="所属组织" v-if="orgListSwitch"> <el-form-item prop="agencyId" label="所属组织" v-if="orgListSwitch">
<el-cascader <el-cascader
v-model="dataForm.orgId" v-model="dataForm.agencyId"
:options="agencytree" :options="agencytree"
placeholder="请选择所属组织" placeholder="请选择所属组织"
:props="{ expandTrigger: 'hover', label: 'orgName', value: 'orgId', children: 'subOrgList' }" :props="{ expandTrigger: 'hover', emitPath: false, label: 'orgName', value: 'orgId', children: 'subOrgList' }"
></el-cascader> :show-all-levels="false"
clearable />
</el-form-item> </el-form-item>
<!-- 网格党支部下拉框 --> <el-form-item prop="pid" label="所属上级" v-if="!orgListSwitch">
<el-form-item prop="pid" label="所属上级" v-if="GridPartyBranchSwitch"> <el-cascader
<el-select v-model="dataForm.pid" placeholder="请选择所属上级"> placeholder="请选择所属上级"
<el-option :options="parentStructTree"
v-for="item in GridPartyBranchList" v-model="dataForm.pid"
:key="item.id" :props="{ expandTrigger: 'hover', emitPath: false, label: 'name', value: 'id', children: 'children' }"
:label="item.name" :show-all-levels="false"
:value="item.id"> clearable />
</el-option>
</el-select>
</el-form-item>
<!-- 党委下拉框 -->
<el-form-item prop="pid" label="所属上级" v-if="partyCommSwitch">
<el-select v-model="dataForm.pid" placeholder="请选择所属上级">
<el-option
v-for="item in PartyCommList"
:key="item.id"
:label="item.name"
:value="item.id">
</el-option>
</el-select>
</el-form-item> </el-form-item>
<el-form-item label="排序"> <el-form-item label="排序">
<el-input-number v-model="dataForm.sort" :min="0" :max="10" label="请输入排序"></el-input-number> <el-input-number v-model="dataForm.sort" :min="0" :max="10" label="请输入排序"></el-input-number>
@ -120,7 +108,6 @@ export default {
name:'', name:'',
agencyId:'', agencyId:'',
agencyName:'', agencyName:'',
orgId: '',
agencyType:'', agencyType:'',
pid:'', pid:'',
categoryCode:'', categoryCode:'',
@ -132,11 +119,8 @@ export default {
structCategoryArr: [], // structCategoryArr: [], //
leaderCategoryArr: [], // leaderCategoryArr: [], //
agencytree: [], // agencytree: [], //
GridPartyBranchList:[], // parentStructTree: [], //
PartyCommList:[], //
orgListSwitch: false, // orgListSwitch: false, //
GridPartyBranchSwitch:false, //
partyCommSwitch:false, //
} }
}, },
computed: { computed: {
@ -148,7 +132,7 @@ export default {
name:[ name:[
{ required: true, message: "名称不能为空", trigger: "blur" } { required: true, message: "名称不能为空", trigger: "blur" }
], ],
orgId:[ agencyId:[
{ required: true, message: "所属组织不能为空", trigger: "blur" } { required: true, message: "所属组织不能为空", trigger: "blur" }
], ],
pid:[ pid:[
@ -243,6 +227,18 @@ export default {
}) })
return orgArray; return orgArray;
}, },
removeEmptyStructTree (structArray) {
structArray.forEach((structInfo) => {
if (structInfo && structInfo.children) {
if (structInfo.children.length === 0) {
structInfo.children = undefined
} else {
this.removeEmptyStructTree(structInfo.children)
}
}
})
return structArray;
},
// //
getInfo () { getInfo () {
this.$http.post(`/pli/power/axisStruct/queryModifyById/${this.dataForm.id}`).then(({ data: res }) => { this.$http.post(`/pli/power/axisStruct/queryModifyById/${this.dataForm.id}`).then(({ data: res }) => {
@ -253,48 +249,27 @@ export default {
...this.dataForm, ...this.dataForm,
...res.data ...res.data
} }
if(this.dataForm.categoryCode === 'community_party') { let selectedLevel
this.orgListSwitch = true this.structCategoryArr.forEach((item) => {
this.GridPartyBranchSwitch = false if(item.categoryCode === this.dataForm.categoryCode){
this.partyCommSwitch = false selectedLevel = item.structLevel
} }
if(this.dataForm.categoryCode === 'grid_party') { })
if(selectedLevel === 0) {
this.orgListSwitch = true
} else {
this.orgListSwitch = false this.orgListSwitch = false
this.GridPartyBranchSwitch = false this.getParentStructTree(selectedLevel)
this.partyCommSwitch = true
this.getPartyCommList()
}
if(this.dataForm.categoryCode === 'group_party') {
this.GridPartyBranchSwitch = true
this.partyCommSwitch = false
this.getGridPartyBranchList()
} }
}).catch(() => {}) }).catch(() => {})
}, },
// //
async getGridPartyBranchList(){ async getParentStructTree(structLevel){
const url = '/pli/power/axisStruct/GridPartyBranchList' const url = `/pli/power/axisStruct/bylevel/${structLevel}/parenttree`
let params = {} let params = {}
const { data, code, msg } = await requestPost(url,params) const { data, code, msg } = await requestPost(url,params)
if (code === 0) { if (code === 0) {
this.GridPartyBranchList = data this.parentStructTree = this.removeEmptyStructTree(data)
} else {
this.$message.error(msg)
}
},
//
async getPartyCommList(){
const url = '/pli/power/axisStruct/getPartyCommList'
let params = {}
const { data, code, msg } = await requestPost(url,params)
if (code === 0) {
this.PartyCommList = data
} else { } else {
this.$message.error(msg) this.$message.error(msg)
} }
@ -310,22 +285,11 @@ export default {
}) })
if (selectedLevel === 0) { if (selectedLevel === 0) {
this.orgListSwitch = true this.orgListSwitch = true
this.GridPartyBranchSwitch = false
this.partyCommSwitch = false
this.dataForm.pid = '0' this.dataForm.pid = '0'
} } else {
if(selectedLevel === 1) {
this.orgListSwitch = false this.orgListSwitch = false
this.GridPartyBranchSwitch = false
this.partyCommSwitch = true
this.dataForm.pid = ''
this.getPartyCommList()
}
if(selectedLevel === 2) {
this.GridPartyBranchSwitch = true
this.partyCommSwitch = false
this.dataForm.pid = '' this.dataForm.pid = ''
this.getGridPartyBranchList() this.getParentStructTree(selectedLevel)
} }
}, },
// init // init
@ -457,7 +421,6 @@ export default {
}, 1000, { 'leading': true, 'trailing': false }), }, 1000, { 'leading': true, 'trailing': false }),
// //
async submitModifyOrg(){ async submitModifyOrg(){
this.dataForm.agencyId = this.dataForm.orgId[this.dataForm.orgId.length - 1]
const url = '/pli/power/axisStruct/update' const url = '/pli/power/axisStruct/update'
const { data, code, msg } = await requestPost(url,this.dataForm) const { data, code, msg } = await requestPost(url,this.dataForm)
if (code === 0) { if (code === 0) {
@ -477,7 +440,6 @@ export default {
// //
async submitAddNewOrg(){ async submitAddNewOrg(){
const url = '/pli/power/axisStruct/save' const url = '/pli/power/axisStruct/save'
this.dataForm.agencyId = this.dataForm.orgId[this.dataForm.orgId.length - 1]
const { data, code, msg } = await requestPost(url,this.dataForm) const { data, code, msg } = await requestPost(url,this.dataForm)
if (code === 0) { if (code === 0) {
this.$message({ this.$message({

5
src/views/modules/plugins/power/poweraxis.vue

@ -22,7 +22,7 @@
</el-form> </el-form>
</div> </div>
<div class="div_table"> <div class="div_table">
<div class="div_btn"> <div>
<el-button style="" <el-button style=""
class="diy-button--add" class="diy-button--add"
size="small" size="small"
@ -264,9 +264,6 @@ export default {
} }
} }
.div_btn {
}
.el-row { .el-row {
/* margin-bottom: 20px; */ /* margin-bottom: 20px; */
display: flex; display: flex;

Loading…
Cancel
Save