Skip to content

Commit df5e2f4

Browse files
YunaiVgitee-org
authored andcommitted
!13 解决同事所提pr i12冲突问题
Merge pull request !13 from 周建/master
2 parents 2f98d5c + 853dab7 commit df5e2f4

File tree

10 files changed

+189
-49
lines changed

10 files changed

+189
-49
lines changed

src/components/XTable/src/XTable.vue

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import { useAppStore } from '@/store/modules/app'
1212
import { useDesign } from '@/hooks/web/useDesign'
1313
import { XTableProps } from './type'
1414
import { isBoolean, isFunction } from '@/utils/is'
15-
15+
import styleCss from './style/dark.scss'
1616
import download from '@/utils/download'
1717
1818
const { t } = useI18n()
@@ -25,15 +25,38 @@ const prefixCls = getPrefixCls('x-vxe-table')
2525
2626
const attrs = useAttrs()
2727
const emit = defineEmits(['register'])
28-
28+
const removeStyles = () => {
29+
var filename = 'cssTheme'
30+
//移除引入的文件名
31+
var targetelement = 'style'
32+
var targetattr = 'id'
33+
var allsuspects = document.getElementsByTagName(targetelement)
34+
for (var i = allsuspects.length; i >= 0; i--) {
35+
if (
36+
allsuspects[i] &&
37+
allsuspects[i].getAttribute(targetattr) != null &&
38+
allsuspects[i].getAttribute(targetattr)?.indexOf(filename) != -1
39+
) {
40+
console.log(allsuspects[i], 'node')
41+
allsuspects[i].parentNode?.removeChild(allsuspects[i])
42+
}
43+
}
44+
}
45+
const reImport = () => {
46+
var head = document.getElementsByTagName('head')[0]
47+
var style = document.createElement('style')
48+
style.innerText = styleCss
49+
style.id = 'cssTheme'
50+
head.appendChild(style)
51+
}
2952
watch(
3053
() => appStore.getIsDark,
3154
() => {
3255
if (appStore.getIsDark == true) {
33-
import('./style/dark.scss')
56+
reImport()
3457
}
3558
if (appStore.getIsDark == false) {
36-
import('./style/light.scss')
59+
removeStyles()
3760
}
3861
},
3962
{ immediate: true }

src/views/bpm/form/formEditor.vue

Lines changed: 44 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,21 @@
33
<!-- 表单设计器 -->
44
<fc-designer ref="designer" height="780px">
55
<template #handle>
6+
<XButton type="primary" title="生成JSON" @click="showJson" />
7+
<XButton type="primary" title="生成Options" @click="showOption" />
68
<XButton type="primary" :title="t('action.save')" @click="handleSave" />
79
</template>
810
</fc-designer>
11+
<Dialog :title="dialogTitle" v-model="dialogVisible1" maxHeight="600">
12+
<div ref="editor" v-if="dialogVisible1">
13+
<XTextButton style="float: right" :title="t('common.copy')" @click="copy(formValue)" />
14+
<el-scrollbar height="580">
15+
<pre>
16+
{{ formValue }}
17+
</pre>
18+
</el-scrollbar>
19+
</div>
20+
</Dialog>
921
<!-- 表单保存的弹窗 -->
1022
<XModal v-model="dialogVisible" title="保存表单">
1123
<el-form ref="formRef" :model="formValues" :rules="formRules" label-width="80px">
@@ -48,13 +60,18 @@ import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
4860
import { CommonStatusEnum } from '@/utils/constants'
4961
import * as FormApi from '@/api/bpm/form'
5062
import { encodeConf, encodeFields, setConfAndFields } from '@/utils/formCreate'
63+
import { useClipboard } from '@vueuse/core'
64+
5165
const { t } = useI18n() // 国际化
5266
const message = useMessage() // 消息
5367
const { query } = useRoute() // 路由
5468
5569
const designer = ref() // 表单设计器
56-
70+
const type = ref(-1)
71+
const formValue = ref('')
72+
const dialogTitle = ref('')
5773
const dialogVisible = ref(false) // 弹窗是否展示
74+
const dialogVisible1 = ref(false) // 弹窗是否展示
5875
const dialogLoading = ref(false) // 弹窗的加载中
5976
const formRef = ref<FormInstance>()
6077
const formRules = reactive({
@@ -98,7 +115,32 @@ const submitForm = async () => {
98115
dialogLoading.value = false
99116
}
100117
}
101-
118+
const showJson = () => {
119+
openModel('生成JSON')
120+
type.value = 0
121+
formValue.value = designer.value.getRule()
122+
}
123+
const showOption = () => {
124+
openModel('生成Options')
125+
type.value = 1
126+
formValue.value = designer.value.getOption()
127+
}
128+
const openModel = (title: string) => {
129+
dialogVisible1.value = true
130+
dialogTitle.value = title
131+
}
132+
/** 复制 **/
133+
const copy = async (text: string) => {
134+
const { copy, copied, isSupported } = useClipboard({ source: text })
135+
if (!isSupported) {
136+
message.error(t('common.copyError'))
137+
} else {
138+
await copy()
139+
if (unref(copied)) {
140+
message.success(t('common.copySuccess'))
141+
}
142+
}
143+
}
102144
// ========== 初始化 ==========
103145
onMounted(() => {
104146
// 场景一:新增表单

src/views/bpm/group/group.data.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ const crudSchemas = reactive<VxeCrudSchema>({
1616
primaryType: 'id',
1717
primaryTitle: '编号',
1818
action: true,
19+
searchSpan: 8,
1920
columns: [
2021
{
2122
title: '组名',

src/views/bpm/oa/leave/leave.data.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ const crudSchemas = reactive<VxeCrudSchema>({
1616
primaryTitle: '申请编号',
1717
action: true,
1818
actionWidth: '260',
19+
searchSpan: 8,
1920
columns: [
2021
{
2122
title: t('common.status'),

src/views/bpm/task/todo/todo.data.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ const crudSchemas = reactive<VxeCrudSchema>({
77
primaryKey: 'id',
88
primaryType: null,
99
action: true,
10+
searchSpan: 8,
1011
columns: [
1112
{
1213
title: '任务编号',

src/views/system/role/index.vue

Lines changed: 49 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -99,36 +99,41 @@
9999
</el-select>
100100
</el-form-item>
101101
<!-- 分配角色的菜单权限对话框 -->
102-
<el-form-item
103-
label="权限范围"
104-
v-if="
105-
actionScopeType === 'menu' || dataScopeForm.dataScope === SystemDataScopeEnum.DEPT_CUSTOM
106-
"
107-
>
108-
<el-card shadow="never">
109-
<template #header>
110-
父子联动(选中父节点,自动选择子节点):
111-
<el-switch v-model="checkStrictly" inline-prompt active-text="" inactive-text="" />
112-
全选/全不选:
113-
<el-switch
114-
v-model="treeNodeAll"
115-
inline-prompt
116-
active-text=""
117-
inactive-text=""
118-
@change="handleCheckedTreeNodeAll()"
119-
/>
120-
</template>
121-
<el-tree
122-
ref="treeRef"
123-
node-key="id"
124-
show-checkbox
125-
:check-strictly="!checkStrictly"
126-
:props="defaultProps"
127-
:data="treeOptions"
128-
empty-text="加载中,请稍后"
129-
/>
130-
</el-card>
131-
</el-form-item>
102+
<el-row>
103+
<el-col :span="24">
104+
<el-form-item
105+
label="权限范围"
106+
v-if="
107+
actionScopeType === 'menu' ||
108+
dataScopeForm.dataScope === SystemDataScopeEnum.DEPT_CUSTOM
109+
"
110+
style="display: flex"
111+
>
112+
<el-card class="card" shadow="never">
113+
<template #header>
114+
<!--父子联动(选中父节点,自动选择子节点):-->
115+
<!--<el-switch v-model="checkStrictly" inline-prompt active-text="是" inactive-text="否" />-->
116+
<!--全选/全不选:-->
117+
<!--<el-switch-->
118+
<!-- v-model="treeNodeAll"-->
119+
<!-- inline-prompt-->
120+
<!-- active-text="是"-->
121+
<!-- inactive-text="否"-->
122+
<!-- @change="handleCheckedTreeNodeAll()"-->
123+
<!--/>-->
124+
</template>
125+
<el-tree
126+
ref="treeRef"
127+
node-key="id"
128+
show-checkbox
129+
:check-strictly="!checkStrictly"
130+
:props="defaultProps"
131+
:data="treeOptions"
132+
empty-text="加载中,请稍后"
133+
/>
134+
</el-card>
135+
</el-form-item> </el-col
136+
></el-row>
132137
</el-form>
133138
<!-- 操作按钮 -->
134139
<template #footer>
@@ -245,18 +250,17 @@ const dialogScopeTitle = ref('数据权限')
245250
const actionScopeType = ref('')
246251
const dataScopeDictDatas = ref()
247252
// 选项
248-
const checkStrictly = ref(true)
249-
const treeNodeAll = ref(false)
253+
const checkStrictly = ref(false)
254+
// const treeNodeAll = ref(false)
250255
// 全选/全不选
251-
const handleCheckedTreeNodeAll = () => {
252-
treeRef.value!.setCheckedNodes(treeNodeAll.value ? treeOptions.value : [])
253-
}
256+
// const handleCheckedTreeNodeAll = () => {
257+
// treeRef.value!.setCheckedNodes(treeNodeAll.value ? treeOptions.value : [])
258+
// }
254259
// 权限操作
255260
const handleScope = async (type: string, row: RoleApi.RoleVO) => {
256261
dataScopeForm.id = row.id
257262
dataScopeForm.name = row.name
258263
dataScopeForm.code = row.code
259-
260264
actionScopeType.value = type
261265
dialogScopeVisible.value = true
262266
if (type === 'menu') {
@@ -265,7 +269,7 @@ const handleScope = async (type: string, row: RoleApi.RoleVO) => {
265269
const role = await PermissionApi.listRoleMenusApi(row.id)
266270
if (role) {
267271
role?.forEach((item: any) => {
268-
unref(treeRef)?.setChecked(item, true,false);
272+
unref(treeRef)?.setChecked(item, true, false)
269273
})
270274
}
271275
} else if (type === 'data') {
@@ -275,11 +279,10 @@ const handleScope = async (type: string, row: RoleApi.RoleVO) => {
275279
dataScopeForm.dataScope = role.dataScope
276280
if (role.dataScopeDeptIds) {
277281
role.dataScopeDeptIds?.forEach((item: any) => {
278-
unref(treeRef)?.setChecked(item, true,false);
282+
unref(treeRef)?.setChecked(item, true, false)
279283
})
280284
}
281285
}
282-
283286
}
284287
// 保存权限
285288
const submitScope = async () => {
@@ -314,3 +317,10 @@ onMounted(() => {
314317
init()
315318
})
316319
</script>
320+
<style scoped>
321+
.card {
322+
width: 100%;
323+
max-height: 400px;
324+
overflow-y: scroll;
325+
}
326+
</style>

src/views/system/tenant/tenant.data.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,24 @@ export const rules = reactive({
2727
contactMobile: [required],
2828
accountCount: [required],
2929
expireTime: [required],
30+
username: [
31+
required,
32+
{
33+
min: 4,
34+
max: 30,
35+
trigger: 'blur',
36+
message: '用户名称长度为 4-30 个字符'
37+
}
38+
],
39+
password: [
40+
required,
41+
{
42+
min: 4,
43+
max: 16,
44+
trigger: 'blur',
45+
message: '密码长度为 4-16 位'
46+
}
47+
],
3048
domain: [required],
3149
status: [required]
3250
})

src/views/system/tenantPackage/index.vue

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
ref="formRef"
2626
>
2727
<template #menuIds>
28-
<el-card class="w-120">
28+
<el-card>
2929
<template #header>
3030
<div class="card-header">
3131
全选/全不选:
@@ -91,6 +91,16 @@ const dialogTitle = ref('edit') // 弹出层标题
9191
const handleCheckedTreeNodeAll = () => {
9292
treeRef.value!.setCheckedNodes(treeNodeAll.value ? menuOptions.value : [])
9393
}
94+
95+
const validateCategory = (rule: any, value: any, callback: any) => {
96+
if (!treeRef.value!.getCheckedKeys().length) {
97+
callback(new Error('该项为必填项'))
98+
} else {
99+
callback()
100+
}
101+
}
102+
rules.menuIds = [{ required: true, validator: validateCategory, trigger: 'blur' }]
103+
94104
const getTree = async () => {
95105
const res = await listSimpleMenusApi()
96106
menuOptions.value = handleTree(res)
@@ -126,7 +136,7 @@ const handleUpdate = async (rowId: number) => {
126136
unref(formRef)?.setValues(res)
127137
// 设置选中
128138
res.menuIds?.forEach((item: any) => {
129-
unref(treeRef)?.setChecked(item, true,false);
139+
unref(treeRef)?.setChecked(item, true, false)
130140
})
131141
}
132142
@@ -168,3 +178,10 @@ onMounted(async () => {
168178
})
169179
// getList()
170180
</script>
181+
<style scoped>
182+
.el-card {
183+
width: 100%;
184+
max-height: 400px;
185+
overflow-y: scroll;
186+
}
187+
</style>

src/views/system/tenantPackage/tenantPackage.data.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,12 @@ const crudSchemas = reactive<VxeCrudSchema>({
3333
{
3434
title: '菜单权限',
3535
field: 'menuIds',
36-
isTable: false
36+
isTable: false,
37+
form: {
38+
colProps: {
39+
span: 24
40+
}
41+
}
3742
},
3843
{
3944
title: t('form.remark'),

0 commit comments

Comments
 (0)