| | |
| | | <el-dialog title="附件查看" :visible.sync="isShow" width="80%" @closed="$emit('closeFilesLook')"> |
| | | <div style="display: flex;justify-content: space-between;"> |
| | | <ul class="tab"> |
| | | <li v-for="(m,i) in dataVisibleTitle" :key="i" :class="{active:i===dataVisibleIndex}" @click="handleDataVisibleTab(m,i)">{{m.label}}</li> |
| | | <li v-for="(m, i) in dataVisibleTitle" :key="i" :class="{ active: i === dataVisibleIndex }" |
| | | @click="handleDataVisibleTab(m, i)">{{ m.label }}</li> |
| | | </ul> |
| | | <el-upload :action="action" |
| | | :auto-upload="true" |
| | | :data="{orderId: dataVisibleIndex === 0 ? filesLookInfo.enterOrderId : filesLookInfo.quarterOrderId}" |
| | | :on-success="handleSuccessUp" :show-file-list="false" |
| | | accept='.jpg,.jpeg,.png,.gif,.doc,.docx,.xls,.xlsx,.ppt,.pptx,.pdf,.zip,.rar' :headers="headers" |
| | | :before-upload="beforeUpload" |
| | | style="width: 80px !important;" |
| | | :on-error="onError" ref='upload'> |
| | | <el-upload :action="action" :auto-upload="true" |
| | | :data="{ orderId: dataVisibleIndex === 0 ? filesLookInfo.enterOrderId : filesLookInfo.quarterOrderId }" |
| | | :on-success="handleSuccessUp" :show-file-list="false" |
| | | accept='.jpg,.jpeg,.png,.gif,.doc,.docx,.xls,.xlsx,.ppt,.pptx,.pdf,.zip,.rar' :headers="uploadHeader" |
| | | :before-upload="beforeUpload" style="width: 80px !important;" :on-error="onError" ref='upload'> |
| | | <el-button size="small" type="primary" style="height: 38px">附件上传</el-button> |
| | | </el-upload> |
| | | </div> |
| | | <div v-if="filesDialogVisible"> |
| | | <lims-table :tableData="tableData" :column="column" |
| | | @pagination="pagination" height="500px" key="tableData" |
| | | :page="page" :tableLoading="tableLoading"></lims-table> |
| | | <lims-table :tableData="tableDataFile" :column="columnFile" @pagination="paginationFile" height="500px" |
| | | key="tableDataFile" :page="pageFile" :tableLoading="tableLoadingFile"></lims-table> |
| | | </div> |
| | | </el-dialog> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | import ValueTable from "@/components/Table/value-table.vue"; |
| | | import file from "@/utils/file"; |
| | | import limsTable from "@/components/Table/lims-table.vue"; |
| | | import {delfile, downFile, getFileList} from "@/api/business/rawMaterialOrder"; |
| | | |
| | | import { delFile, downFile, getFileList } from "@/api/business/rawMaterialOrder"; |
| | | export default { |
| | | name: "filesLookVisible", |
| | | // import 引入的组件需要注入到对象中才能使用 |
| | | components: {limsTable, ValueTable}, |
| | | components: { limsTable }, |
| | | props: { |
| | | filesDialogVisible: { |
| | | type: Boolean, |
| | |
| | | }, |
| | | filesLookInfo: { |
| | | type: Object, |
| | | default: () => {} |
| | | default: () => { } |
| | | }, |
| | | }, |
| | | data() { |
| | | // 这里存放数据 |
| | | return { |
| | | tableData: [], |
| | | tableLoading: false, |
| | | column: [ |
| | | tableDataFile: [], |
| | | tableLoadingFile: false, |
| | | columnFile: [ |
| | | { |
| | | dataType: 'tag', |
| | | label: '类型', |
| | | prop: 'type', |
| | | formatData: (params) => { |
| | | if (params == 1) { |
| | | return '合格' |
| | | } else if (params == 0) { |
| | | return '不合格' |
| | | } else if (params == 3) { |
| | | return '不判定' |
| | | return '图片' |
| | | } else if (params == 2) { |
| | | return '文件' |
| | | } else { |
| | | return '' |
| | | } |
| | |
| | | formatType: (params) => { |
| | | if (params == 1) { |
| | | return 'success' |
| | | } else if (params == 0) { |
| | | return 'danger' |
| | | } else if (params == 3) { |
| | | return '' |
| | | } else { |
| | | } else if (params == 2) { |
| | | return 'warning' |
| | | } else { |
| | | return '' |
| | | } |
| | | } |
| | | }, |
| | | {label: '附件名称', prop: 'fileName'}, |
| | | {label: '上传人', prop: 'name'}, |
| | | {label: '上传时间', prop: 'createTime'}, |
| | | { label: '附件名称', prop: 'fileName' }, |
| | | { label: '上传人', prop: 'name' }, |
| | | { label: '上传时间', prop: 'createTime' }, |
| | | { |
| | | dataType: 'action', |
| | | fixed: 'right', |
| | |
| | | ] |
| | | } |
| | | ], |
| | | page: { |
| | | total:0, |
| | | size:10, |
| | | current:1 |
| | | pageFile: { |
| | | total: 0, |
| | | size: 10, |
| | | current: 1 |
| | | }, |
| | | isShow: this.filesDialogVisible, |
| | | dataVisibleTitle: [ |
| | |
| | | value: 0 |
| | | }, |
| | | { |
| | | label: '季度检验', |
| | | label: '可靠性检验', |
| | | value: 1 |
| | | }, |
| | | ], |
| | | dataVisibleIndex: 0, // tab栏选择值 |
| | | entity: { |
| | | insOrderId:'' |
| | | insOrderId: '' |
| | | }, |
| | | } |
| | | }, |
| | | mounted() { |
| | | this.refreshTable() |
| | | this.getFileList() |
| | | }, |
| | | // 方法集合 |
| | | methods: { |
| | | // 切换数据查看tab栏 |
| | | handleDataVisibleTab (m, i) { |
| | | handleDataVisibleTab(m, i) { |
| | | this.dataVisibleIndex = i |
| | | this.refreshTable() |
| | | this.getFileList() |
| | | }, |
| | | // 查询回调 |
| | | refreshTable() { |
| | | getFileList() { |
| | | if (this.dataVisibleIndex === 0) { |
| | | this.entity.insOrderId = this.filesLookInfo.enterOrderId |
| | | } else { |
| | | this.entity.insOrderId = this.filesLookInfo.quarterOrderId |
| | | } |
| | | this.tableLoading = true |
| | | const params = {...this.entity} |
| | | this.tableLoadingFile = true |
| | | const params = { ...this.entity } |
| | | getFileList(params).then(res => { |
| | | this.tableLoading = false |
| | | this.tableLoadingFile = false |
| | | if (res.code === 200) { |
| | | this.tableData = res.data.records |
| | | this.page.total = res.data.total |
| | | this.tableDataFile = res.data.records |
| | | this.pageFile.total = res.data.total |
| | | } |
| | | }).catch(err => { |
| | | this.tableLoading = false |
| | | this.tableLoadingFile = false |
| | | }) |
| | | }, |
| | | pagination (page) { |
| | | this.page.size = page.limit |
| | | this.refreshTable() |
| | | paginationFile(page) { |
| | | this.pageFile.size = page.limit |
| | | this.getFileList() |
| | | }, |
| | | // 下载 |
| | | handleDown(row){ |
| | | downFile({id: row.id,}).then(res => { |
| | | if (res.code === 200) { |
| | | let url = ''; |
| | | if(res.data.type==1){ |
| | | url = this.javaApi+'/img/'+res.data.fileUrl |
| | | file.downloadIamge(url,row.fileName) |
| | | }else{ |
| | | url = this.javaApi+'/word/'+res.data.fileUrl |
| | | const link = document.createElement('a'); |
| | | link.href = url; |
| | | link.download = row.fileName; |
| | | link.click(); |
| | | } |
| | | } |
| | | handleDown(row) { |
| | | downFile({ id: row.id, }).then(res => { |
| | | this.$download.saveAs(res.data.fileUrl, row.fileName); |
| | | }).catch(error => { |
| | | |
| | | }) |
| | | }, |
| | | handleSuccessUp(response, ) { |
| | | handleSuccessUp(response,) { |
| | | this.upLoading = false; |
| | | if (response.code == 200) { |
| | | this.$message.success('上传成功'); |
| | | this.$refs.fileList.selectList() |
| | | this.getFileList() |
| | | } else { |
| | | this.$message.error(response.msg); |
| | | } |
| | | }, |
| | | beforeUpload(file) { |
| | |
| | | this.$refs.upload.clearFiles() |
| | | }, |
| | | // 删除 |
| | | delete (row) { |
| | | delete(row) { |
| | | this.$confirm('是否删除当前数据?', "警告", { |
| | | confirmButtonText: "确定", |
| | | cancelButtonText: "取消", |
| | | type: "warning" |
| | | }).then(() => { |
| | | delfile({id: row.id}).then(res => { |
| | | if (res.code === 500) { |
| | | return |
| | | } |
| | | delFile({ id: row.id }).then(res => { |
| | | this.$message.success('删除成功') |
| | | this.getList() |
| | | }).catch(e => { |
| | | this.$message.error('删除失败') |
| | | this.getFileList() |
| | | }) |
| | | }).catch(() => {}) |
| | | }).catch(() => { }) |
| | | } |
| | | }, |
| | | computed: { |
| | | headers() { |
| | | return { |
| | | 'token': sessionStorage.getItem('token') |
| | | } |
| | | }, |
| | | action() { |
| | | return this.javaApi + '/insOrderPlan/uploadFile' |
| | | } |