sohelp-eleplus 1.1.18 → 1.1.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  <script setup>
2
- import { Filter, Search, Sort, SortDown, SortUp } from "@element-plus/icons-vue";
2
+ import { Filter, Search, Sort, SortDown, SortUp,Setting,Memo,Menu,Tickets,Postcard, Files, Grid, Refresh} from "@element-plus/icons-vue";
3
3
  import { useMobile } from "@/utils/use-mobile";
4
4
  import { usePermission } from "@/utils/use-permission";
5
5
  import DefaultProps from "./js/DefaultProps";
@@ -11,17 +11,25 @@ import { ElMessageBox } from "element-plus/es";
11
11
  import { useFormData } from "@/utils/use-form-data";
12
12
  import { resetCommonConfig, updateCommonConfig } from "../http/ModuleHttp.js";
13
13
  import CrudHttp from "../http/CrudHttp.js";
14
+ import {merge, cloneDeep } from "lodash-es";
15
+ import { uuid } from "../utils/core.js"
16
+
14
17
  import ApprovalModal from "../sohelp-workflow-drawer/components/approval-modal.vue";
15
18
  import WorkflowDrawer from "../sohelp-workflow-drawer/index.vue";
19
+
16
20
  import SohelpTextareaInput from "../sohelp-textarea-input/index.vue";
17
21
  import SohelpPower from "../sohelp-power/index.vue";
18
22
  import FilterConditionItem from "./components/filter-condition-item.vue";
19
23
  import { useSohelpGridConfig } from "./js/useSohelpGridConfig.js";
20
24
  import { useI18n } from "vue-i18n";
21
25
  import SohelpEntityForm from "../sohelp-entity-form/index.vue";
22
- import * as ElementPlusIcons from '@element-plus/icons-vue';
23
- import * as EleAdminPlusIcons from '../sohelp-icon-select/icons';
24
-
26
+ import * as ElementPlusIcons from '@element-plus/icons-vue';
27
+ import * as EleAdminPlusIcons from '@/components/icons';
28
+ import { moduleCache } from "../cache/ModuleCache.js";
29
+ import SohelpModal from "../sohelp-modal/index.vue";
30
+ import SohelpImport from "../sohelp-import/index.vue";
31
+ import { useUserStore } from '@/store/modules/user';
32
+ import { Alert } from "vxe-pc-ui";
25
33
  const { initial, isConfigDone } = useSohelpGridConfig();
26
34
  const { t } = useI18n();
27
35
  const { mobile } = useMobile();
@@ -36,12 +44,19 @@ const current = ref(null);
36
44
  const isPage = ref(false);
37
45
  const approvalModalVisible = ref(false);
38
46
  const approvalData = ref({});
47
+ const userStore = useUserStore();
39
48
 
40
49
  //报表打印
41
50
  const currentReportValue = ref(null);
42
51
  const visibleReport = ref(false);
43
52
  const reportData = ref([]);
44
53
  const currentRow = ref(null);
54
+
55
+ /** 自动生成ID */
56
+ const getId = () => {
57
+ return 'sohelp-grid-' + uuid();
58
+ }
59
+
45
60
  const loadReport = () => {
46
61
  SohelpHttp.get("/engine/web/report/list", { refid: props.refid }).then(res => {
47
62
  if (res.meta.success) {
@@ -82,6 +97,9 @@ const closeReport = () => {
82
97
  visibleReport.value = false;
83
98
  };
84
99
 
100
+ // 操作栏按钮配置
101
+ const operationsButtons = reactive({});
102
+
85
103
  const loading = ref(false);
86
104
  //显示实体表单
87
105
  const visibleEntityForm = ref(false);
@@ -130,7 +148,7 @@ const propertiesMap = defineModel("propertiesMap");
130
148
  // Grid实例
131
149
  const sohelpVxeGridRef = ref(null);
132
150
  // GridOptions配置
133
- const gridOptions = reactive(JSON.parse(JSON.stringify(DefaultGridOptions)));
151
+ const gridOptions = reactive(cloneDeep(DefaultGridOptions));
134
152
  const batchButtonsIndex = ref(2);
135
153
  const sortValue = ref("");
136
154
  /**
@@ -188,7 +206,7 @@ const getCellValue = (rowIndex, name) => {
188
206
  */
189
207
  const getKeywordsPlaceholder = computed(() => {
190
208
  if (sohelpConfig.value?.filter?.keywords?.length) {
191
- return t("grid.toolbar.keywords") + ",【" + sohelpConfig.value.filter?.keywords?.filter(key => propertiesMap.value[key]).map(key => t(propertiesMap.value[key].i18n) || propertiesMap.value[key].label).join("/") + "";
209
+ return t("grid.toolbar.keywords") + " [" + sohelpConfig.value.filter?.keywords?.filter(key => propertiesMap.value[key]).map(key => t(propertiesMap.value[key].i18n) || propertiesMap.value[key].label).join(",") + "]";
192
210
  }
193
211
  return t("grid.toolbar.keywords");
194
212
  });
@@ -201,6 +219,107 @@ const getCurrentFieldLabel = computed(() => {
201
219
  return (propertiesMap.value[textareaState["field"]]?.label || "") + "修改";
202
220
  });
203
221
 
222
+ const importVisible = ref(false);
223
+ const importAuthority = computed(() => {
224
+ try {
225
+ const prefix = (props.refid || '').split('!')[0] || '';
226
+ return prefix + ':batch.import';
227
+ } catch (e) {
228
+ return 'batch.import';
229
+ }
230
+ });
231
+ const exportAuthority = computed(() => {
232
+ try {
233
+ const prefix = (props.refid || '').split('!')[0] || '';
234
+ return prefix + ':batch.export';
235
+ } catch (e) {
236
+ return 'batch.export';
237
+ }
238
+ });
239
+
240
+ const openImport = () => {
241
+ try {
242
+ if (!permission.hasPermission(importAuthority.value)) {
243
+ EleMessage.error('暂无权限');
244
+ return;
245
+ }
246
+ if (!props.refid) {
247
+ EleMessage.error('列表地址缺失,无法打开导入');
248
+ return;
249
+ }
250
+ importVisible.value = true;
251
+ } catch (e) {
252
+ EleMessage.error(typeof e === 'string' ? e : e?.message || '打开导入失败');
253
+ }
254
+ };
255
+ const closeImport = () => {
256
+ importVisible.value = false;
257
+ };
258
+ const exportData = async (dataRange) => {
259
+ if (!permission.hasPermission(exportAuthority.value)) {
260
+ EleMessage.error('暂无权限');
261
+ return;
262
+ }
263
+ if (dataRange === 0) {
264
+ const $grid = sohelpVxeGridRef.value;
265
+ const selected = $grid?.getCheckboxRecords() || [];
266
+ if (!selected.length) {
267
+ EleMessage.error("请先勾选需要导出的记录");
268
+ return;
269
+ }
270
+ const ids = selected.map((item) => item.id).filter((id) => id !== undefined && id !== null);
271
+ if (!ids.length) {
272
+ EleMessage.error("选中记录未包含可导出的ID");
273
+ return;
274
+ }
275
+ let last = 0;
276
+ let loadingTip = EleMessage.loading("导出中 0%");
277
+ try {
278
+ await SohelpHttp.download("/engine/web/export/download", {
279
+ refid: props.refid,
280
+ exportRange: dataRange,
281
+ ...filterValue.value,
282
+ ids: ids
283
+ }, "导出数据.xlsx", (loaded, total) => {
284
+ if (total > 0) {
285
+ const p = Math.floor((loaded / total) * 100);
286
+ if (p - last >= 5) {
287
+ loadingTip.close();
288
+ loadingTip = EleMessage.loading(`导出中 ${p}%`);
289
+ last = p;
290
+ }
291
+ }
292
+ });
293
+ } catch (e) {
294
+ EleMessage.error(typeof e === "string" ? e : e?.message || "导出失败");
295
+ } finally {
296
+ loadingTip.close();
297
+ }
298
+ return;
299
+ }
300
+ let last = 0;
301
+ let loadingTip = EleMessage.loading("导出中 0%");
302
+ try {
303
+ await SohelpHttp.download("/engine/web/export/download", {
304
+ refid: props.refid,
305
+ exportRange: dataRange,
306
+ filterValue: JSON.stringify(filterValue.value)
307
+ }, "导出数据.xlsx", (loaded, total) => {
308
+ if (total > 0) {
309
+ const p = Math.floor((loaded / total) * 100);
310
+ if (p - last >= 5) {
311
+ loadingTip.close();
312
+ loadingTip = EleMessage.loading(`导出中 ${p}%`);
313
+ last = p;
314
+ }
315
+ }
316
+ });
317
+ } catch (e) {
318
+ EleMessage.error(typeof e === "string" ? e : e?.message || "导出失败");
319
+ } finally {
320
+ loadingTip.close();
321
+ }
322
+ };
204
323
  const keywordsChange = (val) => {
205
324
  filterValue.value = {
206
325
  ...filterValue.value,
@@ -321,6 +440,10 @@ const loadConfig = (param = {}) => {
321
440
  batchButtonsIndex.value = config.batchButtonsIndex;
322
441
  sohelpConfig.value.list = config.sohelpConfig.list;
323
442
 
443
+
444
+
445
+ Object.assign(operationsButtons, config.operationsButtons);
446
+
324
447
  if (!filterValue.value.filter) {
325
448
  filterValue.value.filter = [];
326
449
  }
@@ -468,55 +591,28 @@ const pageChangeEvent = (page) => {
468
591
  * 获取Common类型操作栏 并根据flw_id判断是否显示
469
592
  * @param row
470
593
  */
471
- const getOperationButtonsByType = (row, type = "common") => {
472
- let common = getOperationToolbars.value?.[type] || [];
473
- if (common.length > 0) {
474
- if (row.hasOwnProperty("flw_id")) {
475
- const field = row.flw_id === "0" ? "workflow.view" : "workflow.submit";
476
- common = common.filter(f => f.code != field);
477
- } else {
478
- common = common.filter(f => (f.code != "workflow.submit" || f.code != "workflow.view"));
479
- }
480
- return common;
481
- }
482
- return [];
483
- };
484
-
485
- /**
486
- * 获取操作栏
487
- */
488
- const getOperationToolbars = computed(() => {
489
- const buttonsMap = {};
490
- sohelpConfig.value.operationToolbars?.filter(f => !f.authority || permission.hasPermission(f.authority)).map(button => {
491
- const type = button.buttonType || "common";
492
- const code = button.type === "custom" ? button.id : button.type;
493
- if (!buttonsMap[type]) {
494
- buttonsMap[type] = [];
495
- }
496
- const title = (button.type === "custom") ? button.title : t("grid.toolbar." + button.type?.replaceAll(".", "-"));
497
- let params = button.params || {};
498
- if (button.params && typeof button.params === "string") {
499
- try {
500
- params = JSON.parse(button.params);
501
- } catch (e) {
502
- params = {};
503
- EleMessage.error("button.params配置JSON参数格式错误");
594
+ const getOperationButtonsByType = computed(() => {
595
+ return (row, column, type = "common") => {
596
+ const $grid = sohelpVxeGridRef.value;
597
+ let common = operationsButtons?.[type] || [];
598
+ if (common.length > 0) {
599
+ if (row.hasOwnProperty("flw_id")) {
600
+ const field = row.flw_id === "0" ? "workflow.view" : "workflow.submit";
601
+ common = common.filter(f => f.code != field);
602
+ } else {
603
+ common = common.filter(f => (f.code != "workflow.submit" || f.code != "workflow.view"));
504
604
  }
605
+ return common.map((item) => {
606
+ if(item.render && item.render?.length > 0) {
607
+ const func = new Function("row","item","column","$grid", `return (async () => { ${item.render} })()`);
608
+ func.call(undefined, row, item, column, $grid);
609
+ }
610
+ return item;
611
+ });
505
612
  }
506
- buttonsMap[type].push({
507
- title: title || button.title,
508
- "id": button.id,
509
- code: code,
510
- handler: button.handler,
511
- icon: button.iconCls,
512
- params: params,
513
- refid: button.refid,
514
- openType: button.openType
515
- });
516
- });
517
- return buttonsMap;
518
- });
519
-
613
+ return [];
614
+ };
615
+ })
520
616
 
521
617
  /**
522
618
  * 行操作栏点击事件
@@ -1058,7 +1154,6 @@ const viewWorkflow = (id) => {
1058
1154
  * 筛选
1059
1155
  */
1060
1156
  const changeNameFilter = (option, val, column) => {
1061
- console.log("option", option, val, column);
1062
1157
  const $grid = sohelpVxeGridRef.value;
1063
1158
  if ($grid) {
1064
1159
  $grid.setFilter(column.field, [{
@@ -1160,7 +1255,7 @@ const updateProperties = (obj, properties, key, propertiesMap) => {
1160
1255
  */
1161
1256
  const sortPropertiesInPlace = (properties, sortData) => {
1162
1257
  const sortOrder = {};
1163
- Object.entries(sortData)
1258
+ Object.entries(sortData || {})
1164
1259
  .sort((a, b) => a[1] - b[1])
1165
1260
  .forEach(([key], index) => {
1166
1261
  sortOrder[key] = index;
@@ -1200,6 +1295,7 @@ const handleCustom = async ({ type, $grid }) => {
1200
1295
  if (type === "confirm") {
1201
1296
  //获取当前列配置
1202
1297
  const { sortData, ...columnsData } = filterUnderscoreProps($grid?.getCustomStoreData());
1298
+
1203
1299
  const properties = JSON.parse(JSON.stringify([...sohelpConfig.value.properties])).map(item => {
1204
1300
  return {
1205
1301
  ...item,
@@ -1243,6 +1339,10 @@ const handleCustom = async ({ type, $grid }) => {
1243
1339
  EleMessage.success(message);
1244
1340
  }
1245
1341
 
1342
+ //清除缓存
1343
+ moduleCache?.clear();
1344
+ loadConfig();
1345
+
1246
1346
  localStorage.setItem("VXE_CUSTOM_STORE", "");
1247
1347
  loading.close();
1248
1348
  }
@@ -1310,6 +1410,32 @@ const currentColumnChange = (props) => {
1310
1410
  emit("currentColumnChange", props);
1311
1411
  };
1312
1412
 
1413
+ const columnCheckbox = ref(false);
1414
+ const toggleAllEvent = () => {
1415
+ const $grid = sohelpVxeGridRef.value
1416
+ if ($grid) {
1417
+ $grid.toggleCustomAllCheckbox()
1418
+ }
1419
+ }
1420
+
1421
+ const settingClick = (command) => {
1422
+ const baseUrl = SohelpHttp.getBaseUrl();
1423
+ const { refid,extendEntity,name } = sohelpConfig.value;
1424
+ if(refid && extendEntity && name){
1425
+ const url = {
1426
+ form: baseUrl + `/dev/index.html#/dev/form?datasource=default&name=${extendEntity}&refid=${refid}`,
1427
+ entity: baseUrl + `/dev/index.html#/dev/module/entity?datasource=default&name=${extendEntity}`,
1428
+ workflow: baseUrl + `/dev/index.html#/dev/form?datasource=default&name=${extendEntity}&refid=${refid}&tab=workflow`,
1429
+ grid: baseUrl + `/dev/index.html#/dev/module/grid?refid=${refid}`,
1430
+ module: baseUrl+`/dev/index.html#/dev/module?name=${refid}`,
1431
+ }
1432
+ if(command === 'module' && !extendEntity){
1433
+ url.module = baseUrl+`/dev/index.html#/dev/module?name=${name}`;
1434
+ }
1435
+ window.open(url[command],'_blank');
1436
+ }
1437
+ }
1438
+
1313
1439
  /**
1314
1440
  * 监听是否被选中,更新工具栏批量操作
1315
1441
  */
@@ -1354,7 +1480,7 @@ defineExpose({
1354
1480
  @checkboxChange="onCheckboxChange"
1355
1481
  @checkboxAll="onCheckboxChange"
1356
1482
  class="sohelp-grid-view"
1357
- id="sohelp-grid"
1483
+ :id="getId()"
1358
1484
  v-on="gridEvents"
1359
1485
  @filter-change="handleFilterChange"
1360
1486
  @custom="handleCustom"
@@ -1366,10 +1492,32 @@ defineExpose({
1366
1492
  @currentColumnChange="currentColumnChange"
1367
1493
  @filter-visible="filterVisible"
1368
1494
  >
1495
+
1496
+ <!-- 自定义列设置 -->
1497
+ <template #setting>
1498
+ <div class="column-setting">
1499
+ <vxe-checkbox @change="toggleAllEvent" v-model="columnCheckbox">全选</vxe-checkbox>
1500
+ <vxe-pulldown trigger="click" :transfer="true" :show-popup-shadow="true" v-if="userStore.info.is_developer">
1501
+ <template #default>
1502
+ <el-link :icon="Setting" :underline="false"/>
1503
+ </template>
1504
+ <template #dropdown>
1505
+ <ele-card shadow="always">
1506
+ <el-space direction="vertical" :size="5" alignment="flex-start">
1507
+ <el-link :icon="Memo" @click="settingClick('grid')" :underline="false" style="font-size:12px;"><span style="padding:0 5px;">列表配置</span></el-link>
1508
+ <el-link :icon="Menu" @click="settingClick('entity')" :underline="false" style="font-size: 12px;"><span style="padding:0 5px;">实体配置</span></el-link>
1509
+ <el-link :icon="Grid" @click="settingClick('module')" :underline="false" style="font-size: 12px;"><span style="padding:0 5px;">模块配置</span></el-link>
1510
+ </el-space>
1511
+ </ele-card>
1512
+ </template>
1513
+ </vxe-pulldown>
1514
+ </div>
1515
+ </template>
1516
+
1369
1517
  <!--定义国际化I18n-->
1370
1518
  <template
1371
1519
  v-for="item in sohelpConfig?.properties?.map(item => item)"
1372
- v-slot:[`header_${item.name}`]="{ column, rowIndex }"
1520
+ #[`header_${item.name}`]="{ column, rowIndex }"
1373
1521
  :key="item.name"
1374
1522
  >
1375
1523
  {{ item.i18n ? t(item.i18n) : item.label }}
@@ -1382,12 +1530,12 @@ defineExpose({
1382
1530
  v-model:currentPage="gridOptions.pagerConfig.currentPage"
1383
1531
  v-model:pageSize="gridOptions.pagerConfig.pageSize"
1384
1532
  :total="gridOptions.pagerConfig.total"
1385
- @page-change="pageChangeEvent">
1386
- </vxe-pager>
1533
+ @page-change="pageChangeEvent"/>
1387
1534
  </template>
1388
1535
 
1389
1536
  <!-- 高级筛选 -->
1390
- <template v-for="field in Object.values(propertiesMap).filter(item => item.query)" :key="field.name"
1537
+ <template
1538
+ v-for="field in Object.values(propertiesMap).filter(item => item.query)" :key="field.name"
1391
1539
  #[`filter_${field.name}`]="{ column }">
1392
1540
  <div v-for="(option, index) in column.filters" :key="index" class="condition-box">
1393
1541
  <filter-condition-item
@@ -1404,13 +1552,14 @@ defineExpose({
1404
1552
  <div class="toolbar-box">
1405
1553
  <!-- 查看范围 -->
1406
1554
  <div class="power-box">
1407
- <sohelp-power @change="changePower" v-if="sohelpConfig?.filter?.config?.visibleDataRange"></sohelp-power>
1555
+ <sohelp-power @change="changePower" v-if="sohelpConfig?.filter?.config?.visibleDataRange"/>
1408
1556
  </div>
1409
1557
 
1410
1558
  <div class="search-box" v-if="sohelpConfig?.filter?.config?.visibleKeywords">
1411
1559
  <!-- 关键字 -->
1412
1560
  <ele-tooltip :content="getKeywordsPlaceholder" placement="top" :offset="3">
1413
- <sohelp-input :model-value="filterValue.keywords" @update:model-value="keywordsChange"
1561
+ <sohelp-input
1562
+ :model-value="filterValue.keywords" @update:model-value="keywordsChange"
1414
1563
  :placeholder="getKeywordsPlaceholder" clearable
1415
1564
  @keyup.enter="filter" size="small" style="width: 160px;">
1416
1565
  <template #append>
@@ -1418,22 +1567,26 @@ defineExpose({
1418
1567
  </template>
1419
1568
  </sohelp-input>
1420
1569
  </ele-tooltip>
1421
- <el-button size="small" @click="resetFilter">{{ t("grid.toolbar.reset") }}</el-button>
1570
+ <el-button size="small" :icon="Refresh" @click="resetFilter">{{ t("grid.toolbar.reset") }}</el-button>
1422
1571
  </div>
1423
1572
 
1424
1573
  <div class="tools-btns">
1425
- <sohelp-drop-card :title="t('grid.toolbar.sort')" :icon="Sort" ref="sohelpSortRef"
1574
+ <sohelp-drop-card
1575
+ :title="t('grid.toolbar.sort')" :icon="Sort" ref="sohelpSortRef"
1426
1576
  v-if="sohelpConfig?.filter?.config?.visibleSort && sortList.length > 0">
1427
1577
  <div class="sort-list">
1428
- <ele-card v-for="item in sortList" :key="item.title" :header="item.title"
1578
+ <ele-card
1579
+ v-for="item in sortList" :key="item.title" :header="item.title"
1429
1580
  :bodyStyle="{padding: '0'}"
1430
1581
  :headerStyle="{fontSize: '14px', fontWeight: 'normal', padding: '5px 0'}">
1431
1582
  <template #extra>
1432
- <ele-text :icon="SortUp" style="cursor: pointer;" :underline="false" size="sm"
1583
+ <ele-text
1584
+ :icon="SortUp" style="cursor: pointer;" :underline="false" size="sm"
1433
1585
  @click="sortCommand(item.field,'asc')" plain :type="isActiveSort(item.field,'asc')">
1434
1586
  t("grid.toolbar.asc")
1435
1587
  </ele-text>
1436
- <ele-text :icon="SortDown" style="cursor: pointer;margin-left:5px!important" :underline="false"
1588
+ <ele-text
1589
+ :icon="SortDown" style="cursor: pointer;margin-left:5px!important" :underline="false"
1437
1590
  size="sm" @click="sortCommand(item.field,'desc')" plain
1438
1591
  :type="isActiveSort(item.field,'desc')">t("grid.toolbar.desc")
1439
1592
  </ele-text>
@@ -1441,10 +1594,35 @@ defineExpose({
1441
1594
  </ele-card>
1442
1595
  </div>
1443
1596
  </sohelp-drop-card>
1444
- <el-button :icon="Filter" size="small" @click="showFilter()"
1597
+ <el-button
1598
+ :icon="Filter" size="small" @click="showFilter()"
1599
+ plain
1445
1600
  :type="(sohelpConfig?.filter?.config?.visibleFilter && sohelpConfig?.filter?.config?.filterPosition !== 'NONE')?'primary':''"
1446
- v-if="sohelpConfig?.filter?.config?._visibleFilter">
1447
- </el-button>
1601
+ v-if="sohelpConfig?.filter?.config?._visibleFilter"/>
1602
+ <ele-tooltip :content="'批量导入数据'" placement="top" :offset="3">
1603
+ <el-button size="small" plain :icon="ElementPlusIcons.Upload" @click="openImport" v-permission="importAuthority"/>
1604
+ </ele-tooltip>
1605
+ <ele-tooltip :content="'批量导出数据'" placement="top" :offset="3">
1606
+ <el-dropdown @command="exportData" v-permission="exportAuthority">
1607
+ <el-button size="small" plain :icon="ElementPlusIcons.Download"/>
1608
+ <template #dropdown>
1609
+ <el-dropdown-menu>
1610
+ <el-dropdown-item :command="0" :disabled="!selections || selections.length === 0">
1611
+ <el-icon><Memo /></el-icon>
1612
+ <span style="margin-left:6px;">导出选中数据</span>
1613
+ </el-dropdown-item>
1614
+ <el-dropdown-item :command="1">
1615
+ <el-icon><Files /></el-icon>
1616
+ <span style="margin-left:6px;">当前页数据</span>
1617
+ </el-dropdown-item>
1618
+ <el-dropdown-item :command="2">
1619
+ <el-icon><Grid /></el-icon>
1620
+ <span style="margin-left:6px;">全部记录数据</span>
1621
+ </el-dropdown-item>
1622
+ </el-dropdown-menu>
1623
+ </template>
1624
+ </el-dropdown>
1625
+ </ele-tooltip>
1448
1626
  </div>
1449
1627
  </div>
1450
1628
  </template>
@@ -1453,7 +1631,7 @@ defineExpose({
1453
1631
  <!-- 未编辑状态 -->
1454
1632
  <template
1455
1633
  v-for="name in sohelpConfig?.properties?.map(item => item.name)"
1456
- v-slot:[`default_${name}`]="{ row, column, rowIndex }"
1634
+ #[`default_${name}`]="{ row, column, rowIndex }"
1457
1635
  :key="name"
1458
1636
  >
1459
1637
 
@@ -1465,20 +1643,19 @@ defineExpose({
1465
1643
  />
1466
1644
 
1467
1645
  <!-- 图片 -->
1468
- <sohelp-image-upload v-else-if="column.type === 'SohelpImageUpload'"
1646
+ <sohelp-image-upload
1647
+ v-else-if="column.type === 'SohelpImageUpload'"
1469
1648
  v-model="row[name]"
1470
1649
  v-bind="column.editRender"
1471
1650
  :data="getCellValue(rowIndex,name)"
1472
- :readonly="!column.editRender.edit">
1473
- </sohelp-image-upload>
1651
+ :readonly="!column.editRender.edit"/>
1474
1652
  <!-- 附件 -->
1475
1653
  <sohelp-file-upload
1476
1654
  v-else-if="column.type === 'SohelpFileUpload'"
1477
1655
  v-model="row[name]"
1478
1656
  v-bind="column.editRender"
1479
1657
  :data="getCellValue(rowIndex,name)"
1480
- :readonly="!column.editRender.edit">
1481
- </sohelp-file-upload>
1658
+ :readonly="!column.editRender.edit"/>
1482
1659
 
1483
1660
  <!-- 下拉选择表格 -->
1484
1661
  <div v-else-if="column.type === 'SohelpTableSelect' || column.type === 'ORG' || column.type ==='USER'">
@@ -1503,7 +1680,7 @@ defineExpose({
1503
1680
  v-bind="column.editRender"
1504
1681
  style="width: 100%"
1505
1682
  :readonly="!column.editRender.edit"
1506
- ></sohelp-process>
1683
+ />
1507
1684
 
1508
1685
 
1509
1686
  <!-- 下拉用户选择 -->
@@ -1532,7 +1709,8 @@ defineExpose({
1532
1709
  </div>
1533
1710
 
1534
1711
  <!-- 文本域 -->
1535
- <p style="margin: 0;"
1712
+ <p
1713
+ style="margin: 0;"
1536
1714
  class="textarea-reference"
1537
1715
  @click="showTextareaModal(column, name, row)"
1538
1716
  v-bind="column.editRender"
@@ -1557,7 +1735,7 @@ defineExpose({
1557
1735
  <!-- 可编辑状态 -->
1558
1736
  <template
1559
1737
  v-for="name in sohelpConfig?.properties?.map(item => item.name)"
1560
- v-slot:[`edit_${name}`]="{ row, column, rowIndex }"
1738
+ #[`edit_${name}`]="{ row, column, rowIndex }"
1561
1739
  :key="name"
1562
1740
  >
1563
1741
  <div v-if="column.editRender.enabled">
@@ -1608,11 +1786,12 @@ defineExpose({
1608
1786
  />
1609
1787
 
1610
1788
  <!-- 外键关联 -->
1611
- <sohelp-table-select v-else-if="column.type==='SohelpTableSelect'"
1789
+ <sohelp-table-select
1790
+ v-else-if="column.type==='SohelpTableSelect'"
1612
1791
  v-model:value="row[name]"
1613
1792
  v-model:data="gridData[rowIndex][name]"
1614
1793
  v-bind="column.editRender"
1615
- ></sohelp-table-select>
1794
+ />
1616
1795
 
1617
1796
  <!-- 数值 -->
1618
1797
  <sohelp-number-input
@@ -1636,10 +1815,10 @@ defineExpose({
1636
1815
  </template>
1637
1816
 
1638
1817
  <!-- 操作栏 -->
1639
- <template #_operation="{ row }">
1818
+ <template #_operation="{ row, column }">
1640
1819
  <el-space :size="10">
1641
1820
  <el-link
1642
- v-for="item in getOperationButtonsByType(row)"
1821
+ v-for="(item) in getOperationButtonsByType(row, column)"
1643
1822
  :key="item.code"
1644
1823
  :type="item.code === 'crud.delete' ? 'danger' : 'primary'"
1645
1824
  v-bind="item.params"
@@ -1653,7 +1832,7 @@ defineExpose({
1653
1832
  {{ item.title }}
1654
1833
  </el-link>
1655
1834
  <!-- 更多 -->
1656
- <el-dropdown v-if="getOperationButtonsByType(row,'more')?.length > 0">
1835
+ <el-dropdown v-if="getOperationButtonsByType(row, column,'more')?.length > 0">
1657
1836
  <el-link :underline="false">
1658
1837
  <span>更多</span>
1659
1838
  <el-icon style="margin-left: 4px;">
@@ -1662,8 +1841,9 @@ defineExpose({
1662
1841
  </el-link>
1663
1842
  <template #dropdown>
1664
1843
  <el-dropdown-menu>
1665
- <el-dropdown-item v-for="item in getOperationButtonsByType(row,'more')" :key="item.code"
1666
- @click="operationHandler({item:item, row:row,$grid:sohelpVxeGridRef})"
1844
+ <el-dropdown-item
1845
+ v-for="item in getOperationButtonsByType(row, column, 'more')" :key="item.code"
1846
+ @click.stop="operationHandler({item:item, row:row,$grid:sohelpVxeGridRef})"
1667
1847
  v-bind="item.props">
1668
1848
  <el-icon v-if="item.icon">
1669
1849
  <component :is="ElementPlusIcons[item.icon]" v-if="ElementPlusIcons[item.icon]" />
@@ -1682,7 +1862,7 @@ defineExpose({
1682
1862
  <!-- 统计 -->
1683
1863
  <template
1684
1864
  v-for="field in footerData"
1685
- v-slot:[`footer_${field["field"]}`]="{ row, column,rowIndex}"
1865
+ #[`footer_${field["field"]}`]="{ row, column,rowIndex}"
1686
1866
  :key="field['field']"
1687
1867
  >
1688
1868
  <div v-html="row[column.field]"></div>
@@ -1701,7 +1881,7 @@ defineExpose({
1701
1881
  :showOpera="false"
1702
1882
  ref="todoDrawerRef"
1703
1883
  :key="drawerKey"
1704
- ></workflow-drawer>
1884
+ />
1705
1885
 
1706
1886
  <!-- 提交审批 -->
1707
1887
  <approval-modal
@@ -1709,51 +1889,77 @@ defineExpose({
1709
1889
  type="submit"
1710
1890
  :data="approvalData"
1711
1891
  @confirm="reload"
1712
- ></approval-modal>
1892
+ />
1713
1893
 
1714
1894
  <!-- SohelpTextareaInput 编辑弹窗 -->
1715
1895
  <ele-modal :width="460" v-model="textareaState['visible']" :title="getCurrentFieldLabel">
1716
- <sohelp-textarea-input v-model="textareaState['value']" :rows="6"></sohelp-textarea-input>
1896
+ <sohelp-textarea-input v-model="textareaState['value']" :rows="6"/>
1717
1897
  <template #footer>
1718
1898
  <el-button @click="textareaCancel">{{ t("common.cancel") }}</el-button>
1719
1899
  <el-button type="primary" @click="textareaConfirm(row, column)">{{ t("common.save") }}</el-button>
1720
1900
  </template>
1721
- </ele-modal>
1722
-
1723
- <!--实体表单-->
1724
- <ele-modal :title="toolbarButtonParams?.title || ''"
1725
- :width="toolbarButtonParams?.width || 860"
1726
- v-model="visibleEntityForm" v-loading="loading">
1727
- <sohelp-entity-form ref="entityFormRef"
1728
- :refid="props.refid"
1729
- v-model="entityFormValue"
1730
- :data="entityFormData"
1731
- :config="entityFormConfig"
1732
- :readonly="toolbarButtonParams?.readonly"
1733
- ></sohelp-entity-form>
1734
- <template #footer v-if="!toolbarButtonParams?.readonly">
1735
- <el-button @click="closeEntityForm()">{{ t("common.close") }}</el-button>
1736
- <el-button type="primary" @click="saveEntityForm()" v-loading="loading">{{ t("common.save") }}</el-button>
1737
- </template>
1738
- </ele-modal>
1739
- <!--打印报表-->
1740
- <ele-modal :title="toolbarButtonParams?.title|| t('grid.report.title')" :width="toolbarButtonParams?.width|| 600"
1741
- v-model="visibleReport">
1742
-
1743
- <ele-check-card v-model="currentReportValue" :items="reportData" :row="{ gutter: 2 }">
1744
- <template #item="{ item }">
1745
- <ele-text size="md" style="padding:10px;">{{ item.name }}</ele-text>
1746
- </template>
1747
- </ele-check-card>
1901
+ </ele-modal>
1902
+
1903
+ <!--实体表单-->
1904
+ <sohelp-modal
1905
+ :title="toolbarButtonParams?.title || ''"
1906
+ :width="toolbarButtonParams?.width || 860"
1907
+ :draggable="false"
1908
+ v-model="visibleEntityForm" v-loading="loading">
1909
+ <template #setting v-if="userStore.info.is_developer">
1910
+ <ele-dropdown
1911
+ :items="[
1912
+ { title: '表单配置', command: 'form' , icon:Postcard},
1913
+ { title: '实体配置', command: 'entity', icon:Tickets},
1914
+ { title: '流程配置', command: 'workflow', icon:Files },
1915
+ { title: '模块配置', command: 'module', icon:Grid }
1916
+ ]"
1917
+ @command="settingClick"
1918
+ >
1919
+ <el-link :icon="Setting" :underline="false"/>
1920
+ </ele-dropdown>
1921
+ </template>
1748
1922
 
1749
- <template #footer>
1750
- <el-button @click="closeReport()">{{ t("common.close") }}</el-button>
1751
- <el-button @click="designReport()" v-if="reportData && reportData.length>0">{{ t("common.design") }}</el-button>
1752
- <el-button type="primary" @click="openReport()" v-if="reportData && reportData.length>0">{{ t("common.print") }}
1753
- </el-button>
1754
- </template>
1755
- </ele-modal>
1756
- </template>
1923
+ <sohelp-entity-form
1924
+ ref="entityFormRef"
1925
+ :refid="props.refid.split('!')[0]"
1926
+ v-model="entityFormValue"
1927
+ :data="entityFormData"
1928
+ :config="entityFormConfig"
1929
+ :readonly="toolbarButtonParams?.readonly"
1930
+ />
1931
+ <template #footer v-if="!toolbarButtonParams?.readonly">
1932
+ <el-button @click="closeEntityForm()">{{ t("common.close") }}</el-button>
1933
+ <el-button type="primary" @click="saveEntityForm()" v-loading="loading">{{ t("common.save") }}</el-button>
1934
+ </template>
1935
+ </sohelp-modal>
1936
+ <!--打印报表-->
1937
+ <ele-modal
1938
+ :title="toolbarButtonParams?.title|| t('grid.report.title')" :width="toolbarButtonParams?.width|| 600"
1939
+ v-model="visibleReport">
1940
+
1941
+ <ele-check-card v-model="currentReportValue" :items="reportData" :row="{ gutter: 2 }">
1942
+ <template #item="{ item }">
1943
+ <ele-text size="md" style="padding:10px;">{{ item.name }}</ele-text>
1944
+ </template>
1945
+ </ele-check-card>
1946
+
1947
+ <template #footer>
1948
+ <el-button @click="closeReport()">{{ t("common.close") }}</el-button>
1949
+ <el-button @click="designReport()" v-if="reportData && reportData.length>0">{{ t("common.design") }}</el-button>
1950
+ <el-button type="primary" @click="openReport()" v-if="reportData && reportData.length>0">{{ t("common.print") }}
1951
+ </el-button>
1952
+ </template>
1953
+ </ele-modal>
1954
+ <!--数据导入-->
1955
+ <sohelp-import
1956
+ :model-value="importVisible"
1957
+ :refid="props.refid"
1958
+ :fields="sohelpConfig?.properties || []"
1959
+ @update:modelValue="(v) => importVisible = v"
1960
+ @close="closeImport"
1961
+ />
1962
+ </template>
1757
1963
 
1758
1964
  <style scoped lang="scss">
1759
1965
  .sohelp-grid-view {
@@ -1886,5 +2092,15 @@ defineExpose({
1886
2092
  }
1887
2093
  }
1888
2094
 
2095
+ .column-setting{
2096
+ padding: 5px 10px;
2097
+ display: flex;
2098
+ align-items: center;
2099
+ justify-content: space-between;
2100
+ }
2101
+
2102
+
2103
+
2104
+
1889
2105
 
1890
2106
  </style>