cloud-web-corejs 1.0.54-dev.801 → 1.0.54-dev.803

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.
Files changed (36) hide show
  1. package/package.json +1 -1
  2. package/src/components/baseArea/index.vue +82 -27
  3. package/src/components/table/tableForm.vue +16 -5
  4. package/src/components/table/tableFormMixin.js +35 -7
  5. package/src/components/wf/content.vue +9 -1
  6. package/src/components/wf/wfActionDropdown.vue +32 -5
  7. package/src/components/wf/wfActionItems.js +22 -2
  8. package/src/components/wf/wfUtil.js +34 -10
  9. package/src/components/xform/form-designer/designer.js +6 -1
  10. package/src/components/xform/form-designer/form-widget/container-widget/data-table-widget.vue +9 -3
  11. package/src/components/xform/form-designer/form-widget/field-widget/date-range-widget.vue +3 -2
  12. package/src/components/xform/form-designer/form-widget/field-widget/date-widget.vue +3 -12
  13. package/src/components/xform/form-designer/form-widget/field-widget/mixins/date-limit-mixin.js +2 -46
  14. package/src/components/xform/form-designer/form-widget/field-widget/mixins/relative-default-mixin.js +107 -0
  15. package/src/components/xform/form-designer/form-widget/field-widget/mixins/relativeDateUtil.js +321 -0
  16. package/src/components/xform/form-designer/form-widget/field-widget/mixins/time-limit-mixin.js +2 -17
  17. package/src/components/xform/form-designer/form-widget/field-widget/time-range-widget.vue +3 -2
  18. package/src/components/xform/form-designer/form-widget/field-widget/time-widget.vue +3 -12
  19. package/src/components/xform/form-designer/setting-panel/property-editor/field-date/date-defaultValue-editor.vue +35 -36
  20. package/src/components/xform/form-designer/setting-panel/property-editor/field-date-range/date-range-defaultValue-editor.vue +35 -18
  21. package/src/components/xform/form-designer/setting-panel/property-editor/field-time/time-defaultValue-editor.vue +34 -36
  22. package/src/components/xform/form-designer/setting-panel/property-editor/field-time-range/time-range-defaultValue-editor.vue +35 -18
  23. package/src/components/xform/form-designer/setting-panel/property-editor/fixedQuery-editor.vue +39 -0
  24. package/src/components/xform/form-designer/setting-panel/property-editor/relative-default-block.vue +369 -0
  25. package/src/components/xform/form-designer/setting-panel/propertyRegister.js +1 -0
  26. package/src/components/xform/form-designer/widget-panel/widgetsConfig.js +34 -2
  27. package/src/components/xform/form-render/container-item/data-table-mixin.js +116 -74
  28. package/src/components/xform/lang/en-US.js +3 -0
  29. package/src/components/xform/lang/zh-CN.js +3 -0
  30. package/src/components/xform/utils/fixedQueryUtil.js +93 -0
  31. package/src/views/user/home/wjl/content.vue +1206 -0
  32. package/src/views/user/menu/voc_list.vue +686 -0
  33. package/src/views/user/role/edit.vue +32 -9
  34. package/src/views/user/role/list.vue +142 -67
  35. package/src/views/user/role/voc_edit.vue +282 -0
  36. package/src/views/user/wf/wf_manage/list.vue +17 -1
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "cloud-web-corejs",
3
3
  "private": false,
4
- "version": "1.0.54-dev.801",
4
+ "version": "1.0.54-dev.803",
5
5
  "scripts": {
6
6
  "dev": "vue-cli-service serve",
7
7
  "dev:micro": "vue-cli-service serve --port 17527",
@@ -1,6 +1,7 @@
1
1
  <template>
2
2
  <div class="base-area">
3
3
  <el-popover
4
+ ref="popoverRef"
4
5
  v-model="popoverVisible"
5
6
  placement="bottom-start"
6
7
  trigger="click"
@@ -268,13 +269,28 @@ export default {
268
269
  if (this.labelValue) {
269
270
  return this.labelValue;
270
271
  }
271
- const pathLabel = this.selectedPath.length
272
+ /* 弹层浏览中的选择未确认,输入框只回显打开弹层时的已提交值 */
273
+ if (this.popoverVisible) {
274
+ return this.committedPathLabel;
275
+ }
276
+ if (!this.selectedPath.length) {
277
+ return "";
278
+ }
279
+ /* 外部未回传 label 时的兜底:仅当浏览路径与已绑定值一致才回显 */
280
+ const leafId = this.getLeafIdFromValue(this.value);
281
+ return this.isValueSynced(leafId)
272
282
  ? this.buildPathLabel(this.selectedPath)
273
283
  : "";
274
- if (this.popoverVisible && pathLabel) {
275
- return pathLabel;
284
+ },
285
+ committedPathLabel() {
286
+ const snapshot = this.committedBrowseSnapshot;
287
+ if (!snapshot || !snapshot.selectedPath || !snapshot.selectedPath.length) {
288
+ return "";
276
289
  }
277
- return pathLabel || "";
290
+ if (!this.isSameBoundValue(this.value, snapshot.boundValue)) {
291
+ return "";
292
+ }
293
+ return this.buildPathLabel(snapshot.selectedPath);
278
294
  },
279
295
  tabs() {
280
296
  const tabs = [];
@@ -336,8 +352,43 @@ export default {
336
352
  },
337
353
  beforeDestroy() {
338
354
  clearTimeout(this.searchTimer);
355
+ this.unbindOutsideClick();
339
356
  },
340
357
  methods: {
358
+ bindOutsideClick() {
359
+ /* 捕获阶段监听:外层若阻止了 click 冒泡,el-popover 自带的 document 监听收不到,弹层不会关闭 */
360
+ document.addEventListener("mousedown", this.handleOutsideClick, true);
361
+ },
362
+ unbindOutsideClick() {
363
+ document.removeEventListener("mousedown", this.handleOutsideClick, true);
364
+ },
365
+ isInsidePopover(target) {
366
+ if (!target || !target.nodeType) {
367
+ return false;
368
+ }
369
+ /* 触发器(含输入框)在组件根节点内 */
370
+ if (this.$el && this.$el.contains(target)) {
371
+ return true;
372
+ }
373
+ /* 弹层默认 append 到 body,需单独判断 */
374
+ const popoverRef = this.$refs.popoverRef;
375
+ const popper = popoverRef && popoverRef.$refs && popoverRef.$refs.popper;
376
+ return !!(popper && popper.contains(target));
377
+ },
378
+ handleOutsideClick(evt) {
379
+ if (!this.popoverVisible) {
380
+ return;
381
+ }
382
+ const target = evt.target;
383
+ /* 已从文档移除的节点无法判断归属,不做处理 */
384
+ if (!target || !document.contains(target)) {
385
+ return;
386
+ }
387
+ if (this.isInsidePopover(target)) {
388
+ return;
389
+ }
390
+ this.popoverVisible = false;
391
+ },
341
392
  getResolveDepthLimit(item) {
342
393
  if (item && item.treePath) {
343
394
  const ids = this.parseTreePathIds(item.treePath);
@@ -565,6 +616,7 @@ export default {
565
616
  },
566
617
  handlePopoverShow() {
567
618
  this.pendingLeaf = false;
619
+ this.bindOutsideClick();
568
620
  this.saveCommittedBrowseSnapshot();
569
621
  this.$emit("popover-open");
570
622
  this.$nextTick(() => {
@@ -1060,6 +1112,7 @@ export default {
1060
1112
  this.emitResolvedLabelIfNeeded();
1061
1113
  },
1062
1114
  handlePopoverHide() {
1115
+ this.unbindOutsideClick();
1063
1116
  this.searchKeyword = "";
1064
1117
  this.searchList = [];
1065
1118
  this.searchDropdownVisible = false;
@@ -1299,13 +1352,13 @@ export default {
1299
1352
  }
1300
1353
 
1301
1354
  .base-area-panel {
1302
- padding: 4px 0 0;
1355
+ padding: 0;
1303
1356
  overflow: visible;
1304
1357
  }
1305
1358
 
1306
1359
  .base-area-search {
1307
1360
  position: relative;
1308
- margin-bottom: 8px;
1361
+ margin-bottom: 6px;
1309
1362
  z-index: 2;
1310
1363
  }
1311
1364
 
@@ -1360,8 +1413,8 @@ export default {
1360
1413
  }
1361
1414
 
1362
1415
  .base-area-path {
1363
- padding: 6px 10px;
1364
- margin-bottom: 10px;
1416
+ padding: 3px 8px;
1417
+ margin-bottom: 6px;
1365
1418
  background: #f5f7fa;
1366
1419
  border: 1px solid #ebeef5;
1367
1420
  border-radius: 4px;
@@ -1380,7 +1433,7 @@ export default {
1380
1433
  padding: 0 2px;
1381
1434
  font-size: 12px;
1382
1435
  color: #c0c4cc;
1383
- line-height: 24px;
1436
+ line-height: 22px;
1384
1437
  user-select: none;
1385
1438
  }
1386
1439
 
@@ -1389,8 +1442,8 @@ export default {
1389
1442
  min-width: 0;
1390
1443
  max-width: 100%;
1391
1444
  padding: 0 4px;
1392
- height: 24px;
1393
- line-height: 24px;
1445
+ height: 22px;
1446
+ line-height: 22px;
1394
1447
  border: none;
1395
1448
  border-bottom: 2px solid transparent;
1396
1449
  border-radius: 0;
@@ -1427,7 +1480,7 @@ export default {
1427
1480
  }
1428
1481
 
1429
1482
  .base-area-grid-wrap {
1430
- padding: 8px;
1483
+ padding: 6px;
1431
1484
  background: #fff;
1432
1485
  border: 1px solid #eee;
1433
1486
  border-radius: 8px;
@@ -1436,20 +1489,22 @@ export default {
1436
1489
  .base-area-grid {
1437
1490
  display: flex;
1438
1491
  flex-wrap: wrap;
1439
- min-height: 120px;
1440
- max-height: 294px;
1492
+ align-content: flex-start;
1493
+ min-height: 82px;
1494
+ /* 5 行:(28 + 6) * 5 + 4 */
1495
+ max-height: 174px;
1441
1496
  overflow-y: auto;
1442
1497
  margin: 0 -4px;
1443
1498
  }
1444
1499
 
1445
1500
  .base-area-item {
1446
1501
  width: calc(25% - 8px);
1447
- margin: 0 4px 8px;
1502
+ margin: 0 4px 6px;
1448
1503
  padding: 0 10px;
1449
- height: 34px;
1450
- line-height: 34px;
1504
+ height: 28px;
1505
+ line-height: 28px;
1451
1506
  border: 1px solid #eee;
1452
- border-radius: 8px;
1507
+ border-radius: 6px;
1453
1508
  font-size: 12px;
1454
1509
  cursor: pointer;
1455
1510
  overflow: hidden;
@@ -1470,7 +1525,7 @@ export default {
1470
1525
 
1471
1526
  .base-area-empty {
1472
1527
  width: 100%;
1473
- padding: 24px 0;
1528
+ padding: 16px 0;
1474
1529
  text-align: center;
1475
1530
  color: #909399;
1476
1531
  font-size: 12px;
@@ -1480,12 +1535,12 @@ export default {
1480
1535
  display: flex;
1481
1536
  align-items: center;
1482
1537
  justify-content: space-between;
1483
- margin-top: 8px;
1538
+ margin-top: 6px;
1484
1539
 
1485
1540
  .base-area-nav-btn {
1486
1541
  min-width: 32px;
1487
- padding: 7px 10px;
1488
- border-radius: 8px;
1542
+ padding: 5px 10px;
1543
+ border-radius: 6px;
1489
1544
  color: #fff;
1490
1545
  border-color: $baseColor;
1491
1546
  background-color: $baseColor;
@@ -1522,7 +1577,7 @@ export default {
1522
1577
  text-align: center;
1523
1578
  font-size: 12px;
1524
1579
  color: #606266;
1525
- line-height: 28px;
1580
+ line-height: 24px;
1526
1581
  user-select: none;
1527
1582
  }
1528
1583
  }
@@ -1531,8 +1586,8 @@ export default {
1531
1586
  display: flex;
1532
1587
  align-items: center;
1533
1588
  justify-content: flex-end;
1534
- margin-top: 8px;
1535
- padding-top: 8px;
1589
+ margin-top: 6px;
1590
+ padding-top: 6px;
1536
1591
  border-top: 1px solid #ebeef5;
1537
1592
  }
1538
1593
  </style>
@@ -1577,7 +1632,7 @@ export default {
1577
1632
  }
1578
1633
 
1579
1634
  .base-area-popover {
1580
- padding: 10px 12px;
1635
+ padding: 8px 10px;
1581
1636
  overflow: visible;
1582
1637
  box-sizing: border-box;
1583
1638
 
@@ -1599,7 +1654,7 @@ export default {
1599
1654
  }
1600
1655
 
1601
1656
  .base-area-nav-btn.el-button {
1602
- border-radius: 8px;
1657
+ border-radius: 6px;
1603
1658
  color: #fff;
1604
1659
  border-color: $baseColor;
1605
1660
  background-color: $baseColor;
@@ -222,13 +222,18 @@
222
222
  <el-table
223
223
  ref="singleTable"
224
224
  width="100%"
225
- :data="tableColumns"
225
+ :data="dialogColumns"
226
226
  border=""
227
227
  row-key="field"
228
228
  stripe=""
229
+ :row-class-name="dialogRowClassName"
229
230
  >
230
231
  <el-table-column type="index" width="35" fixed="left"></el-table-column>
231
- <el-table-column label="" width="38"><i class="iconfont icon-tuodongweizhi drag-option"></i></el-table-column>
232
+ <el-table-column label="" width="38">
233
+ <template slot-scope="scope">
234
+ <i v-if="!scope.row.lockValue" class="iconfont icon-tuodongweizhi drag-option"></i>
235
+ </template>
236
+ </el-table-column>
232
237
  <el-table-column :label="$t2('名称', 'components.table.name')" width="150" prop="title">
233
238
  <template slot-scope="scope">
234
239
  {{ scope.row.title }}
@@ -236,8 +241,12 @@
236
241
  </el-table-column>
237
242
  <el-table-column :label="$t2('默认值', 'components.table.defaultValue')" width="375" prop="defaultValue">
238
243
  <template slot-scope="scope">
244
+ <!-- 固定查询条件的值由业务通道注入,这里不给改,也不参与还原/确定的写值 -->
245
+ <span v-if="scope.row.lockValue" class="text-tip">
246
+ {{ $t1('固定条件') }}
247
+ </span>
239
248
  <template
240
- v-if="scope.row.defaultValueEnabled!==false && (scope.row.defaultValueEnabled || !scope.row.slot)">
249
+ v-else-if="scope.row.defaultValueEnabled!==false && (scope.row.defaultValueEnabled || !scope.row.slot)">
241
250
  <template v-if="scope.row.type =='input'">
242
251
  <el-input v-model="scope.row.defaultValue" size="small" clearable></el-input>
243
252
  </template>
@@ -280,7 +289,7 @@
280
289
  </el-table-column>
281
290
  <el-table-column :label="$t2('是否常用', 'components.table.common')" width="70" prop="common">
282
291
  <template slot-scope="scope">
283
- <el-switch v-model="scope.row.common"></el-switch>
292
+ <el-switch v-model="scope.row.common" :disabled="scope.row.lockValue === true"></el-switch>
284
293
  </template>
285
294
  </el-table-column>
286
295
  </el-table>
@@ -315,5 +324,7 @@ export default {
315
324
  </script>
316
325
 
317
326
  <style scoped>
318
-
327
+ .text-tip {
328
+ color: #909399;
329
+ }
319
330
  </style>
@@ -15,7 +15,10 @@ modules = {
15
15
  showAdvancedSearch: false,
16
16
  form1Fields: [],
17
17
  form2Fields: [],
18
+ /* 全量列,「确定」按它回写,隐藏列也在里面(不能丢,它照样往上送条件) */
18
19
  tableColumns: [],
20
+ /* 弹框实际渲染的列,是 tableColumns 里非隐藏项的**引用**(同一批对象,改默认值直接生效) */
21
+ dialogColumns: [],
19
22
  dialogVisible: false,
20
23
  advancedFormData: {},
21
24
  formDataClone: {},
@@ -213,13 +216,17 @@ modules = {
213
216
  },
214
217
  openTableColumnsDialog() {
215
218
  let $grid = this.$parent;
216
- let tableColumns = (tableColumns = this.$baseLodash.cloneDeep(
219
+ // 原写法 let tableColumns = (tableColumns = ...) 自引用触发 TDZ,
220
+ // 只因 Babel 把 let 降成 var 才没在浏览器里炸
221
+ let tableColumns = this.$baseLodash.cloneDeep(
217
222
  $grid.params.searchColumns || []
218
- ));
223
+ );
219
224
  tableColumns.forEach((item) => {
220
225
  if (!item.widgetConfig) item.widgetConfig = {};
221
226
  });
222
227
  this.tableColumns = tableColumns;
228
+ // 隐藏字段(如查询区里存树ID的隐藏输入框)是内部条件,不给用户看也不给拖
229
+ this.dialogColumns = tableColumns.filter((item) => !item.hidden);
223
230
  this.dialogVisible = true;
224
231
  this.$nextTick(() => {
225
232
  this.$nextTick(() => {
@@ -231,20 +238,34 @@ modules = {
231
238
  let e = this.$refs.singleTable.$el.querySelectorAll(
232
239
  ".el-table__body-wrapper > table > tbody"
233
240
  )[0],
234
- t = this.tableColumns;
241
+ t = this.tableColumns,
242
+ visible = this.dialogColumns;
235
243
  this.sortable = Sortable.create(e, {
236
244
  ghostClass: "sortable-ghost",
245
+ // 固定查询条件不可拖动(它的位置由配置决定,个性化也不该记)
246
+ filter: ".drag-disabled",
237
247
  setData: function (e) {
238
248
  e.setData("Text", "");
239
249
  },
240
250
  onEnd: function (e) {
241
- let i = t.splice(e.oldIndex, 1)[0];
242
- t.splice(e.newIndex, 0, i);
243
- /*t[e.newIndex].value;
244
- t[e.newIndex - 1] && t[e.newIndex - 1].value, t[e.newIndex + 1] && t[e.newIndex + 1].value;*/
251
+ // 拖拽发生在「可见列」上,隐藏列不在其中,所以要把新次序同步回全量列:
252
+ // 先在可见列里挪好,再按「新位置的后一个可见列」定位插到全量列的哪里。
253
+ let moved = visible.splice(e.oldIndex, 1)[0];
254
+ visible.splice(e.newIndex, 0, moved);
255
+ let fullIndex = t.indexOf(moved);
256
+ if (fullIndex > -1) {
257
+ t.splice(fullIndex, 1);
258
+ }
259
+ let nextVisible = visible[e.newIndex + 1];
260
+ let insertAt = nextVisible ? t.indexOf(nextVisible) : t.length;
261
+ t.splice(insertAt < 0 ? t.length : insertAt, 0, moved);
245
262
  },
246
263
  });
247
264
  },
265
+ /** 固定查询条件行加标记类:禁拖拽(Sortable filter)+ 视觉上区分 */
266
+ dialogRowClassName({ row }) {
267
+ return row && row.lockValue ? "drag-disabled" : "";
268
+ },
248
269
  dialogPrimary(newTableColumns) {
249
270
  let searchColumns = this.$baseLodash.cloneDeep(
250
271
  newTableColumns || this.tableColumns
@@ -266,6 +287,13 @@ modules = {
266
287
  // this.$set(this, "formData", {});
267
288
  // this.$set(this, "advancedFormData", {});
268
289
  searchColumns.forEach((form1Field) => {
290
+ // 固定查询条件:值由业务通道(树点选 / 脚本 setValue / 页面回填)注入,
291
+ // 「确定」「还原」都不许覆盖它,否则一点设置就把当前上下文查丢了。
292
+ // 注意只认 lockValue,不认 fixed —— 手写页面的 fixed 列(如分支)
293
+ // 正是靠这里按 defaultValue 回填的,跳过它们会打掉原有行为。
294
+ if (form1Field.lockValue) {
295
+ return;
296
+ }
269
297
  let nullValue = this.getNullValue(form1Field);
270
298
  let defaultValue = nullValue;
271
299
  if (form1Field.defaultValueEnabled !== false) {
@@ -7,7 +7,8 @@
7
7
  >
8
8
  <template #default>
9
9
  <!-- 审批按钮条留在流程模块内,不随 wfActionInHeaderEnabled 搬走或隐藏。
10
- 开了该开关时,详情标题栏另挂一份「流程操作」下拉(wfActionDropdown.vue)。 -->
10
+ 开了该开关时,详情标题栏另挂一份(wfActionDropdown.vue):通过/驳回/撤回平铺,
11
+ 其余收进「流程操作」下拉。 -->
11
12
  <div
12
13
  ref="wfActionBar"
13
14
  style="margin: -36px 0 8px 124px; position: relative; z-index: 2; height: 28px"
@@ -629,6 +630,8 @@
629
630
  </span>
630
631
  </el-dialog>
631
632
 
633
+ <!-- append-to-body 必须留着:本弹框在 baseTabPane 的 v-show 子树里,
634
+ 「流程信息」一折叠就跟着 display:none,标题栏那份审批入口点了会毫无反应 -->
632
635
  <el-dialog
633
636
  v-if="rejectDialogVisible"
634
637
  :visible.sync="rejectDialogVisible"
@@ -638,6 +641,7 @@
638
641
  custom-class="dialog-style wf-dialog"
639
642
  v-el-drag-dialog
640
643
  v-el-dialog-center
644
+ :append-to-body="true"
641
645
  >
642
646
  <template #title>
643
647
  <span class="el-dialog__title"
@@ -715,6 +719,7 @@
715
719
  </el-button>
716
720
  </span>
717
721
  </el-dialog>
722
+ <!-- 同上:折叠态下要能弹出来,append-to-body 不能去掉 -->
718
723
  <el-dialog
719
724
  v-if="agreeDialogVisible"
720
725
  :visible.sync="agreeDialogVisible"
@@ -724,6 +729,7 @@
724
729
  custom-class="dialog-style wf-dialog"
725
730
  v-el-drag-dialog
726
731
  v-el-dialog-center
732
+ :append-to-body="true"
727
733
  >
728
734
  <template #title>
729
735
  <span class="el-dialog__title"
@@ -939,6 +945,7 @@
939
945
  >
940
946
  </span>
941
947
  </el-dialog>
948
+ <!-- 同上:折叠态下要能弹出来,append-to-body 不能去掉 -->
942
949
  <el-dialog
943
950
  v-if="revokeDialogVisible"
944
951
  :visible.sync="revokeDialogVisible"
@@ -948,6 +955,7 @@
948
955
  custom-class="dialog-style wf-dialog"
949
956
  v-el-drag-dialog
950
957
  v-el-dialog-center
958
+ :append-to-body="true"
951
959
  >
952
960
  <template #title>
953
961
  <span class="el-dialog__title"
@@ -1,13 +1,23 @@
1
1
  <template>
2
- <div class="button-sty" v-show="items.length">
3
- <el-dropdown trigger="hover">
2
+ <div class="wf-action-dropdown-wrap button-sty" v-show="items.length">
3
+ <!-- 通过 / 驳回 / 撤回 挪出下拉,在标题栏直接平铺;其余操作仍收在「流程操作」下拉里 -->
4
+ <el-button
5
+ v-for="item in standaloneItems"
6
+ :key="item.key"
7
+ :type="item.buttonType || 'primary'"
8
+ :icon="item.iconClass || item.elIcon"
9
+ class="button-sty"
10
+ @click="item.run(wfVm)"
11
+ >{{ itemLabel(item) }}
12
+ </el-button>
13
+ <el-dropdown trigger="hover" v-if="dropdownItems.length">
4
14
  <el-button type="primary" class="button-sty">
5
15
  {{ $t1("流程操作") }}
6
16
  <i class="el-icon-arrow-down el-icon--right"></i>
7
17
  </el-button>
8
18
  <el-dropdown-menu slot="dropdown">
9
19
  <el-dropdown-item
10
- v-for="item in items"
20
+ v-for="item in dropdownItems"
11
21
  :key="item.key"
12
22
  :icon="item.elIcon"
13
23
  @click.native="item.run(wfVm)"
@@ -21,7 +31,10 @@
21
31
  </template>
22
32
 
23
33
  <script>
24
- import { getVisibleWfActionItems } from "./wfActionItems";
34
+ import {
35
+ getVisibleWfActionItems,
36
+ HEADER_STANDALONE_KEYS,
37
+ } from "./wfActionItems";
25
38
 
26
39
  export default {
27
40
  name: "WfActionDropdown",
@@ -31,14 +44,28 @@ export default {
31
44
  type: Object,
32
45
  required: true,
33
46
  },
47
+ // 不收进下拉、直接平铺成独立按钮的操作 key
48
+ standaloneKeys: {
49
+ type: Array,
50
+ default: () => HEADER_STANDALONE_KEYS,
51
+ },
34
52
  },
35
53
  computed: {
36
54
  // 求值时会读 wfVm 上的响应式字段,跨实例也能跟着流程状态更新
37
55
  items() {
38
56
  return getVisibleWfActionItems(this.wfVm);
39
57
  },
58
+ standaloneItems() {
59
+ return this.items.filter((item) => this.isStandalone(item));
60
+ },
61
+ dropdownItems() {
62
+ return this.items.filter((item) => !this.isStandalone(item));
63
+ },
40
64
  },
41
65
  methods: {
66
+ isStandalone(item) {
67
+ return (this.standaloneKeys || []).indexOf(item.key) > -1;
68
+ },
42
69
  itemLabel(item) {
43
70
  if (item.i18nPath) {
44
71
  return this.$t2(item.defaultLabel, item.i18nPath);
@@ -50,9 +77,9 @@ export default {
50
77
  </script>
51
78
 
52
79
  <style scoped>
80
+ /* 标题栏 .fr 内其余按钮都是行内元素,包裹层必须跟着行内排,否则会另起一行 */
53
81
  .wf-action-dropdown-wrap {
54
82
  display: inline-block;
55
83
  vertical-align: middle;
56
- margin-right: 10px;
57
84
  }
58
85
  </style>
@@ -3,17 +3,26 @@
3
3
  * 避免两处各写一遍之后漂移。
4
4
  *
5
5
  * vm 是 content.vue 实例(挂了 wfContentMixin)。
6
+ *
7
+ * buttonType 只在「平铺成独立按钮」时用得上(见 HEADER_STANDALONE_KEYS),
8
+ * 取值与流程模块按钮条里同名按钮保持一致。
6
9
  */
10
+
11
+ /* 详情标题栏里不收进下拉、直接平铺成独立按钮的操作。
12
+ 顺序按 getWfActionItems 的定义序,不按这里的书写序。 */
13
+ export const HEADER_STANDALONE_KEYS = ["agree", "reject", "revoke"];
14
+
7
15
  export function getWfActionItems(vm) {
8
16
  let wfInfo = (vm && vm.wfInfo) || {};
9
- let toTransfer =
10
- wfInfo.toTransfer === null || wfInfo.toTransfer === undefined
17
+ let toTransfer
18
+ = wfInfo.toTransfer === null || wfInfo.toTransfer === undefined
11
19
  ? !!wfInfo.toSubmit
12
20
  : !!wfInfo.toTransfer;
13
21
 
14
22
  return [
15
23
  {
16
24
  key: "agree",
25
+ buttonType: "success",
17
26
  show: !!wfInfo.toSubmit,
18
27
  defaultLabel: "通过",
19
28
  i18nPath: "components.wf.agree",
@@ -22,6 +31,7 @@ export function getWfActionItems(vm) {
22
31
  },
23
32
  {
24
33
  key: "manual",
34
+ buttonType: "warning",
25
35
  show: !!wfInfo.toInterrupt,
26
36
  defaultLabel: "中断",
27
37
  i18nPath: "components.wf.manual",
@@ -30,6 +40,7 @@ export function getWfActionItems(vm) {
30
40
  },
31
41
  {
32
42
  key: "reject",
43
+ buttonType: "danger",
33
44
  show: !!wfInfo.toReject,
34
45
  defaultLabel: "驳回",
35
46
  i18nPath: "components.wf.reject",
@@ -38,6 +49,7 @@ export function getWfActionItems(vm) {
38
49
  },
39
50
  {
40
51
  key: "transfer",
52
+ buttonType: "primary",
41
53
  show: toTransfer,
42
54
  defaultLabel: "转办",
43
55
  i18nPath: "components.wf.transfer",
@@ -46,6 +58,7 @@ export function getWfActionItems(vm) {
46
58
  },
47
59
  {
48
60
  key: "urging",
61
+ buttonType: "primary",
49
62
  show: !!wfInfo.toInterrupt,
50
63
  defaultLabel: "催办",
51
64
  i18nPath: "components.wf.urging",
@@ -54,6 +67,7 @@ export function getWfActionItems(vm) {
54
67
  },
55
68
  {
56
69
  key: "addIncreaseSign",
70
+ buttonType: "primary",
57
71
  show: !!(vm.increaseSignEnabled && wfInfo.toAddIncreaseSign),
58
72
  defaultLabel: "加签",
59
73
  i18nPath: "components.wf.addIncreaseSign",
@@ -62,6 +76,7 @@ export function getWfActionItems(vm) {
62
76
  },
63
77
  {
64
78
  key: "deleteIncreaseSign",
79
+ buttonType: "primary",
65
80
  show: !!(vm.increaseSignEnabled && wfInfo.toDeleteIncreaseSign),
66
81
  defaultLabel: "减签",
67
82
  i18nPath: "components.wf.deleteIncreaseSign",
@@ -70,6 +85,7 @@ export function getWfActionItems(vm) {
70
85
  },
71
86
  {
72
87
  key: "talk",
88
+ buttonType: "primary",
73
89
  show: !!(vm.toTalk && wfInfo.toLinkup),
74
90
  defaultLabel: "沟通",
75
91
  i18nPath: "components.wf.talk",
@@ -78,6 +94,7 @@ export function getWfActionItems(vm) {
78
94
  },
79
95
  {
80
96
  key: "setCandidate",
97
+ buttonType: "primary",
81
98
  show: !!wfInfo.toSetCandidate,
82
99
  defaultLabel: "修改候选人",
83
100
  i18nPath: "components.wf.setCandidate",
@@ -86,6 +103,7 @@ export function getWfActionItems(vm) {
86
103
  },
87
104
  {
88
105
  key: "revoke",
106
+ buttonType: "danger",
89
107
  show: !!wfInfo.toRevoke,
90
108
  defaultLabel: "撤回",
91
109
  i18nPath: "components.wf.revoke",
@@ -94,6 +112,7 @@ export function getWfActionItems(vm) {
94
112
  },
95
113
  {
96
114
  key: "addOpinion",
115
+ buttonType: "primary",
97
116
  show: !!vm.showAddOpinionButton,
98
117
  defaultLabel: "补充意见",
99
118
  run: (wfVm) => {
@@ -103,6 +122,7 @@ export function getWfActionItems(vm) {
103
122
  },
104
123
  {
105
124
  key: "editScript",
125
+ buttonType: "primary",
106
126
  show: !!wfInfo.wfAdmin,
107
127
  defaultLabel: "修改脚本",
108
128
  elIcon: "el-icon-edit",