123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177 |
- <template>
- <span>
- <a-modal
- ref="auditMattersExportModal"
- :body-style="bodyStyle"
- :title="title"
- :destroy-on-close="true"
- :visible="visible"
- :width="modalWidth"
- @ok="handleOk"
- @cancel="handleCancel"
- >
- <a-form>
- <div style="width:80%;margin-left: 10%;;margin-left: 5%;">
- <p>提示:填写分类层级,导出不带数据的模板;请填写2到10的层级数值。 </p>
- <p
- >导出分类层级:<a-input-number
- id="level"
- v-model="level"
- :min="2"
- :max="10"
- style="width:60%;"
- />
- </p>
- <p>
- <a @click="exportItemTemplate">
- 审计指引库导入模板
- </a>
- </p>
- <p>说明 </p>
- <p>1)增量式导入,只导入新增数据;</p>
- <p>2)修改式导入,对存在数据进行修改;</p>
- <p>3)覆盖式导入,删除已经存在的数据,重新导入;</p>
- <p>4)数据导入需要进行单元格合并;</p>
- <p
- >导入模式:
- <a-select v-model="importType" style="width:40%;" @change="changedImportType">
- <a-select-option checked="true" value="over">覆盖式导入</a-select-option>
- <a-select-option value="inter">增量式导入</a-select-option>
- <a-select-option value="update">修改式导入</a-select-option>
- </a-select>
- </p>
- <a-form-item>
- <span v-if="Message !== ''" style="padding:0 15px">
- {{ Message }}
- </span>
- <br v-if="Message !== '' && !hasattach" />
- <sd-attachment :max="1" :group-id="groupId" accept=".xls,.xlsx" @change="fnchangefile">
- </sd-attachment>
- </a-form-item>
- </div>
- </a-form>
- </a-modal>
- <a-modal
- v-model="isErrorInfo"
- title="错误信息"
- :width="700"
- @ok="isErrorInfo = false"
- @cancel="isErrorInfo = false"
- >
- <a-descriptions bordered>
- <a-descriptions-item label="错误信息">
- <p v-for="(item, index) in errorInfo" :key="index">{{ item }}</p>
- </a-descriptions-item>
- </a-descriptions>
- </a-modal>
- </span>
- </template>
- <script>
- import { Modal, Message } from 'ant-design-vue'
- import download from '@/common/services/download'
- import auditMattersService from './audit-matters-service'
- import components from './_import-components/audit-matters-export-modal-import'
- export default {
- name: 'AuditMattersExportModal',
- metaInfo: {
- title: 'AuditMattersExportModal',
- },
- components,
- props: {
- // 弹出窗标题
- title: {
- type: String,
- default: '导入审计指引',
- },
- // 弹出窗宽度
- modalWidth: {
- type: String,
- default: '700px',
- },
- // 弹出窗显示参数
- visible: {
- type: Boolean,
- default: false,
- },
- },
- data() {
- return {
- bodyStyle: {
- padding: 0,
- },
- level: 2,
- errorInfo: [],
- isErrorInfo: false,
- groupId: Math.round(Math.random() * 100000000000000000).toString(),
- hasattach: false,
- Message: '',
- importType: 'inter',
- }
- },
- created() {},
- methods: {
- handleOk(e) {
- if (!this.hasattach) {
- // 未上传附件,给出提示
- Message.error('请上传文件!')
- return
- }
- // 导入
- const groupId = this.groupId
- const orgId = this.$parent.$parent.$refs.auditMattersCatalogTree.depvalue
- auditMattersService.importItemTemplate(this.importType, groupId, orgId).then((res) => {
- if (res.data.length > 0) {
- Message.error('导入数据失败!')
- this.isErrorInfo = true
- this.errorInfo = res.data
- return false
- } else {
- Message.success('导入成功!')
- this.hasattach = false
- this.groupId = Math.round(Math.random() * 100000000000000000).toString()
- this.level = 2
- this.$parent.$parent.visible = !this.$parent.$parent.visible
- }
- })
- },
- handleCancel(e) {
- this.hasattach = false
- this.groupId = Math.round(Math.random() * 100000000000000000).toString()
- this.$parent.$parent.visible = !this.$parent.$parent.visible
- this.level = 2
- },
- changedImportType() {},
- exportItemTemplate() {
- auditMattersService.exportItemTemplate(this.level).then((res) => {
- if (res.status === 200) {
- const url = URL.createObjectURL(res.data)
- const filename = res.headers['content-disposition']
- const fname = filename.substring(filename.indexOf('filename=') + 9, filename.length)
- download(url, decodeURI(fname))
- } else {
- Modal.warning({
- title: '提示',
- content: '导出报错,请联系管理员!',
- })
- return false
- }
- })
- },
- fnchangefile(attach) {
- if (attach.length > 0) {
- this.hasattach = true
- } else {
- this.hasattach = false
- }
- },
- },
- }
- </script>
- <style module lang="scss">
- @use '@/common/design' as *;
- </style>
|