free-fe-core-modules 0.0.8 → 0.0.9

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.
@@ -123,12 +123,7 @@ export default defineComponent({
123
123
  for (let j = 0; j < filters.length; j += 1) {
124
124
  const f = filters[j];
125
125
 
126
- const filterFunc = this.$options.filters[f];
127
- if (filterFunc) {
128
- item.number = filterFunc(
129
- item.number,
130
- );
131
- }
126
+ item.number = this.$filter(f, item.number);
132
127
  }
133
128
 
134
129
  // remove the filter to avoid filter multiple times
@@ -102,7 +102,7 @@
102
102
  </template>
103
103
 
104
104
  <script>
105
- import { defineComponent } from 'vue';
105
+ import { defineComponent, ref, computed } from 'vue';
106
106
  import { useFormValidator } from '../../composible/useFormValidator';
107
107
  import FreeField from '../../free-field/composible/fieldWrapper';
108
108
  import EIcon from '../Basic/EIcon.vue';
@@ -157,170 +157,180 @@ export default defineComponent({
157
157
  FreeField,
158
158
  EIcon,
159
159
  },
160
- setup(props, { expose }) {
160
+ setup(props, { expose, emit }) {
161
161
  const { validate } = useFormValidator('fieldsToValid');
162
- expose({
163
- validate,
164
- })
165
162
 
166
- return {};
167
- },
168
- data() {
169
- return {
170
- timeLeft: 0,
171
- textContent: '',
172
- textValid: true,
173
- timer: undefined,
174
- promise: '',
175
- resolve: '',
176
- reject: '',
177
- };
178
- },
179
- watch: {
180
- visible() {
181
- if (this.visible) {
182
- this.timeout_counter();
183
- this.show();
184
- } else {
185
- this.hide();
186
- }
187
- },
188
- },
189
- computed: {
190
- disabled() {
191
- if (typeof this.okDisabled === 'object') {
192
- return this.okDisabled.value;
193
- }
163
+ const dialog = ref(null);
194
164
 
195
- return this.okDisabled;
196
- },
197
- warningMsg() {
198
- // 设置默认warning
199
- if (!this.showWarning) return '';
165
+ const timeLeft = ref(0),
166
+ textContent = ref(''),
167
+ textValid = ref(true),
168
+ timer = ref(undefined),
169
+ promise = ref(null),
170
+ resolve = ref(null),
171
+ reject = ref(null);
200
172
 
201
- if (!this.warning) {
202
- return '';
173
+ const timeout_counter = () => {
174
+ if (!props.timeout) {
175
+ return;
203
176
  }
204
- return this.warning;
205
- },
206
- },
207
- methods: {
208
- // following method is REQUIRED
209
- // (don't change its name --> "show")
210
- show() {
211
- this.$refs.dialog.show();
212
- this.timeout_counter();
213
-
214
- this.promise = new Promise((resolve, reject) => {
215
- this.resolve = resolve;
216
- this.reject = reject;
177
+
178
+ timeLeft.value = props.timeout;
179
+ timer.value = setInterval(() => {
180
+ timeLeft.value -= 1;
181
+ if (timeLeft.value < 1) {
182
+ clearInterval(timer.value);
183
+ btn_ok();
184
+ }
185
+ }, 1000);
186
+ };
187
+
188
+ const show = () => {
189
+ dialog.value.show();
190
+ timeout_counter();
191
+
192
+ promise.value = new Promise((resv, rej) => {
193
+ resolve.value = resv;
194
+ reject.value = rej;
217
195
  });
218
196
 
219
- return this.promise;
220
- },
197
+ return promise.value;
198
+ };
221
199
 
222
- // following method is REQUIRED
223
- // (don't change its name --> "hide")
224
- hide() {
225
- this.$refs.dialog.hide();
226
- },
227
- onDialogHide() {
228
- // required to be emitted
229
- // when QDialog emits "hide" event
230
- this.$emit('hide');
231
- },
232
- onOKClick() {
233
- // on OK, it is REQUIRED to
234
- // emit "ok" event (with optional payload)
235
- // before hiding the QDialog
236
- // this.$emit('ok');
237
- // or with payload: this.$emit('ok', { ... })
238
-
239
- // // validate
240
- // if (this.validateFunc && typeof this.validateFunc === 'function') {
241
- // // now we only have such content, but later we might will have more
242
- // this.textValid = this.validateFunc(this.textContent);
243
- // if (!this.textValid) return;
244
- // }
245
- if (!this.canOK || !this.validate()) {
200
+ const hide = () => {
201
+ dialog.value.hide();
202
+ };
203
+
204
+ const onDialogHide = () => {
205
+ emit('hide');
206
+ };
207
+
208
+ const onOKClick = () => {
209
+ if (!props.canOK || !validate.value()) {
246
210
  return;
247
211
  }
248
212
 
249
- this.$emit('ok');
213
+ emit('ok');
250
214
 
251
- if (this.timer) {
252
- this.timeLeft = 0;
253
- clearInterval(this.timer);
215
+ if (timer.value) {
216
+ timeLeft.value = 0;
217
+ clearInterval(timer.value);
254
218
  }
255
219
 
256
- if (this.resolve) {
257
- if (this.needText) {
258
- this.resolve(this.textContent);
220
+ if (resolve.value) {
221
+ if (props.needText) {
222
+ resolve.value(textContent.value);
259
223
  } else {
260
- this.resolve('confirm');
224
+ resolve.value('confirm');
261
225
  }
262
226
 
263
- this.hide();
264
- this.remove();
227
+ hide();
228
+
229
+ if (typeof props.remove === 'function'){
230
+ props.remove();
231
+ }
265
232
  }
266
- },
267
- btnCancel() {
268
- if (!this.canCancel) return;
233
+ };
234
+
235
+ const btnCancel = () => {
236
+ if (!props.canCancel) return;
269
237
 
270
- this.$emit('cancel');
238
+ emit('cancel');
271
239
 
272
- if (this.timer) {
273
- this.timeLeft = 0;
274
- clearInterval(this.timer);
240
+ if (timer.value) {
241
+ timeLeft.value = 0;
242
+ clearInterval(timer.value);
275
243
  }
276
244
 
277
- if (this.reject) {
278
- this.reject('cancel');
279
- this.remove();
245
+ if (reject.value) {
246
+ reject.value('cancel');
247
+
248
+ if (typeof props.remove === 'function'){
249
+ props.remove();
250
+ }
280
251
  }
281
- },
282
- btn_ok() {
283
- if (!this.validate()) {
252
+ };
253
+
254
+ const btn_ok = () => {
255
+ if (!validate.value()) {
284
256
  return;
285
257
  }
286
258
 
287
- this.$emit('ok');
259
+ emit('ok');
288
260
 
289
- if (this.timer) {
290
- this.timeLeft = 0;
291
- clearInterval(this.timer);
261
+ if (timer.value) {
262
+ timeLeft.value = 0;
263
+ clearInterval(timer.value);
292
264
  }
293
265
 
294
- if (this.resolve) {
295
- if (this.needText) {
296
- this.resolve(this.textContent);
266
+ if (resolve.value) {
267
+ if (props.needText) {
268
+ resolve.value(textContent.value);
297
269
  } else {
298
- this.resolve('confirm');
270
+ resolve.value('confirm');
299
271
  }
300
272
 
301
- this.hide();
302
- this.remove();
273
+ hide();
274
+
275
+ if (typeof props.remove === 'function'){
276
+ props.remove();
277
+ }
303
278
  }
304
- },
305
- timeout_counter() {
306
- if (!this.timeout) {
307
- return;
279
+ };
280
+
281
+ expose({
282
+ validate,
283
+ show,
284
+ hide,
285
+ });
286
+
287
+ watch(() => props.visible, (v) => {
288
+ if (v) {
289
+ timeout_counter();
290
+ show();
291
+ } else {
292
+ hide();
308
293
  }
294
+ });
309
295
 
310
- this.timeLeft = this.timeout;
311
- this.timer = setInterval(() => {
312
- this.timeLeft -= 1;
313
- if (this.timeLeft < 1) {
314
- clearInterval(this.timer);
315
- this.btn_ok();
316
- }
317
- }, 1000);
318
- },
319
- onInputFieldInput(field){
320
- if(field.onInput) {
321
- field.onInput(field);
296
+
297
+ const disabled = computed(() => {
298
+ if (typeof props.okDisabled === 'object') {
299
+ return props.okDisabled.value;
300
+ }
301
+
302
+ return props.okDisabled;
303
+ });
304
+
305
+ const warningMsg = computed(() => {
306
+ // 设置默认warning
307
+ if (!props.showWarning) return '';
308
+
309
+ if (!props.warning) {
310
+ return '';
322
311
  }
323
- }
312
+ return props.warning;
313
+ });
314
+
315
+ return {
316
+ dialog,
317
+ timeLeft,
318
+ textContent,
319
+ textValid,
320
+
321
+ disabled,
322
+ warningMsg,
323
+
324
+ validate,
325
+
326
+ show,
327
+ hide,
328
+ onDialogHide,
329
+ onOKClick,
330
+ btnCancel,
331
+ btn_ok,
332
+ timeout_counter,
333
+ };
324
334
  },
325
335
  });
326
336
  </script>
@@ -7,12 +7,12 @@ export function useFormValidator(...list) {
7
7
  validate: computed(() => {
8
8
  return (...args) => {
9
9
  if (vm.shouldHide) return true;
10
-
10
+
11
11
  // could have customized validate function in component
12
12
  if (vm.selfValidate && typeof vm.selfValidate === 'function') {
13
13
  return vm.selfValidate();
14
14
  }
15
-
15
+
16
16
  const refsList = [];
17
17
  for(let i = 0; i < list.length; i += 1) {
18
18
  if (typeof list[i] === 'string') {
@@ -20,24 +20,25 @@ export function useFormValidator(...list) {
20
20
  } else if (typeof list[i] === 'function') {
21
21
  list[i] = list[i]();
22
22
  }
23
-
23
+
24
24
  if (Array.isArray(list[i])) {
25
25
  refsList.push(...list[i])
26
26
  } else {
27
27
  refsList.push(list[i])
28
28
  }
29
29
  }
30
-
30
+
31
31
  if (refsList.length <= 0) return true;
32
-
32
+
33
33
  let hasErr = false;
34
34
  for (let i = 0; i < refsList.length; i += 1) {
35
35
  let refi = unref(refsList[i]);
36
36
 
37
+ if (!refi) continue;
37
38
 
38
39
  const validFun = unref(refi.validate || refi.methods?.validate || refi.component?.exposed?.validate|| refi.component?.ctx?.validate);
39
40
  const shouldHide = unref(refi.shouldHide || refi.component?.ctx?.shouldHide);
40
-
41
+
41
42
  if (typeof validFun === 'function' && shouldHide !== true) {
42
43
  hasErr = !validFun() || hasErr;
43
44
 
@@ -47,7 +48,7 @@ export function useFormValidator(...list) {
47
48
  }
48
49
  }
49
50
  }
50
-
51
+
51
52
  return !hasErr;
52
53
  };
53
54
  }),
@@ -44,12 +44,12 @@ export function useObjectData(props, ctx) {
44
44
 
45
45
  if (typeof getData === 'function') {
46
46
  Promise.resolve(getData(...args)).then((d) => {
47
- Object.assign(data.value, d);
47
+ Object.assign(data.value, d.value || d);
48
48
  }).finally(() => {
49
49
  callsLeft.value --;
50
50
  });
51
51
  } else {
52
- Object.assign(data.value, getData);
52
+ Object.assign(data.value, getData.value || getData);
53
53
  callsLeft.value --;
54
54
  }
55
55
  }
@@ -172,6 +172,7 @@ export default defineComponent({
172
172
 
173
173
  if (changed) {
174
174
  this.setFieldData(currentList);
175
+ this.$emit('input');
175
176
  }
176
177
 
177
178
  this.newLabel = '';
@@ -112,7 +112,7 @@ export default defineComponent({
112
112
  v = Number(props.Field.MaxValue);
113
113
  }
114
114
 
115
- setFieldData(v);
115
+ setFieldData(Number(v));
116
116
  })
117
117
 
118
118
  const readonlyNode = () => h(ReadonlyContent, {
@@ -147,7 +147,7 @@ export default defineComponent({
147
147
 
148
148
  modelValue: fieldData.value,
149
149
  'onUpdate:modelValue': (v) => {
150
- setFieldData(v, emit);
150
+ setFieldData(Number(v), emit);
151
151
  },
152
152
  }, {
153
153
  before,
@@ -47,7 +47,7 @@ export default defineComponent({
47
47
  },
48
48
  });
49
49
 
50
- const inputNode = () => computed(h(QInput, {
50
+ const inputNode = computed(() => h(QInput, {
51
51
  type: isPwd.value ? 'password' : 'text',
52
52
  maxlength: props.Field.Options?.MaxLength,
53
53
  autocomplete: props.Field.Options?.autocomplete ? '' : 'new-password',
@@ -76,6 +76,7 @@ export default defineComponent({
76
76
  methods: {
77
77
  permissionChanged(v) {
78
78
  this.setFieldData(v);
79
+ this.$emit('input');
79
80
  },
80
81
  },
81
82
  });
@@ -71,7 +71,6 @@ import { useFreeField, freeFieldProps } from '../composible/useFreeField';
71
71
  export default defineComponent({
72
72
  name: 'PermissionEditor',
73
73
  emits:['changed'],
74
- components: {},
75
74
  props: {
76
75
  ...freeFieldProps,
77
76
  Code: { type: String, default: '' },
@@ -350,9 +350,9 @@ export default defineComponent({
350
350
  },
351
351
  },
352
352
  watch: {
353
- fieldData(n, o) {
353
+ 'fieldData.value': function(n, o) {
354
354
  // init search data from exist id
355
- if (typeof this.fieldData.value === 'undefined') {
355
+ if (this.fieldData.value === void 0) {
356
356
  this.searchSelected = [];
357
357
  this.searchData = {};
358
358
  this.searchDisplay = '';
@@ -406,14 +406,11 @@ export default defineComponent({
406
406
  },
407
407
  },
408
408
  created() {
409
- // search, add filters to col
410
- if (this.Field.Type === 'Search') {
411
- this.searchColumns.forEach((col) => {
412
- if (col.filters) {
413
- col.format = this.ctx.filters[col.filters];
414
- }
415
- });
416
- }
409
+ this.searchColumns.forEach((col) => {
410
+ if (col.filters) {
411
+ col.format = (d) => this.$filter(col.filters, d);
412
+ }
413
+ });
417
414
  },
418
415
  methods: {
419
416
  search(p) {
@@ -163,7 +163,7 @@ export default defineComponent({
163
163
  props: {
164
164
  ...freeFieldProps,
165
165
  },
166
- emits:['udpate:fieldData', 'input'],
166
+ emits:['input'],
167
167
  fieldInfo: {
168
168
  Category: 'Simple',
169
169
  Label: '选择',
@@ -124,7 +124,7 @@ export default defineComponent({
124
124
  const tab = ref(0);
125
125
 
126
126
  if (!Array.isArray(fieldData.value)) {
127
- setFieldData([{}])
127
+ setFieldData([{}], emit)
128
128
  }
129
129
 
130
130
  if (props.Field.Options?.ValueField && props.Field.Default) {
@@ -140,7 +140,6 @@ export default defineComponent({
140
140
  fieldData,
141
141
 
142
142
  fieldChanged: () => {
143
- console.log('field changed', fieldData.value)
144
143
  emit('input');
145
144
  },
146
145
  validate,
@@ -197,7 +197,7 @@ export default defineComponent({
197
197
  onInput: () => {
198
198
  emit("input", props.Field);
199
199
  },
200
- ...compEmits,
200
+ ...compEmits.value,
201
201
  },
202
202
  {
203
203
  ...slots,
@@ -1,85 +1,63 @@
1
- import { reactive, watch, watchEffect } from "vue";
1
+ import { reactive, getCurrentInstance, watchEffect } from "vue";
2
2
 
3
3
  export const freeFieldProps = {
4
4
  values: { type: Object },
5
5
  Field: { type: Object },
6
6
  };
7
7
 
8
- export function useFreeField(props) {
8
+ export function useFreeField(props, ctx) {
9
+ const { proxy:vm } = getCurrentInstance();
9
10
  const fieldData = reactive({});
10
11
 
11
12
  watchEffect(() => {
12
- fieldData.value = Object.nestValue(props.values, props.Field?.Name);
13
-
14
- // TODO:following is from the old mixins, should we add more logic here accordingly?
15
- // let realData;
16
- // if (!this.Field) {
17
- // // return undefined;
18
- // } else if (!this.Field.Name) {
19
- // // this.fieldData = this.Field.Value || this.Field.Default || undefined;
20
- // realData = this.Field.Value || this.Field.Default || undefined;
21
- // } else {
22
- // let isnull = false;
23
- // if (this.Field && this.Field.Info && this.Field.Info.Dynamic && this.Field.Value) {
24
- // realData = this.Field.Value;
25
- // isnull = typeof realData === 'undefined';
26
- // } else {
27
- // realData = this.data;
28
-
29
- // if (this.Field.Name !== '.') {
30
- // const nameList = this.Field.Name.split('.');
31
-
32
- // for (let i = 0; i < nameList.length; i += 1) {
33
- // const name = nameList[i];
34
-
35
- // // if (!realData) return undefined;
36
- // if (typeof realData === 'undefined' || realData === null) {
37
- // isnull = true;
38
- // break;
39
- // } else {
40
- // realData = name ? realData[name] : realData;
41
- // }
42
- // }
43
- // }
44
- // }
45
-
46
- // if (!isnull) {
47
- // // for non-dynamic field, which have refer data, we should save this data into the field
48
- // if ((typeof realData === 'undefined') && (this.Field.Value || this.Field.Default)) {
49
- // realData = this.Field.Value || this.Field.Default;
50
-
51
- // if (this.Field && this.Field.ReferTo && (!this.Field.Info || !this.Field.Info.Dynamic)) {
52
- // this.$emit('input');
53
- // }
54
- // }
55
-
56
- // // realData = (typeof realData === 'undefined') ? (this.Field.Value || this.Field.Default) : realData;
57
-
58
- // if (this.Field.Options && this.Field.Options.Filters) {
59
- // let filters = [];
60
- // if (typeof this.Field.Options.Filters === 'string') {
61
- // // only one filter
62
- // filters.push(this.Field.Options.Filters);
63
- // } else if (Array.isArray(this.Field.Options.Filters)) {
64
- // filters = filters.concat(this.Field.Options.Filters);
65
- // }
66
-
67
- // for (let i = 0; i < filters.length; i += 1) {
68
- // const f = filters[i];
69
- // const filter = this.$options.filters[f];
70
- // if (filter) {
71
- // realData = filter(realData);
72
- // }
73
- // }
74
- // }
75
- // }
76
- // }
77
-
78
- // if ((typeof realData === 'undefined' || realData === null || !realData) && this.Field.Info && this.Field.Info.ShowNaN) {
79
- // return this.ctx.config.nanPlaceholder || '';
80
- // }
81
-
82
- // return realData;
13
+ let realData = void 0;
14
+
15
+ if (!props.Field) {
16
+ return;
17
+ }
18
+
19
+ if (!props.Field.Name) {
20
+ realData = props.Field.Value || props.Field.Default || undefined;
21
+ } else {
22
+ if (props.Field.Info?.Dynamic && props.Field.Value) {
23
+ realData = props.Field.Value;
24
+ } else {
25
+ realData = Object.nestValue(props.values, props.Field?.Name);
26
+ }
27
+ }
28
+
29
+ // set to default if still undefined
30
+ if ((realData === void 0 || realData === null) && (props.Field.Value || props.Field.Default)) {
31
+ realData = props.Field.Value || props.Field.Default;
32
+
33
+ // for non-dynamic field, which have refer data, we should save this data into the field
34
+ if (props.Field.ReferTo && !props.Field.Info?.Dynamic) {
35
+ ctx.emit('input');
36
+ }
37
+ }
38
+
39
+ // filter data
40
+ if (props.Field.Options && props.Field.Options.Filters) {
41
+ let filters = [];
42
+ if (typeof props.Field.Options.Filters === 'string') {
43
+ // only one filter
44
+ filters.push(props.Field.Options.Filters);
45
+ } else if (Array.isArray(props.Field.Options.Filters)) {
46
+ filters = filters.concat(props.Field.Options.Filters);
47
+ }
48
+
49
+ for (let i = 0; i < filters.length; i += 1) {
50
+ const f = filters[i];
51
+ realData = vm.$filter(f, realData)
52
+ }
53
+ }
54
+
55
+ // show NaN placeholder
56
+ if ((realData === void 0 || realData === null || realData === '') && props.Field?.Info?.ShowNaN) {
57
+ return vm.ctx.config.nanPlaceholder || '';
58
+ }
59
+
60
+ fieldData.value = realData;
83
61
  });
84
62
 
85
63
  return {
package/index.js CHANGED
@@ -152,6 +152,27 @@ const filters = {
152
152
  diff = quasarDate.getDateDiff(date1, date2, 'years');
153
153
  return diff + Vue.prototype.$t('yearsAgo');
154
154
  },
155
+ stepCaption: (step, status, data) => {
156
+ if (!step) return '';
157
+ if (step && typeof step.Description === 'string') return step.Description;
158
+
159
+ let desc = '';
160
+ if (step && Array.isArray(step.Description)) {
161
+ let stepStatus;
162
+ if (data && data.Steps) {
163
+ const rStep = data.Steps[step.Index];
164
+ if (rStep) {
165
+ stepStatus = rStep.Status;
166
+ }
167
+ }
168
+ desc = step.Description.find((s) => s.Status === (status || stepStatus || '').toString());
169
+ desc = desc ? desc.Description : '';
170
+ desc = desc;
171
+ }
172
+
173
+ desc = desc || '未知状态';
174
+ return desc;
175
+ },
155
176
  };
156
177
 
157
178
  export default (app, root) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "free-fe-core-modules",
3
- "version": "0.0.8",
3
+ "version": "0.0.9",
4
4
  "main": "index.js",
5
5
  "repository": "https://github.com/freeeis/free-fe-core-modules.git",
6
6
  "author": "zhiquan",
@@ -131,10 +131,6 @@ export default defineComponent({
131
131
 
132
132
  const { validate } = useFormValidator('fieldsToValidate');
133
133
 
134
- watch(() => data, () => {
135
- console.log(data)
136
- })
137
-
138
134
  return {
139
135
  data,
140
136
  refreshData,
@@ -175,6 +171,26 @@ export default defineComponent({
175
171
  }
176
172
  },
177
173
  methods: {
174
+ makeLabelsName(n) {
175
+ n.Labels = n.Labels || [];
176
+ // check labels according to the locales
177
+ const locales = this.ctx.config.locales || [];
178
+ for(let i = 0; i < locales.length; i += 1) {
179
+ const locale = locales[i];
180
+ const existsLabel = n.Labels.find((l) => l.Locale === locale.locale);
181
+
182
+ if (!existsLabel) {
183
+ n.Labels.push({
184
+ Label: '',
185
+ Locale: locale.locale,
186
+ Description: '',
187
+ Name: locale.name,
188
+ });
189
+ } else {
190
+ existsLabel.Name = locale.name;
191
+ }
192
+ }
193
+ },
178
194
  loadSubDicts({ key, done, node /* , fail */ }) {
179
195
  this.GetData(key, node.level)
180
196
  .then((d) => {
@@ -198,28 +214,13 @@ export default defineComponent({
198
214
  Type: 'String',
199
215
  };
200
216
  }
217
+
218
+ this.makeLabelsName(this.editingDict);
201
219
  },
202
220
  editNode(n) {
203
221
  if (!n) return;
204
222
 
205
- n.Labels = n.Labels || [];
206
- // check labels according to the locales
207
- const locales = this.ctx.config.locales || [];
208
- for(let i = 0; i < locales.length; i += 1) {
209
- const locale = locales[i];
210
- const existsLabel = n.Labels.find((l) => l.Locale === locale.locale);
211
-
212
- if (!existsLabel) {
213
- n.Labels.push({
214
- Label: '',
215
- Locale: locale.locale,
216
- Description: '',
217
- Name: locale.name,
218
- });
219
- } else {
220
- existsLabel.Name = locale.name;
221
- }
222
- }
223
+ this.makeLabelsName(n);
223
224
 
224
225
  if (this.selectedDictNode && this.selectedDictNode.id === n.id) {
225
226
  this.selectedDictNode = {};
@@ -255,6 +256,11 @@ export default defineComponent({
255
256
 
256
257
  if (!this.validate()) return;
257
258
 
259
+ // clear labels without label
260
+ this.editingDict.Labels = (this.editingDict.Labels || []).filter(
261
+ (l) => l.Label,
262
+ );
263
+
258
264
  // if is adding new
259
265
  if (this.selectedDictNode.addingNew) {
260
266
  this.editingDict = {
@@ -264,10 +270,6 @@ export default defineComponent({
264
270
  ...this.editingDict,
265
271
  };
266
272
 
267
- // fix: the default content for number input will be string!!!!????
268
- // convert to number
269
- this.editingDict.Index = Number(this.editingDict.Index || '0');
270
-
271
273
  this.addDict(this.editingDict).then((r) => {
272
274
  if (r && r.msg === 'OK') {
273
275
  const parent = this.$refs.dictTree.getNodeByKey(
@@ -1,6 +1,6 @@
1
1
  <template>
2
2
  <div class="flow-list">
3
- <summary-head :values="data.summary" :Bus="Bus"></summary-head>
3
+ <summary-head :values="data.summary"></summary-head>
4
4
  <q-table
5
5
  flat
6
6
  bordered
@@ -23,26 +23,24 @@
23
23
  <span v-else>
24
24
  {{ valueFilters(col, col.value || Object.nestValue(props.row, col.field))}}
25
25
  <q-popup-edit
26
+ v-slot="scope"
26
27
  v-model="props.row.Message"
27
28
  v-if="col.name === 'message'"
28
- buttons
29
- persistent
30
29
  label-set="保存"
31
30
  label-cancel="取消"
32
- @save="messageChanged(props.row.id, props.row.Message)"
33
31
  >
34
- <q-input v-model="props.row.Message" hide-bottom-space autofocus />
32
+ <q-input v-model="props.row.Message" hide-bottom-space autofocus
33
+ @keyup.enter="messageChanged(props.row.id, props.row.Message, scope)"/>
35
34
  </q-popup-edit>
36
35
  <q-popup-edit
37
- v-model="props.row.Description"
36
+ v-slot="scope"
37
+ :model-value="props.row.Description"
38
38
  v-if="col.name === 'description'"
39
- buttons
40
- persistent
41
- label-set="保存"
42
- label-cancel="取消"
43
- @save="descriptionChanged(props.row.id, props.row.Description)"
39
+ :label-set="$t('保存')"
40
+ :label-cancel="$t('取消')"
44
41
  >
45
- <q-input v-model="props.row.Description" hide-bottom-space autofocus />
42
+ <q-input v-model="props.row.Description" hide-bottom-space autofocus
43
+ @keyup.enter="descriptionChanged(props.row.id, props.row.Description, scope)"/>
46
44
  </q-popup-edit>
47
45
  </span>
48
46
  </q-td>
@@ -66,7 +64,7 @@
66
64
 
67
65
  <template v-slot:no-data>
68
66
  <div class="full-width full-height row flex-center q-gutter-sm">
69
- <span>暂 无 数 据</span>
67
+ <span>{{$t('暂无数据')}}</span>
70
68
  </div>
71
69
  </template>
72
70
 
@@ -106,7 +104,7 @@ export default defineComponent({
106
104
  } = useObjectData(props, ctx);
107
105
 
108
106
  return {
109
- data,
107
+ data,
110
108
  refreshData,
111
109
  };
112
110
  },
@@ -165,10 +163,7 @@ export default defineComponent({
165
163
 
166
164
  for (let i = 0; i < filters.length; i += 1) {
167
165
  const f = filters[i];
168
- const filter = this.$options.filters[f];
169
- if (filter) {
170
- val = filter(v || col.value);
171
- }
166
+ val = this.$filter(f, v || col.value)
172
167
  }
173
168
  }
174
169
 
@@ -181,7 +176,8 @@ export default defineComponent({
181
176
  paginationChanged(p) {
182
177
  this.refreshData({ page: p });
183
178
  },
184
- messageChanged(id, msg) {
179
+ messageChanged(id, msg, popup) {
180
+ popup.set();
185
181
  updateErrorCode(id, msg).then((d) => {
186
182
  if (d && d.msg === 'OK') {
187
183
  this.$q.notify(this.$t('notifySaved'));
@@ -190,7 +186,8 @@ export default defineComponent({
190
186
  }
191
187
  });
192
188
  },
193
- descriptionChanged(id, desc) {
189
+ descriptionChanged(id, desc, popup) {
190
+ popup.set();
194
191
  updateDescription(id, desc).then((d) => {
195
192
  if (d && d.msg === 'OK') {
196
193
  this.$q.notify(this.$t('notifySaved'));