cloud-web-corejs 1.0.54-dev.645 → 1.0.54-dev.647

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.
@@ -276,7 +276,7 @@
276
276
  class="a-link"
277
277
  data-tit="新增"
278
278
  @click="addEditRow(null, obj)"
279
- v-if="widget.options.isTreeTable"
279
+ v-if="widget.options.isTreeTable && canShowRowAdd(obj)"
280
280
  >
281
281
  <el-tooltip
282
282
  :enterable="false"
@@ -287,7 +287,12 @@
287
287
  ><i class="el-icon-circle-plus-outline"></i
288
288
  ></el-tooltip>
289
289
  </a>
290
- <a @click="editRowEvent(obj)" class="a-link" data-tit="行编辑">
290
+ <a
291
+ @click="editRowEvent(obj)"
292
+ class="a-link"
293
+ data-tit="行编辑"
294
+ v-if="canShowRowEdit(obj)"
295
+ >
291
296
  <el-tooltip
292
297
  :enterable="false"
293
298
  effect="dark"
@@ -2710,10 +2710,87 @@ modules = {
2710
2710
  this.handleWbs();
2711
2711
  });
2712
2712
  },
2713
+ getTableRowAuthCode(authName) {
2714
+ if (!authName) {
2715
+ return null;
2716
+ }
2717
+ let formRef = this.getFormRef();
2718
+ if (formRef && formRef.reportTemplate) {
2719
+ return formRef.reportTemplate.formCode + ":" + authName;
2720
+ }
2721
+ return null;
2722
+ },
2723
+ hasTableRowPermission(authName) {
2724
+ if (!authName) {
2725
+ return true;
2726
+ }
2727
+ let authCode = this.getTableRowAuthCode(authName);
2728
+ if (!authCode) {
2729
+ return true;
2730
+ }
2731
+ let dispermissions = this.$store.getters.dispermissions;
2732
+ return !dispermissions.includes(authCode);
2733
+ },
2734
+ getRowAddAuthName() {
2735
+ return (
2736
+ this.widget.options.rowAddAuthName ?? this.widget.options.treeRowAddName
2737
+ );
2738
+ },
2739
+ getRowEditAuthName() {
2740
+ return (
2741
+ this.widget.options.rowEditAuthName ??
2742
+ this.widget.options.treeRowEditName
2743
+ );
2744
+ },
2745
+ getRowAddShow() {
2746
+ return (
2747
+ this.widget.options.rowAddShow ?? this.widget.options.treeRowAddShow
2748
+ );
2749
+ },
2750
+ getRowEditShow() {
2751
+ return (
2752
+ this.widget.options.rowEditShow ?? this.widget.options.treeRowEditShow
2753
+ );
2754
+ },
2755
+ isRowButtonShow(script, obj) {
2756
+ if (!script) {
2757
+ return true;
2758
+ }
2759
+ let result = this.handleCustomEvent(script, ["tableParam"], [obj]);
2760
+ return result !== false;
2761
+ },
2762
+ canShowRowAdd(obj) {
2763
+ return (
2764
+ this.hasTableRowPermission(this.getRowAddAuthName()) &&
2765
+ this.isRowButtonShow(this.getRowAddShow(), obj)
2766
+ );
2767
+ },
2768
+ canShowRowEdit(obj) {
2769
+ let isAddRow = !this.hasSaveRow(obj?.row);
2770
+ if (isAddRow) return true;
2771
+ return (
2772
+ this.hasTableRowPermission(this.getRowEditAuthName()) &&
2773
+ this.isRowButtonShow(this.getRowEditShow(), obj)
2774
+ );
2775
+ },
2776
+ editRowEvent(obj) {
2777
+ if (!this.canShowRowEdit(obj)) {
2778
+ return false;
2779
+ }
2780
+ if (this.hasEditingRow(obj.$table, 1)) {
2781
+ return false;
2782
+ }
2783
+ let row = obj.row;
2784
+ obj.$table.editCloneRow = this.$baseLodash.cloneDeep(obj.row);
2785
+ obj.$table.setActiveRow(row);
2786
+ },
2713
2787
  addSiblingEditRow(rowData, obj) {
2714
2788
  this.addEditRow(rowData, obj, null, true);
2715
2789
  },
2716
2790
  addEditRow(rowData, obj, toEnd, toSibling) {
2791
+ if (rowData == null && obj && !this.canShowRowAdd(obj)) {
2792
+ return false;
2793
+ }
2717
2794
  let isEditTable = this.widget.options.isEditTable || false;
2718
2795
  let isTreeTable = this.widget.options.isTreeTable || false;
2719
2796
  let parent = obj?.row;