@zscreate/zhxy-app-component 1.0.185 → 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,
@@ -20,7 +20,7 @@
20
20
  <u-tr>
21
21
  <u-th width="50px" style="box-sizing: border-box">
22
22
  <view v-if="multiple">
23
- <u-checkbox :value="isAllCheck" @change="roleCheckAll">
23
+ <u-checkbox :value="isAllCheck" @change="roleCheckAll" >
24
24
  </u-checkbox>
25
25
  </view>
26
26
  <view v-else>选择</view>
@@ -31,7 +31,7 @@
31
31
  <u-tr v-for="user in roleUserList" :key="user.id">
32
32
  <u-td width="50px" >
33
33
  <view style="width: 33px;">
34
- <u-checkbox v-model="user.checked" @change="handleCheck" :name="user.id">
34
+ <u-checkbox v-model="user.checked" @change="handleCheck" :name="user.id" >
35
35
  </u-checkbox>
36
36
  </view>
37
37
  </u-td>
@@ -39,23 +39,19 @@
39
39
  <u-td style="flex: 1; word-break: break-all; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;"><view>{{ user.departName }}</view></u-td>
40
40
  </u-tr>
41
41
  </u-table>
42
-
43
42
  </view>
44
-
45
- <view style="display: flex; justify-content: space-between; margin-top: 20rpx">
46
- <u-button type="primary" size="medium" @click="handleSelectRoleUserOk">确定</u-button>
47
- <u-button size="medium" @click="roleSelectShow = false">取消</u-button>
43
+ <view style="display: flex; justify-content: space-between; margin-top: 20rpx; gap: 20px">
44
+ <u-button type="primary" size="medium" @click="handleSelectRoleUserOk" :custom-style="{borderRadius: '5px'}">确定</u-button>
45
+ <u-button size="medium" @click="roleSelectShow = false" :custom-style="{borderRadius: '5px'}">取消</u-button>
48
46
  </view>
49
47
  </view>
50
48
 
51
-
52
49
  <t-loading :isLoading="isLoading"/>
53
50
  </u-popup>
54
51
  </template>
55
52
 
56
53
  <script>
57
54
  import {cloneObj} from "../../utils/util";
58
-
59
55
  export default {
60
56
  name: "userSelectByRole",
61
57
  props: {
@@ -204,7 +200,6 @@ export default {
204
200
  }
205
201
  }
206
202
  </script>
207
-
208
203
  <style scoped lang="less">
209
204
  /deep/ u-th:nth-child(1) {
210
205
  flex: 0 0 40px;
@@ -212,7 +207,6 @@ export default {
212
207
  /deep/ u-th {
213
208
  flex: 1;
214
209
  }
215
-
216
210
  /deep/ .u-icon__icon {
217
211
  top: -2px !important;
218
212
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zscreate/zhxy-app-component",
3
- "version": "1.0.185",
3
+ "version": "1.0.187",
4
4
  "private": false,
5
5
  "description": "zhxy-app-component",
6
6
  "main": "index.js",