index.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471
  1. <template>
  2. <div class="app-container">
  3. <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
  4. <el-form-item label="姓名" prop="name">
  5. <el-input
  6. v-model="queryParams.name"
  7. placeholder="请输入姓名"
  8. clearable
  9. @keyup.enter.native="handleQuery"
  10. />
  11. </el-form-item>
  12. <el-form-item label="身份证号" prop="idCard">
  13. <el-input
  14. v-model="queryParams.idCard"
  15. placeholder="请输入身份证号码"
  16. clearable
  17. @keyup.enter.native="handleQuery"
  18. />
  19. </el-form-item>
  20. <el-form-item label="联系号码" prop="phoneNum">
  21. <el-input
  22. v-model="queryParams.phoneNum"
  23. placeholder="请输入联系号码"
  24. clearable
  25. @keyup.enter.native="handleQuery"
  26. />
  27. </el-form-item>
  28. <el-form-item class="nkseydf">
  29. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  30. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  31. </el-form-item>
  32. </el-form>
  33. <el-row :gutter="10" class="mb8">
  34. <el-col :span="1.5">
  35. <el-button
  36. type="primary"
  37. plain
  38. icon="el-icon-plus"
  39. size="mini"
  40. @click="handleAdd"
  41. v-hasPermi="['keyPeople:info:add']"
  42. >新增</el-button>
  43. </el-col>
  44. <el-col :span="1.5">
  45. <el-button
  46. type="success"
  47. plain
  48. icon="el-icon-edit"
  49. size="mini"
  50. :disabled="single"
  51. @click="handleUpdate"
  52. v-hasPermi="['keyPeople:info:edit']"
  53. >修改</el-button>
  54. </el-col>
  55. <el-col :span="1.5">
  56. <el-button
  57. type="danger"
  58. plain
  59. icon="el-icon-delete"
  60. size="mini"
  61. :disabled="multiple"
  62. @click="handleDelete"
  63. v-hasPermi="['keyPeople:info:remove']"
  64. >删除</el-button>
  65. </el-col>
  66. <el-col :span="1.5">
  67. <el-button
  68. type="warning"
  69. plain
  70. icon="el-icon-download"
  71. size="mini"
  72. @click="handleExport"
  73. v-hasPermi="['keyPeople:info:export']"
  74. >导出</el-button>
  75. </el-col>
  76. <el-col :span="1.5">
  77. <el-button
  78. type="info"
  79. plain
  80. icon="el-icon-upload2"
  81. size="mini"
  82. @click="handleImport"
  83. v-hasPermi="['keyPeople:info:import']"
  84. >导入</el-button>
  85. </el-col>
  86. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  87. </el-row>
  88. <el-table v-loading="loading" :data="infoList" @selection-change="handleSelectionChange" :height="tableMaxHeight">
  89. <el-table-column type="selection" width="55" align="center" />
  90. <el-table-column label="姓名" align="center" prop="name" />
  91. <el-table-column label="身份证号码" align="center" prop="idCard" />
  92. <el-table-column label="联系号码" align="center" prop="phoneNum" />
  93. <el-table-column label="备注" align="center" prop="remark" />
  94. <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
  95. <template slot-scope="scope">
  96. <el-button
  97. size="mini"
  98. type="text"
  99. icon="el-icon-edit"
  100. @click="handleUpdate(scope.row)"
  101. v-hasPermi="['system:info:edit']"
  102. >修改</el-button>
  103. <el-button
  104. size="mini"
  105. type="text"
  106. icon="el-icon-delete"
  107. @click="handleDelete(scope.row)"
  108. v-hasPermi="['system:info:remove']"
  109. >删除</el-button>
  110. </template>
  111. </el-table-column>
  112. </el-table>
  113. <pagination
  114. v-show="total>0"
  115. :total="total"
  116. :page.sync="queryParams.pageNum"
  117. :limit.sync="queryParams.pageSize"
  118. @pagination="getList"
  119. />
  120. <!-- 添加或修改重点人群信息对话框 -->
  121. <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
  122. <el-form ref="form" :model="form" :rules="rules" label-width="80px">
  123. <el-form-item label="姓名" prop="name">
  124. <el-input v-model="form.name" placeholder="请输入姓名" />
  125. </el-form-item>
  126. <el-form-item label="身份证号" prop="idCard">
  127. <el-input v-model="form.idCard" placeholder="请输入身份证号码" />
  128. </el-form-item>
  129. <el-form-item label="联系号码" prop="phoneNum">
  130. <el-input v-model="form.phoneNum" placeholder="请输入联系号码" />
  131. </el-form-item>
  132. <el-form-item label="备注" prop="remark">
  133. <el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
  134. </el-form-item>
  135. </el-form>
  136. <div slot="footer" class="dialog-footer">
  137. <el-button type="primary" @click="submitForm">确 定</el-button>
  138. <el-button @click="cancel">取 消</el-button>
  139. </div>
  140. </el-dialog>
  141. <!-- 用户导入对话框 -->
  142. <el-dialog :title="upload.title" :visible.sync="upload.open" width="600px" append-to-body>
  143. <el-upload
  144. ref="upload"
  145. :limit="1"
  146. accept=".xlsx, .xls"
  147. :headers="upload.headers"
  148. :action="upload.url"
  149. :disabled="upload.isUploading"
  150. :on-progress="handleFileUploadProgress"
  151. :on-success="handleFileSuccess"
  152. :auto-upload="false"
  153. :data="{focusCrowdStyle:upload.focusCrowdStyle,jobStyle:upload.jobStyle,startTime:upload.startTime,endTime:upload.endTime,detectionNumber:upload.detectionNumber,detectionScope:upload.detectionScope}"
  154. drag
  155. class="nhkiu"
  156. >
  157. <i class="el-icon-upload"></i>
  158. <div class="el-upload__text">将文件拖到此处,或<em style="color: #00b385;">点击上传</em></div>
  159. <div class="el-upload__tip text-center" slot="tip">
  160. <div class="el-upload__tip" slot="tip">
  161. <!-- <el-checkbox v-model="upload.updateSupport" /> 是否更新已经存在的用户数据 -->
  162. </div>
  163. <span>仅允许导入xls、xlsx格式文件。</span>
  164. <el-link type="primary" :underline="false" style="font-size:12px;vertical-align: baseline; color: #00b385;" @click="importTemplate">下载模板</el-link>
  165. <div v-if="nlsmeh" style="font-size:16px;vertical-align: baseline; color: red;margin-top: 10px;">正在导入中,请稍后,请勿进行操作......</div>
  166. </div>
  167. </el-upload>
  168. <div slot="footer" class="dialog-footer">
  169. <el-button type="primary" @click="submitFileForm">确 定</el-button>
  170. <el-button @click="nlmse">取 消</el-button>
  171. </div>
  172. </el-dialog>
  173. </div>
  174. </template>
  175. <script>
  176. import { listInfo, getInfo, delInfo, addInfo, updateInfo } from "@/api/system/ryxx";
  177. import { getToken } from "@/utils/auth";
  178. export default {
  179. name: "Info",
  180. dicts: ['occupational_category', 'classification_population','whether_abnormal'],
  181. data() {
  182. return {
  183. // 遮罩层
  184. loading: true,
  185. // 选中数组
  186. ids: [],
  187. // 非单个禁用
  188. single: true,
  189. // 非多个禁用
  190. multiple: true,
  191. // 显示搜索条件
  192. showSearch: true,
  193. // 总条数
  194. total: 0,
  195. // 重点人群信息表格数据
  196. infoList: [],
  197. // 弹出层标题
  198. title: "",
  199. // 是否显示弹出层
  200. open: false,
  201. // 查询参数
  202. queryParams: {
  203. pageNum: 1,
  204. pageSize: 10,
  205. name: null,
  206. idCard: null,
  207. phoneNum: null,
  208. },
  209. // 表单参数
  210. form: {},
  211. tableMaxHeight:300,
  212. // 表单校验
  213. rules: {
  214. name: [
  215. { required: true, message: "姓名不能为空", trigger: "blur" }
  216. ],
  217. idCard:[
  218. { pattern: /^([1-6][1-9]|50)\d{4}(18|19|20)\d{2}((0[1-9])|10|11|12)(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/,
  219. message: "请输入正确的身份证号",
  220. trigger: "blur" }
  221. ],
  222. phoneNum:[
  223. {pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/,
  224. message: "请输入正确的手机号码",
  225. trigger: "blur"}
  226. ],
  227. },
  228. // 用户导入参数
  229. upload: {
  230. // 是否显示弹出层(用户导入)
  231. open: false,
  232. // 弹出层标题(用户导入)
  233. title: "",
  234. // 是否禁用上传
  235. isUploading: false,
  236. // 是否更新已经存在的用户数据
  237. detectionNumber:null,
  238. detectionScope:null,
  239. startTime: null,
  240. endTime: null,
  241. jobStyle:null,
  242. focusCrowdStyle:null,
  243. updateSupport: 0,
  244. // 设置上传的请求头部
  245. headers: { Authorization: "Bearer " + getToken() },
  246. // 上传的地址
  247. url: process.env.VUE_APP_BASE_API + "/keyPeople/info//importData"
  248. },
  249. nlsmeh:false
  250. };
  251. },
  252. created() {
  253. this.getList();
  254. window.onresize = () => {
  255. this.changeTableMaxHeight()
  256. }
  257. this.changeTableMaxHeight()
  258. },
  259. mounted() {
  260. window.onresize = () => {
  261. this.changeTableMaxHeight()
  262. }
  263. this.changeTableMaxHeight()
  264. },
  265. methods: {
  266. /** 查询重点人群信息列表 */
  267. getList() {
  268. this.loading = true;
  269. listInfo(this.queryParams).then(response => {
  270. this.infoList = response.rows;
  271. this.total = response.total;
  272. this.loading = false;
  273. });
  274. },
  275. // 取消按钮
  276. cancel() {
  277. this.open = false;
  278. this.reset();
  279. },
  280. // 表单重置
  281. reset() {
  282. this.form = {
  283. id: null,
  284. name: null,
  285. idCard: null,
  286. phoneNum: null,
  287. deptId: null,
  288. createBy: null,
  289. createTime: null,
  290. updateBy: null,
  291. updateTime: null,
  292. remark: null
  293. };
  294. this.resetForm("form");
  295. },
  296. /** 搜索按钮操作 */
  297. handleQuery() {
  298. this.queryParams.pageNum = 1;
  299. this.getList();
  300. },
  301. /** 重置按钮操作 */
  302. resetQuery() {
  303. this.resetForm("queryForm");
  304. this.handleQuery();
  305. },
  306. // 多选框选中数据
  307. handleSelectionChange(selection) {
  308. this.ids = selection.map(item => item.id)
  309. this.single = selection.length!==1
  310. this.multiple = !selection.length
  311. },
  312. /** 新增按钮操作 */
  313. handleAdd() {
  314. this.reset();
  315. this.open = true;
  316. this.title = "添加重点人群信息";
  317. },
  318. /** 修改按钮操作 */
  319. handleUpdate(row) {
  320. this.reset();
  321. const id = row.id || this.ids
  322. getInfo(id).then(response => {
  323. this.form = response.data;
  324. this.open = true;
  325. this.title = "修改重点人群信息";
  326. });
  327. },
  328. /** 提交按钮 */
  329. submitForm() {
  330. this.$refs["form"].validate(valid => {
  331. if (valid) {
  332. if (this.form.id != null) {
  333. updateInfo(this.form).then(response => {
  334. this.$modal.msgSuccess("修改成功");
  335. this.open = false;
  336. this.getList();
  337. });
  338. } else {
  339. addInfo(this.form).then(response => {
  340. this.$modal.msgSuccess("新增成功");
  341. this.open = false;
  342. this.getList();
  343. });
  344. }
  345. }
  346. });
  347. },
  348. /** 删除按钮操作 */
  349. handleDelete(row) {
  350. const ids = row.id || this.ids;
  351. this.$modal.confirm('是否确认删除信息?').then(function() {
  352. return delInfo(ids);
  353. }).then(() => {
  354. this.getList();
  355. this.$modal.msgSuccess("删除成功");
  356. }).catch(() => {});
  357. },
  358. /** 导出按钮操作 */
  359. handleExport() {
  360. this.download('system/info/export', {
  361. ...this.queryParams
  362. }, `info_${new Date().getTime()}.xlsx`)
  363. },
  364. /** 导入按钮操作 */
  365. handleImport() {
  366. this.upload.title = "导入信息";
  367. this.upload.open = true;
  368. },
  369. /** 下载模板操作 */
  370. importTemplate() {
  371. window.open("https://yqfk.qs163.cn/muban/muban.xlsx")
  372. },
  373. // 文件上传中处理
  374. handleFileUploadProgress(event, file, fileList) {
  375. this.upload.isUploading = true;
  376. this.nlsmeh = true
  377. },
  378. // 文件上传成功处理
  379. handleFileSuccess(response, file, fileList) {
  380. // if(response.code == 200){
  381. this.nlsmeh = false
  382. this.upload.open = false;
  383. this.upload.isUploading = false;
  384. this.$refs.upload.clearFiles();
  385. this.upload.detectionNumber = null
  386. this.upload.startTime=null
  387. this.upload.endTime= null
  388. this.upload.jobStyle= null
  389. this.upload.focusCrowdStyle= null
  390. // }
  391. this.$alert("<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" + response.msg + "</div>", "导入结果", { dangerouslyUseHTMLString: true });
  392. this.getList();
  393. },
  394. // 提交上传文件
  395. submitFileForm() {
  396. this.$refs["form"].validate(valid => {
  397. if (valid) {
  398. this.$refs.upload.submit();
  399. }
  400. });
  401. },
  402. // 次数失去焦点事件
  403. nhkse(value){
  404. console.log(this.upload.detectionNumber)
  405. if(this.upload.detectionNumber < 0){
  406. this.upload.detectionNumber = 0
  407. }
  408. },
  409. // 天数失去焦点事件
  410. nhksets(){
  411. if(this.upload.detectionScope < 0){
  412. this.upload.detectionScope = 0
  413. }
  414. },
  415. // 取消
  416. nlmse(){
  417. this.upload.open = false
  418. this.upload.detectionNumber = null
  419. this.upload.startTime=null
  420. this.upload.endTime= null
  421. this.upload.jobStyle= null
  422. this.upload.focusCrowdStyle= null
  423. },
  424. // 获取屏幕高度
  425. showFilterForm () {
  426. this.filterActive = !this.filterActive
  427. this.changeTableMaxHeight()
  428. },
  429. changeTableMaxHeight () {
  430. let height = document.body.offsetHeight // 网页可视区域高度
  431. // if (this.filterActive) {
  432. // this.tableMaxHeight = height - 320
  433. // } else {
  434. this.tableMaxHeight = height - 280
  435. // }
  436. console.log(height)
  437. },
  438. }
  439. };
  440. </script>
  441. <style type="text/css" lang="scss">
  442. .nhkiu{
  443. .el-upload-dragger{
  444. width: 560px !important;
  445. margin-bottom: 20px;
  446. }
  447. }
  448. .nkseydf{
  449. .el-button--primary{
  450. background-color: #00b385 !important;
  451. border-color: #00b385 !important;
  452. }
  453. }
  454. .lndw{
  455. color: red;
  456. }
  457. .heade_codfr{
  458. color: #00b385;
  459. }
  460. </style>