@@ -237,6 +237,32 @@ export default { | |||
return await this.HTTP_GET('learun/adms/annexes/wxlist', folderId) | |||
}, | |||
// 根据文件夹id获取图片列表 | |||
async getFileListById(folderId){ | |||
if(!folderId){ | |||
return [] | |||
} | |||
let wxlist = await this.FETCH_FILEList(folderId),fileList = [] | |||
for (const wxfile of wxlist) { | |||
const fileInfo = await this.FETCH_FILEINFO(wxfile.F_Id) | |||
if (!fileInfo) { | |||
continue | |||
} | |||
const fileType = fileInfo.F_FileType | |||
const fileSize = fileInfo.F_FileSize | |||
const path = this.API + '/learun/adms/annexes/wxdown?' + this.URL_QUERY(wxfile.F_Id, true) | |||
fileList.push({ | |||
path, | |||
type: fileType, | |||
uid:wxfile.F_Id, | |||
folderId:wxfile.F_FolderId, | |||
size: fileSize | |||
}) | |||
} | |||
return fileList | |||
}, | |||
// 封装的 GET 请求,集成了验证信息 | |||
// 返回请求结果或 null | |||
@@ -2,7 +2,7 @@ | |||
<view class="cu-form-group"> | |||
<view class="grid col-4 grid-square flex-sub"> | |||
<view v-for="(item, index) in imgList" @tap="viewImg(item)" :key="index" class="bg-img"> | |||
<image v-if="showfile()&&isImage(item.type)" :src="CONFIG('webHost') + item.url" mode="aspectFill"> | |||
<image v-if="showfile()&&item&&(typeof item == "string"||isImage(item.type))" :src="item.url?CONFIG('webHost') + item.url:item" mode="aspectFill"> | |||
</image> | |||
<l-icon v-if="showfile()&&!isImage(item.type)" type="text" /> | |||
<text class="file-name">{{item.name}}</text> | |||
@@ -33,7 +33,7 @@ | |||
<l-customlist-action @view="action('view', item.MESSAGEID)" showDelete @delete="action('delete', item.MESSAGEID)" showEdit="true" @edit="action('edit', item.MESSAGEID)" /> | |||
<l-customlist-action @view="action('view', item.MESSAGEID)" :showDelete="false" @delete="action('delete', item.MESSAGEID)" :showEdit="false" @edit="action('edit', item.MESSAGEID)" /> | |||
</view> | |||
</l-customlist> | |||
</l-scroll-list> | |||
@@ -26,9 +26,6 @@ | |||
:disabled="!edit" | |||
title="收件时间" | |||
/> | |||
<!-- [API + '/learun/adms/annexes/wxdown?' + URL_QUERY(setValue('SYS_ReceiveMessage.URL', $event), true)] --> | |||
<!-- getValue('SYS_ReceiveMessage.URL',$event) getValue('SYS_ReceiveMessage.URL') --> | |||
<!-- @input="fileList" --> | |||
<l-upload-file | |||
v-if="ready" | |||
:value="fileList" | |||
@@ -49,7 +46,7 @@ | |||
</view> | |||
</view> | |||
<view v-if="ready" class="bg-white margin-tb padding" style="padding-top: 0; overflow: hidden;"> | |||
<l-button v-if="edit" @click="action('save')" size="lg" color="green" class="block margin-top" block> | |||
<!-- <l-button v-if="edit" @click="action('save')" size="lg" color="green" class="block margin-top" block> | |||
提交保存 | |||
</l-button> | |||
<l-button v-if="!edit && mode !== 'create'" @click="action('edit')" size="lg" line="orange" class="block margin-top" block> | |||
@@ -60,7 +57,7 @@ | |||
</l-button> | |||
<l-button v-if="!edit && mode !== 'create'" @click="action('delete')" size="lg" line="red" class="block margin-top" block> | |||
删除 | |||
</l-button> | |||
</l-button> --> | |||
</view> | |||
</view> | |||
</template> | |||
@@ -161,26 +158,7 @@ export default { | |||
} else { | |||
const result = await this.HTTP_GET('learun/adms/EducationalAdministration/SYS_ReceiveMessage/form', this.id) | |||
if(result){ | |||
let wxlist = await this.FETCH_FILEList(result.SYS_ReceiveMessage.FilePath),fileList = [] | |||
for (const wxfile of wxlist) { | |||
const fileInfo = await this.FETCH_FILEINFO(wxfile.F_Id) | |||
if (!fileInfo) { | |||
continue | |||
} | |||
const fileType = fileInfo.F_FileType | |||
const fileSize = fileInfo.F_FileSize | |||
const path = this.API + '/learun/adms/annexes/wxdown?' + this.URL_QUERY(wxfile.F_Id, true) | |||
fileList.push({ | |||
path, | |||
type: fileType, | |||
uid:wxfile.F_Id, | |||
folderId:wxfile.F_FolderId, | |||
size: fileSize | |||
}) | |||
} | |||
let fileList = await this.getFileListById(result.SYS_ReceiveMessage.FilePath) | |||
console.log(fileList) | |||
this.fileList = fileList | |||
@@ -189,7 +167,6 @@ export default { | |||
}else{ | |||
return | |||
} | |||
} | |||
this.current = this.COPY(this.origin) | |||
}, | |||
@@ -207,11 +184,14 @@ export default { | |||
break | |||
case 'save': | |||
console.log(this.fileList) | |||
// return | |||
const verifyResult = this.verifyForm() | |||
if (verifyResult.length > 0) { | |||
this.CONFIRM('表单验证失败', verifyResult.join('\n')) | |||
return | |||
} | |||
} | |||
if (!(await this.CONFIRM('提交确认', '确定要提交本页表单内容吗?', true))) { | |||
return | |||
@@ -42,7 +42,7 @@ | |||
</view> | |||
<l-customlist-action :showEdit="false" @edit="action('edit', item.RFileId)" showDelete @delete="action('delete', item.RFileId)" @view="action('view', item.RFileId)" /> | |||
<l-customlist-action :showEdit="false" @edit="action('edit', item.RFileId)" :showDelete="false" @delete="action('delete', item.RFileId)" @view="action('view', item.RFileId)" /> | |||
</view> | |||
</l-customlist> | |||
</l-scroll-list> | |||
@@ -33,12 +33,19 @@ | |||
:range="dataSource.Sys_ReceiveFile.SendType" | |||
title="接收对象" | |||
/> | |||
<l-upload-file | |||
<!-- <l-upload-file | |||
@input="setValue('Sys_ReceiveFile.RUrl', $event)" | |||
:value="getValue('Sys_ReceiveFile.RUrl')" | |||
:readonly="!edit" | |||
:number="9" | |||
title="附件上传" | |||
/> --> | |||
<l-upload-file | |||
v-if="ready" | |||
:value="fileList" | |||
:readonly="!edit" | |||
:number="9" | |||
title="附件上传" | |||
/> | |||
<!-- <l-textarea | |||
@input="setValue('Sys_ReceiveFile.Contents', $event)" | |||
@@ -54,7 +61,7 @@ | |||
</view> | |||
</view> | |||
<view v-if="ready" class="bg-white margin-tb padding" style="padding-top: 0; overflow: hidden;"> | |||
<!-- <l-button v-if="edit" @click="action('save')" size="lg" color="green" class="block margin-top" block> | |||
<!-- <l-button v-if="edit" @click="action('save')" size="lg" color="green" class="block margin-top" block> | |||
提交保存 | |||
</l-button> | |||
<l-button v-if="!edit && mode !== 'create'" @click="action('edit')" size="lg" line="orange" class="block margin-top" block> | |||
@@ -62,10 +69,10 @@ | |||
</l-button> | |||
<l-button v-if="edit && mode !== 'create'" @click="action('reset')" size="lg" line="red" class="block margin-top" block> | |||
取消编辑 | |||
</l-button> --> | |||
</l-button> | |||
<l-button v-if="!edit && mode !== 'create'" @click="action('delete')" size="lg" line="red" class="block margin-top" block> | |||
删除 | |||
</l-button> | |||
</l-button> --> | |||
</view> | |||
</view | |||
> | |||
@@ -102,6 +109,7 @@ export default { | |||
edit: null, | |||
ready: false, // 表单数据 | |||
current: {}, | |||
fileList:[], | |||
origin: {}, // 表单项数据结构 | |||
scheme: { | |||
Sys_ReceiveFile: { | |||
@@ -152,6 +160,7 @@ export default { | |||
"learun/adms/EducationalAdministration/Sys_ReceiveFile/form", | |||
this.id | |||
); | |||
this.fileList = await this.getFileListById(result.Sys_ReceiveFile.FilePath) | |||
this.origin = await this.formatFormData(result); | |||
} | |||
this.current = this.COPY(this.origin); | |||