doway-coms 1.4.46 → 1.4.47

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": "1.4.46",
3
+ "version": "1.4.47",
4
4
  "description": "doway组件库",
5
5
  "author": "dowaysoft",
6
6
  "main": "packages/index.js",
@@ -1,159 +1,166 @@
1
1
  <template>
2
- <div class="d-control-container">
3
- <div
4
- class="d-control-label"
5
- :style="{ width: labelWidth > 0 ? labelWidth + 'px' : 'none' }"
6
- >
7
- {{ label
8
- }}
9
- <span v-if="rules && rules['required']" class="d-control-label-required"
2
+ <div class="d-control-container">
3
+ <div
4
+ class="d-control-label"
5
+ :style="{ width: labelWidth > 0 ? labelWidth + 'px' : 'none' }"
6
+ >
7
+ {{ label }}
8
+ <span v-if="rules && rules['required']" class="d-control-label-required"
10
9
  >*</span
11
- >
12
- <Tooltip :title="tooltip" v-if="tooltip" style="margin: 0 2px">
13
- <img src="../../styles/icon/help.png" alt="" style="width: 14px">
14
- </Tooltip>
15
- </div>
16
- <div class="d-control">
17
- <ValidationProvider
18
- :name="label"
19
- v-slot="v"
20
- :rules="rules"
21
- v-if="edit === true"
22
- >
23
- <DatePicker
24
- :size="'small'"
25
- placeholder="选择日期"
26
- v-model="currentValue"
27
- :disabled-date="disabledDate"
28
- format="YYYY-MM-DD"
29
- value-format="YYYY-MM-DD"
30
- style="width: 100%"
31
- @change="change"
32
- :class="{ 'd-error-input': v.errors.length > 0 }"
33
- />
34
- <div class="d-error-msg">
35
- {{ v.errors[0] }}
36
- </div>
37
- </ValidationProvider>
38
- <span v-else>{{ moment(currentValue).format("YYYY-MM-DD") }}</span>
39
- </div>
10
+ >
11
+ <Tooltip :title="tooltip" v-if="tooltip" style="margin: 0 2px">
12
+ <img src="../../styles/icon/help.png" alt="" style="width: 14px" />
13
+ </Tooltip>
14
+ </div>
15
+ <div class="d-control">
16
+ <ValidationProvider
17
+ :name="label"
18
+ v-slot="v"
19
+ :rules="rules"
20
+ v-if="edit === true"
21
+ >
22
+ <DatePicker
23
+ :size="'small'"
24
+ placeholder="选择日期"
25
+ v-model="currentValue"
26
+ :disabled-date="disabledDate"
27
+ format="YYYY-MM-DD"
28
+ value-format="YYYY-MM-DD"
29
+ style="width: 100%"
30
+ @change="change"
31
+ :class="{ 'd-error-input': v.errors.length > 0 }"
32
+ />
33
+ <div class="d-error-msg">
34
+ {{ v.errors[0] }}
35
+ </div>
36
+ </ValidationProvider>
37
+ <span v-else>{{ moment(currentValue).format("YYYY-MM-DD") }}</span>
40
38
  </div>
41
- </template>
39
+ </div>
40
+ </template>
42
41
 
43
42
  <script>
44
- import { DatePicker } from 'ant-design-vue'
45
- import { ValidationProvider } from 'vee-validate'
46
- import moment from 'moment'
47
- import { Tooltip } from 'ant-design-vue'
43
+ import { DatePicker } from "ant-design-vue";
44
+ import { ValidationProvider } from "vee-validate";
45
+ import moment from "moment";
46
+ import { Tooltip } from "ant-design-vue";
48
47
 
49
- export default {
50
- name: 'BaseDate',
51
- components:{
52
- DatePicker,
48
+ export default {
49
+ name: "BaseDate",
50
+ components: {
51
+ DatePicker,
53
52
  ValidationProvider,
54
- Tooltip,
55
-
53
+ Tooltip,
56
54
  },
57
- data() {
58
- return {
59
- moment,
60
- filterValue: '',
61
- isInputChanged: false,
62
- inputTimeout: null,
63
- searchRows: [],
64
- filterCols: [],
65
- gridLoading: false,
66
- gridPagerConfig: {
67
- total: 0,
68
- currentPage: 1,
69
- pageSize: 10
70
- }
71
- }
55
+ data() {
56
+ return {
57
+ moment,
58
+ filterValue: "",
59
+ isInputChanged: false,
60
+ inputTimeout: null,
61
+ searchRows: [],
62
+ filterCols: [],
63
+ gridLoading: false,
64
+ gridPagerConfig: {
65
+ total: 0,
66
+ currentPage: 1,
67
+ pageSize: 10,
68
+ },
69
+ };
70
+ },
71
+ computed: {
72
+ currentValue: {
73
+ // 动态计算currentValue的值
74
+ get: function () {
75
+ return this.value; // 将props中的value赋值给currentValue
76
+ },
77
+ set: function (val) {
78
+ this.$emit("input", val); // 通过$emit触发父组件
79
+ },
72
80
  },
73
- computed: {
74
- currentValue: {
75
- // 动态计算currentValue的值
76
- get: function() {
77
- return this.value // 将props中的value赋值给currentValue
78
- },
79
- set: function(val) {
80
- this.$emit('input', val) // 通过$emit触发父组件
81
- }
82
- }
81
+ },
82
+ props: {
83
+ rules: {
84
+ type: Object,
85
+ default: function () {
86
+ return null;
87
+ },
83
88
  },
84
- props: {
85
- rules: {
86
- type: Object,
87
- default: function() {
88
- return null
89
- }
89
+ value: {
90
+ type: String,
91
+ default: function () {
92
+ return "";
90
93
  },
91
- value: {
92
- type: String,
93
- default: function() {
94
- return ''
95
- }
94
+ },
95
+ pastDate: {
96
+ type: Boolean,
97
+ default: function () {
98
+ return false;
96
99
  },
97
- pastDate: {
98
- type: Boolean,
99
- default: function() {
100
- return false
101
- }
100
+ },
101
+ labelWidth: {
102
+ type: Number,
103
+ default: function () {
104
+ return 0;
102
105
  },
103
- labelWidth: {
104
- type: Number,
105
- default: function() {
106
- return 0
107
- }
106
+ },
107
+ edit: {
108
+ type: Boolean,
109
+ default: function () {
110
+ return false;
108
111
  },
109
- edit: {
110
- type: Boolean,
111
- default: function() {
112
- return false
113
- }
112
+ },
113
+ name: {
114
+ type: String,
115
+ default: function () {
116
+ return "";
114
117
  },
115
- name: {
116
- type: String,
117
- default: function() {
118
- return ''
119
- }
118
+ },
119
+ label: {
120
+ type: String,
121
+ default: function () {
122
+ return "";
120
123
  },
121
- label: {
122
- type: String,
123
- default: function() {
124
- return ''
125
- }
124
+ },
125
+ placeholder: {
126
+ type: String,
127
+ default: function () {
128
+ return "";
126
129
  },
127
- placeholder: {
128
- type: String,
129
- default: function() {
130
- return ''
131
- }
130
+ },
131
+ tooltip: {
132
+ type: String,
133
+ default: function () {
134
+ return "";
132
135
  },
133
- tooltip: {
134
- type: String,
135
- default: function() {
136
- return ''
137
- }
138
- }
139
136
  },
140
- created() {},
141
- methods: {
142
- change() {
143
- this.$emit('change')
137
+ disabledDateValue: {
138
+ type: Number,
139
+ default: function () {
140
+ return 0;
144
141
  },
145
- disabledDate(current) {
146
- if (this.pastDate === true) {
147
- //如果允许过期时间
148
- return false
149
- }
150
- return current && current.diff(moment(), 'days') < 0
142
+ },
143
+ },
144
+ created() {},
145
+ methods: {
146
+ change() {
147
+ this.$emit("change");
148
+ },
149
+ disabledDate(current) {
150
+ if (this.pastDate === true) {
151
+ //如果允许过期时间
152
+ return false;
151
153
  }
152
- }
153
- }
154
- </script>
154
+ return (
155
+ current &&
156
+ current.diff(moment().add(this.disabledDateValue, "day"), "days") < 0
157
+ );
158
+ },
159
+ },
160
+ };
161
+ </script>
155
162
 
156
163
  <style lang="less">
157
- @import '../../styles/default.less';
164
+ @import "../../styles/default.less";
158
165
  </style>
159
166
 
@@ -135,6 +135,12 @@ export default {
135
135
  return "";
136
136
  },
137
137
  },
138
+ disabledDateValue: {
139
+ type: Number,
140
+ default: function () {
141
+ return 0;
142
+ },
143
+ },
138
144
  },
139
145
  created() {},
140
146
  methods: {
@@ -143,8 +149,7 @@ export default {
143
149
  //如果允许过期时间
144
150
  return false;
145
151
  }
146
- return current && current.diff(moment(), "minutes") < 0;
147
- // return current && current.isBefore(moment())
152
+ return current && current.diff(moment().add(this.disabledDateValue, 'day'), "minutes") < 0;
148
153
  },
149
154
  change() {
150
155
  this.$emit("change");
@@ -114,6 +114,7 @@
114
114
  :tooltip="col.tooltip"
115
115
  :pastDate="col.pastDate"
116
116
  :rules="col.rules"
117
+ :disabledDateValue="col.disabledDateValue"
117
118
  @change="
118
119
  () => {
119
120
  inputChange(col);
@@ -132,6 +133,7 @@
132
133
  :tooltip="col.tooltip"
133
134
  :edit="col.edit"
134
135
  :rules="col.rules"
136
+ :disabledDateValue="col.disabledDateValue"
135
137
  @change="
136
138
  () => {
137
139
  inputChange(col);