sohelp-eleplus 1.1.22 → 1.1.25

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/components.js CHANGED
@@ -46,3 +46,4 @@ export { default as SohelpIconSelect } from './sohelp-icon-select/index.vue';
46
46
  export { default as SohelpModal } from './sohelp-modal/index.vue';
47
47
  export { default as SohelpCard } from './sohelp-card/index.vue';
48
48
  export { default as SohelpPage } from './sohelp-page/index.vue';
49
+ export { default as SohelpTableSelect } from './sohelp-table-select/index.vue';
package/http/CrudHttp.js CHANGED
@@ -6,9 +6,9 @@ import SohelpHttp from "./SohelpHttp";
6
6
  export const CrudHttp = {
7
7
  /**
8
8
  * 表单初始化数据
9
- *
9
+ *
10
10
  * 获取表单初始化所需的数据,如默认值、选项等。
11
- *
11
+ *
12
12
  * @param {string} refid 模块引用ID
13
13
  * @param {Object} [params={}] 请求参数
14
14
  * @param {Function} [callback] 请求完成后的回调函数
@@ -20,9 +20,9 @@ export const CrudHttp = {
20
20
  },
21
21
  /**
22
22
  * 根据ID获取某一行数据
23
- *
23
+ *
24
24
  * 用于获取单行数据的详细信息。
25
- *
25
+ *
26
26
  * @param {string} refid 模块引用ID
27
27
  * @param {Object} [params={}] 请求参数,通常包含 id
28
28
  * @param {Function} [callback] 请求完成后的回调函数
@@ -34,9 +34,9 @@ export const CrudHttp = {
34
34
  },
35
35
  /**
36
36
  * 根据ID,获取主体数据和外键数据
37
- *
37
+ *
38
38
  * 获取详细数据,包括关联的外键数据。
39
- *
39
+ *
40
40
  * @param {string} refid 模块引用ID
41
41
  * @param {Object} [params={}] 请求参数,通常包含 id
42
42
  * @param {Function} [callback] 请求完成后的回调函数
@@ -48,9 +48,9 @@ export const CrudHttp = {
48
48
  },
49
49
  /**
50
50
  * 根据外键分页读取数据列表
51
- *
51
+ *
52
52
  * 用于加载子表或关联表的分页数据。
53
- *
53
+ *
54
54
  * @param {string} refid 模块引用ID
55
55
  * @param {Object} [params={}] 请求参数,包含分页信息和外键条件
56
56
  * @param {Function} [callback] 请求完成后的回调函数
@@ -62,9 +62,9 @@ export const CrudHttp = {
62
62
  },
63
63
  /**
64
64
  * 保存单据
65
- *
65
+ *
66
66
  * 保存表单数据(通用保存接口)。
67
- *
67
+ *
68
68
  * @param {string} refid 模块引用ID
69
69
  * @param {Object} [data={}] 表单数据对象
70
70
  * @param {Function} [callback] 请求完成后的回调函数
@@ -76,9 +76,9 @@ export const CrudHttp = {
76
76
  },
77
77
  /**
78
78
  * 创建单据
79
- *
79
+ *
80
80
  * 创建新的单据记录。
81
- *
81
+ *
82
82
  * @param {string} refid 模块引用ID
83
83
  * @param {Object} [data={}] 表单数据对象
84
84
  * @param {Function} [callback] 请求完成后的回调函数
@@ -90,9 +90,9 @@ export const CrudHttp = {
90
90
  },
91
91
  /**
92
92
  * 更新单据
93
- *
93
+ *
94
94
  * 更新已存在的单据记录。
95
- *
95
+ *
96
96
  * @param {string} refid 模块引用ID
97
97
  * @param {Object} [data={}] 表单数据对象,通常包含 id
98
98
  * @param {Function} [callback] 请求完成后的回调函数
@@ -104,9 +104,9 @@ export const CrudHttp = {
104
104
  },
105
105
  /**
106
106
  * 删除单据
107
- *
107
+ *
108
108
  * 删除指定的单据记录。
109
- *
109
+ *
110
110
  * @param {string} refid 模块引用ID
111
111
  * @param {Object} [data={}] 数据对象,通常包含 id 或 ids
112
112
  * @param {Function} [callback] 请求完成后的回调函数
@@ -118,9 +118,9 @@ export const CrudHttp = {
118
118
  },
119
119
  /**
120
120
  * 单据分页
121
- *
121
+ *
122
122
  * 获取主表的分页数据列表。
123
- *
123
+ *
124
124
  * @param {string} refid 模块引用ID
125
125
  * @param {Object} [params={}] 查询参数,包含分页、排序和筛选条件
126
126
  * @param {Function} [callback] 请求完成后的回调函数
@@ -129,20 +129,6 @@ export const CrudHttp = {
129
129
  page: async function(refid, params = {}, callback) {
130
130
  params["refid"] = refid;
131
131
  return SohelpHttp.get("/engine/web/crud/page", params,callback);
132
- },
133
- /**
134
- * 单据详情
135
- *
136
- * 获取单据的详细信息,通常用于查看或编辑页面。
137
- *
138
- * @param {string} refid 模块引用ID
139
- * @param {Object} [params={}] 查询参数,通常包含 id
140
- * @param {Function} [callback] 请求完成后的回调函数
141
- * @returns {Promise<axios.AxiosResponse<any>>} 返回Promise对象
142
- */
143
- detail: async function(refid, params = {}, callback) {
144
- params["refid"] = refid;
145
- return SohelpHttp.get("/engine/web/crud/detail", params,callback);
146
132
  }
147
133
  };
148
134
 
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * axios实例
3
3
  */
4
- import { ElMessageBox } from 'element-plus/es';
4
+ import { ElMessageBox } from "element-plus/es";
5
5
 
6
6
  export const SohelpHttp = {
7
7
  /**
@@ -12,7 +12,7 @@ export const SohelpHttp = {
12
12
  },
13
13
 
14
14
  /**
15
- * 下载文件
15
+ * 通过Get请求,下载文件
16
16
  * @param _url
17
17
  * @param param
18
18
  * @param fileName
@@ -20,9 +20,9 @@ export const SohelpHttp = {
20
20
  * @param config
21
21
  * @returns {Promise<never>}
22
22
  */
23
- download: async function (_url, param, fileName, onProgress, config = {}) {
23
+ download: async function(_url, param, fileName, onProgress, config = {}) {
24
24
  if (window.$axios == null) {
25
- console.error('请在配置main.js中配置window.$axios实例!!');
25
+ console.error("请在配置main.js中配置window.$axios实例!!");
26
26
  return;
27
27
  }
28
28
  try {
@@ -33,10 +33,10 @@ export const SohelpHttp = {
33
33
  const response = await window.$axios
34
34
  .get(_url, {
35
35
  params: param || {},
36
- responseType: 'blob',
36
+ responseType: "blob",
37
37
  ...config,
38
38
  onDownloadProgress: (evt) => {
39
- if (typeof onProgress === 'function') {
39
+ if (typeof onProgress === "function") {
40
40
  const total = evt?.total || 0;
41
41
  const loaded = evt?.loaded || 0;
42
42
  onProgress(loaded, total);
@@ -47,7 +47,7 @@ export const SohelpHttp = {
47
47
  return Promise.reject(e.message);
48
48
  });
49
49
 
50
- if (response.type === 'application/json') {
50
+ if (response.type === "application/json") {
51
51
  try {
52
52
  const text = await response.text();
53
53
  const res = JSON.parse(text);
@@ -55,7 +55,7 @@ export const SohelpHttp = {
55
55
  return res.data;
56
56
  } else {
57
57
  if (res?.meta?.error) {
58
- console.log('SohelpHttp.download:', res.meta.error);
58
+ console.log("SohelpHttp.download:", res.meta.error);
59
59
  }
60
60
  return Promise.reject(new Error(res.meta.message));
61
61
  }
@@ -65,12 +65,12 @@ export const SohelpHttp = {
65
65
  return;
66
66
  }
67
67
  // 创建一个链接元素用于下载
68
- const url = _url + '?' + new URLSearchParams(param).toString();
68
+ const url = _url + "?" + new URLSearchParams(param).toString();
69
69
  // const url = window.URL.createObjectURL(response.data);
70
- const link = document.createElement('a');
70
+ const link = document.createElement("a");
71
71
  link.href = url;
72
- link.target = '_blank';
73
- link.setAttribute('download', fileName); // 设置下载的文件名
72
+ link.target = "_blank";
73
+ link.setAttribute("download", fileName); // 设置下载的文件名
74
74
  document.body.appendChild(link);
75
75
 
76
76
  // 触发下载
@@ -82,22 +82,22 @@ export const SohelpHttp = {
82
82
  return Promise.reject(error);
83
83
  }
84
84
  },
85
- get: function (url, param, callback) {
85
+ get: function(url, param, callback) {
86
86
  if (window.$axios == null) {
87
- console.error('请在配置main.js中配置window.$axios实例!!');
87
+ console.error("请在配置main.js中配置window.$axios实例!!");
88
88
  return;
89
89
  }
90
90
  for (const key in param) {
91
- if (typeof param[key] === 'object' && param[key] !== null) {
91
+ if (typeof param[key] === "object" && param[key] !== null) {
92
92
  param[key] = JSON.stringify(param[key]); // 转换为 JSON 字符串
93
93
  }
94
94
  }
95
95
  let promise = window.$axios.get(url, { params: param });
96
96
  return promise.then((r) => {
97
97
  if (!r.meta.success && r.meta.error) {
98
- console.error('(GET请求URL):', url, '(请求参数):', param, '(返回结果):', r.meta.error);
98
+ console.error("(GET请求URL):", url, "(请求参数):", param, "(返回结果):", r.meta.error);
99
99
  }
100
- if (typeof callback === 'function') {
100
+ if (typeof callback === "function") {
101
101
  callback.call(this, r);
102
102
  }
103
103
  return Promise.resolve(r);
@@ -112,17 +112,17 @@ export const SohelpHttp = {
112
112
  * @param {Function} [error] 错误回调函数(目前未使用)
113
113
  * @returns {Promise<any>} 返回Promise对象
114
114
  */
115
- post: function (url, param, callback, error) {
115
+ post: function(url, param, callback, error) {
116
116
  if (window.$axios == null) {
117
- console.error('请在配置main.js中配置window.$axios实例!');
117
+ console.error("请在配置main.js中配置window.$axios实例!");
118
118
  return;
119
119
  }
120
120
  let promise = window.$axios.post(url, param);
121
121
  return promise.then((r) => {
122
122
  if (!r.meta.success && r.meta.error) {
123
- console.error('(GET请求URL):', url, '(请求参数):', param, '(返回结果):', r.meta.error);
123
+ console.error("(GET请求URL):", url, "(请求参数):", param, "(返回结果):", r.meta.error);
124
124
  }
125
- if (typeof callback === 'function') {
125
+ if (typeof callback === "function") {
126
126
  callback.call(this, r);
127
127
  }
128
128
  return Promise.resolve(r);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sohelp-eleplus",
3
- "version": "1.1.22",
3
+ "version": "1.1.25",
4
4
  "description": "SohelpEleplus Extension Components",
5
5
  "public": true,
6
6
  "main": "index.js",
@@ -1,30 +1,25 @@
1
1
  <!-- 字典组件 -->
2
2
  <template>
3
3
  <template v-if="type === 'text'">
4
- <el-text
5
- v-bind="$attrs"
6
- :style="getStyle(item)"
7
- style="
8
- border-radius: 3px;
9
- margin-right: 3px;
10
- padding-left: 6px;
11
- padding-right: 6px;
12
- padding-top: 3px;
13
- padding-bottom: 3px;
14
- display: flex;
15
- align-items: center;
16
- "
17
- v-for="(item, index) in valueData"
18
- :key="item.value"
19
- >
20
- <el-icon :size="18" style="margin: 2px 5px 0 0">
21
- <component :is="ElementPlusIcons[icon]" v-if="ElementPlusIcons[icon]" />
22
- <component :is="EleAdminPlusIcons[icon]" v-else-if="EleAdminPlusIcons[icon]" />
23
- <span :class="icon" v-else></span>
24
- </el-icon>
4
+ <div style="display: flex; align-items: center; flex-wrap: wrap; gap: 5px">
5
+ <el-text
6
+ v-bind="$attrs"
7
+ :style="getStyle(item)"
8
+ style="padding: 0 6px; border-radius: 3px"
9
+ v-for="item in valueData"
10
+ :key="item.value"
11
+ >
12
+ <div class="sohelp-dict-item">
13
+ <el-icon v-if="item.icon">
14
+ <component :is="ElementPlusIcons[icon]" v-if="ElementPlusIcons[icon]" />
15
+ <component :is="EleAdminPlusIcons[icon]" v-else-if="EleAdminPlusIcons[icon]" />
16
+ <span :class="icon" v-else></span>
17
+ </el-icon>
25
18
 
26
- {{ item.label }}
27
- </el-text>
19
+ {{ item.label }}</div
20
+ >
21
+ </el-text></div
22
+ >
28
23
  </template>
29
24
  <template v-else-if="type === 'tag'">
30
25
  <div class="tags" style="display: flex; gap: 5px; flex-wrap: wrap">
@@ -36,45 +31,53 @@
36
31
  :key="item.value"
37
32
  :disable-transitions="true"
38
33
  >
39
- <el-icon :size="18" style="margin: 2px 5px 0 0">
40
- <component :is="ElementPlusIcons[icon]" v-if="ElementPlusIcons[icon]" />
41
- <component :is="EleAdminPlusIcons[icon]" v-else-if="EleAdminPlusIcons[icon]" />
42
- <span :class="icon" v-else></span>
43
- </el-icon>
44
- {{ item.label }}
34
+ <div class="sohelp-dict-item">
35
+ <el-icon v-if="item.icon">
36
+ <component :is="ElementPlusIcons[icon]" v-if="ElementPlusIcons[icon]" />
37
+ <component :is="EleAdminPlusIcons[icon]" v-else-if="EleAdminPlusIcons[icon]" />
38
+ <span :class="icon" v-else></span>
39
+ </el-icon>
40
+ {{ item.label }}</div
41
+ >
45
42
  </el-tag>
46
43
  </div>
47
44
  </template>
45
+
48
46
  <el-radio-group
49
47
  v-bind="$attrs"
50
48
  v-else-if="type === 'radio'"
51
49
  :disabled="disabled"
52
- :model-value="modelValue"
50
+ v-model="modelValue"
53
51
  @change="change"
54
52
  >
55
53
  <el-radio v-for="item in data.value" :key="item.value" :label="item.value">
56
- <el-icon :size="18" style="margin: 2px 5px 0 0">
57
- <component :is="ElementPlusIcons[icon]" v-if="ElementPlusIcons[icon]" />
58
- <component :is="EleAdminPlusIcons[icon]" v-else-if="EleAdminPlusIcons[icon]" />
59
- <span :class="icon" v-else></span>
60
- </el-icon>
61
- {{ item.label }}
54
+ <div class="sohelp-dict-item">
55
+ <el-icon v-if="item.icon">
56
+ <component :is="ElementPlusIcons[icon]" v-if="ElementPlusIcons[icon]" />
57
+ <component :is="EleAdminPlusIcons[icon]" v-else-if="EleAdminPlusIcons[icon]" />
58
+ <span :class="icon" v-else></span>
59
+ </el-icon>
60
+ {{ item.label }}</div
61
+ >
62
62
  </el-radio>
63
63
  </el-radio-group>
64
+
64
65
  <el-checkbox-group
65
66
  v-bind="$attrs"
66
67
  v-else-if="type === 'checkbox'"
67
68
  :disabled="disabled"
68
- :model-value="modelValue"
69
+ v-model="modelValue"
69
70
  @change="change"
70
71
  >
71
72
  <el-checkbox v-for="item in data.value" :key="item.value" :label="item.value">
72
- <el-icon :size="18" style="margin: 2px 5px 0 0">
73
- <component :is="ElementPlusIcons[icon]" v-if="ElementPlusIcons[icon]" />
74
- <component :is="EleAdminPlusIcons[icon]" v-else-if="EleAdminPlusIcons[icon]" />
75
- <span :class="icon" v-else></span>
76
- </el-icon>
77
- {{ item.label }}
73
+ <div class="sohelp-dict-item">
74
+ <el-icon v-if="item.icon">
75
+ <component :is="ElementPlusIcons[icon]" v-if="ElementPlusIcons[icon]" />
76
+ <component :is="EleAdminPlusIcons[icon]" v-else-if="EleAdminPlusIcons[icon]" />
77
+ <span :class="icon" v-else></span>
78
+ </el-icon>
79
+ {{ item.label }}</div
80
+ >
78
81
  </el-checkbox>
79
82
  </el-checkbox-group>
80
83
 
@@ -93,16 +96,32 @@
93
96
  ref="dictSelectRef"
94
97
  :style="getStyle(data?.value?.find((item) => item.value === modelValue))"
95
98
  >
99
+ <template #tag>
100
+ <div style="display: flex; gap: 5px; flex-wrap: wrap">
101
+ <el-tag v-for="item in valueData" :key="item" :style="getStyle(item)">
102
+ <div class="sohelp-dict-item">
103
+ <el-icon v-if="item.icon">
104
+ <component :is="ElementPlusIcons[icon]" v-if="ElementPlusIcons[icon]" />
105
+ <component :is="EleAdminPlusIcons[icon]" v-else-if="EleAdminPlusIcons[icon]" />
106
+ <span :class="icon" v-else></span>
107
+ </el-icon>
108
+
109
+ {{ item.label }}</div
110
+ >
111
+ </el-tag>
112
+ </div>
113
+ </template>
114
+
96
115
  <template #prefix v-if="icon">
97
- <el-icon :size="18" style="margin-right: 5px">
116
+ <el-icon :size="16" style="margin-right: 5px">
98
117
  <component :is="ElementPlusIcons[icon]" v-if="ElementPlusIcons[icon]" />
99
118
  <component :is="EleAdminPlusIcons[icon]" v-else-if="EleAdminPlusIcons[icon]" />
100
119
  <span :class="icon" v-else></span>
101
120
  </el-icon>
102
121
  </template>
103
122
  <el-option v-for="item in data.value" :key="item.id" :value="item.value" :label="item.label">
104
- <el-tag class="el-option-tag" size="small" :style="getStyle(item)" :color="item.backgroundColor">
105
- <el-icon :size="14" v-if="item.icon" style="margin: 0 5px 0 2px">
123
+ <el-tag class="sohelp-dict-item" size="small" :style="getStyle(item)" :color="item.backgroundColor">
124
+ <el-icon v-if="item.icon">
106
125
  <component :is="ElementPlusIcons[item.icon]" v-if="ElementPlusIcons[item.icon]" />
107
126
  <component :is="EleAdminPlusIcons[item.icon]" v-else-if="EleAdminPlusIcons[item.icon]" />
108
127
  <span :class="item.icon" v-else></span>
@@ -119,7 +138,10 @@
119
138
  import * as ElementPlusIcons from '@element-plus/icons-vue';
120
139
  import * as EleAdminPlusIcons from '../sohelp-icon-select/icons';
121
140
 
122
- const modelValue = defineModel('modelValue', { type: [String, Number, Array], default: '' });
141
+ const modelValue = defineModel('modelValue', {
142
+ type: [String, Number, Array],
143
+ default: ''
144
+ });
123
145
  const emit = defineEmits('change');
124
146
  const props = defineProps({
125
147
  /** 字典类型 */
@@ -130,7 +152,10 @@
130
152
  /** 组件类型 */
131
153
  type: String,
132
154
  /** 是否禁用 */
133
- disabled: Boolean,
155
+ disabled: {
156
+ type: Boolean,
157
+ default: false
158
+ },
134
159
  /** 提示文本 */
135
160
  placeholder: String,
136
161
  /** select的下拉是否插入到body下 */
@@ -232,7 +257,7 @@
232
257
  color: inherit;
233
258
  }
234
259
  }
235
- .el-option-tag {
260
+ .sohelp-dict-item {
236
261
  display: flex;
237
262
  flex: 0 0 auto !important;
238
263
  align-items: center;
@@ -240,8 +265,12 @@
240
265
  display: flex;
241
266
  align-items: center;
242
267
  }
268
+ :deep(.el-icon) {
269
+ font-size: 14px;
270
+ margin-right: 2px;
271
+ }
243
272
  }
244
273
  .el-select__popper .el-select-dropdown__list .el-select-dropdown__item {
245
- font-size: inherit;
274
+ // font-size: inherit;
246
275
  }
247
276
  </style>
@@ -13,7 +13,6 @@
13
13
  :labelField="labelField"
14
14
  :valueField="valueField"
15
15
  />
16
-
17
16
  </div>
18
17
  </template>
19
18
  <script>
@@ -82,7 +81,8 @@
82
81
  () => props.modelValue,
83
82
  (val) => {
84
83
  value.value = val;
85
- },{
84
+ },
85
+ {
86
86
  immediate: true,
87
87
  deep: true
88
88
  }
@@ -15,6 +15,7 @@
15
15
  :rowProps="{
16
16
  gutter: 20
17
17
  }"
18
+ :saveParams="saveParams"
18
19
  @updateValue="setFieldValue"
19
20
  >
20
21
  <!-- 自定义插槽 -->
@@ -71,9 +72,12 @@
71
72
  gridNum: {
72
73
  type: Number,
73
74
  default: 1
75
+ },
76
+ saveParams: {
77
+ type: Object,
78
+ default: () => ({})
74
79
  }
75
80
  });
76
-
77
81
  /**
78
82
  * 存储表单初始值用于对比变更
79
83
  *