Browse Source

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

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

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

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

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

Loading…
Cancel
Save