提交 2dba51bb authored 作者: 宋雄's avatar 宋雄

增加社区服务

上级 c31210aa
NODE_ENV=development NODE_ENV=development
# VUE_APP_API_BASE_URL='http://192.168.0.100:9999' # VUE_APP_API_BASE_URL='http://192.168.0.119:9999'
# VUE_APP_API_BASE_URL='http://192.168.0.108:9999'
VUE_APP_API_BASE_URL='http://220.203.25.212:9999' VUE_APP_API_BASE_URL='http://220.203.25.212:9999'
# VUE_APP_API_BASE_URL='http://220.203.25.212:9999/property-central'
VUE_APP_CAS_BASE_URL=http://cas.example.org:8443/cas VUE_APP_CAS_BASE_URL=http://cas.example.org:8443/cas
VUE_APP_ONLINE_BASE_URL=http://fileview.jeecg.com/onlinePreview VUE_APP_ONLINE_BASE_URL=http://fileview.jeecg.com/onlinePreview
......
...@@ -31,7 +31,7 @@ const getSystemSubmenu = (params)=>getAction("/sys/permission/getSystemSubmenu", ...@@ -31,7 +31,7 @@ const getSystemSubmenu = (params)=>getAction("/sys/permission/getSystemSubmenu",
const getSystemSubmenuBatch = (params) => getAction('/sys/permission/getSystemSubmenuBatch', params) const getSystemSubmenuBatch = (params) => getAction('/sys/permission/getSystemSubmenuBatch', params)
const queryTreeList = (params)=>getAction("/sys/permission/queryTreeList",params); const queryTreeList = (params)=>getAction("/sys/permission/queryTreeList",params);
const queryTreeListForRole = (params)=>getAction("/sys/role/queryTreeList",params); const queryTreeListForRole = (params)=>getAction("/sys/role/queryTreeList",params);
const queryTreeListByTypeForRole = (params)=>getAction("/sys/role/queryTreeListByType",{...params, platformType: 'company'}); const queryTreeListByTypeForRole = (params)=>getAction("/sys/role/queryTreeListByType",params);
const queryListAsync = (params)=>getAction("/sys/permission/queryListAsync",params); const queryListAsync = (params)=>getAction("/sys/permission/queryListAsync",params);
const queryRolePermission = (params)=>getAction("/sys/permission/queryRolePermission",params); const queryRolePermission = (params)=>getAction("/sys/permission/queryRolePermission",params);
const saveRolePermission = (params)=>postAction("/sys/permission/saveRolePermission",params); const saveRolePermission = (params)=>postAction("/sys/permission/saveRolePermission",params);
...@@ -110,6 +110,10 @@ const AddUpdatePropertyApi = (params)=>postAction("/property-central/property/pr ...@@ -110,6 +110,10 @@ const AddUpdatePropertyApi = (params)=>postAction("/property-central/property/pr
const auditPropertyApi = (params)=>postAction("/property-central/property/propertySettled/audit",params); const auditPropertyApi = (params)=>postAction("/property-central/property/propertySettled/audit",params);
const freezeOrPropertyApi = (params)=>getAction(`/property-central/property/propertySettled/freezeOrThaw/${params.id}/${params.status}`,{}); const freezeOrPropertyApi = (params)=>getAction(`/property-central/property/propertySettled/freezeOrThaw/${params.id}/${params.status}`,{});
const getCouncilsDetailApi = (params)=>getAction("/property-central/councils/propertyCouncils/queryById",params);
const auditCouncilsApi = (params)=>postAction("/property-central/councils/propertyCouncils/audit",params);
const freezeOrCouncilsApi = (params)=>getAction(`/property-central/councils/propertyCouncils/freezeOrThaw/${params.id}/${params.status}`,{});
//费用管理 //费用管理
const getCostListApi = (params)=>getAction("/property-central/property/propertyChargrule/list",params); const getCostListApi = (params)=>getAction("/property-central/property/propertyChargrule/list",params);
const getCostDetailApi = (params)=>getAction("/property-central/property/propertyChargrule/queryById",params); const getCostDetailApi = (params)=>getAction("/property-central/property/propertyChargrule/queryById",params);
...@@ -188,7 +192,10 @@ export { ...@@ -188,7 +192,10 @@ export {
AuditUpdateCostApi, AuditUpdateCostApi,
getPropertyChargruleListApi, getPropertyChargruleListApi,
getPropertyAdvEditApi, getPropertyAdvEditApi,
proPertyChargruleApi proPertyChargruleApi,
getCouncilsDetailApi,
auditCouncilsApi,
freezeOrCouncilsApi,
} }
......
...@@ -67,15 +67,13 @@ ...@@ -67,15 +67,13 @@
fullscreen:false fullscreen:false
} }
}, },
created(){
this.loadDepart();
},
watch:{ watch:{
departId(){ departId(){
this.initDepartComponent() this.initDepartComponent()
}, },
visible: { visible: {
handler() { handler() {
this.loadDepart();
this.initDepartComponent(true) this.initDepartComponent(true)
} }
} }
......
...@@ -136,7 +136,7 @@ ...@@ -136,7 +136,7 @@
}, },
compareToFirstPassword (rule, value, callback) { compareToFirstPassword (rule, value, callback) {
const form = this.form; const form = this.form;
if (value && value !== form.getFieldValue('password')) { if (value && form.getFieldValue('password') && value !== form.getFieldValue('password')) {
callback('两次输入的密码不一样!'); callback('两次输入的密码不一样!');
} else { } else {
callback() callback()
......
...@@ -199,7 +199,11 @@ export default { ...@@ -199,7 +199,11 @@ export default {
}, },
created() { created() {
//备份model原始值 //备份model原始值
this.dictOptions = getDictItemsFromCache('advStatus') let dictOptions = getDictItemsFromCache('advStatus')
this.dictOptions = dictOptions.push(
{label: '上架', value: 'onShelf'},
{label: '下架', value: 'offShelf'}
)
}, },
methods: { methods: {
handleAShelves(id, type) { handleAShelves(id, type) {
......
...@@ -95,16 +95,15 @@ ...@@ -95,16 +95,15 @@
</a-form-model-item> </a-form-model-item>
</a-col> </a-col>
<a-col :span="12"> <a-col :span="12">
<a-form-model-item label="授权小区数量" :labelCol="labelCol" :wrapperCol="wrapperCol" <a-form-model-item label="授权小区数量" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="empowerCommunityNum">
prop="empowerCommunityNum"> <a-input-number v-model="model.empowerCommunityNum" placeholder="请输入试用小区数量" style="width: 100%" @change="onValidatorInputNum" />
<a-input-number v-model="model.empowerCommunityNum" placeholder="请输入试用小区数量" style="width: 100%" />
</a-form-model-item> </a-form-model-item>
</a-col> </a-col>
<a-col :span="12"> <a-col :span="12">
<a-form-model-item label="收费标准" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="chargingStandardId"> <a-form-model-item label="收费标准" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="chargingStandardId">
<a-select v-model="model.chargingStandardId" placeholder="请选择收费标准" style="width: 100%"> <a-select v-model="model.chargingStandardId" placeholder="请选择收费标准" style="width: 100%" @change="onValidatorNum">
<a-select-option v-for="item in costList" :key="item.id" <a-select-option v-for="item in costList" :key="item.id"
:value="item.id">{{item.chargingName}}</a-select-option> :value="item.id">{{item.chargingName}}{{item.empowerNum}}个社区)</a-select-option>
</a-select> </a-select>
</a-form-model-item> </a-form-model-item>
</a-col> </a-col>
...@@ -317,6 +316,22 @@ export default { ...@@ -317,6 +316,22 @@ export default {
this.$store.dispatch('tags/delView', this.$route.path) this.$store.dispatch('tags/delView', this.$route.path)
this.$router.go(-1) this.$router.go(-1)
}, },
onValidatorInputNum(val) {
if(this.model.chargingStandardId) {
let row = this.costList.find(item=>item.id === this.model.chargingStandardId)
if(val > row.empowerNum) {
this.$message.warning('授权小区数量不能大于收费标准规定社区数!')
this.model.empowerCommunityNum = undefined
}
}
},
onValidatorNum(val) {
let row = this.costList.find(item=>item.id === val)
if(this.model.empowerCommunityNum > row.empowerNum) {
this.$message.warning('授权小区数量不能大于收费标准规定社区数!')
this.model.empowerCommunityNum = undefined
}
},
contactPhoneChange(e) { contactPhoneChange(e) {
if (!this.model.adminLoginName) { if (!this.model.adminLoginName) {
this.model.adminLoginName = e.target.value this.model.adminLoginName = e.target.value
......
...@@ -11,12 +11,12 @@ ...@@ -11,12 +11,12 @@
</a-col> </a-col>
<a-col :md="6" :sm="8"> <a-col :md="6" :sm="8">
<a-form-item label="入驻开始时间"> <a-form-item label="入驻开始时间">
<a-date-picker placeholder="入驻开始时间" v-model="queryParam.createTime_begin"></a-date-picker> <a-date-picker placeholder="入驻开始时间" valueFormat="YYYY-MM-DD" v-model="queryParam.createTime_begin"></a-date-picker>
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :md="6" :sm="8"> <a-col :md="6" :sm="8">
<a-form-item label="入驻结束时间"> <a-form-item label="入驻结束时间">
<a-date-picker placeholder="入驻结束时间" v-model="queryParam.createTime_end"></a-date-picker> <a-date-picker placeholder="入驻结束时间" valueFormat="YYYY-MM-DD" v-model="queryParam.createTime_end"></a-date-picker>
</a-form-item> </a-form-item>
</a-col> </a-col>
<!-- <a-col :md="8" :sm="10"> <!-- <a-col :md="8" :sm="10">
...@@ -239,15 +239,15 @@ export default { ...@@ -239,15 +239,15 @@ export default {
this.handleDetail(record) this.handleDetail(record)
} }
}, },
onChange(date, dateString) { // onChange(date, dateString) {
if (dateString.length > 0) { // if (dateString.length > 0) {
this.queryParam.createTime_begin = dateString[0] // this.queryParam.createTime_begin = dateString[0]
this.queryParam.createTime_end = dateString[1] // this.queryParam.createTime_end = dateString[1]
} else { // } else {
this.queryParam.createTime_begin = '' // this.queryParam.createTime_begin = ''
this.queryParam.createTime_end = '' // this.queryParam.createTime_end = ''
} // }
}, // },
onExamine(record) { onExamine(record) {
let that = this let that = this
this.$confirm({ this.$confirm({
......
...@@ -59,8 +59,6 @@ ...@@ -59,8 +59,6 @@
</template> </template>
<script> <script>
const mapZoom = [5, 8, 10, 12]
let timer = null
import { getPropertyChargruleListApi, getPropertyDetailApi, auditPropertyApi } from '@/api/api' import { getPropertyChargruleListApi, getPropertyDetailApi, auditPropertyApi } from '@/api/api'
import { httpAction, getAction } from '@/api/manage' import { httpAction, getAction } from '@/api/manage'
import { isMobile, validateCreditCode } from '@/utils/validate' import { isMobile, validateCreditCode } from '@/utils/validate'
...@@ -221,22 +219,10 @@ export default { ...@@ -221,22 +219,10 @@ export default {
async getPageDetail() { async getPageDetail() {
let { result } = await getPropertyDetailApi({ id: this.$route.query.id }) let { result } = await getPropertyDetailApi({ id: this.$route.query.id })
this.edit(result) this.edit(result)
if (result.provinceName) {
this.getLongitude(
result.provinceName,
result.provinceName + result.cityName + result.countyName + result.addressInfo,
mapZoom[3]
)
}
}, },
onCancel() { onCancel() {
this.closeCurrent() this.closeCurrent()
}, },
contactPhoneChange(e) {
if(!this.model.adminLoginName) {
this.model.adminLoginName = e.target.value
}
},
edit(record) { edit(record) {
this.model = Object.assign({}, record) this.model = Object.assign({}, record)
this.model.registAdress = [record.provinceCode, record.cityCode, record.countyCode] this.model.registAdress = [record.provinceCode, record.cityCode, record.countyCode]
...@@ -264,96 +250,7 @@ export default { ...@@ -264,96 +250,7 @@ export default {
// }) // })
// } // }
}, },
addressChange(val) {
const province = Object.keys(val[0])[0]
const city = Object.keys(val[1])[0]
const county = Object.keys(val[2])[0]
this.model.provinceName = val[0][province]
this.model.provinceCode = province
this.model.cityName = val[1][city]
this.model.cityCode = city
this.model.countyName = val[2][county]
this.model.countyCode = county
if (this.model.addressInfo) {
this.getLongitude(
this.model.provinceName,
this.model.provinceName + this.model.cityName + this.model.countyName + this.model.addressInfo,
mapZoom[3]
)
}
},
addressBlur(val) {
if (this.model.provinceName) {
this.getLongitude(
this.model.provinceName,
this.model.provinceName + this.model.cityName + this.model.countyName + val.target.value,
mapZoom[3]
)
}
},
getAddress(e) {
let _this = this
// 创建地理编码实例
var myGeo = new BMapGL.Geocoder()
// 根据坐标得到地址描述
myGeo.getLocation(new BMapGL.Point(e.latlng.lng, e.latlng.lat), function (result) {
if (result) {
_this.mapRef.clearOverlays()
_this.model.registAdress = [
result.addressComponents.province,
result.addressComponents.city,
result.addressComponents.district,
]
_this.model.addressInfo = result.addressComponents.street + result.addressComponents.streetNumber
_this.model.longitude = result.point.lng
_this.model.latitude = result.point.lat
_this.positionMap(e.latlng.lng, e.latlng.lat, mapZoom[3], result.address)
console.log(result)
}
})
},
positionMap(mapCenterLng, mapCenterLat, mapzoom, address) {
var point = new BMapGL.Point(mapCenterLng, mapCenterLat) // 创建点坐标
this.mapRef.centerAndZoom(point, mapzoom)
var marker = new BMapGL.Marker(point, { title: address }) // 创建标注
this.mapRef.addOverlay(marker) // 将标注添加到地图中
let _this = this
// marker.addEventListener("click", function(){
var label = new BMapGL.Label(address, {
// 创建文本标注
position: point, // 设置标注的地理位置
offset: new BMapGL.Size(0, -55), // 设置标注的偏移量
})
_this.mapRef.addOverlay(label) // 将标注添加到地图中
label.setStyle({
// 设置label的样式
color: '#333',
fontSize: '14px',
padding: '4px 10px',
border: '1px solid #1E90FF',
borderRadius: '4px',
transform: 'translateX(-40%)',
})
// });
},
getLongitude(city, address, zoom) {
let _this = this
var myGeo = new BMapGL.Geocoder()
myGeo.getPoint(
address,
function (point) {
if (point) {
_this.mapRef.clearOverlays()
_this.model.longitude = point.lng
_this.model.latitude = point.lat
_this.positionMap(point.lng, point.lat, zoom, address)
} else {
console.log('您选择的地址没有解析到结果!')
}
},
city
)
},
submitForm() { submitForm() {
const that = this const that = this
// 触发表单验证 // 触发表单验证
......
<template>
<a-card :bordered="false">
<!-- 查询区域 -->
<div class="table-page-search-wrapper">
<a-form layout="inline" @keyup.enter.native="searchQuery">
<a-row :gutter="24">
<a-col :md="6" :sm="8">
<a-form-item label="社区名称">
<j-input placeholder="请输入社区名称" valueFormat="YYYY-MM-DD" v-model="queryParam.councilsName"></j-input>
</a-form-item>
</a-col>
<a-col :md="6" :sm="8">
<a-form-item label="入驻开始时间">
<a-date-picker placeholder="入驻开始时间" valueFormat="YYYY-MM-DD" v-model="queryParam.createTime_begin"></a-date-picker>
</a-form-item>
</a-col>
<a-col :md="6" :sm="8">
<a-form-item label="入驻结束时间">
<a-date-picker placeholder="入驻结束时间" v-model="queryParam.createTime_end"></a-date-picker>
</a-form-item>
</a-col>
<!-- <a-col :md="8" :sm="10">
<a-form-item label="入驻时间">
<a-range-picker v-model="queryParam.propertyTime" />
</a-form-item>
</a-col> -->
<span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
<a-col :md="6" :sm="24">
<a-button type="primary" @click="searchQuery">查询</a-button>
<a-button style="margin-left: 8px" @click="searchReset">重置</a-button>
</a-col>
</span>
</a-row>
</a-form>
</div>
<!-- 操作按钮区域 -->
<div class="table-operator">
<a-button @click="propertyDetails(1)" type="primary" icon="plus">新增</a-button>
<!-- <a-button type="primary" icon="download" @click="handleExportXls('t_property_settled')">导出</a-button> -->
<a-dropdown v-if="selectedRowKeys.length > 0">
<a-menu slot="overlay">
<a-menu-item key="1" @click="batchDel"><a-icon type="delete" />删除</a-menu-item>
</a-menu>
<a-button style="margin-left: 8px"> 批量操作 <a-icon type="down" /></a-button>
</a-dropdown>
</div>
<!-- table区域-begin -->
<div>
<div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
<i class="anticon anticon-info-circle ant-alert-icon"></i>已选择&nbsp;<a style="font-weight: 600">{{
selectedRowKeys.length }}</a>&nbsp;&nbsp;
<a style="margin-left: 24px" v-if="selectedRowKeys.length > 0" @click="onClearSelected">清空</a>
</div>
<a-table ref="table" size="middle" :scroll="{x:true}" bordered rowKey="id" :columns="columns"
:dataSource="dataSource" :pagination="pagination" :loading="loading"
:rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}" class="j-table-force-nowrap"
@change="handleTableChange">
<span slot="empowerEndDate" slot-scope="text, record">
<span v-if="record.empowerEndDate">{{record.empowerBeginDate}}{{record.empowerEndDate}} </span>
</span>
<span slot="propertyStatus" slot-scope="text, record">
<span>{{record.propertyStatus === 'normal' ? '正常' : '冻结'}}</span>
</span>
<span slot="expirationStatus" slot-scope="text, record">
<a-tag>{{record.expirationStatus === 'notStarted' ? '未开始' :record.expirationStatus === 'normal' ? '正常' :record.expirationStatus === 'soonExpired' ? '即将到期' :record.expirationStatus === 'expire' ? '已过期' : ''}}</a-tag>
</span>
<span slot="action" slot-scope="text, record">
<a href="javascript:;" @click="propertyDetails(4, record.id)">详情</a>
<a-divider type="vertical" />
<a-dropdown>
<a class="ant-dropdown-link">
更多 <a-icon type="down" />
</a>
<a-menu slot="overlay">
<a-menu-item v-if="record.auditStatus === 'auditPass'">
<a @click="handlePerssion(record.roleId)">授权</a>
</a-menu-item>
<a-menu-item>
<a href="javascript:;" @click="propertyDetails(2, record.id)" v-if="record.auditStatus != 'waitAudit'">编辑</a>
</a-menu-item>
<a-menu-item v-if="record.auditStatus === 'waitAudit'">
<a href="javascript:;" @click="propertyDetails(3, record.id)">审核</a>
</a-menu-item>
<a-menu-item v-if="record.auditStatus === 'auditPass'">
<a href="javascript:;"
@click="onStatus(record)">{{record.propertyStatus === 'normal' ? '冻结' : '解冻'}}</a>
</a-menu-item>
<a-menu-item>
<a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)" placement="topLeft">
<a>删除</a>
</a-popconfirm>
</a-menu-item>
</a-menu>
</a-dropdown>
</span>
</a-table>
</div>
<!-- table区域-end -->
<property-settled-modal ref="modalForm" @ok="modalFormOk"></property-settled-modal>
<!-- 右侧的角色权限配置 -->
<user-role-modal ref="modalUserRole"></user-role-modal>
</a-card>
</template>
<script>
import { freezeOrCouncilsApi } from '@/api/api'
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import PropertySettledModal from './modules/PropertySettledModal'
import UserRoleModal from './modules/UserRoleModal'
import { filterDictTextByCache } from '@/components/dict/JDictSelectUtil'
const columns = [
{
title: '社区名称',
dataIndex: 'councilsName',
key: 'councilsName',
align: 'center',
},
{
title: '联系人',
dataIndex: 'contactName',
key: 'contactName',
align: 'center',
},
{
title: '电话',
dataIndex: 'contactPhone',
key: 'contactPhone',
align: 'center',
},
{
title: '授权时间',
dataIndex: 'empowerEndDate',
scopedSlots: { customRender: 'empowerEndDate' },
align: 'center',
},
{
title: '授权小区数量',
dataIndex: 'empowerCommunityNum',
key: 'empowerCommunityNum',
align: 'center',
},
{
title: '审核状态',
dataIndex: 'auditStatus',
key: 'auditStatus',
customRender: function (text) {
return filterDictTextByCache('auditStatus', text)
},
},
{
title: '到期提示',
dataIndex: 'expirationStatus',
scopedSlots: { customRender: 'expirationStatus' },
key: 'expirationStatus',
align: 'center',
},
{
title: '冻结状态',
dataIndex: 'propertyStatus',
scopedSlots: { customRender: 'propertyStatus' },
key: 'propertyStatus',
align: 'center',
},
{
title: '操作',
dataIndex: 'action',
scopedSlots: { customRender: 'action' },
align: 'center',
fixed: 'right',
width: 150,
},
]
export default {
name: 'PermissionListAsync',
mixins: [JeecgListMixin],
components: {
PropertySettledModal,
UserRoleModal,
},
data() {
return {
// 表头
columns: columns,
loading: false,
pagination: {
total: 0,
current: 1,
pageSize: 10,
showSizeChanger: true,
},
url: {
list: '/property-central/councils/propertyCouncils/list',
delete: '/property-central/councils/propertyCouncils/delete',
deleteBatch: '/property-central/councils/propertyCouncils/deleteBatch',
},
}
},
methods: {
propertyDetails(type, id) {
if (type == 1) {
this.$router.push({
path: '/settled/communityDetails?type=add',
})
} else if (type == 2) {
this.$router.push({
path: '/settled/communityDetails?type=edit&id=' + id,
})
} else if (type == 3) {
this.$router.push({
path: '/settled/communityDetails?type=audit&id=' + id,
})
} else if (type == 4) {
this.$router.push({
path: '/settled/communityDetails?type=detail&id=' + id,
})
}
},
onLoadDetail(record, type) {
record['registAdress'] = [record.provinceCode, record.cityCode, record.countyCode]
if (type === 'edit') {
this.handleEdit(record)
} else {
this.handleDetail(record)
}
},
onChange(date, dateString) {
if (dateString.length > 0) {
this.queryParam.createTime_begin = dateString[0]
this.queryParam.createTime_end = dateString[1]
} else {
this.queryParam.createTime_begin = ''
this.queryParam.createTime_end = ''
}
},
onStatus(record) {
let that = this
this.$confirm({
title: `确认${record.propertyStatus === 'normal' ? '冻结' : '解冻'}此社区?`,
closable: true,
okText: `${record.propertyStatus === 'normal' ? '冻结' : '解冻'}`,
onOk() {
return freezeOrCouncilsApi({
id: record.id,
status: `${record.propertyStatus === 'normal' ? 'freeze' : 'normal'}`,
}).then((res) => {
that.searchQuery()
})
},
onCancel() {},
})
},
handlePerssion(roleId) {
this.$refs.modalUserRole.show(roleId)
},
},
}
</script>
<style scoped>
@import '~@assets/less/common.less';
</style>
\ No newline at end of file
<template>
<j-modal
:title="title"
:width="width"
:visible="visible"
switchFullscreen
@ok="handleOk"
:okButtonProps="{ class:{'jee-hidden': disableSubmit} }"
@cancel="handleCancel"
cancelText="关闭">
<property-settled-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit"></property-settled-form>
</j-modal>
</template>
<script>
import PropertySettledForm from './PropertySettledForm'
export default {
name: 'PropertySettledModal',
components: {
PropertySettledForm
},
data () {
return {
title:'',
width: '70%',
visible: false,
disableSubmit: false
}
},
methods: {
add () {
this.visible=true
this.$nextTick(()=>{
this.$refs.realForm.add();
})
},
edit (record) {
this.visible=true
this.$nextTick(()=>{
this.$refs.realForm.edit(record);
})
},
close () {
this.$emit('close');
this.visible = false;
},
handleOk () {
this.$refs.realForm.submitForm();
},
submitCallback(){
this.$emit('ok');
this.visible = false;
},
handleCancel () {
this.close()
}
}
}
</script>
\ No newline at end of file
<template>
<a-drawer
title="数据规则/按钮权限配置"
width="365"
:closable="false"
@close="onClose"
:visible="visible"
>
<a-tabs defaultActiveKey="1">
<a-tab-pane tab="数据规则" key="1">
<a-checkbox-group v-model="dataruleChecked" v-if="dataruleList.length>0">
<a-row>
<a-col :span="24" v-for="(item,index) in dataruleList" :key=" 'dr'+index ">
<a-checkbox :value="item.id">{{ item.ruleName }}</a-checkbox>
</a-col>
<a-col :span="24">
<div style="width: 100%;margin-top: 15px">
<a-button @click="saveDataruleForRole" type="primary" size="small" icon="save">点击保存</a-button>
</div>
</a-col>
</a-row>
</a-checkbox-group>
<div v-else><h3>无配置信息!</h3></div>
</a-tab-pane>
<!--<a-tab-pane tab="按钮权限" key="2">敬请期待!!!</a-tab-pane>-->
</a-tabs>
</a-drawer>
</template>
<script>
import ARow from 'ant-design-vue/es/grid/Row'
import ACol from 'ant-design-vue/es/grid/Col'
import { getAction,postAction } from '@/api/manage'
export default {
name: 'RoleDataruleModal',
components: { ACol, ARow },
data(){
return {
functionId:'',
roleId:'',
visible:false,
tabList: [{
key: '1',
tab: '数据规则',
}, {
key: '2',
tab: '按钮权限',
}],
activeTabKey: '1',
url:{
datarule:"/sys/role/datarule",
},
dataruleList:[],
dataruleChecked:[]
}
},
methods:{
loadData(){
getAction(`${this.url.datarule}/${this.functionId}/${this.roleId}`).then(res=>{
console.log(res)
if(res.success){
this.dataruleList = res.result.datarule
let drChecked = res.result.drChecked
if(drChecked){
this.dataruleChecked = drChecked.split(",")
}
}
})
},
saveDataruleForRole(){
if(!this.dataruleChecked || this.dataruleChecked.length==0){
this.$message.warning("请注意,现未勾选任何数据权限!")
}
let params = {
permissionId:this.functionId,
roleId:this.roleId,
dataRuleIds:this.dataruleChecked.join(",")
}
console.log("保存数据权限",params)
postAction(this.url.datarule,params).then(res=>{
if(res.success){
this.$message.success(res.message)
}else{
this.$message.error(res.message)
}
})
},
show(functionId,roleId){
this.onReset()
this.functionId = functionId
this.roleId = roleId
this.visible=true
this.loadData()
},
onClose(){
this.visible=false
this.onReset()
},
onTabChange (key) {
this.activeTabKey = key
},
onReset(){
this.functionId=''
this.roleId=''
this.dataruleList=[]
this.dataruleChecked=[]
}
}
}
</script>
<style scoped>
</style>
\ No newline at end of file
<template>
<a-drawer
:title="title"
:maskClosable="true"
width=650
placement="right"
:closable="true"
@close="close"
:visible="visible"
style="overflow: auto;padding-bottom: 53px;">
<a-form>
<a-form-item label='所拥有的权限'>
<a-tree
checkable
@check="onCheck"
:checkedKeys="checkedKeys"
:treeData="treeData"
@expand="onExpand"
@select="onTreeNodeSelect"
:selectedKeys="selectedKeys"
:expandedKeys="expandedKeysss"
:checkStrictly="checkStrictly">
<span slot="hasDatarule" slot-scope="{slotTitle,ruleFlag}">
{{ slotTitle }}<a-icon v-if="ruleFlag" type="align-left" style="margin-left:5px;color: red;"></a-icon>
</span>
</a-tree>
</a-form-item>
</a-form>
<div class="drawer-bootom-button">
<a-dropdown style="float: left" :trigger="['click']" placement="topCenter">
<a-menu slot="overlay">
<a-menu-item key="1" @click="switchCheckStrictly(1)">父子关联</a-menu-item>
<a-menu-item key="2" @click="switchCheckStrictly(2)">取消关联</a-menu-item>
<a-menu-item key="3" @click="checkALL">全部勾选</a-menu-item>
<a-menu-item key="4" @click="cancelCheckALL">取消全选</a-menu-item>
<a-menu-item key="5" @click="expandAll">展开所有</a-menu-item>
<a-menu-item key="6" @click="closeAll">合并所有</a-menu-item>
</a-menu>
<a-button>
树操作 <a-icon type="up" />
</a-button>
</a-dropdown>
<a-popconfirm title="确定放弃编辑?" @confirm="close" okText="确定" cancelText="取消">
<a-button style="margin-right: .8rem">取消</a-button>
</a-popconfirm>
<a-button @click="handleSubmit(false)" type="primary" :loading="loading" ghost style="margin-right: 0.8rem">仅保存</a-button>
<a-button @click="handleSubmit(true)" type="primary" :loading="loading">保存并关闭</a-button>
</div>
<role-datarule-modal ref="datarule"></role-datarule-modal>
</a-drawer>
</template>
<script>
import {queryTreeListByTypeForRole,queryRolePermission,saveRolePermission} from '@/api/api'
import RoleDataruleModal from './RoleDataruleModal.vue'
export default {
name: "RoleModal",
components:{
RoleDataruleModal
},
data(){
return {
roleId:"",
treeData: [],
defaultCheckedKeys:[],
checkedKeys:[],
expandedKeysss:[],
allTreeKeys:[],
autoExpandParent: true,
checkStrictly: false,
title:"物业权限配置",
visible: false,
loading: false,
selectedKeys:[]
}
},
methods: {
onTreeNodeSelect(id){
if(id && id.length>0){
this.selectedKeys = id
}
this.$refs.datarule.show(this.selectedKeys[0],this.roleId)
},
onCheck (o) {
if(this.checkStrictly){
this.checkedKeys = o.checked;
}else{
this.checkedKeys = o
}
},
show(roleId){
this.roleId=roleId
this.visible = true;
},
close () {
this.reset()
this.$emit('close');
this.visible = false;
},
onExpand(expandedKeys){
this.expandedKeysss = expandedKeys;
this.autoExpandParent = false
},
reset () {
this.expandedKeysss = []
this.checkedKeys = []
this.defaultCheckedKeys = []
this.loading = false
},
expandAll () {
this.expandedKeysss = this.allTreeKeys
},
closeAll () {
this.expandedKeysss = []
},
checkALL () {
this.checkedKeys = this.allTreeKeys
},
cancelCheckALL () {
//this.checkedKeys = this.defaultCheckedKeys
this.checkedKeys = []
},
switchCheckStrictly (v) {
if(v==1){
this.checkStrictly = false
}else if(v==2){
this.checkStrictly = true
}
},
handleCancel () {
this.close()
},
handleSubmit(exit) {
let that = this;
let params = {
roleId:that.roleId,
permissionIds:that.checkedKeys.join(","),
lastpermissionIds:that.defaultCheckedKeys.join(","),
};
that.loading = true;
console.log("请求参数:",params);
saveRolePermission(params).then((res)=>{
if(res.success){
that.$message.success(res.message);
that.loading = false;
if (exit) {
that.close()
}
}else {
that.$message.error(res.message);
that.loading = false;
if (exit) {
that.close()
}
}
this.loadData();
})
},
loadData(){
queryTreeListByTypeForRole({platformType: 'councils'}).then((res) => {
this.treeData = res.result.treeList
this.allTreeKeys = res.result.ids
queryRolePermission({roleId:this.roleId}).then((res)=>{
this.checkedKeys = [...res.result];
this.defaultCheckedKeys = [...res.result];
this.expandedKeysss = this.allTreeKeys;
console.log(this.defaultCheckedKeys)
})
})
}
},
watch: {
visible () {
if (this.visible) {
this.loadData();
}
}
}
}
</script>
<style lang="less" scoped>
.drawer-bootom-button {
position: absolute;
bottom: 0;
width: 100%;
border-top: 1px solid #e8e8e8;
padding: 10px 16px;
text-align: right;
left: 0;
background: #fff;
border-radius: 0 0 2px 2px;
}
</style>
\ No newline at end of file
...@@ -162,7 +162,7 @@ ...@@ -162,7 +162,7 @@
}) })
}, },
loadData(){ loadData(){
queryTreeListByTypeForRole().then((res) => { queryTreeListByTypeForRole({platformType: 'company'}).then((res) => {
this.treeData = res.result.treeList this.treeData = res.result.treeList
this.allTreeKeys = res.result.ids this.allTreeKeys = res.result.ids
queryRolePermission({roleId:this.roleId}).then((res)=>{ queryRolePermission({roleId:this.roleId}).then((res)=>{
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论