Skip to content

Commit e94eb75

Browse files
YunaiVgitee-org
authored andcommitted
!84 修改测试所提bug
Merge pull request !84 from 周建/master
2 parents c65a9d9 + c4fc9ee commit e94eb75

File tree

18 files changed

+727
-989
lines changed

18 files changed

+727
-989
lines changed

.gitignore

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,3 @@ dist-ssr
66
/dist*
77
*-lock.*
88
pnpm-debug
9-
10-
.idea
11-
.history

src/views/bpm/form/formEditor.vue

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -133,15 +133,24 @@ const openModel = (title: string) => {
133133
}
134134
/** 复制 **/
135135
const copy = async (text: string) => {
136-
const { copy, copied, isSupported } = useClipboard({ source: text })
137-
if (!isSupported) {
138-
message.error(t('common.copyError'))
139-
} else {
140-
await copy()
141-
if (unref(copied)) {
142-
message.success(t('common.copySuccess'))
143-
}
144-
}
136+
// const { copy, copied, isSupported } = useClipboard({ source: JSON.stringify(text) })
137+
// if (!isSupported.value) {
138+
// message.error(t('common.copyError'))
139+
// } else {
140+
// await copy()
141+
// if (unref(copied.value)) {
142+
// message.success(t('common.copySuccess'))
143+
// }
144+
// }
145+
let url = JSON.stringify(text)
146+
let oInput = document.createElement('textarea')
147+
oInput.value = url
148+
document.body.appendChild(oInput)
149+
oInput.select() // 选择对象;
150+
// console.log(oInput.value)
151+
document.execCommand('Copy') // 执行浏览器复制命令
152+
message.success(t('common.copySuccess'))
153+
oInput.remove()
145154
}
146155
// ========== 初始化 ==========
147156
onMounted(() => {

src/views/infra/build/index.vue

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -77,15 +77,24 @@ const showTemplate = () => {
7777
7878
/** 复制 **/
7979
const copy = async (text: string) => {
80-
const { copy, copied, isSupported } = useClipboard({ source: text })
81-
if (!isSupported) {
82-
message.error(t('common.copyError'))
83-
} else {
84-
await copy()
85-
if (unref(copied)) {
86-
message.success(t('common.copySuccess'))
87-
}
88-
}
80+
// const { copy, copied, isSupported } = useClipboard({ source: JSON.stringify(text) })
81+
// if (!isSupported.value) {
82+
// message.error(t('common.copyError'))
83+
// } else {
84+
// await copy()
85+
// if (unref(copied.value)) {
86+
// message.success(t('common.copySuccess'))
87+
// }
88+
// }
89+
let url = JSON.stringify(text)
90+
let oInput = document.createElement('textarea')
91+
oInput.value = url
92+
document.body.appendChild(oInput)
93+
oInput.select() // 选择对象;
94+
// console.log(oInput.value)
95+
document.execCommand('Copy') // 执行浏览器复制命令
96+
message.success(t('common.copySuccess'))
97+
oInput.remove()
8998
}
9099
91100
const makeTemplate = () => {

src/views/infra/codegen/components/Preview.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,11 +130,11 @@ const handleFiles = (datas: CodegenPreviewVO[]) => {
130130
/** 复制 **/
131131
const copy = async (text: string) => {
132132
const { copy, copied, isSupported } = useClipboard({ source: text })
133-
if (!isSupported) {
133+
if (!isSupported.value) {
134134
message.error(t('common.copyError'))
135135
} else {
136136
await copy()
137-
if (unref(copied)) {
137+
if (unref(copied.value)) {
138138
message.success(t('common.copySuccess'))
139139
}
140140
}

src/views/infra/config/config.data.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ export const rules = reactive({
66
category: [required],
77
name: [required],
88
key: [required],
9-
value: [required]
9+
value: [required],
10+
visible: [{ required: true, message: '请选择是否可见', trigger: 'change' }]
1011
})
1112

1213
// CrudSchema

src/views/infra/config/index.vue

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,8 @@ const message = useMessage() // 消息弹窗
9393
// 列表相关的变量
9494
const [registerTable, { reload, deleteData, exportList }] = useXTable({
9595
allSchemas: allSchemas,
96-
getListApi: ConfigApi.getConfigPageApi,
97-
deleteApi: ConfigApi.deleteConfigApi,
96+
getListApi: ConfigApi.getConfigPage,
97+
deleteApi: ConfigApi.deleteConfig,
9898
exportListApi: ConfigApi.exportConfigApi
9999
})
100100
@@ -127,32 +127,22 @@ const handleCreate = async () => {
127127
},
128128
2
129129
)
130-
unref(formRef)?.addSchema(
131-
{
132-
field: 'value',
133-
label: '参数键值',
134-
component: 'Input'
135-
},
136-
3
137-
)
138130
}
139131
}
140132
141133
// 修改操作
142134
const handleUpdate = async (rowId: number) => {
143135
setDialogTile('update')
144136
// 设置数据
145-
const res = await ConfigApi.getConfigApi(rowId)
137+
const res = await ConfigApi.getConfig(rowId)
146138
unref(formRef)?.delSchema('key')
147-
unref(formRef)?.delSchema('value')
148-
149139
unref(formRef)?.setValues(res)
150140
}
151141
152142
// 详情操作
153143
const handleDetail = async (rowId: number) => {
154144
setDialogTile('detail')
155-
const res = await ConfigApi.getConfigApi(rowId)
145+
const res = await ConfigApi.getConfig(rowId)
156146
detailData.value = res
157147
}
158148
@@ -167,10 +157,10 @@ const submitForm = async () => {
167157
try {
168158
const data = unref(formRef)?.formModel as ConfigApi.ConfigVO
169159
if (actionType.value === 'create') {
170-
await ConfigApi.createConfigApi(data)
160+
await ConfigApi.createConfig(data)
171161
message.success(t('common.createSuccess'))
172162
} else {
173-
await ConfigApi.updateConfigApi(data)
163+
await ConfigApi.updateConfig(data)
174164
message.success(t('common.updateSuccess'))
175165
}
176166
dialogVisible.value = false

src/views/infra/fileList/index.vue

Lines changed: 30 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959
:on-exceed="handleExceed"
6060
:on-success="handleFileSuccess"
6161
:on-error="excelUploadError"
62+
:on-change="handleFileChange"
6263
:before-remove="beforeRemove"
6364
:auto-upload="false"
6465
accept=".jpg, .png, .gif"
@@ -83,7 +84,7 @@
8384
</XModal>
8485
</template>
8586
<script setup lang="ts" name="FileList">
86-
import type { UploadInstance, UploadRawFile, UploadProps } from 'element-plus'
87+
import type { UploadInstance, UploadRawFile, UploadProps, UploadFile } from 'element-plus'
8788
// 业务相关的 import
8889
import { allSchemas } from './fileList.data'
8990
import * as FileApi from '@/api/infra/fileList'
@@ -119,9 +120,11 @@ const beforeUpload = (file: UploadRawFile) => {
119120
return isImg && isLt5M
120121
}
121122
// 处理上传的文件发生变化
122-
// const handleFileChange = (uploadFile: UploadFile): void => {
123-
// uploadRef.value.data.path = uploadFile.name
124-
// }
123+
const handleFileChange = (uploadFile: UploadFile): void => {
124+
// uploadRef.value.data.path = uploadFile.name
125+
console.log(uploadFile, 'uploadFile')
126+
uploadDisabled.value = false
127+
}
125128
// 文件上传
126129
const submitFileForm = () => {
127130
uploadHeaders.value = {
@@ -148,10 +151,12 @@ const beforeRemove: UploadProps['beforeRemove'] = () => {
148151
// 文件数超出提示
149152
const handleExceed = (): void => {
150153
message.error('最多只能上传一个文件!')
154+
uploadDisabled.value = false
151155
}
152156
// 上传错误提示
153157
const excelUploadError = (): void => {
154158
message.error('导入数据失败,请您重新上传!')
159+
uploadDisabled.value = false
155160
}
156161
157162
// 详情操作
@@ -164,14 +169,26 @@ const handleDetail = (row: FileApi.FileVO) => {
164169
165170
// ========== 复制相关 ==========
166171
const handleCopy = async (text: string) => {
167-
const { copy, copied, isSupported } = useClipboard({ source: text })
168-
if (!isSupported) {
169-
message.error(t('common.copyError'))
170-
} else {
171-
await copy()
172-
if (unref(copied)) {
173-
message.success(t('common.copySuccess'))
174-
}
175-
}
172+
let url = text
173+
let oInput = document.createElement('textarea')
174+
oInput.value = url
175+
document.body.appendChild(oInput)
176+
oInput.select() // 选择对象;
177+
// console.log(oInput.value)
178+
document.execCommand('Copy') // 执行浏览器复制命令
179+
message.success(t('common.copySuccess'))
180+
oInput.remove()
181+
// const { copy, copied, isSupported } = useClipboard({ source: text, read: true })
182+
// console.log(copy, 'copycopycopy')
183+
// console.log(copied, 'copiedcopiedcopied')
184+
// console.log(isSupported, 'isSupportedisSupportedisSupported')
185+
// if (!isSupported.value) {
186+
// message.error(t('common.copyError'))
187+
// } else {
188+
// await copy()
189+
// if (unref(copied.value)) {
190+
// message.success(t('common.copySuccess'))
191+
// }
192+
// }
176193
}
177194
</script>

0 commit comments

Comments
 (0)