doway-coms 2.2.2 → 2.2.4

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": "doway-coms",
3
- "version": "2.2.2",
3
+ "version": "2.2.4",
4
4
  "description": "doway组件库",
5
5
  "author": "dowaysoft",
6
6
  "main": "packages/index.js",
@@ -76,6 +76,7 @@
76
76
  :max="col.max"
77
77
  :precision="col.precision"
78
78
  :percent="col.percent"
79
+ :doFormat="col.doFormat"
79
80
  @change="
80
81
  () => {
81
82
  numberChange(col)
@@ -203,6 +203,7 @@
203
203
  size="small"
204
204
  @change="cellValueChange(scope)"
205
205
  value-format="YYYY-MM-DD"
206
+ :disabled-date="(current) => disabledDate(current,scope.column.params)"
206
207
  />
207
208
  </div>
208
209
  </template>
@@ -1852,7 +1853,9 @@ export default {
1852
1853
  colParams['controlEdit'] = true
1853
1854
  }
1854
1855
  if (originCol.controlType === controlType.date) {
1855
- colParams['pastDate'] = originCol.pastDate
1856
+ colParams['pastDate'] = originCol.pastDate == undefined ? true : false
1857
+ colParams['disabledDateValue'] =
1858
+ originCol.disabledDateValue == undefined ? 0: originCol.disabledDateValue
1856
1859
  }
1857
1860
  colParams['disableUserVisible'] = originCol.disableUserVisible === true
1858
1861
  colInfo['params'] = colParams
@@ -3323,6 +3326,16 @@ export default {
3323
3326
  })
3324
3327
  .finally(() => {})
3325
3328
  },
3329
+ disabledDate(current, params) {
3330
+ if (params.pastDate === true) {
3331
+ //如果允许过期时间
3332
+ return false;
3333
+ }
3334
+ return (
3335
+ current &&
3336
+ current.diff(moment().add(params.disabledDateValue, "day"), "days") < 0
3337
+ );
3338
+ },
3326
3339
  },
3327
3340
  }
3328
3341
  </script>
@@ -58,8 +58,8 @@
58
58
  </div>
59
59
  </ValidationProvider>
60
60
  <span v-else>
61
- <span v-if="percent">{{ currentValue*100 }}%</span>
62
- <span v-else>{{ currentValue }}</span>
61
+ <span v-if="percent">{{ getFormatValue(currentValue)}}</span>
62
+ <span v-else>{{ getFormatValue(currentValue) }}</span>
63
63
  </span>
64
64
  </div>
65
65
  </div>
@@ -198,6 +198,12 @@ export default {
198
198
  return false
199
199
  }
200
200
  },
201
+ doFormat:{
202
+ type:Boolean,
203
+ default:function(){
204
+ return false
205
+ }
206
+ }
201
207
  },
202
208
  created() {},
203
209
  methods: {
@@ -213,7 +219,12 @@ export default {
213
219
  numberFormatter(value) {
214
220
  // 百分比格式化
215
221
  if (this.percent) {
216
- return value + '%'
222
+
223
+ if(this.precision){
224
+ return XEUtils.round(value,this.precision) +'%'
225
+ }else{
226
+ return value + '%'
227
+ }
217
228
  }
218
229
  return value
219
230
  },
@@ -251,6 +262,21 @@ export default {
251
262
  returnValue = this.min
252
263
  }
253
264
  return returnValue
265
+ },
266
+ getFormatValue(value){
267
+ if (this.percent) {
268
+ if(this.precision){
269
+ return XEUtils.round(this.percentValue,this.precision) +'%'
270
+ }else{
271
+ return this.percentValue + '%'
272
+ }
273
+ }
274
+ console.log('inner',this.doFormat)
275
+ if(this.doFormat&&this.precision){
276
+
277
+ return XEUtils.round(value,this.precision)
278
+ }
279
+ return value
254
280
  }
255
281
  }
256
282
  }
@@ -460,8 +460,8 @@ export function gridDefaultValueDisplay(rowInfo,colInfo){
460
460
  displayValue = displayValue.join(',')
461
461
  break
462
462
  case controlType.number:
463
- if(colInfo.params.doFloor){
464
- displayValue=XEUtils.floor(displayValue,colInfo.params.precision)
463
+ if(colInfo.params.doRound){
464
+ displayValue=XEUtils.round(displayValue,colInfo.params.precision)
465
465
  }
466
466
  break
467
467
 
@@ -57,5 +57,8 @@ VXETable.formats.mixin({
57
57
  },
58
58
  formatPercent({ cellValue }) {
59
59
  return cellValue + '%'
60
+ },
61
+ formatPercentAndFixedNumber({ cellValue }) {
62
+ return XEUtils.toFixed(XEUtils.round(cellValue, digits), digits) +'%'
60
63
  }
61
64
  })