From 6d2f5a43b9bf2922c137e18e3fb4ba91fcfce459 Mon Sep 17 00:00:00 2001
From: qx <1084500556@qq.com>
Date: 星期四, 17 四月 2025 11:14:56 +0800
Subject: [PATCH] qx

---
 src/views/reservation/resercopy/index.vue |  225 ++++++++++++++++++++++++++++++++++++--------------------
 1 files changed, 145 insertions(+), 80 deletions(-)

diff --git a/src/views/reservation/resercopy/index.vue b/src/views/reservation/resercopy/index.vue
index 3cbefa5..388739b 100644
--- a/src/views/reservation/resercopy/index.vue
+++ b/src/views/reservation/resercopy/index.vue
@@ -29,7 +29,7 @@
         </el-select>
         <i class="el-icon-circle-plus-outline" @click="handleAdd"></i>
       </el-form-item>
-      <el-form-item label="閮ㄩ棬" prop="dwDeptName">
+      <!-- <el-form-item label="閮ㄩ棬" prop="dwDeptName">
         <el-select
           v-model="objs.dwDeptName"
           placeholder="璇烽�夋嫨閮ㄩ棬"
@@ -45,7 +45,7 @@
           />
         </el-select>
         <i class="el-icon-circle-plus-outline" @click="handleAddbumen"></i>
-      </el-form-item>
+      </el-form-item> -->
       <!-- <el-form-item label="鍒嗙粍" prop="payType">
         <el-select v-model="objs.payType" placeholder="璇烽�夋嫨缁撶畻鏂瑰紡" style="width: 200px" clearable>
           <el-option v-for="dict in groupingList" :key="dict.id" :label="dict.groupingName" :value="dict.id" />
@@ -58,12 +58,19 @@
           type="date"
           format="yyyy-MM-dd"
           value-format="yyyy-MM-dd"
-          style="width: 220px"
+          style="width: 130px"
           placeholder="璇烽�夋嫨棰勭害鏃ユ湡"
           @change="selectTime"
           :picker-options="setDisabled"
         >
         </el-date-picker>
+      </el-form-item>
+      <el-form-item label="鏈夋晥澶╂暟" prop="yxts">
+        <el-input
+          style="width: 100px"
+          v-model="objs.yxts"
+          placeholder="鏈夋晥澶╂暟"
+        />澶�(鍙嚜瀹氫箟)
       </el-form-item>
     </el-form>
 
@@ -83,7 +90,6 @@
           icon="el-icon-upload2"
           size="mini"
           @click="handleImport"
-          v-hasPermi="['system:user:import']"
           >瀵煎叆</el-button
         >
       </el-col>
@@ -92,8 +98,7 @@
           type="primary"
           icon="el-icon-upload2"
           size="mini"
-         @click="importTemplate"
-          v-hasPermi="['system:user:import']"
+          @click="importTemplate"
           >涓嬭浇妯℃澘</el-button
         >
       </el-col>
@@ -123,8 +128,16 @@
           align="center"
           prop="company"
           width="200"
-        />
-        <el-table-column label="宸ュ彿" align="center" prop="jobNo" width="80" />
+        >
+        </el-table-column>
+        <el-table-column
+          label="鍗曚綅閮ㄩ棬"
+          align="center"
+          prop="department"
+          width="200"
+        >
+        </el-table-column>
+        <!-- <el-table-column label="宸ュ彿" align="center" prop="jobNo" width="80" /> -->
         <el-table-column label="濮撳悕" align="center" prop="name" width="75" />
         <el-table-column label="鎬у埆" align="center" prop="sex" width="75">
           <template slot-scope="scope">
@@ -147,14 +160,14 @@
           prop="birthday"
           width="100"
         />
-        <el-table-column label="鑱屼綅" align="center" prop="position" />
-        <el-table-column label="閮ㄩ棬" align="center" prop="department" />
-        <el-table-column label="閮ㄩ棬缂栧彿" align="center" prop="departmentId" />
+        <!-- <el-table-column label="鑱屼綅" align="center" prop="position" /> -->
+        <!-- <el-table-column label="閮ㄩ棬" align="center" prop="department" /> -->
+        <!-- <el-table-column label="閮ㄩ棬缂栧彿" align="center" prop="departmentId" /> -->
         <el-table-column
           label="鑱旂郴鐢佃瘽"
           align="center"
           prop="phoe"
-          width="120"
+          width="140"
         />
         <el-table-column label="鍦板潃" align="center" prop="address" />
         <el-table-column
@@ -178,7 +191,7 @@
             />
           </template>
         </el-table-column>
-        <el-table-column label="鑱旂郴閭" align="center" prop="email" />
+        <!-- <el-table-column label="鑱旂郴閭" align="center" prop="email" /> -->
         <!-- <el-table-column label="浣撴绫诲埆" align="center" prop="tjCategory" /> -->
         <el-table-column label="鍒嗙粍" align="center" prop="groupingName" />
         <el-table-column label="椤圭洰鏀惰垂" align="center" prop="ysPrice" />
@@ -195,7 +208,8 @@
       <el-upload
         ref="upload"
         :limit="1"
-        accept=".xlsx, .xls"
+        :key="uploadKey" 
+        accept=".xls"
         :headers="upload.headers"
         :data="data"
         :action="upload.url"
@@ -212,7 +226,7 @@
             <el-checkbox v-model="upload.updateSupport" />
             鏄惁鏇存柊宸茬粡瀛樺湪鐨勭敤鎴锋暟鎹�
           </div>
-          <span>浠呭厑璁稿鍏ls銆亁lsx鏍煎紡鏂囦欢銆�</span>
+          <span>浠呭厑璁稿鍏ls鏍煎紡鏂囦欢銆�</span>
           <el-link
             type="primary"
             :underline="false"
@@ -223,7 +237,7 @@
         </div>
       </el-upload>
       <div slot="footer" class="dialog-footer">
-        <el-button type="primary" @click="submitFileForm">纭� 瀹�</el-button>
+        <el-button type="primary" @click="submitFileForm">淇濆瓨淇℃伅</el-button>
         <el-button @click="upload.open = false">鍙� 娑�</el-button>
       </div>
     </el-dialog>
@@ -344,26 +358,26 @@
           label-width="100px"
           :inline="true"
         >
-        <el-form-item label="鍗曚綅鍚嶇О" prop="drugManufacturerId">
-        <el-select
-          :remote-method="getRemoteData"
-          v-model="objs.drugManufacturerId"
-          remote
-          filterable
-          style="width: 200px"
-          placeholder="璇烽�夋嫨鍗曚綅鍚嶇О"
-          clearable
-          @clear="getCompanyList"
-          @change="idFn1"
-        >
-          <el-option
-            v-for="dict in CompanyList"
-            :key="dict.cnName"
-            :label="dict.cnName"
-            :value="dict.drugManufacturerId"
-          />
-        </el-select>
-      </el-form-item>
+          <el-form-item label="鍗曚綅鍚嶇О" prop="drugManufacturerId">
+            <el-select
+              :remote-method="getRemoteData"
+              v-model="objs.drugManufacturerId"
+              remote
+              filterable
+              style="width: 200px"
+              placeholder="璇烽�夋嫨鍗曚綅鍚嶇О"
+              clearable
+              @clear="getCompanyList"
+              @change="idFn1"
+            >
+              <el-option
+                v-for="dict in CompanyList"
+                :key="dict.cnName"
+                :label="dict.cnName"
+                :value="dict.drugManufacturerId"
+              />
+            </el-select>
+          </el-form-item>
           <el-form-item label="閮ㄩ棬鍚嶇О" prop="dwDeptName">
             <el-input v-model="form.dwDeptName" placeholder="璇疯緭鍏ラ儴闂ㄥ悕绉�" />
           </el-form-item>
@@ -384,6 +398,7 @@
 </template>
 
 <script>
+import Cookies from "js-cookie"
 import {
   addDept,
   addComp,
@@ -391,9 +406,13 @@
   getDwAndDwDept,
   newExcelImport,
 } from "@/api/system/comp";
-import { newConfirm, getCompany, queryCompany } from "@/api/team/tuanti";
+import {
+  newConfirm,
+  getCompany,
+  queryCompany,
+  getconfigKey,
+} from "@/api/team/tuanti";
 import { getToken } from "@/utils/auth";
-import { read, utils } from "xlsx";
 
 export default {
   dicts: [
@@ -419,6 +438,7 @@
       }
     };
     return {
+      uploadKey: 0,
       leftList: "",
       isdisabled: true,
       setDisabled: {
@@ -461,13 +481,13 @@
       data: {
         dwId: "",
         dwDeptId: "",
-        dwName:"",
+        dwName: "",
       },
 
       objs: {
         drugManufacturerId: "",
-        dwDeptName: "",
         reservationTime: "",
+        yxts: "",
       },
       DataList: [],
       tjOrderList: [], //鍗曚釜椤圭洰闆嗗悎
@@ -494,11 +514,11 @@
         // 鏄惁鏇存柊宸茬粡瀛樺湪鐨勭敤鎴锋暟鎹�
         updateSupport: 0,
         // 璁剧疆涓婁紶鐨勮姹傚ご閮�
-        headers: { Authorization: "Bearer " + getToken() },
+        headers: { Authorization: "Bearer " + getToken(),hospId: Cookies.get("hospId") },
         // 涓婁紶鐨勫湴鍧�
         url:
           process.env.VUE_APP_BASE_API +
-          "/reservation/reservation/newExcelImport",
+          "/reservation/reservation/newExcelImportNotDwDeptId",
       },
       // 鏌ヨ鍙傛暟
       queryParam: {
@@ -535,9 +555,9 @@
         reservationTime: [
           { required: true, validator: checkPhoneNum, trigger: "blur" },
         ],
-        dwDeptName: [
-          { required: true, validator: checkPhoneNum, trigger: "change" },
-        ],
+        // dwDeptName: [
+        //   { required: true, validator: checkPhoneNum, trigger: "change" },
+        // ],
         signingPic: [
           { required: true, validator: checkPhoneNum, trigger: "blur" },
         ],
@@ -662,7 +682,7 @@
   methods: {
     // 淇濆瓨閮ㄩ棬
     handleAddDept() {
-        let data = {
+      let data = {
         dwName: this.data.dwName,
         dwId: this.data.dwId,
         dwDeptName: this.form.dwDeptName,
@@ -688,12 +708,12 @@
       console.log(value);
       if (value) {
         this.data.dwId = value;
-        this.CompanyList.forEach(item=>{
+        this.CompanyList.forEach((item) => {
           console.log(item);
-          if(item.drugManufacturerId == this.data.dwId){
-            this.data.dwName = item.cnName
+          if (item.drugManufacturerId == this.data.dwId) {
+            this.data.dwName = item.cnName;
           }
-        })
+        });
       }
     },
     idBm(value) {
@@ -704,55 +724,55 @@
       const { columns, data } = param;
       const sums = [];
       columns.forEach((column, index) => {
+        // if (index === 0) {
+        //   sums[index] = "鍚堣";
+        //   return;
+        // }
         if (index === 0) {
-          sums[index] = "鍚堣";
-          return;
-        }
-        if (index === 1) {
           sums[index] = "鎬昏浜烘暟";
           return;
         }
-        if (index === 2) {
+        if (index === 1) {
           sums[index] = this.ListObj.count;
           return;
         }
-        if (index === 7) {
+        if (index === 2) {
           sums[index] = "鐢风粍浜烘暟";
           return;
         }
-        if (index === 8) {
+        if (index === 3) {
           sums[index] = this.ListObj.manCount;
           return;
         }
-        if (index === 9) {
+        if (index === 4) {
           sums[index] = "鐢风粍閲戦";
           return;
         }
-        if (index === 10) {
+        if (index === 5) {
           sums[index] = this.ListObj.manMoney;
           return;
         }
-        if (index === 12) {
+        if (index === 6) {
           sums[index] = "濂崇粍浜烘暟";
           return;
         }
-        if (index === 13) {
+        if (index === 7) {
           sums[index] = this.ListObj.woManCount;
           return;
         }
-        if (index === 14) {
+        if (index === 8) {
           sums[index] = "濂崇粍閲戦";
           return;
         }
-        if (index === 15) {
+        if (index === 9) {
           sums[index] = this.ListObj.woManMoney;
           return;
         }
-        if (index === 16) {
+        if (index === 10) {
           sums[index] = "鍚堣閲戦";
           return;
         }
-        if (index === 17) {
+        if (index === 11) {
           sums[index] = this.ListObj.hjMoney;
           return;
         }
@@ -761,6 +781,7 @@
     },
     // 鎼滅储
     getRemoteData(query) {
+      
       if (query) {
         let compName = query;
         queryCompany(compName).then((response) => {
@@ -775,6 +796,10 @@
     // 鑾峰彇鍗曚綅淇℃伅闆嗗悎
     getCompanyList() {
       this.loading = true;
+      getconfigKey('team_reservation_default_day').then((res) => {
+        console.log(res, 1111);
+        this.objs.yxts = res.msg;
+      });
       getCompany(this.queryParam).then((response) => {
         this.CompanyList = response.data;
         this.total = response.total;
@@ -835,6 +860,7 @@
       this.TotalPrice = "";
       this.tableData[0] = [];
       this.TotalPrice1 = "";
+      this.userList = []
       // this.resetForm("form");
       this.form = {};
     },
@@ -843,14 +869,17 @@
     selectTime(val) {
       this.objs.reservationTime = val;
     },
-
     /** 瀵煎叆鎸夐挳鎿嶄綔 */
     handleImport() {
-      if (this.data.dwId || this.data.dwDeptId) {
+      if (this.objs.drugManufacturerId && this.objs.reservationTime) {
+          // 娓呯┖缁勪欢鍐呴儴鐘舵�侊紙鍚凡涓婁紶鏂囦欢锛�
+      this.$refs.upload?.clearFiles();
+      this.uploadKey = Date.now(); // 鏀瑰彉 key 寮哄埗閲嶆柊娓叉煋缁勪欢
+      // 鍚屾鏁版嵁婧愶紙Vue2 闇�鐢� $set 纭繚鍝嶅簲寮忥級
         this.upload.title = "鐢ㄦ埛瀵煎叆";
         this.upload.open = true;
       } else {
-        this.$modal.msgError("璇烽�夋嫨鍗曚綅鎴栭儴闂�");
+        this.$modal.msgError("璇烽�夋嫨鍗曚綅鎴栭绾︽椂闂�");
       }
     },
     /** 涓嬭浇妯℃澘鎿嶄綔 */
@@ -866,13 +895,43 @@
       this.upload.isUploading = true;
     },
     // 鏂囦欢涓婁紶鎴愬姛澶勭悊
+    // 鏂囦欢涓婁紶鎴愬姛澶勭悊
     handleFileSuccess(response, file, fileList) {
-      this.ListObj = response.data;
+      console.log(response, file, fileList)
+      if (response.code == 500) {
+        this.isdisabled = true;
+        // Message.warning(response.msg);
+        // this.$modal.msgError(response.msg);
+        // this.$modal.msgError("浜哄憳"+ response.data.list + "淇℃伅閿欒");
+       
+        // const errorList = response.data.list.join(", ");
+       
+        this.$confirm( `${response.msg}`, {
+          confirmButtonText: "纭畾",
+          cancelButtonText: "鍙栨秷",
+          type: "error",
+          center: true,
+          dangerouslyUseHTMLString: true,
+        });
+      }else{
+        this.isdisabled = false;
+        this.ListObj = response.data;
       this.userList = response.data.list;
+     
+      this.userList.forEach((item) => {
+        this.CompanyList.forEach((item1) => {
+          if (item1.drugManufacturerId == this.objs.drugManufacturerId) {
+            item.company = item1.cnName;
+          }
+        });
+      });
+      }
+     
       this.upload.open = false;
       this.upload.isUploading = false;
       this.$refs.upload.clearFiles();
       this.leftList = response.msg;
+
       if (this.leftList == "鎿嶄綔澶辫触") {
         this.isdisabled = true;
         this.$alert(
@@ -885,15 +944,17 @@
           "瀵煎叆缁撴灉",
           { dangerouslyUseHTMLString: true }
         );
-      } else {
-        this.isdisabled = false;
-        this.$alert(
-          "<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" +
-            response.msg,
-          { dangerouslyUseHTMLString: true }
-        );
-        this.rightList = response;
-      }
+      } 
+      // else {
+      //   console.log(11111)
+      //   this.isdisabled = false;
+      //   this.$alert(
+      //     "<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" +
+      //       response.msg,
+      //     { dangerouslyUseHTMLString: true }
+      //   );
+      //   this.rightList = response;
+      // }
       for (let i = 0; i < fileList.length; i++) {
         if (file.name != fileList[i].name) {
           this.fileList.push({
@@ -916,6 +977,7 @@
     },
     // 鎻愪氦涓婁紶鏂囦欢
     submitFileForm() {
+      console.log(9999)
       this.$refs.upload.submit();
       this.isShow = false;
     },
@@ -954,17 +1016,20 @@
 
     /** 纭鎸夐挳 */
     submitForm() {
-      if (this.objs.reservationTime && this.data.dwDeptId) {
+      // if (this.objs.reservationTime && this.data.dwDeptId) {
+      if (this.objs.reservationTime) {
         let data = {
           copeWith: this.ListObj.hjMoney,
           reservations: this.userList,
           reservationTime: this.objs.reservationTime,
           dwDeptId: this.data.dwDeptId,
+          yxts: this.objs.yxts,
+          dwId: this.data.dwId,
         };
         newConfirm(data).then((res) => {
           this.$modal.msgSuccess("鎻愪氦鎴愬姛");
           this.confirm = true;
-           this.userList = [];
+          this.userList = [];
         });
       } else {
         this.$modal.msgError("璇峰~鍐欏甫鏄熷彿鍐呭");

--
Gitblit v1.8.0