|
@@ -179,11 +179,11 @@
|
|
|
computed: {
|
|
computed: {
|
|
|
// 判断初步意见是否需要置灰(currentNode === 'yjfk' && status === '已反馈')
|
|
// 判断初步意见是否需要置灰(currentNode === 'yjfk' && status === '已反馈')
|
|
|
isPreliminaryDisabled() {
|
|
isPreliminaryDisabled() {
|
|
|
- return this.currentNode === 'yjfk' && this.currentStatus === '已反馈'
|
|
|
|
|
|
|
+ return this.currentNode === 'yjfk' && this.currentStatus === '260'
|
|
|
},
|
|
},
|
|
|
// 判断结论意见是否可编辑(currentNode === 'yjfk' && status === '已反馈')
|
|
// 判断结论意见是否可编辑(currentNode === 'yjfk' && status === '已反馈')
|
|
|
isConclusionEditable() {
|
|
isConclusionEditable() {
|
|
|
- return this.currentNode === 'yjfk' && this.currentStatus === '已反馈'
|
|
|
|
|
|
|
+ return this.currentNode === 'yjfk' && this.currentStatus === '260'
|
|
|
},
|
|
},
|
|
|
},
|
|
},
|
|
|
watch: {
|
|
watch: {
|
|
@@ -195,6 +195,7 @@
|
|
|
},
|
|
},
|
|
|
},
|
|
},
|
|
|
mounted() {
|
|
mounted() {
|
|
|
|
|
+ console.log(this.currentStatus, '意见反馈this.currentStatus')
|
|
|
// 组件挂载时,如果有 id,获取数据
|
|
// 组件挂载时,如果有 id,获取数据
|
|
|
if (this.id) {
|
|
if (this.id) {
|
|
|
this.getPreliminaryOpinionData()
|
|
this.getPreliminaryOpinionData()
|
|
@@ -418,10 +419,85 @@
|
|
|
fileUrl = file.savePath
|
|
fileUrl = file.savePath
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- if (fileUrl) {
|
|
|
|
|
- window.open(fileUrl, '_blank')
|
|
|
|
|
- } else {
|
|
|
|
|
- this.$message.warning('文件地址无效')
|
|
|
|
|
|
|
+ if (!fileUrl) {
|
|
|
|
|
+ this.$message &&
|
|
|
|
|
+ this.$message.warning &&
|
|
|
|
|
+ this.$message.warning('文件地址无效')
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ const normalized = this.normalizeUrl(fileUrl)
|
|
|
|
|
+ const suggestName =
|
|
|
|
|
+ (file && (file.name || file.fileName)) ||
|
|
|
|
|
+ this.getFileName(file) ||
|
|
|
|
|
+ '下载文件'
|
|
|
|
|
+ this.downloadByFetch(normalized, suggestName).catch((e) => {
|
|
|
|
|
+ console.error('文件下载失败: ', e)
|
|
|
|
|
+ })
|
|
|
|
|
+ },
|
|
|
|
|
+ normalizeUrl(u) {
|
|
|
|
|
+ if (!u) return ''
|
|
|
|
|
+ if (/^https?:\/\//i.test(u)) return u
|
|
|
|
|
+ const base = (window.context && window.context.form) || ''
|
|
|
|
|
+ if (!base) return u
|
|
|
|
|
+ if (u.startsWith('/')) return base + u
|
|
|
|
|
+ return base.replace(/\/$/, '') + '/' + u
|
|
|
|
|
+ },
|
|
|
|
|
+ extractFileName(contentDisposition) {
|
|
|
|
|
+ if (!contentDisposition) return ''
|
|
|
|
|
+ const match = /filename[^;=\n]*=((['"])?.*?\2|[^;\n]*)/i.exec(
|
|
|
|
|
+ contentDisposition
|
|
|
|
|
+ )
|
|
|
|
|
+ if (match && match[1]) {
|
|
|
|
|
+ try {
|
|
|
|
|
+ return decodeURIComponent(match[1].replace(/['"]/g, ''))
|
|
|
|
|
+ } catch (e) {
|
|
|
|
|
+ return match[1].replace(/['"]/g, '')
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ return ''
|
|
|
|
|
+ },
|
|
|
|
|
+ async downloadByFetch(rawUrl, fallbackName) {
|
|
|
|
|
+ const url = this.normalizeUrl(rawUrl)
|
|
|
|
|
+ let loading
|
|
|
|
|
+ try {
|
|
|
|
|
+ loading = this.$baseLoading
|
|
|
|
|
+ ? this.$baseLoading(1, '文件下载中...')
|
|
|
|
|
+ : this.$loading({
|
|
|
|
|
+ lock: true,
|
|
|
|
|
+ text: '文件下载中...',
|
|
|
|
|
+ spinner: 'el-icon-loading',
|
|
|
|
|
+ background: 'rgba(0,0,0,0.7)',
|
|
|
|
|
+ })
|
|
|
|
|
+ const res = await fetch(url, { method: 'GET' })
|
|
|
|
|
+ if (!res.ok) throw new Error('下载失败')
|
|
|
|
|
+ const blob = await res.blob()
|
|
|
|
|
+ let fileName =
|
|
|
|
|
+ this.extractFileName(res.headers.get('content-disposition')) ||
|
|
|
|
|
+ fallbackName ||
|
|
|
|
|
+ '下载文件'
|
|
|
|
|
+ if (!/\.[a-zA-Z0-9]+$/.test(fileName)) {
|
|
|
|
|
+ const extFromUrl = (
|
|
|
|
|
+ url.split('?')[0].split('#')[0].split('.').pop() || ''
|
|
|
|
|
+ ).toLowerCase()
|
|
|
|
|
+ fileName = extFromUrl ? `${fileName}.${extFromUrl}` : fileName
|
|
|
|
|
+ }
|
|
|
|
|
+ const objectUrl = window.URL.createObjectURL(blob)
|
|
|
|
|
+ const link = document.createElement('a')
|
|
|
|
|
+ link.style.display = 'none'
|
|
|
|
|
+ link.href = objectUrl
|
|
|
|
|
+ link.download = fileName
|
|
|
|
|
+ document.body.appendChild(link)
|
|
|
|
|
+ link.click()
|
|
|
|
|
+ document.body.removeChild(link)
|
|
|
|
|
+ window.URL.revokeObjectURL(objectUrl)
|
|
|
|
|
+ this.$message &&
|
|
|
|
|
+ this.$message.success &&
|
|
|
|
|
+ this.$message.success('开始下载文件')
|
|
|
|
|
+ } catch (e) {
|
|
|
|
|
+ console.log(e.message || '文件下载失败')
|
|
|
|
|
+ } finally {
|
|
|
|
|
+ if (loading && loading.close) loading.close()
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
},
|
|
},
|