kz-ui-base 1.0.61 → 1.0.63

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.
@@ -8,7 +8,10 @@
8
8
  append-to-body
9
9
  v-dialogDrag
10
10
  v-dialogDragHeight
11
+ :before-close="cancel"
12
+ v-if="dialogShow"
11
13
  >
14
+ <!-- custom-class="customDialog" -->
12
15
  <slot name="entityForm">
13
16
  <el-form
14
17
  ref="entity"
@@ -16,44 +19,94 @@
16
19
  :rules="rules"
17
20
  :label-width="labelWidth"
18
21
  >
19
- <el-row>
20
- <FormColumns ref="FormColumns"
21
- :columns.sync="columns"
22
+ <el-row type="flex" style="flex-wrap: wrap">
23
+ <FormColumns
24
+ ref="FormColumns"
25
+ :areaSetting="areaSetting"
26
+ :columns.sync="oldeditColumns?oldeditColumns:columns"
22
27
  :entity.sync="entity"
23
28
  @change="onChangeEvent"
24
- ></formColumns>
29
+ @onSearch="onSearch"
30
+ ></FormColumns>
25
31
  </el-row>
26
32
  </el-form>
33
+ <TableForm
34
+ ref="TableForm"
35
+ v-if="setting.isShowItems && listDataShow"
36
+ :listColumns="setting.listSetting.listColumns"
37
+ :listData="listData"
38
+ :listSetting="setting.listSetting"
39
+ @change="onChangeEvent"
40
+ @update="updateMethod"
41
+ ></TableForm>
27
42
  </slot>
28
- <slot name="footer">
29
- <div class="dialog-footer">
43
+ <div slot="footer">
44
+ <div class="dialog-footer" v-if="setting.bottomShow">
30
45
  <el-button
46
+ v-if="!oldeditColumns"
31
47
  type="primary"
32
48
  :loading="setting.submitLoading"
33
49
  @click="submitForm"
34
50
  >确 定</el-button
35
51
  >
36
52
  <el-button @click="cancel">取 消</el-button>
53
+ </div>
54
+ <div class="dialog-footer" v-if="customOpMenus&&customOpMenus.length">
37
55
  <el-button
38
56
  v-for="opMenu in customOpMenus"
39
57
  :key="opMenu.name"
58
+ :icon="opMenu.icon"
59
+ :type="opMenu.cssType"
60
+ :plain="opMenu.plain"
61
+ :loading="setting.submitLoading"
40
62
  @click="handleCustomOpMenuClick(opMenu)"
41
63
  >{{ opMenu.text }}</el-button
42
64
  >
43
65
  </div>
44
- </slot>
66
+ </div>
45
67
  </el-dialog>
68
+ <div v-else>
69
+ <slot name="entityForm">
70
+ <el-form
71
+ ref="entity"
72
+ :model="entity"
73
+ :rules="rules"
74
+ :label-width="labelWidth"
75
+ >
76
+ <el-row type="flex" style="flex-wrap: wrap">
77
+ <FormColumns
78
+ ref="FormColumns"
79
+ :areaSetting="areaSetting"
80
+ :columns.sync="oldeditColumns?oldeditColumns:columns"
81
+ :entity.sync="entity"
82
+ @change="onChangeEvent"
83
+ @onSearch="onSearch"
84
+ ></FormColumns>
85
+ </el-row>
86
+ </el-form>
87
+ <TableForm
88
+ ref="TableForm"
89
+ v-if="setting.isShowItems && listDataShow"
90
+ :listColumns="setting.listSetting.listColumns"
91
+ :listData="listData"
92
+ :listSetting="setting.listSetting"
93
+ @change="onChangeEvent"
94
+ @update="updateMethod"
95
+ ></TableForm>
96
+ </slot>
97
+ </div>
46
98
  </template>
47
99
 
48
100
  <script>
49
- import { addEntity, updateEntity } from "../../../api/common/common";
50
-
51
- import FormColumns from "@srcComponents/customForm/formColumns";
101
+ import { addEntity, updateEntity, listEntity } from "@api/common/common";
102
+ import FormColumns from "@srcComponents/customForm/formColumns.vue";
103
+ import TableForm from "./tableForm.vue";
52
104
 
53
105
  export default {
54
106
  name: "EditDialog",
55
107
  components: {
56
108
  FormColumns,
109
+ TableForm,
57
110
  },
58
111
  props: {
59
112
  //微服务模块名称
@@ -119,6 +172,19 @@ export default {
119
172
  ];
120
173
  },
121
174
  },
175
+ //
176
+ areaSetting: {
177
+ type: Object,
178
+ default: function () {
179
+ return {}
180
+ },
181
+ },
182
+ dialogShow: {
183
+ type: Object,
184
+ default: function () {
185
+ return true
186
+ },
187
+ },
122
188
  },
123
189
  data() {
124
190
  return {
@@ -126,10 +192,50 @@ export default {
126
192
  width: this.setting.width || "60%",
127
193
  //input框宽度
128
194
  labelWidth: this.setting.labelWidth || "100px",
195
+ items:[],
196
+ listData:[],
197
+ listDataShow:false,
129
198
  };
130
199
  },
131
200
  watch: {},
132
- created() {},
201
+ created() {
202
+ if (this.setting && this.setting.bottomShow == undefined) {
203
+ this.setting.bottomShow = true;
204
+ }
205
+ if (this.setting && this.setting.width) {
206
+ this.width = this.setting.width;
207
+ } else {
208
+ this.width = "60%";
209
+ }
210
+ if (this.setting && this.setting.labelWidth) {
211
+ this.labelWidth = this.setting.labelWidth;
212
+ } else {
213
+ this.labelWidth = "100px";
214
+ }
215
+ if (
216
+ this.setting.isShowItems &&
217
+ (this.setting.listSetting.addQueryOpen || this.setting.type != "add")
218
+ ) {
219
+ if (this.entity.children) {
220
+ this.$set(this, "listData", this.entity.children);
221
+ } else {
222
+ listEntity(
223
+ this.setting.itemModuleName,
224
+ this.setting.itemServiceName,
225
+ {
226
+ [this.setting.itemFkField]:
227
+ this.entity[this.setting.listSetting.pkField],
228
+
229
+ ...this.setting.listSetting.parameter,
230
+ },
231
+ this.setting.listSetting.getListAction
232
+ ).then((response) => {
233
+ this.$set(this, "listData", response.rows);
234
+ this.listDataShow = true;
235
+ });
236
+ }
237
+ }
238
+ },
133
239
  mounted() {},
134
240
  activated() {
135
241
  console.log("editDialog");
@@ -138,40 +244,91 @@ export default {
138
244
  //当前绑定实体字段值变更事件
139
245
  onChangeEvent(args) {
140
246
  this.$emit("change", args);
141
- //args: { property: this.column.property, value: value, entity: this.entity, column: this.column }
142
- //console.log(args);
143
247
  },
248
+
144
249
  show() {
145
250
  this.setting.isShow = true;
146
251
  },
147
- /** 组件内更新属性值 */
148
- updateEntity(args) {},
252
+ updateMethod(value) {
253
+ this.items = value;
254
+ },
149
255
  // 取消按钮
150
256
  cancel() {
151
257
  this.setting.isShow = false;
152
- //this.reset()
153
258
  this.$emit("onCancelClick", { data: this.entity, setting: this.setting });
259
+
154
260
  },
155
261
  // 表单重置
156
262
  reset() {
157
263
  for (var column of this.columns) {
158
264
  this.entity[column.property] = column.default;
159
265
  }
160
- this.resetForm("entity");
266
+ (this).resetForm("entity");
161
267
  },
162
268
  /** 提交按钮 */
163
269
  submitForm: function () {
164
270
  var self = this;
165
271
  this.setting.submitLoading = true;
166
- this.$refs["entity"].validate((valid) => {
272
+
273
+ // (this.$refs["TableForm"]).$refs['entity']
274
+ // .validate((valid) => {
275
+
276
+ // });
277
+ (this.$refs["entity"]).validate((valid) => {
167
278
  if (valid) {
168
- this.$emit("onSaveClick", {
169
- data: this.entity,
170
- setting: this.setting,
171
- });
279
+ if (this.setting.isShowItems) {
280
+ (this.$refs["TableForm"]).$refs["entity"].validate((valid) => {
281
+ if (valid) {
282
+ if (this.setting.type && this.setting.type == "add") {
283
+ this.$emit("onAddSaveClick", {
284
+ data: this.entity,
285
+ setting: this.setting,
286
+ });
287
+ self.setting.submitLoading = false;
288
+ } else {
289
+ // if (this.setting.isShowItems) {
290
+ // this.$emit("onSaveClick", {
291
+ // data: { data: this.entity, items: this.items },
292
+ // setting: this.setting,
293
+ // });
294
+ // } else {
295
+ // }
296
+ this.$emit("onSaveClick", {
297
+ data: this.entity,
298
+ setting: this.setting,
299
+ });
300
+ self.setting.submitLoading = false;
301
+ }
302
+ } else {
303
+ this.setting.submitLoading = false;
304
+ }
305
+ });
306
+ } else {
307
+ if (this.setting.type && this.setting.type == "add") {
308
+ this.$emit("onAddSaveClick", {
309
+ data: this.entity,
310
+ setting: this.setting,
311
+ });
312
+ self.setting.submitLoading = false;
313
+ } else {
314
+ // if (this.setting.isShowItems) {
315
+ // this.$emit("onSaveClick", {
316
+ // data: { data: this.entity, items: this.items },
317
+ // setting: this.setting,
318
+ // });
319
+ // } else {
320
+ // }
321
+ this.$emit("onSaveClick", {
322
+ data: this.entity,
323
+ setting: this.setting,
324
+ });
325
+ self.setting.submitLoading = false;
326
+ }
327
+ }
328
+ } else {
329
+ this.setting.submitLoading = false;
172
330
  }
173
331
  });
174
- this.setting.submitLoading = false;
175
332
  },
176
333
  /** 自定义操作菜单按钮点击处理 */
177
334
  handleCustomOpMenuClick(opMenu) {
@@ -181,12 +338,46 @@ export default {
181
338
  setting: this.setting,
182
339
  });
183
340
  },
184
- },
185
- };
341
+ onSearch(value) {
342
+ this.$emit("onSearch", value);
343
+ },
344
+ }
345
+ }
186
346
  </script>
187
347
 
188
348
  <style scoped>
189
349
  .wrapper-container-supplement {
190
350
  min-height: 415px;
191
351
  }
352
+ ::v-deep label {
353
+ font-weight: 500;
354
+ }
355
+
356
+ ::v-deep .el-input.is-disabled .el-input__inner {
357
+ color: #606266;
358
+ }
359
+
360
+ ::v-deep .el-form-item {
361
+ margin-bottom: 16px;
362
+ }
363
+
364
+ ::v-deep .el-form-item--small.el-form-item {
365
+ margin-bottom: 8px;
366
+ }
367
+
368
+ ::v-deep .el-dialog__body {
369
+ padding: 24px 24px 0 24px;
370
+ }
371
+
372
+ ::v-deep .el-dialog__footer {
373
+ text-align: center;
374
+ border-top: 1px solid #e7e8ed;
375
+ padding: 12px 0 12px 0;
376
+ }
377
+
378
+ ::v-deep .el-dialog__header {
379
+ padding: 16px 16px 10px;
380
+ border-bottom: 1px solid #dcdfe6;
381
+ }
192
382
  </style>
383
+ <style></style>
@@ -0,0 +1,280 @@
1
+ <template>
2
+ <div style="margin-bottom: 10px">
3
+ <el-form :model="model" ref="entity">
4
+ <el-table
5
+ :border="true"
6
+ v-loading="loading"
7
+ :data="model.listData"
8
+ @selection-change="onSelectionChange"
9
+ :row-class-name="rowClassName"
10
+ ref="multipleTable"
11
+ >
12
+ <el-table-column type="selection" width="50" align="center" />
13
+ <el-table-column
14
+ v-if="listSetting.isShowIndexColumn"
15
+ type="index"
16
+ label="序号"
17
+ width="50"
18
+ align="center"
19
+ >
20
+ <template scope="scope">
21
+ <span>{{
22
+ (listQueryParams.pageNum - 1) * listQueryParams.pageSize +
23
+ scope.$index +
24
+ 1
25
+ }}</span>
26
+ </template>
27
+ </el-table-column>
28
+ <template v-for="(column, index) in listColumns">
29
+ <el-table-column
30
+ :show-overflow-tooltip="true"
31
+ :key="index"
32
+ :render-header="addRedStar"
33
+ :label="column.text"
34
+ align="center"
35
+ :prop="column.property"
36
+ v-if="column.visible != false"
37
+ :min-width="column.width || 100"
38
+ >
39
+ <template scope="scope">
40
+ <el-form-item
41
+ :prop="`listData[${scope.$index}].` + column.property"
42
+ :rules="listSetting.rules[column.property]"
43
+ >
44
+ <el-input
45
+ v-if="column.displayType == 'TextBox'"
46
+ size="small"
47
+ v-model="scope.row[column.property]"
48
+ placeholder="请输入内容"
49
+ ></el-input>
50
+
51
+ <dropDownList
52
+ v-else-if="column.displayType == 'dropDownList'"
53
+ :column="column"
54
+ :entity="scope.row"
55
+ :value="scope.row[column.property]"
56
+ :setting.sync="column.setting"
57
+ @change="onChangeEvent"
58
+ ></dropDownList>
59
+ <DatePicker
60
+ v-else-if="column.displayType == 'DatePicker'"
61
+ :column="column"
62
+ :entity="scope.row"
63
+ :value="scope.row[column.property]"
64
+ :setting.sync="column.setting"
65
+ @change="onChangeEvent"
66
+ >
67
+ </DatePicker>
68
+ <Lookup
69
+ v-else-if="column.displayType == 'Lookup'"
70
+ :column="column"
71
+ :entity="scope.row"
72
+ :value="scope.row[column.property]"
73
+ :setting.sync="column.setting"
74
+ @change="onChangeEvent"
75
+ >
76
+ </Lookup>
77
+ <changer
78
+ v-else-if="column.displayType == 'Switch'"
79
+ :column="column"
80
+ :entity="scope.row"
81
+ :value="scope.row[column.property]"
82
+ :setting="column.setting"
83
+ @change="onChangeEvent"
84
+ ></changer>
85
+ <Cascader
86
+ v-else-if="column.displayType == 'Cascader'"
87
+ :column="column"
88
+ :entity="scope.row"
89
+ :value="scope.row[column.property]"
90
+ :setting.sync="column.setting"
91
+ @change="onChangeEvent"
92
+ ></Cascader>
93
+ <span v-else>
94
+ {{ scope.row[scope.column.property] }}
95
+ </span>
96
+ </el-form-item>
97
+ </template>
98
+ </el-table-column>
99
+ </template>
100
+
101
+ <el-table-column
102
+ label="操作"
103
+ align="center"
104
+ min-width="160"
105
+ class-name="small-padding fixed-width"
106
+ v-if="listSetting.isShowOpColumn"
107
+ >
108
+ <template slot-scope="scope">
109
+ <el-button
110
+ size="mini"
111
+ type="text"
112
+ @click="deleteSingle(scope.$index)"
113
+ >删除</el-button
114
+ >
115
+ </template>
116
+ </el-table-column>
117
+ </el-table>
118
+ <pagination
119
+ v-if="listSetting.isShowPager"
120
+ :total="listQueryParams.total"
121
+ :page.sync="listQueryParams.pageNum"
122
+ :limit.sync="listQueryParams.pageSize"
123
+ @pagination="getList"
124
+ />
125
+ </el-form>
126
+ <div style="margin-top: 8px" v-if="listSetting.buttonShow">
127
+ <el-button type="primary" size="mini" @click="newAdd">新增数据</el-button>
128
+ <el-button @click="deleteAll" type="danger" size="mini"
129
+ >删除选中</el-button
130
+ >
131
+ </div>
132
+ </div>
133
+ </template>
134
+
135
+ <script>
136
+ import DropDownList from "@srcComponents/customForm/dropDownList.vue";
137
+ import DatePicker from "@srcComponents/customForm/datePicker.vue";
138
+ import Lookup from "@srcComponents/customForm/lookup.vue";
139
+ import changer from "@srcComponents/customForm/switch.vue";
140
+ import Cascader from "@srcComponents/customForm/cascader.vue";
141
+
142
+ export default {
143
+ name: "EditDialog",
144
+ components: {
145
+ Cascader,
146
+ DropDownList,
147
+ DatePicker,
148
+ Lookup,
149
+ changer,
150
+ },
151
+ props: {
152
+ listSetting: {
153
+ type: Object,
154
+ default: function () {
155
+ return {};
156
+ },
157
+ },
158
+ // 列信息
159
+ listColumns: {
160
+ type: Array,
161
+ default: function () {
162
+ return [
163
+ //{ key: 0, text: `用户编码`, property: "userNo", visible: true },
164
+ //{ key: 1, text: `用户账号`, property: "userAccount", visible: true },
165
+ ];
166
+ },
167
+ },
168
+ // 表单参数
169
+ listQueryParams: {
170
+ type: Object,
171
+ default: function () {
172
+ return {};
173
+ },
174
+ },
175
+ // 表单校验
176
+ rules: {
177
+ type: Object,
178
+ default: function () {
179
+ return {};
180
+ },
181
+ },
182
+ //编辑界面自定义按钮菜单 - 若无自定义按钮,不需要重写
183
+ listData: {
184
+ type: Array,
185
+ default: function () {
186
+ return [
187
+ //{ name: "custom1", visable: true, icon: "ion-plus-round", text: "自定义1" }
188
+ ];
189
+ },
190
+ },
191
+ },
192
+ data() {
193
+ return {
194
+ model:{
195
+ listData: [],
196
+ },
197
+ multipleSelectAry:[],
198
+ currentEntities:[],
199
+ loading:false,
200
+ };
201
+ },
202
+ watch: {
203
+ listData(newVal, oldVal) {
204
+ if (newVal) {
205
+ console.log(newVal)
206
+ this.$set(this.model, "listData", this.listData);
207
+ }
208
+ },
209
+ model: {
210
+ handler(newVal, oldVal) {
211
+ if (newVal) {
212
+ this.$emit("update", newVal);
213
+ }
214
+ },
215
+ deep: true // 启用深度监听
216
+ }
217
+ },
218
+ created() {
219
+ if (this.listData) {
220
+ this.$set(this.model, "listData", this.listData);
221
+ }
222
+ },
223
+ mounted() {},
224
+ activated() {
225
+ console.log("editDialog");
226
+ },
227
+ methods: {
228
+ rowClassName(row, index) {
229
+ row.row.index = row.rowIndex;
230
+ },
231
+ onSelectionChange(val) {
232
+ this.$emit('selectionChange',val)
233
+ this.currentEntities = val;
234
+ val.forEach((item) => {
235
+ this.multipleSelectAry.push(item.index);
236
+ });
237
+ },
238
+ addRedStar(h, { column }) {
239
+ if (this.listSetting?.rules[column.property]) {
240
+ return [
241
+ h("span", { style: "color: red" }, "*"),
242
+ h("span", " " + column.label),
243
+ ];
244
+ }
245
+ return [h("span", " " + column.label)];
246
+ },
247
+ newAdd() {
248
+ let newData = {};
249
+ this.listColumns.forEach((item) => {
250
+ newData[item.property] = "";
251
+ });
252
+ this.model.listData.push(newData);
253
+ },
254
+ deleteAll() {
255
+ if (this.multipleSelectAry.length == 0) {
256
+ (this).$message.error("请选择要删除的数据");
257
+ }
258
+ this.model.listData = this.model.listData.filter((item, index) => {
259
+ return !this.multipleSelectAry.includes(index);
260
+ });
261
+ this.multipleSelectAry = [];
262
+ },
263
+ onChangeEvent(args) {
264
+ this.$emit("change", args);
265
+ },
266
+ deleteSingle(index) {
267
+ (this).model.listData.splice(index, 1);
268
+ },
269
+ getList(){
270
+ this.$emit('getList')
271
+ },
272
+ }
273
+ }
274
+ </script>
275
+
276
+ <style scoped>
277
+ .el-form-item{
278
+ margin-bottom: 0;
279
+ }
280
+ </style>
@@ -0,0 +1,126 @@
1
+ <template>
2
+ <div>
3
+ <dict-select v-model="stateValue" v-if="keyInTypeCode === KEY_IN_TYPE_CODE.SELECT_ENUM" v-bind="$attrs"
4
+ :type="dictType" @change="change"></dict-select>
5
+ <dict-select v-model="stateValue" v-else-if="keyInTypeCode === KEY_IN_TYPE_CODE.SELECT_YES_NO" v-bind="$attrs"
6
+ type="sys_yes_no_bool" @change="(val) =>{change(val === 'true')}"></dict-select>
7
+ <el-date-picker v-model="stateValue" v-else-if="keyInTypeCode === KEY_IN_TYPE_CODE.SELECT_DATE" v-bind="$attrs"
8
+ @change="change"></el-date-picker>
9
+ <el-input v-model="stateValue" v-else-if="keyInTypeCode === KEY_IN_TYPE_CODE.INPUT_NUMBER" v-bind="$attrs"
10
+ @change="change"></el-input>
11
+ <el-input v-model="stateValue" v-else-if="keyInTypeCode === KEY_IN_TYPE_CODE.INPUT_STRING" v-bind="$attrs"
12
+ @change="change"></el-input>
13
+ <span v-else>录入类型有误</span>
14
+ </div>
15
+ </template>
16
+
17
+ <script>
18
+ import {KEY_IN_TYPE_CODE} from "@/constant/bd";
19
+
20
+ export default {
21
+ name: 'DynamicInputBox',
22
+ computed: {
23
+ KEY_IN_TYPE_CODE() {
24
+ return KEY_IN_TYPE_CODE
25
+ },
26
+ },
27
+ watch: {
28
+ attributeValue(val) {
29
+ this.setStateValue(this.keyInTypeCode === KEY_IN_TYPE_CODE.SELECT_ENUM ? this.attributeValueCode : this.attributeValue);
30
+ },
31
+ attributeValueCode(val) {
32
+ this.setStateValue(this.keyInTypeCode === KEY_IN_TYPE_CODE.SELECT_ENUM ? this.attributeValueCode : this.attributeValue);
33
+ },
34
+ keyInTypeCode(val) {
35
+ this.setStateValue(this.keyInTypeCode === KEY_IN_TYPE_CODE.SELECT_ENUM ? this.attributeValueCode : this.attributeValue);
36
+ }
37
+ },
38
+ props: {
39
+ keyInTypeCode: {
40
+ type: String,
41
+ required: true
42
+ },
43
+ // 当设置小数位数并且录入类型为数字时,执行格式化和补0
44
+ decimalPlace: {
45
+ type: String,
46
+ default: null
47
+ },
48
+ dictType: {
49
+ type: String,
50
+ default: ''
51
+ },
52
+ value: {
53
+ type: String,
54
+ default: ""
55
+ },
56
+ attributeValue: {
57
+ type: [String,Boolean],
58
+ default: ''
59
+ },
60
+ attributeValueCode: {
61
+ type: String,
62
+ default: ''
63
+ },
64
+ },
65
+ data() {
66
+ return {
67
+ stateValue: '',
68
+ }
69
+ },
70
+ created() {
71
+ this.setStateValue(this.keyInTypeCode === KEY_IN_TYPE_CODE.SELECT_ENUM ? this.attributeValueCode : this.attributeValue);
72
+ },
73
+ methods: {
74
+ formatInput() {
75
+ const decimalPlace = this.decimalPlace || 0; // 默认小数位数为0
76
+ // 格式化输入值
77
+ this.stateValue = this.stateValue
78
+ .replace(/[^\d.]/g, '') // 只保留数字和小数点
79
+ .replace(/^0+(?=\d)/, ''); // 去除前导0
80
+ const parts = this.stateValue.split('.');
81
+ if(!parts[0].length){
82
+ parts[0] = "0";
83
+ }
84
+ if (decimalPlace === 0) {
85
+ // 小数位数为0,只保留整数部分
86
+ this.stateValue = parts[0];
87
+ } else {
88
+ if (parts.length === 1) {
89
+ parts[1] = ''
90
+ }
91
+ // 处理小数部分
92
+ parts[1] = parts[1].slice(0, decimalPlace); // 限制小数位数
93
+
94
+ // 自动补零
95
+ while (parts[1].length < decimalPlace) {
96
+ parts[1] += '0';
97
+ }
98
+ // 重新组合值
99
+ this.stateValue = parts[0] + '.' + parts[1];
100
+ }
101
+ },
102
+ setStateValue(val) {
103
+ if(typeof val === 'boolean') {
104
+ this.stateValue = val.toString()
105
+ }else{
106
+ this.stateValue = val
107
+ }
108
+ },
109
+ change(val, option) {
110
+
111
+ if(this.keyInTypeCode === KEY_IN_TYPE_CODE.INPUT_NUMBER && this.decimalPlace != null){
112
+ this.formatInput();
113
+ val = this.stateValue;
114
+ }
115
+
116
+ if (this.keyInTypeCode === KEY_IN_TYPE_CODE.SELECT_ENUM) {
117
+ this.$emit('attributeValueCodeChange', val)
118
+ this.$emit('attributeValueChange', option['dictLabel'])
119
+ } else {
120
+ this.$emit('attributeValueChange', val)
121
+ }
122
+ this.$emit('change', val, option)
123
+ },
124
+ },
125
+ };
126
+ </script>
@@ -0,0 +1,78 @@
1
+ <template>
2
+ <el-input-number v-model="stateValue" :precision="precision" v-bind="$attrs" @change="change"></el-input-number>
3
+ </template>
4
+
5
+ <script>
6
+ import {SCALE_TYPE} from "@/constant/bd";
7
+ import {
8
+ getAmountScaleByCurrencyId,
9
+ getPriceScaleByCurrencyId,
10
+ getUomScaleByUomNo
11
+ } from "@utils/cache/bdCache";
12
+
13
+
14
+ export default {
15
+ name: 'ScaleInputNumber',
16
+ props: {
17
+ type: {
18
+ type: String,
19
+ required: true
20
+ },
21
+ scaleNo: {
22
+ type: String
23
+ },
24
+ currencyId: {
25
+ type: String,
26
+ },
27
+ value: {
28
+ type: [String, Number],
29
+ default: '0'
30
+ }
31
+ },
32
+ watch: {
33
+ value: {
34
+ handler(val) {
35
+ if (typeof val == 'string') {
36
+ val = Number(val)
37
+ }
38
+ this.stateValue = val
39
+ },
40
+ immediate: true
41
+ }
42
+ },
43
+ data() {
44
+ return {
45
+ step: 1,
46
+ min: 0,
47
+ max: 1000000,
48
+ precision: 0,
49
+ stateValue: 0
50
+ };
51
+ },
52
+ created() {
53
+ this.setPrecision();
54
+ },
55
+ methods: {
56
+ change(val) {
57
+ this.$emit('input', val)
58
+ this.$emit('change', val)
59
+ },
60
+ setPrecision() {
61
+ switch (this.type) {
62
+ case SCALE_TYPE.UOM:
63
+ console.log(getUomScaleByUomNo(this.scaleNo));
64
+ this.precision = getUomScaleByUomNo(this.scaleNo).scale;
65
+ break;
66
+ case SCALE_TYPE.AMOUNT:
67
+ console.log(getAmountScaleByCurrencyId(this.currencyId));
68
+ this.precision = getAmountScaleByCurrencyId(this.currencyId).scale;
69
+ break;
70
+ case SCALE_TYPE.PRICE:
71
+ console.log(getPriceScaleByCurrencyId(this.currencyId));
72
+ this.precision = getPriceScaleByCurrencyId(this.currencyId).scale;
73
+ break;
74
+ }
75
+ },
76
+ },
77
+ };
78
+ </script>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kz-ui-base",
3
- "version": "1.0.61",
3
+ "version": "1.0.63",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {