فهرست منبع

Merge branch 'master' of http://119.23.210.103:3000/wy/zdqy_firm_former

cfort 1 سال پیش
والد
کامیت
f22a0d78f4

+ 18 - 0
src/api/upload/zip.js

@@ -0,0 +1,18 @@
+import request from '@/utils/request'
+import { BUSINESS_BASE_URL } from '@/api/baseUrl'
+
+/**
+ * 导入文件
+ * @param {*} file
+ */
+export function importZip (file) {
+    const data = new FormData() // 创建form对象
+    data.append('file', file)
+    return request({
+        url: BUSINESS_BASE_URL() + '/thirtyparty/humiture/importHumiture',
+        method: 'post',
+        data: data,
+        isLoading: true,
+        gateway: true
+    })
+}

+ 30 - 6
src/business/platform/data/templaterender/templates/list.vue

@@ -268,6 +268,12 @@
             @close="(visible) => (importTableDialogVisible = visible)"
             @action-event="handleImportTableActionEvent"
         />
+        <import-zip
+            :visible="importZipDialogVisible"
+            title="导入"
+            @close="(visible) => (importZipDialogVisible = visible)"
+            @action-event="handleImportZipActionEvent"
+        />
 
         <xlsxFile
             v-if="xlsxFileVisible"
@@ -322,7 +328,7 @@ import IbpsImportColumnsDialog from '../components/import-columns-dialog'
 import CustomDataDisplayMixin from '@/business/platform/system/mixins/customDataDisplay'
 import FormPrintTemplate from '@/business/platform/form/form-print/template'
 import importTable from '@/business/platform/form/formrender/dynamic-form/components/import-table'
-
+import importZip from '@/business/platform/form/formrender/dynamic-form/components/import-zip.vue'
 import JTemplate from '../utils/JTemplate' // 自定义脚本
 import JDialogTemplate from '../utils/JDialogTemplate' // 对话框自定义脚本
 
@@ -335,7 +341,7 @@ import Vue from 'vue'
 Vue.component('ibps-data-template-render-dialog', () => import('@/business/platform/data/templaterender/preview/dialog.vue'))
 import xlsxFile from '@/business/platform/data/templaterender/templates/compenent/xlsxFile.vue'
 import generalModules from '@/views/system/jbdScan/generalModules.vue'
-
+import { importZip as importzip } from '@/api/upload/zip'
 export default {
     name: 'list',
     components: {
@@ -354,6 +360,7 @@ export default {
         DictionaryFormat,
         Scan,
         importTable,
+        importZip,
         Print: () => import('../components/print'),
         LabelPrint: () => import('../components/labelPrint'),
         xlsxFile,
@@ -468,6 +475,7 @@ export default {
             printList: [],
 
             importTableDialogVisible: false,
+            importZipDialogVisible: false,
             position: null,
             importList: [],
             importValue: null,
@@ -1812,10 +1820,19 @@ export default {
         },
 
         // 自定义导入  小林
-        handleImport (data = []) {
-            this.importList = data
-            this.importValue = this.getKeys(this.importList)
-            this.importTableDialogVisible = true
+        handleImport (data = [], type = 'excel') {
+            switch (type) {
+                case 'excel':
+                    this.importList = data
+                    this.importValue = this.getKeys(this.importList)
+                    this.importTableDialogVisible = true
+                    break
+                case 'zip':
+                    this.importZipDialogVisible = true
+                    break
+                default:
+                    break
+            }
         },
         handleImportTableActionEvent (file, options) {
             this.loading = false
@@ -1837,6 +1854,13 @@ export default {
                 // ActionUtils.success('导入成功')
             })
         },
+        async handleImportZipActionEvent (file, options) {
+            // 调用上传接口
+            await importzip(file)
+            this.importZipDialogVisible = false
+            this.search()
+            ActionUtils.success('导入成功')
+        },
         setValue (data) {
             return Object.values(data).reduce((obj, item) => {
                 obj[item] = ''

+ 131 - 0
src/business/platform/form/formrender/dynamic-form/components/import-zip.vue

@@ -0,0 +1,131 @@
+<template>
+    <el-dialog
+        :title="title"
+        :visible.sync="dialogVisible"
+        :close-on-click-modal="false"
+        :close-on-press-escape="false"
+        append-to-body
+        class="dialog"
+        @opened="openedDialog"
+        @close="closeDialog"
+    >
+        <el-form
+            ref="importForm"
+            v-loading="dialogLoading"
+            :element-loading-text="$t('common.loading')"
+            :label-width="formLabelWidth"
+            class="import-form"
+            @submit.native.prevent
+        >
+
+            <el-form-item label="选择文件:" required>
+                <el-upload
+                    ref="upload"
+                    action="https://www.bpmhome.cn/post"
+                    accept=".zip"
+                    :file-list="fileList"
+                    :on-change="handleChange"
+                    :before-upload="handleUpload"
+                    :auto-upload="false"
+                >
+                    <el-button type="primary" icon="el-icon-upload">选择文件</el-button>
+                    <div slot="tip" class="el-upload__tip"> 请导入Zip文件</div>
+                </el-upload>
+            </el-form-item>
+            <!-- <el-form-item label="格式数据:">
+        <el-switch
+          v-model="options.raw"
+          active-text="原始"
+          inactive-text="格式化"
+        />
+      </el-form-item> -->
+        </el-form>
+        <div slot="footer" class="el-dialog--center">
+            <ibps-toolbar
+                :actions="toolbars"
+                @action-event="handleActionEvent"
+            />
+        </div>
+    </el-dialog>
+</template>
+
+<script>
+import ActionUtils from '@/utils/action'
+
+export default {
+    props: {
+        visible: {
+            type: Boolean,
+            default: false
+        },
+        title: {
+            type: String
+        }
+    },
+    data () {
+        return {
+            formName: 'importForm',
+            formLabelWidth: '120px',
+            dialogVisible: this.visible,
+            dialogLoading: false,
+            fileList: [],
+            options: {
+                raw: false
+            },
+            toolbars: [
+                { key: 'import' },
+                { key: 'cancel' }
+            ]
+        }
+    },
+    watch: {
+        visible: {
+            handler: function (val, oldVal) {
+                this.dialogVisible = this.visible
+            },
+            immediate: true
+        }
+    },
+    methods: {
+        openedDialog () {
+            this.fileList = []
+        },
+        handleActionEvent ({ key }) {
+            switch (key) {
+                case 'import':
+                    this.handleImport()
+                    break
+                case 'cancel':
+                    this.closeDialog()
+                    break
+                default:
+                    break
+            }
+        },
+        handleChange (file, fileList) {
+            if (fileList.length > 1) {
+                fileList.splice(0, 1)
+            }
+        },
+        handleUpload (file) {
+            // this.file = file
+            // 判断是否是Excel
+        },
+        async handleImport () {
+            const files = this.$refs['upload'].uploadFiles
+            if (this.$utils.isEmpty(files)) {
+                ActionUtils.warning('请上传要导入的文件')
+                return
+            }
+            console.log(files[0].raw)
+            this.$emit('action-event', files[0].raw, this.options)
+        },
+        // 关闭当前窗口
+        closeDialog () {
+            this.$emit('close', false)
+            this.$refs[this.formName].resetFields()
+        }
+    }
+
+}
+</script>

+ 1 - 28
src/views/infosManage/fileIE.vue

@@ -76,20 +76,6 @@
                                 >{{ scope.row.file_info_ }}</el-tag>
                             </div>
                         </template>
-                        <!-- 阅览/收藏具名插槽 -->
-                        <!-- <template
-                            slot="readStatus"
-                            slot-scope="scope"
-                        >
-                            <img
-                                :src="scope.row.cy_id_ ? openFilePng : closeFilePng"
-                                style="vertical-align: middle; height: 30px;"
-                            > /
-                            <img
-                                :src="scope.row.sc_id_ ? hadColetcPng : noColectPng"
-                                style="vertical-align: middle; height: 30px;"
-                            >
-                        </template> -->
                         <template v-if="showCaoZuoColumn" slot="caozuo" slot-scope="scope">
                             <div style="color:#1E90FF; " class="hover-hand" @click="updateDate(scope)">
                                 <i class="el-icon-edit-outline" style="cursor: pointer;" />
@@ -151,22 +137,16 @@
 </template>
 <script>
 import ActionUtils from '@/utils/action'
-// import { getFileType, getFileByUserId } from '@/api/permission/file'
 import IbpsAttachment from '@/business/platform/file/attachment/selector'
 import curdPost from '@/business/platform/form/utils/custom/joinCURD.js'
 import FixHeight from '@/mixins/height'
 import IbpsTypeTree from '@/business/platform/cat/type/tree'
-// import { findTreeData } from '@/api/platform/cat/type'
 import BpmnFormrender from '@/business/platform/bpmn/form/dialog'
 import closeFilePng from '@/assets/images/icons/closeFile.png'
 import openFilePng from '@/assets/images/icons/openFile.png'
-// import hadColetcPng from '@/assets/images/icons/hadColetc.png'
-// import noColectPng from '@/assets/images/icons/noColect.png'
 import wordPng from '@/assets/images/icons/word.png'
 import fileTraining from '@/views/component/fileTraining'
-// import column from '@/components/ibps-crud/mixin/column'
 import UpdateFile from './updateFile'
-// import ElImageViewer from 'element-ui/packages/image/src/image-viewer'
 
 export default {
     components: {
@@ -175,8 +155,6 @@ export default {
         UpdateFile,
         'ibps-attachment': IbpsAttachment,
         'file-lookup': fileTraining
-        // IbpsImage: () => import('@/business/platform/file/image'),
-        // ElImageViewer
     },
     mixins: [FixHeight],
     data () {
@@ -224,11 +202,6 @@ export default {
                 // 工具栏
                 toolbars: [
                     { key: 'search' }
-                    // {
-                    //     key: 'colect',
-                    //     label: '收藏或取消收藏',
-                    //     type: 'success'
-                    // }
                 ],
                 // 查询条件
                 searchForm: {
@@ -301,7 +274,7 @@ export default {
                 { prop: 'fa_fang_shi_jian_', label: '发布日期', sortable: 'custom', width: 150 },
                 // { prop: 'read', label: '阅览状态', slotName: 'readStatus', minWidth: 60 },
                 // { prop: 'collect', label: '收藏状态', slotName: 'collectStatus', minWidth: 60 },
-                { prop: 'cha_yue_jie_zhi_s', label: '查阅截止时间', sortable: 'custom', minWidth: 120 }
+                { prop: 'cha_yue_jie_zhi_s', label: '查阅截止时间', sortable: 'custom', width: 150 }
             ]
         }
         if (this.$route.name === 'wjkzgl-ywyxjlsc' || this.$route.name === 'ywtxyxjl') {