This commit is contained in:
2021-04-30 16:57:29 +08:00
12 changed files with 257 additions and 194 deletions

View File

@@ -94,6 +94,8 @@ namespace Ewide.Core
new SysDictData{Id="375362c8-d694-40d9-8c55-07669e472460", TypeId="a2068ed1-62a6-463c-b720-06111d994079", Value="本部门数据", Code="3", Sort=100, Remark="本部门数据", Status=0 }, new SysDictData{Id="375362c8-d694-40d9-8c55-07669e472460", TypeId="a2068ed1-62a6-463c-b720-06111d994079", Value="本部门数据", Code="3", Sort=100, Remark="本部门数据", Status=0 },
new SysDictData{Id="70afe4c1-3495-483a-bdd0-3d4ea45136b3", TypeId="a2068ed1-62a6-463c-b720-06111d994079", Value="仅本人数据", Code="4", Sort=100, Remark="仅本人数据", Status=0 }, new SysDictData{Id="70afe4c1-3495-483a-bdd0-3d4ea45136b3", TypeId="a2068ed1-62a6-463c-b720-06111d994079", Value="仅本人数据", Code="4", Sort=100, Remark="仅本人数据", Status=0 },
new SysDictData{Id="6f395e69-8add-40ae-a378-0881d64a4413", TypeId="a2068ed1-62a6-463c-b720-06111d994079", Value="自定义数据", Code="5", Sort=100, Remark="自定义数据", Status=0 }, new SysDictData{Id="6f395e69-8add-40ae-a378-0881d64a4413", TypeId="a2068ed1-62a6-463c-b720-06111d994079", Value="自定义数据", Code="5", Sort=100, Remark="自定义数据", Status=0 },
new SysDictData{Id="2285a101-70b3-4492-a5d7-2605448d99b3", TypeId="a2068ed1-62a6-463c-b720-06111d994079", Value="本部门所在区域及以下区域", Code="6", Sort=100, Remark="本部门所在区域及以下区域", Status=0 },
new SysDictData{Id="0b471624-f9a2-4f0a-9ff5-9cb12414fec0", TypeId="a2068ed1-62a6-463c-b720-06111d994079", Value="仅本部门所在区域数据", Code="7", Sort=100, Remark="仅本部门所在区域数据", Status=0 },
new SysDictData{Id="a819d549-6107-43a2-99d2-377cf0a5681a", TypeId="688f9a69-ec95-46f4-87bb-e19e3cc5c7fc", Value="app", Code="1", Sort=100, Remark="app", Status=0 }, new SysDictData{Id="a819d549-6107-43a2-99d2-377cf0a5681a", TypeId="688f9a69-ec95-46f4-87bb-e19e3cc5c7fc", Value="app", Code="1", Sort=100, Remark="app", Status=0 },
new SysDictData{Id="b1e821b3-4e7b-4e60-a67f-a40d327ab6d6", TypeId="688f9a69-ec95-46f4-87bb-e19e3cc5c7fc", Value="pc", Code="2", Sort=100, Remark="pc", Status=0 }, new SysDictData{Id="b1e821b3-4e7b-4e60-a67f-a40d327ab6d6", TypeId="688f9a69-ec95-46f4-87bb-e19e3cc5c7fc", Value="pc", Code="2", Sort=100, Remark="pc", Status=0 },
new SysDictData{Id="2bce5da0-b386-4412-935d-d081b7cf4391", TypeId="688f9a69-ec95-46f4-87bb-e19e3cc5c7fc", Value="其他", Code="3", Sort=100, Remark="其他", Status=0 }, new SysDictData{Id="2bce5da0-b386-4412-935d-d081b7cf4391", TypeId="688f9a69-ec95-46f4-87bb-e19e3cc5c7fc", Value="其他", Code="3", Sort=100, Remark="其他", Status=0 },

View File

@@ -145,7 +145,8 @@ namespace Ewide.Core.Service
.Select(u => new .Select(u => new
{ {
u.Code, u.Code,
u.Value u.Value,
u.Remark
}).ToListAsync(); }).ToListAsync();
} }

View File

@@ -1,6 +1,12 @@
<template> <template>
<div id="app"> <div id="app">
<a-config-provider :locale="zh_CN"> <a-config-provider :locale="zh_CN">
<template #renderEmpty>
<div class="text-center pt-md">
<a-icon class="h3 mb-md" type="smile" />
<p>暂无数据</p>
</div>
</template>
<router-view /> <router-view />
</a-config-provider> </a-config-provider>
</div> </div>
@@ -17,4 +23,4 @@ export default {
}; };
}, },
}; };
</script> </script>

View File

@@ -1,4 +1,5 @@
@import (reference) '~@/assets/style/main.less'; @import (reference) '~@/assets/style/main.less';
@layout-header-background: #1c2127;
.dark { .dark {
.main(@nav-background: @layout-header-background; .main(@nav-background: @layout-header-background;
@nav-box-shadow-color: fade(@black, 25%); @nav-box-shadow-color: fade(@black, 25%);

View File

@@ -1,4 +1,6 @@
@import (reference) '~@/assets/style/extend.less'; @import (reference) '~@/assets/style/extend.less';
.ant-cascader-picker-arrow { .ant-cascader-picker-arrow {
transform: scaleY(.75); svg {
transform: scaleY(.75);
}
} }

View File

@@ -40,6 +40,7 @@
background-color: @white; background-color: @white;
@box-shadow-focused: 0 0 0 2px fade(@primary-color, 50%); @box-shadow-focused: 0 0 0 2px fade(@primary-color, 50%);
@control-background: lighten(@black, 95%) !important;
&::before, &::before,
&::after { &::after {
content: none; content: none;
@@ -60,7 +61,7 @@
color: lighten(@black, 10%); color: lighten(@black, 10%);
border: 0; border: 0;
background-color: lighten(@black, 95%) !important; background-color: @control-background;
} }
.ant-mentions { .ant-mentions {
textarea { textarea {
@@ -103,6 +104,9 @@
z-index: 0; z-index: 0;
} }
} }
.ant-cascader-picker-clear {
background-color: @control-background;
}
} }
.ant-form-item-label { .ant-form-item-label {
overflow: hidden; overflow: hidden;

View File

@@ -114,6 +114,7 @@ export default {
this.data = this.onClearChildren(res) this.data = this.onClearChildren(res)
this.pagination = false this.pagination = false
} }
}).finally(() => {
this.onLoaded() this.onLoaded()
}) })
}, },

View File

@@ -1,4 +1,5 @@
import Swiper from 'swiper' import Swiper from 'swiper'
import { Empty } from 'ant-design-vue'
let timer, swiper let timer, swiper
@@ -107,7 +108,7 @@ export default {
this.$nextTick(() => { this.$nextTick(() => {
this.onUpdateSwiper() this.onUpdateSwiper()
}) })
}).finally(() => {
this.loading = false this.loading = false
}) })
}, },
@@ -256,7 +257,17 @@ export default {
<div class="swiper-slide"> <div class="swiper-slide">
<a-spin style={{ height: '100%' }} spinning={this.loading}> <a-spin style={{ height: '100%' }} spinning={this.loading}>
<a-icon slot="indicator" type="loading" spin /> <a-icon slot="indicator" type="loading" spin />
<a-tree {...{ props, on, scopedSlots }} /> {
!this.loading && !this.list.length ?
<a-empty description={false} class="ant-list-empty-text">
<template slot="image">
<a-icon class="h3 mt-xl mb-md" type="smile" />
<p>暂无数据</p>
</template>
</a-empty>
:
<a-tree {...{ props, on, scopedSlots }} />
}
</a-spin> </a-spin>
</div> </div>
</div> </div>

View File

@@ -4,11 +4,11 @@
<a-icon slot="indicator" spin type="loading" /> <a-icon slot="indicator" spin type="loading" />
<div class="yo-form-group"> <div class="yo-form-group">
<!-- 表单控件 --> <!-- 表单控件 -->
<a-form-model-item label="字典值" prop="value"> <a-form-model-item label="文本" prop="value">
<a-input placeholder="请输入字典值" v-model="form.value" /> <a-input placeholder="请输入文本" v-model="form.value" />
</a-form-model-item> </a-form-model-item>
<a-form-model-item label="唯一编码" prop="code"> <a-form-model-item label="字典值" prop="code">
<a-input placeholder="请输入唯一编码" v-model="form.code" /> <a-input placeholder="请输入字典值" v-model="form.code" />
</a-form-model-item> </a-form-model-item>
<a-form-model-item label="排序" prop="sort"> <a-form-model-item label="排序" prop="sort">
<a-input-number class="w-100-p" placeholder="请输入排序" v-model="form.sort" /> <a-input-number class="w-100-p" placeholder="请输入排序" v-model="form.sort" />

View File

@@ -4,11 +4,11 @@
<div class="yo-query-bar"> <div class="yo-query-bar">
<a-form-model :model="query" layout="inline"> <a-form-model :model="query" layout="inline">
<!-- 此处添加查询表单控件 --> <!-- 此处添加查询表单控件 -->
<a-form-model-item label="字典值"> <a-form-model-item label="文本">
<a-input placeholder="请输入字典值" v-model="query.value" /> <a-input placeholder="请输入文本" v-model="query.value" />
</a-form-model-item> </a-form-model-item>
<a-form-model-item label="唯一编码"> <a-form-model-item label="字典值">
<a-input placeholder="请输入唯一编码" v-model="query.code" /> <a-input placeholder="请输入字典值" v-model="query.code" />
</a-form-model-item> </a-form-model-item>
<a-form-model-item> <a-form-model-item>
<a-button-group> <a-button-group>
@@ -71,12 +71,12 @@ export default {
}, },
columns: [ columns: [
{ {
title: '字典值', title: '文本',
dataIndex: 'value', dataIndex: 'value',
sorter: true, sorter: true,
}, },
{ {
title: '唯一编码', title: '字典值',
dataIndex: 'code', dataIndex: 'code',
sorter: true, sorter: true,
}, },

View File

@@ -1,170 +1,205 @@
<template> <template>
<a-modal <a-modal
:confirmLoading="confirmLoading" :confirmLoading="confirmLoading"
:visible="visible" :visible="visible"
:width="600" :width="600"
@cancel="onCancel" @cancel="onCancel"
@ok="onOk" @ok="onOk"
title="授权数据" class="yo-modal-form"
> title="授权数据"
<a-spin :spinning="loading"> >
<a-icon slot="indicator" spin type="loading" /> <a-spin :spinning="loading">
<a-form-model :model="form" :rules="rules" class="yo-form" ref="form"> <a-icon slot="indicator" spin type="loading" />
<div class="yo-form-group"> <a-form-model :model="form" :rules="rules" class="yo-form" ref="form">
<a-form-model-item has-feedback label="授权范围" prop="dataScopeType"> <div class="yo-form-group">
<a-select placeholder="请选择授权范围" v-model="form.dataScopeType"> <a-form-model-item label="授权范围" prop="dataScopeType">
<a-select-option <a-select placeholder="请选择授权范围" v-model="form.dataScopeType">
:key="item.code" <a-select-option
:value="item.code" :key="item.code"
@click="onChange(item.code)" :value="item.code"
v-for="item in dataScopeTypeData" @click="onChange(item.code)"
>{{ item.value }}</a-select-option> v-for="item in dataScopeTypeData"
</a-select> >{{ item.value }}</a-select-option>
</a-form-model-item> </a-select>
<a-form-model-item label="选择机构" v-show="orgTreeShow"> </a-form-model-item>
<a-tree-select <a-form-model-item label="选择机构" v-show="isDefine">
:show-checked-strategy="SHOW_PARENT" <a-tree-select
:tree-data="orgTreeData" :show-checked-strategy="SHOW_PARENT"
placeholder="请选择机构" :tree-data="orgTreeData"
tree-checkable placeholder="请选择机构"
v-model="checkedKeys" tree-checkable
/> v-model="orgCheckedKeys"
</a-form-model-item> />
</div> </a-form-model-item>
</a-form-model> <a-form-model-item label="选择区域" v-show="isDefine">
</a-spin> <a-tree-select
</a-modal> :replace-fields="{ title: 'name', value: 'code', children: 'children' }"
</template> :show-checked-strategy="SHOW_PARENT"
:tree-data="areaTreeData"
<script> placeholder="请选择所属区域"
import { TreeSelect } from 'ant-design-vue'; tree-checkable
const SHOW_PARENT = TreeSelect.SHOW_PARENT; v-model="areaCheckedKeys"
/>
export default { </a-form-model-item>
data() { </div>
return { </a-form-model>
visible: false, </a-spin>
confirmLoading: false, </a-modal>
loading: true, </template>
record: {}, <script>
import { TreeSelect } from 'ant-design-vue';
form: { const SHOW_PARENT = TreeSelect.SHOW_PARENT;
dataScopeType: '',
}, export default {
rules: { data() {
dataScopeType: [{ required: true, message: '请选择授权范围' }], return {
}, visible: false,
confirmLoading: false,
SHOW_PARENT, loading: true,
orgTreeData: [],
record: {},
checkedKeys: [],
dataScopeTypeData: [], form: {
orgTreeShow: false, dataScopeType: '',
replaceFields: { },
key: 'id', rules: {
}, dataScopeType: [{ required: true, message: '请选择授权范围' }],
}; },
},
SHOW_PARENT,
methods: { orgTreeData: [],
async onOpen(record) { orgCheckedKeys: [],
this.visible = true;
this.record = record; areaTreeData: [],
areaCheckedKeys: [],
this.loading = true;
dataScopeTypeData: [],
await this.onLoadCodes(); isDefine: false,
this.form.dataScopeType = record.dataScopeType.toString(); replaceFields: {
key: 'id',
await this.onChange(record.dataScopeType); },
};
this.loading = false; },
},
methods: {
/** async onOpen(record) {
* 加载字典数据时的必要方法 this.visible = true;
*/ this.record = record;
onLoadCodes() {
return this.$api this.loading = true;
.$queue([this.$api.sysDictTypeDropDownAwait({ code: 'data_scope_type' })])
.then(([dataScopeType]) => { await this.onLoadCodes();
this.dataScopeTypeData = dataScopeType.data; this.form.dataScopeType = record.dataScopeType.toString();
});
}, await this.onChange(record.dataScopeType);
async onChange(value) { this.loading = false;
if (value == '5') { },
this.loading = true;
this.orgTreeShow = true; /**
// * 加载字典数据时的必要方法
this.orgTreeData = await this.onLoadTreeData(); */
// onLoadCodes() {
this.checkedKeys = await this.onLoadRoleOwn(); return this.$api
.$queue([this.$api.sysDictTypeDropDownAwait({ code: 'data_scope_type' })])
this.loading = false; .then(([dataScopeType]) => {
} else { this.dataScopeTypeData = dataScopeType.data;
this.orgTreeShow = false; });
// },
this.checkedKeys = [];
} async onChange(value) {
}, if (value == '5') {
this.loading = true;
/** this.isDefine = true;
* 获取机构 //
*/ this.orgTreeData = await this.onLoadOrgTreeData();
onLoadTreeData() { //
return this.$api.getOrgTree().then(({ data }) => { this.areaTreeData = await this.onLoadAreaTreeData();
return data; //
}); this.orgCheckedKeys = await this.onLoadRoleOwn();
},
this.loading = false;
/** } else {
* 此角色已有数据列表 this.isDefine = false;
*/ //
onLoadRoleOwn() { this.orgCheckedKeys = [];
return this.$api.sysRoleOwnData({ id: this.record.id }).then(({ data }) => { }
return data; },
});
}, /**
* 获取机构树
onOk() { */
this.$refs.form.validate((valid) => { onLoadOrgTreeData() {
if (valid) { return this.$api.getOrgTree().then(({ data }) => {
this.confirmLoading = true; return data;
this.$api });
.sysRoleGrantData({ },
id: this.record.id,
grantOrgIdList: this.checkedKeys, onLoadAreaTreeData() {
dataScopeType: this.form.dataScopeType, return this.$api.getAreaTree().then(({ data }) => {
}) // ,children
.then(({ success }) => { const clearChiildren = (data) => {
if (success) { data.forEach((item) => {
this.$message.success('授权成功'); if (item.children && item.children.length) {
this.$emit('ok'); clearChiildren(item.children);
this.onCancel(); } else {
} delete item.children;
}) }
.finally(() => { });
this.confirmLoading = false; };
}); clearChiildren(data);
} return data;
}); });
}, },
onCancel() {
this.visible = false; /**
* 此角色已有数据列表
setTimeout(() => { */
this.record = {}; onLoadRoleOwn() {
this.checkedKeys = []; return this.$api.sysRoleOwnData({ id: this.record.id }).then(({ data }) => {
this.dataScopeTypeData = []; return data;
this.orgTreeShow = false; });
this.form = {}; },
this.$refs.form.resetFields(); onOk() {
}, 300); this.$refs.form.validate((valid) => {
}, if (valid) {
}, this.confirmLoading = true;
}; this.$api
</script> .sysRoleGrantData({
id: this.record.id,
grantOrgIdList: this.orgCheckedKeys,
grantAreaCodeList: this.areaCheckedKeys,
dataScopeType: this.form.dataScopeType,
})
.then(({ success }) => {
if (success) {
this.$message.success('授权成功');
this.$emit('ok');
this.onCancel();
}
})
.finally(() => {
this.confirmLoading = false;
});
}
});
},
onCancel() {
this.visible = false;
setTimeout(() => {
this.record = {};
this.orgCheckedKeys = [];
this.areaCheckedKeys = [];
this.dataScopeTypeData = [];
this.isDefine = false;
this.form = {};
this.$refs.form.resetFields();
}, 300);
},
},
};
</script>

View File

@@ -50,7 +50,7 @@
</Auth> </Auth>
<Auth auth="sysRole:grantData"> <Auth auth="sysRole:grantData">
<a-menu-item> <a-menu-item>
<a @click="onOpen('org-form', record)">授权数据</a> <a @click="onOpen('data-form', record)">授权数据</a>
</a-menu-item> </a-menu-item>
</Auth> </Auth>
</a-menu> </a-menu>
@@ -64,20 +64,20 @@
<add-form @ok="onReloadData" ref="add-form" /> <add-form @ok="onReloadData" ref="add-form" />
<edit-form @ok="onReloadData" ref="edit-form" /> <edit-form @ok="onReloadData" ref="edit-form" />
<menu-form @ok="onReloadData" ref="menu-form" /> <menu-form @ok="onReloadData" ref="menu-form" />
<org-form @ok="onReloadData" ref="org-form" /> <data-form @ok="onReloadData" ref="data-form" />
</container> </container>
</template> </template>
<script> <script>
import AddForm from './addForm'; import AddForm from './addForm';
import editForm from './editForm'; import EditForm from './editForm';
import menuForm from './menuForm'; import MenuForm from './menuForm';
import orgForm from './orgForm'; import DataForm from './dataForm';
export default { export default {
components: { components: {
AddForm, AddForm,
editForm, EditForm,
menuForm, MenuForm,
orgForm, DataForm,
}, },
data() { data() {
return { return {