Ver Fonte

userDeptId筛选

zhuangyunsheng há 1 ano atrás
pai
commit
7bda9484dd

+ 34 - 0
.env.production

@@ -0,0 +1,34 @@
+# 生产环境加载
+
+# 环境标识
+VITE_APP_ENV = "production"
+
+# 公共基础路径
+VITE_BASE = "/"
+# 代理URL路径
+VITE_BASE_URL = "/dev-api"
+# 模拟数据接口路径
+VITE_BASE_MOCK_URL = "/mock-api"
+
+# boot服务端接口路径
+VITE_BASE_SERVER_URL = "http://10.236.2.146:8080/"
+
+# 微前端-工作流
+VITE_WORKFLOW_URL = "http://10.236.2.146:1888/"
+# 微前端-代码生成器
+VITE_CODEMAKER_URL = "http://localhost:32582/"
+
+# 宝信单点登录
+VITE_BX_CLIENT_ID = "项目英文名"
+VITE_BX_AUTH_URL = "http://eplattest.qdgwlds.com/cloud/oauth/authorize"
+VITE_BX_REDIRECT_URL = "http://localhost:8080/yh"
+VITE_BX_LOGOUT_URL = "http://eplattest.qdgwlds.com/cloud/"
+
+# 边端单点登录
+VITE_EDGE_CLIENT_ID = "frame-demo"
+VITE_EDGE_AUTH_URL = "http://qdport.auth.vue3.10.236.3.36.nip.io/oauth/authorize"
+VITE_EDGE_REDIRECT_URL = "http://localhost:8080/ssoyh"
+VITE_EDGE_LOGOUT_URL = "http://qdport.auth.vue3.10.236.3.36.nip.io/logout"
+
+# 打包是否使用Mock
+VITE_APP_PRODMOCK = false

+ 1 - 1
package.json

@@ -4,7 +4,7 @@
     "private": true,
     "scripts": {
         "dev": "vite --mode development",
-        "build": "vite build --mode development",
+        "build": "vite build --mode production",
         "preview": "vite preview",
         "lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs --fix --ignore-path .gitignore",
         "format": "prettier --write src/"

+ 38 - 0
src/api/system/template.js

@@ -0,0 +1,38 @@
+import request from "@/utils/request";
+
+export default {
+    get: function (params) {
+        return request({
+            url: "/qdport-zcgx/template/page",
+            method: "get",
+            params
+        })
+    },
+
+    add: function (data) {
+        return request({
+            url: "/qdport-zcgx/template/save",
+            method: "post",
+            data
+        })
+    },
+
+    edit: function (data) {
+        return request({
+            url: "/qdport-zcgx/template/update",
+            method: "post",
+            data
+        })
+    },
+
+    del: function (data) {
+        return request({
+            headers: {
+                "Content-Type": "application/x-www-form-urlencoded"
+            },
+            url: "/qdport-zcgx/template/remove",
+            method: "post",
+            data
+        })
+    }
+}

+ 15 - 15
src/components/Upload/imageViewer.vue

@@ -5,25 +5,25 @@
 </template>
 
 <script>
-	import { ElImageViewer } from "element-plus";
+import { ElImageViewer } from "element-plus";
 
-	export default {
-		emits: ["closed"],
-		components: {
-			ElImageViewer
-		},
+export default {
+    emits: ["closed"],
+    components: {
+        ElImageViewer
+    },
 
-		props: {
-			showViewer: { type: Boolean, default: false },
-			imageList: { type: Array, default: () => [] }
-		},
+    props: {
+        showViewer: { type: Boolean, default: false },
+        imageList: { type: Array, default: () => [] }
+    },
 
-		data() {
-			return {}
-		},
+    data() {
+        return {}
+    },
 
-		methods: {}
-	}
+    methods: {}
+}
 </script>
 
 <style lang="scss" scoped>

+ 133 - 133
src/components/Upload/index.vue

@@ -30,140 +30,140 @@
 </template>
 
 <script>
-  	import { defineAsyncComponent } from "vue";
-    import Folder from "@/api/folder";
-
-	export default {
-		components: {
-			yhImageViewer: defineAsyncComponent(() => import("@/components/Upload/imageViewer.vue")),
-		},
-		props: {
-			modelValue: { type: Array, default: () => [] },
-			tip: { type: String, default: "" },
-			accept: { type: String, default: "" },
-			maxSize: { type: Number, default: 50 },
-			limit: { type: Number, default: 0 },
-			multiple: { type: Boolean, default: true },
-			disabled: { type: Boolean, default: false },
-			hideAdd: { type: Boolean, default: false },
-			onSuccess: { type: Function, default: () => { return true } }
-		},
-
-		data() {
-			return {
-				value: "",
-				defaultFileList: [],
-				
-				showPictureViewer: false,
-				previewImageList: []
-			}
-		},
-
-		watch: {
-			modelValue(val) {
-				if (JSON.stringify(val) != JSON.stringify(this.formatArr(this.defaultFileList))) {
-					this.defaultFileList = val;
-					this.value = val;
-				}
-			},
-
-			defaultFileList: {
-				deep: true,
-				handler(val) {
-					this.$emit("update:modelValue", this.formatArr(val));
-					this.value = val.map(v => v.path).join(",");
-				}
-			}
-		},
-
-		mounted() {
-			this.defaultFileList = this.modelValue;
-			this.value = this.modelValue;
-		},
-
-		methods: {
-			// 格式化数组值
-			formatArr(arr) {
-				return arr.map(item => ({ fileName: item.fileName, fileType: item.fileType, fileDomain: item.fileDomain, originalName: item.originalName, path: item.fileDomain + "/" + item.fileName }));
-			},
-
-			before(file) {
-				const maxSize = file.size / 1024 / 1024 < this.maxSize;
-				if (!maxSize) {
-					ElMessage.warning(`上传文件大小不能超过 ${this.maxSize}MB!`);
-					return false;
-				}
-			},
-
-			success(res, file) {
-				let os = this.onSuccess(res, file);
-				if (os != undefined && os == false) return false;
-			
-				file.fileDomain = res.domain;
-				file.fileName = res.name;
-				file.fileType = res.fileType;
-				file.originalName = res.originalName;
-				file.path = res.domain + "/" + res.name;
-			},
-
-			error(message) {
+import { defineAsyncComponent } from "vue";
+import Folder from "@/api/folder";
+
+export default {
+    components: {
+        yhImageViewer: defineAsyncComponent(() => import("@/components/Upload/imageViewer.vue")),
+    },
+    props: {
+        modelValue: { type: Array, default: () => [] },
+        tip: { type: String, default: "" },
+        accept: { type: String, default: "" },
+        maxSize: { type: Number, default: 50 },
+        limit: { type: Number, default: 0 },
+        multiple: { type: Boolean, default: true },
+        disabled: { type: Boolean, default: false },
+        hideAdd: { type: Boolean, default: false },
+        onSuccess: { type: Function, default: () => { return true } }
+    },
+
+    data() {
+        return {
+            value: "",
+            defaultFileList: [],
+            
+            showPictureViewer: false,
+            previewImageList: []
+        }
+    },
+
+    watch: {
+        modelValue(val) {
+            if (JSON.stringify(val) != JSON.stringify(this.formatArr(this.defaultFileList))) {
+                this.defaultFileList = val;
+                this.value = val;
+            }
+        },
+
+        defaultFileList: {
+            deep: true,
+            handler(val) {
+                this.$emit("update:modelValue", this.formatArr(val));
+                this.value = val.map(v => v.path).join(",");
+            }
+        }
+    },
+
+    mounted() {
+        this.defaultFileList = this.modelValue;
+        this.value = this.modelValue;
+    },
+
+    methods: {
+        // 格式化数组值
+        formatArr(arr) {
+            return arr.map(item => ({ fileName: item.fileName, fileType: item.fileType, fileDomain: item.fileDomain, originalName: item.originalName, path: item.fileDomain + "/" + item.fileName }));
+        },
+
+        before(file) {
+            const maxSize = file.size / 1024 / 1024 < this.maxSize;
+            if (!maxSize) {
+                ElMessage.warning(`上传文件大小不能超过 ${this.maxSize}MB!`);
+                return false;
+            }
+        },
+
+        success(res, file) {
+            let os = this.onSuccess(res, file);
+            if (os != undefined && os == false) return false;
+        
+            file.fileDomain = res.domain;
+            file.fileName = res.name;
+            file.fileType = res.fileType;
+            file.originalName = res.originalName;
+            file.path = res.domain + "/" + res.name;
+        },
+
+        error(message) {
+            this.$emit("update:isUpload", false);
+            ElNotification.error({ title: "上传文件未成功", message });
+        },
+
+        beforeRemove({ id, name, fileName }) { // id, name, fileName
+            return ElMessageBox.confirm(`是否移除 ${name}? 此操作不可逆!`, "提示", {
+                type: "warning",
+                confirmButtonText: "移除"
+            }).then(() => {
+                const promiseArray = [Folder.rm(fileName)];
+                id && promiseArray.push(Folder.fileRemove(id));
+
+                return Promise.all(promiseArray).then(() => {
+                    id && this.$emit("updateTable");
+                    return true;
+                }).catch(() => false);
+            }).catch(() => false);
+        },
+
+        handleExceed() {
+            ElMessage.warning(`当前设置最多上传 ${this.limit} 个文件,请移除后上传!`);
+        },
+
+        handlePreview(uploadFile) {
+            if (["image/jpeg", "image/png"].includes(uploadFile.fileType)) {
+                this.showPictureViewer = true;
+                this.previewImageList = [uploadFile.path];
+            } else {
+                Folder.download(uploadFile.path).then(res => {
+                    const a = document.createElement("a");
+                    const blob = new Blob([res.data], { type: uploadFile.fileType });
+                    if (uploadFile.fileType == "application/pdf") a.target = "_blank";
+                    else a.download = uploadFile.name;
+                    a.href = URL.createObjectURL(blob);
+                    a.click();
+                });
+            }
+        },
+
+        request(param) {
+            const data = new FormData();
+            data.append(param.filename, param.file);
+
+            this.$emit("update:isUpload", true);
+            Folder.up(data, {
+                onUploadProgress: e => {
+                    const percent = parseInt(((e.loaded / e.total) * 100) | 0, 10);
+                    param.onProgress({ percent });
+                }
+            }).then(res => {
                 this.$emit("update:isUpload", false);
-				ElNotification.error({ title: "上传文件未成功", message });
-			},
-
-			beforeRemove({ id, name, fileName }) { // id, name, fileName
-				return ElMessageBox.confirm(`是否移除 ${name}? 此操作不可逆!`, "提示", {
-					type: "warning",
-					confirmButtonText: "移除"
-				}).then(() => {
-                    const promiseArray = [Folder.rm(fileName)];
-                    id && promiseArray.push(Folder.fileRemove(id));
-
-                    return Promise.all(promiseArray).then(() => {
-                        id && this.$emit("updateTable");
-                        return true;
-                    }).catch(() => false);
-				}).catch(() => false);
-			},
-
-			handleExceed() {
-				ElMessage.warning(`当前设置最多上传 ${this.limit} 个文件,请移除后上传!`);
-			},
-
-			handlePreview(uploadFile) {
-				if (["image/jpeg", "image/png"].includes(uploadFile.fileType)) {
-					this.showPictureViewer = true;
-					this.previewImageList = [uploadFile.path];
-				} else {
-                    Folder.download(uploadFile.path).then(res => {
-                        const a = document.createElement("a");
-                        const blob = new Blob([res.data], { type: uploadFile.fileType });
-                        if (uploadFile.fileType == "application/pdf") a.target = "_blank";
-                        else a.download = uploadFile.name;
-                        a.href = URL.createObjectURL(blob);
-                        a.click();
-                    });
-				}
-			},
-
-			request(param) {
-				const data = new FormData();
-				data.append(param.filename, param.file);
-
-                this.$emit("update:isUpload", true);
-                Folder.up(data, {
-					onUploadProgress: e => {
-						const percent = parseInt(((e.loaded / e.total) * 100) | 0, 10);
-						param.onProgress({ percent });
-					}
-				}).then(res => {
-                    this.$emit("update:isUpload", false);
-					if (res.code == 200) param.onSuccess({ ...res.data, fileType: param.file.type });
-					else param.onError(res.msg || "未知错误");
-				}).catch(err => param.onError(err));
-			}
-		}
-	}
+                if (res.code == 200) param.onSuccess({ ...res.data, fileType: param.file.type });
+                else param.onError(res.msg || "未知错误");
+            }).catch(err => param.onError(err));
+        }
+    }
+}
 </script>
 
 <style lang="scss" scoped>

+ 57 - 57
src/components/Upload/tableImport.vue

@@ -15,69 +15,69 @@
 </template>
 
 <script>
-    import Folder from "@/api/folder";
+import Folder from "@/api/folder";
 
-	export default {
-		props: {
-			url: { type: String, default: "" },
-			maxSize: { type: Number, default: 50 },
-			onSuccess: { type: Function, default: () => true }
-		},
+export default {
+    props: {
+        url: { type: String, default: "" },
+        maxSize: { type: Number, default: 50 },
+        onSuccess: { type: Function, default: () => true }
+    },
 
-		data() {
-			return {
-                loading: null
-            }
-		},
+    data() {
+        return {
+            loading: null
+        }
+    },
 
-		methods: {
-			before(file) {
-                if (!this.url) return false;
-				const maxSize = file.size / 1024 / 1024 < this.maxSize;
-				if (!maxSize) {
-					ElMessage.warning(`上传文件大小不能超过 ${this.maxSize}MB!`);
-					return false;
-				}
-			},
+    methods: {
+        before(file) {
+            if (!this.url) return false;
+            const maxSize = file.size / 1024 / 1024 < this.maxSize;
+            if (!maxSize) {
+                ElMessage.warning(`上传文件大小不能超过 ${this.maxSize}MB!`);
+                return false;
+            }
+        },
 
-			success(res, file) {
-				let os = this.onSuccess(res, file);
-				if (os != undefined && os == false) return false;
+        success(res, file) {
+            let os = this.onSuccess(res, file);
+            if (os != undefined && os == false) return false;
 
-                ElMessage.success("导入成功");
-                this.$emit("importSuc");
-                this.$refs.uploader.clearFiles();
-			},
+            ElMessage.success("导入成功");
+            this.$emit("importSuc");
+            this.$refs.uploader.clearFiles();
+        },
 
-			error(message) {
-                this.loading && this.loading.close();
-				message && ElNotification.error({ title: "导入文件未成功", message });
-			},
+        error(message) {
+            this.loading && this.loading.close();
+            message && ElNotification.error({ title: "导入文件未成功", message });
+        },
 
-			request(param) {
-                this.loading = ElLoading.service({
-                    lock: true,
-                    text: "上传中请等待…",
-                    spinner: "el-icon-loading",
-                    background: "rgba(0, 0, 0, 0.7)"
-                });
+        request(param) {
+            this.loading = ElLoading.service({
+                lock: true,
+                text: "上传中请等待…",
+                spinner: "el-icon-loading",
+                background: "rgba(0, 0, 0, 0.7)"
+            });
 
-				const data = new FormData();
-				data.append(param.filename, param.file);
-                
-                Folder.up(data).then(upRes => {
-                    if (upRes.code == 200) {
-                        this.loading.setText("导入中请等待…");
-                        Folder.import(this.url, upRes.data.link).then(res => {
-                            this.loading.close();
-                            if (res.code == 200) {
-                                if (res.data.length) param.onError(`有${res.data.length}条数据导入失败,序号为: ${res.data.map(d => d.index).join()}`);
-                                else param.onSuccess(res.data);
-                            } else param.onError(res.msg || "未知错误");
-                        }).catch(() => param.onError());
-                    } else param.onError(upRes.msg || "未知错误");
-				}).catch(() => param.onError());
-			}
-		}
-	}
+            const data = new FormData();
+            data.append(param.filename, param.file);
+            
+            Folder.up(data).then(upRes => {
+                if (upRes.code == 200) {
+                    this.loading.setText("导入中请等待…");
+                    Folder.import(this.url, upRes.data.link).then(res => {
+                        this.loading.close();
+                        if (res.code == 200) {
+                            if (res.data.length) param.onError(`有${res.data.length}条数据导入失败,序号为: ${res.data.map(d => d.index).join()}`);
+                            else param.onSuccess(res.data);
+                        } else param.onError(res.msg || "未知错误");
+                    }).catch(() => param.onError());
+                } else param.onError(upRes.msg || "未知错误");
+            }).catch(() => param.onError());
+        }
+    }
+}
 </script>

+ 0 - 2
src/layout/components/SideBar/sideBarItem.vue

@@ -33,13 +33,11 @@ function isExternal(path) {
 
 const router = useRouter()
 const handleClickMenu = item => {
-    console.log(item.path)
     if (isExternal(item.path)) {
         window.open(item.path, '_blank')
     } else {
         if (item.path.startsWith('/tjmchild')) {
             const parts = item.path.split('/') // 使用斜杠分割路径
-            console.log(parts.slice(3).join('/'))
             router.push({
                 name: parts[2],
                 params: { page: parts.slice(3).join('/') }

+ 9 - 12
src/store/permission.js

@@ -39,23 +39,21 @@ export const usePermissionStore = defineStore(
         }
     }
 )
-// 
+
 function filterAsyncRouter(asyncRouterMap, httpSave = true) {
-    const blackList = [
-        // "/workflow", "/system/dataList", "/system/template",
-        // "/publicDomain", "/manage/policyStrive", "/policyStrive",
-        // "/caseShare"
+    const blackList = ["/publicDomain", "/caseShare"
+        // "/workflow"
     ]
 
     let arr = []
     asyncRouterMap.filter(route => {
-        if (!blackList.includes(route.path)) {
+        if (route.path != "/system/dataList") {
             if (route.children != null && route.children && route.children.length && route.children[0].type != 2 && route.parentId == "1762659463383281665") {
                 let info = {
                     alwaysShow: true,
                     children: [],
                     component: Layout,
-                    hidden: false,
+                    hidden: blackList.includes(route.path),
                     meta: {
                         icon: route.icon,
                         link: "",
@@ -76,7 +74,7 @@ function filterAsyncRouter(asyncRouterMap, httpSave = true) {
                     alwaysShow: true,
                     children: [],
                     component: ParentView,
-                    hidden: false,
+                    hidden: blackList.includes(route.path),
                     meta: {
                         icon: route.icon,
                         link: "",
@@ -98,7 +96,7 @@ function filterAsyncRouter(asyncRouterMap, httpSave = true) {
                     component: Layout,
                     redirect: route.path,
                     alwaysShow: false,
-                    hidden: false,
+                    hidden: blackList.includes(route.path),
                     meta: {
                         icon: route.icon,
                         title: route.name
@@ -108,7 +106,7 @@ function filterAsyncRouter(asyncRouterMap, httpSave = true) {
                             // alwaysShow: false, //菜单不支持设置
                             children: [],
                             component: loadView(route.path),
-                            hidden: false,
+                            hidden: blackList.includes(route.path),
                             meta: {
                                 icon: route.icon,
                                 link: "",
@@ -139,7 +137,7 @@ function filterAsyncRouter(asyncRouterMap, httpSave = true) {
                     // alwaysShow: false, //菜单不支持设置
                     children: [],
                     component: loadView(route.path),
-                    hidden: false,
+                    hidden: blackList.includes(route.path),
                     meta: {
                         icon: route.icon,
                         link: "",
@@ -165,7 +163,6 @@ function filterAsyncRouter(asyncRouterMap, httpSave = true) {
             }
         }
     })
-
     return arr
 }
 

+ 1 - 2
src/store/tabsbar.js

@@ -12,13 +12,12 @@ export const useTabsBarStore = defineStore(
         actions: {
             addVisitedView(view) {
                 if (this.visitedViews.some(v => v.path === view.path)) return
-                const viewDeal = JSON.parse(JSON.stringify(view))
+                const viewDeal = Object.assign({}, view)
                 if (view.meta.micro) {
                     if (this.visitedViews.some(v => v.path === decodeURIComponent(view.path))) return
                     view.meta.title = findObjectByPath(this.sidebarRouters, view.path).meta.title
                     let depath = decodeURIComponent(view.path)
                     viewDeal.path = depath
-                    console.log(viewDeal)
                 }
                 this.visitedViews.push(
                     Object.assign({}, viewDeal, {

+ 10 - 5
src/views/caseShare/index.vue

@@ -92,6 +92,7 @@
 
 <script>
 import API from "@/api/policy/case";
+import { useUserStore } from "@/store/user";
 import { exportExcel } from "@/utils/exportExcel";
 import { levelDic, typeDic } from "@/views/policyShare/main";
 import { columns, statusDic } from "./main";
@@ -117,7 +118,9 @@ export default {
             createTime: [],
             params: {
                 page: 1,
-                size: 10
+                size: 10,
+                createId: useUserStore().userInfo.id,
+                userDeptId: useUserStore().userInfo.deptId
             },
 
             total: 0,
@@ -159,11 +162,13 @@ export default {
 
         reset() {
             this.createTime = [];
-            for (const key in this.params) {
-                if (key == "page") this.params[key] = 1;
-                else if (key == "size") this.params[key] = 10;
-                else this.params[key] = null;
+            this.params = {
+                page: 1,
+                size: 10,
+                createId: useUserStore().userInfo.id,
+                userDeptId: useUserStore().userInfo.deptId
             }
+
             this.reloadTable();
         },
 

+ 8 - 3
src/views/login/index.vue

@@ -14,7 +14,8 @@
             </div>
         </div>
         <div class="right">
-            <div class="title">欢迎登录</div>
+            <div class="title">{{projectName}}</div>
+            <div class="title sub-title">欢迎登录</div>
             <!-- <div class="select_login_type">
                 <div class="type_item type_item_active">
                     <span>密码登录</span>
@@ -374,8 +375,12 @@ function phoneCancel() {
       font-size: 36px;
       font-weight: 600;
       line-height: 28px;
-      text-align: left;
-      margin: 100px 0 0 0px;
+      margin: 100px 0 0;
+    }
+
+    .sub-title {
+      font-size: 28px;
+      font-weight: 500;
     }
     .select_login_type {
       width: 81.6%;

+ 7 - 3
src/views/manage/policyShare/dialog.vue

@@ -147,9 +147,11 @@ export default {
                 createId: userInfo.id,
                 createName: userInfo.name,
                 createTime: null,
-                name: null,
-                companyName: null,
+                deptId: userInfo.deptId,
                 deptName: null,
+                companyId: null,
+                companyName: null,
+                name: null,
                 zcLevel: null,
                 zcType: null,
                 docNo: null,
@@ -206,8 +208,10 @@ export default {
         getUserDept() {
             Common.getUserDept(userInfo.deptId).then(res => {
                 if (res.code === 200) {
-                    this.form.companyName = res.data.companyName;
+                    this.form.deptId = res.data.deptId;
                     this.form.deptName = res.data.deptName;
+                    this.form.companyId = res.data.companyId;
+                    this.form.companyName = res.data.companyName;
                 }
             });
         },

+ 1 - 1
src/views/manage/policyShare/index.vue

@@ -65,7 +65,7 @@
                             <template #icon><tjm-icon-fluent-emoji-high-contrast-open-book /></template>
                             添加解读
                         </el-button>
-                        <el-button v-if="scope.row.processTaskId && scope.row.processInstanceId" type="primary" link @click.stop="table_process(scope.row)">
+                        <el-button v-if="scope.row.processTaskId && scope.row.processInstanceId" :class="scope.row.isInWh == 0 || scope.row.inWhType == '解读类' && 'no-m-l'" type="primary" link @click.stop="table_process(scope.row)">
                             <template #icon><tjm-icon-uis-process /></template>
                             审批流程
                         </el-button>

+ 7 - 3
src/views/policyShare/dialog.vue

@@ -112,10 +112,12 @@ export default {
                 status: null,
                 createId: userInfo.id,
                 createName: userInfo.name,
+                deptId: userInfo.deptId,
+                deptName: null,
+                companyId: null,
+                companyName: null,
                 createTime: null,
                 name: null,
-                companyName: null,
-                deptName: null,
                 zcLevel: null,
                 zcType: null,
                 docNo: null,
@@ -163,8 +165,10 @@ export default {
         getUserDept() {
             Common.getUserDept(userInfo.deptId).then(res => {
                 if (res.code === 200) {
-                    this.form.companyName = res.data.companyName;
+                    this.form.deptId = res.data.deptId;
                     this.form.deptName = res.data.deptName;
+                    this.form.companyId = res.data.companyId;
+                    this.form.companyName = res.data.companyName;
                 }
             });
         },

+ 26 - 3
src/views/policyShare/index.vue

@@ -53,6 +53,7 @@
             <div class="tjm_card_tools_right flex-row">
                 <table-import url="policyShare" @importSuc="reloadTable"></table-import>
                 <el-button class="export-btn" icon="download" @click="table_export">导出</el-button>
+                <el-button icon="download" @click="download_temp">导入模版下载</el-button>
             </div>
         </div>
         <div class="tjm_card_table">
@@ -103,6 +104,8 @@
 </template>
 
 <script>
+import Folder from "@/api/folder";
+import Temp from "@/api/system/template";
 import API from "@/api/policy/share";
 import { useUserStore } from "@/store/user";
 import { exportExcel } from "@/utils/exportExcel";
@@ -134,7 +137,8 @@ export default {
             params: {
                 page: 1,
                 size: 10,
-                deptId: useUserStore().userInfo.deptId
+                createId: useUserStore().userInfo.id,
+                userDeptId: useUserStore().userInfo.deptId
             },
 
             total: 0,
@@ -180,8 +184,9 @@ export default {
             this.params = {
                 page: 1,
                 size: 10,
-                deptId: useUserStore().userInfo.deptId
-            };
+                createId: useUserStore().userInfo.id,
+                userDeptId: useUserStore().userInfo.deptId
+            }
                 
             this.reloadTable();
         },
@@ -193,6 +198,24 @@ export default {
             exportExcel(header, data, [], `${this.$route.name}.xlsx`);
         },
 
+        download_temp() {
+            Temp.get({ refType: "policy_share" }).then(res => {
+                if (res.code === 200) {
+                    if (!res.data.records[0]) ElMessage.warning("暂无模版,请联系管理员");
+                    else {
+                        const { templateName, templateUrl } = res.data.records[0];
+                        Folder.download(templateUrl).then(res => {
+                            const a = document.createElement("a");
+                            const blob = new Blob([res.data], { type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" });
+                            a.download = templateName;
+                            a.href = URL.createObjectURL(blob);
+                            a.click();
+                        });
+                    }
+                }else ElMessage.error(res.msg);
+            });
+        },
+
         table_add() {
             this.dialog.update = true;
             this.$nextTick(() => this.$refs.policyDialog.open());

+ 7 - 3
src/views/policyStrive/dialog.vue

@@ -136,9 +136,11 @@ export default {
                 createId: userInfo.id,
                 createName: userInfo.name,
                 createTime: null,
-                name: null,
-                companyName: null,
+                deptId: userInfo.deptId,
                 deptName: null,
+                companyId: null,
+                companyName: null,
+                name: null,
                 zcLevel: null,
                 zcType: null,
                 docNo: null,
@@ -194,8 +196,10 @@ export default {
         getUserDept() {
             Common.getUserDept(userInfo.deptId).then(res => {
                 if (res.code === 200) {
-                    this.form.companyName = res.data.companyName;
+                    this.form.deptId = res.data.deptId;
                     this.form.deptName = res.data.deptName;
+                    this.form.companyId = res.data.companyId;
+                    this.form.companyName = res.data.companyName;
                 }
             });
         },

+ 4 - 2
src/views/policyStrive/explain.vue

@@ -165,9 +165,11 @@ export default {
                 createId: null,
                 createName: null,
                 createTime: null,
-                name: null,
-                companyName: null,
+                deptId: userInfo.deptId,
                 deptName: null,
+                companyId: null,
+                companyName: null,
+                name: null,
                 zcLevel: null,
                 zcType: null,
                 docNo: null,

+ 34 - 3
src/views/policyStrive/index.vue

@@ -60,6 +60,15 @@
                     </template>
                 </el-dropdown>
                 <el-button class="export-btn" icon="download" @click="table_export">导出</el-button>
+                <el-dropdown @command="download_temp">
+                    <el-button icon="download">导入模版下载</el-button>
+                    <template #dropdown>
+                        <el-dropdown-menu>
+                            <el-dropdown-item command="policy_strive">政策争取</el-dropdown-item>
+                            <el-dropdown-item command="policy_strive_month">月度完成</el-dropdown-item>
+                        </el-dropdown-menu>
+                    </template>
+                </el-dropdown>
             </div>
         </div>
         <div class="tjm_card_table">
@@ -111,6 +120,8 @@
 </template>
 
 <script>
+import Folder from "@/api/folder";
+import Temp from "@/api/system/template";
 import API from "@/api/policy/strive";
 import { useUserStore } from "@/store/user";
 import { exportExcel } from "@/utils/exportExcel";
@@ -143,7 +154,8 @@ export default {
             params: {
                 page: 1,
                 size: 10,
-                deptId: useUserStore().userInfo.deptId
+                createId: useUserStore().userInfo.id,
+                userDeptId: useUserStore().userInfo.deptId
             },
 
             total: 0,
@@ -189,11 +201,30 @@ export default {
             this.params = {
                 page: 1,
                 size: 10,
-                deptId: useUserStore().userInfo.deptId
+                createId: useUserStore().userInfo.id,
+                userDeptId: useUserStore().userInfo.deptId
             }
             this.reloadTable();
         },
 
+        download_temp(refType) {
+            Temp.get({ refType }).then(res => {
+                if (res.code === 200) {
+                    if (!res.data.records[0]) ElMessage.warning("暂无模版,请联系管理员");
+                    else {
+                        const { templateName, templateUrl } = res.data.records[0];
+                        Folder.download(templateUrl).then(res => {
+                            const a = document.createElement("a");
+                            const blob = new Blob([res.data], { type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" });
+                            a.download = templateName;
+                            a.href = URL.createObjectURL(blob);
+                            a.click();
+                        });
+                    }
+                }else ElMessage.error(res.msg);
+            });
+        },
+
         table_export() {
             const header = columns.map(c => c.label);
             const data = this.tableData.map(v => columns.map(c => c.props).map(j => this.columnFormat(v, j)));
@@ -267,7 +298,7 @@ export default {
 
 <style lang="scss" scoped>
 .export-btn {
-  margin-left: 12px;
+  margin: 0 12px;
 }
 
 .no-m-l {

+ 112 - 0
src/views/system/template/dialog.vue

@@ -0,0 +1,112 @@
+<template>
+    <el-dialog v-model="visible" :title="titleMap[mode]" @closed="$emit('closed', fileIsDel)">
+        <el-form ref="formRef" :model="form" :rules="rules" label-width="110px">
+            <el-row>
+                <el-col :span="24">
+                    <el-form-item label="模版名称" prop="templateName">
+                        <el-input v-model="form.templateName" placeholder="请输入模版名称"></el-input>
+                    </el-form-item>
+                </el-col>
+                <el-col :span="24">
+                    <el-form-item label="模版类型" prop="refType">
+                        <el-select v-model="form.refType" placeholder="请选择模版类型">
+                            <el-option v-for="(label, key) in typeDic" :key="key" :label="label" :value="key"></el-option>
+                        </el-select>
+                    </el-form-item>
+                </el-col>
+                <el-col :span="24">
+                    <el-form-item label="模版文件" prop="fileList">
+                        <yhUpload v-model="form.fileList" v-model:isUpload="isUpload" accept=".xlsx, .xls" :limit="1" @updateTable="fileIsDel = true">
+                            <el-button type="primary" icon="upload" size="small"></el-button>
+                        </yhUpload>
+                    </el-form-item>
+                </el-col>
+            </el-row>
+        </el-form>
+
+        <template #footer>
+            <el-button :loading="isSaving" type="primary" :disabled="isUpload" @click="submit">保 存</el-button>
+        </template>
+    </el-dialog>
+</template>
+
+<script>
+import API from "@/api/system/template";
+import { typeDic } from "./main";
+import yhUpload from "@/components/Upload/index.vue";
+
+export default {
+    emits: ["success", "closed"],
+    
+    components: {
+        yhUpload
+    },
+
+    data() {
+        return {
+            typeDic,
+            visible: false,
+            isUpload: false,
+            isSaving: false,
+
+            mode: "add",
+            titleMap: {
+                add: "新增",
+                edit: "修改"
+            },
+            form: {
+                id: null,
+                templateName: null,
+                refType: null,
+                templateUrl: null,
+                fileList: []
+            },
+
+            rules: {
+                templateName: [{ required: true, message: "请输入模版名称" }],
+                refType: [{ required: true, message: "请选择模版类型" }],
+                fileList: [{ required: true, message: "请上传模版文件" }]
+            },
+
+            fileIsDel: false
+        }
+    },
+
+    methods: {
+        open(mode = "add") {
+            this.mode = mode;
+            this.visible = true;
+            return this;
+        },
+
+        setData(data) {
+            for (const key in this.form) {
+                if (key == "fileList") this.form[key] = data[key].map(file => ({ ...file, name: file.originalName, path: file.fileDomain + "/" + file.fileName }));
+                else this.form[key] = data[key] || null;
+            }
+        },
+
+        // 表单提交方法
+        submit() {
+            this.$refs.formRef.validate(valid => {
+                if (valid) {
+                    this.isSaving = true;
+                    this.form.templateUrl = this.form.fileList[0].path;
+
+                    API[this.mode](this.form).then(res => {
+                        this.isSaving = false;
+                        if (res.code === 200) {
+                            ElMessage.success("操作成功");
+                            this.visible = false;
+                            this.fileIsDel = false;
+                            this.$emit("success");
+                        } else ElMessage.error(res.msg);
+                    }).catch(() => this.isSaving = false);
+                } else {
+                    return false;
+                }
+            });
+        }
+    }
+}
+</script>

+ 48 - 5
src/views/system/template/index.vue

@@ -9,8 +9,10 @@
         <div class="tjm_card_table">
             <el-table v-loading="loading" row-key="id" header-cell-class-name="tjm_card_table_header" height="400" :data="tableData" border>
                 <el-table-column type="index" label="序号" width="55"></el-table-column>
-                <el-table-column label="模板名称" prop="name"></el-table-column>
-                <el-table-column label="模板类型" prop="type"></el-table-column>
+                <el-table-column label="模板名称" prop="templateName"></el-table-column>
+                <el-table-column label="模板类型">
+                    <template #default="scope">{{ formatType(scope.row.refType) }}</template>
+                </el-table-column>
 
                 <el-table-column label="操作" fixed="right" width="240">
                     <template #default="scope">
@@ -21,19 +23,26 @@
             </el-table>
         </div>
     </el-card>
+
+    <temp-dialog v-if="dialog" ref="tempDialog" @success="reloadTable" @closed="closed"></temp-dialog>
 </template>
 
 <script>
-import API from "@/api/policy/share";
+import API from "@/api/system/template";
+import { typeDic } from "./main";
+import tempDialog from "./dialog.vue";
 
 export default {
     components: {
+        tempDialog
     },
 
     data() {
         return {
             loading: false,
-            tableData: []
+            tableData: [],
+
+            dialog: false
         }
     },
 
@@ -42,13 +51,47 @@ export default {
     },
 
     methods: {
+        formatType(type) {
+            return typeDic[type] || "";
+        },
+
         reloadTable() {
             this.loading = true;
-            API.get(this.params).then(res => {
+            API.get().then(res => {
                 this.loading = false;
                 if (res.code === 200) this.tableData = res.data.records;
                 else ElMessage.error(res.msg);
             }).catch(() => this.loading = false);
+        },
+
+        table_add() {
+            this.dialog = true;
+            this.$nextTick(() => this.$refs.tempDialog.open());
+        },
+
+        table_edit(row) {
+            this.dialog = true;
+            this.$nextTick(() => this.$refs.tempDialog.open("edit").setData(row));
+        },
+
+        table_del(row) {
+            ElMessageBox.confirm("是否确认删除?", "删除警告", {
+                type: "warning",
+                confirmButtonText: "确定",
+                cancelButtonText: "取消"
+            }).then(() => {
+                API.del({ ids: row.id }).then(res => {
+                    if (res.code == 200) {
+                        ElMessage.success("操作成功");
+                        this.reloadTable();
+                    } else ElMessage.error(res.msg);
+                });
+            });
+        },
+
+        closed(e) {
+            e && this.reloadTable();
+            this.dialog = false;
         }
     }
 }

+ 5 - 0
src/views/system/template/main.js

@@ -0,0 +1,5 @@
+export const typeDic = {
+    policy_share: "政策分享-导入模版",
+    policy_strive: "政策争取-导入模版",
+    policy_strive_month: "政策争取-月度完成"
+}

+ 4 - 2
src/views/toDo/share.vue

@@ -137,9 +137,11 @@ export default {
                 createId: null,
                 createName: null,
                 createTime: null,
-                name: null,
-                companyName: null,
+                deptId: userInfo.deptId,
                 deptName: null,
+                companyId: null,
+                companyName: null,
+                name: null,
                 zcLevel: null,
                 zcType: null,
                 docNo: null,

+ 4 - 2
src/views/toDo/strive.vue

@@ -137,9 +137,11 @@ export default {
                 createId: null,
                 createName: null,
                 createTime: null,
-                name: null,
-                companyName: null,
+                deptId: userInfo.deptId,
                 deptName: null,
+                companyId: null,
+                companyName: null,
+                name: null,
                 zcLevel: null,
                 zcType: null,
                 docNo: null,