feat:设备管理
This commit is contained in:
@@ -1017,7 +1017,7 @@ export default defineComponent({
|
||||
height: 0;
|
||||
padding: 0;
|
||||
overflow: hidden;
|
||||
font-size: 14px;
|
||||
font-size: 16px;
|
||||
line-height: 1;
|
||||
visibility: hidden;
|
||||
opacity: 0;
|
||||
@@ -1034,8 +1034,8 @@ export default defineComponent({
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
width: 23px;
|
||||
height: 23px;
|
||||
overflow: hidden;
|
||||
|
||||
&--arr {
|
||||
@@ -1163,8 +1163,9 @@ export default defineComponent({
|
||||
}
|
||||
|
||||
&--append {
|
||||
font-size: 60%;
|
||||
opacity: 0.6;
|
||||
font-size: 80%;
|
||||
opacity: 0.7;
|
||||
padding-top: 5px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ const imgs = ref([])
|
||||
const uploadConfig = reactive({
|
||||
baseURL: getBaseUrl(),
|
||||
imgBaseURL: getImgBaseUrl(),
|
||||
header: { 'X-Access-Token': uni.getStorageSync('token') }
|
||||
header: { Authorization: 'Bearer ' + uni.getStorageSync('token') }
|
||||
})
|
||||
|
||||
// 同步外部值到组件
|
||||
@@ -50,10 +50,12 @@ watch(
|
||||
newVal => {
|
||||
if (!newVal) return (fileList.value = [])
|
||||
const urls = Array.isArray(newVal) ? newVal : newVal.split(',')
|
||||
imgs.value = urls
|
||||
imgs.value = urls.map(url => url.previewUrl)
|
||||
fileList.value = urls.map(url => ({
|
||||
url: uploadConfig.imgBaseURL + url,
|
||||
url: url.url,
|
||||
status: 'success',
|
||||
name: url.name,
|
||||
id: url.id,
|
||||
message: ''
|
||||
}))
|
||||
},
|
||||
@@ -82,10 +84,13 @@ const afterRead = async event => {
|
||||
for (let i = 0; i < files.length; i++) {
|
||||
const result = await uploadFile(files[i])
|
||||
const index = initialLength + i
|
||||
console.log(files[i])
|
||||
|
||||
fileList.value[index] = {
|
||||
...files[i],
|
||||
status: 'success',
|
||||
url: uploadConfig.imgBaseURL + result.message
|
||||
url: result.url,
|
||||
name: result.name,
|
||||
id: result.id
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
@@ -100,14 +105,19 @@ const afterRead = async event => {
|
||||
const uploadFile = file => {
|
||||
return new Promise((resolve, reject) => {
|
||||
uni.uploadFile({
|
||||
url: `${uploadConfig.baseURL}/sys/common/upload`,
|
||||
url: `${uploadConfig.baseURL}/infra/file/upload-with-return`,
|
||||
filePath: file.url,
|
||||
name: 'file',
|
||||
header: uploadConfig.header,
|
||||
formData: { biz: 'lims-device' },
|
||||
formData: { encrypt: false },
|
||||
success: res => {
|
||||
if (res.statusCode === 200) {
|
||||
resolve(JSON.parse(res.data))
|
||||
let result = JSON.parse(res.data)
|
||||
if (result.code === 0) {
|
||||
resolve(result.data)
|
||||
} else {
|
||||
reject(new Error(result.msg))
|
||||
}
|
||||
} else {
|
||||
reject(new Error(res.data))
|
||||
}
|
||||
@@ -125,7 +135,7 @@ const formatValue = fileList => {
|
||||
: fileList.map(item => item.url.slice(baseUrlLength))
|
||||
}
|
||||
const updateParent = fileList => {
|
||||
emit('update:modelValue', formatValue(fileList))
|
||||
emit('update:modelValue', fileList)
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user