gcs-ui-lib 1.2.22 → 1.2.24

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gcs-ui-lib",
3
- "version": "1.2.22",
3
+ "version": "1.2.24",
4
4
  "private": false,
5
5
  "main": "./lib/gcs-ui-lib.common.js",
6
6
  "scripts": {
@@ -1,6 +1,6 @@
1
1
  <template>
2
2
  <div>
3
- <template v-if="isCustomType">
3
+ <template v-if="isCustomType && !isCustomName">
4
4
  <component
5
5
  :is="typeMap[row.fieldProperty]"
6
6
  :value.sync="value"
@@ -470,7 +470,7 @@ export default {
470
470
  function fl(node) {
471
471
  node?.matchingRules?.forEach((i) => {
472
472
  let l1 = i.matchingValueType === "DYNAMIC";
473
- let l3 = i.matchingOperation == "EQUALS";
473
+ let l3 = ["EQUALS", "NOT_EQUALS", "CONTAINS", "NOT_CONTAINS"].includes(i.matchingOperation);
474
474
  const tmval = i.TmValues?.[0] || "";
475
475
  if (l1 && l3 && !TmValueArr.includes(tmval)) {
476
476
  TmValueArr.push(tmval);
@@ -1,13 +1,28 @@
1
1
  <template>
2
2
  <div>
3
+ <div class="flex-box flex-c flex-v m-b-s">
4
+ <el-button size="mini" @click="showColumnVisible = true">{{ '显示列' | $l }}</el-button>
5
+ </div>
6
+ <cl-show-column
7
+ ref="showColumn"
8
+ :dialog-visible.sync="showColumnVisible"
9
+ :check-columns="checkColumns"
10
+ :columns="TableHeader"
11
+ label-key="label"
12
+ :auto-save="false"
13
+ :page-id="showColumnPageId"
14
+ :fixed-count="2"
15
+ @setColumns="setChange"
16
+ />
3
17
  <Trade
4
18
  ref="fillList"
5
19
  :selection="true"
6
20
  :columns="columns"
7
21
  :tableData="tableData"
22
+ @columns-change="handleColumnsChange"
8
23
  >
9
24
  <!-- 管理单位 -->
10
- <template slot="businessTypeNo" slot-scope="{ scope }">
25
+ <template slot="manageUnitNo" slot-scope="{ scope }">
11
26
  fffffffff
12
27
  </template>
13
28
  </Trade>
@@ -18,15 +33,16 @@
18
33
  </template>
19
34
 
20
35
  <script>
21
- import { TableOperateColumn } from "n20-common-lib";
36
+ import { TableOperateColumn, ShowColumn } from "n20-common-lib";
22
37
  import { $l } from "n20-common-lib/src/utils/i18n";
23
38
  import {amountFormat} from "@/utils/index"
24
- import Trade from "../main.vue"; // 真正使用的时候不用导入 已全局use
39
+ import Trade from "../main.vue";
25
40
  export default {
26
41
  name: "trade",
27
42
  components: {
28
43
  TableOperateColumn,
29
- Trade, // 真正使用的时候不用导入 已全局use
44
+ ShowColumn,
45
+ Trade,
30
46
  },
31
47
  data() {
32
48
  return {
@@ -94,40 +110,6 @@ export default {
94
110
  isRplsChange: false,
95
111
  },
96
112
  ],
97
- btnList: [
98
- {
99
- // 根据权限和当前行数据显示
100
- label: "置顶",
101
- tip: "提示信息",
102
- // disabled: true, // 显示但禁用
103
- isHas: (row) => row.state == "0",
104
- command: "zd",
105
- },
106
- {
107
- // 根据函数返回值显示
108
- label: "取消销户登记",
109
- isHas: (row) => row.state != "0",
110
- command: "qxxfdj",
111
- type: "danger",
112
- },
113
- {
114
- // 一直显示的
115
- label: "销户登记",
116
- command: "xfdj",
117
- },
118
- {
119
- // 根据权限显示的
120
- label: "销户申请",
121
- isHas: "user-web0001",
122
- command: "xfsq",
123
- },
124
- {
125
- // 根据权限组显示的
126
- label: "初始化余额",
127
- isHas: ["user-web0001", "user-web00012"],
128
- command: "cshye",
129
- },
130
- ],
131
113
  columns: [
132
114
  {
133
115
  label: $l("金额"),
@@ -136,9 +118,6 @@ export default {
136
118
  align: "right",
137
119
  minWidth: "190",
138
120
  "show-overflow-tooltip": true,
139
- render(h, row) {
140
- return <span>{amountFormat(row.amount)}</span>;
141
- },
142
121
  },
143
122
  {
144
123
  label: $l("所属管理单位"),
@@ -147,9 +126,6 @@ export default {
147
126
  align: "left",
148
127
  minWidth: "230",
149
128
  "show-overflow-tooltip": true,
150
- render(h, row) {
151
- return <span>{row.manageUnitName || "--"}</span>;
152
- },
153
129
  },
154
130
  {
155
131
  label: $l("款项类别"),
@@ -158,9 +134,6 @@ export default {
158
134
  align: "center",
159
135
  minWidth: "144",
160
136
  "show-overflow-tooltip": true,
161
- render(h, row) {
162
- return <span>{row.paymentCategoryName || "--"}</span>;
163
- },
164
137
  },
165
138
  {
166
139
  label: $l("部门"),
@@ -169,11 +142,7 @@ export default {
169
142
  align: "center",
170
143
  minWidth: "144",
171
144
  "show-overflow-tooltip": true,
172
- render(h, row) {
173
- return <span>{row.departmentName || "--"}</span>;
174
- },
175
145
  },
176
-
177
146
  {
178
147
  label: $l("预算科目"),
179
148
  prop: "budgetAccountName",
@@ -197,9 +166,6 @@ export default {
197
166
  align: "right",
198
167
  minWidth: "190",
199
168
  "show-overflow-tooltip": true,
200
- render(h, row) {
201
- return <span>{amountFormat(row.budgetExecAmount) || "--"}</span>;
202
- },
203
169
  },
204
170
  {
205
171
  label: $l("资金计划"),
@@ -216,9 +182,6 @@ export default {
216
182
  align: "center",
217
183
  minWidth: "144",
218
184
  "show-overflow-tooltip": true,
219
- render(h, row) {
220
- return <span>{row.cashFlowName || "--"}</span>;
221
- },
222
185
  },
223
186
  {
224
187
  label: $l("客商"),
@@ -227,9 +190,6 @@ export default {
227
190
  align: "center",
228
191
  minWidth: "144",
229
192
  "show-overflow-tooltip": true,
230
- render(h, row) {
231
- return <span>{row.customName || "--"}</span>;
232
- },
233
193
  },
234
194
  {
235
195
  label: $l("备注"),
@@ -240,9 +200,35 @@ export default {
240
200
  "show-overflow-tooltip": true,
241
201
  },
242
202
  ],
203
+ mergedColumns: [],
204
+ showColumnVisible: false,
205
+ showColumnPageId: "stream_refill_demo",
243
206
  };
244
207
  },
208
+ computed: {
209
+ // 显示列列表
210
+ TableHeader() {
211
+ const sourceList = this.mergedColumns.length ? this.mergedColumns : this.columns;
212
+ return sourceList.map((item) => ({
213
+ ...item,
214
+ label: item.label || item.prop,
215
+ }));
216
+ },
217
+ // 显示列勾选状态(返回数组,默认全选)
218
+ checkColumns() {
219
+ return this.mergedColumns.length ? this.mergedColumns : this.columns;
220
+ },
221
+ },
245
222
  methods: {
223
+ // 显示列设置回调 - 将显示列设置同步回表格
224
+ setChange(list) {
225
+ this.$refs.fillList.setColumns(list);
226
+ this.showColumnVisible = false; // 手动关闭弹窗
227
+ },
228
+ // 接收合并后的列配置
229
+ handleColumnsChange(columns) {
230
+ this.mergedColumns = columns;
231
+ },
246
232
  async submit() {
247
233
  let v_1 = await this.$refs.fillList?.validate();
248
234
  debugger;
@@ -26,37 +26,7 @@
26
26
  align="center"
27
27
  />
28
28
  <el-table-column
29
- v-for="item in _columns"
30
- :key="item.prop"
31
- v-bind="item"
32
- header-align="center"
33
- min-width="250"
34
- :show-overflow-tooltip="false"
35
- >
36
- <template slot="header">
37
- <span class="req-h" v-if="headerProps.includes(item.prop)">*</span>
38
- {{ $l(item.label) }}
39
- </template>
40
- <template slot-scope="{ $index, row, column }">
41
- <el-form-item
42
- :prop="`tableData.${$index}.${item.prop}`"
43
- :rules="[
44
- {
45
- required: _requireProps.includes(item.prop),
46
- trigger: ['blur', 'change'],
47
- message: '请输入/选择' + item.label,
48
- },
49
- ]"
50
- >
51
- <slot
52
- :name="item.slotName"
53
- :scope="{ $index, row, column, item }"
54
- ></slot>
55
- </el-form-item>
56
- </template>
57
- </el-table-column>
58
- <el-table-column
59
- v-for="item in exFields"
29
+ v-for="item in displayColumns"
60
30
  :key="item.prop"
61
31
  v-bind="item"
62
32
  header-align="center"
@@ -67,8 +37,8 @@
67
37
  <span class="req-h" v-if="headerProps.includes(item.prop)">*</span>
68
38
  {{ $l(item.label) }}
69
39
  <el-tooltip
70
- class="item"
71
40
  v-if="item.fieldDescription"
41
+ class="item"
72
42
  effect="dark"
73
43
  :content="item.fieldDescription"
74
44
  placement="top-start"
@@ -76,7 +46,7 @@
76
46
  <i class="n20-icon-xinxitishi"></i>
77
47
  </el-tooltip>
78
48
  </template>
79
- <template slot-scope="{ $index, row }">
49
+ <template slot-scope="{ $index, row, column }">
80
50
  <el-form-item
81
51
  :prop="`tableData.${$index}.${item.prop}`"
82
52
  :rules="[
@@ -87,7 +57,15 @@
87
57
  },
88
58
  ]"
89
59
  >
60
+ <!-- 固定列使用插槽(通过 prop 判断) -->
61
+ <slot
62
+ v-if="_isFixedColumn(item.prop)"
63
+ :name="item.slotName"
64
+ :scope="{ $index, row, column, item }"
65
+ ></slot>
66
+ <!-- 扩展列使用组件 -->
90
67
  <component
68
+ v-else
91
69
  v-model="row[item.prop]"
92
70
  :disabled="disabled || row['disabled']"
93
71
  :is="item.type"
@@ -191,6 +169,7 @@ export default {
191
169
  sizeBind: {},
192
170
  exFields: [],
193
171
  typeCodeList: [],
172
+ displayColumns: [], // 显示列配置
194
173
  };
195
174
  },
196
175
  computed: {
@@ -227,6 +206,15 @@ export default {
227
206
  return this.columns;
228
207
  },
229
208
  },
209
+ mergedColumns() {
210
+ return [...this._columns, ...this.exFields].map((item) => {
211
+ const { slotName, ...rest } = item;
212
+ return {
213
+ ...rest,
214
+ label: item.label || item.prop,
215
+ };
216
+ });
217
+ },
230
218
  },
231
219
  watch: {
232
220
  tableData: {
@@ -236,11 +224,24 @@ export default {
236
224
  deep: true,
237
225
  immediate: true,
238
226
  },
227
+ mergedColumns: {
228
+ handler(newVal) {
229
+ if (!this.displayColumns.length && newVal.length) {
230
+ this.displayColumns = newVal;
231
+ }
232
+ this.$emit("columns-change", newVal);
233
+ },
234
+ immediate: true,
235
+ },
239
236
  },
240
237
  mounted() {
241
238
  this.init();
242
239
  },
243
240
  methods: {
241
+ // 判断是否为固定列(通过 prop 是否在传入的 columns 中判断)
242
+ _isFixedColumn(prop) {
243
+ return this._columns.some((col) => col.prop === prop);
244
+ },
244
245
  async init() {
245
246
  let res = await getCustomSettingFieldFormList(this.axiosParams);
246
247
  this.exFields = [];
@@ -275,6 +276,7 @@ export default {
275
276
  minWidth: 250,
276
277
  align: "center",
277
278
  prop: item.fieldNo,
279
+ slotName: item.fieldNo, // 扩展字段使用 fieldNo 作为 slotName
278
280
  multiple: item.fieldProperty == "multiSelect",
279
281
  type: typeMap[item.fieldProperty] || "FillInput",
280
282
  "show-overflow-tooltip": true,
@@ -304,6 +306,7 @@ export default {
304
306
  });
305
307
  await this.$nextTick();
306
308
  this.clearValidate();
309
+ this.$emit("columns-change", this.mergedColumns);
307
310
  },
308
311
  handleSelectionChange(val) {
309
312
  this.$emit("selection-change", val);
@@ -335,6 +338,14 @@ export default {
335
338
  });
336
339
  });
337
340
  },
341
+ setColumns(columns) {
342
+ // 确保每列都有 label 属性用于显示
343
+ this.displayColumns = columns.map((col) => ({
344
+ ...col,
345
+ label: col.label || col.label2 || col.prop,
346
+ label2: col.label2 || col.label || col.prop,
347
+ }));
348
+ },
338
349
  },
339
350
  activated() {},
340
351
  };