st-comp 0.0.21 → 0.0.22

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.
@@ -0,0 +1,306 @@
1
+ <template>
2
+ <div class="component-main">
3
+ <span>{{ props.label }}</span>
4
+ <el-button text type="primary" size="small" @click="clean">
5
+ 不限
6
+ </el-button>
7
+ <slot>
8
+ <div style="display: inline-block">
9
+ <el-tag
10
+ style="margin-right: 5px"
11
+ v-for="(item, i) in tagList"
12
+ :key="item.key"
13
+ closable
14
+ type="info"
15
+ :disable-transitions="false"
16
+ @close="delData(item)"
17
+ >
18
+ {{ item.freqName || "" }}
19
+ {{ item.factorName || "" }}
20
+ {{ item.startScore === null ? " / " : item.startScore + "分" }}
21
+ <span>~</span>
22
+ {{ item.endScore === null ? " / " : item.endScore + "分" }}
23
+ </el-tag>
24
+ </div>
25
+ </slot>
26
+ <el-popover :visible="visible" placement="top" :width="700">
27
+ <div class="title">因子筛选</div>
28
+ <el-row class="list">
29
+ <el-col :span="6"> 周期 </el-col>
30
+ <el-col :span="6"> 因子 </el-col>
31
+ <el-col :span="8"> 分数范围 </el-col>
32
+ <el-col :span="4">
33
+ <div style="text-align: center">操作</div>
34
+ </el-col>
35
+ </el-row>
36
+ <el-row
37
+ v-for="(formItem, index) in form"
38
+ :key="formItem.key"
39
+ class="list"
40
+ >
41
+ <el-col :span="6">
42
+ <el-select
43
+ v-model="formItem.freqId"
44
+ :class="formItem.freqStatus ? 'border-red' : ''"
45
+ :style="{ width: '150px' }"
46
+ size="small"
47
+ placeholder="请选择"
48
+ @change="
49
+ (val) => {
50
+ formItem.freqStatus = false;
51
+ formItem.freqName = freqList.find(
52
+ (fitem) => fitem.value === val
53
+ ).label;
54
+ }
55
+ "
56
+ >
57
+ <el-option
58
+ v-for="item in freqList"
59
+ :key="item.value"
60
+ :label="item.label"
61
+ :value="item.value"
62
+ />
63
+ </el-select>
64
+ </el-col>
65
+ <el-col :span="6">
66
+ <el-select
67
+ v-model="formItem.factorId"
68
+ :class="formItem.factorStatus ? 'border-red' : ''"
69
+ :style="{ width: '150px' }"
70
+ size="small"
71
+ placeholder="请选择"
72
+ @change="
73
+ (val) => {
74
+ formItem.factorStatus = false;
75
+ formItem.factorName = factorList.find(
76
+ (fitem) => fitem.id === val
77
+ ).factorName;
78
+ }
79
+ "
80
+ >
81
+ <el-option
82
+ v-for="item in factorList"
83
+ :key="item.id"
84
+ :label="item.factorName"
85
+ :value="item.id"
86
+ />
87
+ </el-select>
88
+ </el-col>
89
+ <el-col :span="8">
90
+ <el-input-number
91
+ v-model="formItem.startScore"
92
+ :class="formItem.startScoreStatus ? 'border-red' : ''"
93
+ style="width: 100px"
94
+ :step="0.5"
95
+ :min="-999"
96
+ :max="999"
97
+ controls-position="right"
98
+ size="small"
99
+ @change="
100
+ () => {
101
+ formItem.startScoreStatus = false;
102
+ formItem.endScoreStatus = false;
103
+ }
104
+ "
105
+ />
106
+ <span> ~ </span>
107
+ <el-input-number
108
+ v-model="formItem.endScore"
109
+ :class="formItem.endScoreStatus ? 'border-red' : ''"
110
+ style="width: 100px"
111
+ :step="0.5"
112
+ :min="-999"
113
+ :max="999"
114
+ controls-position="right"
115
+ size="small"
116
+ @change="
117
+ (val) => {
118
+ formItem.startScoreStatus = false;
119
+ formItem.endScoreStatus = false;
120
+ }
121
+ "
122
+ />
123
+ </el-col>
124
+ <el-col :span="4">
125
+ <el-button
126
+ size="small"
127
+ type="primary"
128
+ text
129
+ @click="
130
+ () => {
131
+ form.splice(index + 1, 0, {
132
+ factorId: null,
133
+ freqId: null,
134
+ startScore: null,
135
+ endScore: null,
136
+ key: new Date().getTime(),
137
+ });
138
+ }
139
+ "
140
+ >
141
+ 添加
142
+ </el-button>
143
+ <el-button
144
+ size="small"
145
+ type="danger"
146
+ text
147
+ @click="
148
+ () => {
149
+ form.splice(index, 1);
150
+ }
151
+ "
152
+ >
153
+ 删除
154
+ </el-button>
155
+ </el-col>
156
+ </el-row>
157
+ <div class="card-bottom">
158
+ <el-button @click="visible = false"> 取消 </el-button>
159
+ <el-button type="primary" @click="submitPost()"> 确认 </el-button>
160
+ </div>
161
+ <template #reference>
162
+ <div style="display: inline-block">
163
+ <el-button type="primary" size="small" @click="open">
164
+ 添加
165
+ </el-button>
166
+ </div>
167
+ </template>
168
+ </el-popover>
169
+ </div>
170
+ </template>
171
+
172
+ <script setup>
173
+ import { ref, computed } from "vue";
174
+
175
+ const emit = defineEmits(["updata", "update:modelValue"]);
176
+ const props = defineProps({
177
+ label: {
178
+ type: String,
179
+ default: "因子筛选",
180
+ require: true,
181
+ },
182
+ modelValue: {
183
+ type: Array,
184
+ default: [],
185
+ require: true,
186
+ },
187
+ freqList: {
188
+ type: Array,
189
+ default: [],
190
+ },
191
+ factorList: {
192
+ type: Array,
193
+ default: [],
194
+ },
195
+ });
196
+
197
+ const visible = ref(false);
198
+ const form = ref([]);
199
+ const tagList = computed({
200
+ get() {
201
+ return props.modelValue;
202
+ },
203
+ set(val) {
204
+ emit("update:modelValue", val);
205
+ },
206
+ });
207
+ const open = () => {
208
+ if (!form.value.length) {
209
+ form.value.push({
210
+ factorId: null,
211
+ freqId: null,
212
+ startScore: null,
213
+ endScore: null,
214
+ key: new Date().getTime(),
215
+ });
216
+ }
217
+ visible.value = true;
218
+ };
219
+
220
+ const delData = (row) => {
221
+ form.value = form.value.filter((item) => item.key !== row.key);
222
+ tagList.value = tagList.value.filter((item) => item.key !== row.key);
223
+ };
224
+
225
+ const clean = () => {
226
+ form.value = [];
227
+ tagList.value = [];
228
+ };
229
+
230
+ const submitPost = () => {
231
+ let verify = true;
232
+ const list = form.value.map((item, i) => {
233
+ const row = { ...item };
234
+ if (!row.factorId || !row.freqId) {
235
+ verify = false;
236
+ row.factorStatus = !row.factorId ? true : false;
237
+ row.freqStatus = !row.freqId ? true : false;
238
+ }
239
+ if (
240
+ (row.startScore === "" || row.startScore === null) &&
241
+ (row.endScore === "" || row.endScore === null)
242
+ ) {
243
+ verify = false;
244
+ row.startScoreStatus = true;
245
+ row.endScoreStatus = true;
246
+ } else {
247
+ row.startScoreStatus = false;
248
+ row.endScoreStatus = false;
249
+ }
250
+ form.value[i] = { ...row };
251
+ return row;
252
+ });
253
+ if (verify) {
254
+ visible.value = false;
255
+ tagList.value = list;
256
+ } else {
257
+ ElMessage.warning("请输入未填项");
258
+ }
259
+ };
260
+
261
+ const init = () => {
262
+ form.value = [
263
+ {
264
+ factorId: null,
265
+ freqId: null,
266
+ startScore: null,
267
+ endScore: null,
268
+ key: new Date().getTime(),
269
+ },
270
+ ];
271
+ tagList.value = [];
272
+ };
273
+
274
+ defineExpose({
275
+ delData, // 删除某条数据
276
+ clean, // 清空数据
277
+ init, // 初始化组件方法
278
+ });
279
+ </script>
280
+ <style>
281
+ .component-main {
282
+ display: inline-block;
283
+ }
284
+ .border-red .el-input__wrapper,
285
+ .border-red .el-select__wrapper {
286
+ box-shadow: 0 0 0 1px var(--el-color-danger) inset;
287
+ }
288
+ </style>
289
+ <style lang="scss" scoped>
290
+ .title {
291
+ font-size: 16px;
292
+ padding-bottom: 5px;
293
+ margin-bottom: 5px;
294
+ border-bottom: 1px solid #6c6e72;
295
+ }
296
+ .card-bottom {
297
+ border-top: 1px solid #6c6e72;
298
+ padding-top: 10px;
299
+ margin-top: 15px;
300
+ text-align: right;
301
+ }
302
+
303
+ .list {
304
+ margin-top: 10px;
305
+ }
306
+ </style>
@@ -0,0 +1,8 @@
1
+ import { App } from "vue";
2
+ import StVarSeach from "./index.vue";
3
+
4
+ export default {
5
+ install(app: App) {
6
+ app.component("st-varSeach", StVarSeach);
7
+ },
8
+ }
@@ -0,0 +1,121 @@
1
+ <script setup lang="ts">
2
+ import {computed} from "vue";
3
+ import ModalScreenv from "./components/ModalScreenv/index.vue";
4
+ import ModalQuery from "./components/ModalQuery/index.vue";
5
+
6
+ const emit = defineEmits(["update:modelValue"]);
7
+ /**
8
+ * 组件接收参数
9
+ * @param {Object} formConfig 筛选配置
10
+ * @param {Boolean} formSeachShow 是否展开
11
+ */
12
+
13
+ const props = defineProps({
14
+ modelValue: {
15
+ type: Object,
16
+ require: true,
17
+ default: () => ({}),
18
+ },
19
+ show: {
20
+ type: Boolean,
21
+ default: true,
22
+ },
23
+ config: {
24
+ type: Object,
25
+ require: true,
26
+ default: () => ({}),
27
+ },
28
+ });
29
+ const formData = computed({
30
+ get() {
31
+ return props.modelValue;
32
+ },
33
+ set(val) {
34
+ emit("update:modelValue", val);
35
+ },
36
+ });
37
+
38
+ // 另设表单数据源,避免直接使用传入数据源导致非主动的子影响父
39
+ const formConfig = computed(() => {
40
+ return Object.keys(props.config).map((key) => {
41
+ return {
42
+ key,
43
+ ...props.config[key],
44
+ show:
45
+ props.config[key].show === undefined ? true : props.config[key].show, // 默认展示
46
+ };
47
+ });
48
+ });
49
+ </script>
50
+
51
+ <template>
52
+ <!-- 神兔-品种池筛 -->
53
+ <div v-show="props.show" class="st-var-seach">
54
+ <div class="form-item" v-for="(item, index) in formConfig" :key="index">
55
+ <div v-if="item.type === 'checkboxGroup'" v-show="item.show === true">
56
+ <span class="el-form-item__label">{{ item.label }}:</span>
57
+ <el-button
58
+ text
59
+ size="small"
60
+ type="primary"
61
+ @click="
62
+ () => {
63
+ formData[item.key] = [];
64
+ }
65
+ "
66
+ >
67
+ 不限
68
+ </el-button>
69
+ <el-checkbox-group
70
+ v-model="formData[item.key]"
71
+ size="small"
72
+ style="display: inline-block; vertical-align: middle"
73
+ >
74
+ <el-checkbox
75
+ :label="items.dictCode"
76
+ v-for="items in item.options"
77
+ :key="items.dictCode"
78
+ >
79
+ {{ items.dictName }}
80
+ </el-checkbox>
81
+ </el-checkbox-group>
82
+ </div>
83
+ <div
84
+ v-if="item.type === 'factorscores'"
85
+ v-show="item.show === true"
86
+ class="form-item"
87
+ >
88
+ <ModalScreenv
89
+ :label="item.label"
90
+ v-model="formData[item.key]"
91
+ :freqList="item.freqList"
92
+ :factorList="item.factorList"
93
+ ></ModalScreenv>
94
+ </div>
95
+ <div
96
+ v-if="item.type === 'queryList'"
97
+ v-show="item.show === true"
98
+ class="form-item"
99
+ style="min-height: 70px"
100
+ >
101
+ <ModalQuery
102
+ :label="item.label"
103
+ v-model="formData[item.key]"
104
+ :orderByInfoList="item.orderByInfoList"
105
+ ></ModalQuery>
106
+ </div>
107
+ </div>
108
+ </div>
109
+ </template>
110
+
111
+ <style lang="scss">
112
+ // 需要写在外面,不然会被Vue唯一标识符顶掉导致样式不生效
113
+ </style>
114
+ <style lang="scss" scoped>
115
+ .st-var-seach {
116
+ .form-item {
117
+ line-height: 32px;
118
+ font-size: 14px;
119
+ }
120
+ }
121
+ </style>
package/packages/index.ts CHANGED
@@ -3,10 +3,13 @@ import StChartLayout from "./ChartLayout/index.ts"
3
3
  import StDialog from "./Dialog/index.ts"
4
4
  import StHeatMap from "./HeatMap/index.ts"
5
5
  import StKline from "./Kline/index.ts"
6
+ import StLinearLegend from "./LinearLegend/index.ts"
6
7
  import StMap from "./Map/index.ts"
7
8
  import StPagination from "./Pagination/index.ts"
8
9
  import StPie from "./Pie/index.ts"
9
10
  import StTable from "./Table/index.ts"
11
+ import StTreeMap from "./TreeMap/index.ts"
12
+ import StVarSeach from "./VarSeach/index.ts"
10
13
 
11
14
  export default {
12
15
  install(app: App) {
@@ -14,10 +17,13 @@ export default {
14
17
  StDialog.install(app)
15
18
  StHeatMap.install(app)
16
19
  StKline.install(app)
20
+ StLinearLegend.install(app)
17
21
  StMap.install(app)
18
22
  StPagination.install(app)
19
23
  StPie.install(app)
20
24
  StTable.install(app)
25
+ StTreeMap.install(app)
26
+ StVarSeach.install(app)
21
27
  },
22
28
  }
23
29