n20-common-lib 2.9.39 → 2.9.41

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": "n20-common-lib",
3
- "version": "2.9.39",
3
+ "version": "2.9.41",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve": "vue-cli-service serve",
@@ -79,7 +79,7 @@
79
79
  :max="formItem.max || 9999999999.99"
80
80
  :min="formItem.min || formItem.min === 0 ? formItem.min : 0"
81
81
  :d-num="formItem.dNum || formItem.dNum === 0 ? formItem.dNum : 2"
82
- :type="formItem.type || 'money'"
82
+ :type="formItem.numberType || 'money'"
83
83
  @change="(value) => $emit('valueChange', value, key)"
84
84
  />
85
85
  </template>
@@ -21,7 +21,7 @@
21
21
  @selection-change-method="handleSelectionChange"
22
22
  >
23
23
  <vxe-column slot="order" title="排序" width="60px" align="center">
24
- <i class="n20-icon-tuodong"></i>
24
+ <i class="n20-icon-tuodong draggable-button"></i>
25
25
  </vxe-column>
26
26
  <vxe-column slot="input" slot-scope="{ column }" v-bind="column" :field="column.prop" :title="column.label">
27
27
  <el-input v-model="row[column.prop]" slot-scope="{ row }" placeholder="请输入" size="normal" clearable />
@@ -115,9 +115,11 @@ export default {
115
115
  ]
116
116
  }
117
117
  },
118
- busKey: {
119
- type: String,
120
- default: ''
118
+ value: {
119
+ type: Array,
120
+ default: () => {
121
+ return []
122
+ }
121
123
  },
122
124
  options: {
123
125
  type: Object,
@@ -268,11 +270,19 @@ export default {
268
270
  }
269
271
  },
270
272
  computed: {},
271
- watch: {},
273
+ watch: {
274
+ value: {
275
+ handler(val) {
276
+ this.tableData = val
277
+ },
278
+ immediate: true,
279
+ deep: true
280
+ }
281
+ },
272
282
  created() {},
273
283
  mounted() {
274
- this.setFieldType()
275
284
  this.getData()
285
+ this.setFieldType()
276
286
  this.checkColumns = this.TableHeader.filter((item) => {
277
287
  return this.showItems.includes(item.label)
278
288
  })
@@ -302,24 +312,7 @@ export default {
302
312
  this.selectData = data
303
313
  },
304
314
  getData() {
305
- if (!this.busKey) {
306
- this.$message.warning('busKey缺失,请检查')
307
- return false
308
- }
309
- /* this.$axios.get(`/test/dyfield/list/${this.busKey}`).then(res => {
310
- const { code, data } = res
311
- if (code !== 200) {
312
- return false
313
- }
314
- this.tableData = data.map((item, index) => {
315
- item.selectId = index
316
- return item
317
- })
318
- this.initData()
319
- }) */
320
-
321
- this.tableData = customFormOptionsData.data
322
- this.initData()
315
+ this.tableData = this.value
323
316
  this.$nextTick(() => {
324
317
  this.rowDrop()
325
318
  })
@@ -348,6 +341,7 @@ export default {
348
341
  } else {
349
342
  this.type = 2
350
343
  }
344
+ this.initData()
351
345
  break
352
346
  case '新增':
353
347
  this.tableData.push({ selectId: this.tableData.length })
@@ -363,23 +357,12 @@ export default {
363
357
  break
364
358
  case '保存':
365
359
  if (this.type === 1) {
366
- /* this.$axios
367
- .post(
368
- '/test/dyfield/save',
369
- this.tableData.map((item, index) => {
370
- item.busKey = this.busKey
371
- item.sort = index
372
- return item
373
- })
374
- )
375
- .then(res => {
376
- const { code } = res
377
- if (code !== 200) {
378
- return false
379
- }
380
- this.$message.success('保存成功')
381
- }) */
382
- this.initData()
360
+ const tableData = this.tableData.map((item, index) => {
361
+ item.busKey = this.busKey
362
+ item.sort = index
363
+ return item
364
+ })
365
+ this.$emit('save', tableData)
383
366
  } else {
384
367
  this.$refs['DynamicField'].validate((valid) => {
385
368
  if (valid) {
@@ -402,6 +385,7 @@ export default {
402
385
  const tbody = document.querySelector('.Tabledrag tbody')
403
386
  const _this = this
404
387
  Sortable.create(tbody, {
388
+ handle: '.draggable-button',
405
389
  onEnd({ newIndex, oldIndex }) {
406
390
  // 页面重新渲染
407
391
  const tableData = deepClone(_this.tableData)
@@ -560,7 +560,10 @@ export default {
560
560
  showClose: true
561
561
  })
562
562
  }
563
- this.$emit('down-rows', this.selectionList)
563
+ this.$emit(
564
+ 'down-rows',
565
+ this.selectionList.filter((item) => item[this.keys.url] || item._name)
566
+ )
564
567
  },
565
568
  deleteRows() {
566
569
  if (!this.selectionList.length) {
@@ -0,0 +1,7 @@
1
+ <template>
2
+ <div></div>
3
+ </template>
4
+
5
+ <script>
6
+ export default {}
7
+ </script>
@@ -8,7 +8,7 @@
8
8
  v-if="type === '日' && selectList.includes(type)"
9
9
  key="day"
10
10
  v-model="day"
11
- style="width: 220px"
11
+ style="width: 100%"
12
12
  format="yyyy-MM-dd"
13
13
  value-format="yyyy-MM-dd"
14
14
  type="daterange"
@@ -57,6 +57,15 @@
57
57
  :editable="false"
58
58
  :placeholder="'选择年' | $lc"
59
59
  />
60
+ <el-date-picker
61
+ v-if="type === '临时' && selectList.includes(type)"
62
+ v-model="custom"
63
+ type="daterange"
64
+ style="width: 100%"
65
+ value-format="yyyy-MM-dd"
66
+ :start-placeholder="$l('开始日期')"
67
+ :end-placeholder="$l('结束日期')"
68
+ />
60
69
  </div>
61
70
  </template>
62
71
 
@@ -95,7 +104,7 @@ export default {
95
104
  selectList: {
96
105
  type: Array,
97
106
  default: () => {
98
- return ['日', '周', '月', '季', '半年', '年']
107
+ return ['日', '周', '月', '季', '半年', '年', '临时']
99
108
  }
100
109
  }
101
110
  },
@@ -243,6 +252,20 @@ export default {
243
252
  this.$emit('change', iYear)
244
253
  }
245
254
  }
255
+ },
256
+ custom: {
257
+ get() {
258
+ return [this.value.startDate, this.value.endDate]
259
+ },
260
+ set(value) {
261
+ if (value) {
262
+ this.$emit('input', { startDate: value[0], endDate: value[1], typeDate: this.type })
263
+ this.$emit('change', { startDate: value[0], endDate: value[1], typeDate: this.type })
264
+ } else {
265
+ this.$emit('input', { startDate: '', endDate: '', typeDate: this.type })
266
+ this.$emit('change', { startDate: '', endDate: '', typeDate: this.type })
267
+ }
268
+ }
246
269
  }
247
270
  },
248
271
  methods: {