update 企标稽查计划-业务信息调整前端存储
This commit is contained in:
+106
-6
@@ -18,7 +18,7 @@
|
|||||||
:columns="columns"
|
:columns="columns"
|
||||||
:dataSource="dataSource"
|
:dataSource="dataSource"
|
||||||
:can-drag="true"
|
:can-drag="true"
|
||||||
rowKey="id"
|
:rowKey="(row, index) => row.id || index"
|
||||||
:loading="loading"
|
:loading="loading"
|
||||||
:pagination="false"
|
:pagination="false"
|
||||||
:row-selection="hasTableOperator ? { selectedRowKeys: selectedRowKeys, onChange: onSelectChange, getCheckboxProps } : null"
|
:row-selection="hasTableOperator ? { selectedRowKeys: selectedRowKeys, onChange: onSelectChange, getCheckboxProps } : null"
|
||||||
@@ -63,7 +63,7 @@
|
|||||||
<!-- 节点2:填写意见、意见回显 -->
|
<!-- 节点2:填写意见、意见回显 -->
|
||||||
<write-opinion-modal ref="writeOpinionModal" @ok="handleWriteOpinionCallback"/>
|
<write-opinion-modal ref="writeOpinionModal" @ok="handleWriteOpinionCallback"/>
|
||||||
<!-- 节点3:所属部门意见-查看 -->
|
<!-- 节点3:所属部门意见-查看 -->
|
||||||
<show-opinion-modal ref="showOpinionModal" @ok="modalFormOk"/>
|
<show-opinion-modal ref="showOpinionModal"/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -74,7 +74,10 @@ import InspectionPlanDrawer from '@views/workCenter/enterpriseStandardInspection
|
|||||||
import WriteOpinionModal from '@views/workCenter/enterpriseStandardInspectionPlan/modules/WriteOpinionModal'
|
import WriteOpinionModal from '@views/workCenter/enterpriseStandardInspectionPlan/modules/WriteOpinionModal'
|
||||||
import ShowOpinionModal from '@views/workCenter/enterpriseStandardInspectionPlan/modules/ShowOpinionModal'
|
import ShowOpinionModal from '@views/workCenter/enterpriseStandardInspectionPlan/modules/ShowOpinionModal'
|
||||||
import { EsInspectionPlan } from '@/enums/commonEnums'
|
import { EsInspectionPlan } from '@/enums/commonEnums'
|
||||||
|
import Vue from 'vue'
|
||||||
|
import { ACCESS_TOKEN } from '@/store/mutation-types'
|
||||||
|
import store from '@/store'
|
||||||
|
let importModalLoading
|
||||||
export default {
|
export default {
|
||||||
name: 'InspectionPlanTable',
|
name: 'InspectionPlanTable',
|
||||||
components: { ShowOpinionModal, WriteOpinionModal, InspectionPlanDrawer, JTable },
|
components: { ShowOpinionModal, WriteOpinionModal, InspectionPlanDrawer, JTable },
|
||||||
@@ -98,9 +101,13 @@ export default {
|
|||||||
url: {
|
url: {
|
||||||
list: '/process/processEsInspectPlan/list',
|
list: '/process/processEsInspectPlan/list',
|
||||||
delete: '/process/processEsInspectPlan/delete',
|
delete: '/process/processEsInspectPlan/delete',
|
||||||
importExcelUrl: '/process/processEsInspectPlan/importExcel',
|
|
||||||
deleteBatch: '/process/processEsInspectPlan/deleteBatch',
|
deleteBatch: '/process/processEsInspectPlan/deleteBatch',
|
||||||
downTemplateUrl: '/process/processEsInspectPlan/templateDownload'
|
// 默认是发起节点的导入和 下载模板,如果是节点2就用没有 征求意见对象 的模板和导入接口
|
||||||
|
importExcelUrl: '/process/processEsInspectPlan/importExcelByStart',
|
||||||
|
downTemplateUrl: '/process/processEsInspectPlan/templateDownloadByStart',
|
||||||
|
// 节点2 的导入和下载模板
|
||||||
|
nodeTwoImportUrl: '/process/processEsInspectPlan/importExcelByOpinionFill',
|
||||||
|
nodeTwoDownTemplateUrl: '/process/processEsInspectPlan/templateDownloadByStartByOpinionFill'
|
||||||
},
|
},
|
||||||
model: {},
|
model: {},
|
||||||
dataSource: [],
|
dataSource: [],
|
||||||
@@ -238,6 +245,17 @@ export default {
|
|||||||
}
|
}
|
||||||
this.loadData()
|
this.loadData()
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
// 监听当前节点变化
|
||||||
|
currentNode: {
|
||||||
|
immediate: true,
|
||||||
|
handler () {
|
||||||
|
// 节点2填写意见,用没有“征求意见对象”的模板和导入接口
|
||||||
|
if (this.currentNode === EsInspectionPlan.fillInComments.value) {
|
||||||
|
this.url.importExcelUrl = this.url.nodeTwoImportUrl
|
||||||
|
this.url.downTemplateUrl = this.url.nodeTwoDownTemplateUrl
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@@ -245,7 +263,7 @@ export default {
|
|||||||
currentUserName () {
|
currentUserName () {
|
||||||
return this.$store.getters.userInfo.username
|
return this.$store.getters.userInfo.username
|
||||||
},
|
},
|
||||||
// 是否显示表格操作按钮
|
// 是否前两个节点:显示表格操作按钮
|
||||||
hasTableOperator () {
|
hasTableOperator () {
|
||||||
const arr = [
|
const arr = [
|
||||||
EsInspectionPlan.initiate.value,
|
EsInspectionPlan.initiate.value,
|
||||||
@@ -345,6 +363,88 @@ export default {
|
|||||||
// 查看所属部门意见
|
// 查看所属部门意见
|
||||||
showDepartOpinion (record) {
|
showDepartOpinion (record) {
|
||||||
this.$refs.showOpinionModal.show(record)
|
this.$refs.showOpinionModal.show(record)
|
||||||
|
},
|
||||||
|
/* 导入 */
|
||||||
|
handleImportExcel (info) {
|
||||||
|
// 限制导入大于500MB
|
||||||
|
if (info.file.size > 1024 * 1024 * 500) {
|
||||||
|
this.$message.error('导入文件最大500MB!')
|
||||||
|
info.fileList.pop()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
// 加一个大的提示
|
||||||
|
if (!this.loading) {
|
||||||
|
importModalLoading = this.$info({
|
||||||
|
title: '提示',
|
||||||
|
content: <span>正在导入,请稍候 <a-spin size="small" /></span>,
|
||||||
|
keyboard: false
|
||||||
|
})
|
||||||
|
}
|
||||||
|
this.loading = true
|
||||||
|
// 把知道了这个按钮去掉
|
||||||
|
this.$nextTick(() => {
|
||||||
|
document.getElementsByClassName('ant-modal-confirm-btns')[0].style = 'display:none'
|
||||||
|
})
|
||||||
|
if (info.file.status !== 'uploading') {
|
||||||
|
console.log(info.file, info.fileList)
|
||||||
|
}
|
||||||
|
if (info.file.status === 'done') {
|
||||||
|
// 销毁这个提示
|
||||||
|
importModalLoading && importModalLoading.destroy()
|
||||||
|
this.loading = false
|
||||||
|
if (info.file.response.success) {
|
||||||
|
// this.$message.success(`${info.file.name} 文件上传成功`);
|
||||||
|
if (info.file.response.code === 201) {
|
||||||
|
const { message, result: { msg, fileUrl, fileName } } = info.file.response
|
||||||
|
const href = window._CONFIG.domianURL + fileUrl
|
||||||
|
this.$warning({
|
||||||
|
title: message,
|
||||||
|
content: (<div>
|
||||||
|
<span>{msg}</span><br />
|
||||||
|
<span>具体详情请 <a href={href} target="_blank" download={fileName}>点击下载</a> </span>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
this.$message.success(info.file.response.message || `${info.file.name} 文件上传成功`)
|
||||||
|
}
|
||||||
|
// 前端存储
|
||||||
|
const data = info.file.response.result || []
|
||||||
|
this.dataSource.push(...data)
|
||||||
|
} else {
|
||||||
|
if (Array.isArray(info.file.response.result) && info.file.response.result.length > 0) {
|
||||||
|
this.messageLineFeed(this.$t('fileImportError'), info.file.response.result)
|
||||||
|
} else if (/<br>|<\/br>|<br\/>/.test(info.file.response.message)) {
|
||||||
|
this.messageLineFeedByBr(this.$t('fileImportError'), info.file.response.message)
|
||||||
|
} else {
|
||||||
|
this.$message.warning(`${info.file.name} ${info.file.response.message}`)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (info.file.status === 'error') {
|
||||||
|
// 销毁这个提示
|
||||||
|
importModalLoading && importModalLoading.destroy()
|
||||||
|
this.loading = false
|
||||||
|
if (info.file.response.status === 500) {
|
||||||
|
const data = info.file.response
|
||||||
|
const token = Vue.ls.get(ACCESS_TOKEN)
|
||||||
|
if (token && data.message.includes('Token失效')) {
|
||||||
|
this.error({
|
||||||
|
title: '登录已过期',
|
||||||
|
content: '很抱歉,登录已过期,请重新登录',
|
||||||
|
okText: '重新登录',
|
||||||
|
mask: false,
|
||||||
|
onOk: () => {
|
||||||
|
store.dispatch('Logout').then(() => {
|
||||||
|
Vue.ls.remove(ACCESS_TOKEN)
|
||||||
|
window.location.reload()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.$message.warning(`文件上传失败: ${info.file.msg} `)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user