From ece367bce18895a76a9236e39f4be2f557308a77 Mon Sep 17 00:00:00 2001
From: luoyb <412940104@qq.com>
Date: 星期日, 31 一月 2021 10:14:24 +0800
Subject: [PATCH] feat(信息录入): 体检信息

---
 src/views/user/Informationinput.vue |  390 +++++++++++++++++++++++++++++--------------------------
 1 files changed, 207 insertions(+), 183 deletions(-)

diff --git a/src/views/user/Informationinput.vue b/src/views/user/Informationinput.vue
index 095539d..4f68968 100644
--- a/src/views/user/Informationinput.vue
+++ b/src/views/user/Informationinput.vue
@@ -150,12 +150,7 @@
             width="180"
           />
         </el-table>
-        <el-table
-          v-show="showArr[1].show"
-          ref="workExperienceTable"
-          :data="workExperienceData"
-          style="width: 100%"
-        >
+        <el-table v-show="showArr[1].show" ref="workExperienceTable" :data="workExperienceData" style="width: 100%">
           <el-table-column
             type="selection"
             width="55"
@@ -177,86 +172,34 @@
           <el-table-column prop="endDate" label="结束日期" width="180" />
           <el-table-column prop="jobContent" label="主要工作内容" width="180" />
         </el-table>
-        <el-table
-          v-show="showArr[2].show"
-          :data="physicalData"
-          style="width: 100%"
-        >
+        <el-table v-show="showArr[2].show" ref="physicalExamTable" :data="physicalExamData" style="width: 100%">
+          <el-table-column
+            type="selection"
+            width="55"
+          />
           <el-table-column
             fixed="left"
             label="操作"
             width="100"
           >
-            <template>
-              <el-button type="text" size="small">编辑</el-button>
+            <template slot-scope="scope">
+              <el-button type="text" size="small" @click="editPhysicalExam(scope.row)">编辑</el-button>
             </template>
           </el-table-column>
-          <el-table-column
-            prop="userNumb"
-            label="员工编号"
-            width="180"
-          />
-          <el-table-column
-            prop="name"
-            label="姓名"
-            width="180"
-          />
-          <el-table-column
-            prop="sex"
-            label="性别"
-            width="180"
-          />
-          <el-table-column
-            prop="idNumber"
-            label="身份证号码"
-            width="180"
-          />
-          <el-table-column
-            prop="hospital"
-            label="体检医院"
-            width="180"
-          />
-          <el-table-column
-            prop="physicalDate"
-            label="体检日期"
-            width="180"
-          />
-          <el-table-column
-            prop="physicalType"
-            label="体检类型"
-            width="180"
-          />
-          <el-table-column
-            prop="bloodPressure"
-            label="血压"
-            width="180"
-          />
-          <el-table-column
-            prop="transaminase"
-            label="转氨酶"
-            width="180"
-          />
-          <el-table-column
-            prop="ecg"
-            label="心电图"
-            width="180"
-          />
-          <el-table-column
-            prop="conclusion"
-            label="体检结论"
-            width="180"
-          />
-          <el-table-column
-            prop="reviewRecords"
-            label="复查记录"
-            width="180"
-          />
-          <el-table-column
-            prop="remark"
-            label="备注"
-            width="240"
-          />
-
+          <el-table-column prop="empNumb" label="员工编号" width="180" />
+          <el-table-column prop="deptName" label="护卫点" width="180" />
+          <el-table-column prop="empName" label="员工姓名" width="180" />
+          <el-table-column prop="certificateNumb" label="身份证号码" width="180" />
+          <el-table-column prop="jobName" label="岗位" width="180" />
+          <el-table-column prop="hospital" label="体检医院" width="180" />
+          <el-table-column prop="physicalExamDate" label="体检日期" width="180" />
+          <el-table-column prop="physicalExamType" label="体检类型" width="180" />
+          <el-table-column prop="bloodPressure" label="血压" width="180" />
+          <el-table-column prop="transaminase" label="转氨酶" width="180" />
+          <el-table-column prop="ecg" label="心电图" width="180" />
+          <el-table-column prop="conclusion" label="体检结论" width="180" />
+          <el-table-column prop="reviewRecord" label="复查记录" width="180" />
+          <el-table-column prop="remark" label="备注" width="180" />
         </el-table>
         <el-table
           v-show="showArr[3].show"
@@ -1067,52 +1010,55 @@
     </el-dialog>
 
     <el-dialog title="体检信息" :visible.sync="dialogshowArr[2].show" width="50%">
-      <el-form :model="physicalForm" label-position="right" label-width="120px">
+      <el-form :model="physicalExamForm" label-position="right" label-width="120px">
         <el-row>
           <el-col :span="12">
             <el-form-item label="员工编号">
-              <el-input v-model="physicalForm.name" />
+              <el-input v-model="physicalExamForm.empNumb" />
             </el-form-item>
             <el-form-item label="身份证号码">
-              <el-input v-model="physicalForm.name" />
+              <el-input v-model="physicalExamForm.certificateNumb" />
             </el-form-item>
+            <el-form-item label="部门名称"><el-input v-model="physicalExamForm.deptName" /></el-form-item>
             <el-form-item label="体检医院">
-              <el-input v-model="physicalForm.name" />
+              <el-input v-model="physicalExamForm.hospital" />
             </el-form-item>
             <el-form-item label="体检类型" prop="region">
-              <el-select v-model="physicalForm.name" placeholder="请选择体检类型">
+              <el-select v-model="physicalExamForm.physicalExamType" placeholder="请选择体检类型">
                 <el-option label="普通体检" value="1" />
                 <el-option label="员工体检" value="2" />
               </el-select>
             </el-form-item>
             <el-form-item label="转氨酶">
-              <el-input v-model="physicalForm.name" />
+              <el-input v-model="physicalExamForm.transaminase" />
             </el-form-item>
           </el-col>
           <el-col :span="12">
             <el-form-item label="姓名">
-              <el-input v-model="physicalForm.name" />
+              <el-input v-model="physicalExamForm.empName" />
             </el-form-item>
             <el-form-item label="性别" prop="region">
-              <el-select v-model="physicalForm.name" placeholder="请选择性别">
+              <el-select v-model="physicalExamForm.sex" placeholder="请选择性别">
                 <el-option label="男" value="1" />
                 <el-option label="女" value="2" />
               </el-select>
             </el-form-item>
+            <el-form-item label="岗位名称"><el-input v-model="physicalExamForm.jobName" /></el-form-item>
             <el-form-item label="体检日期">
               <el-date-picker
-                v-model="physicalForm.name"
+                v-model="physicalExamForm.physicalExamDate"
+                value-format="yyyy-MM-dd"
                 type="date"
                 placeholder="选择体检日期"
               />
             </el-form-item>
             <el-form-item label="血压">
-              <el-input v-model="physicalForm.name" />
+              <el-input v-model="physicalExamForm.bloodPressure" />
             </el-form-item>
             <el-form-item label="心电图" prop="region">
-              <el-select v-model="physicalForm.name" placeholder="请选择心电图">
+              <el-select v-model="physicalExamForm.name" placeholder="ecg">
                 <el-option label="正常" value="1" />
-                <el-option label="异常" value="2" />
+                <el-option label="异常" value="0" />
               </el-select>
             </el-form-item>
           </el-col>
@@ -1120,24 +1066,25 @@
         <el-row>
           <el-col :span="24">
             <el-form-item label="体检结论">
-              <el-input v-model="physicalForm.name" />
+              <el-input v-model="physicalExamForm.conclusion" />
             </el-form-item>
             <el-form-item label="复查记录">
-              <el-input v-model="physicalForm.name" />
+              <el-input v-model="physicalExamForm.reviewRecord" />
             </el-form-item>
           </el-col>
         </el-row>
         <el-row>
           <el-col :span="24">
             <el-form-item label="备注">
-              <el-input v-model="physicalForm.name" type="textarea" />
+              <el-input v-model="physicalExamForm.remark" type="textarea" />
             </el-form-item>
           </el-col>
         </el-row>
       </el-form>
       <div slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="putPhysicalExam()">保 存</el-button>
+        <el-button type="primary" @click="putPhysicalExamContinue()">保存并继续新增</el-button>
         <el-button @click="dialogIsShow()">取 消</el-button>
-        <el-button type="primary" @click="dialogIsShow()">确 定</el-button>
       </div>
     </el-dialog>
 
@@ -1966,49 +1913,7 @@
       // eslint-disable-next-line no-undef
       showArr: [{ show: true }, { show: false }, { show: false }, { show: false }, { show: false }, { show: false }, { show: false }, { show: false }, { show: false }, { show: false }, { show: false }, { show: false }, { show: false }, { show: false }],
       isAdd: false,
-      physicalData: [{
-        name: '王小虎',
-        userNumb: '12321222',
-        sex: '女',
-        idNumber: '430422199823222222',
-        hospital: '宝安中心医院',
-        physicalDate: '2020-01-01',
-        physicalType: '员工体检',
-        bloodPressure: '80/120',
-        transaminase: '85',
-        ecg: '正常',
-        conclusion: '血压偏高',
-        reviewRecords: '2019-02-05',
-        remark: ''
-      }, {
-        name: '王小虎',
-        userNumb: '12321222',
-        sex: '女',
-        idNumber: '430422199823222222',
-        hospital: '宝安中心医院',
-        physicalDate: '2020-01-01',
-        physicalType: '员工体检',
-        bloodPressure: '80/120',
-        transaminase: '85',
-        ecg: '正常',
-        conclusion: '血压偏高',
-        reviewRecords: '2019-02-05',
-        remark: ''
-      }, {
-        name: '王小虎',
-        userNumb: '12321222',
-        sex: '女',
-        idNumber: '430422199823222222',
-        hospital: '宝安中心医院',
-        physicalDate: '2020-01-01',
-        physicalType: '员工体检',
-        bloodPressure: '80/120',
-        transaminase: '85',
-        ecg: '正常',
-        conclusion: '血压偏高',
-        reviewRecords: '2019-02-05',
-        remark: ''
-      }],
+      physicalExamData: [],
       workExperienceData: [],
       basicInformationData: [],
       contractData: [],
@@ -2538,20 +2443,32 @@
         absenteeismDay: '',
         remark: ''
       },
-      physicalForm: {
-        name: '',
-        userNumb: '',
+      physicalExamForm: {
+        physicalExamId: '',
+        empId: '',
+        empNumb: '',
+        empName: '',
+        certificateNumb: '',
         sex: '',
-        idNumber: '',
+        deptId: '',
+        deptName: '',
+        JobId: '',
+        jobName: '',
         hospital: '',
-        physicalDate: '',
-        physicalType: '',
+        physicalExamDate: '',
+        physicalExamType: '',
         bloodPressure: '',
         transaminase: '',
         ecg: '',
         conclusion: '',
-        reviewRecords: '',
-        remark: ''
+        reviewRecord: '',
+        remark: '',
+        createTime: '',
+        creator: '',
+        modifyTime: '',
+        modifier: '',
+        delFlag: '',
+        version: ''
       },
       workExperienceForm: {
         workExperienceId: '',
@@ -2637,6 +2554,7 @@
     this.getBadRecord()
     this.selectEmpBase()
     this.selectWorkExperience()
+    this.selectPhysicalExam()
   },
   methods: {
     dialogIsShow() {
@@ -2654,6 +2572,60 @@
         this.showArr[this.thisShowIndex].show = false
       }
       this.thisShowIndex = index
+    },
+    butDelete() {
+      switch (this.thisShowIndex) {
+        case 1:
+          var selected = this.$refs.workExperienceTable.selection
+          if (selected.length > 0) {
+            const delIds = []
+            selected.forEach((j) => {
+              delIds.push(j.workExperienceId)
+            })
+            this.$delete(`hr/empWorkExperience/` + delIds).then(() => {
+              this.$message({
+                message: this.$t('tips.deleteSuccess'),
+                type: 'success'
+              })
+              this.selectWorkExperience()
+            })
+          }
+          break
+        case 2:
+          // eslint-disable-next-line no-redeclare
+          var selected = this.$refs.physicalExamTable.selection
+          if (selected.length > 0) {
+            const delIds = []
+            selected.forEach((j) => {
+              delIds.push(j.physicalExamId)
+            })
+            this.$delete(`hr/empPhysicalExam/` + delIds).then(() => {
+              this.$message({
+                message: this.$t('tips.deleteSuccess'),
+                type: 'success'
+              })
+              this.selectPhysicalExam()
+            })
+          }
+          break
+        case 12:
+          // eslint-disable-next-line no-redeclare
+          var selected = this.$refs.badRecordTable.selection
+          if (selected.length > 0) {
+            const badIds = []
+            selected.forEach((j) => {
+              badIds.push(j.badId)
+            })
+            this.$delete(`hr/empBadRecord/` + badIds).then(() => {
+              this.$message({
+                message: this.$t('tips.deleteSuccess'),
+                type: 'success'
+              })
+              this.getBadRecord()
+            })
+          }
+          break
+      }
     },
     getBadRecord() {
       this.$get('hr/empBadRecord/list').then((r) => {
@@ -2709,43 +2681,6 @@
       this.badRecordFrom.creator = row.creator
       this.badRecordFrom.remark = row.remark
       this.dialogshowArr[12].show = true
-    },
-    butDelete() {
-      switch (this.thisShowIndex) {
-        case 1:
-          var selected = this.$refs.workExperienceTable.selection
-          if (selected.length > 0) {
-            const delIds = []
-            selected.forEach((j) => {
-              delIds.push(j.workExperienceId)
-            })
-            this.$delete(`hr/empWorkExperience/` + delIds).then(() => {
-              this.$message({
-                message: this.$t('tips.deleteSuccess'),
-                type: 'success'
-              })
-              this.selectWorkExperience()
-            })
-          }
-          break
-        case 12:
-          // eslint-disable-next-line no-redeclare
-          var selected = this.$refs.badRecordTable.selection
-          if (selected.length > 0) {
-            const badIds = []
-            selected.forEach((j) => {
-              badIds.push(j.badId)
-            })
-            this.$delete(`hr/empBadRecord/` + badIds).then(() => {
-              this.$message({
-                message: this.$t('tips.deleteSuccess'),
-                type: 'success'
-              })
-              this.getBadRecord()
-            })
-          }
-          break
-      }
     },
     selectEmpBase() {
       this.$get('hr/empBaseInfo/list').then((r) => {
@@ -2877,6 +2812,95 @@
       this.workExperienceForm.delFlag = row.delFlag
       this.workExperienceForm.version = row.version
       this.dialogshowArr[1].show = true
+    },
+    selectPhysicalExam() {
+      this.$get('hr/empPhysicalExam/list').then((r) => {
+        this.physicalExamData = r.data.data.rows
+      }).catch((error) => {
+        console.error(error)
+        this.$message({
+          message: this.$t('tips.getDataFail'),
+          type: 'error'
+        })
+      })
+    },
+    putPhysicalExam() {
+      if (this.isAdd) {
+        this.$post('hr/empPhysicalExam', { ...this.physicalExamForm }).then(() => {
+          this.buttonLoading = false
+          this.$message({
+            message: this.$t('tips.createSuccess'),
+            type: 'success'
+          })
+          this.cleanPhysicalExam()
+          this.selectPhysicalExam()
+        })
+      } else {
+        this.$put('hr/empPhysicalExam', { ...this.physicalExamForm }).then(() => {
+          this.$message({
+            message: this.$t('tips.updateSuccess'),
+            type: 'success'
+          })
+          this.$emit('success')
+          this.cleanPhysicalExam()
+          this.selectPhysicalExam()
+        })
+      }
+      this.dialogIsShow()
+    },
+    putPhysicalExamContinue() {
+      if (this.isAdd) {
+        this.$post('hr/empPhysicalExam', { ...this.physicalExamForm }).then(() => {
+          this.buttonLoading = false
+          this.$message({
+            message: this.$t('tips.createSuccess'),
+            type: 'success'
+          })
+          this.cleanPhysicalExam()
+          this.selectPhysicalExam()
+        })
+      }
+    },
+    cleanPhysicalExam() {
+      this.physicalExamForm.hospital = ''
+      this.physicalExamForm.physicalExamDate = ''
+      this.physicalExamForm.physicalExamType = ''
+      this.physicalExamForm.bloodPressure = ''
+      this.physicalExamForm.transaminase = ''
+      this.physicalExamForm.ecg = ''
+      this.physicalExamForm.conclusion = ''
+      this.physicalExamForm.reviewRecord = ''
+      this.physicalExamForm.remark = ''
+    },
+    editPhysicalExam(row) {
+      this.isAdd = false
+      this.physicalExamForm.physicalExamId = row.physicalExamId
+      this.physicalExamForm.empId = row.empId
+      this.physicalExamForm.empNumb = row.empNumb
+      this.physicalExamForm.empName = row.empName
+      this.physicalExamForm.certificateNumb = row.certificateNumb
+      this.physicalExamForm.sex = row.sex
+      this.physicalExamForm.deptId = row.deptId
+      this.physicalExamForm.deptName = row.deptName
+      this.physicalExamForm.JobId = row.JobId
+      this.physicalExamForm.jobName = row.jobName
+      this.physicalExamForm.hospital = row.hospital
+      this.physicalExamForm.physicalExamDate = row.physicalExamDate
+      this.physicalExamForm.physicalExamType = row.physicalExamType
+      this.physicalExamForm.bloodPressure = row.bloodPressure
+      this.physicalExamForm.transaminase = row.transaminase
+      this.physicalExamForm.ecg = row.ecg
+      this.physicalExamForm.conclusion = row.conclusion
+      this.physicalExamForm.reviewRecord = row.reviewRecord
+      this.physicalExamForm.remark = row.remark
+      this.physicalExamForm.createTime = row.createTime
+      this.physicalExamForm.creator = row.creator
+      this.physicalExamForm.modifyTime = row.modifyTime
+      this.physicalExamForm.modifier = row.modifier
+      this.physicalExamForm.delFlag = row.delFlag
+      this.physicalExamForm.version = row.version
+
+      this.dialogshowArr[2].show = true
     }
   }
 }

--
Gitblit v1.8.0