Skip to content

Commit b2ddefe

Browse files
committed
【代码评审】BPM:表单字段,批量选中
1 parent 5d20f62 commit b2ddefe

File tree

3 files changed

+56
-82
lines changed

3 files changed

+56
-82
lines changed

src/components/SimpleProcessDesignerV2/src/nodes-config/CopyTaskNodeConfig.vue

Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@
134134
:key="idx"
135135
:label="item.title"
136136
:value="item.field"
137-
:disabled ="!item.required"
137+
:disabled="!item.required"
138138
/>
139139
</el-select>
140140
</el-form-item>
@@ -149,7 +149,7 @@
149149
:key="idx"
150150
:label="item.title"
151151
:value="item.field"
152-
:disabled ="!item.required"
152+
:disabled="!item.required"
153153
/>
154154
</el-select>
155155
</el-form-item>
@@ -195,12 +195,14 @@
195195
<div class="field-permit-title">
196196
<div class="setting-title-label first-title"> 字段名称 </div>
197197
<div class="other-titles">
198-
<span class="setting-title-label">只读
199-
<el-switch v-model="readSwitch" @change="updatePermission('READ')" />
198+
<span class="setting-title-label cursor-pointer" @click="updatePermission('READ')">
199+
只读
200200
</span>
201-
<span class="setting-title-label">可编辑</span>
202-
<span class="setting-title-label">隐藏
203-
<el-switch v-model="noneSwitch" @change="updatePermission('NONE')" />
201+
<span class="setting-title-label cursor-pointer" @click="updatePermission('WRITE')">
202+
可编辑
203+
</span>
204+
<span class="setting-title-label cursor-pointer" @click="updatePermission('NONE')">
205+
隐藏
204206
</span>
205207
</div>
206208
</div>
@@ -371,23 +373,20 @@ const showCopyTaskNodeConfig = (node: SimpleFlowNode) => {
371373
// 表单字段权限
372374
getNodeConfigFormFields(node.fieldsPermission)
373375
}
374-
const readSwitch = ref(false);
375-
const noneSwitch = ref(false);
376-
const updatePermission = (type: string) => {
377-
if (type === 'READ') {
378-
readSwitch.value = true;
379-
380-
noneSwitch.value = false;
381-
} else if (type === 'NONE') {
382-
readSwitch.value = false;
383376
384-
noneSwitch.value = true;
385-
}
377+
/** 批量更新权限 */
378+
// TODO @lesan:要不要 bpmn 也加下?
379+
const updatePermission = (type: string) => {
380+
fieldsPermissionConfig.value.forEach((field) => {
381+
field.permission =
382+
type === 'READ'
383+
? FieldPermissionType.READ
384+
: type === 'WRITE'
385+
? FieldPermissionType.WRITE
386+
: FieldPermissionType.NONE
387+
})
388+
}
386389
387-
fieldsPermissionConfig.value.forEach(field => {
388-
field.permission = type === 'READ' ? FieldPermissionType.READ : FieldPermissionType.NONE;
389-
});
390-
};
391390
defineExpose({ openDrawer, showCopyTaskNodeConfig }) // 暴露方法给父组件
392391
</script>
393392

src/components/SimpleProcessDesignerV2/src/nodes-config/StartUserNodeConfig.vue

Lines changed: 18 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@
3636
placement="top"
3737
:content="getUserNicknames(startUserIds)"
3838
>
39-
{{ getUserNicknames(startUserIds.slice(0,2)) }} 等 {{ startUserIds.length }} 人可发起流程
39+
{{ getUserNicknames(startUserIds.slice(0, 2)) }} 等
40+
{{ startUserIds.length }} 人可发起流程
4041
</el-tooltip>
4142
</el-text>
4243
</el-tab-pane>
@@ -46,14 +47,14 @@
4647
<div class="field-permit-title">
4748
<div class="setting-title-label first-title"> 字段名称 </div>
4849
<div class="other-titles">
49-
<span class="setting-title-label">只读
50-
<el-switch v-model="readSwitch" @change="updatePermission('READ')" />
50+
<span class="setting-title-label cursor-pointer" @click="updatePermission('READ')">
51+
只读
5152
</span>
52-
<span class="setting-title-label">可编辑
53-
<el-switch v-model="writeSwitch" @change="updatePermission('WRITE')" />
53+
<span class="setting-title-label cursor-pointer" @click="updatePermission('WRITE')">
54+
可编辑
5455
</span>
55-
<span class="setting-title-label">隐藏
56-
<el-switch v-model="noneSwitch" @change="updatePermission('NONE')" />
56+
<span class="setting-title-label cursor-pointer" @click="updatePermission('NONE')">
57+
隐藏
5758
</span>
5859
</div>
5960
</div>
@@ -162,32 +163,19 @@ const showStartUserNodeConfig = (node: SimpleFlowNode) => {
162163
// 表单字段权限
163164
getNodeConfigFormFields(node.fieldsPermission)
164165
}
165-
const readSwitch = ref(false)
166-
const writeSwitch = ref(false)
167-
const noneSwitch = ref(false)
168-
const updatePermission = (type) => {
169-
if (type === 'READ') {
170-
readSwitch.value = true;
171-
writeSwitch.value = false;
172-
noneSwitch.value = false;
173-
} else if (type === 'WRITE') {
174-
readSwitch.value = false;
175-
writeSwitch.value = true;
176-
noneSwitch.value = false;
177-
} else if (type === 'NONE') {
178-
readSwitch.value = false;
179-
writeSwitch.value = false;
180-
noneSwitch.value = true;
181-
}
182166
183-
fieldsPermissionConfig.value.forEach(item => {
184-
item.permission = type === 'READ' ? FieldPermissionType.READ :
185-
type === 'WRITE' ? FieldPermissionType.WRITE :
186-
FieldPermissionType.NONE;
187-
});
167+
/** 批量更新权限 */
168+
const updatePermission = (type: string) => {
169+
fieldsPermissionConfig.value.forEach((field) => {
170+
field.permission =
171+
type === 'READ'
172+
? FieldPermissionType.READ
173+
: type === 'WRITE'
174+
? FieldPermissionType.WRITE
175+
: FieldPermissionType.NONE
176+
})
188177
}
189178
defineExpose({ openDrawer, showStartUserNodeConfig }) // 暴露方法给父组件
190-
191179
</script>
192180

193181
<style lang="scss" scoped></style>

src/components/SimpleProcessDesignerV2/src/nodes-config/UserTaskNodeConfig.vue

Lines changed: 17 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -454,14 +454,14 @@
454454
<div class="field-permit-title">
455455
<div class="setting-title-label first-title"> 字段名称 </div>
456456
<div class="other-titles">
457-
<span class="setting-title-label">只读
458-
<el-switch v-model="readSwitch" @change="updatePermission('READ')" />
459-
</span>
460-
<span class="setting-title-label">可编辑
461-
<el-switch v-model="writeSwitch" @change="updatePermission('WRITE')" />
457+
<span class="setting-title-label cursor-pointer" @click="updatePermission('READ')">
458+
只读
462459
</span>
463-
<span class="setting-title-label">隐藏
464-
<el-switch v-model="noneSwitch" @change="updatePermission('NONE')" />
460+
<span class="setting-title-label cursor-pointer" @click="updatePermission('WRITE')">
461+
可编辑
462+
</span>
463+
<span class="setting-title-label cursor-pointer" @click="updatePermission('NONE')">
464+
隐藏
465465
</span>
466466
</div>
467467
</div>
@@ -959,31 +959,18 @@ function useTimeoutHandler() {
959959
cTimeoutMaxRemindCount
960960
}
961961
}
962-
const readSwitch = ref(false);
963-
const writeSwitch = ref(false);
964-
const noneSwitch = ref(false);
965962
963+
/** 批量更新权限 */
966964
const updatePermission = (type: string) => {
967-
if (type === 'READ') {
968-
readSwitch.value = true;
969-
writeSwitch.value = false;
970-
noneSwitch.value = false;
971-
} else if (type === 'WRITE') {
972-
readSwitch.value = false;
973-
writeSwitch.value = true;
974-
noneSwitch.value = false;
975-
} else if (type === 'NONE') {
976-
readSwitch.value = false;
977-
writeSwitch.value = false;
978-
noneSwitch.value = true;
979-
}
980-
981-
fieldsPermissionConfig.value.forEach(field => {
982-
field.permission = type === 'READ' ? FieldPermissionType.READ :
983-
type === 'WRITE' ? FieldPermissionType.WRITE :
984-
FieldPermissionType.NONE;
985-
});
986-
};
965+
fieldsPermissionConfig.value.forEach((field) => {
966+
field.permission =
967+
type === 'READ'
968+
? FieldPermissionType.READ
969+
: type === 'WRITE'
970+
? FieldPermissionType.WRITE
971+
: FieldPermissionType.NONE
972+
})
973+
}
987974
</script>
988975

989976
<style lang="scss" scoped>

0 commit comments

Comments
 (0)