From 2b5e20ec148e824fb6498bbe2977dd1820468c3e Mon Sep 17 00:00:00 2001
From: Fixiaobai <fixiaobai@163.com>
Date: 星期一, 14 八月 2023 18:00:06 +0800
Subject: [PATCH] 	new file:   src/api/urlEnum/personnel.js 	modified:   src/api/urlEnum/satisfactionSurveys.js 	modified:   src/views/CNAS/satisfactionSurveys/index.vue 	modified:   src/views/laboratory/ledger/index.vue 	modified:   src/views/laboratory/personnel/index.vue

---
 src/views/CNAS/satisfactionSurveys/index.vue |  216 +++++++++++++++++++++++++++++++++++++++++++----------
 1 files changed, 173 insertions(+), 43 deletions(-)

diff --git a/src/views/CNAS/satisfactionSurveys/index.vue b/src/views/CNAS/satisfactionSurveys/index.vue
index a0f1ee8..f1e2efb 100644
--- a/src/views/CNAS/satisfactionSurveys/index.vue
+++ b/src/views/CNAS/satisfactionSurveys/index.vue
@@ -7,13 +7,19 @@
         <el-form-item style="width: 800px;">
           <el-col style="display: flex; justify-content: space-around;" :span="12">
             <el-row>璋冩煡鏃ユ湡:</el-row>
-            <el-row style="width: 300px;"><el-input type="date" prefix-icon="el-icon-date" v-model="surveyDate"
-                placeholder="璇烽�夋嫨璋冩煡鏃ユ湡"></el-input></el-row>
+            <el-row style="width: 300px;">
+              <el-date-picker style="width: 270px;" class="newly-form" v-model="surveyDate" type="date"
+                placeholder="璇烽�夋嫨璋冩煡鏃ユ湡" autocomplete="off">
+              </el-date-picker>
+            </el-row>
           </el-col>
           <el-col style="display: flex; justify-content: space-around;" :span="12">
             <el-row>褰曞叆鏃ユ湡:</el-row>
-            <el-row style="width: 300px;"><el-input type="date" prefix-icon="el-icon-date" v-model="entryDate"
-                placeholder="璇烽�夋嫨褰曞叆鏃ユ湡"></el-input></el-row>
+            <el-row style="width: 300px;">
+              <el-date-picker style="width: 270px;" class="newly-form" v-model="entryDate" type="date"
+                placeholder="璇烽�夋嫨褰曞叆鏃ユ湡" autocomplete="off">
+              </el-date-picker>
+            </el-row>
           </el-col>
         </el-form-item>
         <el-form-item>
@@ -30,16 +36,11 @@
         <el-table ref="tableData" :max-height="800" :cell-style="{ textAlign: 'center' }"
           :header-cell-style="{ border: '0px', background: '#f5f7fa', color: '#606266', boxShadow: 'inset 0 1px 0 #ebeef5', textAlign: 'center' }"
           :data="tableData" style="width: 100%">
-          <el-table-column type="index" label="搴忓彿" min-width="5%">
-            <template slot-scope="scope">
-              <el-checkbox v-model="id" value="scope.row.id"></el-checkbox>
-            </template>
-          </el-table-column>
+          <el-table-column prop="id" type="index" label="搴忓彿" min-width="20%"/>
           <el-table-column prop="surveyDate" label="璋冩煡鏃ユ湡" min-width="10%" />
           <el-table-column prop="userUnit" label="瀹㈡埛鍗曚綅鍚嶇О" min-width="10%" />
           <el-table-column prop="projectName" label="椤圭洰鍚嶇О" min-width="10%" />
           <el-table-column prop="fillName" label="濉〃浜哄鍚�" min-width="10%" />
-          <el-table-column prop="dateInfo" label="鏃ユ湡" min-width="10%" />
           <el-table-column prop="post" label="鑱屼綅" min-width="10%" />
           <el-table-column prop="telephone" label="鑱旂郴鐢佃瘽" min-width="10%" />
           <el-table-column prop="userName" label="褰曞叆浜�" min-width="10%" />
@@ -121,12 +122,14 @@
         <el-row>
           <el-col :span="12">
             <el-form-item label="璋冩煡鏃ユ湡锛�" prop="surveyDate">
-              <el-input style="width: 200px;" type="date" v-model="ruleForm.surveyDate"></el-input>
+              <el-date-picker style="width: 200px;" class="newly-form" v-model="ruleForm.surveyDate" type="date"
+                placeholder="璇烽�夋嫨璋冩煡鏃ユ湡" autocomplete="off">
+              </el-date-picker>
             </el-form-item>
           </el-col>
           <el-col :span="12">
-            <el-form-item label="瀹㈡埛鍗曚綅锛�" prop="unitName">
-              <el-input style="width: 200px;" type="text" placeholder="璇疯緭鍏ュ鎴峰崟浣嶅悕绉�" v-model="ruleForm.unitName"></el-input>
+            <el-form-item label="瀹㈡埛鍗曚綅锛�" prop="userUnit">
+              <el-input style="width: 200px;" type="text" placeholder="璇疯緭鍏ュ鎴峰崟浣嶅悕绉�" v-model="ruleForm.userUnit"></el-input>
             </el-form-item>
           </el-col>
         </el-row>
@@ -137,8 +140,8 @@
             </el-form-item>
           </el-col>
           <el-col :span="12">
-            <el-form-item label="鏃ユ湡锛�" prop="dateInfo">
-              <el-input style="width: 200px;" type="date" v-model="ruleForm.dateInfo"></el-input>
+            <el-form-item label="鑱旂郴鐢佃瘽锛�" prop="telephone">
+              <el-input style="width: 200px;" type="text" placeholder="璇疯緭鍏ヨ仈绯荤數璇�" v-model="ruleForm.telephone"></el-input>
             </el-form-item>
           </el-col>
         </el-row>
@@ -158,30 +161,24 @@
         <!-- 鑱旂郴鐢佃瘽/褰曞叆鏃ユ湡 -->
         <el-row>
           <el-col :span="12">
-            <el-form-item label="鑱旂郴鐢佃瘽锛�" prop="telephone">
-              <el-input style="width: 200px;" type="text" placeholder="璇疯緭鍏ヨ亴浣�" v-model="ruleForm.telephone"></el-input>
+            <el-form-item label="褰曞叆浜猴細" prop="userName">
+              <el-input style="width: 200px;" type="text" placeholder="璇疯緭鍏ュ綍鍏ヤ汉濮撳悕" v-model="ruleForm.userName"></el-input>
             </el-form-item>
           </el-col>
           <el-col :span="12">
             <el-form-item label="褰曞叆鏃ユ湡锛�" prop="entryDate">
-              <el-input style="width: 200px;" type="date" v-model="ruleForm.entryDate"></el-input>
-            </el-form-item>
-          </el-col>
-        </el-row>
-        <!-- 褰曞叆浜� -->
-        <el-row>
-          <el-col :span="12">
-            <el-form-item label="褰曞叆浜猴細" prop="userName">
-              <el-input style="width: 200px;" type="text" placeholder="璇疯緭鍏ュ綍鍏ヤ汉濮撳悕" v-model="ruleForm.userName"></el-input>
+              <el-date-picker style="width: 200px;" class="newly-form" v-model="ruleForm.entryDate" type="date"
+                placeholder="璇烽�夋嫨褰曞叆鏃ユ湡" autocomplete="off">
+              </el-date-picker>
             </el-form-item>
           </el-col>
         </el-row>
         <el-row>
           <el-col :span="12">
             <el-form-item label="闄勪欢涓婁紶锛�">
-              <el-upload class="upload-demo" :action="path"
-                :on-preview="handlePreview" :on-remove="handleRemove" :before-remove="beforeRemove" multiple :limit="1"
-                :on-exceed="handleExceed" :file-list="fileList" :on-success="fileUploadSuccess()">
+              <el-upload class="upload-demo" :action="path" :on-preview="handlePreview" :on-remove="handleRemove" multiple
+                :limit="1" :on-exceed="handleExceed" :file-list="fileList" :on-success="handleSuccess"
+                :before-upload="beforeAvatarUpload">
                 <el-button size="small" type="primary">鐐瑰嚮涓婁紶</el-button>
               </el-upload>
             </el-form-item>
@@ -189,7 +186,7 @@
         </el-row>
         <!-- 鎻愪氦 -->
         <el-row>
-          <el-col :span="8">
+          <el-col :span="24" style="display: flex;justify-content: center;">
             <el-form-item>
               <el-button @click="resetForm('ruleForm')">鍙栨秷</el-button>
               <el-button type="primary" @click="submitForm('ruleForm')">淇濆瓨</el-button>
@@ -230,20 +227,26 @@
       path: 'http://192.168.110.254:1234/cnasSatisfactionSurvey/uploadFile',
       ruleForm: {
         surveyDate: '',
-        unitName: '',
+        userUnit: '',
         projectName: '',
-        dateInfo: '',
         fillName: '',
         post: '',
+        userId: '',
         telephone: '',
         entryDate: '',
-        userName: ''
+        userName: '',
+        serviceAttitude: '',
+        technicalPower: '',
+        testJob: '',
+        reasonableCharge: '',
+        improvementRequirements: '',
+        otherSupplements: ''
       },
       rules: {
         surveyDate: [
           { type: 'date', required: true, message: '璇烽�夋嫨璋冩煡鏃ユ湡', trigger: 'change' }
         ],
-        unitName: [
+        userUnit: [
           { required: true, message: '璇疯緭鍏ュ鎴峰崟浣嶅悕绉�', trigger: 'blur' },
         ],
         projectName: [
@@ -260,7 +263,7 @@
     }
   },
   created() {
-      
+
   },
   mounted() {
     this.getData()
@@ -270,6 +273,7 @@
       this.getData();
     },
     look(id) {
+      console.log(id);
       let str = "/$";
       this.dialogVisible = true
       let data = this.tableData.filter(res => {
@@ -311,25 +315,62 @@
         "surveyDate": this.surveyDate,
         "entryDate": this.entryDate
       }
+      if (this.surveyDate != null) {
+        param.surveyDate = this.dateFormat(this.surveyDate);
+      }
+      if (this.entryDate !== null) {
+        param.entryDate = this.dateFormat(this.entryDate);
+      }
       let res = await get(urlInfo.url.getCnasSatisfactionSurvey, param)
       this.tableData = res.data.cnasSatisfactionSurveyList
       this.total = res.data.total
     },
-    getFillName() {
+    async getFillName() {
       this.dialogVisible2 = true
-      // get(urlInfo.url.getFillNameAndId)
+      let res = await get(urlInfo.url.getFillNameAndId)
+      this.ruleForm.userName = res.data.name
+      this.ruleForm.userId = res.data.id
+      var now = new Date();
+      this.ruleForm.entryDate = now
     },
-    submitForm(formName) {
+    async submitForm(formName) {
       this.$refs[formName].validate((valid) => {
         if (valid) {
-          alert('submit!');
+          this.add();
         } else {
           console.log('error submit!!');
           return false;
         }
       });
     },
+    async add() {
+      let data = JSON.parse(JSON.stringify(this.ruleForm))
+      let entryDate = this.format(this.ruleForm.entryDate);
+      let surveyDate = this.format(this.ruleForm.surveyDate);
+      data.entryDate = entryDate
+      data.surveyDate = surveyDate
+      // data.dateInfo = dateInfo
+      let add = await post(urlInfo.url.addSurvey, data);
+      if (add) {
+        this.$message({
+          message: '娣诲姞鎴愬姛',
+          type: 'success'
+        });
+        this.fileList = []
+        this.$refs["ruleForm"].resetFields();
+        let res = await get(urlInfo.url.getFillNameAndId)
+      this.ruleForm.userName = res.data.name
+      this.ruleForm.id = res.data.id
+      var now = new Date();
+      this.ruleForm.entryDate = now
+      this.getData()
+      } else {
+        this.$message.error('娣诲姞澶辫触锛佽妫�鏌ュ唴瀹�');
+      }
+    },
     resetForm(formName) {
+      this.dialogVisible2 = false
+      this.fileList = []
       this.$refs[formName].resetFields();
     },
     handleRemove(file, fileList) {
@@ -341,11 +382,100 @@
     handleExceed(files, fileList) {
       this.$message.warning(`褰撳墠闄愬埗閫夋嫨 1 涓枃浠讹紝鏈閫夋嫨浜� ${files.length} 涓枃浠讹紝鍏遍�夋嫨浜� ${files.length + fileList.length} 涓枃浠禶);
     },
-    beforeRemove(file, fileList) {
-      return this.$confirm(`纭畾绉婚櫎 ${file.name}锛焋);
+    // beforeRemove(file, fileList) {
+    //   return this.$confirm(`纭畾绉婚櫎 ${file.name}锛焋);
+    // },
+    handleSuccess(response, file, fileList) {
+      let data = response.data;
+      if (this.ruleForm.userUnit == '') {
+        this.ruleForm.userUnit = data.unitName
+      }
+      if (this.ruleForm.projectName == '') {
+        this.ruleForm.projectName = data.projectName
+      }
+      if (this.ruleForm.post === '') {
+        this.ruleForm.post = data.post
+      }
+      if (this.ruleForm.fillName == '') {
+        this.ruleForm.fillName = data.fillName.split("/")[0]
+      }
+      if (this.ruleForm.telephone == '') {
+        this.ruleForm.telephone = data.telephone
+      }
+      if(this.ruleForm.surveyDate==null||this.ruleForm.surveyDate==''){
+        let dates = new Date(data.fillName.split("/")[1]);
+        console.log(dates);
+        if(dates!=''&&dates!=''){
+          this.ruleForm.surveyDate=dates
+        }
+      }
+      this.ruleForm.serviceAttitude = data.serviceAttitude
+      this.ruleForm.technicalPower = data.technicalPower
+      this.ruleForm.testJob = data.testJob
+      this.ruleForm.improvementRequirements = data.improvementRequirements
+      this.ruleForm.otherSupplements = data.otherSupplements
+      this.ruleForm.reasonableCharge=data.reasonableCharge
     },
-    fileUploadSuccess(res){
-      console.log(res);
+    beforeAvatarUpload(file) {
+      let split = file.name.split(".");
+      let fileName = split[split.length - 1];
+      const isWord = fileName == 'doc' || fileName == 'docx';
+      const isLt2M = file.size / 1024 / 1024 < 2;
+      if (!isWord) {
+        this.$message.error('涓婁紶word鏂囦欢鍙兘鏄� doc/docx 鏍煎紡!');
+      }
+      if (!isLt2M) {
+        this.$message.error('涓婁紶word鏂囦欢澶у皬涓嶈兘瓒呰繃 2MB!');
+      }
+      return isWord && isLt2M;
+    },
+    dateFormat(longTypeDate) {
+      var dateTypeDate = "";
+      var date = new Date();
+      date.setTime(longTypeDate);
+      dateTypeDate += date.getFullYear();   //骞�    
+      dateTypeDate += "-" + this.getMonth(date); //鏈�     
+      dateTypeDate += "-" + this.getDay(date);   //鏃�    
+      return dateTypeDate;
+    },
+    //杩斿洖 01-12 鐨勬湀浠藉��     
+    getMonth(date) {
+      var month = "";
+      month = date.getMonth() + 1; //getMonth()寰楀埌鐨勬湀浠芥槸0-11    
+      if (month < 10) {
+        month = "0" + month;
+      }
+      return month;
+    },
+    //杩斿洖01-30鐨勬棩鏈�    
+    getDay(date) {
+      var day = "";
+      day = date.getDate();
+      if (day < 10) {
+        day = "0" + day;
+      }
+      return day;
+    },
+    datetimeFormat(longTypeDate) {
+      var dateTypeDate = "";
+      var date = new Date();
+      date.setTime(longTypeDate);
+      dateTypeDate += date.getFullYear();   //骞�    
+      dateTypeDate += "-" + this.getMonth(date); //鏈�     
+      dateTypeDate += "-" + this.getDay(date);   //鏃�    
+      return dateTypeDate;
+    },
+    format(d) {
+      var y = d.getFullYear();
+      var m = d.getMonth() + 1;
+      if (m < 10) {
+        m = "0" + m;
+      }
+      var day = d.getDate();
+      if (day < 10) {
+        day = "0" + day;
+      }
+      return y + "-" + m + "-" + day;
     }
   }
 }

--
Gitblit v1.9.3