wangmengwei 3 年 前
コミット
2a28b0c970
2 ファイル変更112 行追加36 行削除
  1. 1 1
      src/settings.js
  2. 111 35
      src/views/system/time/index.vue

+ 1 - 1
src/settings.js

@@ -1,7 +1,7 @@
 module.exports = {
   title: '潜山市防疫数据平台',
   // urls: `http://118.178.139.79:7090`,
-  urls: `http://192.168.101.11:8090`,
+  urls: `http://192.168.101.110:8090`,
    // urls: `https://qsfy.qs163.cn`,
 
   /**

+ 111 - 35
src/views/system/time/index.vue

@@ -44,8 +44,8 @@
 								</el-select>
 							</el-form-item>
 						</el-col>
-						
-						
+
+
 					</el-row>
 				</el-col>
 				<el-col :span="24">
@@ -122,8 +122,8 @@
 							</el-form-item>
 						</el-col>
 
-						
-						
+
+
 					</el-row>
 				</el-col>
 				<el-col :span="24">
@@ -165,7 +165,7 @@
 											/> -->
 							</el-form-item>
 						</el-col>
-						
+
 						<el-col :span="4" style="text-align: center;">
 							<el-form-item>
 								<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
@@ -186,6 +186,16 @@
 			<el-col :span="1.5">
 				<el-button type="danger" plain icon="el-icon-delete" size="mini" :disabled="multiple" @click="handleDelete" v-hasPermi="['core:info:remove']">删除</el-button>
 			</el-col>
+      <el-col :span="1.5">
+        <el-button
+          type="info"
+          plain
+          icon="el-icon-upload2"
+          size="mini"
+          @click="handleImport"
+          v-hasPermi="['system:user:import']"
+        >导入</el-button>
+      </el-col>
 			<el-col :span="1.5">
 				<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" v-hasPermi="['core:info:export']">导出</el-button>
 			</el-col>
@@ -202,24 +212,24 @@
 			<!-- <el-table-column label="性别" align="center" prop="gender" /> -->
 			<el-table-column label="受种者编号" align="center" prop="code"   width="170"/>
 			<el-table-column label="身份证号码" align="center" prop="idCard" width="180" />
-			
+
 			<!-- <el-table-column label="现居省份" align="center" prop="province" />
 			<el-table-column label="现居市" align="center" prop="city" />
 			<el-table-column label="现居县区" align="center" prop="region" /> -->
 			<el-table-column label="户籍地址" align="center" prop="domicileSelect" width="250" />
 			<el-table-column label="居住地址" align="center" prop="nowInSelect" width="250" />
-			
+
 			<!-- <el-table-column label="户籍乡镇" align="center" prop="villageTowns" />
 			<el-table-column label="户籍村居" align="center" prop="village" />
 			<el-table-column label="户籍村民组" align="center" prop="villagerGroup" /> -->
 			<!-- <el-table-column label="户主" align="center" prop="houseType" /> -->
-			
+
 			<!-- <el-table-column label="重点行业" align="center" prop="keyIndustries" /> -->
 			<!-- <el-table-column label="接种情况" align="center" prop="isVaccination" /> -->
 			<!-- <el-table-column label="接种记录" align="center" class-name="small-padding fixed-width">
 				<template slot-scope="scope">
 					<el-button size="mini" type="text" @click="chakei(scope.row)">查看</el-button>
-					
+
 				</template>
 			</el-table-column> -->
 			<!-- v-hasPermi="['core:info:edit']" -->
@@ -353,7 +363,7 @@
 					<!-- <el-col :span="12">
 						<el-form-item label="人群分类" prop="crowd_classification"><el-input v-model="form.crowd_classification" placeholder="请输入人群分类" /></el-form-item>
 					</el-col> -->
-					
+
 					<el-col :span="24">
 						<el-col :span="12">
 							<el-form-item label="户主" prop="houseType">
@@ -482,9 +492,9 @@
 									</div>
 								</el-form-item>
 							</el-col>
-							
+
 							<!-- <el-col :span="2" class="hjdoecdre"> -->
-								
+
 							<!-- </el-col> -->
 						</el-row>
 					</el-col>
@@ -521,13 +531,13 @@
 											<!-- <div class="el-upload__tip" style="margin-left: 5px; color: red; margin-top: 0;">请上传png/jpg文档,且不超过50MB</div> -->
 										</div>
 									</el-col>
-									
+
 								</el-row>
 							</el-col>
 							<el-col :span="9">
 								<el-row>
 									<el-col :span="18" class="znshu">
-								<el-form-item label="暂缓接种" prop="suspend"> 
+								<el-form-item label="暂缓接种" prop="suspend">
 									<!-- <el-input
                   						v-model="form.suspend"
                   						placeholder="请输入暂缓"
@@ -560,7 +570,7 @@
 											<!-- <div class="el-upload__tip" style="margin-left: 5px; color: red; margin-top: 0;">请上传png/jpg文档,且不超过50MB</div> -->
 										</div>
 									</el-col>
-									
+
 								</el-row>
 							</el-col>
 							<el-col :span="7">
@@ -595,10 +605,10 @@
 											<!-- <div class="el-upload__tip" style="margin-left: 5px; color: red; margin-top: 0;">请上传png/jpg文档,且不超过50MB</div> -->
 										</div>
 									</el-col>
-									
+
 								</el-row>
 							</el-col>
-							
+
 						</el-row>
 					</el-col>
 				</el-row>
@@ -629,6 +639,36 @@
 				<el-table-column label="接种地点" align="center" prop=".vaccinationPlace" />
 			</el-table>
 		</el-dialog>
+    <!-- 用户导入对话框 -->
+    <el-dialog :close-on-click-modal="false" :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body>
+      <el-upload
+        ref="upload"
+        :limit="1"
+        accept=".xlsx, .xls"
+        :headers="upload.headers"
+        :action="upload.url + '?updateSupport=' + upload.updateSupport"
+        :disabled="upload.isUploading"
+        :on-progress="handleFileUploadProgress"
+        :on-success="handleFileSuccess"
+        :auto-upload="false"
+        drag
+      >
+        <i class="el-icon-upload"></i>
+        <div class="el-upload__text">
+          将文件拖到此处,或
+          <em>点击上传</em>
+        </div>
+        <div class="el-upload__tip" slot="tip">
+          <el-checkbox v-model="upload.updateSupport" />是否更新已经存在的用户数据
+          <el-link type="info" style="font-size:12px" @click="importTemplate">下载模板</el-link>
+        </div>
+        <div class="el-upload__tip" style="color:red" slot="tip">提示:仅允许导入“xls”或“xlsx”格式文件!</div>
+      </el-upload>
+      <div slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="submitFileForm">确 定</el-button>
+        <el-button @click="upload.open = false">取 消</el-button>
+      </div>
+    </el-dialog>
 	</div>
 </template>
 
@@ -719,6 +759,21 @@ export default {
 					}
 				]
 			},
+      // 用户导入参数
+      upload: {
+        // 是否显示弹出层(用户导入)
+        open: false,
+        // 弹出层标题(用户导入)
+        title: "",
+        // 是否禁用上传
+        isUploading: false,
+        // 是否更新已经存在的用户数据
+        updateSupport: 0,
+        // 设置上传的请求头部
+        headers: { Authorization: "Bearer " + getToken() },
+        // 上传的地址
+        url: process.env.VUE_APP_BASE_API + "/system/user/importData"
+      },
 			// 表单校验
 			rules: {
 				region: [{ required: true, message: '区不能为空', trigger: 'blur' }],
@@ -789,7 +844,7 @@ export default {
 			],
 			typeOptionstyzandeh:[],
 			angesList: [
-				
+
 			],
 			typeOptionsname: [],
 			typeOptionstimes: [],
@@ -855,7 +910,7 @@ export default {
 		this.getDicts('contraindication').then(response => {
 			this.typeOptionscont = response.data;
 		});
-		// 其他 typeOptionscontqit 
+		// 其他 typeOptionscontqit
 		this.getDicts('other_status').then(response => {
 			this.typeOptionscontqit = response.data;
 		});
@@ -863,7 +918,7 @@ export default {
 		this.getDicts('age_interval').then(response => {
 			this.angesList = response.data;
 		});
-		
+
 		this.form.province = this.selected[0];
 		this.form.city = this.selected[1];
 		this.form.region = this.selected[2];
@@ -1011,10 +1066,10 @@ export default {
 			if (this.form.isVaccination !== null) {
 				if (this.form.isVaccination == '是') {
 					// 接种疫苗
-					this.naneme = false, 
+					this.naneme = false,
 					this.shouwes = true;
 				}else {
-					this.naneme = true, 
+					this.naneme = true,
 					this.shouwes = false,
 					this.form.vaccineInfoUserList = [{
 						vaccineName: '',
@@ -1090,7 +1145,7 @@ export default {
 				this.config.filter( router=> {
 					router.name = '禁忌症附件'
 				})
-				console.log(res.data); 
+				console.log(res.data);
 				console.log(res.data.name.substr(0, res.data.name.length - 4));
 				this.form.url = this.config;
 				this.form.url = JSON.stringify(this.form.url);
@@ -1162,7 +1217,7 @@ export default {
 		},
 		upImageFntwo(res, file) {
 			this.comfietg = []
-			
+
 			if (res.code !== 200) {
 				this.msgInfo('上传失败');
 				return false;
@@ -1172,7 +1227,7 @@ export default {
 				this.comfietg.filter( router=> {
 					router.name = '附件'
 				})
-				console.log(this.comfietg); 
+				console.log(this.comfietg);
 				this.form.vaccineInfoUserList[this.nameutaiL].url = []
 				console.log(res.data.name.substr(0, res.data.name.length - 4));
 				console.log(this.nameutaiL)
@@ -1257,7 +1312,7 @@ export default {
 				this.configther.filter( router=> {
 					router.name = '暂缓附件'
 				})
-				console.log(this.configther); 
+				console.log(this.configther);
 				console.log(res.data.name.substr(0, res.data.name.length - 4));
 				console.log(this.nameutaiL)
 				this.form.suspendUrl = this.configther
@@ -1341,7 +1396,7 @@ export default {
 				this.configfor.filter( router=> {
 					router.name = '其他附件'
 				})
-				console.log(this.configfor); 
+				console.log(this.configfor);
 				console.log(res.data.name.substr(0, res.data.name.length - 4));
 				console.log(this.nameutaiL)
 				this.form.otherUrl = this.configfor
@@ -1444,9 +1499,9 @@ export default {
 		handleAdd() {
 			this.reset();
 			this.open = true;
-			(this.naneme = false), 
+			(this.naneme = false),
 			(this.shouwes = false);
-			// this.selected = ['安徽省', '安庆市', '潜山市'], 
+			// this.selected = ['安徽省', '安庆市', '潜山市'],
 			this.form.province = this.selected[0];
 			this.villageTownshy = '';
 			this.naiseurya = '';
@@ -1493,7 +1548,7 @@ export default {
 				}
 				if (this.form.vaccineInfoUserList !== null) {
 					if (this.form.vaccineInfoUserList.length == 0) {
-						
+
 						this.form.vaccineInfoUserList = [
 							{
 								vaccineName: '',
@@ -1572,7 +1627,7 @@ export default {
 						// this.form.domicile = this.hsuej + this.form.domicile;
 						// if (this.form.nowIn == 'undefined') {
 						// 	this.form.nowIn = null;
-						// } 
+						// }
 						console.log(this.form)
 						// return
 						addInfo(this.form).then(response => {
@@ -1683,7 +1738,7 @@ export default {
 					// this.getList();
 					this.msgSuccess('删除成功');
 				});
-			
+
 		},
 		delseeug(index,item){
 			console.log(234)
@@ -1750,9 +1805,30 @@ export default {
 					this.jiezheList = response.data
 				}
 			});
-			
+
 			this.jiezhong = true;
-		}
+		},
+    /** 导入按钮操作 */
+    handleImport() {
+      this.upload.title = "用户导入";
+      this.upload.open = true;
+    },
+    // 文件上传中处理
+    handleFileUploadProgress(event, file, fileList) {
+      this.upload.isUploading = true;
+    },
+    // 文件上传成功处理
+    handleFileSuccess(response, file, fileList) {
+      this.upload.open = false;
+      this.upload.isUploading = false;
+      this.$refs.upload.clearFiles();
+      this.$alert(response.msg, "导入结果", { dangerouslyUseHTMLString: true });
+      this.getList();
+    },
+    // 提交上传文件
+    submitFileForm() {
+      this.$refs.upload.submit();
+    }
 	}
 };
 </script>
@@ -1782,7 +1858,7 @@ export default {
 		}
 		.el-form-item__content {
 			margin-left: 80px !important;
-			
+
 			// width: 70%;
 		}
 		.el-input__inner{