wangggziwen 1 mēnesi atpakaļ
vecāks
revīzija
6002ff6f8f

+ 21 - 0
rc-admin/src/main/java/com/ruoyi/web/controller/rc/TStandardChapterController.java

@@ -2,8 +2,12 @@ package com.ruoyi.web.controller.rc;
 
 import com.ruoyi.common.core.domain.entity.SysDept;
 import com.ruoyi.system.service.ISysDeptService;
+
+import java.util.ArrayList;
 import java.util.List;
 import javax.servlet.http.HttpServletResponse;
+
+import com.ruoyi.web.controller.rc.vo.TreeVO;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.GetMapping;
@@ -35,12 +39,29 @@ public class TStandardChapterController extends BaseController
 {
     @Autowired
     private ITStandardChapterService tStandardChapterService;
+
     /**
      * 查询标准模板章节列表
      */
     @GetMapping("/list")
     public AjaxResult list(TStandardChapter tStandardChapter)
     {
+//        //数组集合结构
+//        List<TStandardChapter> tStandardChapters = tStandardChapterService.selectTStandardChapterList(tStandardChapter);
+//        //树状VO结构
+//        ArrayList<TreeVO> treeVo = new ArrayList<>();
+//        for (TStandardChapter standardChapter : tStandardChapters) {
+//            Long id = standardChapter.getId();
+//            String code = standardChapter.getCode();
+//            String name = standardChapter.getName();
+//            if (code.indexOf(".") == -1) {
+//                TreeVO vo = new TreeVO();
+//                vo.setId(id);
+//                vo.setLabel(name);
+//                treeVo.add(vo);
+//            }
+//        }
+//        return success(treeVo);
         return success(tStandardChapterService.selectTStandardChapterList(tStandardChapter));
     }
 

+ 14 - 0
rc-admin/src/main/java/com/ruoyi/web/controller/rc/TStandardQuestionnaireController.java

@@ -2,6 +2,9 @@ package com.ruoyi.web.controller.rc;
 
 import com.ruoyi.common.core.domain.entity.SysDept;
 import com.ruoyi.common.core.page.TableDataInfo;
+import com.ruoyi.rc.domain.TChapter;
+import com.ruoyi.rc.domain.TStandardChapter;
+import com.ruoyi.rc.service.ITStandardChapterService;
 import com.ruoyi.system.service.ISysDeptService;
 import java.util.List;
 import javax.servlet.http.HttpServletResponse;
@@ -37,6 +40,9 @@ public class TStandardQuestionnaireController extends BaseController
     @Autowired
     private ITStandardQuestionnaireService tStandardQuestionnaireService;
 
+    @Autowired
+    private ITStandardChapterService tStandardChapterService;
+
     /**
      * 查询标准模板问卷列表
      */
@@ -76,6 +82,14 @@ public class TStandardQuestionnaireController extends BaseController
     @PostMapping
     public AjaxResult add(@RequestBody TStandardQuestionnaire tStandardQuestionnaire)
     {
+        if (StringUtils.isNotNull(tStandardQuestionnaire.getDirectory())) {
+            TStandardChapter params = new TStandardChapter();
+            params.setCode(tStandardQuestionnaire.getDirectory());
+            TStandardChapter chapter = tStandardChapterService.selectTStandardChapterByCode(params);
+            if (chapter != null) {
+                tStandardQuestionnaire.setChapterId(chapter.getId());
+            }
+        }
         return toAjax(tStandardQuestionnaireService.insertTStandardQuestionnaire(tStandardQuestionnaire));
     }
 

+ 44 - 0
rc-admin/src/main/java/com/ruoyi/web/controller/rc/vo/TreeVO.java

@@ -0,0 +1,44 @@
+package com.ruoyi.web.controller.rc.vo;
+
+import java.util.ArrayList;
+
+/**
+ * 树状节点VO
+ * @date 2025/07/30 14:31:24
+ */
+public class TreeVO {
+
+    private Long id;
+
+    private String label;
+
+    private ArrayList<TreeVO> children = new ArrayList<>();
+
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    public String getLabel() {
+        return label;
+    }
+
+    public void setLabel(String label) {
+        this.label = label;
+    }
+
+    public ArrayList<TreeVO> getChildren() {
+        return children;
+    }
+
+    public void setChildren(ArrayList<TreeVO> children) {
+        this.children = children;
+    }
+
+    public TreeVO() {
+    }
+
+}

+ 12 - 1
rc-buisness/src/main/java/com/ruoyi/rc/domain/TStandardQuestionnaire.java

@@ -74,7 +74,18 @@ public class TStandardQuestionnaire extends BaseEntity
     @Excel(name = "删除状态")
     private String delFlag;
 
-    public void setId(Long id) 
+    /** 关键字 */
+    private String keywords;
+
+    public String getKeywords() {
+        return keywords;
+    }
+
+    public void setKeywords(String keywords) {
+        this.keywords = keywords;
+    }
+
+    public void setId(Long id)
     {
         this.id = id;
     }

+ 2 - 0
rc-buisness/src/main/java/com/ruoyi/rc/mapper/TStandardChapterMapper.java

@@ -19,6 +19,8 @@ public interface TStandardChapterMapper
      */
     public TStandardChapter selectTStandardChapterById(Long id);
 
+    public TStandardChapter selectTStandardChapterByCode(TStandardChapter tStandardChapter);
+
     /**
      * 查询标准模板章节列表
      * 

+ 2 - 0
rc-buisness/src/main/java/com/ruoyi/rc/service/ITStandardChapterService.java

@@ -19,6 +19,8 @@ public interface ITStandardChapterService
      */
     public TStandardChapter selectTStandardChapterById(Long id);
 
+    public TStandardChapter selectTStandardChapterByCode(TStandardChapter tStandardChapter);
+
     /**
      * 查询标准模板章节列表
      * 

+ 5 - 0
rc-buisness/src/main/java/com/ruoyi/rc/service/impl/TStandardChapterServiceImpl.java

@@ -31,6 +31,11 @@ public class TStandardChapterServiceImpl implements ITStandardChapterService
         return tStandardChapterMapper.selectTStandardChapterById(id);
     }
 
+    @Override
+    public TStandardChapter selectTStandardChapterByCode(TStandardChapter tStandardChapter) {
+        return tStandardChapterMapper.selectTStandardChapterByCode(tStandardChapter);
+    }
+
     /**
      * 查询标准模板章节列表
      * 

+ 5 - 0
rc-buisness/src/main/resources/mapper/rc/TStandardChapterMapper.xml

@@ -33,6 +33,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         where id = #{id}
     </select>
 
+    <select id="selectTStandardChapterByCode" parameterType="TStandardChapter" resultMap="TStandardChapterResult">
+        <include refid="selectTStandardChapterVo"/>
+        where code = #{code}
+    </select>
+
     <insert id="insertTStandardChapter" parameterType="TStandardChapter" useGeneratedKeys="true" keyProperty="id">
         <selectKey keyProperty="id" order="BEFORE" resultType="Long">
             select seq_t_standard_chapter.nextval as id from DUAL

+ 18 - 6
rc-buisness/src/main/resources/mapper/rc/TStandardQuestionnaireMapper.xml

@@ -19,10 +19,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="deleteTime"    column="delete_time"    />
         <result property="link"    column="link"    />
         <result property="delFlag"    column="del_flag"    />
+        <result property="keywords"    column="keywords"    />
     </resultMap>
 
     <sql id="selectTStandardQuestionnaireVo">
-        select id, chapter_id, year, type, directory, code, name, yes_no_na, minimum_standard, remarks, create_time, delete_time, link, del_flag from t_standard_questionnaire
+        SELECT id, chapter_id, year, type, directory, code, name, yes_no_na, minimum_standard, remarks, create_time, delete_time, link, del_flag,
+               CASE
+                 WHEN INSTR(directory, '.') > 0 THEN SUBSTR(directory, 1, INSTR(directory, '.') - 1)
+                 ELSE directory
+                   END AS directorySubStr
+        FROM t_standard_questionnaire
     </sql>
 
     <select id="selectTStandardQuestionnaireList" parameterType="TStandardQuestionnaire" resultMap="TStandardQuestionnaireResult">
@@ -31,15 +37,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="chapterId != null "> and chapter_id = #{chapterId}</if>
             <if test="year != null  and year != ''"> and year = #{year}</if>
             <if test="type != null  and type != ''"> and type = #{type}</if>
-            <if test="directory != null  and directory != ''"> and directory = #{directory}</if>
-            <if test="code != null "> and code = #{code}</if>
-            <if test="name != null  and name != ''"> and name like concat('%', #{name}, '%')</if>
             <if test="yesNoNa != null  and yesNoNa != ''"> and yes_no_na = #{yesNoNa}</if>
-            <if test="minimumStandard != null  and minimumStandard != ''"> and minimum_standard = #{minimumStandard}</if>
-            <if test="remarks != null  and remarks != ''"> and remarks = #{remarks}</if>
             <if test="deleteTime != null "> and delete_time = #{deleteTime}</if>
             <if test="link != null "> and link = #{link}</if>
+            <if test="keywords != null  and keywords != ''">
+                and
+                (
+                    directory like concat(concat('%', #{keywords}), '%')
+                    or code like concat(concat('%', #{keywords}), '%')
+                    or name like concat(concat('%', #{keywords}), '%')
+                    or minimum_standard like concat(concat('%', #{keywords}), '%')
+                    or remarks like concat(concat('%', #{keywords}), '%')
+                )
+            </if>
         </where>
+        order by directorySubStr asc, directory asc, code asc
     </select>
     
     <select id="selectTStandardQuestionnaireById" parameterType="Long" resultMap="TStandardQuestionnaireResult">

+ 2 - 2
rc-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java

@@ -111,11 +111,11 @@ public class SecurityConfig
             .authorizeHttpRequests((requests) -> {
                 permitAllUrl.getUrls().forEach(url -> requests.antMatchers(url).permitAll());
                 // 对于登录login 注册register 验证码captchaImage 允许匿名访问
-                requests.antMatchers("/login", "/register", "/captchaImage").permitAll()
+                requests.antMatchers("/login", "/register", "/captchaImage", "/showstandardtemplate").permitAll()
                     // 静态资源,可匿名访问
                     .antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**").permitAll()
                     .antMatchers("/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**").permitAll()
-                        .antMatchers("/ehs/approvedanger/processImg/**", "/common/template").permitAll()
+                        .antMatchers("/ehs/approvedanger/processImg/**", "/common/template", "/rc/standardchapter/**", "/rc/standardquestionnaire/**", "/rc/commonfile/**").permitAll()
                     // 除上面外的所有请求全部需要鉴权认证
                     .anyRequest().authenticated();
             })

+ 1 - 1
ruoyi-ui/src/permission.js

@@ -8,7 +8,7 @@ import { isRelogin } from '@/utils/request'
 
 NProgress.configure({ showSpinner: false })
 
-const whiteList = ['/login', '/register']
+const whiteList = ['/login', '/register', '/showstandardtemplate']
 
 router.beforeEach((to, from, next) => {
   NProgress.start()

+ 5 - 0
ruoyi-ui/src/router/index.js

@@ -46,6 +46,11 @@ export const constantRoutes = [
     component: () => import('@/views/login'),
     hidden: true
   },
+  {
+    path: '/showstandardtemplate',
+    component: () => import('@/views/showstandardtemplate'),
+    hidden: true
+  },
   {
     path: '/register',
     component: () => import('@/views/register'),

+ 52 - 1
ruoyi-ui/src/views/rc/standardchapter/index.vue

@@ -13,6 +13,14 @@
       />
       </div>
       <div class="head-container">
+        <!--<el-tree-->
+          <!--style="height: 800px; overflow: scroll;"-->
+          <!--:data="treeData"-->
+          <!--:props="treeProps"-->
+          <!--node-key="id"-->
+          <!--@node-click="handleTreeNodeClick"-->
+          <!--:default-expand-all="true">-->
+        <!--</el-tree>-->
         <el-table
           :height="clientHeight"
           ref="chapterList"
@@ -69,6 +77,43 @@ export default {
       // 表单校验
       rules: {
       },
+      treeData: [
+        {
+          id: 1001,
+          label: '一级 1',
+          children: [{
+            id: 1002,
+            label: '二级 1-1',
+            children: [{
+              id: 1003,
+              label: '三级 1-1-1'
+            }]
+          }]
+        },
+        {
+          id: 1004,
+          label: '一级 2',
+          children: [{
+            id: 1005,
+            label: '二级 2-1',
+            children: [{
+              id: 1006,
+              label: '三级 2-1-1'
+            }]
+          }, {
+            id: 1007,
+            label: '二级 2-2',
+            children: [{
+              id: 1008,
+              label: '三级 2-2-1'
+            }]
+          }]
+        }
+      ],
+      treeProps: {
+        children: 'children',
+        label: 'label'
+      }
     };
   },
   created() {
@@ -79,15 +124,21 @@ export default {
     // this.getList();
   },
   methods: {
+    handleTreeNodeClick(data) {
+      this.$emit('questionnaire', data.id);
+    },
     // 节点单击事件
     handleNodeClick(row) {
-      this.$emit('standardquestionnaire', row.id);
+      this.$emit('questionnaire', row.id);
     },
     /** 查询章节列表 */
     getList() {
       this.loading = true;
       listStandardChapter().then(response => {
         this.chapterList = response.data;
+        // this.treeData = response.data;
+        // console.log(this.treeData)
+        // console.log(response.data)
         this.total = response.total;
         this.loading = false;
       });

+ 68 - 32
ruoyi-ui/src/views/rc/standardquestionnaire/index.vue

@@ -2,6 +2,14 @@
   <div class="app-container" style="padding: 0px;">
     <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="80px">
       <el-form-item>
+        <el-form-item label="关键字" prop="keywords">
+          <el-input
+            v-model="queryParams.keywords"
+            placeholder="请输入关键字"
+            clearable
+            @keyup.enter.native="handleQuery"
+          />
+        </el-form-item>
         <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
         <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
       </el-form-item>
@@ -47,7 +55,7 @@
       <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
     </el-row>
 
-    <el-table :height="clientHeight" border v-loading="loading" :data="questionnaireList" @selection-change="handleSelectionChange" style="font-size: 12px;">
+    <el-table :height="clientHeight" :row-style="rowStyle" border v-loading="loading" :data="questionnaireList" @selection-change="handleSelectionChange" style="font-size: 12px;">
       <el-table-column type="selection" width="55" align="center" />
       <el-table-column label="年份" align="center" prop="year"/>
       <el-table-column label="问卷类型" align="center" prop="type">
@@ -74,10 +82,18 @@
         </template>
       </el-table-column>
       <el-table-column label="MinimumStandard" align="center" prop="minimumStandard" width="150" />
-      <el-table-column label="标准文档" align="center" prop="minimumStandard" width="150" />
-      <el-table-column label="Good Pratices" align="center" prop="minimumStandard" width="150" />
-      <el-table-column label="链接" align="center" prop="link" width="150" />
-      <el-table-column label="备注" align="center" prop="remarks" width="150" />
+      <el-table-column label="标准文档" align="center" width="150">
+        <template slot-scope="scope">
+          <el-button icon="el-icon-folder" style="color:#6e96fa;" circle @click="handleDoc(scope.row , 'standard')"></el-button>
+        </template>
+      </el-table-column>
+      <el-table-column label="Good Pratices" align="center" width="150">
+        <template slot-scope="scope">
+          <el-button icon="el-icon-folder" style="color:#6e96fa;" circle @click="handleDoc(scope.row , 'good-practices')"></el-button>
+        </template>
+      </el-table-column>
+      <el-table-column label="链接" align="center" prop="link" width="300" />
+      <el-table-column label="备注" align="center" prop="remarks" width="300" />
       <el-table-column label="创建时间" align="center" prop="createTime" width="150">
         <template slot-scope="scope">
           <span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span>
@@ -90,7 +106,7 @@
       </el-table-column>
       <el-table-column label="数据状态" align="center" prop="delFlag" width="150" >
         <template slot-scope="scope">
-          <span>{{scope.row.delFlag == 0 ? "" : "删除"}}</span>
+          <span>{{scope.row.delFlag == 0 ? "正常" : "删除"}}</span>
         </template>
       </el-table-column>
       <el-table-column label="操作" align="center" width="120" fixed="right" class-name="small-padding fixed-width">
@@ -106,7 +122,14 @@
             type="text"
             icon="el-icon-delete"
             @click="handleDelete(scope.row)"
+            v-if="scope.row.delFlag == 0"
           >删除</el-button>
+          <el-button
+            size="mini"
+            type="text"
+            @click="handleRecover(scope.row)"
+            v-if="scope.row.delFlag == 2"
+          >恢复</el-button>
         </template>
       </el-table-column>
     </el-table>
@@ -264,13 +287,15 @@ export default {
         name: null,
         yesNoNa: null,
         minimumStandard: null,
-        remarks: null
+        remarks: null,
+        keywords: null,
       },
       // 表单参数
       form: {},
       openitemForm: {},
       // 表单校验
       rules: {
+        directory: [{required: true, message: "目录不可为空", trigger: "blur"}],
       },
       // 附件参数
       doc: {
@@ -305,32 +330,32 @@ export default {
     this.$nextTick(() => {
       this.clientHeight = (document.body.clientHeight - 80) * 0.8
     })
-    // this.getList();
+    this.getList();
   },
   methods: {
+    rowStyle({row, rowIndex}) {
+      if (row.delFlag == 2) {
+        return {
+          background: "#DCDCDC"
+        }
+      }
+    },
     /** 附件按钮操作 */
     handleDoc(row , type) {
       var typeName = "";
-      if (type === "questionnaire-standard"){
-        typeName = "标准附件";
-        this.doc.pType = type
-        this.doc.queryParams.pType = type
-        this.doc.id = row.id;
-        this.doc.title = "标准附件(CODE " + row.code + ")";
-        this.doc.open = true;
-        this.doc.queryParams.pId = row.id
-        this.doc.pId = row.id
-        this.getFileList();
-      } else if (type === 'audit') {
-        this.$router.push({
-          path: '/rc/file',
-          query: {
-            linkId: row.id,
-            linkName: 'questionnaire',
-            auditResult: this.auditResult,
-          }
-        })
+      if (type === "standard"){
+        typeName = "标准";
+      } else if (type === 'good-practices') {
+        typeName = "Good Practices";
       }
+      this.doc.title = typeName + "(CODE " + row.code + ")";
+      this.doc.pType = type;
+      this.doc.queryParams.pType = type;
+      this.doc.id = row.id;
+      this.doc.open = true;
+      this.doc.queryParams.pId = row.id
+      this.doc.pId = row.id
+      this.getFileList();
     },
     getFileList(){
       allFileList(this.doc.queryParams).then(response => {
@@ -388,7 +413,6 @@ export default {
     /** 查询问卷列表 */
     getList(chapterId) {
       this.loading = true;
-      this.loading = false;
       if (chapterId != null) {
         this.queryParams.chapterId = chapterId;
       }
@@ -416,7 +440,6 @@ export default {
         yesNoNa: null,
         minimumStandard: null,
         remarks: null,
-        deptId: null
       };
       this.resetForm("form");
     },
@@ -427,8 +450,11 @@ export default {
     },
     /** 重置按钮操作 */
     resetQuery() {
-      this.resetForm("queryForm");
-      this.handleQuery();
+        this.resetForm("queryForm");
+      // this.handleQuery();
+      this.queryParams.pageNum = 1;
+      this.queryParams.chapterId = null;
+      this.getList(null);
     },
     // 多选框选中数据
     handleSelectionChange(selection) {
@@ -439,7 +465,6 @@ export default {
     /** 新增按钮操作 */
     handleAdd() {
       this.reset();
-      this.form.chapterId = this.queryParams.chapterId;
       this.open = true;
       this.title = "添加问卷";
     },
@@ -453,6 +478,17 @@ export default {
         this.title = "修改问卷";
       });
     },
+    handleRecover(row) {
+      const ids = row.id || this.ids;
+      this.$modal.confirm('是否确认恢复问卷编号为"' + ids + '"的数据项?').then(function() {
+        row.delFlag = 0;
+        row.deleteTime = null;
+        updateStandardQuestionnaire(row);
+      }).then(() => {
+        this.getList();
+        this.$modal.msgSuccess("恢复成功");
+      }).catch(() => {});
+    },
     /** 提交按钮 */
     submitForm() {
       this.$refs["form"].validate(valid => {

+ 18 - 0
ruoyi-ui/src/views/showstandardtemplate.vue

@@ -0,0 +1,18 @@
+<template>
+    <div>
+      <standard-template></standard-template>
+    </div>
+</template>
+
+<script>
+  import StandardTemplate from "./rc/standardtemplate";
+
+    export default {
+        name: "showstandardtemplate",
+        components: { StandardTemplate },
+    }
+</script>
+
+<style scoped>
+
+</style>