5 changed files with 665 additions and 194 deletions
@ -0,0 +1,75 @@ |
|||
<template> |
|||
<el-table-column :prop="prop" v-bind="$attrs"> |
|||
<template slot-scope="scope"> |
|||
<span @click.prevent="toggleHandle(scope.$index, scope.row)" :style="{ 'padding-left': ((scope.row._level || 0) * 10) + 'px' }"> |
|||
<i :class="[ scope.row._expanded ? 'el-icon-caret-bottom' : 'el-icon-caret-right' ]" :style="{ 'visibility': hasChild(scope.row) ? 'visible' : 'hidden' }"></i> |
|||
{{ scope.row[prop] }} |
|||
</span> |
|||
</template> |
|||
</el-table-column> |
|||
</template> |
|||
|
|||
<script> |
|||
import isArray from 'lodash/isArray' |
|||
export default { |
|||
name: 'table-tree-column', |
|||
props: { |
|||
prop: { |
|||
type: String |
|||
}, |
|||
treeKey: { |
|||
type: String, |
|||
default: 'id' |
|||
}, |
|||
parentKey: { |
|||
type: String, |
|||
default: 'pid' |
|||
}, |
|||
childKey: { |
|||
type: String, |
|||
default: 'children' |
|||
} |
|||
}, |
|||
methods: { |
|||
hasChild (row) { |
|||
return (isArray(row[this.childKey]) && row[this.childKey].length >= 1) || false |
|||
}, |
|||
// 切换处理 |
|||
toggleHandle (index, row) { |
|||
if (!this.hasChild(row)) { |
|||
return false |
|||
} |
|||
var data = this.$parent.store.states.data.slice(0) |
|||
data[index]._expanded = !data[index]._expanded |
|||
if (data[index]._expanded) { |
|||
row[this.childKey].forEach(item => { |
|||
item._level = (row._level || 0) + 1 |
|||
item._expanded = false |
|||
}) |
|||
data = data.splice(0, index + 1).concat(row[this.childKey]).concat(data) |
|||
} else { |
|||
data = this.removeChildNode(data, row[this.treeKey]) |
|||
} |
|||
this.$parent.store.commit('setData', data) |
|||
this.$nextTick(() => { |
|||
this.$parent.doLayout() |
|||
}) |
|||
}, |
|||
// 移除子节点 |
|||
removeChildNode (data, pid) { |
|||
var pids = isArray(pid) ? pid : [pid] |
|||
if (pid.length <= 0) { |
|||
return data |
|||
} |
|||
var ids = [] |
|||
for (var i = 0; i < data.length; i++) { |
|||
if (pids.indexOf(data[i][this.parentKey]) !== -1 && pids.indexOf(data[i][this.treeKey]) === -1) { |
|||
ids.push(data.splice(i, 1)[0][this.treeKey]) |
|||
i-- |
|||
} |
|||
} |
|||
return this.removeChildNode(data, ids) |
|||
} |
|||
} |
|||
} |
|||
</script> |
@ -1,202 +1,410 @@ |
|||
<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="$i18n.locale === 'en-US' ? '120px' : '80px'"> |
|||
<el-form-item label="客户Id (customer.id)" prop="customerId"> |
|||
<el-input v-model="dataForm.customerId" placeholder="客户Id (customer.id)"></el-input> |
|||
</el-form-item> |
|||
<el-form-item label="党组织的上级ID,没有上级时为0" prop="orgPid"> |
|||
<el-input v-model="dataForm.orgPid" placeholder="党组织的上级ID,没有上级时为0"></el-input> |
|||
</el-form-item> |
|||
<el-form-item label="党组织的所有上级ID,没有上级时为0" prop="orgPids"> |
|||
<el-input v-model="dataForm.orgPids" placeholder="党组织的所有上级ID,没有上级时为0"></el-input> |
|||
</el-form-item> |
|||
<el-form-item label="行政组织 机关ID" prop="agencyId"> |
|||
<el-input v-model="dataForm.agencyId" placeholder="行政组织 机关ID"></el-input> |
|||
</el-form-item> |
|||
<el-form-item label="行政组织 机关ID" prop="agencyPids"> |
|||
<el-input v-model="dataForm.agencyPids" placeholder="行政组织 机关ID"></el-input> |
|||
</el-form-item> |
|||
<el-form-item label="党组织类型 0省委,1市委,2区委,3党工委,4党委,5支部" prop="partyOrgType"> |
|||
<el-input v-model="dataForm.partyOrgType" placeholder="党组织类型 0省委,1市委,2区委,3党工委,4党委,5支部"></el-input> |
|||
</el-form-item> |
|||
<el-form-item label="组织名称" prop="partyOrgName"> |
|||
<el-input v-model="dataForm.partyOrgName" placeholder="组织名称"></el-input> |
|||
</el-form-item> |
|||
<el-form-item label="组织编码" prop="partyOrgCode"> |
|||
<el-input v-model="dataForm.partyOrgCode" placeholder="组织编码"></el-input> |
|||
</el-form-item> |
|||
<el-form-item label="经度" prop="longitude"> |
|||
<el-input v-model="dataForm.longitude" placeholder="经度"></el-input> |
|||
</el-form-item> |
|||
<el-form-item label="纬度" prop="latitude"> |
|||
<el-input v-model="dataForm.latitude" placeholder="纬度"></el-input> |
|||
</el-form-item> |
|||
<el-form-item label="地址" prop="address"> |
|||
<el-input v-model="dataForm.address" placeholder="地址"></el-input> |
|||
</el-form-item> |
|||
<el-form-item label="党组织介绍" prop="introduction"> |
|||
<el-input v-model="dataForm.introduction" placeholder="党组织介绍"></el-input> |
|||
</el-form-item> |
|||
<el-form-item label="删除标识:0.未删除 1.已删除" prop="delFlag"> |
|||
<el-input v-model="dataForm.delFlag" placeholder="删除标识:0.未删除 1.已删除"></el-input> |
|||
</el-form-item> |
|||
<el-form-item label="乐观锁" prop="revision"> |
|||
<el-input v-model="dataForm.revision" placeholder="乐观锁"></el-input> |
|||
</el-form-item> |
|||
<el-form-item label="创建人" prop="createdBy"> |
|||
<el-input v-model="dataForm.createdBy" placeholder="创建人"></el-input> |
|||
</el-form-item> |
|||
<el-form-item label="创建时间" prop="createdTime"> |
|||
<el-input v-model="dataForm.createdTime" placeholder="创建时间"></el-input> |
|||
</el-form-item> |
|||
<el-form-item label="更新人" prop="updatedBy"> |
|||
<el-input v-model="dataForm.updatedBy" placeholder="更新人"></el-input> |
|||
</el-form-item> |
|||
<el-form-item label="更新时间" prop="updatedTime"> |
|||
<el-input v-model="dataForm.updatedTime" placeholder="更新时间"></el-input> |
|||
</el-form-item> |
|||
</el-form> |
|||
<template slot="footer"> |
|||
<el-button @click="visible = false">{{ $t('cancel') }}</el-button> |
|||
<el-button type="primary" @click="dataFormSubmitHandle()">{{ $t('confirm') }}</el-button> |
|||
</template> |
|||
</el-dialog> |
|||
<el-dialog :visible.sync="visible" :title="!dataForm.id ? '新增党组织' : '更新党组织'" :close-on-click-modal="false" |
|||
:close-on-press-escape="false"> |
|||
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmitHandle()" |
|||
:label-width="$i18n.locale === 'en-US' ? '120px' : '100px'"> |
|||
<!-- <el-form-item label="上级组织" prop="orgPid">--> |
|||
<!-- <el-input v-model="dataForm.orgPid" placeholder="上级组织"></el-input>--> |
|||
<!-- </el-form-item>--> |
|||
<el-form-item prop="orgPidName" |
|||
label="上级组织" |
|||
class="dept-list"> |
|||
<el-popover v-model="orgListVisible" |
|||
ref="orgListPopover" |
|||
placement="bottom-start" |
|||
trigger="click"> |
|||
<el-tree :data="orgList" |
|||
:props="{ label: 'partyOrgName', children: 'children' }" |
|||
node-key="id" |
|||
ref="deptListTree" |
|||
:highlight-current="true" |
|||
:expand-on-click-node="false" |
|||
accordion |
|||
@current-change="orgListTreeCurrentChangeHandle"> |
|||
</el-tree> |
|||
</el-popover> |
|||
<el-input v-model="dataForm.orgPidName" |
|||
v-popover:orgListPopover |
|||
:readonly="true" |
|||
placeholder="上级分类"> |
|||
<i v-if="dataForm.orgPid !== '0'" |
|||
slot="suffix" |
|||
@click.stop="orgListTreeSetDefaultHandle()" |
|||
class="el-icon-circle-close el-input__icon"> |
|||
</i> |
|||
</el-input> |
|||
</el-form-item> |
|||
<!-- <el-form-item label="组织类型" prop="partyOrgType">--> |
|||
<!-- <el-input v-model="dataForm.partyOrgType" placeholder="党组织类型"></el-input>--> |
|||
<!-- </el-form-item>--> |
|||
<el-form-item label="组织类型" prop="partyOrgType"> |
|||
<el-select v-model="dataForm.partyOrgType" @change="changePartyOrgType" clearable placeholder="组织类型"> |
|||
<el-option v-for="item in partyOrgTypeList" :key="item.value" :label="item.name" :value="item.value"> |
|||
</el-option> |
|||
</el-select> |
|||
</el-form-item> |
|||
<el-form-item label="组织名称" prop="partyOrgName"> |
|||
<el-input v-model="dataForm.partyOrgName" placeholder="组织名称"></el-input> |
|||
</el-form-item> |
|||
<el-form-item label="组织编码" prop="partyOrgCode"> |
|||
<el-input v-model="dataForm.partyOrgCode" placeholder="组织编码"></el-input> |
|||
</el-form-item> |
|||
<!-- <el-form-item label="行政组织" prop="agencyId">--> |
|||
<!-- <el-input v-model="dataForm.agencyId" placeholder="行政组织"></el-input>--> |
|||
<!-- </el-form-item>--> |
|||
<el-form-item prop="agencyName" |
|||
label="行政组织" |
|||
v-if="dataForm.partyOrgType != '5'" |
|||
class="dept-list"> |
|||
<el-popover v-model="agencyListVisible" |
|||
ref="agencyOrgListPopover" |
|||
placement="bottom-start" |
|||
trigger="click"> |
|||
<el-tree :data="agencyOrgList" |
|||
:props="{ label: 'name', children: 'children' }" |
|||
node-key="id" |
|||
ref="agencyListTree" |
|||
:highlight-current="true" |
|||
:expand-on-click-node="false" |
|||
accordion |
|||
@current-change="agencyListTreeCurrentChangeHandle"> |
|||
</el-tree> |
|||
</el-popover> |
|||
<el-input v-model="dataForm.agencyName" |
|||
v-popover:agencyOrgListPopover |
|||
:readonly="true" |
|||
placeholder="行政组织"> |
|||
<!-- <i v-if="dataForm.orgPid !== '0'"--> |
|||
<!-- slot="suffix"--> |
|||
<!-- class="el-icon-circle-close el-input__icon">--> |
|||
<!-- </i>--> |
|||
</el-input> |
|||
</el-form-item> |
|||
<el-form-item label="党组织介绍" prop="introduction"> |
|||
<el-input v-model="dataForm.introduction" type="textarea" maxlength="500" placeholder="党组织介绍"></el-input> |
|||
</el-form-item> |
|||
</el-form> |
|||
<template slot="footer"> |
|||
<el-button @click="visible = false">{{ $t('cancel') }}</el-button> |
|||
<el-button type="primary" @click="dataFormSubmitHandle()">{{ $t('confirm') }}</el-button> |
|||
</template> |
|||
</el-dialog> |
|||
</template> |
|||
|
|||
<script> |
|||
import debounce from 'lodash/debounce' |
|||
|
|||
export default { |
|||
data () { |
|||
return { |
|||
visible: false, |
|||
dataForm: { |
|||
id: '', |
|||
customerId: '', |
|||
orgPid: '', |
|||
orgPids: '', |
|||
agencyId: '', |
|||
agencyPids: '', |
|||
partyOrgType: '', |
|||
partyOrgName: '', |
|||
partyOrgCode: '', |
|||
longitude: '', |
|||
latitude: '', |
|||
address: '', |
|||
introduction: '', |
|||
delFlag: '', |
|||
revision: '', |
|||
createdBy: '', |
|||
createdTime: '', |
|||
updatedBy: '', |
|||
updatedTime: '' |
|||
} |
|||
} |
|||
}, |
|||
computed: { |
|||
dataRule () { |
|||
return { |
|||
customerId: [ |
|||
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } |
|||
], |
|||
orgPid: [ |
|||
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } |
|||
], |
|||
orgPids: [ |
|||
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } |
|||
], |
|||
agencyId: [ |
|||
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } |
|||
], |
|||
agencyPids: [ |
|||
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } |
|||
], |
|||
partyOrgType: [ |
|||
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } |
|||
], |
|||
partyOrgName: [ |
|||
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } |
|||
], |
|||
partyOrgCode: [ |
|||
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } |
|||
], |
|||
longitude: [ |
|||
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } |
|||
], |
|||
latitude: [ |
|||
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } |
|||
], |
|||
address: [ |
|||
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } |
|||
], |
|||
introduction: [ |
|||
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } |
|||
], |
|||
delFlag: [ |
|||
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } |
|||
], |
|||
revision: [ |
|||
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } |
|||
], |
|||
createdBy: [ |
|||
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } |
|||
], |
|||
createdTime: [ |
|||
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } |
|||
], |
|||
updatedBy: [ |
|||
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } |
|||
], |
|||
updatedTime: [ |
|||
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } |
|||
] |
|||
} |
|||
} |
|||
}, |
|||
methods: { |
|||
init () { |
|||
this.visible = true |
|||
this.$nextTick(() => { |
|||
this.$refs['dataForm'].resetFields() |
|||
if (this.dataForm.id) { |
|||
this.getInfo() |
|||
} |
|||
}) |
|||
}, |
|||
// 获取信息 |
|||
getInfo () { |
|||
this.$http.get(`/${moduleName}/${pathName}/#[[${this.dataForm.id}`).then(({ data: res }) => { |
|||
if (res.code !== 0) { |
|||
return this.$message.error(res.msg) |
|||
} |
|||
this.dataForm = { |
|||
...this.dataForm, |
|||
...res.data |
|||
} |
|||
}).catch(() => {}) |
|||
}, |
|||
// 表单提交 |
|||
dataFormSubmitHandle: debounce(function () { |
|||
this.$refs['dataForm'].validate((valid) => { |
|||
if (!valid) { |
|||
return false |
|||
} |
|||
this.$http[!this.dataForm.id ? 'post' : 'put']('/${moduleName}/${pathName}/', this.dataForm).then(({ data: res }) => { |
|||
if (res.code !== 0) { |
|||
return this.$message.error(res.msg) |
|||
} |
|||
this.$message({ |
|||
message: this.$t('prompt.success'), |
|||
type: 'success', |
|||
duration: 500, |
|||
onClose: () => { |
|||
this.visible = false |
|||
this.$emit('refreshDataList') |
|||
data() { |
|||
return { |
|||
visible: false, |
|||
dataForm: { |
|||
id: '', |
|||
customerId: '', |
|||
staffId:'', |
|||
orgPid: '', |
|||
orgPids: '', |
|||
orgPidName: '', |
|||
agencyId: '', |
|||
agencyName:'', |
|||
agencyPids: '', |
|||
partyOrgType: '', |
|||
partyOrgName: '', |
|||
partyOrgCode: '', |
|||
longitude: '1', |
|||
latitude: '1', |
|||
address: '', |
|||
introduction: '', |
|||
delFlag: '', |
|||
revision: '', |
|||
createdBy: '', |
|||
createdTime: '', |
|||
updatedBy: '', |
|||
updatedTime: '' |
|||
}, |
|||
orgListVisible: false, |
|||
agencyListVisible:false, |
|||
orgList: [], |
|||
agencyId: '', |
|||
partyOrgTypeList: [], |
|||
agencyOrgList:[] |
|||
} |
|||
}, |
|||
computed: { |
|||
dataRule() { |
|||
return { |
|||
customerId: [ |
|||
{required: true, message: this.$t('validate.required'), trigger: 'blur'} |
|||
], |
|||
orgPid: [ |
|||
{required: true, message: this.$t('validate.required'), trigger: 'blur'} |
|||
], |
|||
orgPids: [ |
|||
{required: true, message: this.$t('validate.required'), trigger: 'blur'} |
|||
], |
|||
agencyId: [ |
|||
{required: true, message: this.$t('validate.required'), trigger: 'blur'} |
|||
], |
|||
agencyPids: [ |
|||
{required: true, message: this.$t('validate.required'), trigger: 'blur'} |
|||
], |
|||
partyOrgType: [ |
|||
{required: true, message: this.$t('validate.required'), trigger: 'blur'} |
|||
], |
|||
partyOrgName: [ |
|||
{required: true, message: this.$t('validate.required'), trigger: 'blur'} |
|||
], |
|||
longitude: [ |
|||
{required: true, message: this.$t('validate.required'), trigger: 'blur'} |
|||
], |
|||
latitude: [ |
|||
{required: true, message: this.$t('validate.required'), trigger: 'blur'} |
|||
], |
|||
address: [ |
|||
{required: true, message: this.$t('validate.required'), trigger: 'blur'} |
|||
], |
|||
delFlag: [ |
|||
{required: true, message: this.$t('validate.required'), trigger: 'blur'} |
|||
], |
|||
revision: [ |
|||
{required: true, message: this.$t('validate.required'), trigger: 'blur'} |
|||
], |
|||
createdBy: [ |
|||
{required: true, message: this.$t('validate.required'), trigger: 'blur'} |
|||
], |
|||
createdTime: [ |
|||
{required: true, message: this.$t('validate.required'), trigger: 'blur'} |
|||
], |
|||
updatedBy: [ |
|||
{required: true, message: this.$t('validate.required'), trigger: 'blur'} |
|||
], |
|||
updatedTime: [ |
|||
{required: true, message: this.$t('validate.required'), trigger: 'blur'} |
|||
], |
|||
orgPidName: [ |
|||
{required: true, message: this.$t('validate.required'), trigger: 'blur'} |
|||
], |
|||
agencyName: [ |
|||
{required: true, message: this.$t('validate.required'), trigger: 'blur'} |
|||
] |
|||
} |
|||
} |
|||
}) |
|||
}).catch(() => {}) |
|||
}) |
|||
}, 1000, { 'leading': true, 'trailing': false }) |
|||
} |
|||
} |
|||
}, |
|||
methods: { |
|||
changePartyOrgType(value){ |
|||
if(value != '5'){ |
|||
this.dataForm.agencyId = '' |
|||
this.dataForm.agencyName = '' |
|||
} |
|||
this.$http.get('/gov/org/customeragency/getOrgTreeByUserAndType', |
|||
{params: |
|||
{agencyId: this.agencyId, |
|||
orgType:value} |
|||
}).then(({data: res}) => { |
|||
if (res.code !== 0) { |
|||
return this.$message.error(res.msg) |
|||
} |
|||
this.agencyOrgList = res.data |
|||
}).catch(() => { |
|||
}) |
|||
}, |
|||
//设置组织类型 |
|||
setPartyOrgType() { |
|||
/** |
|||
* 社区级:community, |
|||
街道级:street, |
|||
区县级: district, |
|||
市级: city |
|||
省级:province |
|||
* |
|||
*/ |
|||
this.level = localStorage.getItem('level') |
|||
/** |
|||
* 党组织类型 0省委,1市委,2区委,3党工委,4党委,5支部 |
|||
*/ |
|||
if (this.level == 'province') { |
|||
this.partyOrgTypeList = [ |
|||
{value: '0', name: '省委'}, |
|||
{value: '1', name: '市委'}, |
|||
{value: '2', name: '区委'}, |
|||
{value: '3', name: '党工委'}, |
|||
{value: '4', name: '党委'}, |
|||
{value: '5', name: '支部'} |
|||
] |
|||
}else if(this.level == 'city'){ |
|||
this.partyOrgTypeList = [ |
|||
{value: '1', name: '市委'}, |
|||
{value: '2', name: '区委'}, |
|||
{value: '3', name: '党工委'}, |
|||
{value: '4', name: '党委'}, |
|||
{value: '5', name: '支部'} |
|||
] |
|||
}else if(this.level == 'district'){ |
|||
this.partyOrgTypeList = [ |
|||
{value: '2', name: '区委'}, |
|||
{value: '3', name: '党工委'}, |
|||
{value: '4', name: '党委'}, |
|||
{value: '5', name: '支部'} |
|||
] |
|||
}else if(this.level == 'street'){ |
|||
this.partyOrgTypeList = [ |
|||
{value: '3', name: '党工委'}, |
|||
{value: '4', name: '党委'}, |
|||
{value: '5', name: '支部'} |
|||
] |
|||
}else if(this.level == 'community'){ |
|||
this.partyOrgTypeList = [ |
|||
{value: '4', name: '党委'}, |
|||
{value: '5', name: '支部'} |
|||
] |
|||
} |
|||
}, |
|||
// 获取党组织列表 |
|||
getOrgList() { |
|||
return this.$http.get('/resi/partymember/icPartyOrg/getTreelist', {params: {agencyId: this.agencyId}}).then(({data: res}) => { |
|||
if (res.code !== 0) { |
|||
return this.$message.error(res.msg) |
|||
} |
|||
this.orgList = res.data |
|||
}).catch(() => { |
|||
}) |
|||
}, |
|||
// 上级党组织树, 设置默认值 |
|||
orgListTreeSetDefaultHandle() { |
|||
this.dataForm.orgPid = '0' |
|||
this.dataForm.orgPidName = '一级组织' |
|||
}, |
|||
// 上级党组织树, 选中 |
|||
orgListTreeCurrentChangeHandle(data) { |
|||
this.dataForm.orgPid = data.id |
|||
this.dataForm.orgPidName = data.partyOrgName |
|||
this.dataForm.orgPids = data.orgPids+data.id+"," |
|||
//默认设置行政组织id为父节点的行政组织id |
|||
this.dataForm.agencyId = data.agencyId |
|||
this.orgListVisible = false |
|||
}, |
|||
// 上级行政组织树, 选中 |
|||
agencyListTreeCurrentChangeHandle(data) { |
|||
this.dataForm.agencyId = data.id |
|||
this.dataForm.agencyName = data.name |
|||
this.agencyListVisible = false |
|||
}, |
|||
init() { |
|||
this.visible = true |
|||
this.agencyId = localStorage.getItem('agencyId') |
|||
this.dataForm.customerId = localStorage.getItem('customerId') |
|||
this.dataForm.staffId = localStorage.getItem('staffId') |
|||
this.$nextTick(() => { |
|||
this.$refs['dataForm'].resetFields() |
|||
//设置党组织类型 |
|||
this.setPartyOrgType() |
|||
this.getOrgList().then(() => { |
|||
if (this.dataForm.id) { |
|||
this.getInfo() |
|||
} else { |
|||
this.orgListTreeSetDefaultHandle() |
|||
} |
|||
}) |
|||
}) |
|||
}, |
|||
// 获取信息 |
|||
getInfo() { |
|||
this.$http.get(`/resi/partymember/icPartyOrg/${this.dataForm.id}`).then(({data: res}) => { |
|||
if (res.code !== 0) { |
|||
return this.$message.error(res.msg) |
|||
} |
|||
this.dataForm = { |
|||
...this.dataForm, |
|||
...res.data |
|||
} |
|||
}).catch(() => { |
|||
}) |
|||
|
|||
//根据组织类型获取行政组织 |
|||
this.getInfoAgencyLisy() |
|||
}, |
|||
getInfoAgencyLisy(){ |
|||
this.$http.get('/gov/org/customeragency/getOrgTreeByUserAndType', |
|||
{params: |
|||
{agencyId: this.agencyId, |
|||
orgType:this.dataForm.partyOrgType} |
|||
}).then(({data: res}) => { |
|||
if (res.code !== 0) { |
|||
return this.$message.error(res.msg) |
|||
} |
|||
this.agencyOrgList = res.data |
|||
}).catch(() => { |
|||
}) |
|||
}, |
|||
// 表单提交 |
|||
dataFormSubmitHandle: debounce(function () { |
|||
this.$refs['dataForm'].validate((valid) => { |
|||
if (!valid) { |
|||
return false |
|||
} |
|||
this.$http[!this.dataForm.id ? 'post' : 'put']('/resi/partymember/icPartyOrg/', this.dataForm).then(({data: res}) => { |
|||
if (res.code !== 0) { |
|||
return this.$message.error(res.msg) |
|||
} |
|||
this.$message({ |
|||
message: this.$t('prompt.success'), |
|||
type: 'success', |
|||
duration: 500, |
|||
onClose: () => { |
|||
this.visible = false |
|||
this.$emit('refreshDataList') |
|||
} |
|||
}) |
|||
}).catch(() => { |
|||
}) |
|||
}) |
|||
}, 1000, {'leading': true, 'trailing': false}) |
|||
} |
|||
} |
|||
</script> |
|||
<style lang="scss"> |
|||
.mod-sys__dept { |
|||
.dept-list { |
|||
.el-input__inner, |
|||
.el-input__suffix { |
|||
cursor: pointer; |
|||
} |
|||
} |
|||
} |
|||
|
|||
.el-popover { |
|||
height: 320px; |
|||
overflow-y: scroll; |
|||
} |
|||
|
|||
.el-dialog__footer { |
|||
margin-top: 100px; |
|||
} |
|||
|
|||
.avatar-uploader .el-upload { |
|||
border: 1px dashed #d9d9d9; |
|||
border-radius: 6px; |
|||
cursor: pointer; |
|||
position: relative; |
|||
overflow: hidden; |
|||
} |
|||
|
|||
.avatar-uploader .el-upload:hover { |
|||
border-color: #409eff; |
|||
} |
|||
|
|||
.avatar-uploader-icon { |
|||
font-size: 28px; |
|||
color: #8c939d; |
|||
width: 178px; |
|||
height: 178px; |
|||
line-height: 178px; |
|||
text-align: center; |
|||
} |
|||
|
|||
.avatar { |
|||
width: 178px; |
|||
height: 178px; |
|||
display: block; |
|||
} |
|||
</style> |
|||
|
@ -0,0 +1,186 @@ |
|||
<template> |
|||
<div class="resi-container"> |
|||
<el-card class="resi-card-table"> |
|||
<div class="resi-row-btn"> |
|||
<el-button class="diy-button--add" |
|||
size="small" |
|||
@click="addOrUpdateHandle()">新增</el-button> |
|||
</div> |
|||
|
|||
<el-table :data="tableData" |
|||
v-loading="tableLoading" |
|||
border |
|||
style="width: 100%" |
|||
class="resi-table"> |
|||
<table-tree-column prop="partyOrgName" label="党组织名称" header-align="center"></table-tree-column> |
|||
<el-table-column label="操作" |
|||
align="center" |
|||
width="300"> |
|||
<template slot-scope="scope"> |
|||
<el-button v-if="scope.row.agencyId == agencyId || scope.row.agencyPids.includes(agencyId)" |
|||
@click="handleLook(scope.row)" |
|||
type="text" |
|||
size="small" |
|||
class="div-table-button--detail">{{'查看党员'}}</el-button> |
|||
<el-button v-if="scope.row.agencyId == agencyId || scope.row.agencyPids.includes(agencyId)" |
|||
@click="handleAdd('2', 'add', scope.row)" |
|||
type="text" |
|||
size="small" |
|||
class="div-table-button--add">新增下级</el-button> |
|||
<el-button v-if="scope.row.agencyId == agencyId || scope.row.agencyPids.includes(agencyId)" |
|||
@click="addOrUpdateHandle(scope.row.id)" |
|||
type="text" |
|||
size="small" |
|||
class="div-table-button--edit">修改</el-button> |
|||
<el-button v-if="scope.row.agencyId == agencyId || scope.row.agencyPids.includes(agencyId)" |
|||
@click="handleEdit(scope.row, 'edit')" |
|||
type="text" |
|||
size="small" |
|||
class="div-table-button--edit">删除</el-button> |
|||
</template> |
|||
</el-table-column> |
|||
</el-table> |
|||
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update> |
|||
</el-card> |
|||
</div> |
|||
</template> |
|||
|
|||
<script> |
|||
import mixinViewModule from '@/mixins/view-module' |
|||
import AddOrUpdate from './icpartyorg-add-or-update' |
|||
import TableTreeColumn from '@/components/table-tree-column' |
|||
|
|||
export default { |
|||
mixins: [mixinViewModule], |
|||
data () { |
|||
return { |
|||
mixinViewModuleOptions: { |
|||
getDataListURL: '/resi/partymember/icPartyOrg/getTreelist', |
|||
getDataListIsPage: true, |
|||
deleteURL: '/resi/partymember/icPartyOrg', |
|||
deleteIsBatch: true |
|||
}, |
|||
dataForm: { |
|||
id: '', |
|||
customerId: '' |
|||
}, |
|||
tableLoading: false, |
|||
tableData: [], |
|||
agencyId: '' |
|||
} |
|||
}, |
|||
components: { |
|||
AddOrUpdate, |
|||
TableTreeColumn |
|||
}, |
|||
async created () { |
|||
this.agencyId = localStorage.getItem('agencyId') |
|||
this.dataForm.customerId = localStorage.getItem('customerId') |
|||
this.getTableData() |
|||
// this.pageLoading = true |
|||
}, |
|||
methods:{ |
|||
// 新增 / 修改 |
|||
addOrUpdateHandle (id) { |
|||
this.addOrUpdateVisible = true |
|||
this.$nextTick(() => { |
|||
this.$refs.addOrUpdate.dataForm.id = id |
|||
this.$refs.addOrUpdate.init() |
|||
}) |
|||
}, |
|||
async getTableData () { |
|||
this.tableLoading = true |
|||
let params = { |
|||
customerId: localStorage.getItem('customerId') |
|||
} |
|||
await this.$http |
|||
.get('/resi/partymember/icPartyOrg/getTreelist', {params: this.dataForm}) |
|||
.then(({ data: res }) => { |
|||
if (res.code !== 0) { |
|||
return this.$message.error(res.msg) |
|||
} else { |
|||
this.tableData = res.data |
|||
} |
|||
}) |
|||
.catch(() => {}) |
|||
this.tableLoading = false |
|||
} |
|||
} |
|||
} |
|||
</script> |
|||
<style lang="scss" scoped> |
|||
.resi-container .resi-card-table { |
|||
::v-deep .el-table { |
|||
th { |
|||
color: #fff; |
|||
background-color: rgba(33, 149, 254, 1); |
|||
} |
|||
|
|||
.cell { |
|||
span:nth-of-type(3) { |
|||
display: inline-block; |
|||
width: 90%; |
|||
word-break: break-all; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
.resi-table { |
|||
::v-deep .el-button--text { |
|||
text-decoration: underline; |
|||
} |
|||
::v-deep .btn-color-del { |
|||
margin-left: 10px; |
|||
color: rgba(213, 16, 16, 1); |
|||
} |
|||
::v-deep .btn-color-edit { |
|||
color: rgba(0, 167, 169, 1); |
|||
} |
|||
} |
|||
</style> |
|||
<style lang="scss" scoped> |
|||
.resi-row-btn { |
|||
display: flex; |
|||
margin-bottom: 13px; |
|||
::v-deep .el-button { |
|||
// margin-left: 10px; |
|||
border: 0; |
|||
} |
|||
::v-deep .el-select { |
|||
margin-right: 10px; |
|||
} |
|||
.el-button--success { |
|||
background: rgba(34, 193, 195, 1); |
|||
} |
|||
} |
|||
.avatar-uploader { |
|||
::v-deep .el-upload { |
|||
cursor: pointer; |
|||
position: relative; |
|||
overflow: hidden; |
|||
} |
|||
.el-upload:hover { |
|||
border-color: #409eff; |
|||
} |
|||
.avatar { |
|||
width: 70px; |
|||
height: 70px; |
|||
display: block; |
|||
} |
|||
.avatar-uploader-icon { |
|||
border: 1px dashed #d9d9d9; |
|||
border-radius: 6px; |
|||
font-size: 28px; |
|||
color: #8c939d; |
|||
width: 70px; |
|||
height: 70px; |
|||
line-height: 70px; |
|||
text-align: center; |
|||
} |
|||
} |
|||
|
|||
.resi-btns { |
|||
margin-top: 20px; |
|||
text-align: center; |
|||
} |
|||
</style> |
Loading…
Reference in new issue