jiawuxian 2 жил өмнө
parent
commit
01a0caf48d

+ 17 - 0
src/api/safetycheck/register.js

@@ -0,0 +1,17 @@
+import request from "@/utils/request";
+
+// 登记信息
+export function info(id) {
+  return request({
+    url: "/core/safetycheck/register/" + id,
+    method: "get",
+  });
+}
+
+// 登记信息
+export function submit(data) {
+  return request({
+    url: "/core/safetycheck/register",
+    method: "POST",
+  });
+}

+ 0 - 4
src/views/question/list/index.vue

@@ -247,10 +247,6 @@
 <script>
 <script>
 import {
 import {
   listQuestion,
   listQuestion,
-  getQuestion,
-  delQuestion,
-  addQuestion,
-  updateQuestion,
 } from "@/api/question/list.js";
 } from "@/api/question/list.js";
 import OrgTree from "@/components/orgTree";
 import OrgTree from "@/components/orgTree";
 import Dialog from "./dialog.vue";
 import Dialog from "./dialog.vue";

+ 8 - 5
src/views/safetycheck/ruleManager/dialog.select.point.vue

@@ -80,18 +80,21 @@ export default {
   computed: {},
   computed: {},
   watch: {},
   watch: {},
   props: {
   props: {
-    defaultSelect:{
-      type:Array
-    },
+    // defaultSelect:{
+    //   type:Array
+    // },
     orgType:{
     orgType:{
       type:String
       type:String
     }
     }
   },
   },
   methods: {
   methods: {
-    show() {
+    show(defaultSelect) {
       this.search = this.emptySearch();
       this.search = this.emptySearch();
       this.isShow = true;
       this.isShow = true;
-      this.selectList =this.defaultSelect; 
+      if (defaultSelect && defaultSelect.map) {
+        this.selectList = defaultSelect.map((s) => ({ id: s }));
+      }
+      
       ruleListForOrg({ orgType: this.orgType }).then((r) => {
       ruleListForOrg({ orgType: this.orgType }).then((r) => {
         this.ruleList = r.data;
         this.ruleList = r.data;
         if (r.data && r.data.length > 0) {
         if (r.data && r.data.length > 0) {

+ 227 - 0
src/views/safetycheck/taskManager/components/register.vue

@@ -0,0 +1,227 @@
+<template>
+  <el-dialog
+    :title="检查任务"
+    :visible.sync="dialogVisible"
+    width="50%"
+    :show-close="true"
+    @close="onHide"
+  >
+    <el-descriptions>
+      <el-descriptions-item label="检查名称">{{
+        info.taskName
+      }}</el-descriptions-item>
+      <el-descriptions-item label="检查机构">{{
+        info.checkOrgName
+      }}</el-descriptions-item>
+      <el-descriptions-item label="受检机构">{{
+        info.beCheckOrgName
+      }}</el-descriptions-item>
+      <el-descriptions-item label="检查角色"
+        >{{ info.checkRoleNames }}
+      </el-descriptions-item>
+      <el-descriptions-item label="开始日期"
+        >{{ dayjs(info.planStartTime).format("YYYY-MM-DD") }}
+      </el-descriptions-item>
+      <el-descriptions-item label="截止日期"
+        >{{ dayjs(info.planEndTime).format("YYYY-MM-DD") }}
+      </el-descriptions-item>
+      <el-descriptions-item label="创建时间"
+        >{{ dayjs(info.planStartTime).format("YYYY-MM-DD") }}
+      </el-descriptions-item>
+      <el-descriptions-item label="检查组成员"
+        ><el-input
+          placeHolder="请输入检查组成员"
+          v-model="info.checkTeam"
+        ></el-input>
+      </el-descriptions-item>
+      <el-descriptions-item label="检查状态"
+        >{{ dayjs(info.planStartTime).format("YYYY-MM-DD") }}
+      </el-descriptions-item>
+    </el-descriptions>
+    <div>
+      <span>巡检区域</span>
+      <el-button type="primary" @click="onAddPoint()">新增检查内容</el-button>
+    </div>
+    <div class="content" v-for="area in info.areaList">
+      <div>
+        {{ area.areaName }}
+      </div>
+      <div>
+        <div v-for="(item, index) in area.itemList">
+          <span>{{ index + 1 }}、{{ item.itemName }}</span>
+          <div v-for="point in item.pointList">
+            <div>
+              <span><i class="circle" /> {{ point.pointName }}</span>
+              <el-radio-group v-model="point.status">
+                <el-radio :value="0">正常</el-radio>
+                <el-radio :label="1">异常</el-radio>
+              </el-radio-group>
+            </div>
+            <div v-if="point.status == 1">
+              <el-form
+                :ref="'form_' + point.pointId"
+                :model="point"
+                :rule="exceptionRules"
+              >
+                <el-form-item label="情况描述" prop="remark">
+                  <el-input v-model="point.remark"></el-input>
+                </el-form-item>
+                <el-form-item label="异常图片" prop="image"> </el-form-item>
+                <el-form-item label="整改期限" prop="rectificationDeadline">
+                  <el-select
+                    v-model="point.rectificationDeadline"
+                    placeHolder="请选择整改期限"
+                  >
+                    <el-option
+                      v-for="item in dict.type.rectification_deadline"
+                      :key="item.value"
+                      :value="item.value"
+                      :label="item.label"
+                    ></el-option>
+                  </el-select>
+                </el-form-item>
+              </el-form>
+            </div>
+          </div>
+        </div>
+      </div>
+    </div>
+    <div slot="footer" class="dialog-footer">
+      <el-button @click="dialogVisible = false">取消</el-button>
+      <el-button @click="onGrant">授权</el-button>
+      <el-button @click="onSave">保存</el-button>
+      <el-button type="primary" @click="onSubmit()">提交</el-button>
+    </div>
+    <SelectPoint
+      ref="SelectPoint"
+      :orgType="info.beCheckOrgType"
+      @select="onSelectPoint"
+    ></SelectPoint>
+  </el-dialog>
+</template>
+<script>
+import * as api from "@/api/safetycheck/register.js";
+import dayjs from "dayjs";
+import SelectPoint from "../../ruleManager/dialog.select.point.vue";
+export default {
+  data() {
+    return {
+      info: {},
+      exceptionRules: {
+        remark: [{ required: true, message: "请输入情况描述" }],
+        rectificationDeadline: [{ required: true, message: "请选择整改期限" }],
+      },
+      pointIdsWhenAdd: [],
+    };
+  },
+  dicts: ["rectification_deadline"],
+  components: { SelectPoint },
+  mounted() {
+    api.info(id).then((r) => {
+      this.info = r.data;
+    });
+  },
+  methods: {
+    onAddPoint() {
+      this.pointIdsWhenAdd = [];
+      this.info.areaList.forEach((a) => {
+        a.itemList.forEach((i) => {
+          i.pointList.forEach((p) => {
+            this.pointIdsWhenAdd.push(p.pointId);
+          });
+        });
+      });
+      this.$ref.SelectPoint.show(this.pointIdsWhenAdd);
+    },
+    onSelectPoint(selectedList) {
+      let hasNew = false;
+      for (let p in selectedList) {
+        if (this.pointIdsWhenAdd.indexOf(p.id) >= 0) {
+          continue;
+        }
+        let info = this.info;
+        let area = info.areaList.find((a) => a.areaId === p.areaId);
+        if (!area) {
+          area = { areaId: p.areaId, areaName: p.areaName, itemList: [] };
+          info.areaList.push(area);
+        }
+
+        let item = area.itemList((i) => i.itemId == p.itemId);
+        if (!item) {
+          item = { itemId: p.itemId, itemName: p.itemName, pointList: [] };
+          area.itemList.push(item);
+        }
+
+        let point = item.pointList.find((i) => i.pointId == p.id);
+        if (!point) {
+          point = {
+            pointId: p.id,
+            pointName: p.pointName,
+            mustCheck: 1,
+            isAdd: 1,
+            status: 0,
+            remark: null,
+            imgData: null,
+            rectificationDeadline: null,
+            submitBy: null,
+            submitTime: null,
+          };
+
+          item.pointList.push(point);
+          hasNew = true;
+        }
+      }
+      if (!hasNew) {
+        this.$message.info("没有可新增的检查内容");
+      }
+    },
+    onDeletePoint(item, point) {
+      if (point.isAdd === 0) {
+        this.$message.warning("不可删除计划的检查内容");
+        return;
+      }
+
+      let index = item.indexOf(point);
+      if (index >= 0) {
+        item.pointList.splice(index, 1);
+      }
+    },
+    onGrant() {},
+    onSave() {
+      this.info.isSubmit = false;
+      api.submit(this.info).then((r) => {
+        this.$message.info("保存成功");
+      });
+    },
+    async onSubmit() {
+      let isOk = true;
+      for (let p in this.$ref.forms) {
+        isOk &= await this.$ref.forms[p].validate();
+      }
+      if (isOk) {
+        this.info.isSubmit = true;
+        api.submit(info);
+      }
+    },
+  },
+};
+</script>
+<style lan="scss" scoped>
+.content {
+  border: black 1px solid;
+}
+.content:first-child {
+  background-color: #c4c4c4;
+  padding-top: auto;
+  padding-bottom: auto;
+}
+.circle {
+  display: inline-block;
+  width: 5px;
+  height: 5px;
+  border-radius: 5px;
+  background-color: #333333;
+  border: none;
+  margin-bottom: 3px;
+}
+</style>