xs-common-plugins 1.3.1 → 1.3.3

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": "xs-common-plugins",
3
- "version": "1.3.1",
3
+ "version": "1.3.3",
4
4
  "private": false,
5
5
  "description": "向上公共代码部分",
6
6
  "author": "祝玲云 <1902733517@qq.com>",
@@ -44,367 +44,338 @@
44
44
  defaultTime: true
45
45
  }-->
46
46
  <template>
47
- <div class="search-wrapper formClass" ref="formClass">
48
- <el-form :model="inputValue" :inline="true" fit size="small" ref="formContent" label-position="left" class="form" @submit.native.prevent>
49
- <div class="contentBox" ref="contentBox">
50
- <div class="searchBox">
51
- <div v-for="(optionItem, indexs) in formContent" :key="indexs">
52
- <el-form-item :label="optionItem.displayName" v-if="optionItem.conditionType == $enum.conditionType.input"
53
- :style="{ width: optionItem.itemWidth }">
54
- <el-input v-model="inputValue[optionItem.fieldName]" :placeholder="optionItem.defaultValue" @change="(value)=>{
47
+ <div class="search-wrapper formClass" ref="formClass">
48
+ <el-form :model="inputValue" :inline="true" fit size="small" ref="formContent" label-position="left" class="form" @submit.native.prevent>
49
+ <div class="contentBox" ref="contentBox">
50
+ <div class="searchBox">
51
+ <div v-for="(optionItem, indexs) in formContent" :key="indexs">
52
+ <el-form-item :label="optionItem.displayName" v-if="optionItem.conditionType == $enum.conditionType.input" :style="{ width: optionItem.itemWidth }">
53
+ <el-input v-model="inputValue[optionItem.fieldName]" :placeholder="optionItem.defaultValue" @change="(value)=>{
55
54
  optionItem.change&&optionItem.change(value)
56
- }" @keydown.enter.native="toSearch"></el-input>
57
- </el-form-item>
58
- <!--下拉单选通过接口-->
59
- <el-form-item :label="optionItem.displayName"
60
- v-else-if="optionItem.conditionType == $enum.conditionType.select"
61
- :style="{ width: optionItem.itemWidth }">
62
- <search-select-cmp :option="optionItem" v-model="inputValue[optionItem.fieldName]">
63
- </search-select-cmp>
64
- </el-form-item>
65
- <el-form-item :label="optionItem.displayName" v-else-if="optionItem.conditionType == 9"
66
- :style="{ width: optionItem.itemWidth }">
67
- <search-cascader-cmp :option="optionItem" v-model="inputValue[optionItem.fieldName]">
68
- </search-cascader-cmp>
69
- </el-form-item>
55
+ }" @keydown.enter.native="toSearch"></el-input>
56
+ </el-form-item>
57
+ <!--下拉单选通过接口-->
58
+ <el-form-item :label="optionItem.displayName" v-else-if="optionItem.conditionType == $enum.conditionType.select" :style="{ width: optionItem.itemWidth }">
59
+ <search-select-cmp :option="optionItem" v-model="inputValue[optionItem.fieldName]"></search-select-cmp>
60
+ </el-form-item>
61
+ <el-form-item :label="optionItem.displayName" v-else-if="optionItem.conditionType == 9" :style="{ width: optionItem.itemWidth }">
62
+ <search-cascader-cmp :option="optionItem" v-model="inputValue[optionItem.fieldName]"></search-cascader-cmp>
63
+ </el-form-item>
70
64
 
71
- <el-form-item :label="optionItem.displayName"
72
- v-if="optionItem.conditionType == $enum.conditionType.mixedSelect"
73
- :style="{ width: optionItem.itemWidth }">
74
- <!-- <select-cmp :selectType="optionItem.selectType" v-model="inputValue[optionItem.fieldName]" ></select-cmp> -->
75
- <el-select :multiple="optionItem.dataSourceType == 4" clearable collapse-tags popper-class="select-popper"
76
- class="select-style" v-model="inputValue[optionItem.fieldName]" :placeholder="optionItem.defaultValue">
77
- <div class="shortcut" v-for="(item, index) in $orgEnum[optionItem.url].slice(-1)" :key="index">
78
- <div class="tabs" v-for="(items, indexs) in item" :key="items.id">
79
- <el-button @click="toSelect(items, optionItem.fieldName)">{{
80
- indexs
81
- }}</el-button>
82
- </div>
83
- </div>
84
- <div class="option">
85
- <el-option v-for="item in $orgEnum[optionItem.url].slice(0, -1)" :key="item.Id" :label="item.Text"
86
- :value="item.Id">
87
- <div class="item">{{ item.Text }}</div>
88
- </el-option>
89
- </div>
90
- </el-select>
91
- </el-form-item>
65
+ <el-form-item :label="optionItem.displayName" v-if="optionItem.conditionType == $enum.conditionType.mixedSelect" :style="{ width: optionItem.itemWidth }">
66
+ <!-- <select-cmp :selectType="optionItem.selectType" v-model="inputValue[optionItem.fieldName]" ></select-cmp> -->
67
+ <el-select :multiple="optionItem.dataSourceType == 4" clearable collapse-tags popper-class="select-popper" class="select-style" v-model="inputValue[optionItem.fieldName]" :placeholder="optionItem.defaultValue">
68
+ <div class="shortcut" v-for="(item, index) in $orgEnum[optionItem.url].slice(-1)" :key="index">
69
+ <div class="tabs" v-for="(items, indexs) in item" :key="items.id">
70
+ <el-button @click="toSelect(items, optionItem.fieldName)">{{
71
+ indexs
72
+ }}
73
+ </el-button>
74
+ </div>
75
+ </div>
76
+ <div class="option">
77
+ <el-option v-for="item in $orgEnum[optionItem.url].slice(0, -1)" :key="item.Id" :label="item.Text" :value="item.Id">
78
+ <div class="item">{{ item.Text }}</div>
79
+ </el-option>
80
+ </div>
81
+ </el-select>
82
+ </el-form-item>
92
83
 
93
- <el-form-item :label="optionItem.displayName"
94
- v-if="optionItem.conditionType == $enum.conditionType.cascader" :style="{ width: optionItem.itemWidth }">
95
- <product-option-cmp v-model="inputValue[optionItem.fieldName]" :optionItem="optionItem">
96
- </product-option-cmp>
97
- </el-form-item>
98
- <!--单选联级选择-->
99
- <el-form-item :label="optionItem.displayName" v-if="
84
+ <el-form-item :label="optionItem.displayName" v-if="optionItem.conditionType == $enum.conditionType.cascader" :style="{ width: optionItem.itemWidth }">
85
+ <product-option-cmp v-model="inputValue[optionItem.fieldName]" :optionItem="optionItem"></product-option-cmp>
86
+ </el-form-item>
87
+ <!--单选联级选择-->
88
+ <el-form-item :label="optionItem.displayName" v-if="
100
89
  optionItem.conditionType == $enum.conditionType.radioCascader
101
90
  ">
102
- <el-cascader ref="radiocascader" class="radiocascader" v-model="inputValue[optionItem.fieldName]"
103
- :props="{ checkStrictly: true }" clearable :options="brandModelList"
104
- @visible-change="cascaderData($event, optionItem.url)"></el-cascader>
105
- </el-form-item>
106
- <!--单选联级选择-->
107
- <el-form-item :label="optionItem.displayName"
108
- v-if="optionItem.conditionType === $enum.conditionType.datePicker"
109
- :style="{ width: optionItem.itemWidth }" class="dateRange">
110
- <el-date-picker clearable v-model="inputValue[optionItem.fieldName]" v-if="optionItem.dataSourceType == 0"
111
- type="date" align="right" unlink-panels :placeholder="optionItem.defaultValue"
112
- value-format="yyyy-MM-dd">
113
- </el-date-picker>
114
- <!-- 时间选择器-->
115
- <el-date-picker v-else clearable v-model="inputValue[optionItem.fieldName]" type="daterange" align="right"
116
- unlink-panels range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期"
117
- :picker-options="pickerOptions" value-format="yyyy-MM-dd" style="position:relative;top:-1px">
118
- </el-date-picker>
119
- <!-- :value-format="optionItem.config?optionItem.config.timeFrom:'yyyy-MM-DD'" -->
120
- </el-form-item>
91
+ <el-cascader ref="radiocascader" class="radiocascader" v-model="inputValue[optionItem.fieldName]" :props="{ checkStrictly: true }" clearable :options="brandModelList" @visible-change="cascaderData($event, optionItem.url)"></el-cascader>
92
+ </el-form-item>
93
+ <!--单选联级选择-->
94
+ <el-form-item :label="optionItem.displayName" v-if="optionItem.conditionType === $enum.conditionType.datePicker" :style="{ width: optionItem.itemWidth }" class="dateRange">
95
+ <el-date-picker clearable v-model="inputValue[optionItem.fieldName]" v-if="optionItem.dataSourceType == 0" type="date" align="right" unlink-panels :placeholder="optionItem.defaultValue" value-format="yyyy-MM-dd"></el-date-picker>
96
+ <el-date-picker clearable v-model="inputValue[optionItem.fieldName]" v-else-if="optionItem.dataSourceType == 'month'" type="month" align="right" unlink-panels :placeholder="optionItem.defaultValue" value-format="yyyy-MM-dd"></el-date-picker>
97
+ <!-- 时间选择器-->
98
+ <el-date-picker v-else clearable v-model="inputValue[optionItem.fieldName]" type="daterange" align="right" unlink-panels range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" :picker-options="pickerOptions" value-format="yyyy-MM-dd" style="position:relative;top:-1px"></el-date-picker>
99
+ <!-- :value-format="optionItem.config?optionItem.config.timeFrom:'yyyy-MM-DD'" -->
100
+ </el-form-item>
121
101
 
122
- <!-- -->
123
- <el-form-item :label="optionItem.displayName"
124
- v-if="optionItem.conditionType == $enum.conditionType.reportSet" :style="{ width: optionItem.itemWidth }"
125
- class="report-class">
126
- <!-- v-model="inputValue[optionItem.fieldName]" -->
127
- <el-dropdown @command="handlerSelReport" @click="clickReportBtn(optionItem.url, optionItem.params)">
128
- <el-button type="primary">{{ selReportName }}</el-button>
129
- <el-dropdown-menu slot="dropdown" v-if="reportList.length > 0">
130
- <el-dropdown-item v-for="report in reportList" :key="report.id" :command="report">
131
- {{ report.title }}
132
- </el-dropdown-item>
133
- </el-dropdown-menu>
134
- </el-dropdown>
135
- <el-popover placement="bottom" width="560" trigger="click" v-if="selReportName !== '选择报表'">
136
- <report-set v-if="reloadReportForm" v-model="inputValue[optionItem.fieldName]" model-type="Object"
137
- :jsonCfg="reportDefs"></report-set>
138
- <el-button slot="reference" type="primary" class="set-class" icon="el-icon-s-tools">
139
- </el-button>
140
- </el-popover>
141
- </el-form-item>
142
- <!--多选联级选择可动态查询-->
143
- <el-form-item :label="optionItem.displayName" v-if="optionItem.conditionType == $enum.conditionType.hkqudao"
144
- :style="{ width: optionItem.itemWidth }" class="dateRange">
145
- <HKQudao v-model="inputValue[optionItem.fieldName]" :placeholder="optionItem.defaultValue"
146
- :style="{ width: optionItem.itemWidth }" :optionItem="optionItem"></HKQudao>
147
- </el-form-item>
148
- <el-form-item :label="optionItem.displayName" v-if="optionItem.conditionType == $enum.conditionType.hkarea"
149
- :style="{ width: optionItem.itemWidth }" class="dateRange">
150
- <HKCascader v-model="inputValue[optionItem.fieldName]" :placeholder="optionItem.defaultValue"
151
- :style="{ width: optionItem.itemWidth }" :optionItem="optionItem"></HKCascader>
152
- </el-form-item>
153
- <el-form-item :label="optionItem.displayName" v-if="optionItem.component "
154
- :style="{ width: optionItem.itemWidth }" class="dateRange">
155
- <component :is="optionItem.component" v-model="inputValue[optionItem.fieldName]" :placeholder="optionItem.defaultValue" v-bind="optionItem" />
156
- </el-form-item>
157
- </div>
102
+ <!-- -->
103
+ <el-form-item :label="optionItem.displayName" v-if="optionItem.conditionType == $enum.conditionType.reportSet" :style="{ width: optionItem.itemWidth }" class="report-class">
104
+ <!-- v-model="inputValue[optionItem.fieldName]" -->
105
+ <el-dropdown @command="handlerSelReport" @click="clickReportBtn(optionItem.url, optionItem.params)">
106
+ <el-button type="primary">{{ selReportName }}</el-button>
107
+ <el-dropdown-menu slot="dropdown" v-if="reportList.length > 0">
108
+ <el-dropdown-item v-for="report in reportList" :key="report.id" :command="report">
109
+ {{ report.title }}
110
+ </el-dropdown-item>
111
+ </el-dropdown-menu>
112
+ </el-dropdown>
113
+ <el-popover placement="bottom" width="560" trigger="click" v-if="selReportName !== '选择报表'">
114
+ <report-set v-if="reloadReportForm" v-model="inputValue[optionItem.fieldName]" model-type="Object" :jsonCfg="reportDefs"></report-set>
115
+ <el-button slot="reference" type="primary" class="set-class" icon="el-icon-s-tools"></el-button>
116
+ </el-popover>
117
+ </el-form-item>
118
+ <!--多选联级选择可动态查询-->
119
+ <el-form-item :label="optionItem.displayName" v-if="optionItem.conditionType == $enum.conditionType.hkqudao" :style="{ width: optionItem.itemWidth }" class="dateRange">
120
+ <HKQudao v-model="inputValue[optionItem.fieldName]" :placeholder="optionItem.defaultValue" :style="{ width: optionItem.itemWidth }" :optionItem="optionItem"></HKQudao>
121
+ </el-form-item>
122
+ <el-form-item :label="optionItem.displayName" v-if="optionItem.conditionType == $enum.conditionType.hkarea" :style="{ width: optionItem.itemWidth }" class="dateRange">
123
+ <HKCascader v-model="inputValue[optionItem.fieldName]" :placeholder="optionItem.defaultValue" :style="{ width: optionItem.itemWidth }" :optionItem="optionItem"></HKCascader>
124
+ </el-form-item>
125
+ <el-form-item :label="optionItem.displayName" v-if="optionItem.component " :style="{ width: optionItem.itemWidth }" class="dateRange">
126
+ <component :is="optionItem.component" v-model="inputValue[optionItem.fieldName]" :placeholder="optionItem.defaultValue" v-bind="optionItem"/>
127
+ </el-form-item>
128
+ </div>
158
129
 
159
- <el-form-item v-if="!!getBtnContentIsOut().length">
160
- <el-dropdown trigger="click" @command="handleCommand" split-button type="primary" @click="toSearch()">
161
- 查询
162
- <el-dropdown-menu slot="dropdown">
163
- <el-dropdown-item v-for="item in getBtnContentIsOut()" :key="item.id" :command="item">
164
- {{ item.actionText }}
165
- </el-dropdown-item>
166
- </el-dropdown-menu>
167
- </el-dropdown>
168
- </el-form-item>
169
- <el-form-item v-else>
170
- <el-button @command="handleCommand" split-button type="primary" @click="toSearch()">查询</el-button>
171
- </el-form-item>
172
- <div class="isOut-btn">
173
- <el-button v-for="(item, i) in getBtnContentIsOut('isOut')" :key="i" size="small"
174
- @click="handleCommand(item)" type="primary">{{ item.actionText }}
175
- </el-button>
176
- </div>
177
- </div>
178
- <slot name="search_custemBtn" />
179
- <!-- <div class="buttonBox">
130
+ <el-form-item v-if="!!getBtnContentIsOut().length">
131
+ <el-dropdown trigger="click" @command="handleCommand" split-button type="primary" @click="toSearch()">
132
+ 查询
133
+ <el-dropdown-menu slot="dropdown">
134
+ <el-dropdown-item v-for="item in getBtnContentIsOut()" :key="item.id" :command="item">
135
+ {{ item.actionText }}
136
+ </el-dropdown-item>
137
+ </el-dropdown-menu>
138
+ </el-dropdown>
139
+ </el-form-item>
140
+ <el-form-item v-else>
141
+ <el-button @command="handleCommand" split-button type="primary" @click="toSearch()">查询</el-button>
142
+ </el-form-item>
143
+ <div class="isOut-btn">
144
+ <el-button v-for="(item, i) in getBtnContentIsOut('isOut')" :key="i" size="small" @click="handleCommand(item)" type="primary">{{ item.actionText }}
145
+ </el-button>
146
+ </div>
147
+ </div>
148
+ <slot name="search_custemBtn"/>
149
+ <!-- <div class="buttonBox">
180
150
 
181
- <el-form-item v-if="!!getBtnContentIsOut().length">
182
- <el-dropdown
183
- trigger="click"
184
- @command="handleCommand"
185
- split-button
186
- type="primary"
187
- @click="toSearch()"
188
- >
189
- 查询
190
- <el-dropdown-menu slot="dropdown">
191
- <el-dropdown-item
192
- v-for="item in getBtnContentIsOut()"
193
- :key="item.id"
194
- :command="item"
195
- >
196
- {{ item.actionText }}
197
- </el-dropdown-item>
198
- </el-dropdown-menu>
199
- </el-dropdown>
200
- </el-form-item>
201
- <el-form-item v-else>
202
- <el-button
203
- @command="handleCommand"
204
- split-button
205
- type="primary"
206
- @click="toSearch()"
207
- >查询</el-button
208
- >
209
- </el-form-item>
210
- <el-form-item style="margin-left:4px" v-for="(item,i) in getBtnContentIsOut('isOut')" :key="i">
211
- <el-button @command="handleCommand" type="primary">{{item.actionText}} </el-button>
212
- </el-form-item>
213
- </div> -->
214
- </div>
215
- </el-form>
216
- </div>
151
+ <el-form-item v-if="!!getBtnContentIsOut().length">
152
+ <el-dropdown
153
+ trigger="click"
154
+ @command="handleCommand"
155
+ split-button
156
+ type="primary"
157
+ @click="toSearch()"
158
+ >
159
+ 查询
160
+ <el-dropdown-menu slot="dropdown">
161
+ <el-dropdown-item
162
+ v-for="item in getBtnContentIsOut()"
163
+ :key="item.id"
164
+ :command="item"
165
+ >
166
+ {{ item.actionText }}
167
+ </el-dropdown-item>
168
+ </el-dropdown-menu>
169
+ </el-dropdown>
170
+ </el-form-item>
171
+ <el-form-item v-else>
172
+ <el-button
173
+ @command="handleCommand"
174
+ split-button
175
+ type="primary"
176
+ @click="toSearch()"
177
+ >查询</el-button
178
+ >
179
+ </el-form-item>
180
+ <el-form-item style="margin-left:4px" v-for="(item,i) in getBtnContentIsOut('isOut')" :key="i">
181
+ <el-button @command="handleCommand" type="primary">{{item.actionText}} </el-button>
182
+ </el-form-item>
183
+ </div> -->
184
+ </div>
185
+ </el-form>
186
+ </div>
217
187
  </template>
218
188
  <script>
219
- import methods from "./methods";
220
189
  import { isArray } from "@/common/utils";
221
190
 
222
191
  import reportSet from "@/components/report_set";
223
- // 组件分离 2020-10-10 10:00
224
- // 下拉框组件升级
225
- import SearchSelectCmp from "./select";
226
192
  import SearchCascaderCmp from "./cascader";
193
+ import HKCascader from "./hk_cascader";
194
+ import HKQudao from "./hk_cascader_qudao";
195
+ import methods from "./methods";
227
196
 
228
197
  import ProductOptionCmp from "./product_option";
229
- import HKQudao from "./hk_cascader_qudao";
230
- import HKCascader from "./hk_cascader";
198
+ // 组件分离 2020-10-10 10:00
199
+ // 下拉框组件升级
200
+ import SearchSelectCmp from "./select";
231
201
 
232
202
  const EVENT_INPUT = "input";
233
203
  let id = 0;
234
204
 
235
205
  export default {
236
- name: "Search",
206
+ name: "Search",
237
207
 
238
- components: {
239
- reportSet,
240
- SearchSelectCmp,
241
- SearchCascaderCmp,
242
- ProductOptionCmp,
243
- HKQudao,
244
- HKCascader,
245
- },
246
- props: {
247
- //搜索内容集合
248
- formContent: {
249
- type: [Object, Array],
250
- },
251
- btnContent: {
252
- type: [Object, Array],
253
- },
254
- placeholder: {
255
- type: String,
256
- default: "",
257
- },
258
- value: {
259
- type: Object,
260
- default: () => {},
261
- },
262
- },
263
- data() {
264
- return {
265
- brandModelList: [],
266
- keys: [],
267
- inputValue: this.value,
268
- pickerOptions: {
269
- shortcuts: [
270
- {
271
- text: "最近一周",
272
- onClick(picker) {
273
- const end = new Date();
274
- const start = new Date();
275
- start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
276
- picker.$emit("pick", [start, end]);
277
- },
278
- },
279
- {
280
- text: "最近一个月",
281
- onClick(picker) {
282
- const end = new Date();
283
- const start = new Date();
284
- start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
285
- picker.$emit("pick", [start, end]);
286
- },
287
- },
288
- {
289
- text: "最近三个月",
290
- onClick(picker) {
291
- const end = new Date();
292
- const start = new Date();
293
- start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
294
- picker.$emit("pick", [start, end]);
295
- },
296
- },
297
- {
298
- text: "本月",
299
- onClick(picker) {
300
- const end = new Date();
301
- var d = new Date();
302
- d.setDate(1);
303
- const start = d;
304
- picker.$emit("pick", [start, end]);
305
- },
306
- },
307
- {
308
- text: "本周",
309
- onClick(picker) {
310
- const date = new Date();
311
- const weekday = date.getDay() || 7;
312
- const end = new Date();
313
- date.setDate(date.getDate() - weekday + 1);
314
- const start = date;
315
- picker.$emit("pick", [start, end]);
316
- },
317
- },
318
- {
319
- text: "最近半年",
320
- onClick(picker) {
321
- const end = new Date();
322
- const start = new Date();
323
- start.setTime(start.getTime() - 3600 * 1000 * 24 * 180);
324
- picker.$emit("pick", [start, end]);
325
- },
326
- },
327
- {
328
- text: "最近一年",
329
- onClick(picker) {
330
- const end = new Date();
331
- const start = new Date();
332
- start.setTime(start.getTime() - 3600 * 1000 * 24 * 365);
333
- picker.$emit("pick", [start, end]);
334
- },
335
- },
336
- ],
337
- },
338
- // 报表相关属性
339
- reportList: [], // 报表集合
340
- selReportName: "选择报表",
341
- reportDefs: "",
342
- reportParamStr: "",
343
- reloadReportForm: false,
344
- };
345
- },
346
- methods,
347
- mixins: [],
348
- watch: {
349
- value: {
350
- handler(newValue) {
351
- this.inputValue = newValue;
352
- },
353
- deep: true,
354
- },
355
- inputValue: {
356
- handler(newValue) {
357
- this.$emit(EVENT_INPUT, newValue);
358
- },
359
- deep: true,
360
- },
361
- formContent: {
362
- handler(newValue) {
363
- if (isArray(newValue)) {
364
- const reportObj = newValue.find((item) => {
365
- return item.conditionType == this.$enum.conditionType.reportSet;
366
- });
367
- if (reportObj) {
368
- this.clickReportBtn(reportObj.url, reportObj.params);
369
- }
370
- }
371
- },
372
- deep: true,
373
- immediate: true,
374
- },
375
- },
376
- computed: {
377
- getItem() {
378
- return function (val) {
379
- setTimeout(() => {
380
- const result = this.$http.get(val);
381
- }, 1000);
382
- };
383
- },
384
- // getBtnContentIsOut() {
385
- // let arr = Array.isArray(this.btnContent)&&this.btnContent.filter((item) => item.isOut);
386
- // console.log('xxx',arr)
387
- // return arr
388
- // },
389
- },
390
- // ------------------------------------------------------------------
391
- // pragma mark - Life Cycle(生命周期)
392
- // ------------------------------------------------------------------
393
- created() {
394
- this.createdInit();
395
- },
396
- mounted() {
397
- //点击文本自动点击前面的input触发选择
398
- setInterval(function () {
399
- document.querySelectorAll(".el-cascader-node__label").forEach((el) => {
400
- el.onclick = function () {
401
- if (this.previousElementSibling) this.previousElementSibling.click();
402
- };
403
- });
404
- }, 1000);
208
+ components: {
209
+ reportSet,
210
+ SearchSelectCmp,
211
+ SearchCascaderCmp,
212
+ ProductOptionCmp,
213
+ HKQudao,
214
+ HKCascader,
215
+ },
216
+ props: {
217
+ //搜索内容集合
218
+ formContent: {
219
+ type: [Object, Array],
220
+ },
221
+ btnContent: {
222
+ type: [Object, Array],
223
+ },
224
+ placeholder: {
225
+ type: String,
226
+ default: "",
227
+ },
228
+ value: {
229
+ type: Object,
230
+ default: () => {
231
+ },
232
+ },
233
+ },
234
+ data() {
235
+ return {
236
+ brandModelList: [],
237
+ keys: [],
238
+ inputValue: this.value,
239
+ pickerOptions: {
240
+ shortcuts: [
241
+ {
242
+ text: "最近一周",
243
+ onClick(picker) {
244
+ const end = new Date();
245
+ const start = new Date();
246
+ start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
247
+ picker.$emit("pick", [start, end]);
248
+ },
249
+ },
250
+ {
251
+ text: "最近一个月",
252
+ onClick(picker) {
253
+ const end = new Date();
254
+ const start = new Date();
255
+ start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
256
+ picker.$emit("pick", [start, end]);
257
+ },
258
+ },
259
+ {
260
+ text: "最近三个月",
261
+ onClick(picker) {
262
+ const end = new Date();
263
+ const start = new Date();
264
+ start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
265
+ picker.$emit("pick", [start, end]);
266
+ },
267
+ },
268
+ {
269
+ text: "本月",
270
+ onClick(picker) {
271
+ const end = new Date();
272
+ var d = new Date();
273
+ d.setDate(1);
274
+ const start = d;
275
+ picker.$emit("pick", [start, end]);
276
+ },
277
+ },
278
+ {
279
+ text: "本周",
280
+ onClick(picker) {
281
+ const date = new Date();
282
+ const weekday = date.getDay() || 7;
283
+ const end = new Date();
284
+ date.setDate(date.getDate() - weekday + 1);
285
+ const start = date;
286
+ picker.$emit("pick", [start, end]);
287
+ },
288
+ },
289
+ {
290
+ text: "最近半年",
291
+ onClick(picker) {
292
+ const end = new Date();
293
+ const start = new Date();
294
+ start.setTime(start.getTime() - 3600 * 1000 * 24 * 180);
295
+ picker.$emit("pick", [start, end]);
296
+ },
297
+ },
298
+ {
299
+ text: "最近一年",
300
+ onClick(picker) {
301
+ const end = new Date();
302
+ const start = new Date();
303
+ start.setTime(start.getTime() - 3600 * 1000 * 24 * 365);
304
+ picker.$emit("pick", [start, end]);
305
+ },
306
+ },
307
+ ],
308
+ },
309
+ // 报表相关属性
310
+ reportList: [], // 报表集合
311
+ selReportName: "选择报表",
312
+ reportDefs: "",
313
+ reportParamStr: "",
314
+ reloadReportForm: false,
315
+ };
316
+ },
317
+ methods,
318
+ mixins: [],
319
+ watch: {
320
+ value: {
321
+ handler(newValue) {
322
+ this.inputValue = newValue;
323
+ },
324
+ deep: true,
325
+ },
326
+ inputValue: {
327
+ handler(newValue) {
328
+ this.$emit(EVENT_INPUT, newValue);
329
+ },
330
+ deep: true,
331
+ },
332
+ formContent: {
333
+ handler(newValue) {
334
+ if (isArray(newValue)) {
335
+ const reportObj = newValue.find((item) => {
336
+ return item.conditionType == this.$enum.conditionType.reportSet;
337
+ });
338
+ if (reportObj) {
339
+ this.clickReportBtn(reportObj.url, reportObj.params);
340
+ }
341
+ }
342
+ },
343
+ deep: true,
344
+ immediate: true,
345
+ },
346
+ },
347
+ computed: {
348
+ getItem() {
349
+ return function (val) {
350
+ setTimeout(() => {
351
+ const result = this.$http.get(val);
352
+ }, 1000);
353
+ };
354
+ },
355
+ // getBtnContentIsOut() {
356
+ // let arr = Array.isArray(this.btnContent)&&this.btnContent.filter((item) => item.isOut);
357
+ // console.log('xxx',arr)
358
+ // return arr
359
+ // },
360
+ },
361
+ // ------------------------------------------------------------------
362
+ // pragma mark - Life Cycle(生命周期)
363
+ // ------------------------------------------------------------------
364
+ created() {
365
+ this.createdInit();
366
+ },
367
+ mounted() {
368
+ //点击文本自动点击前面的input触发选择
369
+ setInterval(function () {
370
+ document.querySelectorAll(".el-cascader-node__label").forEach((el) => {
371
+ el.onclick = function () {
372
+ if (this.previousElementSibling) this.previousElementSibling.click();
373
+ };
374
+ });
375
+ }, 1000);
405
376
 
406
- this.mountedInit();
407
- },
377
+ this.mountedInit();
378
+ },
408
379
  };
409
380
  </script>
410
381
  <style lang="scss" src="./index.scss" scoped></style>