free-fe-core-modules 0.0.7 → 0.0.8

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,7 +1,7 @@
1
- // import Vue from 'vue';
2
1
  import { getConfig } from './api';
2
+ import { i18n } from '@/boot/i18n';
3
3
 
4
- // const bus = new Vue();
4
+ const {global:{t}} = i18n;
5
5
 
6
6
  export default {
7
7
  systemConfig: () => ({
@@ -28,7 +28,7 @@ export default {
28
28
  Index: i + 1,
29
29
  Actions: [
30
30
  {
31
- Label: '保存',
31
+ Label: t('保存'),
32
32
  Action: 'save',
33
33
  },
34
34
  ],
@@ -41,6 +41,5 @@ export default {
41
41
 
42
42
  return data;
43
43
  }),
44
- // Bus: bus,
45
44
  }),
46
45
  };
@@ -53,6 +53,7 @@
53
53
  v-if="field.Name !== 'Name' || !selectedDictNode.Parent"
54
54
  :values="editingDict"
55
55
  :Field="field"
56
+ ref="fieldsToValidate"
56
57
  ></free-field>
57
58
  </div>
58
59
 
@@ -98,10 +99,11 @@
98
99
  </template>
99
100
 
100
101
  <script>
101
- import { defineComponent } from 'vue';
102
+ import { defineComponent, watch } from 'vue';
102
103
  import { copyToClipboard } from 'quasar';
103
104
  import { requests } from '@/boot/axios';
104
105
  import { useObjectData, objectDataProps } from '../../composible/useObjectData';
106
+ import { useFormValidator} from '../../composible/useFormValidator';
105
107
 
106
108
  export default defineComponent({
107
109
  name: 'DictionaryPage',
@@ -127,9 +129,16 @@ export default defineComponent({
127
129
  refreshData,
128
130
  } = useObjectData(props, ctx);
129
131
 
132
+ const { validate } = useFormValidator('fieldsToValidate');
133
+
134
+ watch(() => data, () => {
135
+ console.log(data)
136
+ })
137
+
130
138
  return {
131
- data,
139
+ data,
132
140
  refreshData,
141
+ validate,
133
142
  };
134
143
  },
135
144
  watch: {
@@ -243,6 +252,9 @@ export default defineComponent({
243
252
  },
244
253
  onSaveClick() {
245
254
  if (Object.keys(this.editingDict) <= 0) return;
255
+
256
+ if (!this.validate()) return;
257
+
246
258
  // if is adding new
247
259
  if (this.selectedDictNode.addingNew) {
248
260
  this.editingDict = {
@@ -338,9 +338,6 @@ export default defineComponent({
338
338
  this.onCancelClick();
339
339
  }
340
340
  },
341
- fieldInput(e) {
342
- console.log(e)
343
- }
344
341
  },
345
342
  });
346
343
  </script>