ci-plus 1.8.8 → 1.9.0
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/README.md +5 -0
- package/package.json +1 -1
- package/src/components.d.ts +1 -0
- package/src/fileRelated/index/ciuploadV5.ts +4 -0
- package/src/fileRelated/uploadV4.vue +1 -1
- package/src/fileRelated/uploadV5.vue +450 -0
- package/src/index.ts +1 -0
- package/src/sortableTable/README.md +254 -266
- package/src/sortableTable/headerInput.vue +13 -1
package/README.md
CHANGED
package/package.json
CHANGED
package/src/components.d.ts
CHANGED
|
@@ -27,6 +27,7 @@ declare module '@vue/runtime-core' {
|
|
|
27
27
|
CiUploadV2: typeof components.UploadV2
|
|
28
28
|
CiUploadV3: typeof components.UploadV3
|
|
29
29
|
CiUploadV4: typeof components.UploadV4
|
|
30
|
+
CiUploadV5: typeof components.UploadV5
|
|
30
31
|
|
|
31
32
|
CiSelect: typeof components.Select
|
|
32
33
|
CiSelectTable: typeof components.SelectTable
|
|
@@ -0,0 +1,450 @@
|
|
|
1
|
+
<!-- /**
|
|
2
|
+
* @module uploadV4
|
|
3
|
+
* @author : 卖女孩的小火柴
|
|
4
|
+
* !description : 其它入库 导入组件
|
|
5
|
+
* @version : 1.0.0
|
|
6
|
+
* @since : 创建时间 2025-08-14 14:36:38
|
|
7
|
+
*/ -->
|
|
8
|
+
|
|
9
|
+
<template>
|
|
10
|
+
<el-popover
|
|
11
|
+
placement="bottom"
|
|
12
|
+
:width="300"
|
|
13
|
+
:trigger="props.otherConfig?.trigger || 'hover'"
|
|
14
|
+
:visible="visible"
|
|
15
|
+
>
|
|
16
|
+
<el-upload
|
|
17
|
+
ref="upload"
|
|
18
|
+
class="upload-demo"
|
|
19
|
+
:action="uploadUrl"
|
|
20
|
+
:limit="mylimit || 1"
|
|
21
|
+
:on-exceed="handleExceed"
|
|
22
|
+
:auto-upload="false"
|
|
23
|
+
:on-success="onSuccess"
|
|
24
|
+
:on-error="onError"
|
|
25
|
+
:on-change="handleChange"
|
|
26
|
+
:on-remove="handleRemove"
|
|
27
|
+
:data="datas"
|
|
28
|
+
:multiple="mymultiple || false"
|
|
29
|
+
v-model:file-list="fileList"
|
|
30
|
+
>
|
|
31
|
+
<template #trigger>
|
|
32
|
+
<el-button size="small" type="primary" style="width: 100%" plain>
|
|
33
|
+
{{ t('fileRelated.selectFile') }}
|
|
34
|
+
</el-button>
|
|
35
|
+
</template>
|
|
36
|
+
<el-button
|
|
37
|
+
size="small"
|
|
38
|
+
@click="formwork"
|
|
39
|
+
style="float: left; margin: 0 12px 0 0; width: 95px"
|
|
40
|
+
v-if="url"
|
|
41
|
+
>
|
|
42
|
+
{{ t('fileRelated.downloadTemplate') }}
|
|
43
|
+
</el-button>
|
|
44
|
+
</el-upload>
|
|
45
|
+
|
|
46
|
+
<div class="slot" style="display: flex; flex-direction: column; align-items: flex-end">
|
|
47
|
+
<div style="width: 100%; margin: 4px 2px" v-if="ifShowAffiliation">
|
|
48
|
+
<el-select-v2
|
|
49
|
+
size="small"
|
|
50
|
+
v-model="affiliationAll"
|
|
51
|
+
filterable
|
|
52
|
+
:options="affiliationOptions"
|
|
53
|
+
:placeholder="t('fileRelated.selectCompany')"
|
|
54
|
+
style="width: 100%; margin-right: 5px"
|
|
55
|
+
clearable
|
|
56
|
+
@change="changeAll"
|
|
57
|
+
/>
|
|
58
|
+
</div>
|
|
59
|
+
<div style="width: 100%; margin: 4px 2px" v-if="ifShowWarehouse">
|
|
60
|
+
<el-select-v2
|
|
61
|
+
size="small"
|
|
62
|
+
v-model="warehouseAll"
|
|
63
|
+
filterable
|
|
64
|
+
:options="warehouseOptions"
|
|
65
|
+
:placeholder="t('fileRelated.selectWarehouse')"
|
|
66
|
+
style="width: 100%; margin-right: 5px"
|
|
67
|
+
clearable
|
|
68
|
+
@change="changeWarehouseAll"
|
|
69
|
+
/>
|
|
70
|
+
</div>
|
|
71
|
+
<!-- 添加一个插槽 -->
|
|
72
|
+
<slot></slot>
|
|
73
|
+
<div>
|
|
74
|
+
<el-button size="small" type="primary" @click="submitUpload" style="flex: 2">
|
|
75
|
+
{{ t('fileRelated.upload') }}
|
|
76
|
+
</el-button>
|
|
77
|
+
</div>
|
|
78
|
+
</div>
|
|
79
|
+
|
|
80
|
+
<template #reference>
|
|
81
|
+
<el-button
|
|
82
|
+
:type="exporLoading ? 'danger' : 'success'"
|
|
83
|
+
@click="visible = !visible"
|
|
84
|
+
:size="props.otherConfig?.size || 'small'"
|
|
85
|
+
:loading="exporLoading"
|
|
86
|
+
>
|
|
87
|
+
{{ props.title || t('fileRelated.attachmentUpload') }}
|
|
88
|
+
</el-button>
|
|
89
|
+
</template>
|
|
90
|
+
</el-popover>
|
|
91
|
+
</template>
|
|
92
|
+
|
|
93
|
+
<script setup lang="ts">
|
|
94
|
+
defineOptions({ name: 'ci-uploadV5' })
|
|
95
|
+
|
|
96
|
+
// 定义一个函数,用于处理字符串
|
|
97
|
+
|
|
98
|
+
const setFilePath = (arr: string[], url?: string) => {
|
|
99
|
+
// console.log('重新渲染数据', arr);
|
|
100
|
+
if (arr && arr.length > 0) {
|
|
101
|
+
let newArr: { name: string; oldName: string }[] = []
|
|
102
|
+
arr.forEach((item, i) => {
|
|
103
|
+
let segments = item.split('.')
|
|
104
|
+
let parts = segments[0].split('/') // 获取每名称
|
|
105
|
+
let name = parts[parts.length - 1] + '.' + segments[segments.length - 1]
|
|
106
|
+
let oldName = url ? url + item : item //原来的名称
|
|
107
|
+
// let url = segments[0] + '.' + segments[segments.length - 1]
|
|
108
|
+
newArr.push({ name, oldName })
|
|
109
|
+
})
|
|
110
|
+
return newArr
|
|
111
|
+
} else {
|
|
112
|
+
return [] // 如果数组为空,则返回空数组
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
// 将路径处理成附件的参数
|
|
117
|
+
const fileArr = (url: string, pathArr: string[]) => {
|
|
118
|
+
if (pathArr && pathArr.length > 0) {
|
|
119
|
+
let objArr: any = []
|
|
120
|
+
if (pathArr.length > 0) {
|
|
121
|
+
pathArr.map((item: any) => {
|
|
122
|
+
objArr.push({
|
|
123
|
+
name: item.name,
|
|
124
|
+
oldName: item.oldName,
|
|
125
|
+
url: url + item.oldName
|
|
126
|
+
})
|
|
127
|
+
})
|
|
128
|
+
return objArr
|
|
129
|
+
} else {
|
|
130
|
+
return []
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
import t from '../utils/lang/index'
|
|
135
|
+
import ajaxBox from '../utils/ajaxBox'
|
|
136
|
+
import { getAffiliationOptions, getWarehouseList, axios } from '../utils/getAffiliationOptions.ts'
|
|
137
|
+
import type { AxiosRequestConfig } from 'axios'
|
|
138
|
+
import { computed, onMounted, ref } from 'vue'
|
|
139
|
+
// import t from '@/views/MaterialWarehouse/lang'
|
|
140
|
+
// import ajaxBox from '@/views/MaterialWarehouse/utils/ajaxBox'
|
|
141
|
+
// import { getAffiliationOptions, getWarehouseList, axios } from '@/views/MaterialWarehouse/utils/getAffiliationOptions.ts'
|
|
142
|
+
|
|
143
|
+
import type {
|
|
144
|
+
UploadFile,
|
|
145
|
+
UploadFiles,
|
|
146
|
+
UploadInstance,
|
|
147
|
+
UploadProps,
|
|
148
|
+
UploadUserFile
|
|
149
|
+
} from 'element-plus'
|
|
150
|
+
import {
|
|
151
|
+
ElButton,
|
|
152
|
+
ElLoading,
|
|
153
|
+
ElMessage,
|
|
154
|
+
ElPopover,
|
|
155
|
+
ElSelectV2,
|
|
156
|
+
ElUpload,
|
|
157
|
+
genFileId,
|
|
158
|
+
UploadRawFile
|
|
159
|
+
} from 'element-plus'
|
|
160
|
+
|
|
161
|
+
const upload = ref<UploadInstance>()
|
|
162
|
+
const exporLoading = ref(false)
|
|
163
|
+
const visible = ref(false)
|
|
164
|
+
const affiliationAll = ref() // 选择的归属公司
|
|
165
|
+
const warehouseAll = ref() // 选择的仓库
|
|
166
|
+
const affiliationOptions = ref<any[]>([]) // 获取归属公司列表数据
|
|
167
|
+
const warehouseOptions = ref<any[]>([]) // 获取仓库列表数据
|
|
168
|
+
|
|
169
|
+
interface Props {
|
|
170
|
+
url?: string // 上传和下载模板的接口(当需要将附件传递回父组件时不需要传递此属性)
|
|
171
|
+
uploadUrl?: string // 上传附件的接口
|
|
172
|
+
parameter?: Object // 模板下载的时候请求需要携带的参数:{state: 1}
|
|
173
|
+
data?: any //上传携带的其他数据对象:{userId: 1, userName: '张三'}
|
|
174
|
+
title?: string // 上传按钮的名称
|
|
175
|
+
multiple?: boolean // 是否支持多文件
|
|
176
|
+
limit?: number // 最大文件数量
|
|
177
|
+
ifShowAffiliation?: boolean // 是否显示归属公司
|
|
178
|
+
requiredAffiliation?: boolean // 是否必选归属公司
|
|
179
|
+
ifShowWarehouse?: boolean // 是否显示仓库
|
|
180
|
+
requiredWarehouse?: boolean // 是否必选仓库
|
|
181
|
+
ifDefaultAffiliation?: boolean // 是否默认选中归属工厂默认值true
|
|
182
|
+
defaultAffiliationOrgid?: string // 默认选中归属工厂的 orgid(默认值当前登陆账号的单位)
|
|
183
|
+
filePath?: UploadFile[] //UploadRawFile[] // 父组件传递的附件数据,用于显示附件列表和上传附件后传递给父组件附件数据
|
|
184
|
+
RowIndex?: number // 父组件传递的行索引,用于父组件中删除了附件找到对应的行(用于表格表单中上传附件)
|
|
185
|
+
templateName?: string //模板名称
|
|
186
|
+
timeOn?: boolean // 是否开启耗时任务 默认不开启
|
|
187
|
+
// 其他的一些配置:请求的baseurl地址,有耗时任务的时候耗时任务的配置,模板下载的一些配置等
|
|
188
|
+
otherConfig: {
|
|
189
|
+
size?: 'large' | 'default' | 'small' // 按钮大小
|
|
190
|
+
trigger?: 'click' | 'focus' | 'hover' | 'contextmenu' // 按钮触发方式 默认 hover
|
|
191
|
+
baseUrl?: string // 上请求的baseurl地址
|
|
192
|
+
datakey: string // 耗时请求的参数key值
|
|
193
|
+
// 耗时任务的配置
|
|
194
|
+
timeConfig: {
|
|
195
|
+
url: string // 查询耗时任务地址
|
|
196
|
+
method: 'put' | 'post' | 'get' | 'PUT' | 'POST' | 'GET'
|
|
197
|
+
data?: object // 可选属性
|
|
198
|
+
params?: object // 可选属性
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
const props = defineProps<Props>()
|
|
203
|
+
|
|
204
|
+
// 默认值:是否显示归属公司
|
|
205
|
+
const ifShowAffiliation = computed(() => {
|
|
206
|
+
return props.ifShowAffiliation || true
|
|
207
|
+
})
|
|
208
|
+
// 默认值:是否显示仓库
|
|
209
|
+
const ifShowWarehouse = computed(() => {
|
|
210
|
+
return props.ifShowWarehouse || false
|
|
211
|
+
})
|
|
212
|
+
// 默认值:是否必选归属公司
|
|
213
|
+
const requiredAffiliation = computed(() => {
|
|
214
|
+
return props.requiredAffiliation || false
|
|
215
|
+
})
|
|
216
|
+
// 默认值:是否必选仓库
|
|
217
|
+
const requiredWarehouse = computed(() => {
|
|
218
|
+
return props.requiredWarehouse || false
|
|
219
|
+
})
|
|
220
|
+
|
|
221
|
+
// 是否默认选中归属工厂(默认值true)
|
|
222
|
+
const ifDefaultAffiliation = computed(() => {
|
|
223
|
+
return props.ifDefaultAffiliation || true
|
|
224
|
+
})
|
|
225
|
+
|
|
226
|
+
// 获取本地缓存中当前登陆账号的公司
|
|
227
|
+
const raw = localStorage.getItem('UserData')
|
|
228
|
+
const UserData = raw ? JSON.parse(raw) : {}
|
|
229
|
+
const defaultAffiliationOrgid = computed(() => {
|
|
230
|
+
return props.defaultAffiliationOrgid || UserData?.resOrgId // 默认登陆账号的单位
|
|
231
|
+
})
|
|
232
|
+
|
|
233
|
+
const emits = defineEmits<{
|
|
234
|
+
(e: 'reloadTable'): void // 组件中上传附件后刷新父组件表格数据方法
|
|
235
|
+
(e: 'getFile', files: UploadFiles, file?: UploadFile, rowindex?: number): void // 编辑表单的时候回显附件用到
|
|
236
|
+
(e: 'update:file', files: UploadFiles): void // 编辑表单的时候回显附件用到
|
|
237
|
+
}>()
|
|
238
|
+
console.log('附件props: ', props)
|
|
239
|
+
const datas: any = ref(props.data)
|
|
240
|
+
const mymultiple = ref<boolean>(props.multiple)
|
|
241
|
+
const mylimit = ref<number>((props.limit as number) || 1)
|
|
242
|
+
const myfilePath = ref<any>(props.filePath || [])
|
|
243
|
+
console.log('myfilePath: ', props.filePath)
|
|
244
|
+
|
|
245
|
+
const changeAll = (val: string) => {
|
|
246
|
+
datas.value.factory_affiliation_id = val
|
|
247
|
+
datas.value.factory_affiliation_name = affiliationOptions.value.find(
|
|
248
|
+
(item: any) => item.value === val
|
|
249
|
+
)?.label
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
const changeWarehouseAll = (val: string) => {
|
|
253
|
+
datas.value.warehouse_id = val
|
|
254
|
+
datas.value.warehouse_name = warehouseOptions.value.find((item: any) => item.value === val)?.label
|
|
255
|
+
|
|
256
|
+
console.log('%c Line:236 🍐 datas.value', 'color:#ea7e5c', datas.value)
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
// 对数组中的每个字符串应用处理函数
|
|
260
|
+
let pathArr = setFilePath(myfilePath.value)
|
|
261
|
+
|
|
262
|
+
// 打印处理后的数组
|
|
263
|
+
// 将父组件中传递过来的名称,处理成el-upload需要的格式
|
|
264
|
+
let pathUrlArr = fileArr(import.meta.env.VITE_BASE_URL9999, pathArr)
|
|
265
|
+
console.log('fileObj(): ', pathUrlArr)
|
|
266
|
+
const fileList = ref<UploadUserFile[]>(pathUrlArr)
|
|
267
|
+
console.log('fileList: ', fileList.value)
|
|
268
|
+
|
|
269
|
+
//当超出限制时,执行的钩子函数
|
|
270
|
+
const handleExceed: UploadProps['onExceed'] = (files) => {
|
|
271
|
+
console.log('%c Line:177 🥝 files', 'color:#e41a6a', files)
|
|
272
|
+
|
|
273
|
+
if (mylimit?.value === 1) {
|
|
274
|
+
upload.value!.clearFiles()
|
|
275
|
+
const file = files[0] as UploadRawFile
|
|
276
|
+
file.uid = genFileId()
|
|
277
|
+
upload.value!.handleStart(file)
|
|
278
|
+
}
|
|
279
|
+
if (mylimit?.value > 1) {
|
|
280
|
+
console.log('超出限制: ', files)
|
|
281
|
+
ElMessage.warning(
|
|
282
|
+
`${t('fileRelated.exceedFiles')} ${mylimit?.value} ${t('fileRelated.reselect')}`
|
|
283
|
+
)
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
// 文件状态改变时的钩子,添加文件、上传成功和上传失败时都会被调用
|
|
288
|
+
const handleChange = (file: any, fileLists: any) => {
|
|
289
|
+
if (!props.url) {
|
|
290
|
+
emits('getFile', fileLists) //将选中的文件传递回父组件
|
|
291
|
+
emits('update:file', fileLists) //同步父组件绑定的附件字段,以便父组件提交表单的时候一起将附件提交
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
// 文件列表删除时
|
|
295
|
+
const handleRemove: UploadProps['onRemove'] = (file, fileList) => {
|
|
296
|
+
console.log('file: ', file)
|
|
297
|
+
console.log('fileList: ', fileList)
|
|
298
|
+
// 如果没有url时 在删除的时候将文件流同步回父组件
|
|
299
|
+
if (!props.url) {
|
|
300
|
+
emits('getFile', fileList, file, props.RowIndex)
|
|
301
|
+
emits('update:file', fileList)
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
//上传文件
|
|
305
|
+
const submitUpload = () => {
|
|
306
|
+
if (!fileList.value || !fileList.value.length) {
|
|
307
|
+
return ElMessage.warning(t('fileRelated.pleaseFile'))
|
|
308
|
+
}
|
|
309
|
+
console.log(fileList.value.length)
|
|
310
|
+
if (!datas.value.warehouse_id && requiredWarehouse.value) {
|
|
311
|
+
return ElMessage.warning(t('fileRelated.pleaseSelectWarehouse'))
|
|
312
|
+
}
|
|
313
|
+
if (!datas.value.factory_affiliation_id && requiredAffiliation.value) {
|
|
314
|
+
return ElMessage.warning(t('fileRelated.selectCompany'))
|
|
315
|
+
}
|
|
316
|
+
// exporLoading.value = ElLoading.service({ text: t('fileRelated.importing') })
|
|
317
|
+
exporLoading.value = true
|
|
318
|
+
console.log('upload.value', upload.value)
|
|
319
|
+
upload.value!.submit()
|
|
320
|
+
visible.value = false
|
|
321
|
+
}
|
|
322
|
+
//文件上传成功回调
|
|
323
|
+
const onSuccess = async (res: any, file: any, fileList: any) => {
|
|
324
|
+
console.log('fileList: ', fileList)
|
|
325
|
+
console.log('file: ', file)
|
|
326
|
+
console.log('上传成功回调: ', res)
|
|
327
|
+
// exporLoading.value.close() // 关闭加载动画
|
|
328
|
+
if (res.code !== 200) {
|
|
329
|
+
upload.value!.clearFiles() // 清空文件列表
|
|
330
|
+
// exporLoading.value.close() // 关闭加载动画
|
|
331
|
+
exporLoading.value = false
|
|
332
|
+
return ElMessage.warning(res.msg)
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
// 判断是否要走耗时逻辑
|
|
336
|
+
if (!props.timeOn || !res.data) {
|
|
337
|
+
upload.value!.clearFiles() // 清空文件列表
|
|
338
|
+
visible.value = false // 关闭上传面板
|
|
339
|
+
// exporLoading.value.close() // 关闭加载动画
|
|
340
|
+
exporLoading.value = false
|
|
341
|
+
ElMessage.success(res.msg)
|
|
342
|
+
emits('reloadTable')
|
|
343
|
+
return
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
// 处理耗时请求的参数
|
|
347
|
+
let datas = {}
|
|
348
|
+
datas[props.otherConfig?.datakey] = res.data.task_id
|
|
349
|
+
// 耗时轮训
|
|
350
|
+
const data = await askForTask(datas)
|
|
351
|
+
console.log('data: ', data)
|
|
352
|
+
if (data.code === 200) {
|
|
353
|
+
// fileList.value.length = 0 // 清空文件列表
|
|
354
|
+
upload.value!.clearFiles() // 清空文件列表
|
|
355
|
+
visible.value = false // 关闭上传面板
|
|
356
|
+
// exporLoading.value.close() // 关闭加载动画
|
|
357
|
+
exporLoading.value = false
|
|
358
|
+
ElMessage.success(data.msg)
|
|
359
|
+
emits('reloadTable')
|
|
360
|
+
} else if (data.code === 0) {
|
|
361
|
+
upload.value!.clearFiles() // 清空文件列表
|
|
362
|
+
exporLoading.value = false
|
|
363
|
+
ElMessage.error(data.msg || '导入失败')
|
|
364
|
+
// exporLoading.value.close() // 关闭加载动画
|
|
365
|
+
} else {
|
|
366
|
+
ElMessage.error(data.msg || '请求超时或者其他错误,请联系管理员.')
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
//文件上传失败回调
|
|
370
|
+
const onError = (response: any, file: any, fileList: any) => {
|
|
371
|
+
console.log('上传失败回调: ', response)
|
|
372
|
+
ElMessage.error(file.name + t('fileRelated.uploadFailed'))
|
|
373
|
+
// fileList.value.length = 0 // 清空文件列表
|
|
374
|
+
upload.value!.clearFiles() // 清空文件列表
|
|
375
|
+
visible.value = false // 关闭上传面板
|
|
376
|
+
// exporLoading.value.close() // 关闭加载动画
|
|
377
|
+
exporLoading.value = false
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
// 耗时请求函数
|
|
381
|
+
const askForTask: (task_info: any) => Promise<any> = async (task_info: any) => {
|
|
382
|
+
// 处理父组件传递的配置
|
|
383
|
+
const axiosConfig: AxiosRequestConfig = {
|
|
384
|
+
...props.otherConfig?.timeConfig
|
|
385
|
+
}
|
|
386
|
+
// 处理请求的参数
|
|
387
|
+
if (
|
|
388
|
+
props.otherConfig?.timeConfig?.method === 'get' ||
|
|
389
|
+
props.otherConfig?.timeConfig?.method === 'GET'
|
|
390
|
+
) {
|
|
391
|
+
axiosConfig.params = {
|
|
392
|
+
...props.otherConfig?.timeConfig.params,
|
|
393
|
+
...task_info
|
|
394
|
+
}
|
|
395
|
+
} else {
|
|
396
|
+
axiosConfig.data = {
|
|
397
|
+
...props.otherConfig?.timeConfig.data,
|
|
398
|
+
...task_info
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
try {
|
|
402
|
+
const res = await axios(axiosConfig)
|
|
403
|
+
// 如果返回的code是50001 就继续轮询,直到返回的code不是50001
|
|
404
|
+
if (res.data.code === 50001)
|
|
405
|
+
return await new Promise((resolve) => {
|
|
406
|
+
setTimeout(() => resolve(askForTask(task_info)), 2000)
|
|
407
|
+
})
|
|
408
|
+
return res.data
|
|
409
|
+
} catch (error) {
|
|
410
|
+
console.error('Error fetching task:', error)
|
|
411
|
+
throw error
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
//下载模板
|
|
416
|
+
const formwork = () => {
|
|
417
|
+
const url = props.url as string
|
|
418
|
+
const params = props.parameter
|
|
419
|
+
ajaxBox.downFileFetchV2(url, params, {
|
|
420
|
+
method: 'GET',
|
|
421
|
+
fileName: props.templateName || t('fileRelated.template')
|
|
422
|
+
})
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
//选择框
|
|
426
|
+
onMounted(async () => {
|
|
427
|
+
if (props.url && ifShowAffiliation.value) {
|
|
428
|
+
affiliationOptions.value = await getAffiliationOptions()
|
|
429
|
+
if (props.data && ifShowWarehouse.value) {
|
|
430
|
+
warehouseOptions.value = await getWarehouseList({
|
|
431
|
+
storage_type: props.data?.storage_type || 'CAILIAO'
|
|
432
|
+
})
|
|
433
|
+
}
|
|
434
|
+
} else {
|
|
435
|
+
affiliationOptions.value = []
|
|
436
|
+
warehouseOptions.value = []
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
// 判断是否默认选中归属公司
|
|
440
|
+
if (ifDefaultAffiliation.value) {
|
|
441
|
+
affiliationAll.value = defaultAffiliationOrgid.value
|
|
442
|
+
}
|
|
443
|
+
})
|
|
444
|
+
</script>
|
|
445
|
+
|
|
446
|
+
<style scoped lang="scss">
|
|
447
|
+
:deep(.el-upload) {
|
|
448
|
+
width: calc(100% - 110px);
|
|
449
|
+
}
|
|
450
|
+
</style>
|
package/src/index.ts
CHANGED
|
@@ -19,6 +19,7 @@ export * from './fileRelated/index/ciupload' // 导出附件上传组件
|
|
|
19
19
|
export * from './fileRelated/index/ciuploadV2' // 导出附件上传v2组件
|
|
20
20
|
export * from './fileRelated/index/ciuploadV3' // 导出附件上传v3组件
|
|
21
21
|
export * from './fileRelated/index/ciuploadV4' // 导出附件上传v4组件
|
|
22
|
+
export * from './fileRelated/index/ciuploadV5' // 导出附件上传v5组件
|
|
22
23
|
|
|
23
24
|
export * from './select' // 导出select组件
|
|
24
25
|
export * from './selectTable' // 导出selectTable组件
|
|
@@ -1,287 +1,275 @@
|
|
|
1
1
|
## 使用示例
|
|
2
2
|
|
|
3
3
|
```ts
|
|
4
|
-
const useBackStoreM = defineStore(
|
|
5
|
-
|
|
6
|
-
() => {
|
|
7
|
-
const ifshow = ref(true)
|
|
4
|
+
const useBackStoreM = defineStore('MaterialWarehouse-MaterialsPreparationNotice-index', () => {
|
|
5
|
+
const ifshow = ref(true)
|
|
8
6
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
},
|
|
55
|
-
})
|
|
56
|
-
},
|
|
57
|
-
},
|
|
58
|
-
{
|
|
59
|
-
col: { width: 150, label: '产线', prop: 'line_name' },
|
|
60
|
-
// 示例3:输入框
|
|
61
|
-
header(createVNode: any) {
|
|
62
|
-
return createVNode(HeaderInput, {
|
|
63
|
-
text: '产线',
|
|
64
|
-
column: 'line_name',
|
|
65
|
-
storePar: store.params.value,
|
|
66
|
-
type: 'text',
|
|
67
|
-
disableFilter: false,// 关闭筛选功能true
|
|
68
|
-
selectConfig: {},
|
|
69
|
-
placeholder: '请输入关键字...',
|
|
70
|
-
onChange(val: any) {
|
|
71
|
-
console.log('val: ', val)
|
|
72
|
-
store.HEADERSEARCH(val)
|
|
73
|
-
console.log('当前的参数: ', store.params.value)
|
|
74
|
-
},
|
|
75
|
-
onGetstore(val: any) {
|
|
76
|
-
console.log('val: ', val)
|
|
77
|
-
console.log('当前的参数: ', store.params.value)
|
|
78
|
-
},
|
|
79
|
-
ordersConfig: { enableOrder: false }, // 开启排序功能true
|
|
80
|
-
})
|
|
81
|
-
},
|
|
82
|
-
},
|
|
83
|
-
{
|
|
84
|
-
col: {
|
|
85
|
-
width: 100,
|
|
86
|
-
label: '通用件库存',
|
|
87
|
-
prop: 'common_parts_inventory_count',
|
|
88
|
-
},
|
|
89
|
-
component(createVNode, { row }: Scoped) {
|
|
90
|
-
return createVNode(
|
|
91
|
-
'div',
|
|
92
|
-
{
|
|
93
|
-
style: {
|
|
94
|
-
color: `${row.common_parts_inventory_count < row.count
|
|
95
|
-
? 'red'
|
|
96
|
-
: 'black'
|
|
97
|
-
}`,
|
|
98
|
-
}, // 行内样式
|
|
99
|
-
class: 'flex-a-c', // 添加一个flex-a-c的class名称
|
|
100
|
-
},
|
|
101
|
-
row.common_parts_inventory_count,
|
|
102
|
-
)
|
|
103
|
-
},
|
|
104
|
-
|
|
105
|
-
},
|
|
106
|
-
{
|
|
107
|
-
col: { width: 100, label: '状态', prop: 'state', fixed: 'right' },
|
|
108
|
-
component(createVNode, { row }: Scoped) {
|
|
109
|
-
let { type, val } = setLibraryName(row.state)
|
|
110
|
-
if (val) {
|
|
111
|
-
return createVNode(ElTag, { type, class: 'ml-2' }, () => val)
|
|
112
|
-
} else {
|
|
113
|
-
return createVNode('div', [val])
|
|
7
|
+
type Scoped = Scope<MPNRes>
|
|
8
|
+
const store: ReturnType<
|
|
9
|
+
ReturnType<typeof getOptStore<MPNRes, any, any, any, { ids: number[] }>>
|
|
10
|
+
> = getOptStore<MPNRes, any, any, any, { ids: number[] }>({
|
|
11
|
+
model: 'material_preparation_notice_list', // 请求地址:material_preparation_notice_list_post
|
|
12
|
+
id: 'MaterialWarehouse-MaterialsPreparationNotice-index', // 配置存储的id(约定项目名称-模块名称-页面名称)
|
|
13
|
+
name: '材料库_备料通知',
|
|
14
|
+
storage_type: '', //CHUKU
|
|
15
|
+
params: { limit: 20, storage_type: 'CAILIAO' },
|
|
16
|
+
baseUrl: storageModule,
|
|
17
|
+
setId: true,
|
|
18
|
+
ifInitData: false, // 是否初始请求表格数据
|
|
19
|
+
sortColumn: [
|
|
20
|
+
{ col: { width: 60, label: '序号', type: 'index', fixed: 'left' } },
|
|
21
|
+
{
|
|
22
|
+
col: { width: 130, label: '计划开始时间', prop: 'plan_start_date' },
|
|
23
|
+
// 示例1:日期格式
|
|
24
|
+
header(createVNode: any) {
|
|
25
|
+
return createVNode(HeaderInput, {
|
|
26
|
+
text: '计划开始时间',
|
|
27
|
+
column: 'plan_start_date',
|
|
28
|
+
storePar: store.params.value,
|
|
29
|
+
type: 'date',
|
|
30
|
+
placeholder: '请选择...',
|
|
31
|
+
popperStyle: { width: '450px', height: '300px' },
|
|
32
|
+
onChange(val: any) {
|
|
33
|
+
console.log('val: ', val)
|
|
34
|
+
store.HEADERSEARCH(val)
|
|
35
|
+
console.log('当前的参数: ', store.params.value)
|
|
36
|
+
},
|
|
37
|
+
ordersConfig: { enableOrder: true }
|
|
38
|
+
})
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
col: { width: 330, label: '物料编码', prop: 'material_info' },
|
|
43
|
+
// 示例2:输入框(简写)
|
|
44
|
+
header(createVNode: any) {
|
|
45
|
+
return createVNode(HeaderInput, {
|
|
46
|
+
text: '物料编码|物料名称|物料型号',
|
|
47
|
+
column: 'material_info',
|
|
48
|
+
storePar: store.params.value,
|
|
49
|
+
placeholder: '请输入关键字...',
|
|
50
|
+
onChange(val: any) {
|
|
51
|
+
store.HEADERSEARCH(val)
|
|
114
52
|
}
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
53
|
+
})
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
col: { width: 150, label: '产线', prop: 'line_name' },
|
|
58
|
+
// 示例3:输入框
|
|
59
|
+
header(createVNode: any) {
|
|
60
|
+
return createVNode(HeaderInput, {
|
|
61
|
+
text: '产线',
|
|
62
|
+
column: 'line_name',
|
|
63
|
+
storePar: store.params.value,
|
|
64
|
+
type: 'text',
|
|
65
|
+
disableFilter: false, // 关闭筛选功能true
|
|
66
|
+
selectConfig: {},
|
|
67
|
+
placeholder: '请输入关键字...',
|
|
68
|
+
onChange(val: any) {
|
|
69
|
+
console.log('val: ', val)
|
|
70
|
+
store.HEADERSEARCH(val)
|
|
71
|
+
console.log('当前的参数: ', store.params.value)
|
|
72
|
+
},
|
|
73
|
+
onGetstore(val: any) {
|
|
74
|
+
console.log('val: ', val)
|
|
75
|
+
console.log('当前的参数: ', store.params.value)
|
|
76
|
+
},
|
|
77
|
+
ordersConfig: { enableOrder: false } // 开启排序功能true
|
|
78
|
+
})
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
col: {
|
|
83
|
+
width: 100,
|
|
84
|
+
label: '通用件库存',
|
|
85
|
+
prop: 'common_parts_inventory_count'
|
|
138
86
|
},
|
|
139
|
-
{
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
prop: 'state',
|
|
144
|
-
fixed: 'right',
|
|
145
|
-
},
|
|
146
|
-
component(createVNode: any, { row }: Scoped) {
|
|
147
|
-
// 单元格内容为一个开关 ElSwitch 组件
|
|
148
|
-
return createVNode(ElSwitch, {
|
|
87
|
+
component(createVNode, { row }: Scoped) {
|
|
88
|
+
return createVNode(
|
|
89
|
+
'div',
|
|
90
|
+
{
|
|
149
91
|
style: {
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
// 点击事件
|
|
168
|
-
onClick: (event: MouseEvent) => {
|
|
169
|
-
event.stopPropagation() // 阻止事件冒泡
|
|
170
|
-
},
|
|
171
|
-
// 禁用状态
|
|
172
|
-
disabled:
|
|
173
|
-
Number(row.material_preparation_count) >= Number(row.count)
|
|
174
|
-
? true
|
|
175
|
-
: false,
|
|
176
|
-
})
|
|
177
|
-
},
|
|
178
|
-
header(createVNode: any) {
|
|
179
|
-
return createVNode(HeaderInput, {
|
|
180
|
-
text: '操作',
|
|
181
|
-
column: 'state',
|
|
182
|
-
storePar: store.params.value,
|
|
183
|
-
type: 'select',
|
|
184
|
-
initValue: '0',
|
|
185
|
-
popperStyle: { width: '300px', height: '150px' },
|
|
186
|
-
selectConfig: {
|
|
187
|
-
options: [
|
|
188
|
-
{ value: '0', label: '备货中' },
|
|
189
|
-
{ value: '1', label: '已备货' },
|
|
190
|
-
],
|
|
191
|
-
selectMultiple: true, // 是否多选
|
|
192
|
-
},
|
|
193
|
-
placeholder: '请选择...',
|
|
194
|
-
onChange(val: any) {
|
|
195
|
-
console.log('val: ', val)
|
|
196
|
-
store.HEADERSEARCH(val)
|
|
197
|
-
console.log('当前的参数: ', store.params.value)
|
|
198
|
-
},
|
|
199
|
-
})
|
|
200
|
-
},
|
|
92
|
+
color: `${row.common_parts_inventory_count < row.count ? 'red' : 'black'}`
|
|
93
|
+
}, // 行内样式
|
|
94
|
+
class: 'flex-a-c' // 添加一个flex-a-c的class名称
|
|
95
|
+
},
|
|
96
|
+
row.common_parts_inventory_count
|
|
97
|
+
)
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
col: { width: 100, label: '状态', prop: 'state', fixed: 'right' },
|
|
102
|
+
component(createVNode, { row }: Scoped) {
|
|
103
|
+
let { type, val } = setLibraryName(row.state)
|
|
104
|
+
if (val) {
|
|
105
|
+
return createVNode(ElTag, { type, class: 'ml-2' }, () => val)
|
|
106
|
+
} else {
|
|
107
|
+
return createVNode('div', [val])
|
|
108
|
+
}
|
|
201
109
|
},
|
|
202
|
-
|
|
203
|
-
{
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
)
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
110
|
+
// 示例4:下拉选择框(多选)
|
|
111
|
+
header(createVNode: any) {
|
|
112
|
+
return createVNode(HeaderInput, {
|
|
113
|
+
text: '状态',
|
|
114
|
+
column: 'state',
|
|
115
|
+
storePar: store.params.value,
|
|
116
|
+
type: 'select',
|
|
117
|
+
selectConfig: {
|
|
118
|
+
options: [
|
|
119
|
+
{ value: '0', label: '备货中' },
|
|
120
|
+
{ value: '1', label: '已备货' }
|
|
121
|
+
],
|
|
122
|
+
selectMultiple: true // 是否多选
|
|
123
|
+
},
|
|
124
|
+
placeholder: '请选择...',
|
|
125
|
+
onChange(val: any) {
|
|
126
|
+
console.log('val: ', val)
|
|
127
|
+
store.HEADERSEARCH(val)
|
|
128
|
+
console.log('当前的参数: ', store.params.value)
|
|
129
|
+
}
|
|
130
|
+
})
|
|
131
|
+
}
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
col: {
|
|
135
|
+
width: 100,
|
|
136
|
+
label: '操作',
|
|
137
|
+
prop: 'state',
|
|
138
|
+
fixed: 'right'
|
|
139
|
+
},
|
|
140
|
+
component(createVNode: any, { row }: Scoped) {
|
|
141
|
+
// 单元格内容为一个开关 ElSwitch 组件
|
|
142
|
+
return createVNode(ElSwitch, {
|
|
143
|
+
style: {
|
|
144
|
+
'--el-switch-on-color': '#13ce66',
|
|
145
|
+
'--el-switch-off-color': '#e6a23c'
|
|
146
|
+
},
|
|
147
|
+
modelValue: row.state === 0 ? false : true, //ifshow.value,
|
|
148
|
+
inlinePrompt: true,
|
|
149
|
+
activeText: '备货完成',
|
|
150
|
+
inactiveText: '备货中',
|
|
151
|
+
'onUpdate:modelValue': (newValue: any) => {
|
|
152
|
+
console.log('newValue: ', newValue)
|
|
153
|
+
// ifshow.value = newValue
|
|
154
|
+
row.state = newValue ? 1 : 0
|
|
155
|
+
materialPreparationCompleted([row], store.loading, store.UPDATEPOST)
|
|
156
|
+
},
|
|
157
|
+
// 点击事件
|
|
158
|
+
onClick: (event: MouseEvent) => {
|
|
159
|
+
event.stopPropagation() // 阻止事件冒泡
|
|
160
|
+
},
|
|
161
|
+
// 禁用状态
|
|
162
|
+
disabled: Number(row.material_preparation_count) >= Number(row.count) ? true : false
|
|
163
|
+
})
|
|
235
164
|
},
|
|
165
|
+
header(createVNode: any) {
|
|
166
|
+
return createVNode(HeaderInput, {
|
|
167
|
+
text: '操作',
|
|
168
|
+
column: 'state',
|
|
169
|
+
storePar: store.params.value,
|
|
170
|
+
type: 'select',
|
|
171
|
+
initValue: '0',
|
|
172
|
+
popperStyle: { width: '300px', height: '150px' },
|
|
173
|
+
selectConfig: {
|
|
174
|
+
options: [
|
|
175
|
+
{ value: '0', label: '备货中' },
|
|
176
|
+
{ value: '1', label: '已备货' }
|
|
177
|
+
],
|
|
178
|
+
selectMultiple: true // 是否多选
|
|
179
|
+
},
|
|
180
|
+
placeholder: '请选择...',
|
|
181
|
+
onChange(val: any) {
|
|
182
|
+
console.log('val: ', val)
|
|
183
|
+
store.HEADERSEARCH(val)
|
|
184
|
+
console.log('当前的参数: ', store.params.value)
|
|
185
|
+
}
|
|
186
|
+
})
|
|
187
|
+
}
|
|
188
|
+
},
|
|
236
189
|
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
190
|
+
{
|
|
191
|
+
col: { label: '操作', prop: '', width: 240 },
|
|
192
|
+
// 单元格中渲染2个普通按钮组件
|
|
193
|
+
component(createVNode, { row }: Scoped) {
|
|
194
|
+
return createVNode('div', [
|
|
195
|
+
createVNode(
|
|
196
|
+
ElButton,
|
|
197
|
+
{
|
|
243
198
|
size: 'small',
|
|
244
199
|
type: 'warning',
|
|
245
|
-
icon: View, // 查看
|
|
246
200
|
color: '#2193b0',
|
|
247
201
|
onClick(evt) {
|
|
248
202
|
evt.stopPropagation() // 阻止冒泡事件
|
|
249
|
-
console.log('
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
{
|
|
258
|
-
size: 'small',
|
|
259
|
-
icon: EditPen,
|
|
260
|
-
onClick(evt) {
|
|
261
|
-
evt.stopPropagation() // 阻止冒泡事件
|
|
262
|
-
onAdd(true, addRef.value, row)
|
|
263
|
-
},
|
|
264
|
-
}, //, () => '修改'
|
|
265
|
-
),
|
|
266
|
-
createVNode(ElButton, {
|
|
203
|
+
console.log('修改', row)
|
|
204
|
+
}
|
|
205
|
+
},
|
|
206
|
+
() => '公司详情记录'
|
|
207
|
+
),
|
|
208
|
+
createVNode(
|
|
209
|
+
ElButton,
|
|
210
|
+
{
|
|
267
211
|
size: 'small',
|
|
268
|
-
|
|
269
|
-
icon: Delete,
|
|
212
|
+
color: '#2c56a0',
|
|
270
213
|
onClick(evt) {
|
|
271
214
|
evt.stopPropagation() // 阻止冒泡事件
|
|
272
|
-
console.log('
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
}
|
|
215
|
+
console.log('编辑', row)
|
|
216
|
+
}
|
|
217
|
+
},
|
|
218
|
+
() => '条款详情记录'
|
|
219
|
+
)
|
|
220
|
+
])
|
|
221
|
+
}
|
|
222
|
+
},
|
|
279
223
|
|
|
224
|
+
{
|
|
225
|
+
col: { width: 180, label: '操作', prop: '' },
|
|
226
|
+
component(createVNode, { row }: Scoped) {
|
|
227
|
+
// 单元格中渲染3个图标按钮组件
|
|
228
|
+
return createVNode('div', [
|
|
229
|
+
createVNode(ElButton, {
|
|
230
|
+
size: 'small',
|
|
231
|
+
type: 'warning',
|
|
232
|
+
icon: View, // 查看
|
|
233
|
+
color: '#2193b0',
|
|
234
|
+
onClick(evt) {
|
|
235
|
+
evt.stopPropagation() // 阻止冒泡事件
|
|
236
|
+
console.log('查看', row)
|
|
237
|
+
console.log('detailsRef', detailsRef.value)
|
|
238
|
+
// detailsRef.value?.showMydia()
|
|
239
|
+
onSeeDetails(detailsRef.value, row)
|
|
240
|
+
}
|
|
241
|
+
}),
|
|
242
|
+
createVNode(
|
|
243
|
+
ElButton,
|
|
244
|
+
{
|
|
245
|
+
size: 'small',
|
|
246
|
+
icon: EditPen,
|
|
247
|
+
onClick(evt) {
|
|
248
|
+
evt.stopPropagation() // 阻止冒泡事件
|
|
249
|
+
onAdd(true, addRef.value, row)
|
|
250
|
+
}
|
|
251
|
+
} //, () => '修改'
|
|
252
|
+
),
|
|
253
|
+
createVNode(ElButton, {
|
|
254
|
+
size: 'small',
|
|
255
|
+
type: 'danger',
|
|
256
|
+
icon: Delete,
|
|
257
|
+
onClick(evt) {
|
|
258
|
+
evt.stopPropagation() // 阻止冒泡事件
|
|
259
|
+
console.log('修改', row)
|
|
260
|
+
deleteOpen([row.id], store.UPDATEPOST)
|
|
261
|
+
}
|
|
262
|
+
})
|
|
263
|
+
])
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
]
|
|
267
|
+
})()
|
|
268
|
+
return store
|
|
269
|
+
})
|
|
270
|
+
```
|
|
280
271
|
|
|
272
|
+
## 说明
|
|
281
273
|
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
return store
|
|
285
|
-
},
|
|
286
|
-
)
|
|
287
|
-
```
|
|
274
|
+
- showConnector: false, // 不使用连接符输入框的时候需要传入 initValue 属性,否则无法监听到筛选按钮的颜色变化
|
|
275
|
+
- 因为 不显示连接符输入框的时候, storePar属性中就可能没有 filter属性和 orders属性, 就无法监听到筛选按钮的颜色变化, 所以需要传入 initValue 属性, 使得 storePar中即使没有 filter属性和 orders属性, 也能能监听到筛选按钮的颜色变化。
|
|
@@ -510,7 +510,12 @@ if (props.type === 'date') {
|
|
|
510
510
|
}
|
|
511
511
|
// 不是日期筛选的时候将介于禁用
|
|
512
512
|
if (props.type !== 'date') {
|
|
513
|
-
operatorOptions.value
|
|
513
|
+
// 查找 operatorOptions.value 中value为between的项
|
|
514
|
+
// operatorOptions.value[7].disabled = true
|
|
515
|
+
const betweenItem = operatorOptions.value.find((item) => item.value === 'between')
|
|
516
|
+
if (betweenItem) {
|
|
517
|
+
betweenItem.disabled = true
|
|
518
|
+
}
|
|
514
519
|
}
|
|
515
520
|
|
|
516
521
|
// 监听operator.value的变化重置value的值
|
|
@@ -680,6 +685,7 @@ watch(
|
|
|
680
685
|
hasValue.value = true
|
|
681
686
|
} else {
|
|
682
687
|
hasValue.value = false
|
|
688
|
+
value.value = '' // 重置value的值
|
|
683
689
|
}
|
|
684
690
|
if (newVal?.filters) {
|
|
685
691
|
// 判断是否是当前列的筛选条件
|
|
@@ -691,9 +697,11 @@ watch(
|
|
|
691
697
|
hasValue.value = true
|
|
692
698
|
} else {
|
|
693
699
|
hasValue.value = false
|
|
700
|
+
value.value = '' // 重置value的值
|
|
694
701
|
}
|
|
695
702
|
} else {
|
|
696
703
|
hasValue.value = false
|
|
704
|
+
value.value = '' // 重置value的值
|
|
697
705
|
}
|
|
698
706
|
}
|
|
699
707
|
if (newVal?.orders) {
|
|
@@ -720,6 +728,9 @@ watch(
|
|
|
720
728
|
immediate: true
|
|
721
729
|
}
|
|
722
730
|
)
|
|
731
|
+
|
|
732
|
+
// 监听 props.initValue 的变化:当不显示条件连接符下拉选择框的时候,监听props.initValue 的变化
|
|
733
|
+
// showConnector: false, // 不使用连接符输入框的时候需要传入 initValue 属性,否则无法监听到筛选按钮的颜色变化
|
|
723
734
|
watch(
|
|
724
735
|
() => props.initValue,
|
|
725
736
|
(newVal, oldVal) => {
|
|
@@ -729,6 +740,7 @@ watch(
|
|
|
729
740
|
hasValue.value = true
|
|
730
741
|
} else {
|
|
731
742
|
hasValue.value = false
|
|
743
|
+
value.value = '' // 重置value的值
|
|
732
744
|
}
|
|
733
745
|
},
|
|
734
746
|
{
|