adtec-core-package 0.8.4 → 0.8.6

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": "adtec-core-package",
3
- "version": "0.8.4",
3
+ "version": "0.8.6",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "scripts": {
@@ -156,24 +156,6 @@ const { stop, pause, resume } = watchPausable(
156
156
  },
157
157
  )
158
158
  pause()
159
- //@ts-ignore
160
- watch(props.required, () => {
161
- if (props.required) {
162
- if (!props.scope.row.validateArr) {
163
- props.scope.row.validateArr = []
164
- }
165
- if (props.scope.row.validateArr.indexOf(props.scope.column.property) === -1) {
166
- props.scope.row.validateArr.push(props.scope.column.property)
167
- }
168
- } else {
169
- if (props.scope.row.validateArr) {
170
- props.scope.row.validateArr.splice(
171
- props.scope.row.validateArr.indexOf(props.scope.column.property),
172
- 1,
173
- )
174
- }
175
- }
176
- })
177
159
  onMounted(() => {
178
160
  // if (props.enableEditingStatus) {
179
161
  // resume()
@@ -198,27 +180,6 @@ onMounted(() => {
198
180
  }
199
181
  table.value = instance1
200
182
  showOverflowTooltip.value = table.value?.props?.showOverflowTooltip
201
- nextTick(() => {
202
- if (props.required) {
203
- if(props.scope) {
204
- if (!props.scope!.row!.validateArr) {
205
- props.scope.row.validateArr = []
206
- }
207
- if (props.scope.row.validateArr.indexOf(props.scope.column.property) === -1) {
208
- props.scope.row.validateArr.push(props.scope.column.property)
209
- }
210
- }
211
- } else {
212
- if(props.scope) {
213
- if (props.scope!.row!.validateArr) {
214
- props.scope.row.validateArr.splice(
215
- props.scope.row.validateArr.indexOf(props.scope.column.property),
216
- 1,
217
- )
218
- }
219
- }
220
- }
221
- })
222
183
  })
223
184
  onUnmounted(() => {
224
185
  bus.off(listener)
@@ -1,3 +1,5 @@
1
+ import { ElMessage } from 'element-plus'
2
+
1
3
  /**
2
4
  * Create by丁盼
3
5
  * 说明: tableTool
@@ -7,20 +9,28 @@
7
9
  export default {
8
10
  /**
9
11
  * 校验表格数据是否为空
10
- * @param table
12
+ * @param table 表格对象
13
+ * @param rules 校验规则
11
14
  */
12
- validateTableData(table: any): Boolean {
15
+ validateTableData(table: any,rules:any): Boolean {
13
16
  try {
14
- table.data.forEach((row: any) => {
15
- const v = row.validateArr
16
- v.forEach((val: any) => {
17
- if (!row[val]) {
18
- throw new Error()
17
+ const data=table.value?table.value.data:table.data
18
+ data.forEach((row: any,index:number) => {
19
+ for(let v in rules){
20
+ if (!row[v]) {
21
+ let msg=rules[v].message
22
+ if(msg){
23
+ msg=msg.replace('{index}',index+1)
24
+ }
25
+ throw new Error(msg)
19
26
  }
20
- })
27
+ }
21
28
  })
22
29
  return true
23
- } catch (e) {
30
+ } catch (e:any) {
31
+ if(e.message) {
32
+ ElMessage.error(e.message)
33
+ }
24
34
  return false
25
35
  }
26
36
  },