提交 6dd0b4b4 authored 作者: 赵明's avatar 赵明

小区商铺

上级 cb4d61a7
...@@ -48,6 +48,7 @@ const loadAllRoleIds = (params)=>getAction("/sys/permission/loadAllRoleIds",para ...@@ -48,6 +48,7 @@ const loadAllRoleIds = (params)=>getAction("/sys/permission/loadAllRoleIds",para
const getPermissionRuleList = (params)=>getAction("/sys/permission/getPermRuleListByPermId",params); const getPermissionRuleList = (params)=>getAction("/sys/permission/getPermRuleListByPermId",params);
const queryPermissionRule = (params)=>getAction("/sys/permission/queryPermissionRule",params); const queryPermissionRule = (params)=>getAction("/sys/permission/queryPermissionRule",params);
const queryTreeListByTypeForRole = (params)=>getAction("/sys/role/queryTreeListByType",{...params, platformType: 'committee'}); const queryTreeListByTypeForRole = (params)=>getAction("/sys/role/queryTreeListByType",{...params, platformType: 'committee'});
const queryTreeListByTypeForRoles = (params)=>getAction("/sys/role/queryTreeListByType",{...params, platformType: 'shop'});
// 部门管理 // 部门管理
const queryDepartTreeList = (params)=>getAction("/sys/sysDepart/queryTreeList",params); const queryDepartTreeList = (params)=>getAction("/sys/sysDepart/queryTreeList",params);
...@@ -117,7 +118,12 @@ const getAccountListByIdApi = (params)=>getAction("/property-community/property/ ...@@ -117,7 +118,12 @@ const getAccountListByIdApi = (params)=>getAction("/property-community/property/
const communityAuditAccountPageApi = (params)=>postAction("/property-community/property/communityReconciliation/communityAudit",params); const communityAuditAccountPageApi = (params)=>postAction("/property-community/property/communityReconciliation/communityAudit",params);
const getCommunityRecordListApi = (params)=>getAction("/property-central/property/auditRecord/getRecordList",params); const getCommunityRecordListApi = (params)=>getAction("/property-central/property/auditRecord/getRecordList",params);
const communitySubCompanyApi = (params)=>getAction("/property-community/property/communityReconciliation/communitySubCompany",params); const communitySubCompanyApi = (params)=>getAction("/property-community/property/communityReconciliation/communitySubCompany",params);
// 商铺管理
const shopAuditApi = (params)=>postAction("/property-central/shop/shopInfo/audit",params);
const shopDeleteApi = (params)=>deleteAction("/property-central/shop/shopCommunity/delete",params);
const shopDetailApi = (params)=>getAction("/property-central/shop/shopInfo/queryById",params);
const freezeOrThawApi = (params)=>getAction(`/property-central/shop/shopInfo/freezeOrThaw/${params.id}/${params.status}`,params);
const shopCommunityApi = (params)=>getAction("/property-central/shop/shopCommunity/list",params);
// 分利规则管理 // 分利规则管理
const getRuleDayDetailApi = (params)=>getAction("/property-central/sharerule/settlementSet/queryById?id=1",params); const getRuleDayDetailApi = (params)=>getAction("/property-central/sharerule/settlementSet/queryById?id=1",params);
// 分利对账管理 // 分利对账管理
...@@ -200,6 +206,7 @@ export { ...@@ -200,6 +206,7 @@ export {
getPermissionRuleList, getPermissionRuleList,
queryPermissionRule, queryPermissionRule,
queryTreeListByTypeForRole, queryTreeListByTypeForRole,
queryTreeListByTypeForRoles,
queryDepartTreeList, queryDepartTreeList,
queryDepartTreeSync, queryDepartTreeSync,
queryIdTree, queryIdTree,
...@@ -272,7 +279,12 @@ export { ...@@ -272,7 +279,12 @@ export {
geCommunityDeleteApi, geCommunityDeleteApi,
getRuleDayDetailApi, getRuleDayDetailApi,
getshareBenefitApi, getshareBenefitApi,
getshareBalanceApi getshareBalanceApi,
shopAuditApi,
shopDeleteApi,
shopDetailApi,
freezeOrThawApi,
shopCommunityApi
} }
......
...@@ -47,3 +47,7 @@ export const isValidPermit = permit=> { ...@@ -47,3 +47,7 @@ export const isValidPermit = permit=> {
const reg = /^[HMhm]{1}([0-9]{10}|[0-9]{8})$/; //港澳通行证 const reg = /^[HMhm]{1}([0-9]{10}|[0-9]{8})$/; //港澳通行证
return reg.test(permit) return reg.test(permit)
} }
/* 校验字母*/
export function alphanumeric(s) {
return /^[a-zA-Z]+$/.test(s)
}
<template>
<a-spin :spinning="confirmLoading">
<div class="title-top">
<h3>{{title}}</h3>
<div class="button"><a-button @click="onCancel">返回</a-button>
<a-button type="primary" @click="submitForm" v-if="pageType == 'edit' || pageType == 'add' ">保存</a-button>
<a-button type="danger" @click="onExamine(2)" v-if="pageType == 'audit'">审核驳回</a-button>
<a-button type="primary" @click="onExamine(1)" v-if="pageType == 'audit'">审核通过</a-button>
</div>
</div>
<j-form-container :disabled="pageType=='detail' || pageType=='audit'||creditCodeChangeBool">
<a-form-model ref="form" :model="model" :rules="validatorRules" slot="detail">
<a-card title="新增商铺基本信息">
<a-row>
<a-col :span="12">
<a-form-model-item label="关联楼栋单元" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="roomId" v-if="!(pageType=='detail' || pageType=='audit')">
<a-tree-select
v-model=" model.roomId"
style="width: 100%"
:defaultExpandAll="true"
:dropdown-style="{ maxHeight: '400px', overflow: 'auto' }"
:tree-data="treeData"
:load-data="onLoadData"
placeholder="请选择关联房屋"
@select="onSelectRoom"
/>
</a-form-model-item>
<a-form-model-item v-else label="关联楼栋单元" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="roomName">
<a-input v-model="model.roomName" placeholder="请输入商铺名称"></a-input>
</a-form-model-item>
</a-col>
<a-col :span="12">
<p style="line-height:30px">{{model.buildingName}}{{model.unitName}}{{model.roomName}}</p>
</a-col>
</a-row>
<a-row>
<a-col :span="12">
<a-form-model-item label="商铺名称" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="shopName">
<a-input v-model="model.shopName" placeholder="请输入商铺名称"></a-input>
</a-form-model-item>
</a-col>
<a-col :span="12">
<a-form-model-item label="营业执照代码" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="creditCode">
<a-input v-model="model.creditCode" placeholder="请输入营业执照代码" @blur="creditCodeChange"></a-input>
</a-form-model-item>
</a-col>
<a-col :span="12">
<a-form-model-item label="法人代表" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="legalName">
<a-input v-model="model.legalName" placeholder="请输入法人代表"></a-input>
</a-form-model-item>
</a-col>
</a-row>
<a-row>
<a-col :span="12">
<a-form-model-item label="联系人" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="contactName">
<a-input v-model="model.contactName" placeholder="请输入联系人"></a-input>
</a-form-model-item>
</a-col>
<a-col :span="12">
<a-form-model-item label="联系人电话" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="contactPhone">
<a-input @blur="contactPhoneChange" v-model="model.contactPhone" placeholder="请输入联系人电话"></a-input>
</a-form-model-item>
</a-col>
<a-col :span="12">
<a-form-model-item label="注册地址" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="registAdress">
<area-cascader v-model="model.registAdress" :data="pcaa" :level="1" type="all" @change="addressChange"
style="width:100%" />
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item label="详细地址" :labelCol="{ xs:{ span: 24 }, sm:{ span: 3 } }" :wrapperCol="wrapperCol"
prop="addressInfo">
<a-input v-model="model.addressInfo" placeholder="请输入详细地址" @blur="addressBlur"></a-input>
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item label="" :offset="3" :pull="3" :labelCol="{ xs:{ span: 24 }, sm:{ span: 3 } }">
<div class="hhh">
<div id="container" style="width:100%;height:200px"></div>
</div>
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item label="LOGO" :labelCol="{ xs:{ span: 24 }, sm:{ span: 3 } }" :wrapperCol="wrapperCol"
prop="logoUrl">
<j-image-upload bizPath="scott/pic" v-model="model.logoUrl"></j-image-upload>
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item label="介绍" :labelCol="{ xs:{ span: 24 }, sm:{ span: 3 } }" :wrapperCol="wrapperCol"
prop="shopContent">
<a-textarea v-model="model.shopContent" placeholder="请输入介绍" :maxLength="500"
:auto-size="{ minRows: 3, maxRows: 5 }" />
</a-form-model-item>
</a-col>
</a-row>
</a-card>
<a-card title="商铺管理员">
<a-row>
<a-col :span="12">
<a-form-model-item label="管理员账户" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="adminLoginName">
<a-input v-model="model.adminLoginName" placeholder="请输入管理员账户"></a-input>
</a-form-model-item>
</a-col>
<a-col :span="12">
<a-form-model-item label="管理员密码" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="adminPassword">
<a-input v-model="model.adminPassword" placeholder="请输入管理员密码"></a-input>
</a-form-model-item>
</a-col>
<a-col :span="12" style="position:relative">
<a-form-model-item label="访问域名前缀" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="accessAddress"
v-if="pageType=='add' || pageType=='edit'">
<a-input v-model="model.accessAddress" placeholder="请输入访问域名前缀"
addon-after=".shop.hjxbc.cn"></a-input>
</a-form-model-item>
<a-form-model-item label="访问域名" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="accessAddress"
:disabled="false" v-else>
<p v-if="model.accessAddress">{{ model.accessAddress }}.shop.hjxbc.cn</p>
</a-form-model-item>
<a @click="onCopyLink" v-if="model.accessAddress" style="position:absolute;top:0;right:-10px;line-height:40px;z-index:999;pointer-events:auto;">复制</a>
</a-col>
</a-row>
</a-card>
<a-card title="商铺二维码" v-if="pageType != 'add'">
<a-row>
<img :src="shopQrcode" alt="商铺二维码" class="shopQrcode">
</a-row>
</a-card>
<a-card title="审核记录" v-if="pageType != 'add'">
<a-row>
<a-table
ref="table"
size="middle"
bordered
rowKey="id"
:columns="columns"
:dataSource="dataSource"
:pagination="false"
:loading="loading"
class="j-table-force-nowrap"
>
</a-table>
</a-row>
</a-card>
</a-form-model>
</j-form-container>
</a-spin>
</template>
<script>
import { filterDictTextByCache } from '@comp/dict/JDictSelectUtil'
const mapZoom = [5, 8, 10, 12]
let timer = null
import {shopDetailApi, shopAuditApi, getBuildingListApi, getUnitListApi, getRoomListApi} from '@/api/api'
import { httpAction, getAction } from '@/api/manage'
import { isMobile, alphanumeric } from '@/utils/validate'
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import {axios} from '@/utils/request'
const columns = [
{
title: '操作人',
dataIndex: 'createBy',
key: 'createBy',
align: 'center',
},
{
title: '部门',
dataIndex: 'departName',
key: 'departName',
align: 'center',
},
{
title: '操作类型',
dataIndex: 'operateType',
key: 'operateType',
align: 'center',
},
{
title: '审核状态',
dataIndex: 'auditStatus',
key: 'auditStatus',
align: 'center',
},
{
title: '操作时间',
dataIndex: 'createTime',
key: 'createTime',
align: 'center',
}
]
export default {
name: 'PropertySettledForm',
mixins: [JeecgListMixin],
inject: ['closeCurrent'],
data() {
const validateToNextPhone = (rule, value, callback) => {
if (value && isMobile(value)) {
callback()
} else {
callback('请输入正确的联系人电话!')
}
}
const isAlphanumeric = (rule, value, callback) => {
if (value && alphanumeric(value)) {
callback()
} else {
callback('请输入带字母的域名前缀')
}
}
return {
title: '',
pageType: '',
columns: columns,
creditCodeChangeBool: false,
pcaa: this.$Jpcaa,
model: {
buildingId: '',
buildingName: '',
unitId: '',
unitName: '',
roomId: '',
roomName: '',
useTo: '',
shopName: '',
legalName: '',
creditCode: '',
contactName: '',
contactPhone: '',
registAdress: [],
provinceName: '',
provinceCode: '',
cityName: '',
cityCode: '',
countyName: '',
countyCode: '',
addressInfo: '',
logoUrl: '',
shopContent: '',
chargingStandardId: '',
contractUrl: '',
longitude: '',
latitude: '',
accessAddress: '',
},
labelCol: {
xs: { span: 24 },
sm: { span: 6 },
},
wrapperCol: {
xs: { span: 24 },
sm: { span: 16 },
},
confirmLoading: false,
validatorRules: {
roomId: [{ required: true, message: '请选择关联房屋', trigger: 'change' }],
shopName: [{ required: true, message: '请输入商铺名称', trigger: 'blur' }],
legalName: [{ required: true, message: '请输入法人代表', trigger: 'blur' }],
creditCode: [{ required: true, message: '请输入营业执照代码', trigger: 'blur' }],
contactName: [{ required: true, message: '请输入联系人', trigger: 'blur' }],
contactPhone: [
{ required: true, message: '请输入联系人电话', trigger: 'blur' },
{ validator: validateToNextPhone },
],
registAdress: [{ required: true, message: '请选择注册地址', trigger: 'change' }],
addressInfo: [{ required: true, message: '请输入详细地址', trigger: 'blur' }],
logoUrl: [{ required: true, message: '请上传LOGO', trigger: 'change' }],
adminLoginName: [{ required: true, message: '请输入管理员账号', trigger: 'blur' }],
adminPassword: [{ required: true, message: '请输入管理员密码', trigger: 'blur' }],
accessAddress: [
{ required: true, message: '请输入访问域名前缀', trigger: 'blur' },
{ validator: isAlphanumeric },
],
},
url: {
list: '/property-central/property/auditRecord/list?settledId='+this.$route.query.id,
code: '/property-central/shop/shopInfo/getList',
add: '/property-central/shop/shopInfo/add',
edit: '/property-central/shop/shopInfo/edit',
},
treeData: [],
shopQrcode: '',
mapRef: null,
}
},
computed: {
formDisabled() {
return this.disabled
},
},
watch: {
'model.addressInfo': {
handler(newV) {
if (newV) {
clearTimeout(timer)
timer = setTimeout(() => {
// this.getLongitude(this.model.categoryCodes[0], this.model.categoryCodes.join('') + newV, mapZoom[3])
}, 1000)
}
},
},
},
created() {
//备份model原始值
//this.modelDefault = JSON.parse(JSON.stringify(this.model))
this.pageType = this.$route.query.type
if (this.$route.query.type == 'add') {
this.title = '新增'
} else if (this.$route.query.type == 'edit') {
this.title = '编辑'
} else if (this.$route.query.type == 'audit') {
this.title = '审核'
} else if (this.$route.query.type == 'detail') {
this.title = '详情'
}
if (this.$route.query.id) {
this.getPageDetail()
}
},
mounted() {
this.getBuildingList()
this.mapRef = new BMapGL.Map('container') // 创建地图实例
var point = new BMapGL.Point(108.5525, 34.3237) // 创建点坐标
this.mapRef.centerAndZoom(point, mapZoom[0])
// var zoomCtrl = new BMapGL.ZoomControl(); // 添加缩放控件
// this.mapRef.addControl(zoomCtrl);
this.mapRef.enableScrollWheelZoom(true) //开启鼠标滚轮缩放
this.mapRef.addEventListener('click', (e) => this.getAddress(e))
},
methods: {
async getBuildingList() {
let {result} = await getBuildingListApi()
this.treeData = result.map(item=> {
return {
value: item.id,
label: item.buildingName,
pId: 0,
disabled: true
}
})
},
shopQrcodes() {
axios('/property-central/shop/shopInfo/getQrCode?shopCode='+this.model.shopCode+'&platformType=cell',{ responseType: 'blob',}).then(res=>{
this.shopQrcode = window.URL.createObjectURL(new Blob([res]))
console.log(this.shopQrcode)
})
},
onSelectRoom(value, node) {
let data = node.dataRef
this.model.roomId = data.value
this.model.roomName = data.label
this.model.useTo = data.useTo
this.model.floorSpace = data.floorSpace
this.model.unitId = data.parent.value
this.model.unitName = data.parent.label
this.model.buildingId = data.parent.parent.value
this.model.buildingName = data.parent.parent.label
console.log(this.model)
},
onLoadData(treeNode) {
return new Promise(async resolve => {
if (treeNode.dataRef.children) {
resolve();
return;
}
if(treeNode.pos.split('-').length === 2) { // 单元
let {result} = await getUnitListApi({id: treeNode.eventKey})
treeNode.dataRef.children = result.map(item=> {
return {
value: item.id,
label: item.unitName,
pId: treeNode.dataRef.id,
parent: {...treeNode.dataRef},
disabled: true
}
})
this.treeData = [...this.treeData];
resolve();
} else { // 房屋
let {result} = await getRoomListApi({id: treeNode.eventKey})
treeNode.dataRef.children = result.map(item=> {
return {
value: item.id,
label: item.roomNum,
pId: treeNode.dataRef.id,
useTo: item.useTo,
floorSpace: item.floorSpace,
parent: {...treeNode.dataRef},
isLeaf: true
}
})
this.treeData = [...this.treeData];
resolve();
}
});
},
async getPageDetail() {
let { result } = await shopDetailApi({ id: this.$route.query.id })
this.edit(result)
if (result.provinceName) {
this.getLongitude(
result.provinceName,
result.provinceName + result.cityName + result.countyName + result.addressInfo,
mapZoom[3]
)
}
},
onCancel() {
this.closeCurrent()
},
creditCodeChange() {
getAction(this.url.code, { creditCode: this.model.creditCode }).then(res => {
console.log(res)
if (res.success) {
if(res.result.length > 0){
this.creditCodeChangeBool = true;
this.creditCodeChangeBoolBool = true;
}else {
this.creditCodeChangeBool = false;
}
}
})
},
contactPhoneChange(e) {
if (!this.model.adminLoginName) {
this.model.adminLoginName = e.target.value
}
},
edit(record) {
this.model = Object.assign({}, record)
this.shopQrcodes()
this.model.registAdress = [record.provinceCode, record.cityCode, record.countyCode]
this.visible = true
},
onExamine(type) {
const that = this
if (type == 1) {
return shopAuditApi({
id: this.$route.query.id,
auditStatus: 'auditPass',
}).then((res) => {
that.$message.success('审核通过成功')
that.$emit('ok')
this.onCancel()
})
} else if (type == 2) {
return shopAuditApi({
id: this.$route.query.id,
auditStatus: 'refuse',
}).then((res) => {
that.$message.success('审核驳回成功')
this.onCancel()
})
}
},
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
)
},
onCopyLink() {
let txa = document.createElement("textarea");
txa.value = this.model.accessAddress + '.shop.hjxbc.cn'
document.body.appendChild(txa);
txa.select();
document.execCommand("copy");
document.body.removeChild(txa);
this.$message.success("复制成功!");
},
submitForm() {
const that = this
// 触发表单验证
this.$refs.form.validate((valid) => {
if (valid) {
that.confirmLoading = true
let httpurl = ''
let method = ''
if (!this.model.id) {
httpurl += this.url.add
method = 'post'
} else {
httpurl += this.url.edit
method = 'put'
}
//this.model.registAdress = undefined
httpAction(httpurl, this.model, method)
.then((res) => {
if (res.success) {
that.$message.success(res.message)
that.$emit('ok')
this.onCancel()
} else {
that.$message.warning(res.message)
}
})
.finally(() => {
that.confirmLoading = false
})
}
})
},
},
beforeDestroy() {
clearTimeout(timer)
this.mapRef.removeEventListener('click', (e) => this.getAddress(e))
},
}
</script>
<style lang="less" scoped>
.title-top {
background: #fff;
padding: 0 25px;
line-height: 50px;
height: 50px;
margin-bottom: 5px;
h3 {
font-weight: bold;
display: inline-block;
}
.button {
float: right;
.ant-btn {
margin-left: 15px;
}
}
}
</style>
<style>
.area-select {
width: 100% !important;
}
.anchorBL{
visibility: hidden;
}
</style>
\ No newline at end of file
<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="商铺名称">
<a-input placeholder="请输入商铺名称" v-model="queryParam.shopName"></a-input>
</a-form-item>
</a-col>
<a-col :md="6" :sm="8">
<a-form-item label="入驻时间">
<a-input placeholder="请选择入驻时间" v-model="queryParam.createTime"></a-input>
</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="shopDetails(1)" type="primary" icon="plus">添加</a-button>
</div>
<!-- table区域-begin -->
<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="buildingName" slot-scope="text, record">
<span>{{`${record.buildingName}-${record.unitName}-${record.roomName}`}}</span>
</span>
<span slot="shopStatus" slot-scope="text, record">
<span v-if="record.shopStatus=='normal'" class="success">正常</span>
<span v-if="record.shopStatus=='freeze'" class="error">冻结</span>
</span>
<span slot="action" slot-scope="text, record">
<a href="javascript:;"
@click="onShopStatus(record)">{{record.shopStatus === 'normal' ? '冻结' : '解冻'}}</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 @click="shopDetails(4,record.id )">详情</a>
</a-menu-item>
<a-menu-item v-if="record.auditStatus != 'auditPass'">
<a @click="shopDetails(3, record.id)">编辑</a>
</a-menu-item>
<a-menu-item v-if="record.auditStatus != 'auditPass'">
<a @click="shopDetails(2, record.id)">审核</a>
</a-menu-item>
<a-menu-item>
<a-popconfirm title="确定删除吗?" @confirm="() => handleDeletes(record.shopCode)" placement="topLeft">
<a>删除</a>
</a-popconfirm>
</a-menu-item>
</a-menu>
</a-dropdown>
</span>
<!-- 字符串超长截取省略号显示 -->
</a-table>
</div>
<!-- table区域-end -->
<!-- 右侧的角色权限配置 -->
<user-role-modal ref="modalUserRole"></user-role-modal>
</a-card>
</template>
<script>
import {freezeOrThawApi, shopDeleteApi, shopAuditApi} from '@/api/api'
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import JEllipsis from '@/components/jeecg/JEllipsis'
import JUpload from '@/components/jeecg/JUpload'
import UserRoleModal from './modules/UserRoleModal'
import {filterDictTextByCache} from '@/components/dict/JDictSelectUtil'
const columns = [
{
title: '商铺名称',
dataIndex: 'shopName',
key: 'shopName',
align: 'center',
},
{
title: '营业执照编码',
dataIndex: 'creditCode',
key: 'creditCode',
align: 'center',
},
{
title: '法人',
dataIndex: 'legalName',
key: 'legalName',
align: 'center',
},
{
title: '电话',
dataIndex: 'contactPhone',
key: 'contactPhone',
align: 'center',
},
{
title: '房屋编号',
dataIndex: 'buildingName',
key: 'buildingName',
align: 'center',
scopedSlots: { customRender: 'buildingName' },
},
{
title: '添加时间',
dataIndex: 'createTime',
key: 'createTime',
align: 'center',
},
{
title: '审核状态',
dataIndex: 'auditStatus',
key: 'auditStatus',
align: 'center',
customRender: function(text) {
return filterDictTextByCache('auditStatus', text);
}
},
{
title: '冻结/解冻',
dataIndex: 'shopStatus',
key: 'shopStatus',
align: 'center',
scopedSlots: { customRender: 'shopStatus' },
},
{
title: '操作',
dataIndex: 'action',
scopedSlots: { customRender: 'action' },
align: 'center',
width: 150
}
]
export default {
name: 'PermissionListAsync',
mixins: [JeecgListMixin],
components: {
JEllipsis,
JUpload,
UserRoleModal
},
data() {
return {
// 表头
columns: columns,
loading: false,
pagination: {
total: 0,
current: 1,
pageSize: 10,
showSizeChanger: true
},
url: {
list: "/property-central/shop/shopInfo/list",
audit: "/property-central/shop/shopInfo/audit",
},
labelCol: { span: 6 },
wrapperCol: { span: 14 },
other: '',
uploadDisabled: false
}
},
methods: {
onLoadDetail(record, type) {
record['registAdress'] = [record.provinceCode, record.cityCode, record.countyCode]
if(type === 'edit') {
this.handleEdit(record)
} else {
this.handleDetail(record)
}
},
shopDetails(type, id) {
if (type == 1) {
this.$router.push({
path: '/shops/ShopDetail?type=add',
})
} else if (type == 2) {
this.$router.push({
path: '/shops/ShopDetail?type=audit&id=' + id,
})
}else if (type == 3) {
this.$router.push({
path: '/shops/ShopDetail?type=edit&id=' + id,
})
}else if (type == 4) {
this.$router.push({
path: '/shops/ShopDetail?type=detail&id=' + id,
})
}
},
handleDeletes(id) {
shopDeleteApi({shopCode:id}).then(res=> {
this.$message.success(res.message);
this.loadData()
})
},
onShopStatus(record) {
let that = this
this.$confirm({
title: `确认${record.shopStatus === 'normal' ? '冻结' : '解冻'}?`,
closable: true,
okText: `${record.shopStatus === 'normal' ? '冻结' : '解冻'}`,
onOk() {
return freezeOrThawApi({
id: record.id,
status: `${record.shopStatus === 'normal' ? 'freeze' : 'normal'}`,
}).then((res) => {
that.searchQuery()
})
},
onCancel() {},
})
},
handlePerssion(roleId) {
this.$refs.modalUserRole.show(roleId)
},
}
}
</script>
<style scoped>
@import '~@assets/less/common.less';
</style>
<style>
.success{
color: #52c41a;
}
.warning{
color: #fa8c16;
}
.error{
color: #f5222d;
}
</style>
\ 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>
<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 {queryTreeListByTypeForRoles,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(){
queryTreeListByTypeForRoles({platformType: 'shop'}).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>
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论