@zscreate/zhxy-app-component 1.0.186 → 1.0.187
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.
|
@@ -840,7 +840,26 @@ export default {
|
|
|
840
840
|
}
|
|
841
841
|
})
|
|
842
842
|
},
|
|
843
|
-
|
|
843
|
+
/**
|
|
844
|
+
* @param date Moment
|
|
845
|
+
* @returns {boolean}
|
|
846
|
+
*/
|
|
847
|
+
disabledDate(val) {
|
|
848
|
+
const { min, max, format, type } = this.widget.options
|
|
849
|
+
let flag = false
|
|
850
|
+
const date = moment(new Date())
|
|
851
|
+
if (min) {
|
|
852
|
+
const ago = moment(val, format).subtract(min + (type === 'month' ? 1 : 0), 'months')
|
|
853
|
+
flag = date.diff(ago) < 0
|
|
854
|
+
if (flag) return true
|
|
855
|
+
}
|
|
856
|
+
if (max) {
|
|
857
|
+
const after = moment(val, format).add(max, 'months')
|
|
858
|
+
flag = date.diff(after) > 0
|
|
859
|
+
if (flag) return true
|
|
860
|
+
}
|
|
861
|
+
return flag
|
|
862
|
+
},
|
|
844
863
|
//切换时间
|
|
845
864
|
dateChange(val) {
|
|
846
865
|
if (this.tableKey) {
|
|
@@ -1640,7 +1659,6 @@ export default {
|
|
|
1640
1659
|
if (this.tableKey) {
|
|
1641
1660
|
this.tableValueSet(v);
|
|
1642
1661
|
} else {
|
|
1643
|
-
this.models[this.widget.model] = v
|
|
1644
1662
|
if (this.widget.type === 'userSelector') {
|
|
1645
1663
|
if (v === "") {
|
|
1646
1664
|
this.dataModel = []
|
|
@@ -1677,7 +1695,22 @@ export default {
|
|
|
1677
1695
|
// }
|
|
1678
1696
|
this.widget.key = v
|
|
1679
1697
|
this.$emit('upDateWidget', this.widget)
|
|
1698
|
+
} else if( this.widget.type === 'date') {
|
|
1699
|
+
if (this.widget.options.type === 'range' && !Array.isArray(v)) {
|
|
1700
|
+
this.dataModel = v =[]
|
|
1701
|
+
}
|
|
1702
|
+
const concatData = [].concat(v)
|
|
1703
|
+
if (v && concatData.length > 0 && !concatData.every(item => !this.disabledDate(item))) {
|
|
1704
|
+
this.$refs.uToast.show({
|
|
1705
|
+
title: "超出允许选择范围",
|
|
1706
|
+
duration: 2000,
|
|
1707
|
+
});
|
|
1708
|
+
this.dataModel = undefined
|
|
1709
|
+
v = undefined
|
|
1710
|
+
}
|
|
1711
|
+
|
|
1680
1712
|
}
|
|
1713
|
+
this.models[this.widget.model] = v
|
|
1681
1714
|
|
|
1682
1715
|
this.$emit("update:models", {
|
|
1683
1716
|
...this.models,
|