bri-components 1.4.57 → 1.4.59

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": "bri-components",
3
- "version": "1.4.57",
3
+ "version": "1.4.59",
4
4
  "author": "dengshanghui",
5
5
  "description": "a component lib for vue project",
6
6
  "main": "src/index.js",
@@ -32,7 +32,7 @@
32
32
  "dependencies": {
33
33
  "ali-oss": "^6.13.1",
34
34
  "axios": "^0.23.0",
35
- "bri-datas": "^1.2.31",
35
+ "bri-datas": "^1.2.34",
36
36
  "jshint": "^2.12.0",
37
37
  "jsonlint": "^1.6.3",
38
38
  "minio": "7.1.0",
@@ -9,29 +9,51 @@
9
9
  <template v-if="['time'].includes(subType)">
10
10
  <TimePicker
11
11
  class="DshDate-edit"
12
- v-model="curValDate"
12
+ v-model="curVal"
13
13
  :type="subType"
14
14
  :placeholder="selfPropsObj._placeholder"
15
15
  :disabled="disabled"
16
16
  :clearable="clearable"
17
17
  :transfer="selfPropsObj._transfer"
18
- @on-change="change"
19
18
  ></TimePicker>
20
19
  </template>
21
20
 
22
21
  <!-- 日期、日期时间、年、月 -->
23
22
  <template v-else>
24
- <DatePicker
23
+ <!-- <DatePicker
25
24
  class="DshDate-edit"
26
- v-model="curValDate"
25
+ v-model="curVal"
27
26
  :type="subType"
28
27
  :placeholder="selfPropsObj._placeholder"
29
28
  :disabled="disabled"
30
29
  :clearable="clearable"
31
30
  :options="options"
32
31
  :transfer="selfPropsObj._transfer"
33
- @on-change="change"
34
- ></DatePicker>
32
+ ></DatePicker> -->
33
+ <DatePicker
34
+ class="DshDate-edit"
35
+ :model-value="curVal"
36
+ :type="subType"
37
+ :disabled="disabled"
38
+ :options="options"
39
+ :open="open"
40
+ :transfer="selfPropsObj._transfer"
41
+ :transfer-class-name="selfPropsObj._transferClassName"
42
+ @on-change="changeVal($event, '')"
43
+ @on-open-change="changeOpen($event, '')"
44
+ >
45
+ <dsh-control-input
46
+ :class="{
47
+ ...commonClass,
48
+ 'bri-control-nodata': this.$isEmptyData(this.curVal)
49
+ }"
50
+ :value="showVal"
51
+ :disabled="disabled"
52
+ :propsObj="selfPropsObj"
53
+ @clear="clickClear('', '')"
54
+ @click.native="changeOpen(true, '')"
55
+ ></dsh-control-input>
56
+ </DatePicker>
35
57
  </template>
36
58
  </template>
37
59
  </div>
@@ -89,71 +111,82 @@
89
111
  </template>
90
112
 
91
113
  <script>
92
- import controlMixin from "../../mixins/controlMixin.js";
114
+ import dateMixin from "../../mixins/dateMixin.js";
93
115
  import DshDaterange from "./DshDaterange.vue";
94
116
 
95
117
  export default {
96
118
  name: "DshDate",
97
119
  mixins: [
98
- controlMixin
120
+ dateMixin
99
121
  ],
100
122
  components: {
101
123
  DshDaterange
102
124
  },
103
125
  props: {},
104
126
  data () {
105
- return {};
127
+ return {
128
+ open: false
129
+ };
106
130
  },
107
131
  computed: {
108
132
  selfPropsObj () {
109
133
  return {
110
134
  _writeSort: undefined, // 表格里字段的 该列上下行汇总限制顺序 "downToUp", "upToDown"
111
135
  _compareOperator: "gt", // 表格里字段的 该列上下行的对比条件 "gt", "lt", "et", "gtAet", "ltAet",
112
- _transfer: true,
136
+ _transferClassName: undefined,
113
137
 
114
- ...this.propsObj,
115
- ...this.commonDealPropsObj
138
+ ...this.basePropsObj
116
139
  };
117
140
  },
118
- subType () {
119
- return this.selfPropsObj._dateType; // 5种,"date", "datetime", "year", "month", "time"
120
- },
141
+
121
142
  options () {
143
+ const index = this.dynDateType === "start"
144
+ ? 0
145
+ : this.dynDateType === "end"
146
+ ? 1
147
+ : undefined;
148
+
122
149
  return {
123
- shortcuts: [],
150
+ shortcuts: this.getShortCuts(index),
124
151
  disabledDate: (date) => {
152
+ const curDateStr = this.$transformDate(date, "/", this.subType);
153
+ const rangeBool = this.getRangeCompareBool(curDateStr);
154
+
125
155
  const selfValue = {
126
156
  ...this.value,
127
- [this.controlKey]: this.$transformDate(date, "/", this.subType)
157
+ [this.controlKey]: curDateStr
128
158
  };
129
-
130
159
  // 日期字段的平级对比
131
160
  const compareBool = this.$normalComparedFunc(this.selfPropsObj, selfValue, this.allFormList, this.parentObj, this.parentFormList, this.inTableType);
132
161
  // 层级表格里-日期字段的上下级对比
133
162
  const caluBool = this.$levelComparedFunc(this.selfPropsObj, selfValue, this.allListRows, this.inTableType, undefined, true);
134
163
 
135
- return !compareBool || !caluBool;
164
+ return !(rangeBool && compareBool && caluBool);
136
165
  }
137
166
  };
138
167
  },
139
168
 
140
- curValDate: {
169
+ curVal: {
141
170
  get () {
142
- const val = this.value[this.controlKey];
143
- return this.$transformDateCompatible(val, this.subType);
171
+ return this.getVal(this.value[this.controlKey]);
144
172
  },
145
173
  set (val) {
146
- this.$set(this.value, this.controlKey, this.$transformDate(val, "-", this.subType));
174
+ this.$set(this.value, this.controlKey, this.transformVal(val));
175
+ this.change();
147
176
  }
148
177
  },
149
178
  showVal () {
150
- return this.$isEmptyData(this.curVal)
151
- ? this.emptyShowVal
152
- : this.$transformDate(this.curVal, "-", this.subType);
179
+ return this.getShowVal(this.curVal);
153
180
  }
154
181
  },
155
182
  created () {},
156
- methods: {}
183
+ methods: {
184
+ // 点击快捷日期
185
+ clickDynDate (val) {
186
+ this.curVal = val;
187
+ this.open = false;
188
+ }
189
+ }
157
190
  };
158
191
  </script>
159
192
 
@@ -8,7 +8,7 @@
8
8
  :placeholder="selfPropsObj._placeholder"
9
9
  type="timerange"
10
10
  :disabled="disabled"
11
- :transfer="true"
11
+ :transfer="selfPropsObj._transfer"
12
12
  :transfer-class-name="selfPropsObj._transferClassName"
13
13
  @on-change="change"
14
14
  ></TimePicker>
@@ -18,13 +18,12 @@
18
18
  <template v-else-if="['date', 'datetime', 'year', 'month'].includes(subType)">
19
19
  <DatePicker
20
20
  class="DshDaterange-left"
21
- :model-value="val0"
22
- :placeholder="selfPropsObj._placeholder"
21
+ :model-value="curVal0"
23
22
  :type="subType"
24
23
  :disabled="disabled"
25
24
  :options="options0"
26
25
  :open="open0"
27
- :transfer="true"
26
+ :transfer="selfPropsObj._transfer"
28
27
  :transfer-class-name="selfPropsObj._transferClassName"
29
28
  @on-change="changeVal($event, 0)"
30
29
  @on-open-change="changeOpen($event, 0)"
@@ -32,7 +31,7 @@
32
31
  <dsh-control-input
33
32
  :class="{
34
33
  ...commonClass,
35
- 'bri-control-nodata': this.$isEmptyData(this.showVal0)
34
+ 'bri-control-nodata': this.$isEmptyData(this.curVal0)
36
35
  }"
37
36
  :value="showVal0"
38
37
  :disabled="disabled"
@@ -46,13 +45,12 @@
46
45
 
47
46
  <DatePicker
48
47
  class="DshDaterange-right"
49
- :model-value="val1"
50
- :placeholder="selfPropsObj._placeholder"
48
+ :model-value="curVal1"
51
49
  :type="subType"
52
50
  :disabled="disabled"
53
51
  :options="options1"
54
52
  :open="open1"
55
- :transfer="true"
53
+ :transfer="selfPropsObj._transfer"
56
54
  :transfer-class-name="selfPropsObj._transferClassName"
57
55
  @on-change="changeVal($event, 1)"
58
56
  @on-open-change="changeOpen($event, 1)"
@@ -60,7 +58,7 @@
60
58
  <dsh-control-input
61
59
  :class="{
62
60
  ...commonClass,
63
- 'bri-control-nodata': this.$isEmptyData(this.showVal1)
61
+ 'bri-control-nodata': this.$isEmptyData(this.curVal1)
64
62
  }"
65
63
  :value="showVal1"
66
64
  :disabled="disabled"
@@ -74,14 +72,14 @@
74
72
  </template>
75
73
 
76
74
  <script>
77
- import controlMixin from "../../mixins/controlMixin.js";
78
- import { dateDynSearchs } from "../../../../data/index.js";
75
+ import dateMixin from "../../mixins/dateMixin.js";
79
76
 
80
77
  export default {
81
78
  name: "DshDaterange",
82
79
  mixins: [
83
- controlMixin
80
+ dateMixin
84
81
  ],
82
+ components: {},
85
83
  props: {},
86
84
  data () {
87
85
  return {
@@ -92,31 +90,13 @@
92
90
  computed: {
93
91
  selfPropsObj () {
94
92
  return {
95
- _icon: "ios-calendar-outline",
96
- _useShortcuts: true, // 是否使用动态筛选
97
- _dynSearchKeys: [], // 动态筛选条件列表
93
+ // _icon: "ios-calendar-outline",
98
94
  _transferClassName: "DshDaterange-dropdown",
99
95
 
100
- ...this.propsObj,
101
- ...this.commonDealPropsObj
96
+ ...this.basePropsObj
102
97
  };
103
98
  },
104
- subType () {
105
- return this.selfPropsObj._dateType; // 5种,"date", "datetime", "year", "month", "time"
106
- },
107
- useShortcuts () {
108
- return this.selfPropsObj._useShortcuts;
109
- },
110
- dynSearchKeys () {
111
- return this.selfPropsObj._dynSearchKeys;
112
- },
113
- dynSearchList () {
114
- return this.dynSearchKeys.length
115
- ? this.dynSearchKeys.map(dynSearchKey =>
116
- dateDynSearchs.find(dynSearchItem => dynSearchItem._key === dynSearchKey) || { _key: dynSearchKey }
117
- )
118
- : dateDynSearchs;
119
- },
99
+
120
100
  options0 () {
121
101
  return this.getOptions(0);
122
102
  },
@@ -124,97 +104,44 @@
124
104
  return this.getOptions(1);
125
105
  },
126
106
 
127
- val0: {
107
+ curVal0: {
128
108
  get () {
129
- return this.getVal(0);
109
+ return this.getVal(this.value[this.controlKey][0]);
130
110
  },
131
111
  set (val) {
132
- this.setVal(val, 0);
112
+ this.$set(this.value, this.controlKey, [this.transformVal(val), this.value[this.controlKey][1] || ""]);
113
+ this.change();
133
114
  }
134
115
  },
135
- val1: {
116
+ curVal1: {
136
117
  get () {
137
- return this.getVal(1);
118
+ return this.getVal(this.value[this.controlKey][1]);
138
119
  },
139
120
  set (val) {
140
- this.setVal(val, 1);
121
+ this.$set(this.value, this.controlKey, [this.value[this.controlKey][0] || "", this.transformVal(val)]);
122
+ this.change();
141
123
  }
142
124
  },
143
125
  showVal0 () {
144
- return this.getShowVal(this.val0);
126
+ return this.getShowVal(this.curVal0);
145
127
  },
146
128
  showVal1 () {
147
- return this.getShowVal(this.val1);
129
+ return this.getShowVal(this.curVal1);
148
130
  }
149
131
  },
150
132
  created () {},
151
133
  methods: {
152
- // 点击快捷日期
153
- clickDynDate (val, index) {
154
- this[`val${index}`] = val;
155
- this.changeOpen(false, index);
156
- },
157
- // 点击清空
158
- clickClear (val, index) {
159
- this[`val${index}`] = val;
160
- this.changeOpen(false, index);
161
- },
162
- // 日期值变化回调
163
- changeVal (val, index) {
164
- this[`val${index}`] = val;
165
- this.subType !== "datetime" && this.changeOpen(false, index);
166
- },
167
- changeOpen (bool, index) {
168
- this[`open${index}`] = bool;
169
- },
170
-
171
134
  /* -------- 方法 ------- */
172
- getVal (index) {
173
- const val = this.value[this.controlKey][index];
174
-
175
- return this.isDynSearch(val)
176
- ? val
177
- : this.$transformDateCompatible(val, this.subType);
178
- },
179
- setVal (val, index) {
180
- const newVal = this.isDynSearch(val) ? val : this.$transformDate(val, "-", this.subType);
181
- this.value[this.controlKey] = index === 0
182
- ? [newVal, this.value[this.controlKey][1] || ""]
183
- : [this.value[this.controlKey][0] || "", newVal];
184
-
185
- this.change();
186
- },
187
135
  getOptions (index) {
188
- const compareDateStr = this[`val${index === 0 ? 1 : 0}`];
189
- const compareOperator = index === 0 ? "ltAet" : "gtAet";
190
-
191
136
  return {
192
- shortcuts: this.useShortcuts
193
- ? this.dynSearchList
194
- .filter(dynItem => dynItem.numbers.includes(index) && dynItem.dateTypes.includes(this.subType))
195
- .map(dynItem => ({
196
- text: dynItem.name,
197
- onClick: () => this.clickDynDate(dynItem._key, index)
198
- }))
199
- : [],
137
+ shortcuts: this.getShortCuts(index),
200
138
  disabledDate: (date) => {
201
139
  const curDateStr = this.$transformDate(date, "/", this.subType);
140
+ const rangeBool = this.getRangeCompareBool(curDateStr);
202
141
 
203
- return compareDateStr
204
- ? this.isDynSearch(compareDateStr)
205
- ? true
206
- : !this.$isComparedAccord(curDateStr, compareDateStr, compareOperator, "date", this.subType, this.subType)
207
- : false;
142
+ return !rangeBool;
208
143
  }
209
144
  };
210
- },
211
- getShowVal (val) {
212
- return this.isDynSearch(val)
213
- ? (this.dynSearchList.find(dynItem => dynItem._key === val) || { name: `"${val}"动态条件不存在` }).name
214
- : this.$transformDate(val, "-", this.subType);
215
- },
216
- isDynSearch (dynKey) {
217
- return this.dynSearchList.some(dynItem => dynItem._key === dynKey);
218
145
  }
219
146
  }
220
147
  };
@@ -0,0 +1,142 @@
1
+ import controlMixin from "./controlMixin.js";
2
+ import { dynDateData } from "../../../data/index.js";
3
+
4
+ export default {
5
+ mixins: [
6
+ controlMixin
7
+ ],
8
+ components: {},
9
+ props: {},
10
+ data () {
11
+ return {};
12
+ },
13
+ computed: {
14
+ basePropsObj () {
15
+ return {
16
+ _dateType: "date", // 子类型5种,"date", "datetime", "year", "month", "time"
17
+
18
+ _useDynDate: false, // 使用动态时间
19
+ _dynDateType: undefined, // 使用什么类型的动态时间,"start","end"
20
+ _dynDateKeys: [], // 仅使用一些指定的动态时间
21
+ _dynSearchKeys: [], // 筛选时-仅使用一些指定的动态时间
22
+
23
+ _minDate: undefined, // 最小日期
24
+ _maxDate: undefined, // 最大日期
25
+ _transfer: true,
26
+
27
+ ...this.propsObj,
28
+ ...this.commonDealPropsObj
29
+ };
30
+ },
31
+
32
+ subType () {
33
+ return this.selfPropsObj._dateType;
34
+ },
35
+ useDynDate () {
36
+ return this.isInSearch
37
+ ? true
38
+ : this.selfPropsObj._useDynDate;
39
+ },
40
+ dynDateType () {
41
+ return this.selfPropsObj._dynDateType;
42
+ },
43
+ dynDateKeys () {
44
+ return this.isInSearch
45
+ ? this.selfPropsObj._dynSearchKeys
46
+ : this.selfPropsObj._dynDateKeys;
47
+ },
48
+ dynDateList () {
49
+ return (
50
+ this.dynDateKeys.length
51
+ ? this.dynDateKeys
52
+ .map(dynDateKey =>
53
+ dynDateData.find(dynDateItem => dynDateItem._key === dynDateKey)
54
+ )
55
+ .filter(dynDateItem => !!dynDateItem)
56
+ : dynDateData
57
+ ).filter(dynDateItem => dynDateItem.dateTypes.includes(this.subType));
58
+ },
59
+
60
+ minDate () {
61
+ const date = this.selfPropsObj._minDate;
62
+ return this.isDynDate(date)
63
+ ? this.$transformDynToNormalDate(date, "-", this.subType)
64
+ : date;
65
+ },
66
+ maxDate () {
67
+ const date = this.selfPropsObj._maxDate;
68
+ return this.isDynDate(date)
69
+ ? this.$transformDynToNormalDate(date, "-", this.subType)
70
+ : date;
71
+ }
72
+ },
73
+ created () { },
74
+ methods: {
75
+ // 点击快捷日期
76
+ clickDynDate (val, index) {
77
+ this[`curVal${index}`] = val;
78
+ this.changeOpen(false, index);
79
+ },
80
+ // 点击清空
81
+ clickClear (val, index) {
82
+ this[`curVal${index}`] = val;
83
+ // this.changeOpen(false, index);
84
+ },
85
+ // 日期值变化回调
86
+ changeVal (val, index) {
87
+ this[`curVal${index}`] = val;
88
+ this.subType !== "datetime" && this.changeOpen(false, index);
89
+ },
90
+ changeOpen (bool, index) {
91
+ this[`open${index}`] = bool;
92
+ },
93
+
94
+ /* -------- 方法 ------- */
95
+ getVal (val) {
96
+ return this.isDynDate(val)
97
+ ? val
98
+ : this.$transformDateCompatible(val, this.subType);
99
+ },
100
+ transformVal (val) {
101
+ return this.isDynDate(val)
102
+ ? val
103
+ : this.$transformDate(val, "-", this.subType);
104
+ },
105
+ getShowVal (val) {
106
+ return this.isDynDate(val)
107
+ ? (this.dynDateList.find(dynDateItem => dynDateItem._key === val) || { name: `"${val}"动态时间不存在` }).name
108
+ : this.$transformDate(val, "-", this.subType);
109
+ },
110
+ isDynDate (val) {
111
+ return val && typeof val === "string" && (
112
+ this.dynDateList.some(dynDateItem => dynDateItem._key === val) ||
113
+ ["dyn", "year", "month", "days", "start", "end"].some(str => val.includes(str))
114
+ );
115
+ },
116
+
117
+ getShortCuts (index) {
118
+ return this.useDynDate
119
+ ? this.dynDateList
120
+ .filter(dynDateItem =>
121
+ index || index === 0 ? dynDateItem.numbers.includes(index) : true
122
+ )
123
+ .map(dynDateItem => ({
124
+ text: dynDateItem.name,
125
+ onClick: () => {
126
+ this.clickDynDate(dynDateItem._key, index);
127
+ }
128
+ }))
129
+ : [];
130
+ },
131
+ getRangeCompareBool (curDateStr) {
132
+ const compareFunc = (curDateStr, compareDateStr, compareOperator) => {
133
+ return curDateStr && compareDateStr
134
+ ? this.$isComparedAccord(curDateStr, compareDateStr, compareOperator, "date", this.subType, this.subType)
135
+ : true;
136
+ };
137
+
138
+ return compareFunc(curDateStr, this.minDate, "gtAet") &&
139
+ compareFunc(curDateStr, this.maxDate, ["last_month_end", "dyn_month_end", "dyn_nextmonth_end", "dyn_quarter_end", "dyn_year_end", "dyn_nextyear_end"].includes(this.selfPropsObj._maxDate) ? "lt" : "ltAet");
140
+ }
141
+ }
142
+ };
@@ -24,8 +24,8 @@ export default {
24
24
 
25
25
  _round: "decimal", // 取值方式 "decimal", "round", "normal"
26
26
  _digit: "2", // 保留小数位数 "1", "2", "3", "4"
27
- _max: null, // 最大值
28
27
  _min: null, // 最小值
28
+ _max: null, // 最大值
29
29
 
30
30
  ...this.propsObj,
31
31
  ...this.commonDealPropsObj
@@ -32,10 +32,10 @@ export default {
32
32
  ...this.commonDealPropsObj
33
33
  };
34
34
  },
35
+
35
36
  showMode () {
36
37
  return this.selfPropsObj._optionKind;
37
38
  },
38
-
39
39
  saveKey () {
40
40
  return this.selfPropsObj._saveKey;
41
41
  },
package/src/data/index.js CHANGED
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  resourceData, regionData, benjiRegionData, userIndustryData,
3
- dateDynSearchs
3
+ dynDateData
4
4
  } from "bri-datas";
5
5
 
6
6
  export {
7
7
  resourceData, regionData, benjiRegionData, userIndustryData,
8
- dateDynSearchs
8
+ dynDateData
9
9
  };