mooho-base-admin-plus 0.4.75 → 0.4.76

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,7 +1,7 @@
1
1
  {
2
2
  "name": "mooho-base-admin-plus",
3
3
  "description": "MOOHO basic framework for admin by Vue3",
4
- "version": "0.4.75",
4
+ "version": "0.4.76",
5
5
  "author": "jinyifan <jinyifan@mooho.com.cn>",
6
6
  "dotnetVersion": "1.4.0",
7
7
  "license": "MIT",
@@ -245,6 +245,49 @@
245
245
  @on-change="selected => onSelectDataChange(rowData(row, index), column, selected)"
246
246
  ></dialog-select>
247
247
  </template>
248
+ <template v-else-if="column.controlType === 'SelectWithOther'">
249
+ <div style="display: flex">
250
+ <Select
251
+ :model-value="parseDataWithOther(rowData(row, index), column)"
252
+ @update:model-value="$event => setDataWithOther(rowData(row, index), column.code, $event)"
253
+ size="small"
254
+ :disabled="isReadonly(rowData(row, index), column)"
255
+ :clearable="true"
256
+ :style="{
257
+ width:
258
+ parseDataWithOther(rowData(row, index), column) == '__Other'
259
+ ? column.controlWidth == null
260
+ ? null
261
+ : column.controlWidth * 0.4 - 4 + 'px'
262
+ : column.controlWidth == null
263
+ ? null
264
+ : column.controlWidth - 8 + 'px'
265
+ }"
266
+ :placeholder="column.description"
267
+ :transfer="true"
268
+ @on-change="selected => onSelectDataChange(rowData(row, index), column, selected)"
269
+ >
270
+ <Option v-for="item in getDataSource(rowData(row, index), column)" :key="item.id" :value="item.id">{{ item.name }}</Option>
271
+ <Option key="__Other" value="__Other">{{ !!(column.pattern || '').trim() ? column.pattern : $t('Front_Label_Others') }}</Option>
272
+ </Select>
273
+ <Input
274
+ type="text"
275
+ size="small"
276
+ v-show="parseDataWithOther(rowData(row, index), column) == '__Other'"
277
+ :model-value="parseData(rowData(row, index), column.code)"
278
+ @update:model-value="$event => setData(rowData(row, index), column.code, $event)"
279
+ :readonly="readonly || column.isReadonly"
280
+ :style="{
281
+ width: column.controlWidth == null ? null : column.controlWidth * 0.6 - 8 + 'px'
282
+ }"
283
+ style="margin-left: 4px"
284
+ :maxlength="column.maxLength"
285
+ :placeholder="column.description"
286
+ @on-change="onDataChange(rowData(row, index), column)"
287
+ @on-blur="onBlur(rowData(row, index), column)"
288
+ />
289
+ </div>
290
+ </template>
248
291
  <template v-else-if="column.controlType === 'Date' || column.controlType === 'DateTime' || column.controlType === 'Year' || column.controlType === 'Month'">
249
292
  <DatePicker
250
293
  size="small"
@@ -2382,6 +2425,38 @@
2382
2425
 
2383
2426
  this.loadData(data);
2384
2427
  }
2428
+ },
2429
+ // 根据表达式取值(带其他)
2430
+ parseDataWithOther(model, column) {
2431
+ let expression = column.code;
2432
+ let selectValue = this.parseData(model, expression + '_o');
2433
+
2434
+ let value = this.parseData(model, expression);
2435
+ let dataSource = this.getDataSource(model, column);
2436
+
2437
+ if (selectValue != null) {
2438
+ return selectValue;
2439
+ } else if (value == null) {
2440
+ return null;
2441
+ } else if (
2442
+ dataSource &&
2443
+ dataSource.some(item => {
2444
+ return item.id == value;
2445
+ })
2446
+ ) {
2447
+ return value;
2448
+ } else {
2449
+ return '__Other';
2450
+ }
2451
+ },
2452
+ // 根据表达式赋值(带其他)
2453
+ setDataWithOther(model, expression, value) {
2454
+ this.setData(model, expression + '_o', value);
2455
+ if (value != '__Other') {
2456
+ this.setData(model, expression, value);
2457
+ } else {
2458
+ this.setData(model, expression, null);
2459
+ }
2385
2460
  }
2386
2461
  }
2387
2462
  };
package/src/i18n/index.js CHANGED
@@ -9,6 +9,8 @@ import { createI18n } from 'vue-i18n/index';
9
9
  export default createI18n({
10
10
  allowComposition: true,
11
11
  globalInjection: true,
12
+ fallbackWarn: false,
13
+ missingWarn: false,
12
14
  legacy: false
13
15
  // locale,
14
16
  // messages