Browse Source

Merge branch 'master' into shibei_master

shibei_master
dai 3 years ago
parent
commit
16529a2a9b
  1. 11
      src/views/modules/base/epidemic/vaccin.vue
  2. 549
      src/views/modules/base/epidemic/vaccinForm.vue

11
src/views/modules/base/epidemic/vaccin.vue

@ -234,9 +234,9 @@
top="5vh" top="5vh"
class="dialog-h" class="dialog-h"
@closed="diaClose"> @closed="diaClose">
<nat-form ref="ref_form" <vaccinForm ref="ref_form"
@dialogCancle="diaClose" @dialogCancle="diaClose"
@dialogOk="addFormOk"></nat-form> @dialogOk="addFormOk"></vaccinForm>
</el-dialog> </el-dialog>
</div> </div>
@ -244,6 +244,7 @@
<script> <script>
import vaccinForm from './vaccinForm'
import natForm from './natInfo/natForm' import natForm from './natInfo/natForm'
import { requestPost } from "@/js/dai/request"; import { requestPost } from "@/js/dai/request";
@ -304,6 +305,7 @@ export default {
} }
}, },
components: { components: {
vaccinForm,
natForm natForm
}, },
async created () { async created () {
@ -395,7 +397,7 @@ export default {
this.formTitle = '详情' this.formTitle = '详情'
this.formShow = true this.formShow = true
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.ref_form.initForm('detail', row.icNatId) this.$refs.ref_form.initForm('detail', row)
}) })
}, },
@ -572,7 +574,8 @@ export default {
await this.$http({ await this.$http({
method: 'POST', method: 'POST',
url, url,
responseType: 'blob' responseType: 'blob',
data: this.formData
}) })
.then(res => { .then(res => {
console.log('res----dddd', res) console.log('res----dddd', res)

549
src/views/modules/base/epidemic/vaccinForm.vue

@ -0,0 +1,549 @@
<template>
<div class="epidemic-form">
<div class="dialog-h-content scroll-h">
<el-form ref="ref_form"
:inline="true"
:model="formData"
:rules="dataRule"
:disabled="formType==='detail'"
class="form">
<el-form-item label="姓名"
prop="name"
label-width="150px"
style="display: block">
<el-input class="item_width_2"
placeholder="请输入姓名"
clearable
:disabled="isFromResi"
v-model="formData.name">
</el-input>
</el-form-item>
<el-form-item label="手机号"
prop="mobile"
label-width="150px"
style="display: block">
<el-input class="item_width_2"
placeholder="请输入手机号"
clearable
:disabled="isFromResi"
v-model="formData.mobile">
</el-input>
</el-form-item>
<el-form-item label="身份证号"
prop="idCard"
label-width="150px"
style="display: block">
<el-input class="item_width_2"
placeholder="请输入身份证号"
clearable
:disabled="isFromResi"
v-model="formData.idCard">
</el-input>
</el-form-item>
<el-form-item label="接种时间"
style="display: block"
prop="inoculateTime"
label-width="150px">
<el-date-picker class="item_width_2"
v-model="formData.inoculateTime"
format="yyyy-MM-dd HH:mm"
value-format="yyyy-MM-dd HH:mm"
type="datetime"
:picker-options="pickerOptions"
clearable
placeholder="选择时间">
</el-date-picker>
</el-form-item>
<el-form-item label="接种地点"
prop="inoculateAddress"
label-width="150px"
style="display: block">
<el-input class="item_width_1"
placeholder="请输入检测地点"
clearable
v-model="formData.inoculateAddress">
</el-input>
</el-form-item>
<el-form-item label="疫苗厂家"
prop="manufacturer"
label-width="150px"
style="display: block">
<el-input class="item_width_1"
placeholder="请输入检测地点"
clearable
v-model="formData.manufacturer" />
</el-form-item>
</el-form>
</div>
<div class="form_div_btn">
<el-button size="small"
@click="handleCancle"> </el-button>
<el-button v-if="formType != 'detail'"
size="small"
type="primary"
:disabled="btnDisable"
@click="handleComfirm"> </el-button>
</div>
</div>
</template>
<script>
import { Loading } from 'element-ui' // Loading
import { requestPost } from '@/js/dai/request'
let loading //
export default {
data () {
return {
formType: 'add', // addeditdetail
hideUploadEdit: false, // ''
limitNum: 1,
enterType: '1',//1 2
isFromResi: false,//
gridList: [],
personList: [],
pickerOptions: { //
disabledDate (time) {
return time.getTime() > (Date.now())
}
},
btnDisable: false,
icNatId: '',
formData: {
agencyId: '',//Id
userId: '',//idicResiUserId
userType: 'icresi',//resi;icresi;import;synchro
name: '',
idCard: '',
mobile: '',
inoculateTime: '',
inoculateAddress: '',
manufacturer: ''
},
fileList: [],
uploadUlr: window.SITE_CONFIG['apiURL'] + '/oss/file/uploadvariedfile',
dialogImageUrl: '',
dialogVisible: false,
imgLoading: false,
}
},
components: {},
async mounted () {
const { user } = this.$store.state
this.agencyId = user.agencyId
//
// await this.loadGrid()
},
methods: {
handleChannelChange (val) {
this.formData.content = ''
},
async initForm (type, row) {
// this.startLoading()
this.formData.agencyId = this.agencyId
// this.$refs['ref_form'].resetFields();
this.isFromResi = false
this.enterType = '1'
this.formType = type
this.formData = { ...row }
// this.endLoading()
console.log('formData----', this.formData)
},
handleChangeEnterType (value) {
this.formData.name = ''
this.formData.mobile = ''
this.formData.idCard = ''
this.formData.gridId = ''
this.formData.userId = ''
this.$refs['ref_form'].resetFields();
if (value === '2') {
this.isFromResi = true
} else {
this.isFromResi = false
}
},
async loadGrid () {
const url = "/gov/org/customergrid/gridoption"
let params = {
agencyId: this.agencyId
}
const { data, code, msg } = await requestPost(url, params)
if (code === 0) {
this.gridList = data
} else {
this.$message.error(msg)
}
},
async handleSelGrid (value) {
const url = "/epmetuser/icresiuser/demandusers"
let params = {
agencyId: this.agencyId,
gridId: value
}
const { data, code, msg } = await requestPost(url, params)
if (code === 0) {
this.personList = data
} else {
this.$message.error(msg)
}
},
async handleSelPerson (personItem) {
this.formData.userId = personItem.demandUserId
this.formData.name = personItem.demandUserName
this.formData.mobile = personItem.demandUserMobile
this.formData.idCard = personItem.idCard
},
async loadFormData () {
// const url = 'http://yapi.elinkservice.cn/mock/245/epmetuser/icNat/detail'
const url = '/epmetuser/icNat/detail'
let params = {
icNatId: this.icNatId,
}
const { data, code, msg } = await requestPost(url, params)
if (code === 0) {
this.formData = data
this.formData.channel = []
this.formData.content = ''
// if (data.channel && data.channel.length > 0) {
// this.$set(this.formData, 'isSelChannel', true)
// // this.formData.isSelChannel = true
// } else {
// this.$set(this.formData, 'isSelChannel', false)
// // this.formData.isSelChannel = false
// this.formData.channel = []
// this.formData.content = ''
// }
console.log(this.formData.isSelChannel)
this.formData.icNatId = this.icNatId
if (this.formData.userId) {
this.isFromResi = true
} else {
this.isFromResi = false
}
this.fileList = []
if (data.fileName) {
let obj = {
name: data.fileName,
type: data.attachmentType,
url: data.attachmentUrl,
}
// data.attachmentList.forEach(element => {
// element.name = element.fileName
// element.type = element.attachmentType
// element.size = element.attachmentSize
// });
this.fileList.push(obj)
}
this.hideUploadEdit = this.fileList.length >= this.limitNum;
} else {
this.$message.error(msg)
}
},
handleComfirm () {
this.$refs['ref_form'].validate((valid, messageObj) => {
if (!valid) {
app.util.validateRule(messageObj)
} else {
this.addNat()
}
})
},
async addNat () {
// if (this.imgLoading) {
// this.$message({
// type: 'warning',
// message: ''
// })
// return false;
// }
const regPhone = /^1(3|4|5|6|7|8|9)\d{9}$/; //
if (regPhone.test(this.formData.mobile) === false) {
this.btnDisable = false
this.$message({
type: 'warning',
message: '请输入正确的手机号码'
})
return false;
}
const regCard = /(^\d{15}$)|(^\d{17}(\d|X)$)/; //1518151817X
if (regCard.test(this.formData.idCard) === false) {
this.btnDisable = false
this.$message({
type: 'warning',
message: '请输入正确的身份证号码'
})
return false;
}
if (this.formData.isSelChannel) {
if (!this.formData.content) {
this.$message({
type: 'warning',
message: '请填写通知内容'
})
return false;
} else {
this.formData.channel = ['0']
}
} else {
this.formData.channel = []
this.formData.content = ''
}
this.btnDisable = true
setTimeout(() => {
this.btnDisable = false
}, 5000)
let url = ''
if (this.formType === 'add') {
url = '/epmetuser/icNat/add'
// url = "http://yapi.elinkservice.cn/mock/102/epmetuser/icNat/add"
this.formData.icNatId = ''
} else {
url = '/epmetuser/icNat/edit'
// url = "http://yapi.elinkservice.cn/mock/245/epmetuser/icNat/edit"
}
const { data, code, msg } = await requestPost(url, this.formData)
if (code === 0) {
this.$message({
type: 'success',
message: '操作成功'
})
this.resetData()
this.$emit('dialogOk')
this.btnDisable = false
} else {
this.btnDisable = false
this.$message.error(msg)
}
},
handleCancle () {
this.resetData()
this.$emit('dialogCancle')
},
handleRemove (file, fileList) {
this.hideUploadEdit = fileList.length >= this.limitNum;
this.formData.fileName = ''
this.formData.attachmentUrl = ''
this.formData.attachmentType = ''
this.fileList = []
},
handlePictureCardPreview (file) {
this.dialogImageUrl = file.url;
this.dialogVisible = true;
},
handleEditChange (file, fileList) {
this.hideUploadEdit = fileList.length >= this.limitNum;
},
beforeUpload (file) {
const array = file.name.split('.')
const extension = array[array.length - 1]
// const isLt1M = (file.size / 1024 / 1024) < 5
if (extension !== 'jpg'
&& extension !== 'png'
&& extension !== 'gif'
) {
this.$message.error('只能上传jpg、png、gif文件!')
return false
} else {
this.btnDisable = true
}
// if (!isLt1M) {
// this.$message.error(' 5MB!')
// }
// return isLt1M
},
handleFileSuccess (res, file) {
if (res.code === 0 && res.msg === 'success') {
const array = file.name.split('.')
const fileType = array[array.length - 1]
this.formData.fileName = file.name
this.formData.attachmentUrl = res.data.url
this.formData.attachmentType = 'image'
file.attachmentFormat = fileType
file.attachmentSize = file.size
} else {
this.$message.error(res.msg)
}
this.btnDisable = false
},
resetData () {
this.icNatId = ''
this.fileList = []
this.hideUploadEdit = false
this.formData = {
icNatId: '',
agencyId: '',//Id
userId: '',//idicResiUserId
userType: 'icresi',//resi;icresi;import;synchro
name: '',
idCard: '',
mobile: '',
natTime: '',
natAddress: '',
natResult: '',
isSelChannel: false,
channel: [],
content: '',
fileName: '',//
attachmentType: '',// - image - video - voice - doc
attachmentUrl: '',//
}
},
//
startLoading () {
loading = Loading.service({
lock: true, //
text: '正在加载……', //
background: 'rgba(0,0,0,.7)' //
})
},
//
endLoading () {
// clearTimeout(timer);
if (loading) {
loading.close()
}
}
},
computed: {
dataRule () {
return {
name: [
{ required: true, message: '姓名不能为空', trigger: 'blur' }
],
idCard: [
{ required: true, message: '身份证号不能为空', trigger: 'blur' }
],
mobile: [
{ required: true, message: '手机号不能为空', trigger: 'blur' },
],
natTime: [
{ required: true, message: '检测时间不能为空', trigger: 'blur' },
],
natAddress: [
{ required: false },
],
natResult: [
{ required: true, message: '检测结果不能为空', trigger: 'blur' },
],
isSelChannel: [
{ required: false },
],
channel: [
{ required: false },
],
content: [
{ required: false },
],
}
},
},
props: {
// serviceList: {
// type: Array,
// default: []
// },
}
}
</script>
<style lang="scss" scoped >
@import "@/assets/scss/modules/management/epidemic.scss";
</style>
<style lang='scss'>
//
.hide .el-upload--picture-card {
display: none;
}
// /
.el-upload-list__item {
transition: none !important;
}
</style>
Loading…
Cancel
Save