Browse Source

职责目录未完

hm 1 month ago
parent
commit
97bd8ab533

+ 42 - 0
src/api/unified-resources/job-directory/index.js

@@ -0,0 +1,42 @@
+import request from "@/utils/request2";
+
+export function getResponsibilityList(data) {
+  return request({
+    url: "/responsibility/getResponsibilityList",
+    method: "post",
+    data,
+  });
+}
+
+export function falseDeleteResponsibility(data) {
+  return request({
+    url: "/responsibility/falseDeleteResponsibility",
+    method: "post",
+    data,
+  });
+}
+
+
+export function getResponsibilityMsg(data) {
+    return request({
+      url: '/responsibility/getResponsibilityMsg',
+      method: "post",
+      data
+    })
+  }
+
+  export function addResponsibility(data) {
+    return request({
+      url: '/responsibility/addResponsibility',
+      method: "post",
+      data
+    })
+  }
+
+  export function updateResponsibility(data) {
+    return request({
+      url: '/responsibility/updateResponsibility',
+      method: "post",
+      data
+    })
+  }

+ 0 - 56
src/views/unified-resources/information-system/index copy.vue

@@ -1,56 +0,0 @@
-<template>
-  <el-container>
-    <iframe
-      :src="iframeUrl"
-      width="100%"
-      height="840"
-      frameborder="0"
-      scrolling="auto"
-      id="myIframe"
-      ref="iframe"
-    ></iframe>
-  </el-container>
-</template>
-
-<script>
-import { getSixCatalogToken } from "@/api/login";
-import { setCatalogToken } from '@/utils/auth'
-export default {
-  data() {
-    return {
-      iframeUrl: "http://localhost:8090/catalog/SixInfoSystemManage", //要跳转的菜单页
-    };
-  },
-  mounted() {
-    // 获取 iframe 元素
-    const iframe = this.$refs.iframe;
-
-    // 监听来自 iframe 的消息
-    window.addEventListener("message", this.handleIframeMessage, false);
-
-    // 获取 token 并发送给 iframe
-    getSixCatalogToken().then((result) => {
-      const token = result; // 假设 result 是整个 token 对象
-      setCatalogToken(token)
-      // 更新 iframe 的 URL 后再发送 token
-      this.iframeUrl = this.iframeUrl; // 强制刷新 iframe(可能需要更改为其他 URL)
-
-      // 确保 iframe 已加载,再发送 token
-      iframe.onload = () => {
-        const params = {
-          type: "setToken",
-          token: token, // 传递 token
-        };
-
-        // 使用 postMessage 向 iframe 发送 token
-        iframe.contentWindow.postMessage(params, "http://localhost:8090"); // 这里是子系统的域名,需要与子系统的 URL 匹配
-      };
-    });
-  },
-  methods: {
-    changeIframeUrl(url) {
-      this.iframeUrl = url;
-    },
-  },
-};
-</script>

+ 1 - 1
src/views/unified-resources/information-system/index.vue

@@ -361,6 +361,6 @@ export default {
 }
 
 .popconfirm_btn {
-  margin-right: 10px !important;
+  margin:0 10px !important;
 }
 </style>

+ 254 - 0
src/views/unified-resources/job-directory/dialog/JobDirectoryDialog.vue

@@ -0,0 +1,254 @@
+<!-- Dialog.vue -->
+<template>
+    <el-dialog :visible.sync="visible" @update:visible="handleUpdateVisible" :title="title + '职责目录'" :width="width"
+        :before-close="beforeClose">
+
+        <el-form inline :model="formData" label-width="" :label-position="'right'" :disabled="dialogTitle == '查看'"
+            class="form-detail-inline" :rules="formRules" ref="ruleFormRef">
+            <el-form-item label="所属机构名称" prop="agenciesName">
+                <el-cascader v-model="formData.agenciesName" placeholder="请选择所属单位机构名称" :options="buildDepartmentOptions"
+                    :props="{ value: 'id', label: 'directoryName', children: 'list' }" @change="agenciesNameChange" />
+            </el-form-item>
+            <el-form-item label="内设机构职责" prop="agenciesPrsponsibility">
+                <el-input v-model="formData.agenciesPrsponsibility" :title="formData.agenciesPrsponsibility"
+                    placeholder="请输入内设机构职责"></el-input>
+            </el-form-item>
+            <el-form-item label="职责事项" prop="matters">
+                <el-input v-model="formData.matters" :title="formData.matters" placeholder="请输入职责事项"></el-input>
+            </el-form-item>
+            <el-form-item label="数据资源名称" prop="databasename">
+                <el-input v-model="formData.databasename" :title="formData.databasename"
+                    placeholder="请输入数据资源名称"></el-input>
+            </el-form-item>
+            <el-form-item label="职责类型" prop="type">
+                <el-input v-model="formData.type" placeholder="请输入职责类型"></el-input>
+            </el-form-item>
+            <el-form-item label="职责目录编码" prop="code">
+                <el-input v-model="formData.code" placeholder="提交后自动生成" disabled></el-input>
+            </el-form-item>
+            <el-form-item label="核心数据项" prop="database">
+                <el-input v-model="formData.database" :title="formData.database" placeholder="请输入核心数据项"></el-input>
+            </el-form-item>
+            <el-form-item label="对应信息系统" prop="system">
+                <!-- <el-input v-model="formData.system" :title="formData.system" placeholder="请输入对应信息系统" /> -->
+                <el-select v-model="formData.system" placeholder="请选择系统架构">
+                    <el-option v-for="item in systemOption" :key="item.id" :label="item.misProjectName"
+                        :value="item.id" />
+                </el-select>
+            </el-form-item>
+            <el-form-item label="备注" prop="ps" class="textarea-row">
+                <el-input v-model="formData.ps" :title="formData.ps" type="textarea" :rows="4" placeholder="请输入备注" />
+            </el-form-item>
+            <el-form-item label="变更原因" v-if="dialogTitle == '审核'" prop="agenciesName">
+                <el-input :disabled="dialogTitle == '审核'" v-model="formData.agenciesName" placeholder="请输入变更原因" />
+            </el-form-item>
+
+            <!-- <template v-if="operationType == 'aduit'">
+        <el-row>
+          <el-col :span="12" class="two-form">
+         
+          </el-col>
+          <el-col :span="12"></el-col>
+          <el-col :span="7"></el-col>
+        </el-row>
+      </template> -->
+        </el-form>
+        <div slot="footer" class="dialog-footer">
+            <el-button @click="handleCancel">取 消</el-button>
+            <el-button type="primary" @click="handleConfirm">确 定</el-button>
+        </div>
+    </el-dialog>
+</template>
+
+<script>
+import { queryMisList, getDirectoryAllLevel } from '@/api/unified-resources/information-system/index.js'
+import { getResponsibilityMsg, addResponsibility, updateResponsibility } from '@/api/unified-resources/job-directory/index.js'
+import MyForm from "@/components/MyForm";
+export default {
+    name: "StandardDialog",
+    components: {
+        MyForm,
+    },
+    props: {
+        value: {
+            type: Boolean,
+            default: false,
+        },
+        title: {
+            type: String,
+            default: "弹窗标题",
+        },
+        rowObj: {
+            type: Object,
+            default: {},
+        },
+        width: {
+            type: String,
+            default: "50%",
+        },
+    },
+    data() {
+        return {
+            visible: this.value,
+            dialogTitle: '',
+            itemView: {},
+            // 这是传递给表单组件的数据
+            formData: {},
+            isDisabled: false,
+            buildDepartmentOptions: [],
+            systemOption: [],
+            formRules: {
+                agenciesName: [{ required: true, message: '请输入所属机构名称', trigger: 'blur' }],
+                agenciesPrsponsibility: [{ required: true, message: '请输入内设机构职责', trigger: 'blur' }],
+                matters: [{ required: true, message: '请输入职责事项', trigger: 'blur' }],
+                databasename: [{ required: true, message: '请输入职责事项', trigger: 'blur' }],
+                type: [{ required: true, message: '请输入职责类型', trigger: 'blur' }],
+                code: [{ required: true, message: '请输入职责目录编码', trigger: 'blur' }],
+                database: [{ required: true, message: '请输入核心数据项', trigger: 'blur' }],
+                system: [{ required: true, message: '请输入对应信息系统', trigger: 'blur' }]
+            }
+        };
+    },
+    watch: {
+        value(newVal) {
+            this.visible = newVal;
+        },
+        visible(newVal) {
+            this.$emit("input", newVal);
+        },
+        title: {
+            handler(newVal) {
+                this.dialogTitle = newVal;
+            },
+            deep: true, // 深入监听
+            immediate: true,
+        },
+        rowObj: {
+            handler(newVal) {
+                this.itemView = newVal;
+            },
+            deep: true, // 深入监听
+            immediate: true,
+        },
+    },
+
+    mounted() {
+        this.getOrganizationalList()
+
+        if (this.dialogTitle !== '新增') {
+            getResponsibilityMsg({ id: this.itemView.id }).then(res => {
+                if (+res.code === 200) {
+                    this.getTableListData(res.data[0].agenciesName)
+                    this.formData = res.data[0]
+                    this.formData.agenciesName = res.data[0].agenciesName ? res.data[0].agenciesName?.split(',') : []
+
+                }
+            })
+        }
+
+    },
+    methods: {
+        getOrganizationalList() {
+            getDirectoryAllLevel({ type: '组织机构' }).then(res => {
+                if (+res.code === 200) {
+                    if (res.data === null) {
+                        this.buildDepartmentOptions = []
+                    } else {
+                        this.removeListForLevel4(res.data[0].list)
+                        this.buildDepartmentOptions = res.data[0].list
+                    }
+                }
+            })
+        },
+        agenciesNameChange(value) {
+            let str = value.join(',')
+            this.getTableListData(str)
+        },
+        removeListForLevel4(data) {
+            data.forEach(item => {
+                // 如果是 level 4 的项,删除 list 属性
+                if (item.level === '4') {
+                    delete item.list;
+                }
+                // 如果当前项有子项(list),递归调用该函数
+                if (item.list && item.list.length > 0) {
+                    this.removeListForLevel4(item.list);
+                }
+            });
+        },
+        getTableListData(misProjectNameVal) {
+            queryMisList({ pageNumber: 1, pageSize: 9999, belongDepartment: misProjectNameVal }).then(res => {
+                if (res.data === null) {
+                    this.systemOption = []
+                } else {
+                    this.systemOption = res.data
+                }
+            })
+        },
+        handleUpdateVisible(val) {
+            this.visible = val;
+        },
+        beforeClose(done) {
+            this.visible = false;
+            this.$emit("before-close", done);
+        },
+        // 取消按钮处理方法
+        handleCancel() {
+            this.visible = false;
+            this.$emit("cancel"); // 可以在父组件监听 'cancel' 事件
+        },
+
+        // 确定按钮处理方法
+        async handleConfirm() {
+            if (this.title === "新增") {
+                this.formData.code = this.createRandomId()
+            }
+            // this.$refs.myFormComponent.validateForm();
+            await this.$refs.ruleFormRef.validate((valid, fields) => {
+                if (valid) {
+                    // 校验通过,进行后续操作
+                    console.log("表单校验通过,进行后续操作");
+                    this.handleSave();
+                } else {
+                    this.$message.error("请完整填写表单");
+                    console.log("表单校验失败");
+                }
+            })
+
+        },
+
+        handleSave() {
+
+            let pForm = {}
+            pForm = { ...this.formData }
+            pForm.agenciesName = pForm.agenciesName ? pForm.agenciesName?.join(',') : ''
+            if (this.title === "新增") {
+                addResponsibility({ ...pForm }).then(res => {
+                    if (+res.code === 200) {
+                        this.$message.success(res.msg)
+                        this.$emit("confirm");
+                        this.handleCancel()
+                    }
+                })
+            } else {
+                updateResponsibility({ id: this.itemView.id, ...pForm }).then(res => {
+                    if (+res.code === 200) {
+                        this.$message.success(res.msg)
+                        this.$emit("confirm");
+                        this.handleCancel()
+                    }
+                })
+            }
+        },
+        createRandomId() {
+            let min = Math.pow(10, 14);
+            let max = Math.pow(10, 15) - 1;
+            return Math.floor(Math.random() * (max - min + 1)) + min;
+        }
+    },
+};
+</script>
+
+<style scoped lang="scss">
+/* 你可以根据需要为弹窗添加样式 */
+</style>

+ 91 - 89
src/views/unified-resources/job-directory/index.vue

@@ -1,30 +1,71 @@
 <template>
   <el-container>
     <el-header height="60px" class="content-header">
-      <MyHeader
-        :title="'信息系统清单'"
-        :formData="headerFormData"
-        @submit="handleHeaderFormSubmit"
-      ></MyHeader>
+      <MyHeader :title="'职责目录'" :formData="headerFormData" @submit="handleHeaderFormSubmit"></MyHeader>
     </el-header>
     <el-container>
       <el-main>
-        <MyTableHeader
-          :title="tableHeaderTitle"
-          :tabs="tabs"
-          :buttons="buttons"
-          @tabClick="handleTabClick"
-          @buttonClick="handleButtonClick"
-        ></MyTableHeader>
+        <MyTableHeader :title="tableHeaderTitle" :tabs="tabs" :buttons="buttons" @tabClick="handleTabClick"
+          @buttonClick="handleButtonClick"></MyTableHeader>
 
-        <MyTable
+        <el-table ref="table" :data="tableData" class="table-new" >
+          <el-table-column type="selection" width="50" align="center" />
+          <el-table-column type="index" label="序号" width="70" align="center" />
+          <el-table-column prop="belongDepartmentName" label="内设机构名称" align="center" min-width="220"
+            :show-overflow-tooltip="true" />
+          <el-table-column prop="agenciesPrsponsibility" label="内设机构职责" align="center" min-width="120"
+            :show-overflow-tooltip="true" />
+          <el-table-column prop="matters" label="职责事项" align="center" :show-overflow-tooltip="true" />
+          <el-table-column prop="databasename" label="数据资源名称" align="center" :show-overflow-tooltip="true" />
+          <el-table-column prop="system" label="信息系统名称" align="center" :show-overflow-tooltip="true" />
+          <el-table-column prop="temp" label="是否对应数据目录" align="center" :show-overflow-tooltip="true">
+            <template #default="{ row }">
+              {{ row.temp === '1' ? '是' : '否' }}
+            </template>
+          </el-table-column>
+          <el-table-column prop="temp1" label="是否对应信息系统" align="center">
+            <template #default="{ row }">
+              {{ row.temp1 === '1' ? '是' : '否' }}
+            </template>
+          </el-table-column>
+          <el-table-column label="操作" align="center" min-width="220">
+            <template #default="scope">
+              <el-button link type="text" @click="handleView(scope.row)">
+                <el-icon>
+                  <View />
+                </el-icon>
+                <span>查看</span>
+              </el-button>
+              <el-button link type="text" @click="handleEdit(scope.row)">
+                <el-icon>
+                  <Edit />
+                </el-icon>
+                <span>编辑</span>
+              </el-button>
+              <el-button link type="text" @click="handleAduit('audit')" :disabled="true">
+                <!-- <el-icon><Delete /></el-icon> -->
+                <span>审核</span>
+              </el-button>
+              <!-- <el-link class="mr10">查看</el-link>
+              <el-link class="mr10">编辑</el-link>
+              <el-link class="mr10">审核</el-link> -->
+              <el-popconfirm title="确认删除此条?" @confirm="handleDeleteRow(scope.row)" class="popconfirm_btn">
+                <el-button type="text" icon="el-icon-delete" slot="reference">
+                  删除
+                </el-button>
+              </el-popconfirm>
+            </template>
+          </el-table-column>
+        </el-table>
+
+        <!-- <MyTable
           :tableData="tableData"
           :formData="formData"
           :minWidth="340"
           ref="myTableRef"
           @selection-change="handleSelectionChange"
         >
-          <!-- 自定义操作按钮,传递 row 和 index -->
+    
           <template #operation="{ row, index }">
             <el-button
               size="mini"
@@ -50,35 +91,30 @@
               >删除</el-button
             >
           </template>
-        </MyTable>
-        <MyPagination
-          :total="tableTotal"
-          :page-size="pageSize"
-          :current-page="currentPage"
-          @pageChange="pagi_changePage"
-          @sizeChange="pagi_changeSize"
-        ></MyPagination>
+        </MyTable> -->
+        <MyPagination :total="tableTotal" :page-size="pageSize" :current-page="currentPage"
+          @pageChange="pagi_changePage" @sizeChange="pagi_changeSize"></MyPagination>
       </el-main>
     </el-container>
 
-    <!-- <div v-if="showDialog">
-      <ConfigDialog
+    <div v-if="showDialog">
+      <JobDirectoryDialog
         v-model="showDialog"
         :title="title"
         :rowObj="rowObj"
         @confirm="getList"
-        @before-close=""
-      ></ConfigDialog>
-    </div> -->
+        @before-close="beforeClose"
+      ></JobDirectoryDialog>
+    </div>
   </el-container>
 </template>
 <script>
-import { queryMisList, addMis, updateMis, queryMisMsg, falseDeleteMis } from '@/api/unified-resources/information-system/index.js'
+import { getResponsibilityList, falseDeleteResponsibility } from '@/api/unified-resources/job-directory/index.js'
 import MyHeader from "@/components/MyHeader";
 import MyTable from "@/components/MyTable";
 import MyPagination from "@/components/MyPagination";
 import MyTableHeader from "@/components/MyTableHeader";
-// import ConfigDialog from "./dialog/ConfigDialog.vue";
+import JobDirectoryDialog from "./dialog/JobDirectoryDialog.vue";
 export default {
   name: "access-config",
   components: {
@@ -86,7 +122,7 @@ export default {
     MyTableHeader,
     MyTable,
     MyPagination,
-    // ConfigDialog,
+    JobDirectoryDialog,
   },
   data() {
     return {
@@ -136,7 +172,7 @@ export default {
           value: "",
           width: "",
         },
-       
+
       ],
       tableTotal: 0,
       pageSize: 10,
@@ -153,39 +189,19 @@ export default {
           methodName: "action1",
           icon: "el-icon-circle-plus",
         },
-     
+
       ],
 
       headerFormData: [
         {
-          label: "信息系统名称",
-          fieldName: "misProjectName",
+          label: "(内设)机构名称",
+          fieldName: "agenciesName",
           type: "input",
           value: "",
-          placeholder: "请输入信息系统名称",
+          placeholder: "请输入机构名称",
           // isRequired: true,
         },
-      
-        {
-          label: "所属单位",
-          fieldName: "belongDepartment",
-          type: "select",
-          value: "",
-          placeholder: "请选择所属单位",
-          isRequired: true,
-          options: [
-            { label: "男", value: "male" },
-            { label: "女", value: "female" },
-          ],
-        },
-        // {
-        //   label: "生日",
-        //   fieldName: "birthdate",
-        //   type: "date",
-        //   value: "",
-        //   placeholder: "请选择生日",
-        //   isRequired: false,
-        // },
+
       ],
     };
   },
@@ -197,7 +213,7 @@ export default {
       this.getList();
     },
     // 树结构点击
-    handleNodeClick() {},
+    handleNodeClick() { },
     // 列表头部
     handleTabClick(tab) {
       this.tabs.forEach((item) => {
@@ -219,7 +235,7 @@ export default {
           this.title = "新增";
           this.showDialog = true;
           break;
-  
+
         default:
           break;
       }
@@ -230,7 +246,7 @@ export default {
     },
 
     getList() {
-      queryMisList({
+      getResponsibilityList({
         pageNumber: this.currentPage,
         pageSize: this.pageSize,
         ...this.searchForm,
@@ -259,12 +275,12 @@ export default {
       this.dialogVisible = false;
     },
 
-    // 编辑
     handleView(row) {
       this.rowObj = row;
       this.title = "查看";
       this.showDialog = true;
     },
+    // 编辑
     handleEdit(row) {
       console.log(row, "row");
       this.rowObj = row;
@@ -276,37 +292,19 @@ export default {
       this.showDialog = false;
     },
 
-  
-    handleDelete(row) {
-      this.$confirm("此操作将永久删除该文件, 是否继续?", "提示", {
-        confirmButtonText: "确定",
-        cancelButtonText: "取消",
-        center: true,
-        type: "warning",
+
+    handleDeleteRow(row) {
+      falseDeleteResponsibility({ ids: row.id }).then(res => {
+        if (+res.code === 200) {
+          this.$message.success(res.msg)
+          this.getList()
+        } else {
+          this.$message.error(res.msg)
+        }
       })
-        .then(() => {
-          falseDeleteMis({ ids: row.id }).then((res) => {
-            if (+res.code === 200) {
-              this.$message({
-                message: res.msg,
-                type: "success",
-              });
-              this.getList();
-            } else {
-              this.$message.error(res.msg);
-            }
-          });
-        })
-        .catch(() => {
-          this.$message({
-            type: "info",
-            message: "已取消删除",
-          });
-        });
-      console.log(row, "row");
-    },
+    }
   },
-  created() {},
+  created() { },
   mounted() {
     this.getList();
   },
@@ -322,4 +320,8 @@ export default {
   font-weight: 700;
   color: #1e80e0;
 }
+
+.popconfirm_btn {
+  margin: 0 10px !important;
+}
 </style>