Commit 597e51e2 authored by gengchunlei's avatar gengchunlei

bug修改

parent ac7f98ac
...@@ -54,7 +54,7 @@ ...@@ -54,7 +54,7 @@
}, },
created() { created() {
//获取妇幼权限和登录基本信息 //获取妇幼权限和登录基本信息
// document.cookie = 'bGNnd3lwdF9hdA=4f0aa588-ba25-4d21-a200-e94cd6dcc1cc;'//昆明市 // document.cookie = 'bGNnd3lwdF9hdA=4bace827-4931-44f1-9e4f-82f9838734be;'//昆明市
// document.cookie = 'bGNnd3lwdF9hdA=' + sessionStorage.getItem("loginToken") + ';'//云南省 // document.cookie = 'bGNnd3lwdF9hdA=' + sessionStorage.getItem("loginToken") + ';'//云南省
let cookieToken = getCookie('bGNnd3lwdF9hdA'); let cookieToken = getCookie('bGNnd3lwdF9hdA');
console.log('tokenInfo',cookieToken) console.log('tokenInfo',cookieToken)
......
...@@ -60,7 +60,7 @@ ...@@ -60,7 +60,7 @@
:rows="5" :rows="5"
:maxLength="200" :maxLength="200"
v-model="formData.remarks" v-model="formData.remarks"
placeholder="请输入备注(最多可输入200字)"></a-textarea> placeholder="请输入备注,最多可输入200字"></a-textarea>
</a-form-model-item> </a-form-model-item>
</a-form-model> </a-form-model>
</div> </div>
......
...@@ -52,8 +52,11 @@ ...@@ -52,8 +52,11 @@
<a-descriptions-item label="入库时间" v-if="detailInfo.status == 2"> <a-descriptions-item label="入库时间" v-if="detailInfo.status == 2">
{{detailInfo.receiveDate || '--'}} {{detailInfo.receiveDate || '--'}}
</a-descriptions-item> </a-descriptions-item>
<a-descriptions-item label="备注" :span="3">
{{detailInfo.remarks || '--'}}
</a-descriptions-item>
</a-descriptions> </a-descriptions>
<a-form-model ref="formRef" <!--<a-form-model ref="formRef"
:labelCol="{span: 4}" :labelCol="{span: 4}"
:wrapperCol="{span: 16}" :wrapperCol="{span: 16}"
style="margin-top: 20px" style="margin-top: 20px"
...@@ -69,7 +72,7 @@ ...@@ -69,7 +72,7 @@
v-model="detailInfo.remarks" v-model="detailInfo.remarks"
placeholder="请输入备注"></a-textarea> placeholder="请输入备注"></a-textarea>
</a-form-model-item> </a-form-model-item>
</a-form-model> </a-form-model>-->
</div> </div>
</div> </div>
<div style="text-align: center;margin-top: 16px"> <div style="text-align: center;margin-top: 16px">
......
...@@ -85,34 +85,36 @@ ...@@ -85,34 +85,36 @@
}, },
{ {
title: '单价(元)', title: '单价(元)',
width:'90px',
dataIndex: 'unitPrice', dataIndex: 'unitPrice',
ellipsis: true
}, },
{ {
title: '规格', title: '规格',
dataIndex: 'specs', dataIndex: 'specs',
ellipsis: true width:'70px',
}, },
{ {
title: '分配数量', title: '分配数量',
dataIndex: 'sendNum', dataIndex: 'sendNum',
ellipsis: true width:'100px',
}, },
{ {
title: '入库状态', title: '入库状态',
// dataIndex: 'statusName', // dataIndex: 'statusName',
// ellipsis: true, // ellipsis: true,
width:'100px',
scopedSlots: {customRender: 'statusNameInfo'}, scopedSlots: {customRender: 'statusNameInfo'},
}, },
{ {
title: '入库日期', title: '入库日期',
dataIndex: 'receiveDate', dataIndex: 'receiveDate',
ellipsis: true width: '110px',
}, },
{ {
title: '操作', title: '操作',
align: 'center', align: 'center',
fixed: 'right', fixed: 'right',
width:'140px',
scopedSlots: {customRender: 'action'}, scopedSlots: {customRender: 'action'},
}, },
] ]
......
...@@ -29,7 +29,9 @@ ...@@ -29,7 +29,9 @@
:pagination="false" :pagination="false"
> >
<template slot="statusName" slot-scope="record"> <template slot="statusName" slot-scope="record">
<a-button type="link" size="small">{{record.statusName}}</a-button> <a-badge status="success" v-if="record.status == 2" />
<a-badge status="warning" v-if="record.status == 1"/>
<span>{{record.statusName}}</span>
</template> </template>
<a-table <a-table
slot="expandedRowRender" slot="expandedRowRender"
...@@ -38,8 +40,10 @@ ...@@ -38,8 +40,10 @@
:data-source="record.detailedList" :data-source="record.detailedList"
:pagination="false" :pagination="false"
> >
<template slot="statusName" slot-scope="record"> <template slot="statusNameInfo" slot-scope="record">
<a-button type="link" size="small">{{record.statusName}}</a-button> <a-badge status="success" v-if="record.status == 2" />
<a-badge status="warning" v-if="record.status == 1"/>
<span>{{record.statusName}}</span>
</template> </template>
</a-table> </a-table>
</a-table> </a-table>
...@@ -145,7 +149,7 @@ ...@@ -145,7 +149,7 @@
{ {
title: '收货状态', title: '收货状态',
width:"160px", width:"160px",
scopedSlots: {customRender: 'statusName'}, scopedSlots: {customRender: 'statusNameInfo'},
ellipsis: true ellipsis: true
}, },
{ {
......
...@@ -21,8 +21,10 @@ ...@@ -21,8 +21,10 @@
<a-row :gutter="16"> <a-row :gutter="16">
<a-col :span="12"> <a-col :span="12">
<a-form-model-item label="姓名" prop="womanName"> <a-form-model-item label="姓名" prop="womanName">
<a-input placeholder="请输入姓名" :disabled="disabled" <a-input v-toInputNum="{num: 15}"
v-model="formData.womanName"></a-input> placeholder="请输入姓名,最多可输入15个字"
:disabled="disabled"
v-model="formData.womanName"></a-input>
</a-form-model-item> </a-form-model-item>
</a-col> </a-col>
<a-col :span="12"> <a-col :span="12">
...@@ -74,16 +76,23 @@ ...@@ -74,16 +76,23 @@
<a-row :gutter="16"> <a-row :gutter="16">
<a-col :span="12"> <a-col :span="12">
<a-form-model-item label="姓名" prop="manName"> <a-form-model-item label="姓名" prop="manName">
<a-input placeholder="请输入姓名" v-model="formData.manName" <a-input
v-toInputNum="{num: 15}"
placeholder="请输入姓名,最多可输入15个字"
v-model="formData.manName"
:disabled="disabled"></a-input> :disabled="disabled"></a-input>
</a-form-model-item> </a-form-model-item>
</a-col> </a-col>
<a-col :span="12"> <a-col :span="12">
<a-form-model-item label="证件类型" prop="menCertificateType"> <a-form-model-item label="证件类型" prop="menCertificateType">
<a-select v-model="formData.menCertificateType" placeholder="请选择" <a-select v-model="formData.menCertificateType"
:disabled="disabled"> placeholder="请选择"
:disabled="disabled"
>
<a-select-option v-for="item in certificateTypeList" <a-select-option v-for="item in certificateTypeList"
:key="item.enumValue" :value="item.enumValue" :key="item.enumValue"
:value="item.enumValue"
> >
{{item.enumName}} {{item.enumName}}
</a-select-option> </a-select-option>
...@@ -116,13 +125,13 @@ ...@@ -116,13 +125,13 @@
<a-form-model-item label="现住地址" prop="presentCode" :labelCol="{span: 3}" <a-form-model-item label="现住地址" prop="presentCode" :labelCol="{span: 3}"
:wrapperCol="{span: 20}"> :wrapperCol="{span: 20}">
<!--<a-input placeholder="请输入现住地址" v-model="formData.presentCode"></a-input>--> <!--<a-input placeholder="请输入现住地址" v-model="formData.presentCode"></a-input>-->
<!--@click.native="initLoadAreaData"-->
<a-cascader v-model="formData.presentCode" <a-cascader v-model="formData.presentCode"
change-on-select change-on-select
:disabled="disabled" :disabled="disabled"
:options="areaInfo" :options="areaInfo"
:fieldNames="fieldNames" :fieldNames="fieldNames"
:load-data="loadAreaData" :load-data="loadAreaData"
@click.native="initLoadAreaData"
placeholder="请选择"/> placeholder="请选择"/>
</a-form-model-item> </a-form-model-item>
</a-col> </a-col>
...@@ -130,7 +139,10 @@ ...@@ -130,7 +139,10 @@
<a-col :span="24"> <a-col :span="24">
<a-form-model-item label="详细地址" prop="nowAddress" :labelCol="{span: 3}" <a-form-model-item label="详细地址" prop="nowAddress" :labelCol="{span: 3}"
:wrapperCol="{span: 20}"> :wrapperCol="{span: 20}">
<a-input placeholder="请输入详细地址" v-model="formData.nowAddress" <a-input
v-toInputNum="{num: 100}"
placeholder="请输入详细地址,最多可输入100个字"
v-model="formData.nowAddress"
:disabled="disabled"></a-input> :disabled="disabled"></a-input>
</a-form-model-item> </a-form-model-item>
</a-col> </a-col>
...@@ -164,14 +176,14 @@ ...@@ -164,14 +176,14 @@
</div> </div>
</a-card> </a-card>
</a-form-model-item> </a-form-model-item>
</a-col> </a-col>-->
<a-col :span="21" :offset="3" v-if="routerParams.routerFlag == 'update'"> <a-col :span="21" :offset="3" v-if="routerParams.routerFlag == 'update'">
<a-form-model-item :wrapperCol="{span: 23}"> <a-form-model-item :wrapperCol="{span: 23}">
<div style="border: 1px dashed #EEEEEE"> <div style="border: 1px dashed #EEEEEE">
<img style="width: 100%;height: 160px" :src="formData.consentUrl"> <img style="width: 100%;height: 160px" :src="formData.consentUrl">
</div> </div>
</a-form-model-item> </a-form-model-item>
</a-col>--> </a-col>
<!-- <a-col :span="21" :offset="3"> <!-- <a-col :span="21" :offset="3">
<a-form-model-item :wrapperCol="{span: 23}"> <a-form-model-item :wrapperCol="{span: 23}">
<div style="border: 1px dashed #EEEEEE"> <div style="border: 1px dashed #EEEEEE">
...@@ -322,7 +334,11 @@ ...@@ -322,7 +334,11 @@
{required: true, message: '请选择证件类型'} {required: true, message: '请选择证件类型'}
], ],
womenIdCard: [ womenIdCard: [
{required: true, message: '请输入证件号码'} {required: true, message: '请输入证件号码'},
{
pattern: /^[1-9]\d{5}(18|19|20)\d{2}((0[1-9])|(1[0-2]))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/,
message:'请输入正确的身份证号'
}
], ],
// oncePregnant: [ // oncePregnant: [
// {required: true, message: '请选择是否曾经怀孕'} // {required: true, message: '请选择是否曾经怀孕'}
...@@ -337,7 +353,11 @@ ...@@ -337,7 +353,11 @@
{required: true, message: '请选择证件类型'} {required: true, message: '请选择证件类型'}
], ],
menIdCard: [ menIdCard: [
{required: true, message: '请输入证件号码'} {required: true, message: '请输入证件号码'},
{
pattern: /^[1-9]\d{5}(18|19|20)\d{2}((0[1-9])|(1[0-2]))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/,
message:'请输入正确的身份证号'
}
], ],
telephone: [ telephone: [
{required: true, message: '请输入联系电话'}, {required: true, message: '请输入联系电话'},
...@@ -410,6 +430,7 @@ ...@@ -410,6 +430,7 @@
this.signedModeList = getEnumByFlag('folacin_resident_info_signed_mode') this.signedModeList = getEnumByFlag('folacin_resident_info_signed_mode')
this.getBookHtmlContent() this.getBookHtmlContent()
this.getAllDoctorList() this.getAllDoctorList()
this.initLoadAreaData()
if (this.routerParams.routerFlag == 'update') {//从申请过来的发放 if (this.routerParams.routerFlag == 'update') {//从申请过来的发放
this.disabled = true; this.disabled = true;
this.getStockListDetail() this.getStockListDetail()
...@@ -476,6 +497,9 @@ ...@@ -476,6 +497,9 @@
targetOption.loading = false; targetOption.loading = false;
data.forEach(item => { data.forEach(item => {
item['isLeaf'] = false item['isLeaf'] = false
if (item.areaLevel >=5) {
item['isLeaf'] = true
}
}) })
if (targetOption.areaCode == 0) { if (targetOption.areaCode == 0) {
this.areaInfo = [...data] this.areaInfo = [...data]
......
...@@ -78,7 +78,7 @@ ...@@ -78,7 +78,7 @@
@click="showVisible=true"/> @click="showVisible=true"/>
</a-descriptions-item> </a-descriptions-item>
</a-descriptions> </a-descriptions>
<div class="card_info"> <!-- <div class="card_info">
<a-card class="book" :headStyle="{background: '#FAFAFA'}" v-if="routerParams.source == 2"> <a-card class="book" :headStyle="{background: '#FAFAFA'}" v-if="routerParams.source == 2">
<div slot="title" style="text-align: center;"> <div slot="title" style="text-align: center;">
<span style="color: #262626;font-size: 14px">知情同意书</span> <span style="color: #262626;font-size: 14px">知情同意书</span>
...@@ -88,7 +88,7 @@ ...@@ -88,7 +88,7 @@
</div> </div>
</div> </div>
</a-card> </a-card>
</div> </div>-->
<div v-if="routerParams.source == 2"> <div v-if="routerParams.source == 2">
<img style="width: 100%;height: 160px" :src="detailInfo.applySignUrl"> <img style="width: 100%;height: 160px" :src="detailInfo.applySignUrl">
</div> </div>
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
</a-form-item> </a-form-item>
<a-button type="primary" class="search_btn" @click="searchList">搜索</a-button> <a-button type="primary" class="search_btn" @click="searchList">搜索</a-button>
<a-button class="search_btn" style="margin-left: 10px" @click="restSearchForm">清空</a-button> <a-button class="search_btn" style="margin-left: 10px" @click="restSearchForm">清空</a-button>
<div style="float: right;line-height: 32px;background-color: #E6F7FF;margin-top: 16px;cursor: pointer" <div style="float: right;line-height: 32px;background-color: #FFF1F0;margin-top: 16px;cursor: pointer"
@click="showSelectedMedical" @click="showSelectedMedical"
v-if="selectedRowKeys.length > 0" v-if="selectedRowKeys.length > 0"
> >
......
...@@ -16,7 +16,11 @@ ...@@ -16,7 +16,11 @@
<a-row> <a-row>
<a-col :span="8"> <a-col :span="8">
<a-form-model-item label="发货人姓名" prop="sendContact"> <a-form-model-item label="发货人姓名" prop="sendContact">
<a-input placeholder="请填写发货人" v-model="formData.sendContact"></a-input> <a-input
v-toInputNum="{num:15}"
placeholder="请填写发货人,最多可输入15个字"
v-model="formData.sendContact"
></a-input>
</a-form-model-item> </a-form-model-item>
</a-col> </a-col>
<a-col :span="8"> <a-col :span="8">
...@@ -44,7 +48,11 @@ ...@@ -44,7 +48,11 @@
</a-col> </a-col>
<a-col :span="8"> <a-col :span="8">
<a-form-model-item label="收货人姓名" prop="receiver"> <a-form-model-item label="收货人姓名" prop="receiver">
<a-input placeholder="请填写收货人" v-model="formData.receiver"></a-input> <a-input
v-toInputNum="{num:15}"
placeholder="请填写收货人,最多可输入15个字"
v-model="formData.receiver"
></a-input>
</a-form-model-item> </a-form-model-item>
</a-col> </a-col>
<a-col :span="8"> <a-col :span="8">
...@@ -69,7 +77,7 @@ ...@@ -69,7 +77,7 @@
<a-form-model-item :prop="'detailedList.' + index + '.sendNum'" <a-form-model-item :prop="'detailedList.' + index + '.sendNum'"
:rules="formRules.sendNum" class="tab_input_r"> :rules="formRules.sendNum" class="tab_input_r">
<a-input type="number" <a-input type="number"
v-toInt v-toInt="{notNum: 0}"
v-model="record.sendNum" v-model="record.sendNum"
placeholder="请输入分配数量" placeholder="请输入分配数量"
style="width: 150px;" style="width: 150px;"
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
<a-col :span="12"> <a-col :span="12">
<a-form-model-item label="供应商" prop="supplierId"> <a-form-model-item label="供应商" prop="supplierId">
<a-select v-model="formData.supplierId" <a-select v-model="formData.supplierId"
placeholder="请选择" placeholder="请选择供应商"
:dropdownMatchSelectWidth="false" :dropdownMatchSelectWidth="false"
@click.native="getAllSupply" @click.native="getAllSupply"
> >
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
<a-col :span="12"> <a-col :span="12">
<a-form-model-item label="品牌" prop="brandId"> <a-form-model-item label="品牌" prop="brandId">
<a-select v-model="formData.brandId" <a-select v-model="formData.brandId"
placeholder="品牌名称" placeholder="请选择叶酸品牌"
:dropdownMatchSelectWidth="false" :dropdownMatchSelectWidth="false"
> >
<a-select-option v-for="item in brandNameList" :key="item.enumValue" <a-select-option v-for="item in brandNameList" :key="item.enumValue"
...@@ -37,8 +37,10 @@ ...@@ -37,8 +37,10 @@
</a-col> </a-col>
<a-col :span="12"> <a-col :span="12">
<a-form-model-item label="批次号" prop="batchNumber"> <a-form-model-item label="批次号" prop="batchNumber">
<a-input v-model="formData.batchNumber" <a-input
placeholder="请输入批次号"></a-input> v-toInputNum="{num:10}"
v-model="formData.batchNumber"
placeholder="请输入批次号,最多可输入10个字"></a-input>
</a-form-model-item> </a-form-model-item>
</a-col> </a-col>
...@@ -55,11 +57,16 @@ ...@@ -55,11 +57,16 @@
</a-form-model-item> </a-form-model-item>
</a-col> </a-col>
<a-col :span="12"> <a-col :span="12">
<!-- @change="changeUnitPrice({digit:2, maxNum: 10000})"-->
<a-form-model-item label="单价" prop="unitPrice"> <a-form-model-item label="单价" prop="unitPrice">
<a-input v-price <a-input
v-price="{digit:2, maxNum:10000}"
v-model="formData.unitPrice" v-model="formData.unitPrice"
suffix="元" placeholder="0~10000,最多保留2位小数"
placeholder="请输入单价,保留2位小数"></a-input>
>
<span slot="addonAfter"></span>
</a-input>
</a-form-model-item> </a-form-model-item>
</a-col> </a-col>
<a-col :span="12"> <a-col :span="12">
...@@ -70,9 +77,9 @@ ...@@ -70,9 +77,9 @@
</a-col> </a-col>
<a-col :span="12"> <a-col :span="12">
<a-form-model-item label="数量" prop="number"> <a-form-model-item label="数量" prop="number">
<a-input v-toInt <a-input v-toInt="{maxNum:10000000}"
v-model="formData.number" v-model="formData.number"
placeholder="请输入数量"> placeholder="0~10000000">
<a-select slot="addonAfter" v-model="formData.specs" default-value="瓶" <a-select slot="addonAfter" v-model="formData.specs" default-value="瓶"
style="width: 60px"> style="width: 60px">
<a-select-option value="瓶"> <a-select-option value="瓶">
...@@ -95,8 +102,9 @@ ...@@ -95,8 +102,9 @@
<a-col :span="12"> <a-col :span="12">
<a-form-model-item label="入库经手人" prop="handler"> <a-form-model-item label="入库经手人" prop="handler">
<a-input <a-input
v-toInputNum="{num:15}"
v-model="formData.handler" v-model="formData.handler"
placeholder="请输入入库经手人"></a-input> placeholder="请输入入库经手人,最多可输入15个字"></a-input>
</a-form-model-item> </a-form-model-item>
</a-col> </a-col>
<a-col :span="24"> <a-col :span="24">
...@@ -228,6 +236,21 @@ ...@@ -228,6 +236,21 @@
} }
}); });
}, },
changeUnitPrice(val) {
if (val.maxNum && this.formData.unitPrice > val.maxNum) {
this.formData.unitPrice = val.maxNum
}
let num = new RegExp(`(^[\\-0-9][0-9]*(.[0-9]+)?)$`) // 是否为数字
let littleNum = new RegExp(`^(0|[1-9]\\d{0,${val.digit}})(\\.\\d{1,${val.digit}})?$`)//自定义小数位数
if (this.formData.unitPrice &&!num.test(+this.formData.unitPrice)) {
this.formData.unitPrice = this.formData.unitPrice.replace(/[^\d.]/g, ""); //清除“数字”和“.”以外的字符
}
if (this.formData.unitPrice && !littleNum.test(+this.formData.unitPrice)) {
this.formData.unitPrice = this.formData.unitPrice.replace(/\.{2,}/g, "."); //只保留第一个. 清除多余的
this.formData.unitPrice = this.formData.unitPrice.replace(".", "$#$").replace(/\./g, "").replace("$#$", ".");
this.formData.unitPrice = this.formData.unitPrice.replace(new RegExp(`^(.*\\..{${defu}}).*$`), "$1");//只能输入自定义个小数
}
},
goBack() { goBack() {
closedDetail('/inStock/add', '/Home/inStock') closedDetail('/inStock/add', '/Home/inStock')
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<div class="inStockManage"> <div class="inStockManage">
<a-form layout="inline" class="search_form"> <a-form layout="inline" class="search_form">
<a-form-item label="供应商名称"> <a-form-item label="供应商名称">
<a-select v-model="searchForm.supplierId" placeholder="请选择" style="width: 250px"> <a-select v-model="searchForm.supplierId" placeholder="请选择" style="width: 200px">
<a-select-option value="">全部</a-select-option> <a-select-option value="">全部</a-select-option>
<a-select-option v-for="item in allSupplyInfo" :key="item.id" :value="item.id"> <a-select-option v-for="item in allSupplyInfo" :key="item.id" :value="item.id">
{{item.supplierName}} {{item.supplierName}}
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
</a-select> </a-select>
</a-form-item> </a-form-item>
<a-form-item label="品牌"> <a-form-item label="品牌">
<a-select v-model="searchForm.brandId" placeholder="请选择" style="width: 250px"> <a-select v-model="searchForm.brandId" placeholder="请选择" style="width: 200px">
<a-select-option value="">全部</a-select-option> <a-select-option value="">全部</a-select-option>
<a-select-option v-for="item in brandList" :key="item.enumValue" :value="item.enumValue"> <a-select-option v-for="item in brandList" :key="item.enumValue" :value="item.enumValue">
{{item.enumName}} {{item.enumName}}
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
</a-select> </a-select>
</a-form-item> </a-form-item>
<a-form-item label="入库日期"> <a-form-item label="入库日期">
<dateRangePicker :date.sync="searchForm.date"></dateRangePicker> <dateRangePicker :date.sync="searchForm.date" style="width: 240px"></dateRangePicker>
</a-form-item> </a-form-item>
<a-button type="primary" icon="search" class="search_btn" @click="searchList">搜索</a-button> <a-button type="primary" icon="search" class="search_btn" @click="searchList">搜索</a-button>
<a-button class="search_btn ant-table-btn" icon="sync" style="margin-left: 10px" @click="restSearchForm">清空</a-button> <a-button class="search_btn ant-table-btn" icon="sync" style="margin-left: 10px" @click="restSearchForm">清空</a-button>
...@@ -41,8 +41,8 @@ ...@@ -41,8 +41,8 @@
v-if="unitInfo.level==3||unitInfo.level==4" v-if="unitInfo.level==3||unitInfo.level==4"
@click="toAdd">调拨分配 @click="toAdd">调拨分配
</a-button> </a-button>
<a-button type="primary" class="search_btn btn_space">导出Excel</a-button> <!-- <a-button type="primary" class="search_btn btn_space">导出Excel</a-button>-->
<div style="display: inline-block;line-height: 32px;background-color: #E6F7FF;cursor: pointer" <div style="display: inline-block;line-height: 32px;background-color: #FFF1F0;cursor: pointer"
@click="showSelectedMedical" @click="showSelectedMedical"
v-if="selectedRowKeys.length > 0" v-if="selectedRowKeys.length > 0"
> >
......
...@@ -15,14 +15,17 @@ ...@@ -15,14 +15,17 @@
prop="supplierName" prop="supplierName"
:labelCol="{span: 3}" :labelCol="{span: 3}"
:wrapperCol="{span: 20}"> :wrapperCol="{span: 20}">
<a-input v-model="formData.supplierName" <a-input v-toInputNum="{num:10}"
placeholder="请输入供应商名称"></a-input> v-model="formData.supplierName"
placeholder="请输入供应商名称,最多可输入50字"></a-input>
</a-form-model-item> </a-form-model-item>
</a-col> </a-col>
<a-col :span="12"> <a-col :span="12">
<a-form-model-item label="联系人" prop="contactsName"> <a-form-model-item label="联系人" prop="contactsName">
<a-input v-model="formData.contactsName" <a-input
placeholder="请输入联系人"></a-input> v-toInputNum="{num: 15}"
v-model="formData.contactsName"
placeholder="请输入联系人,最多可输入15个字"></a-input>
</a-form-model-item> </a-form-model-item>
</a-col> </a-col>
<a-col :span="12"> <a-col :span="12">
...@@ -49,8 +52,10 @@ ...@@ -49,8 +52,10 @@
prop="address" prop="address"
:labelCol="{span: 3}" :labelCol="{span: 3}"
:wrapperCol="{span: 20}"> :wrapperCol="{span: 20}">
<a-input v-model="formData.address" <a-input
placeholder="请输入详细地址"></a-input> v-toInputNum="{num: 100}"
v-model="formData.address"
placeholder="请输入详细地址,最多可输入100个字"></a-input>
</a-form-model-item> </a-form-model-item>
</a-col> </a-col>
<a-col :span="24"> <a-col :span="24">
...@@ -150,6 +155,9 @@ ...@@ -150,6 +155,9 @@
targetOption.loading = false; targetOption.loading = false;
data.forEach(item => { data.forEach(item => {
item['isLeaf'] = false item['isLeaf'] = false
if (item.areaLevel >=5) {
item['isLeaf'] = true
}
}) })
if (targetOption.areaCode == 0) { if (targetOption.areaCode == 0) {
this.areaInfo = [...data] this.areaInfo = [...data]
......
...@@ -6,11 +6,17 @@ import Vue from 'vue' ...@@ -6,11 +6,17 @@ import Vue from 'vue'
Vue.directive('toInputNum', { Vue.directive('toInputNum', {
// 指令的定义 // 指令的定义
inserted: function(el, binding, vnode) { inserted: function(el, binding, vnode) {
el.addEventListener('input', function () { let dom = null
if (el.tagName == 'INPUT') {
dom = el
} else {
dom = el.querySelector('input')
}
dom.addEventListener('input', function () {
if (binding.value) { if (binding.value) {
checkValue(el, binding.value.num) checkValue(dom, binding.value.num)
} else { } else {
checkValue(el, 50) checkValue(dom, 50)
} }
}) })
function checkValue(el, defu) { function checkValue(el, defu) {
......
import Vue from 'vue' import Vue from 'vue'
//input 限制输入正整数 //input 限制输入正整数
//v-toInt //v-toInt={maxNum: 最大值,notNum:不等于}
Vue.directive('toInt', { Vue.directive('toInt', {
// 指令的定义 // 指令的定义
inserted: function(el, binding, vnode) { inserted: function(el, binding, vnode) {
el.addEventListener("input", function() { let dom = null
if (el.tagName == 'INPUT') {
dom = el
} else {
dom = el.querySelector('input')
}
dom.addEventListener("input", function() {
//进行验证 //进行验证
checkedfun(el); if (binding.value) {
checkedfun(dom, binding.value.maxNum, binding.value.notNum)
} else {
checkedfun(dom, null, null)
}
}); });
function checkedfun(el) { function checkedfun(el, maxNum, notNum) {
let reg = new RegExp("^[0-9]*$"); if (maxNum && el.value > maxNum) {
el.value = maxNum
el.dispatchEvent(new Event("input"));//调用input事件使vue v-model绑定更新
}
if (typeof (notNum) !=='undefined' && el.value === notNum.toString()) {
el.value = ''
el.dispatchEvent(new Event("input"));//调用input事件使vue v-model绑定更新
}
let reg = new RegExp("^[0-9]*$");
if (!reg.test(el.value)) { if (!reg.test(el.value)) {
el.value = el.value.replace(/[^0-9]+/g, ""); el.value = el.value.replace(/[^0-9]+/g, "");
el.dispatchEvent(new Event("input"));//调用input事件使vue v-model绑定更新 el.dispatchEvent(new Event("input"));//调用input事件使vue v-model绑定更新
......
import Vue from 'vue' import Vue from 'vue'
//input 限制输入正整数以及自定义小数位数 //input 限制输入正整数以及自定义小数位数
//v-price //v-price
//v-price="{digit:4}" //v-price="{digit:小数位数,maxNum:最大值}"
Vue.directive('price', { Vue.directive('price', {
inserted: function (el, binding, vnode) { inserted: function (el, binding, vnode) {
el.addEventListener('input', function () { let dom = null
if (el.tagName == 'INPUT') {
dom = el
} else {
dom = el.querySelector('input')
}
dom.addEventListener('input', function () {
if (binding.value) { if (binding.value) {
checkValue(el, binding.value.digit) checkValue(dom, binding.value.digit,binding.value.maxNum)
} else { } else {
checkValue(el, 3) checkValue(dom, 3, null)
} }
}) })
function checkValue(el, defu) { function checkValue(el, defu, maxNum) {
if (maxNum && el.value > maxNum) {
el.value = maxNum
el.dispatchEvent(new Event("input"));//调用input事件使vue v-model绑定更新
}
let num = new RegExp(`(^[\\-0-9][0-9]*(.[0-9]+)?)$`) // 是否为数字 let num = new RegExp(`(^[\\-0-9][0-9]*(.[0-9]+)?)$`) // 是否为数字
let reg = new RegExp("^[0-9]*$");//正整数
let littleNum = new RegExp(`^(0|[1-9]\\d{0,${defu}})(\\.\\d{1,${defu}})?$`)//自定义小数位数 let littleNum = new RegExp(`^(0|[1-9]\\d{0,${defu}})(\\.\\d{1,${defu}})?$`)//自定义小数位数
if (el.value &&!num.test(+el.value)) { if (el.value &&!num.test(+el.value)) {
el.value = el.value.replace(/[^\d.]/g, ""); //清除“数字”和“.”以外的字符 el.value = el.value.replace(/[^\d.]/g, ""); //清除“数字”和“.”以外的字符
el.dispatchEvent(new Event("input"));//调用input事件使vue v-model绑定更新 el.dispatchEvent(new Event("input"));//调用input事件使vue v-model绑定更新
} }
if (el.value && !littleNum.test(+el.value)) { if (el.value && !littleNum.test(+el.value) && !reg.test(+el.value)) {
el.value = el.value.replace(/\.{2,}/g, "."); //只保留第一个. 清除多余的 el.value = el.value.replace(/\.{2,}/g, "."); //只保留第一个. 清除多余的
el.value = el.value.replace(".", "$#$").replace(/\./g, "").replace("$#$", "."); el.value = el.value.replace(".", "$#$").replace(/\./g, "").replace("$#$", ".");
el.value = el.value.replace(new RegExp(`^(.*\\..{${defu}}).*$`), "$1");//只能输入自定义个小数 el.value = el.value.replace(new RegExp(`^(.*\\..{${defu}}).*$`), "$1");//只能输入自定义个小数
...@@ -27,5 +38,4 @@ Vue.directive('price', { ...@@ -27,5 +38,4 @@ Vue.directive('price', {
} }
} }
} }
}) })
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment