From d0594c96b1905f461ebf4dbdcc49a5c6230f1102 Mon Sep 17 00:00:00 2001
From: su1124 <1583764726@qq.com>
Date: 星期二, 26 十二月 2023 15:33:00 +0800
Subject: [PATCH] su

---
 src/views/hosp/history/index.vue |  431 +++++++++++++++++++++++++++++++++++++++++++++++------
 1 files changed, 383 insertions(+), 48 deletions(-)

diff --git a/src/views/hosp/history/index.vue b/src/views/hosp/history/index.vue
index 7a54ea5..06b4e6f 100644
--- a/src/views/hosp/history/index.vue
+++ b/src/views/hosp/history/index.vue
@@ -2,32 +2,107 @@
   <div class="app-container">
     <div class="hist1">
       <div class="hist2">
-        <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
+        <el-form
+          :model="queryParams"
+          ref="queryForm"
+          size="small"
+          :inline="true"
+          v-show="showSearch"
+          label-width="68px"
+        >
           <el-form-item label="濮撳悕" prop="name">
-            <el-input v-model="queryParams.name" placeholder="璇疯緭鍏ュ鎴峰悕" clearable @keyup.enter.native="handleQuery" style="width:130px"/>
+            <el-input
+              v-model="queryParams.name"
+              placeholder="璇疯緭鍏ュ鎴峰悕"
+              clearable
+              @keyup.enter.native="handleQuery"
+              style="width: 130px"
+            />
           </el-form-item>
           <el-form-item label="浣撴鍙�" prop="tjNum">
-            <el-input ref="inputName" v-model="queryParams.tjNum" placeholder="璇疯緭鍏ヤ綋妫�鍙�" style="width: 170px" clearable @keyup.enter.native="handleQuery"/>
+            <el-input
+              ref="inputName"
+              v-model="queryParams.tjNum"
+              placeholder="璇疯緭鍏ヤ綋妫�鍙�"
+              style="width: 170px"
+              clearable
+              @keyup.enter.native="handleQuery"
+              @blur="handleQuery"
+            />
           </el-form-item>
           <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-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>
         </el-form>
-        <el-table :row-class-name="tableRowClassName" height="650px" v-loading="loading" :data="orderList" ref="multipleTable" @selection-change="handleSelectionChange" border style="width: 95%">
+        <el-table
+          :row-class-name="tableRowClassName"
+          height="650px"
+          v-loading="loading"
+          :data="orderList"
+          ref="multipleTable"
+          @selection-change="handleSelectionChange"
+          border
+          style="width: 95%"
+        >
           <el-table-column type="selection" width="40px" align="center" />
-          <el-table-column label="搴忓彿" align="center" prop="newID" width="50px" :show-overflow-tooltip="true" fixed="left"/>
-          <el-table-column label="濮撳悕" align="center" prop="tjCustomerName" width="110px" :show-overflow-tooltip="true"/>
-          <el-table-column label="鎬у埆" align="center" prop="tjCustomerSex" width="55px" :show-overflow-tooltip="true">
+          <el-table-column
+            label="搴忓彿"
+            align="center"
+            prop="newID"
+            width="50px"
+            :show-overflow-tooltip="true"
+            fixed="left"
+          />
+          <el-table-column
+            label="濮撳悕"
+            align="center"
+            prop="tjCustomerName"
+            width="110px"
+            :show-overflow-tooltip="true"
+          />
+          <el-table-column
+            label="鎬у埆"
+            align="center"
+            prop="tjCustomerSex"
+            width="55px"
+            :show-overflow-tooltip="true"
+          >
             <template slot-scope="scope">
               <span v-if="scope.row.tjCustomerSex == '0'">鐢�</span>
               <span v-if="scope.row.tjCustomerSex == '1'">濂�</span>
+              <span v-if="scope.row.tjCustomerSex == '2'">鏈煡</span>
             </template>
           </el-table-column>
-          <el-table-column label="鐢佃瘽" align="center" prop="tjCustomerPhone" width="120px" :show-overflow-tooltip="true"/>
-          <el-table-column label="骞撮緞" align="center" prop="tjCustomerAge" width="70" :show-overflow-tooltip="true"
+          <el-table-column
+            label="鐢佃瘽"
+            align="center"
+            prop="tjCustomerPhone"
+            width="120px"
+            :show-overflow-tooltip="true"
           />
-          <el-table-column label="骞撮緞鍗曚綅" align="center" prop="ageUnit" width="80" :show-overflow-tooltip="true">
+          <el-table-column
+            label="骞撮緞"
+            align="center"
+            prop="tjCustomerAge"
+            width="70"
+            :show-overflow-tooltip="true"
+          />
+          <el-table-column
+            label="骞撮緞鍗曚綅"
+            align="center"
+            prop="ageUnit"
+            width="80"
+            :show-overflow-tooltip="true"
+          >
             <template slot-scope="scope">
               <dict-tag
                 :options="dict.type.dict_ageunit"
@@ -35,7 +110,13 @@
               />
             </template>
           </el-table-column>
-          <el-table-column label="鑱屼笟" align="center" prop="career" width="120" :show-overflow-tooltip="true">
+          <el-table-column
+            label="鑱屼笟"
+            align="center"
+            prop="career"
+            width="120"
+            :show-overflow-tooltip="true"
+          >
             <template slot-scope="scope">
               <dict-tag
                 :options="dict.type.dict_job"
@@ -79,7 +160,7 @@
                 </el-form-item>
                 <el-form-item label="鑱屼笟" prop="work">
                   <el-select
-                  filterable
+                    filterable
                     v-model="form.work"
                     placeholder="璇烽�夋嫨鑱屼笟"
                     clearable
@@ -95,7 +176,7 @@
                 </el-form-item>
                 <el-form-item label="宸ヤ綔鐘舵��" prop="workStatus">
                   <el-select
-                  filterable
+                    filterable
                     v-model="form.workStatus"
                     placeholder="璇烽�夋嫨宸ヤ綔鐘舵��"
                     clearable
@@ -108,6 +189,15 @@
                       :value="dict.value"
                     />
                   </el-select>
+                </el-form-item>
+                <el-form-item label="鎺ヨЕ姣掔墿" prop="contactPoison">
+                  <el-input
+                    type="textarea"
+                    rows="4"
+                    v-model="form.contactPoison"
+                    placeholder="璇疯緭鍏ユ帴瑙︽瘨鐗�"
+                    style="width: 700px"
+                  />
                 </el-form-item>
                 <el-form-item label="鏃㈠線鐥呭彶" prop="medicalHistory">
                   <el-input
@@ -160,7 +250,7 @@
                 <el-form-item label="鏄惁鍚哥儫" prop="xiyan">
                   <!-- <el-input v-model="form.xiyanpinlv" placeholder="璇疯緭鍏ュ惛鐑熼鐜�" /> -->
                   <el-select
-                  filterable
+                    filterable
                     v-model="form.xiyan"
                     placeholder="璇烽�夋嫨鏄惁鍚哥儫"
                     clearable
@@ -189,7 +279,7 @@
                 <el-form-item label="鏄惁楗厭" prop="yinjiu">
                   <!-- <el-input v-model="form.yinjiupinlv" placeholder="璇疯緭鍏ラギ閰掗鐜�" /> -->
                   <el-select
-                  filterable
+                    filterable
                     v-model="form.yinjiu"
                     placeholder="璇烽�夋嫨鏄惁楗厭"
                     clearable
@@ -236,7 +326,11 @@
                     </el-button>
                   </el-col>
                   <el-col :span="1.5">
-                    <el-button type="danger" icon="el-icon-delete" size="mini"
+                    <el-button
+                      type="danger"
+                      icon="el-icon-delete"
+                      size="mini"
+                      @click="delemembers()"
                       >鍒犻櫎
                     </el-button>
                   </el-col>
@@ -246,6 +340,7 @@
                   :data="form.tjAskHistorysList"
                   ref="tjAskHistorys"
                   style="width: 98%"
+                  @selection-change="handlebingChange"
                 >
                   <el-table-column type="selection" width="40" align="center" />
                   <!-- <el-table-column
@@ -295,7 +390,7 @@
                     <template slot-scope="scope">
                       <!-- <el-input v-model="scope.row.isOk" placeholder="璇疯緭鍏ユ槸鍚︾棅鎰�" /> -->
                       <el-select
-                      filterable
+                        filterable
                         size="mini"
                         v-model="scope.row.isOk"
                         placeholder="璇烽�夋嫨鏄惁鐥婃剤"
@@ -322,10 +417,139 @@
                 </el-table>
               </div>
             </el-collapse-item>
+
+            <el-collapse-item title="鑱屼笟鍙�" name="7">
+              <div style="width: 900px">
+                <el-row :gutter="10" class="mb8">
+                  <el-col :span="1.5">
+                    <el-button
+                      type="primary"
+                      icon="el-icon-plus"
+                      size="mini"
+                      @click="addmemberss()"
+                      >娣诲姞
+                    </el-button>
+                  </el-col>
+                  <el-col :span="1.5">
+                    <el-button
+                      type="danger"
+                      icon="el-icon-delete"
+                      size="mini"
+                      @click="delememberss()"
+                      >鍒犻櫎
+                    </el-button>
+                  </el-col>
+                </el-row>
+                <el-table
+                  border
+                  :data="form.workLogs"
+                  style="width: 98%"
+                  @selection-change="handlezhiyeChange"
+                >
+                  <el-table-column type="selection" width="40" align="center" />
+                  <!-- <el-table-column
+            label="搴忓彿"
+            align="center"
+            prop="index"
+            width="50"
+          /> -->
+                  <el-table-column label="寮�濮嬫椂闂�" prop="beginTime">
+                    <template slot-scope="scope">
+                      <el-date-picker
+                        size="mini"
+                        v-model="scope.row.beginTime"
+                        align="right"
+                        type="date"
+                        placeholder="閫夋嫨鏃ユ湡"
+                        :picker-options="pickerOptions"
+                        style="width: 130px"
+                        value-format="yyyy-MM-dd"
+                      >
+                      </el-date-picker>
+                    </template>
+                  </el-table-column>
+                  <el-table-column label="缁撴潫鏃堕棿" prop="endTime">
+                    <template slot-scope="scope">
+                      <el-date-picker
+                        size="mini"
+                        v-model="scope.row.endTime"
+                        align="right"
+                        type="date"
+                        placeholder="閫夋嫨鏃ユ湡"
+                        :picker-options="pickerOptions"
+                        style="width: 130px"
+                        value-format="yyyy-MM-dd"
+                      >
+                      </el-date-picker>
+                    </template>
+                  </el-table-column>
+                  <el-table-column label="宸ヤ綔鍗曚綅" prop="workCompany">
+                    <template slot-scope="scope">
+                      <el-input
+                        size="mini"
+                        v-model="scope.row.workCompany"
+                        placeholder="璇疯緭鍏ュ伐浣滃崟浣�"
+                      />
+                    </template>
+                  </el-table-column>
+                  <el-table-column label="閮ㄩ棬" prop="workDept">
+                    <template slot-scope="scope">
+                      <el-input
+                        size="mini"
+                        v-model="scope.row.workDept"
+                        placeholder="璇疯緭鍏ラ儴闂�"
+                      />
+                    </template>
+                  </el-table-column>
+                  <el-table-column label="宸ョ" prop="workType">
+                    <template slot-scope="scope">
+                      <el-input
+                        size="mini"
+                        v-model="scope.row.workType"
+                        placeholder="璇疯緭鍏ュ伐绉�"
+                      />
+                    </template>
+                  </el-table-column>
+                  <el-table-column label="鏈夊鍥犵礌" prop="harmTypeLogs">
+                    <template slot-scope="scope">
+                      <!-- <el-input v-model="scope.row.isOk" placeholder="璇疯緭鍏ユ槸鍚︾棅鎰�" /> -->
+                      <el-select
+                        filterable
+                        size="mini"
+                        v-model="scope.row.harmTypeLogs"
+                        multiple
+                        placeholder="璇烽�夋嫨鏈夊鍥犵礌"
+                        clearable
+                      >
+                        <el-option
+                          v-for="dict in harmTypeList"
+                          :key="dict.aid"
+                          :label="dict.harmType"
+                          :value="dict.aid"
+                        />
+                      </el-select>
+                    </template>
+                  </el-table-column>
+                  <el-table-column label="闃叉姢鎺柦" prop="fangHu">
+                    <template slot-scope="scope">
+                      <el-input
+                        size="mini"
+                        v-model="scope.row.fangHu"
+                        placeholder="璇疯緭鍏ラ槻鎶ゆ帾鏂�"
+                      />
+                    </template>
+                  </el-table-column>
+                </el-table>
+              </div>
+            </el-collapse-item>
           </el-collapse>
         </el-form>
         <div slot="footer" class="dialog-footer">
-          <el-button type="primary" @click="submitForm" style="margin-top: 10px" :disabled="isdisabled"
+          <el-button
+            type="primary"
+            @click="submitForm"
+            style="margin-top: 10px"
+            :disabled="isdisabled"
             >鎻愪氦</el-button
           >
         </div>
@@ -344,19 +568,35 @@
 </template>
 
 <script>
-import {
-  updateHistory,
-  getInfoById,
-} from "@/api/hosp/history";
+import { updateHistory, getInfoById } from "@/api/hosp/history";
 import { Message } from "element-ui";
 import { getOrderList } from "@/api/hosp/order";
-
+import { listHarmType } from "@/api/hosp/harmType";
 export default {
   name: "History",
-  dicts: ["tj_smoking_pinlv", "sys_yes_no", "tj_work_status", "tj_work","dict_ageunit","dict_job"],
+  dicts: [
+    "tj_smoking_pinlv",
+    "sys_yes_no",
+    "tj_work_status",
+    "tj_work",
+    "dict_ageunit",
+    "dict_job",
+  ],
   data() {
+    let checkPhoneNum = (rule, value, callback) => {
+      console.log(value);
+      let patter = new RegExp(/^1\s*[3456789]\s*(\d\s*){9}$/);
+      if (value == "" && value == undefined && !value) {
+        return callback("");
+      } else if (value != undefined && value != "") {
+        return callback();
+      } else if (!patter.test(value)) {
+        return callback("");
+      }
+    };
     return {
-      selectList:[],
+      selectList: [],
+      dataList: [],
       pickerOptions: {
         disabledDate(time) {
           return time.getTime() > Date.now();
@@ -419,15 +659,18 @@
         pageSize: 20,
         cusName: null,
       },
+      harmTypeList: [],
       // 琛ㄥ崟鍙傛暟
       form: {},
+      chageall: [],
+      bingshiall: [],
       rew: [],
       // 琛ㄥ崟鏍¢獙
       rules: {
         deleted: [
           {
             required: true,
-            message: "$comment涓嶈兘涓虹┖",
+            validator: checkPhoneNum,
             trigger: "blur",
           },
         ],
@@ -436,6 +679,11 @@
   },
   created() {
     this.getList();
+  },
+  mounted() {
+    this.$nextTick(() => {
+      this.$refs.inputName.focus();
+    });
   },
   methods: {
     /** 鏌ヨ闂瘖鍒楄〃 */
@@ -456,6 +704,10 @@
     /** 鏌ヨ浣撴璁板綍鍒楄〃 */
     getList() {
       this.loading = true;
+      listHarmType().then((response) => {
+        this.harmTypeList = response.rows;
+        this.loading = false;
+      });
       getOrderList(this.queryParams).then((response) => {
         this.orderList = response.data.list;
         if (this.orderList) {
@@ -473,6 +725,7 @@
                   true
                 );
               });
+              this.dataList = this.orderList[0];
             } else {
               this.$refs.multipleTable.clearSelection();
             }
@@ -535,6 +788,7 @@
     },
     // 鍗曢�夋閫変腑鏁版嵁
     handleSelectionChange(selection) {
+      this.dataList = [];
       this.selectList = selection;
       // this.ids = selection.map((item) => item.askId);
       // this.single = selection.length !== 1;
@@ -549,33 +803,33 @@
         let del_row = selection.shift();
         this.$refs.multipleTable.toggleRowSelection(del_row, false);
       }
-      selection.forEach(item1=>{
+      selection.forEach((item1) => {
         if (item1.tjCustomerSex === 1) {
-        this.sex = true;
-      } else {
-        this.sex = false;
-      }
-      })
-      let userId = selection.map((item) => item.userId);
-      getInfoById(userId).then((response) => {
+          this.sex = true;
+        } else {
+          this.sex = false;
+        }
+      });
+      let tjNumber = selection.map((item) => item.tjNumber);
+      getInfoById(tjNumber).then((response) => {
         this.form = response.data;
-        if(this.form.xiyan == null){
-          this.form.xiyan ="1"
+        if (this.form.xiyan == null) {
+          this.form.xiyan = "1";
         }
-        if(this.form.xiyanpinlv == null){
-          this.form.xiyanpinlv ="0"
+        if (this.form.xiyanpinlv == null) {
+          this.form.xiyanpinlv = "0";
         }
-        if(this.form.xiyanyear == null){
-          this.form.xiyanyear ="0"
+        if (this.form.xiyanyear == null) {
+          this.form.xiyanyear = "0";
         }
-        if(this.form.yinjiu == null){
-          this.form.yinjiu ="1"
+        if (this.form.yinjiu == null) {
+          this.form.yinjiu = "1";
         }
-        if(this.form.yinjiupinlv == null){
-          this.form.yinjiupinlv ="0"
+        if (this.form.yinjiupinlv == null) {
+          this.form.yinjiupinlv = "0";
         }
-        if(this.form.yinjiuyear == null){
-          this.form.yinjiuyear ="0"
+        if (this.form.yinjiuyear == null) {
+          this.form.yinjiuyear = "0";
         }
         this.form.tjAskHistorysList = response.data.tjAskHistorysList;
         // this.isdisabled= true
@@ -618,8 +872,83 @@
       }
       this.$forceUpdate();
     },
+
+    handlebingChange(selection) {
+      this.bingshiall = [];
+      this.bingshiall = selection;
+    },
+
+    delemembers() {
+      let that = this;
+      if (that.form.tjAskHistorysList.length == that.bingshiall.length) {
+        that.form.tjAskHistorysList = [];
+      } else {
+        that.bingshiall.forEach((item1, index1) => {
+          that.form.tjAskHistorysList.forEach((item, index) => {
+            if (item == item1) {
+              that.form.tjAskHistorysList.splice(index, 1);
+            }
+          });
+        });
+      }
+    },
+
+    addmemberss() {
+      if (this.form.cusName) {
+        if (!this.form.workLogs) {
+          this.form.workLogs = [];
+          this.form.workLogs.push({
+            id: parseInt(length),
+            beginTime: "",
+            endTime: "",
+            workCompany: "",
+            workDept: "",
+            workType: "",
+            harmTypeLogs: "",
+            fangHu: "",
+            Selection,
+          });
+        } else {
+          this.form.workLogs.push({
+            id: parseInt(length),
+            beginTime: "",
+            endTime: "",
+            workCompany: "",
+            workDept: "",
+            workType: "",
+            harmTypeLogs: "",
+            fangHu: "",
+            Selection,
+          });
+        }
+      } else {
+        Message.warning("璇峰厛濉啓瀹㈡埛鍚�");
+      }
+      this.$forceUpdate();
+    },
+
+    handlezhiyeChange(selection) {
+      this.chageall = [];
+      this.chageall = selection;
+    },
+
+    delememberss() {
+      let that = this;
+      if (that.form.workLogs.length == that.chageall.length) {
+        that.form.workLogs = [];
+      } else {
+        that.chageall.forEach((item1, index1) => {
+          that.form.workLogs.forEach((item, index) => {
+            if (item == item1) {
+              that.form.workLogs.splice(index, 1);
+            }
+          });
+        });
+      }
+    },
     /** 鎻愪氦鎸夐挳 */
     submitForm() {
+      this.form.tjNum = this.dataList[0].tjNumber;
       updateHistory(this.form).then((response) => {
         this.$modal.msgSuccess("淇敼鎴愬姛");
       });
@@ -640,19 +969,24 @@
   display: flex;
   justify-content: space-evenly;
 }
+
 .hist2 {
   width: 708px;
 }
+
 .hist3 {
   margin-top: 60px;
 }
+
 .coll {
   width: 100%;
 }
+
 ::v-deep .el-collapse-item__header {
   font-weight: 800;
   font-size: 16px;
 }
+
 .txt {
   font-size: 16px;
   font-weight: 800;
@@ -661,6 +995,7 @@
   justify-content: center;
   margin-bottom: 20px;
 }
+
 .el-table .warning-row {
   background: #e5f3ff !important;
 }

--
Gitblit v1.8.0