Browse Source

增加手机新增页面

feature/codeMove
ZhaoTongYao 4 years ago
parent
commit
84482281dc
  1. 4
      public/index.html
  2. 386
      src/views/modules/epidemic/persontesting-add-or-update-mobile.vue
  3. 20
      src/views/modules/epidemic/persontesting.vue

4
public/index.html

@ -35,8 +35,8 @@
<!-- 开发环境 --> <!-- 开发环境 -->
<% if (process.env.VUE_APP_NODE_ENV === 'dev') { %> <% if (process.env.VUE_APP_NODE_ENV === 'dev') { %>
<script> <script>
window.SITE_CONFIG['apiURL'] = 'http://127.0.0.1:9094/epdc-api' // window.SITE_CONFIG['apiURL'] = 'http://127.0.0.1:9094/epdc-api'
// window.SITE_CONFIG['apiURL'] = 'https://epdc-yushan.elinkservice.cn/epdc-api' window.SITE_CONFIG['apiURL'] = 'https://epdc-api-test.elinkservice.cn/epdc-api'
window.SITE_CONFIG['workLogURL'] = 'https://epmet-ext1.pingyin.gov.cn/plugin-wrf' //工作日志引用外链地址 window.SITE_CONFIG['workLogURL'] = 'https://epmet-ext1.pingyin.gov.cn/plugin-wrf' //工作日志引用外链地址
</script> </script>
<% } %> <% } %>

386
src/views/modules/epidemic/persontesting-add-or-update-mobile.vue

@ -0,0 +1,386 @@
<template>
<el-dialog :visible.sync="visible" :title="!dataForm.id ? $t('add') : $t('update')" :close-on-click-modal="false"
:close-on-press-escape="false" custom-class="mobile">
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmitHandle()"
:label-width="$i18n.locale === 'en-US' ? '120px' : '80px'">
<el-form-item label="身份证号码" prop="idcard" label-width="120px">
<el-input v-model="dataForm.idcard" placeholder="身份证号码" @blur="getSexAndBirthDay" style="width:250px"></el-input>
</el-form-item>
<el-form-item label="姓名" prop="name" label-width="120px">
<el-input v-model="dataForm.name" placeholder="姓名" style="width:250px"></el-input>
</el-form-item>
<el-form-item label="手机号码" prop="mobile" label-width="120px">
<el-input v-model="dataForm.mobile" placeholder="手机号码" style="width:250px"></el-input>
</el-form-item>
<!-- <el-form-item label="签发机关" prop="organ" label-width="120px">
<el-input v-model="dataForm.organ" placeholder="签发机关" style="width:250px"></el-input>
</el-form-item>
<el-form-item label="性别" prop="sex" label-width="120px">
<el-radio-group v-model="dataForm.sex" disabled>
<el-radio label="女"></el-radio>
<el-radio label="男"></el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="出生日期" prop="birthday" label-width="120px">
<el-date-picker disabled
v-model="dataForm.birthday"
type="date"
placeholder="出生日期"
value-format="yyyy-MM-dd"
format="yyyy-MM-dd"
style="width:250px">
</el-date-picker>
</el-form-item> -->
<!-- <el-form-item label="检测时间" prop="testingTime" label-width="120px">
<el-date-picker
v-model="dataForm.testingTime"
type="datetime"
placeholder="核酸检测时间"
value-format="yyyy-MM-dd HH:mm:ss"
format="yyyy-MM-dd HH:mm:ss"
style="width:250px">
</el-date-picker>
</el-form-item> -->
<!--
<el-form-item label="照片"
v-loading="loading"
prop="imgUrl"
label-width="120px">
<el-upload class="avatar-uploader"
:action="uploadUrl"
:show-file-list="false"
:on-success="handleAvatarSuccess"
:before-upload="beforeAvatarUpload">
<img v-if="dataForm.imgUrl"
:src="dataForm.imgUrl"
class="avatar">
<i v-else
class="el-icon-plus avatar-uploader-icon"></i>
<div slot="tip"
class="el-upload__tip">只能上传jpg/png文件且不超过500kb
</div>
</el-upload>
</el-form-item>
<el-form-item label="住址" prop="address" label-width="120px">
<el-input v-model="dataForm.address" placeholder="住址"></el-input>
</el-form-item>
<el-form-item label="核酸检测点" label-width="120px">
<el-select v-model="dataForm.testingPointId" placeholder="请选择..." clearable style="width: 100%;">
<el-option v-for="item in optionTestingPoint"
:key="item.tagValue"
:label="item.tagName"
:value="item.tagValue">
</el-option>
</el-select>
</el-form-item> -->
</el-form>
<template slot="footer">
<el-button @click="visible = false">{{ $t('cancel') }}</el-button>
<el-button type="primary" @click="dataFormSubmitHandle()">{{ $t('confirm') }}</el-button>
</template>
</el-dialog>
</template>
<script>
import Cookies from 'js-cookie'
import debounce from 'lodash/debounce'
export default {
data() {
return {
visible: false,
dataForm: {
id: '',
name: '',
sex: '',
nation: '',
birthday: '',
address: '',
idcard: '',
organ: '',
imgCode: '',
imgUrl: '',
testingResult: '',
testingTime: '',
revision: '',
createdBy: '',
createdTime: '',
updatedBy: '',
updatedTime: '',
delFlag: '',
mobile:'',
testingPointId:''
},
uploadUrl: '',
loading: false,
optionTestingPoint: []
}
},
computed: {
dataRule() {
return {
name: [
{required: true, message: this.$t('validate.required'), trigger: 'blur'}
],
// sex: [
// {required: true, message: this.$t('validate.required'), trigger: 'blur'}
// ],
// nation: [
// { required: true, message: this.$t('validate.required'), trigger: 'blur' }
// ],
// birthday: [
// { required: true, message: this.$t('validate.required'), trigger: 'blur' }
// ],
// address: [
// { required: true, message: this.$t('validate.required'), trigger: 'blur' }
// ],
idcard: [
{required: true, message: this.$t('validate.required'), trigger: 'blur'},
{ pattern: /(^\d{15}$)|bai(^\d{18}$)|(^\d{17}(\d|X|x)$)/, message: '请输入正确身份证号', trigger: 'blur' }
],
// organ: [
// { required: true, message: this.$t('validate.required'), trigger: 'blur' }
// ],
// imgCode: [
// { required: true, message: this.$t('validate.required'), trigger: 'blur' }
// ],
// imgUrl: [
// { required: true, message: this.$t('validate.required'), trigger: 'blur' }
// ],
// testingResult: [
// { required: true, message: this.$t('validate.required'), trigger: 'blur' }
// ],
// testingTime: [
// {required: true, message: this.$t('validate.required'), trigger: 'blur'}
// ],
// revision: [
// { required: true, message: this.$t('validate.required'), trigger: 'blur' }
// ],
// createdBy: [
// { required: true, message: this.$t('validate.required'), trigger: 'blur' }
// ],
// createdTime: [
// { required: true, message: this.$t('validate.required'), trigger: 'blur' }
// ],
// updatedBy: [
// { required: true, message: this.$t('validate.required'), trigger: 'blur' }
// ],
// updatedTime: [
// { required: true, message: this.$t('validate.required'), trigger: 'blur' }
// ],
// delFlag: [
// { required: true, message: this.$t('validate.required'), trigger: 'blur' }
// ]
}
}
},
created() {
console.log('add')
// this.visible = true
this.$nextTick(() => {
// this.dataForm.communityId = this.dataForm.streetId = this.dataForm.gridId = null
//
// this.hideUpload = false
this.uploadUrl = `${window.SITE_CONFIG['apiURL']}/oss/file/upload?token=${Cookies.get('token')}`
})
// var oMeta = document.createElement('meta')
// oMeta.content = 'width=device-width, initial-scale=1.0, maximum-scale=1.0,minimum-scale=1.0, user-scalable=0'
// oMeta.name = 'viewport'
// document.getElementsByTagName('head')[0].appendChild(oMeta)
},
methods: {
init() {
this.visible = true
this.dataForm.testingPointId = ''
this.getListSimpleByDictType()
this.$nextTick(() => {
this.$refs['dataForm'].resetFields()
// this.$set(this.dataForm,'testingTime', new Date())
this.dataForm.testingTime = new Date()
if (this.dataForm.id) {
this.getInfo()
}
})
},
//
handleAvatarSuccess(res, file) {
this.loading = false
this.dataForm.imgUrl = res.data.url
},
beforeAvatarUpload(file) {
this.loading = true
},
getSexAndBirthDay () {
//
// this.$http.get(`/custom/populationinformation/isIdentifyNoLegal/${this.dataForm.idcard}`).then(({ data: res }) => {
// if (res.code !== 0) {
// this.dataForm.idcard = ''
// return this.$message.error(res.msg)
// }
// let identifyNo = this.dataForm.idcard
// this.dataForm.sex = this.IdCard(identifyNo, 2)
// this.dataForm.birthday = this.IdCard(identifyNo, 1)
// }).catch(() => { })
this.$http.get(`/custom/persontesting/v2/getNameByIDcard/${this.dataForm.idcard}`).then(({ data: res }) => {
if (res.code !== 0) {
this.dataForm.idcard = ''
return this.$message.error(res.msg)
}
this.dataForm.name = res.data.userName
this.dataForm.mobile = res.data.mobile
}).catch(() => { })
},
IdCard (UUserCard, num) {
if (num === 1) {
//
return UUserCard.substring(6, 10) + '-' + UUserCard.substring(10, 12) + '-' + UUserCard.substring(12, 14)
}
if (num === 2) {
//
if (parseInt(UUserCard.substr(16, 1)) % 2 === 1) {
//
return '男'
} else {
//
return '女'
}
}
},
getListSimpleByDictType () {
this.$http.get(`/custom/testingpoint/testingPointSelection`).then(({ data: res }) => {
if (res.code !== 0) {
return this.$message.error(res.msg)
}
this.optionTestingPoint = res.data
}).catch(() => {})
},
//
getInfo() {
this.$http.get(`/custom/persontesting/${this.dataForm.id}`).then(({data: res}) => {
if (res.code !== 0) {
return this.$message.error(res.msg)
}
this.dataForm = {
...this.dataForm,
...res.data
}
}).catch(() => {
})
},
//
dataFormSubmitHandle: debounce(function () {
this.$refs['dataForm'].validate((valid) => {
if (!valid) {
return false
}
this.dataForm.testingTime = new Date()
this.$http[!this.dataForm.id ? 'post' : 'put']('/custom/persontesting/v2/', this.dataForm).then(({data: res}) => {
if (res.code !== 0) {
return this.$message.error(res.msg)
}
this.$message({
message: this.$t('prompt.success'),
type: 'success',
duration: 1000,
onClose: () => {
// this.visible = false
this.$emit('refreshDataList')
this.$refs['dataForm'].resetFields()
}
})
}).catch(() => {
})
})
}, 1000, {'leading': true, 'trailing': false})
}
}
</script>
<style>
.avatar-uploader .el-upload {
border: 1px dashed #d9d9d9;
border-radius: 6px;
cursor: pointer;
position: relative;
overflow: hidden;
}
.avatar-uploader .el-upload:hover {
border-color: #409eff;
}
.avatar-uploader-icon {
font-size: 28px;
color: #8c939d;
width: 178px;
height: 178px;
line-height: 178px;
text-align: center;
}
.avatar {
width: 178px;
height: 178px;
display: block;
}
.mobile {
margin: 0 !important;
width: 100vw;
height: 100vh;
position: fixed;
left: 0;
top: 0;
}
.mobile .el-form .el-form-item__label {
font-size: 40px;
width: 24vw !important;
}
.mobile .el-form .el-form-item__content {
margin-left: 20px !important;
}
.mobile .el-form .el-form-item {
display: flex;
align-items: center;
margin-bottom: 50px !important;
}
.mobile .el-form .el-input {
font-size: 40px;
width: 70vw !important;
height: 80px;
}
.mobile .el-form .el-input input{
font-size: 40px;
height: 80px;
line-height: 80px;
padding-left: 50px;
}
.mobile .el-form .el-form-item__error {
font-size: 30px;
}
.mobile .el-form .el-input__prefix {
top: 25%;
}
.mobile .el-form .el-input__suffix {
top: 25%;
right: 10px;
}
.mobile .el-button {
width: 300px !important;
height: 100px !important;
font-size: 40px !important;
}
.el-message {
width: 80vw !important;
height: 80px !important;;
}
.el-message .el-message__content {
font-size: 40px !important
}
.el-message .el-message__icon {
font-size: 40px !important
}
.mobile .el-dialog__body {
margin-top: 10vh;
}
</style>

20
src/views/modules/epidemic/persontesting.vue

@ -86,6 +86,10 @@
type="danger" type="danger"
@click="deleteHandle()">{{ $t('deleteBatch') }}</el-button> @click="deleteHandle()">{{ $t('deleteBatch') }}</el-button>
</el-form-item> </el-form-item>
<el-form-item>
<el-button type="primary"
@click="addOrUpdateHandleMobile()">手机版新增</el-button>
</el-form-item>
</el-form> </el-form>
<el-table v-loading="dataListLoading" <el-table v-loading="dataListLoading"
:data="dataList" :data="dataList"
@ -165,6 +169,9 @@
@refreshDataList="getDataList"></person-look> @refreshDataList="getDataList"></person-look>
<reader ref="reader" <reader ref="reader"
@refreshDataList="getDataList"></reader> @refreshDataList="getDataList"></reader>
<add-or-update-mobile v-if="addOrUpdateMobileVisible"
ref="addOrUpdateMobile"
@refreshDataList="getDataList"></add-or-update-mobile>
<!-- 错误信息 --> <!-- 错误信息 -->
<el-dialog :visible.sync="faultDataVisible" <el-dialog :visible.sync="faultDataVisible"
title="请修改后重新提交"> title="请修改后重新提交">
@ -195,6 +202,7 @@ import AddOrUpdate from './persontesting-add-or-update'
import PersonLook from './persontesting-look' import PersonLook from './persontesting-look'
import reader from './reader' import reader from './reader'
import Cookies from 'js-cookie' import Cookies from 'js-cookie'
import AddOrUpdateMobile from './persontesting-add-or-update-mobile'
export default { export default {
mixins: [mixinViewModule], mixins: [mixinViewModule],
data () { data () {
@ -218,13 +226,15 @@ export default {
faultDataVisible: false, faultDataVisible: false,
errordataList: [], errordataList: [],
deptIdList: [], deptIdList: [],
lookVisible: false lookVisible: false,
addOrUpdateMobileVisible: false
} }
}, },
components: { components: {
AddOrUpdate, AddOrUpdate,
PersonLook, PersonLook,
reader reader,
AddOrUpdateMobile
}, },
created: function () { created: function () {
this.getOptions() this.getOptions()
@ -255,6 +265,12 @@ export default {
} }
}, },
methods: { methods: {
addOrUpdateHandleMobile () {
this.addOrUpdateMobileVisible = true
this.$nextTick(() => {
this.$refs.addOrUpdateMobile.init()
})
},
lookDetail (id) { lookDetail (id) {
this.lookVisible = true this.lookVisible = true
this.$nextTick(() => { this.$nextTick(() => {

Loading…
Cancel
Save