From 00212ed8e808fc7b76c04389224e65f27f074fb2 Mon Sep 17 00:00:00 2001
From: su1124 <1583764726@qq.com>
Date: 星期五, 26 四月 2024 15:30:04 +0800
Subject: [PATCH] su

---
 src/views/sampling/sampling/index.vue |  303 ++++++++++++++++++++++++++++++++++++++++----------
 1 files changed, 243 insertions(+), 60 deletions(-)

diff --git a/src/views/sampling/sampling/index.vue b/src/views/sampling/sampling/index.vue
index 7006297..db6e314 100644
--- a/src/views/sampling/sampling/index.vue
+++ b/src/views/sampling/sampling/index.vue
@@ -1,18 +1,46 @@
 <template>
   <div class="app-container">
-    <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="tjNum">
-        <el-input v-model="queryParams.tjNum" placeholder="璇疯緭鍏ヤ綋妫�鍙�" clearable @keyup.enter.native="handleQuery"
-          style="width: 170px" />
+        <el-input
+          ref="inputName"
+          v-model="queryParams.tjNum"
+          placeholder="璇疯緭鍏ヤ綋妫�鍙�"
+          clearable
+          @keyup.enter.native="handleQuery"
+          @blur="hb"
+          style="width: 170px"
+        />
       </el-form-item>
       <el-form-item label="濮撳悕" prop="name">
-        <el-input v-model="queryParams.name" placeholder="璇疯緭鍏ュ鍚�" clearable @keyup.enter.native="handleQuery"
-          style="width: 110px" />
+        <el-input
+          v-model="queryParams.name"
+          placeholder="璇疯緭鍏ュ鍚�"
+          clearable
+          @keyup.enter.native="handleQuery"
+          style="width: 110px"
+        />
       </el-form-item>
       <el-form-item label="鐢宠鏃堕棿" prop="applicationTime">
-        <el-date-picker clearable v-model="createTimeList" @change="dateChangebirthday1" style="width: 240px"
-          value-format="yyyy-MM-dd" type="daterange" range-separator="-" start-placeholder="寮�濮嬫棩鏈�" end-placeholder="缁撴潫鏃ユ湡"
-          :picker-options="pickerOptions"></el-date-picker>
+        <el-date-picker
+          v-model="createTimeList"
+          @change="dateChangebirthday1"
+          :default-time="['00:00:00', '23:00:00']"
+          format="yyyy-MM-dd HH:mm:ss"
+          value-format="yyyy-MM-dd HH:mm:ss"
+          type="daterange"
+          range-separator="-"
+          start-placeholder="寮�濮嬫棩鏈�"
+          end-placeholder="缁撴潫鏃ユ湡"
+          :picker-options="pickerOptions"
+        ></el-date-picker>
       </el-form-item>
       <!-- <el-form-item label="鏄惁閲囨牱" prop="isSignFor">
                     <el-select style="width:100px" v-model="queryParams.isSignFor" placeholder="鏄惁閲囨牱">
@@ -32,33 +60,95 @@
                 <el-input v-model="queryParams.proName" placeholder="璇疯緭鍏ラ」鐩悕绉�" clearable @keyup.enter.native="handleQuery" style="width: 140px;"/>
             </el-form-item> -->
       <el-form-item>
-        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">鏌ヨ</el-button>
-        <el-button type="primary" icon="el-icon-thumb" size="mini" @click="Confirmreceipt">纭閲囨牱</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
+          type="primary"
+          icon="el-icon-thumb"
+          size="mini"
+          @click="Confirmreceipt"
+          >纭閲囨牱</el-button
+        >
+        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
+          >閲嶇疆</el-button
+        >
       </el-form-item>
     </el-form>
-
-    <el-radio-group v-model="tjStatus" @input="radioChange" style="margin: 10px 15px">
-      <el-radio-button label="1">鏈噰鏍�</el-radio-button>
-      <el-radio-button label="0">宸查噰鏍�</el-radio-button>
-    </el-radio-group>
+    <el-row :gutter="10" class="mb8">
+      <el-col :span="10">
+        <el-radio-group
+          v-model="tjStatus"
+          @input="radioChange"
+          style="margin: 10px 15px"
+        >
+          <el-radio-button label="1">鏈噰鏍�</el-radio-button>
+          <el-radio-button label="0">宸查噰鏍�</el-radio-button>
+        </el-radio-group>
+      </el-col>
+      <el-col :span="12" v-if="tableList.length > 1 && tjStatus == 0">
+        <el-button type="primary" plain v-hasPermi="['hosp:detail:add']"
+          >鍚堝苟鏍锋湰</el-button
+        >
+      </el-col>
+    </el-row>
 
     <div style="width: 100%; margin-left: 10px; display: flex">
       <div style="width: 40%; margin-right: 20px">
-        <el-table id="ta" v-loading="loading" ref="tb" :data="samplingList" @selection-change="handleSelectionChange"
-          border height="520px" :row-class-name="tableRowClassName">
+        <el-table
+          id="ta"
+          v-loading="loading"
+          ref="tb"
+          :data="samplingList"
+          @selection-change="handleSelectionChange"
+          border
+          height="520px"
+          :row-class-name="tableRowClassName"
+        >
           <el-table-column type="selection" width="40" align="center" />
-          <el-table-column label="浣撴鍙�" align="center" prop="customer.tjNumber" width="160px" />
-          <el-table-column label="濮撳悕" align="center" prop="customer.cusName" width="80px" />
-          <el-table-column label="鎬у埆" align="center" prop="customer.cusSex" width="60px">
-            <template slot-scope="scope">
-              <!-- {{scope.row.customer.cusSex}} -->
+          <el-table-column
+            label="浣撴鍙�"
+            align="center"
+            prop="customer.tjNumber"
+            width="160px"
+          />
+          <el-table-column
+            label="濮撳悕"
+            align="center"
+            prop="customer.cusName"
+            width="80px"
+          />
+          <el-table-column
+            label="鎬у埆"
+            align="center"
+            prop="customer.cusSex"
+            width="60px"
+          >
+            <!-- <template slot-scope="scope">
               {{ scope.row.customer.cusSex === 0 ? "鐢�" : "濂�" }}
-              <!-- <dict-tag :options="dict.type.sys_user_sex" :value="scope.row.cusSex " /> -->
+            </template> -->
+            <template slot-scope="scope">
+              <span v-if="scope.row.cusSex == '0'">鐢�</span>
+              <span v-if="scope.row.cusSex == '1'">濂�</span>
+              <span v-if="scope.row.cusSex == '2'">鏈煡</span>
             </template>
           </el-table-column>
-          <el-table-column label="鎵嬫満鍙�" align="center" prop="customer.cusPhone" width="120px" />
-          <el-table-column label="鐢宠鏃堕棿" align="center" prop="customer.applicationTime" width="210">
+          <el-table-column
+            label="鎵嬫満鍙�"
+            align="center"
+            prop="customer.cusPhone"
+            width="120px"
+          />
+          <el-table-column
+            label="鐢宠鏃堕棿"
+            align="center"
+            prop="customer.applicationTime"
+            width="210"
+          >
             <template slot-scope="scope">
               <span>{{ parseTime(scope.row.customer.applicationTime) }}</span>
             </template>
@@ -66,8 +156,16 @@
         </el-table>
       </div>
       <div style="width: 50%">
-        <el-table v-loading="loading" :data="tableList" :span-method="objectSpanMethod" @selection-change="handleChange"
-          border height="520px" ref="tab1" :row-class-name="tableRowClassName">
+        <el-table
+          v-loading="loading"
+          :data="tableList"
+          :span-method="objectSpanMethod"
+          @selection-change="handleChange"
+          border
+          height="520px"
+          ref="tab1"
+          :row-class-name="tableRowClassName"
+        >
           <el-table-column type="selection" width="40" align="center" />
           <!--  :selectable="selectEnable" -->
           <!-- <el-table-column label="鏄惁绛炬敹" align="center" prop="isSignFor" /> -->
@@ -76,18 +174,50 @@
                     <span>{{ parseTime(scope.row.tjTime, '{y}-{m}-{d}') }}</span>
                 </template>
             </el-table-column> -->
-          <el-table-column label="鏍囨湰绫诲瀷" align="center" prop="specimenType">
+          <el-table-column
+            label="鏍囨湰绫诲瀷"
+            align="center"
+            prop="specimenType"
+            width="120"
+          >
             <template slot-scope="scope">
-              <dict-tag :options="dict.type.sys_dict_specimen" :value="scope.row.specimenType" />
+              <dict-tag
+                :options="dict.type.sys_dict_specimen"
+                :value="scope.row.specimenType"
+              />
             </template>
           </el-table-column>
           <el-table-column label="椤圭洰鍚嶇О" align="center" prop="proName" />
-          <el-table-column label="鎬у埆" align="center" prop="proSex" />
-          <el-table-column label="绌鸿吂" align="center" prop="isEat" />
-          <el-table-column label="閲囨牱缂栧彿" align="center" prop="samplingNumber" />
-          <el-table-column label="閲囨牱鐘舵��" align="center" prop="isSignFor">
+          <el-table-column
+            label="鎬у埆"
+            align="center"
+            prop="proSex"
+            width="90"
+          />
+          <el-table-column
+            label="绌鸿吂"
+            align="center"
+            prop="proCheckMethod"
+            width="90"
+          />
+          <el-table-column
+            label="閲囨牱缂栧彿"
+            align="center"
+            prop="samplingNumber"
+            :show-overflow-tooltip="true"
+            width="120"
+          />
+          <el-table-column
+            label="閲囨牱鐘舵��"
+            align="center"
+            prop="isSignFor"
+            width="90"
+          >
             <template slot-scope="scope">
-              <dict-tag :options="dict.type.sampling_type" :value="scope.row.isSignFor" />
+              <dict-tag
+                :options="dict.type.sampling_type"
+                :value="scope.row.isSignFor"
+              />
             </template>
           </el-table-column>
           <!-- <el-table-column label="鎿嶄綔" align="center" class-name="small-padding fixed-width">
@@ -113,8 +243,13 @@
       <!-- <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :pager-count="5" :current-page.sync="currentPage1" :current-page="page"
                 :page-sizes="pageSize" :page-size="size" layout="total, sizes, prev, pager, next, jumper" :total="total">
             </el-pagination> -->
-      <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
-        @pagination="getList" />
+      <pagination
+        v-show="total > 0"
+        :total="total"
+        :page.sync="queryParams.pageNum"
+        :limit.sync="queryParams.pageSize"
+        @pagination="getList"
+      />
     </div>
 
     <!-- 娣诲姞鎴栦慨鏀逛綋妫�閲囨牱绠$悊瀵硅瘽妗� -->
@@ -150,6 +285,8 @@
   updateSampling,
   confirmSampling,
 } from "@/api/sampling/sampling";
+import { getNewDateList } from "@/api/hosp/order";
+import moment from "moment";
 
 export default {
   dicts: [
@@ -242,10 +379,25 @@
     };
   },
   created() {
-    this.getNowTime();
-    this.getList();
+    // this.getNowTime();
+   
+    this.getdate();
+  },
+  mounted() {
+    this.$nextTick(() => {
+      this.$refs.inputName.focus();
+    });
   },
   methods: {
+    getdate() {
+      getNewDateList().then((res) => {
+        this.createTimeList = [
+          moment(res.data).format("YYYY-MM-DD 00:00:00"),
+          moment(res.data).format("YYYY-MM-DD 23:59:00"),
+        ];
+        this.getList();
+      });
+    },
     handleSizeChange(val) {
       this.size = val;
       this.page = 1;
@@ -281,27 +433,38 @@
     getList() {
       this.loading = true;
       this.queryParams.isSignFor = this.tjStatus;
-      this.queryParams.beginTime = this.createTimeList[0];
+      if(this.createTimeList){
+        this.queryParams.beginTime = this.createTimeList[0];
       this.queryParams.endTime = this.createTimeList[1];
+      }else if(this.createTimeList == null){
+        this.queryParams.beginTime = null;
+      this.queryParams.endTime = null;
+      }
+     
       getList(this.queryParams).then((response) => {
         if (response.data) {
-          this.samplingList = response.data.list;
-          if (this.samplingList.length != 0) {
-            this.$nextTick(() => {
-              this.$refs.tb.toggleRowSelection(this.samplingList[0], true);
-            });
+          if (response.data.list == null) {
+            this.samplingList = [];
+            this.tableList = [];
+            this.loading = false;
           } else {
-            this.$refs.tb.clearSelection();
+            this.samplingList = response.data.list;
+            this.loading = false;
+            if (this.samplingList.length != 0) {
+              this.$nextTick(() => {
+                this.$refs.tb.toggleRowSelection(this.samplingList[0], true);
+              });
+            } else {
+              this.$refs.tb.clearSelection();
+            }
           }
           this.total = response.data.total;
           this.loading = false;
         } else {
-          this.samplingList = []
-          this.tableList = []
+          this.samplingList = [];
+          this.tableList = [];
           this.loading = false;
         }
-
-        
       });
     },
 
@@ -330,6 +493,12 @@
       };
       this.resetForm("form");
     },
+    hb() {
+      // console.log(this.queryParams.tjNum);
+      if (this.queryParams.tjNum != null) {
+        this.handleQuery();
+      }
+    },
     /** 鎼滅储鎸夐挳鎿嶄綔 */
     handleQuery() {
       this.queryParams.pageNum = 1;
@@ -337,6 +506,7 @@
     },
     /** 閲嶇疆鎸夐挳鎿嶄綔 */
     resetQuery() {
+      this.createTimeList=[]
       this.resetForm("queryForm");
       this.handleQuery();
     },
@@ -384,7 +554,7 @@
     // },
 
     // 纭畾鎸夐挳
-    submitForm() { },
+    submitForm() {},
 
     // 纭閲囨牱
     Confirmreceipt() {
@@ -400,16 +570,29 @@
       this.loading = true;
       this.queryParams.isSignFor = value;
       getList(this.queryParams).then((response) => {
-        this.samplingList = response.data.list;
-        if (this.samplingList.length != 0) {
-          this.$nextTick(() => {
-            this.$refs.tb.toggleRowSelection(this.samplingList[0], true);
-          });
+        if (response.data) {
+          if (response.data.list == null) {
+            this.samplingList = [];
+            this.tableList = [];
+            this.loading = false;
+          } else {
+            this.samplingList = response.data.list;
+            this.loading = false;
+            if (this.samplingList.length != 0) {
+              this.$nextTick(() => {
+                this.$refs.tb.toggleRowSelection(this.samplingList[0], true);
+              });
+            } else {
+              this.$refs.tb.clearSelection();
+            }
+          }
+          this.total = response.data.total;
+          this.loading = false;
         } else {
-          this.$refs.tb.clearSelection();
+          this.samplingList = [];
+          this.tableList = [];
+          this.loading = false;
         }
-        this.total = response.data.total;
-        this.loading = false;
       });
     },
 
@@ -435,7 +618,7 @@
     },
 
     // 瀵煎嚭
-    handleExport() { },
+    handleExport() {},
   },
 };
 </script>

--
Gitblit v1.8.0