|
1 | 1 | <template>
|
2 | 2 | <div class="function-lib-list-container p-24" style="padding-top: 16px">
|
3 |
| - <el-tabs |
4 |
| - v-model="functionType" |
5 |
| - @tab-change=" |
6 |
| - tabChangeHandle |
7 |
| - |
8 |
| - " |
9 |
| - > |
| 3 | + <el-tabs v-model="functionType" @tab-change="tabChangeHandle"> |
10 | 4 | <el-tab-pane :label="$t('views.functionLib.title')" name="PUBLIC"></el-tab-pane>
|
11 | 5 | <el-tab-pane :label="$t('views.functionLib.internalTitle')" name="INTERNAL"></el-tab-pane>
|
12 | 6 | </el-tabs>
|
|
165 | 159 | </el-button>
|
166 | 160 | <template #dropdown>
|
167 | 161 | <el-dropdown-menu>
|
| 162 | + <el-dropdown-item |
| 163 | + v-if="item.template_id" |
| 164 | + :disabled="item.permission_type === 'PUBLIC' && !canEdit(item)" |
| 165 | + @click.stop="addInternalFunction(item, true)" |
| 166 | + > |
| 167 | + <el-icon><EditPen /></el-icon> |
| 168 | + {{ $t('common.edit') }} |
| 169 | + </el-dropdown-item> |
168 | 170 | <el-dropdown-item
|
169 | 171 | v-if="!item.template_id"
|
170 | 172 | :disabled="item.permission_type === 'PUBLIC' && !canEdit(item)"
|
@@ -366,17 +368,24 @@ async function openDescDrawer(row: any) {
|
366 | 368 | InternalDescDrawerRef.value.open(content, row)
|
367 | 369 | }
|
368 | 370 |
|
369 |
| -function addInternalFunction(data?: any) { |
370 |
| - AddInternalFunctionDialogRef.value.open(data) |
| 371 | +function addInternalFunction(data?: any, isEdit?: boolean) { |
| 372 | + AddInternalFunctionDialogRef.value.open(data, isEdit) |
371 | 373 | }
|
372 | 374 |
|
373 |
| -function confirmAddInternalFunction(data?: any) { |
374 |
| - functionLibApi |
375 |
| - .addInternalFunction(data.id, { name: data.name }, changeStateloading) |
376 |
| - .then((res) => { |
377 |
| - MsgSuccess(t('common.submitSuccess')) |
| 375 | +function confirmAddInternalFunction(data?: any, isEdit?: boolean) { |
| 376 | + if (isEdit) { |
| 377 | + functionLibApi.putFunctionLib(data?.id as string, data, loading).then((res) => { |
| 378 | + MsgSuccess(t('common.saveSuccess')) |
378 | 379 | searchHandle()
|
379 | 380 | })
|
| 381 | + } else { |
| 382 | + functionLibApi |
| 383 | + .addInternalFunction(data.id, { name: data.name }, changeStateloading) |
| 384 | + .then((res) => { |
| 385 | + MsgSuccess(t('common.addSuccess')) |
| 386 | + searchHandle() |
| 387 | + }) |
| 388 | + } |
380 | 389 | }
|
381 | 390 |
|
382 | 391 | function searchHandle() {
|
|
0 commit comments