<template>
|
<div>
|
<a-card :bordered="false" style="margin-top: 24px">
|
<div class="tableList">
|
<div class="tableListForm">
|
<a-form layout="horizontal">
|
<a-row :gutter="{ md: 8, lg: 24, xl: 48 }">
|
<a-col :md="8" :sm="24">
|
<a-form-item fieldDecoratorId="query" v-bind="searchFormLayout">
|
<a-input type="text" placeholder="请输入名称" v-model="queryData"/>
|
</a-form-item>
|
</a-col>
|
<a-col>
|
</a-col>
|
<div class="tableListOperator1">
|
<a-button icon="plus" type="primary" @click="() => this.handleModalVisible(true)">
|
新建
|
</a-button>
|
</div>
|
</a-row>
|
</a-form>
|
</div>
|
</div>
|
<av-system-table
|
:dataSource="dataSource"
|
:columns="columns"
|
:total="total"
|
:paginationProps="pagination"
|
@cPage="turnCurrentPage">
|
</av-system-table>
|
</a-card>
|
<a-modal width="45%" title="添加-组织" destroyOnClose :visible="visibleCreateModal" @ok="saveOrgData"
|
@cancel="handleCreateModalCancel">
|
<!---->
|
<a-form style="margin-top: 8px" :form="form">
|
<a-row>
|
<a-col :md="11" :sm="24">
|
<a-form-item :labelCol="{ span: 8 }" :wrapperCol="{ span: 15 }" label="名称">
|
<a-input placeholder="名称" v-decorator="['name', { rules: [{ required: true,message: '名称不能为空'}] }]"/>
|
</a-form-item>
|
</a-col>
|
<a-col :md="11" :sm="24">
|
<a-form-item label="父组织" :labelCol="{ span: 8 }" :wrapperCol="{ span: 15 }" >
|
<a-select placeholder="请选择父组织" allowClear
|
show-search
|
option-filter-prop="children"
|
:filter-option="filterOption"
|
v-decorator="['pname', { rules: [{ required: false}] }]"
|
@change="handleChange">
|
<!-- @blur="handleBlur"-->
|
<a-select-option v-for="(item,index) of orgMenu" :value="item.id"> {{ item.name }}</a-select-option>
|
</a-select>
|
</a-form-item>
|
</a-col>
|
<a-col :md="11" :sm="24">
|
<a-form-item :labelCol="{ span: 8 }" :wrapperCol="{ span: 15 }" label="城市">
|
<a-cascader :options="areaData" placeholder="请选择城市" @change="citydata" v-decorator="['city', { rules: [{ required: true, message: '城市不能为空' }] }]"/>
|
</a-form-item>
|
</a-col>
|
<a-col :md="11" :sm="24">
|
<a-form-item :labelCol="{ span: 8 }" :wrapperCol="{ span: 15 }" label="电话" >
|
<a-input placeholder="请输入" v-decorator="['phone', { rules: [{ required: false, message: '请输入正确的号码格式' , pattern:/^(13[0-9]{9}$|14[0-9]{9}|15[0-9]{9}$|18[0-9]{9})$|(^\d{3}-\d{7,8}|\d{4}-\d{7,8})$/ }] }]"/>
|
</a-form-item>
|
</a-col>
|
<a-col :md="11" :sm="24">
|
<a-form-item :labelCol="{ span: 8 }" :wrapperCol="{ span: 15 }" label="定位级别" >
|
<a-cascader :options="areaData" placeholder="双击选择城市" change-on-select @change="positionLevel"
|
v-decorator="['position', { rules: [{ required: true, message: '定位级别不能为空' }] }]"
|
labelInValue/>
|
</a-form-item>
|
</a-col>
|
<a-col :md="11" :sm="24">
|
<a-form-item :labelCol="{ span: 8 }" :wrapperCol="{ span: 15 }" label="邮箱">
|
<a-input placeholder="请输入" v-decorator="['email', { rules: [{ required: false,message:'请输入正确邮箱格式', pattern:/^([a-zA-Z]|[0-9])(\w|\-)+@[a-zA-Z0-9]+\.([a-zA-Z]{2,4})$/}] }]"/>
|
</a-form-item>
|
</a-col>
|
<a-col :md="11" :sm="24">
|
<a-form-item :labelCol="{ span: 8 }" :wrapperCol="{ span: 15 }" label="地址" >
|
<a-input placeholder="请输入" v-decorator="['address', { rules: [{ required: true, message: '地址不能为空' }] }]"/>
|
</a-form-item>
|
</a-col>
|
<a-col :md="11" :sm="24">
|
<a-form-item :labelCol="{ span: 8 }" :wrapperCol="{ span: 15 }" label="微信">
|
<a-input placeholder="请输入" v-decorator="['wechat', { rules: [{ required: false }] }]"/>
|
</a-form-item>
|
</a-col>
|
<a-col :md="11" :sm="24">
|
<a-form-item :labelCol="{ span: 8 }" :wrapperCol="{ span: 15 }" label="有效期" >
|
<a-date-picker
|
format="YYYY-MM-DD"
|
:disabled-date="disabledDate"
|
v-decorator="['expireTime', { rules: [{ required: true, message: '日期不能为空' }] }]"
|
/>
|
</a-form-item>
|
</a-col>
|
</a-row>
|
</a-form>
|
</a-modal>
|
<a-modal width="45%" title="编辑-组织" destroyOnClose :visible="visibleEditModal" @ok="editOrgData"
|
@cancel="handleEditModalCancel">
|
<!---->
|
<a-form-model style="margin-top: 8px"
|
:model="beforeEdit"
|
:rules="rules"
|
ref="editOrgForm"
|
:label-col="{span: 4}"
|
:wrapper-col="{span: 14}">
|
<a-row>
|
<a-col :md="11" :sm="24">
|
<a-form-model-item :labelCol="{ span: 8 }" :wrapperCol="{ span: 15 }" label="名称" prop="name">
|
<a-input placeholder="名称" v-model="beforeEdit.name"/>
|
</a-form-model-item>
|
</a-col>
|
<a-col :md="11" :sm="24">
|
<a-form-model-item label="父组织" :labelCol="{ span: 8 }" :wrapperCol="{ span: 15 }">
|
|
<a-select
|
show-search
|
placeholder="请选择父组织"
|
v-model="beforeEdit.pname"
|
allowClear
|
option-filter-prop="children"
|
:filter-option="filterOption"
|
@change="handleChange">
|
<!-- @blur="handleBlur"-->
|
<a-select-option v-for="(item,index) of orgMenu" :value="item.id"> {{ item.name }}</a-select-option>
|
</a-select>
|
</a-form-model-item>
|
</a-col>
|
<a-col :md="11" :sm="24">
|
<a-form-model-item :labelCol="{ span: 8 }" :wrapperCol="{ span: 15 }" label="城市" prop="cityBack">
|
<a-cascader v-model="beforeEdit.cityBack" :options="areaData" placeholder="请选择城市" @change="vCity"
|
labelInValue/>
|
</a-form-model-item>
|
</a-col>
|
<a-col :md="11" :sm="24">
|
<a-form-model-item :labelCol="{ span: 8 }" :wrapperCol="{ span: 15 }" label="电话" prop="phone">
|
<a-input v-model="beforeEdit.phone" placeholder="请输入"/>
|
</a-form-model-item>
|
</a-col>
|
<a-col :md="11" :sm="24">
|
<a-form-model-item :labelCol="{ span: 8 }" :wrapperCol="{ span: 15 }" label="定位级别" prop="positionBack">
|
<a-cascader v-model="beforeEdit.positionBack" :options="areaData" placeholder="双击选择城市" change-on-select
|
@change="positionLevel" labelInValue/>
|
</a-form-model-item>
|
</a-col>
|
<a-col :md="11" :sm="24">
|
<a-form-model-item :labelCol="{ span: 8 }" :wrapperCol="{ span: 15 }" label="邮箱" prop="email">
|
<a-input v-model="beforeEdit.email" placeholder="请输入"/>
|
</a-form-model-item>
|
</a-col>
|
<a-col :md="11" :sm="24">
|
<a-form-model-item :labelCol="{ span: 8 }" :wrapperCol="{ span: 15 }" label="地址" prop="address">
|
<a-input v-model="beforeEdit.address" placeholder="请输入"/>
|
</a-form-model-item>
|
</a-col>
|
<a-col :md="11" :sm="24">
|
<a-form-model-item :labelCol="{ span: 8 }" :wrapperCol="{ span: 15 }" label="微信">
|
<a-input v-model="beforeEdit.wechat" placeholder="请输入"/>
|
</a-form-model-item>
|
</a-col>
|
<a-col :md="11" :sm="24">
|
<a-form-model-item :labelCol="{ span: 8 }" :wrapperCol="{ span: 15 }" label="有效期" prop="expireTime">
|
<a-date-picker v-model="beforeEdit.expireTime"/>
|
</a-form-model-item>
|
</a-col>
|
</a-row>
|
</a-form-model>
|
</a-modal>
|
<a-modal width="45%" title="菜单配置" destroyOnClose :visible="showTree" @ok="handleTreeOk" @cancel="handleTreeCancel">
|
<a-tree
|
v-model="selectMenus"
|
checkable
|
defaultExpandAll
|
:tree-data="webMenusData"
|
@check="onChangePermissionsTree"
|
/>
|
</a-modal>
|
<div class="deleteConfirm" :class="{ orDelete: !deleteConfimFlag }">
|
<p>是否删除子组织</p>
|
<span class="confimButton" @click="cancelDeleteChild">否</span>
|
<span class="confimButton" @click="okDeleteChild">是</span>
|
</div>
|
<user-account @visible="turnAccountFlag" v-if="userFlag" :visible="userFlag" :accountRecord="userRecord"/>
|
<alarm-unit-configure :alarmUFlag="alarmFlag" :alarmRecord="alarmRecord" @turnAlarmFlag="turnAlarmFlag" />
|
<configure-web :configure-flag="configureFlag" :configRecord="configRecord" @turnConfigureFlag="turnConfigureFlag"/>
|
</div>
|
</template>
|
|
<script lang="tsx">
|
import {Component, Prop, Vue, Watch} from 'vue-property-decorator';
|
import org from '@/util/org'
|
import moment from 'moment'
|
import UserAccount from '@/views/system/userAccount.vue'
|
import AlarmUnitConfigure from "@/views/system/alarmUnitConfigure.vue";
|
import ConfigureWeb from "@/views/system/configureWeb.vue";
|
import { get, post } from "@/util/request";
|
|
@Component({
|
components: {
|
UserAccount,
|
AlarmUnitConfigure,
|
ConfigureWeb
|
}
|
})
|
export default class Organization extends Vue {
|
|
private userFlag: boolean = false
|
private userRecord: any = null
|
|
private deleteConfimFlag: boolean = false
|
private updateTaskFormVisible: boolean = false;
|
private updateRecord: any = {};
|
private dataSource: any[] = []; //组织数据
|
|
private visibleCreateModal: boolean = false;
|
private visibleEditModal: boolean = false;
|
|
private areaData: any = JSON.parse(JSON.stringify(org))
|
private addForm: any = null
|
private editForm: any = null
|
private date: string = ''
|
|
// web配置flag
|
private configureFlag: boolean = false
|
// 分页数据
|
private pagination: any = {
|
total: 0,
|
current: 1,
|
pageSize: 8,
|
showSizeChanger: false,
|
showQuickJumper: false,
|
};
|
|
// 分页数据总条数
|
private total: number = 0
|
// 修改组织规则验证
|
private rules: any = {
|
name: [
|
{required: true, message: '名称不能为空', trigger: ['change', 'blur']},
|
],
|
cityBack: [
|
{required: true, message: '请选择城市', trigger: ['change', 'blur']},
|
],
|
positionBack: [
|
{required: true, message: '请选择定位级别'},
|
],
|
phone: [
|
{required: false, message: '请输入正确的电话格式', trigger: 'blur'},
|
],
|
email: [
|
{required: false, message: '请输入正确的邮箱格式', trigger: 'blur'},
|
],
|
address: [
|
{required: true, message: '地址不能为空', trigger: ['change', 'blur']},
|
],
|
expireTime: [
|
{required: true, message: '日期不能为空'},
|
]
|
}
|
// 列数据
|
private columns: any[] = [
|
{
|
title: '名称',
|
dataIndex: 'name',
|
},
|
{
|
title: '父组织',
|
dataIndex: 'parentName',
|
},
|
{
|
title: '城市',
|
dataIndex: 'provinceCityAreaName',
|
},
|
{
|
title: '定位级别',
|
dataIndex: 'locationLevelName',
|
},
|
{
|
title: '电话',
|
dataIndex: 'phone'
|
},
|
{
|
title: '邮箱',
|
dataIndex: 'email',
|
},
|
{
|
title: '地址',
|
dataIndex: 'address',
|
},
|
{
|
title: '创建时间',
|
dataIndex: 'createTime',
|
},
|
{
|
title: '到期时间',
|
dataIndex: 'expireTime',
|
},
|
{
|
title: '用户账号',
|
dataIndex: 'adminUserAccount',
|
},
|
{
|
title: '操作',
|
customRender: this.opRender
|
}
|
];
|
private codeAndName: any = null
|
private editCodeAndName: any = null
|
private queryData: string = ''
|
private form: any = null
|
private positionData: Array<any> = []
|
|
//新增表单form
|
|
// 修改前的数据(用于双向绑定)
|
private beforeEdit: any = {
|
id: 0,
|
name: '',
|
pname: '',
|
locationLevelCode: '',
|
locationLevelName: '',
|
phone: '',
|
email: '',
|
wechat: '',
|
address: '',
|
expireTime: '',
|
cityBack: [],
|
positionBack: []
|
}
|
// 修改前的数据(用于记录)
|
private record: any = null
|
// 当前页
|
private currentPage: number = 0
|
|
// 接收子组件数据
|
private turnCurrentPage(page: number) {
|
this.currentPage = page
|
}
|
|
@Watch('queryData')
|
private queryDataWatch(newVal: string, oldVal: string) {
|
this.queryData = newVal.trim()
|
this.currentPage = 1
|
this.orgData()
|
}
|
|
@Watch('currentPage')
|
private pageData() {
|
this.orgData()
|
}
|
|
private searchFormLayout: any = {
|
labelCol: {
|
span: 5,
|
},
|
wrapperCol: {
|
span: 18,
|
offset: 1,
|
},
|
};
|
|
private mounted() {
|
this.form = this.$form.createForm(this, {name: "Organization"});
|
this.orgData()
|
}
|
|
|
private queryOrg: string = ''
|
private orgMenu: any = []
|
//显示树状菜单
|
private showTree: boolean = false
|
|
private vCity(val: any, selectedOptions: any) {
|
if (selectedOptions === undefined) {
|
this.beforeEdit.cityBack = []
|
this.editCodeAndName = []
|
}else {
|
this.beforeEdit.cityBack = val
|
this.editCodeAndName = JSON.parse(JSON.stringify(selectedOptions))
|
}
|
}
|
|
// 获取所有组织信息
|
private getAllOrg() {
|
if (this.record === null) {
|
get("organization/queryNames", {
|
name: this.queryOrg,
|
}).then(res => {
|
this.orgMenu = res.data.data.organizationVOs
|
})
|
} else {
|
get("organization/queryNames", {
|
name: this.queryOrg,
|
id: this.record.id
|
}).then(res => {
|
this.orgMenu = res.data.data.organizationVOs
|
})
|
}
|
|
}
|
|
private handleEditModalCancel(): any {
|
this.beforeEdit.cityBack = []
|
this.beforeEdit.positionBack = []
|
this.visibleEditModal = false;
|
}
|
|
// 隐藏弹框
|
private handleCreateModalCancel(): any {
|
this.visibleCreateModal = false;
|
}
|
|
// 显示增加弹框
|
private handleModalVisible(isVisible: boolean): void {
|
this.record = null
|
this.getAllOrg()
|
this.visibleCreateModal = isVisible;
|
}
|
|
// 城市数据
|
private citydata(val: any, selectedOptions: any) {
|
if (selectedOptions === undefined) {
|
this.codeAndName = []
|
}else {
|
this.codeAndName = JSON.parse(JSON.stringify(selectedOptions))
|
}
|
|
}
|
|
// 定位级别数据
|
private positionLevel(val: any, selectedOptions: any) {
|
if (selectedOptions === undefined) {
|
this.beforeEdit.positionBack = []
|
this.positionData = []
|
}else {
|
this.beforeEdit.positionBack = val
|
this.positionData = JSON.parse(JSON.stringify(selectedOptions))
|
}
|
}
|
|
// 日期格式转换
|
private turnDate(date: any) {
|
let d = new Date(date);
|
// let datetime=d.getFullYear() + '-' + (d.getMonth() + 1) + '-' + d.getDate() + ' ' + d.getHours() + ':' + d.getMinutes() + ':' + d.getSeconds();
|
let datetime = d.getFullYear() + '-' +( (d.getMonth() + 1).toString().length === 1 ? '0'+(d.getMonth() + 1) : (d.getMonth() + 1) )+
|
'-' +( d.getDate().toString().length === 1 ? '0' + d.getDate() : d.getDate());
|
this.date = datetime
|
}
|
|
// 禁止点击当前时间之前的时间
|
private disabledDate(current: any) {
|
// Can not select days before today and today
|
return current && current < moment().endOf('day');
|
}
|
|
//保存数据
|
private saveOrgData() {
|
this.form.validateFields((err: any, values: any) => {
|
if (err) {
|
return;
|
}
|
this.turnDate(values.expireTime)
|
post("organization/insert",
|
{
|
name: values.name.replace(/\s+/g, ""),
|
parentId: values.pname ? values.pname : '',
|
provinceCode: this.codeAndName[0].value ? this.codeAndName[0].value : '',
|
provinceName: this.codeAndName[0].label ? this.codeAndName[0].label : '',
|
cityCode: this.codeAndName[1].value ? this.codeAndName[1].value : '',
|
cityName: this.codeAndName[1].label ? this.codeAndName[1].label : '',
|
areaCode: this.codeAndName[2].value ? this.codeAndName[2].value : '',
|
areaName: this.codeAndName[2].label ? this.codeAndName[2].label : '',
|
locationLevelCode: this.positionData[this.positionData.length - 1].value,
|
locationLevelName: this.positionData[this.positionData.length - 1].label,
|
address: values.address ? values.address : '',
|
phone: values.phone ? values.phone : '',
|
email: values.email ? values.email : '',
|
wechat: values.wechat ? values.wechat : '',
|
expireTime: this.date ? this.date : ''
|
},
|
).then(res => {
|
if (res.data.code === 0) {
|
this.visibleCreateModal = false;
|
this.$message.success('添加成功')
|
this.positionData = []
|
this.orgData()
|
}
|
})
|
})
|
|
|
}
|
|
private parentName: any = ''
|
|
// 修改数据
|
private editOrgData(): void {
|
|
this.$refs.editOrgForm.validate((valid: any) => {
|
if (valid) {
|
this.parentName = ''
|
let locationLevelCode = null
|
let locationLevelName = null
|
if (this.positionData.length === 0) {
|
locationLevelCode = null
|
locationLevelName = null
|
} else {
|
locationLevelCode = this.positionData[this.positionData.length - 1].value
|
locationLevelName = this.positionData[this.positionData.length - 1].label
|
}
|
// 父组织没有变动
|
if ((typeof this.beforeEdit.pname) === 'string') {
|
for (let i = 0; i < this.orgMenu.length; i++) {
|
if (this.beforeEdit.pname === this.orgMenu[i].name) {
|
this.parentName = null
|
break
|
}
|
}
|
}
|
// 删除父组织
|
if ((typeof this.beforeEdit.pname) === 'undefined') {
|
this.parentName = 0
|
}
|
|
let name = this.record.name === this.beforeEdit.name ? null : this.beforeEdit.name
|
|
let parentId = this.parentName === null ? null :
|
(this.parentName === 0 && this.beforeEdit.pname === undefined && this.record.parentName === null) ? null :
|
this.beforeEdit.pname === undefined ? 0 : this.beforeEdit.pname
|
let provinceCode = this.editCodeAndName === null ? null : this.editCodeAndName[0].value
|
let provinceName = this.editCodeAndName === null ? null : this.editCodeAndName[0].label
|
let cityCode = this.editCodeAndName === null ? null : this.editCodeAndName[1].value
|
let cityName = this.editCodeAndName === null ? null : this.editCodeAndName[1].label
|
let areaCode = this.editCodeAndName === null ? null : this.editCodeAndName[2].value
|
let areaName = this.editCodeAndName === null ? null : this.editCodeAndName[2].label
|
let address = this.record.address === this.beforeEdit.address ? null : this.beforeEdit.address
|
let phone = this.record.phone === this.beforeEdit.phone ? null : this.beforeEdit.phone
|
let email = this.record.email === this.beforeEdit.email ? null : this.beforeEdit.email
|
let wechat = this.record.wechat === this.beforeEdit.wechat ? null : this.beforeEdit.wechat
|
this.turnDate(this.beforeEdit.expireTime)
|
let expireTime = this.date === this.record.expireTime ? null : this.date
|
|
if (name || parentId || parentId === 0 || provinceName || provinceName || cityCode || cityName || locationLevelCode || locationLevelName ||
|
areaCode || areaName || address || (phone || phone === '') || (email || email === '') || (wechat || wechat === '') || expireTime) {
|
post("organization/update",
|
{
|
organizationId: this.record.id,
|
name: name,
|
parentId: parentId,
|
provinceCode: provinceCode,
|
provinceName: provinceName,
|
cityCode: cityCode,
|
cityName: cityName,
|
areaCode: areaCode,
|
areaName: areaName,
|
locationLevelCode: locationLevelCode,
|
locationLevelName: locationLevelName,
|
address: address,
|
phone: phone,
|
email: email,
|
wechat: wechat,
|
expireTime: expireTime
|
}
|
).then(res => {
|
if (res.data.code === 0) {
|
this.orgData()
|
this.positionData = []
|
this.visibleEditModal = false;
|
this.$message.success(res.data.message)
|
}else {
|
this.$message.warning(res.data.message)
|
}
|
})
|
}else {
|
this.$message.warning('未修改')
|
}
|
|
|
}else {
|
return;
|
}
|
})
|
|
}
|
|
|
// 删除组织
|
private deleteOrg(id: any, deleteChildren: number) {
|
post("organization/delete",
|
{
|
organizationId: id,
|
deleteChildren: deleteChildren
|
}
|
).then(res => {
|
if (res.data.code === 0) {
|
this.$message.success(res.data.message)
|
this.orgData()
|
}
|
})
|
}
|
|
// 获取组织列表数据
|
private orgData() {
|
get("organization/query", {
|
page: this.currentPage,
|
size: this.pagination.pageSize,
|
name: this.queryData,
|
order: 'createTime',
|
orderType: 1
|
}).then(res => {
|
this.dataSource = res.data.data.organizations
|
this.pagination.current = res.data.data.current
|
this.pagination.total = res.data.data.total
|
this.pagination.pageSize = res.data.data.size
|
if (res.data.data.current - 1 === res.data.data.pages) {
|
this.currentPage = res.data.data.pages
|
this.orgData()
|
}
|
})
|
}
|
|
|
// 账号信息管理
|
private handleAccountModalVisible(visible: boolean, record: any) {
|
this.userFlag = visible
|
this.userRecord = record
|
}
|
|
// 编辑组织信息
|
private handleEditModalVisible(visible: boolean, record: any): void {
|
this.record = record
|
this.getAllOrg()
|
this.beforeEdit.name = record.name
|
this.beforeEdit.address = record.address
|
this.beforeEdit.pname = record.parentName === null ? undefined : record.parentName
|
this.beforeEdit.expireTime = record.expireTime
|
this.beforeEdit.phone = record.phone
|
this.beforeEdit.email = record.email
|
this.beforeEdit.wechat = record.wechat
|
this.beforeEdit.cityBack = []
|
this.beforeEdit.cityBack.push(record.provinceCode)
|
this.beforeEdit.cityBack.push(record.cityCode)
|
this.beforeEdit.cityBack.push(record.areaCode)
|
if (JSON.stringify(record.locationLevelCode).substring(2, 6) === '0000') {
|
this.beforeEdit.positionBack.push(record.locationLevelCode)
|
} else {
|
this.beforeEdit.positionBack = []
|
if (JSON.stringify(record.locationLevelCode).substring(4, 6) === '00') {
|
this.beforeEdit.positionBack.push(parseInt((JSON.stringify(record.locationLevelCode).substring(0, 2) + '0000')))
|
this.beforeEdit.positionBack.push(record.locationLevelCode)
|
} else {
|
this.beforeEdit.positionBack.push(parseInt((JSON.stringify(record.locationLevelCode).substring(0, 2) + '0000')))
|
this.beforeEdit.positionBack.push(parseInt((JSON.stringify(record.locationLevelCode).substring(0, 4) + '00')))
|
this.beforeEdit.positionBack.push(record.locationLevelCode)
|
}
|
}
|
// this.$refs.city.push(record.locationLevelCode)
|
this.visibleEditModal = visible;
|
}
|
|
private deleteId: any = -1
|
|
private cancelDeleteChild() {
|
this.deleteOrg(this.deleteId, 0)
|
this.deleteConfimFlag = false
|
}
|
|
private okDeleteChild() {
|
this.deleteOrg(this.deleteId, 1)
|
this.deleteConfimFlag = false
|
}
|
|
private handleChange(value: any) {
|
|
// this.beforeEdit.pname = value != null && value != '' ? value : [];
|
}
|
|
private filterOption(input: any, option: any) {
|
return (
|
option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
|
);
|
}
|
|
// 所有前端菜单
|
private webMenusData: any[] = []
|
// 指定组织选中的菜单
|
private selectMenus: any[] = []
|
|
/*
|
* 树形方法 --------------------------------------------------------------------
|
* */
|
private checkKey!: any
|
private autoExpandParent: boolean = true
|
|
private onSelect(selectedKeys: any[], info: any) {
|
// this.selectedKeys = selectedKeys;
|
}
|
|
private onCheck(expandedKeys: any) {
|
// if not set autoExpandParent to false, if children expanded, parent can not collapse.
|
// or, you can remove all expanded children keys.
|
// this.autoExpandParent = false;
|
}
|
|
private handleTreeCancel() {
|
this.showTree = false
|
}
|
|
private menuIds!: any[]
|
|
private onChangePermissionsTree(node: any, event: any) {
|
this.menuIds = []
|
let halfKeys = event.halfCheckedKeys
|
this.menuIds = node.concat(halfKeys)
|
}
|
|
private oId: any = -2
|
|
private handleTreeOk() {
|
if (this.menuIds) {
|
if (this.menuIds[0] === -1) {
|
this.showTree = false
|
} else {
|
post("group/updateAdminGroupMenu",
|
{
|
organizationId: this.oId,
|
channelKey: 0,
|
menuIds: this.menuIds
|
}
|
).then((res: any) => {
|
if (res.data.code === 0) {
|
this.$message.success(res.data.message)
|
this.showTree = false
|
}
|
})
|
}
|
}
|
|
this.menuIds = [-1]
|
}
|
|
|
// 选择菜单
|
private webMenu: any[] = []
|
|
private selectWebMenu(record: any) {
|
this.oId = record.id
|
this.webMenusData = []
|
this.showTree = true
|
get('menu/query', {}).then((res: any) => {
|
this.webMenu = res.data.data.menus
|
this.treeDatas(this.webMenu)
|
})
|
this.selectedWeb(record)
|
}
|
|
//已选前端菜单
|
private selectedWeb(record: any) {
|
get("menu/queryAdmin", {
|
organizationId: record.id
|
}).then(res => {
|
if (res.data.code === 0) {
|
let datas = res.data.data.menus
|
let array = []
|
for (let i in datas) {
|
array.push(datas[i].id)
|
}
|
this.selectMenus = array
|
}
|
})
|
}
|
|
// 递归更改数据格式
|
private treeDatas(datas: any[]) {
|
for (let i in datas) {
|
if (datas[i].children) {
|
datas[i].key = datas[i].id
|
datas[i].title = datas[i].name
|
delete datas[i].name
|
delete datas[i].url
|
delete datas[i].order
|
delete datas[i].id
|
this.treeDatas(datas[i].children)
|
} else {
|
datas[i].title = datas[i].name
|
datas[i].key = datas[i].id
|
datas[i].parentId = datas[i].parentId
|
delete datas[i].name
|
delete datas[i].url
|
delete datas[i].order
|
delete datas[i].id
|
}
|
}
|
this.webMenusData = datas
|
}
|
|
private showOrHidden() {
|
this.showTree = false
|
}
|
|
private turnAccountFlag(flag: boolean) {
|
this.userFlag = flag
|
}
|
|
// 配置报警以及显示单位===============================================
|
private alarmFlag: boolean = false
|
private turnAlarmFlag(flag: boolean) {
|
this.alarmFlag = flag
|
}
|
private alarmRecord: any = null
|
private displayUnitAndAlarm(record: any) {
|
this.alarmRecord = record
|
this.alarmFlag = true
|
}
|
|
// 接受大屏配置flag
|
private turnConfigureFlag(flag: boolean) {
|
this.configureFlag = flag
|
}
|
|
// 存放组织record
|
private configRecord: any = null
|
// 大屏布局model隐藏显示
|
private configureWebLayout(record: any) {
|
this.configRecord = record
|
this.configureFlag = true
|
}
|
|
private opRender(text: string, record: any, index: number) {
|
return (<div>
|
<a onClick={
|
() => this.handleEditModalVisible(true, record)
|
}> 编辑 </a>
|
<a-divider type='vertical'/>
|
<a-popconfirm
|
title="请确认删除"
|
ok-text="是"
|
cancel-text="否"
|
onConfirm={() => {
|
this.deleteId = record.id
|
this.deleteConfimFlag = true
|
}}
|
oncancel="1"
|
>
|
<a>删除</a>
|
</a-popconfirm>
|
<a-divider type='vertical'/>
|
<a onClick={
|
() => this.handleAccountModalVisible(true, record)
|
}>
|
账号
|
</a>
|
<a-divider type='vertical'/>
|
<a onClick={
|
() => this.selectWebMenu(record)
|
}>
|
前端菜单配置
|
</a>
|
<a-divider type='vertical'/>
|
<a-dropdown>
|
<a class="ant-dropdown-link">
|
更多 <a-icon type="down"/></a>
|
<a-menu slot="overlay">
|
<a-menu-item>
|
<a onClick={() => this.displayUnitAndAlarm(record)}>报警信息配置</a>
|
</a-menu-item>
|
<a-menu-item>
|
<a onClick={() => this.configureWebLayout(record)}>配置大屏布局</a>
|
</a-menu-item>
|
</a-menu>
|
</a-dropdown>
|
</div>);
|
}
|
}
|
</script>
|
|
<style lang="less">
|
.tableList {
|
.tableListOperator1 {
|
margin-bottom: 16px;
|
|
button {
|
margin-right: 8px;
|
margin-top: 3px;
|
}
|
}
|
}
|
|
.orDelete {
|
display: none;
|
}
|
|
.deleteConfirm {
|
width: 16%;
|
height: 100px;
|
background-color: white;
|
position: fixed;
|
top: 220px;
|
left: 48%;
|
z-index: 2;
|
border-radius: 10px;
|
border: 1px solid red;
|
}
|
|
.confimButton {
|
width: 30%;
|
display: inline-block;
|
text-align: center;
|
height: 25px;
|
margin-left: 14%;
|
background-color: #00A0E9;
|
color: white;
|
height: 24px;
|
line-height: 24px;
|
border-radius: 4px;
|
/*margin-top: 5px;*/
|
}
|
|
.confimButton:hover {
|
opacity: 0.8;
|
}
|
|
.deleteConfirm p {
|
width: 100%;
|
text-align: center;
|
margin-top: 25px;
|
font-size: 16px;
|
color: red;
|
}
|
|
/*.ant-calendar-picker{*/
|
/* width: 180%;*/
|
/*}*/
|
</style>
|