Ver código fonte

人员体检信息

ltao 3 anos atrás
pai
commit
7f8737b613

+ 8 - 0
src/api/medicalhealth/examine.js

@@ -53,6 +53,14 @@ export function delExamine(id) {
   })
 }
 
+// 删除
+export function delshanchu(id) {
+  return request({
+    url: '/medicalhealth/details/' + id,
+    method: 'delete'
+  })
+}
+
 // 导出人员体检信息
 export function exportExamine(query) {
   return request({

+ 49 - 14
src/views/medicalhealth/examine/index.vue

@@ -247,7 +247,7 @@
         <el-form
           ref="form"
           :model="form"
-          :rules="rules"
+          :rules="rules1"
           :inline="true"
           style="margin-left: 30px"
         >
@@ -256,7 +256,7 @@
           </el-form-item>
           <div class="xiangMu">
             <el-form-item label="项目" prop="month">
-              <el-select v-model="form.month" placeholder="请选择类型">
+              <el-select v-model="form.month" placeholder="请选择项目">
                 <el-option
                   v-for="dict in dict.type.project"
                   :key="dict.value"
@@ -313,19 +313,26 @@
         <el-form-item label="工作岗位" prop="yeardate">
           <el-input v-model="form.job" disabled />
         </el-form-item>
-        <div class="ee" v-for="item in form.examineDetails" :key="item.id">
+        <div class="ee" v-for="(item,index) in form.examineDetails" :key="item.id">
           <div class="jiben">
             体检信息
             <span style="margin-left: 100px">
               时间 : {{ item.createTime }}
             </span>
+            <el-button
+              style="margin-left: 518px"
+              size="btd"
+              type="text"
+              @click="shanchus(item,index)"
+              >删除</el-button
+            >
           </div>
           <el-form-item label="年份" prop="yeardate">
             <el-input v-model="item.year" disabled />
           </el-form-item>
           <div class="xiangMu">
             <el-form-item label="项目" prop="type">
-              <el-select v-model="item.month" placeholder="请选择类型" disabled>
+              <el-select v-model="item.month" placeholder="请选择项目" disabled>
                 <el-option
                   v-for="dict in dict.type.project"
                   :key="dict.value"
@@ -335,6 +342,7 @@
               </el-select>
             </el-form-item>
           </div>
+
           <div style="margin-bottom: 20px; display: flex; align-items: center">
             <span class="filename">{{ item.fileName }}</span>
             <a
@@ -376,6 +384,7 @@ import {
   getDept,
   getZhuChiRen,
   details,
+  delshanchu,
 } from "@/api/medicalhealth/examine";
 // 导入树形结构
 import Treeselect from "@riophae/vue-treeselect";
@@ -436,6 +445,11 @@ export default {
       form: {},
       // 表单校验
       rules: {},
+      // 表单校验
+      rules1: {
+        year: [{ required: true, message: "年份不能为空", trigger: "blur" }],
+        month: [{ required: true, message: "项目不能为空", trigger: "change" }],
+      },
       // 树形单位
       deptOptions: [],
       // 人员列表
@@ -455,6 +469,22 @@ export default {
     this.getRenLei();
   },
   methods: {
+    // 删除
+    shanchus(row,index) {
+      console.log(row)
+      const ids = row.id || this.ids;
+      this.$modal
+        .confirm("是否确认删除?")
+        .then(function () {
+          
+          return delshanchu(ids);
+        })
+        .then(() => {
+          this.form.examineDetails.splice(index,1)
+          this.$modal.msgSuccess("删除成功");
+        })
+        .catch(() => {});
+    },
     // 获取人员类别
     getRenLei() {
       // 字典查询数据
@@ -511,6 +541,7 @@ export default {
     },
     // 取消按钮
     cancel() {
+      this.opene = false;
       this.open = false;
       this.reset();
     },
@@ -580,16 +611,20 @@ export default {
     },
     // 体检信息提交
     submitFormT() {
-      if (this.fuWenList.length > 0) {
-        this.form.fileName = this.fuWenList[0].name;
-        this.form.filePath = this.fuWenList[0].url;
-      }
-      this.form.examineId = this.idss;
-      details(this.form).then((response) => {
-        this.$modal.msgSuccess("新增成功");
-        this.opene = false;
-        this.getList();
-        this.reset();
+      this.$refs["form"].validate((valid) => {
+        if (valid) {
+          if (this.fuWenList.length > 0) {
+            this.form.fileName = this.fuWenList[0].name;
+            this.form.filePath = this.fuWenList[0].url;
+          }
+          this.form.examineId = this.idss;
+          details(this.form).then((response) => {
+            this.$modal.msgSuccess("新增成功");
+            this.opene = false;
+            this.getList();
+            this.reset();
+          });
+        }
       });
     },
     /** 提交按钮 */