123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281 |
- <template>
- <view class="content">
- <view class="inner">
- <view class="form-box">
- <view class="form-item">
- <text class="label">姓名</text>
- <input maxlength="10" class="input-width" type="text" v-model="form.userName" placeholder="请如实填写您的真实姓名" placeholder-class="form-input" />
- </view>
- <view class="form-item">
- <text class="label">性别</text>
- <radio-group style="display: flex;align-items: center;">
- <label style="margin-right: 50upx;">
- <radio @click="sexChange(1)" value="1" :checked="form.sex===1" style="margin-right: 16upx;" />
- <text class="sex-text">男</text>
- </label>
- <label>
- <radio @click="sexChange(2)" value="2" :checked="form.sex===2" style="margin-right: 16upx;" />
- <text class="sex-text">女</text>
- </label>
- </radio-group>
- </view>
- <view class="form-item">
- <text class="label">身份证号</text>
- <input maxlength="18" class="input-width" type="idcard" v-model="form.idCard" placeholder="请如实填写身份证号" placeholder-class="form-input" />
- </view>
- <view class="form-item">
- <text class="label">出生年月</text>
- <picker class="birth-picker" mode="date" @change="bindDateChange">
- <view class="right-box">
- <view class="input-box">
- <input type="text" :value="form.birthday" placeholder="请选择出生年月" placeholder-class="form-input" disabled="disabled" />
- </view>
- <image class="arrow" src="../../static/images/arrow_gray.png" mode=""></image>
- </view>
- </picker>
- </view>
- <view class="form-item">
- <text class="label">备注</text>
- <textarea maxlength="200" class="form-textarea" v-model="form.remark" placeholder="请输入备注" />
- </view>
-
- </view>
- </view>
- <view class="btn-box">
- <view class="sub-btn" @click="submit()">保存档案</view>
- </view>
- </view>
- </template>
- <script>
- import {getDocDetails,addDoc,editDoc} from '@/api/doc.js'
- export default {
- data() {
- return {
- type:null,
- patientId:null,
- form: {
- userName:null,
- idCard: null,
- sex:null,
- birthday:null,
- remark:null,
- }
- };
- },
- onLoad(option) {
- this.type=option.type;
- console.log(this.type)
- if(this.type=='edit'){
- this.docId=option.docId;
- this.getDocDetails();
- }
- },
- methods:{
- sexChange(type){
- this.form.sex=type
- },
- getDocDetails(){
- var data={docId:this.docId};
- getDocDetails(data).then(
- res => {
- if(res.code==200){
- this.form=res.data;
-
- }else{
- uni.showToast({
- title: res.msg,
- });
- }
- },
- rej => {}
- );
- },
- submit(){
- if(this.form.userName==null){
- uni.showToast({
- icon:'none',
- title: "姓名不能为空",
- });
- return;
- }
- if(this.form.idCard==null){
- uni.showToast({
- icon:'none',
- title: "身份证号不能为空",
- });
- return;
- }
- if(this.form.sex==null){
- uni.showToast({
- icon:'none',
- title: "性别不能为空",
- });
- return;
- }
- if(this.form.birthday==null){
- uni.showToast({
- icon:'none',
- title: "出生年月不能为空",
- });
- return;
- }
- if(this.type=="add"){
- this.addDoc()
- }
- else if(this.type=="edit"){
- this.editDoc()
- }
-
- },
- editDoc(){
- editDoc(this.form).then(
- res => {
- if(res.code==200){
- uni.showToast({
- icon:'success',
- title: "操作成功",
- });
- setTimeout(function() {
- uni.$emit('refreshDoc');
- uni.navigateBack({
- delta: 1
- })
- }, 500);
- }else{
- uni.showToast({
- icon:'none',
- title: res.msg,
- });
- }
- },
- rej => {}
- );
- },
- addDoc(){
- addDoc(this.form).then(
- res => {
- if(res.code==200){
- uni.showToast({
- icon:'success',
- title: "操作成功",
- });
- setTimeout(function() {
- uni.$emit('refreshDoc');
- uni.navigateBack({
- delta: 1
- })
- }, 500);
- }else{
- uni.showToast({
- icon:'none',
- title: res.msg,
- });
- }
- },
- rej => {}
- );
- },
- // 出生日期选择
- bindDateChange: function(e) {
- this.form.birthday = e.target.value
- },
- }
- }
- </script>
- <style lang="scss">
- page{
- height: 100%;
- }
- .content{
- height: 100%;
- display: flex;
- flex-direction: column;
- justify-content: space-between;
- .inner{
- height: calc(100% - 120upx);
- padding: 20upx;
- .form-box{
- padding: 0 30upx;
- background: #FFFFFF;
- border-radius: 16upx;
- .form-item{
- padding: 30upx 0;
- display: flex;
- align-items: flex-start;
- border-bottom: 1px solid #F1F1F1;
- &:last-child{
- border-bottom: none;
- }
- .label{
- width: 150upx;
- text-align: left;
- font-size: 30upx;
- line-height: 44upx;
- font-family: PingFang SC;
- font-weight: 500;
- color: #222222;
- flex-shrink: 0;
- }
- input{
- text-align: left;
- }
- .form-input{
- font-size: 30upx;
- font-family: PingFang SC;
- font-weight: 500;
- color: #999999;
- text-align: left;
- }
- .form-textarea{
- font-size: 30upx;
- color: #999999;
- height: 100upx;
- padding: 4upx 0;
- }
-
- .birth-picker {
- flex: 1;
- display: flex;
- align-items: center;
-
- .right-box{
- width: 100%;
- display: flex;
- align-items: center;
- .input-box{
- width: 470upx;
- }
- .arrow{
- width: 13upx;
- height: 23upx;
- margin-left: 20upx;
- }
- }
- }
- }
- }
- }
- .btn-box{
- height: 120upx;
- padding: 0 30upx;
- display: flex;
- align-items: center;
- justify-content: center;
- background: #FFFFFF;
- .sub-btn{
- width: 100%;
- height: 88upx;
- line-height: 88upx;
- text-align: center;
- font-size: 30upx;
- font-family: PingFang SC;
- font-weight: bold;
- color: #FFFFFF;
- background: #018C39;
- border-radius: 44upx;
- }
- }
- }
- </style>
|