Forráskód Böngészése

内容库定义与内容管理入口合一

jiawuxian 1 éve
szülő
commit
5f1214844e

+ 10 - 0
src/plugins/tab.js

@@ -59,6 +59,16 @@ export default {
       router.go(-1);
     });
   },
+  setPageTitle(title){    
+    let  obj = router.currentRoute;
+
+    if(obj){
+      return store.dispatch("tagsView/setPageTitle",{
+        view:obj,
+        title
+      });
+    }
+  },
   // 关闭所有tab页签
   closeAllPage() {
     return store.dispatch("tagsView/delAllViews");

+ 27 - 0
src/router/index.js

@@ -252,6 +252,33 @@ export const dynamicRoutes = [
       }
     ]
   },
+  {
+    path: '/core/safetycheck/rule',
+    component: Layout,
+    hidden: true,
+     permissions: ['safetycheck:rule:contentmanage'],
+    children: [
+      {
+        path: 'content/:id(\\d+)',
+        component: () => import('@/views/safetycheck/ruleManager/index.vue'),
+        name: 'safetycheckRuleManager',
+        meta: { title: '检查内容库管理', activeMenu: '/safetycheck/rule' }
+      }
+    ]
+  },{
+    path: '/core/resumption/rule',
+    component: Layout,
+    hidden: true,
+     permissions: ['resumption:rule:contentmanage'],
+    children: [
+      {
+        path: 'content/:id(\\d+)',
+        component: () => import('@/views/resumption/ruleManager/index.vue'),
+        name: 'resumptionRuleManager',
+        meta: { title: '履职内容库管理', activeMenu: '/resumption/rule' }
+      }
+    ]
+  },
 ]
 
 // 防止连续点击多次路由报错

+ 10 - 0
src/store/modules/tagsView.js

@@ -218,6 +218,16 @@ const actions = {
       resolve([...state.visitedViews])
     })
   },
+  setPageTitle({commit}, obj){
+    let view={...obj.view} 
+    view.title=obj.title;
+    for (let v of state.visitedViews) {
+      if (v.path === view.path) {
+        v = Object.assign(v, view)
+        break
+      }
+    }    
+  }
 }
 
 export default {

+ 23 - 1
src/views/resumption/rule/index.vue

@@ -145,7 +145,7 @@
               header-align="center"
               label="操作"
               class="small-padding fixed-width"
-              width="150"
+              width="250"
             >
               <template slot-scope="r">
                 <el-button
@@ -158,6 +158,24 @@
                   >编辑</el-button
                 >
                 <el-button
+                  size="mini"
+                  type="text"
+                  icon="el-icon-edit-outline"
+                  @click="onManageContent(r.row.id)"
+                  v-hasPermi="['resumption:rule:contentmanage']"
+                  v-if="orgId == r.row.orgId"
+                  >管理内容库</el-button
+                >
+                <el-button
+                  size="mini"
+                  type="text"
+                  icon="el-icon-view"
+                  @click="onManageContent(r.row.id)"
+                  v-hasPermi="['resumption:rule:contentmanage']"
+                  v-if="orgId != r.row.orgId"
+                  >查看内容库</el-button
+                >
+                <el-button
                   type="text"
                   size="mini"
                   slot="reference"
@@ -278,6 +296,10 @@ export default {
     onEdit(id, other = {}) {
       this.$refs.editDialog.show(id, other);
     },
+    onManageContent(id){
+      let path=`/core/resumption/rule/content/${id}`
+      this.$router.push(path)
+    },
     onDel(id) {
       this.$modal
         .confirm("确定删除履职内容库定义?")

+ 33 - 14
src/views/resumption/ruleManager/index.vue

@@ -1,7 +1,7 @@
 <template>
   <div class="app-container">
     <el-row :gutter="10">
-      <el-col :span="4" :xs="24">
+      <!-- <el-col :span="4" :xs="24">
         <org-tree
           v-model="queryParams.orgId"
           @click="clicktreenode"
@@ -16,11 +16,14 @@
           :renderContent="renderContent"
         >
         </org-tree>
-      </el-col>
-      <el-col :span="20" :xs="24">
-        <div class="main-right-box">
+      </el-col> -->
+      <el-col :span="24" :xs="24">
+        <div class="main-right-box">          
           <!--    搜索条件    -->
           <div class="main-search-box" v-show="showSearch && rule">
+            <div v-if="rule" style="padding-bottom:10px;font-weight: 700;">
+              {{rule.name}}
+            </div>
             <el-form
               :model="queryParams"
               ref="search"
@@ -53,7 +56,7 @@
                   icon="el-icon-search"
                   size="mini"
                   @click="refresh"
-                  v-hasPermi="['resumption:ruleManager']"
+                  v-hasPermi="['resumption:rule:contentmanage']"
                   >搜索</el-button
                 >
                 <el-button
@@ -69,8 +72,8 @@
                   icon="el-icon-plus"
                   @click="onAddItem()"
                   :disabled="rule ? false : true"
-                  v-hasPermi="['resumption:ruleManager:add']"
-                  v-if="rule && rule.orgId == orgId && rule.ruleStatus == 0"
+                  v-hasPermi="['resumption:rule:contentmanage']"
+                  v-if="rule && rule.orgId == orgId && rule.status == 0"
                   >新增履职项</el-button
                 >
                 <!-- <el-button
@@ -193,7 +196,7 @@
               header-align="center"
               label="操作"
               width="150"
-              v-if="rule && rule.orgId == orgId && rule.ruleStatus == 0"
+              v-if="rule && rule.orgId == orgId && rule.status == 0"
             >
               <template slot-scope="scope">
                 <el-button
@@ -201,7 +204,7 @@
                   size="mini"
                   icon="el-icon-edit-outline"
                   @click="onEditItem(scope.row.id)"
-                  v-hasPermi="['resumption:ruleManager:edit']"
+                  v-hasPermi="['resumption:rule:contentmanage']"
                   >编辑</el-button
                 >
                 <el-button
@@ -210,7 +213,7 @@
                   slot="reference"
                   icon="el-icon-delete"
                   @click="deldata(scope.row.id)"
-                  v-hasPermi="['resumption:ruleManager:remove']"
+                  v-hasPermi="['resumption:rule:contentmanage']"
                   >删除</el-button
                 >
               </template>
@@ -239,6 +242,8 @@
 import OrgTree from "@/components/orgTree";
 import { mapGetters } from "vuex";
 import { page, treeData, del } from "@/api/resumption/ruleManager.js";
+import { get as getRule } from "@/api/resumption/rule.js";
+import { getLabel } from "./../../commonOption";
 import DialogEdit from "./dialog.editItem.vue";
 
 export default {
@@ -311,10 +316,24 @@ export default {
     // await this.getassetlist();
   },
 
-  mounted() {},
+  mounted() {
+    let id = this.$route.params.id;
+    if (!id) {
+      this.$tab.closePageAndPushPrev();
+      return;
+    }
+
+    getRule(id).then((r) => {
+      this.rule = r.data;
+      // this.$tab.setPageTitle(r.data.name);
+    });
+    this.queryParams.ruleId = id;
+    this.getList();
+  },
 
   methods: {
     treeData,
+    getLabel,
     dakai() {
       this.expandAll = !this.expandAll;
       this.fresh = false;
@@ -346,7 +365,7 @@ export default {
       this.tableData = data.rows;
       this.total = Number.parseInt(data.total);
       this.loading = false;
-    }, 
+    },
     clicktreenode(data, node) {
       this.tableData = [];
       this.rule = null;
@@ -359,7 +378,7 @@ export default {
       this.queryParams.ruleId = data.id;
       this.rule = data;
       this.rule.orgId = node.parent.data.id;
-      if (this.rule.ruleStatus != 0) {
+      if (this.rule.status != 0) {
         this.$message.info("履职内容库已禁用,无法编辑履职项、履职内容");
       }
       this.refresh();
@@ -417,7 +436,7 @@ export default {
     onSelect() {
       this.$refs.DialogSelect.show();
     },
-    onSuccess(isAdd) {   
+    onSuccess(isAdd) {
       if (isAdd) {
         this.queryParams.pageNum = 1;
       }

+ 26 - 3
src/views/safetycheck/rule/index.vue

@@ -141,9 +141,9 @@
               label="备注"
               v-if="columns[5].visible"
             ></el-table-column>
-            <el-table-column header-align="center" label="操作" width="150">
-              <template slot-scope="r" v-if="orgId == r.row.orgId">
-                <el-button
+            <el-table-column header-align="center" label="操作" width="250">
+              <template slot-scope="r">
+                <div  v-if="orgId == r.row.orgId"><el-button
                   size="mini"
                   type="text"
                   icon="el-icon-edit-outline"
@@ -152,6 +152,15 @@
                   >编辑</el-button
                 >
                 <el-button
+                  size="mini"
+                  type="text"
+                  icon="el-icon-edit-outline"
+                  @click="onManageContent(r.row.id)"
+                  v-hasPermi="['safetycheck:rule:contentmanage']"
+                  >管理内容库</el-button
+                >
+
+                <el-button
                   type="text"
                   size="mini"
                   slot="reference"
@@ -160,7 +169,17 @@
                   v-if="orgId == r.row.orgId"
                   v-hasPermi="['safetycheck:rule:remove']"
                   >删除</el-button
+                ></div>
+                <div  v-else>
+                  <el-button
+                  size="mini"
+                  type="text"
+                  icon="el-icon-view"
+                  @click="onManageContent(r.row.id)"
+                  v-hasPermi="['safetycheck:rule:contentmanage']"
+                  >查看内容库</el-button
                 >
+                </div>
               </template>
             </el-table-column>
           </el-table>
@@ -272,6 +291,10 @@ export default {
     onEdit(id, other = {}) {
       this.$refs.editDialog.show(id, other);
     },
+    onManageContent(id) {
+      let path = `/core/safetycheck/rule/content/${id}`;
+      this.$router.push(path);
+    },
     onDel(id) {
       this.$modal
         .confirm("确定删除检查内容库定义?")

+ 28 - 13
src/views/safetycheck/ruleManager/index.vue

@@ -2,7 +2,7 @@
 <template>
   <div class="app-container">
     <el-row :gutter="10">
-      <el-col :span="4" :xs="24">
+      <!-- <el-col :span="4" :xs="24">
         <org-tree
           v-model="queryParams.orgId"
           @click="clicktreenode"
@@ -17,11 +17,14 @@
           :renderContent="renderContent"
         >
         </org-tree>
-      </el-col>
-      <el-col :span="20" :xs="24">
+      </el-col> -->
+      <el-col :span="24" :xs="24">
         <div class="main-right-box">
           <!--    搜索条件    -->
           <div class="main-search-box" v-show="showSearch && rule">
+            <div style="padding-bottom:10px;font-weight: 700;">
+              {{rule.name}}
+            </div>
             <el-form
               :model="queryParams"
               ref="search"
@@ -54,7 +57,7 @@
                   icon="el-icon-search"
                   size="mini"
                   @click="refresh"
-                  v-hasPermi="['safetycheck:ruleManager']"
+                  v-hasPermi="['safetycheck:rule:contentmanage']"
                   >搜索</el-button
                 >
                 <el-button
@@ -70,8 +73,8 @@
                   icon="el-icon-plus"
                   @click="onAddItem()"
                   :disabled="rule ? false : true"
-                  v-hasPermi="['safetycheck:ruleManager:add']"
-                  v-if="rule && rule.orgId == orgId && rule.ruleStatus == 0"
+                  v-hasPermi="['safetycheck:rule:contentmanage']"
+                  v-if="rule && rule.orgId == orgId && rule.status == 0"
                   >新增检查项</el-button
                 >
                 <!-- <el-button
@@ -158,7 +161,7 @@
               header-align="center"
               label="操作"
               width="140"
-              v-if="rule && rule.orgId == orgId && rule.ruleStatus == 0"
+              v-if="rule && rule.orgId == orgId && rule.status == 0"
             >
               <template slot-scope="scope">
                 <el-button
@@ -166,7 +169,7 @@
                   size="mini"
                   icon="el-icon-edit-outline"
                   @click="onEditItem(scope.row.id)"
-                  v-hasPermi="['safetycheck:ruleManager:edit']"
+                  v-hasPermi="['safetycheck:rule:contentmanage']"
                   >编辑</el-button
                 >
                 <el-button
@@ -175,7 +178,7 @@
                   slot="reference"
                   icon="el-icon-delete"
                   @click="deldata(scope.row.id)"
-                  v-hasPermi="['safetycheck:ruleManager:remove']"
+                  v-hasPermi="['safetycheck:rule:contentmanage']"
                   >删除</el-button
                 >
               </template>
@@ -197,14 +200,13 @@
       :pointDataSource="dict.type.point_data_source"
       @success="onSuccess"
     ></dialog-edit>
-    <SelectPoint ref="DialogSelect" @success="onSuccess" orgType="4">
-    </SelectPoint>
   </div>
 </template>
 
 <script>
 import { mapGetters } from "vuex";
 import { page, treeData, del } from "@/api/safetycheck/ruleManager.js";
+import { get as getRule } from "@/api/safetycheck/rule.js";
 import DialogEdit from "./dialog.editItem.vue";
 import SelectPoint from "./dialog.select.point.vue";
 import OrgTree from "@/components/orgTree";
@@ -276,7 +278,20 @@ export default {
     // await this.getassetlist();
   },
 
-  mounted() {},
+  mounted() {
+    let id = this.$route.params.id;
+    if (!id) {
+      this.$tab.closePageAndPushPrev();
+      return;
+    }
+
+    getRule(id).then((r) => {
+      this.rule = r.data;
+      // this.$tab.setPageTitle(r.data.name);
+    });
+    this.queryParams.ruleId = id;
+    this.getList();
+  },
 
   methods: {
     treeData,
@@ -323,7 +338,7 @@ export default {
       this.queryParams.ruleId = data.id;
       this.rule = data;
       this.rule.orgId = node.parent.data.id;
-      if (this.rule.ruleStatus != 0) {
+      if (this.rule.status != 0) {
         this.$message.info("履职内容库已禁用,无法编辑履职项、履职内容");
       }
       this.refresh();