Commit 53b0f40f by zhuxiaomei

添加界面合成一个

parent ca670964
......@@ -185,7 +185,7 @@
} else if (testedType === 0) {
this.$router.push({
path: '/sampling_list/sampling_list_add',
query: {testedType, shelfId, title: '抽样单添加-非网络'}
query: {testedType, shelfId, title: '抽样单添加'}
})
} else {
this.$router.push({
......
......@@ -5,7 +5,7 @@
<table-col>
<van-field
label-class="cus-field-class"
label-width="50%"
label-width="25%"
label-align="center"
name="samplingNum"
v-model="formObj.samplingNum"
......@@ -13,15 +13,6 @@
:rules="[{ required: true, message: '请填写抽样单编号' }]"
></van-field>
</table-col>
<table-col>
<van-field
label-class="cus-field-class"
label-width="50%"
label-align="center"
v-model="formObj.taskNum"
label="No."
></van-field>
</table-col>
</table-row>
<table-row>
<table-col>
......@@ -42,7 +33,7 @@
<template #input>
<van-radio-group v-model="formObj.taskType" direction="horizontal">
<van-radio :name="item" :key="item" shape="square" v-for="item in taskTypeList">
{{item}}
{{ item }}
</van-radio>
</van-radio-group>
</template>
......@@ -67,12 +58,29 @@
></van-field>
</table-col>
<table-col>
<van-field
label-class="cus-field-class"
label-width="25%"
label-align="center"
label="区域类型">
<template #input>
<van-radio-group v-model="nonNetTested.areaType" direction="horizontal">
<van-radio v-for="item in areaTypeList" :key="item" :name="item" shape="square">
{{ item }}
</van-radio>
</van-radio-group>
</template>
</van-field>
</table-col>
</table-row>
<table-row>
<table-col>
<van-field readonly
label-class="cus-field-class"
label-width="25%"
label-align="center"
v-model="areaObj"
label="省市区"
label="单位地址"
@click="showCityPicker=true"
:columns-placeholder="['请选择', '请选择', '请选择']"
></van-field>
......@@ -82,82 +90,74 @@
<table-col>
<van-field
label-class="cus-field-class"
label-width="25%"
label-width="50%"
label-align="center"
v-model="nonNetTested.address"
label="单位地址"
placeholder="如证照与许可证不一致,以许可证为准"
v-model="nonNetTested.legalPerson"
label="法人代表"
></van-field>
</table-col>
</table-row>
<table-row>
<table-col>
<van-field
label-class="cus-field-class"
label-width="25%"
label-width="50%"
label-align="center"
label="区域类型">
<template #input>
<van-radio-group v-model="nonNetTested.areaType" direction="horizontal">
<van-radio v-for="item in areaTypeList" :key="item" :name="item" shape="square">
{{item}}
</van-radio>
</van-radio-group>
<div style="border-bottom: 1px solid #000">
<van-field :readonly="nonNetTested.areaType!=='其他'"
v-model="nonNetTested.sales"
label="年销售额(万元)"
></van-field>
</table-col>
<table-col>
<van-field
label-class="cus-field-class"
label-width="50%"
label-align="center"
v-model="nonNetTested.areaTypeRemark"
v-model="nonNetTested.license"
label="营业执照号"
></van-field>
</div>
</template>
</van-field>
</table-col>
</table-row>
<table-row>
<table-col>
<van-radio-group v-model="nonNetTested.permitType" direction="horizontal">
<van-radio v-for="item in permitTypeList" :key="item" :name="item" shape="square">
{{item}}
</van-radio>
</van-radio-group>
</table-col>
<table-col>
<van-field
label-class="cus-field-class"
label-width="50%"
label-align="center"
v-model="nonNetTested.permitNum"
v-model="nonNetTested.linkman"
label="联系人"
></van-field>
</table-col>
<table-col>
<van-radio-group v-model="nonNetTested.permitType" direction="horizontal">
<van-radio v-for="item in permitTypeList" :key="item" :name="item" shape="square">
{{ item }}
</van-radio>
</van-radio-group>
</table-col>
<table-col>
<van-field
label-class="cus-field-class"
label-width="50%"
label-align="center"
v-model="nonNetTested.legalPerson"
label="法人代表"
v-model="nonNetTested.permitNum"
></van-field>
</table-col>
</table-row>
<table-row>
<table-col>
<van-field
label-class="cus-field-class"
label-width="50%"
label-align="center"
v-model="nonNetTested.linkman"
label="联系人"
v-model="nonNetTested.tel"
label="电话"
></van-field>
</table-col>
</table-row>
<table-row>
<table-col>
<van-field
label-class="cus-field-class"
label-width="50%"
label-align="center"
v-model="nonNetTested.license"
label="营业执照号/社会信用代码"
v-model="nonNetTested.fax"
label="传真"
></van-field>
</table-col>
<table-col>
......@@ -165,8 +165,8 @@
label-class="cus-field-class"
label-width="50%"
label-align="center"
v-model="nonNetTested.tel"
label="联系电话"
v-model="nonNetTested.postalCode"
label="邮编"
></van-field>
</table-col>
</table-row>
......@@ -182,21 +182,13 @@
<div style="display: flex;padding: 5px 10px;flex-wrap: wrap">
<div style="align-self: center">生产环节:</div>
<van-radio v-for="item in proLinkList" :key="item" :name="1+','+item" shape="square">
{{item}}
{{ item }}
</van-radio>
<div style="border-bottom: 1px solid #000">
<van-field :readonly="placeRemark1Readonly"
label-class="cus-field-class"
label-width="50%"
label-align="center"
v-model="placeRemark1"
></van-field>
</div>
</div>
<div style="display: flex;padding: 5px 10px;flex-wrap: wrap">
<div style="align-self: center">流通环节:</div>
<van-radio v-for="item in flowLinkList" :key="item" :name="2+','+item" shape="square">
{{item}}
{{ item }}
</van-radio>
<div style="border-bottom: 1px solid #000">
<van-field :readonly="placeRemark2Readonly"
......@@ -211,20 +203,20 @@
<div style="align-self: center;">餐饮环节:</div>
<van-radio v-for="item in restLinkList1" :key="item.value" :name="3+','+item.value"
shape="square">
{{item.label}}
{{ item.label }}
</van-radio>
</div>
<div style="display: flex;padding: 5px 10px;flex-wrap: wrap">
<div style="align-self: center;width:72px"></div>
<van-radio v-for="item in restLinkList2" :key="item.value" :name="3+','+item.value"
shape="square">
{{item.label}}
{{ item.label }}
</van-radio>
</div>
<div style="display: flex;padding: 5px 10px;flex-wrap: wrap">
<div style="align-self: center;width:72px"></div>
<van-radio v-for="item in restLinkList3" :key="item.value" :name="3+','+item"
shape="square">{{item}}
shape="square">{{ item }}
</van-radio>
<div style="border-bottom: 1px solid #000">
<van-field :readonly="placeRemark3Readonly"
......@@ -239,27 +231,6 @@
</van-radio-group>
</table-col>
</table-row>
<table-row>
<table-col>
<van-field readonly
label-class="cus-field-class"
label-width="50%"
label-align="center"
v-model="formObj.samplingDate"
label="抽样日期"
@click="_selectDate('formObj.samplingDate')"
></van-field>
</table-col>
<table-col>
<van-field
label-class="cus-field-class"
label-width="50%"
label-align="center"
v-model="formObj.testMembers"
label="抽样人员"
></van-field>
</table-col>
</table-row>
<table-row flex-none>
<table-col>
样品信息
......@@ -269,63 +240,25 @@
<table-col>
<van-field
label-class="cus-field-class"
label-width="50%"
label-align="center"
v-model="sample.name"
label="样品名称"
></van-field>
</table-col>
<table-col>
<van-field
label-class="cus-field-class"
label-width="25%"
label-align="center"
v-model="sample.trademark"
label="商标"
></van-field>
</table-col>
<table-col>
<van-field
label-class="cus-field-class"
label-width="25%"
label-align="center"
v-model="sample.qrcode"
label="条形码"
@blur="_getSample"
></van-field>
<!--<van-field-->
<!--label-class="cus-field-class"-->
<!--label-width="25%"-->
<!--label-align="center"-->
<!--v-model="sample.qrcode"-->
<!--label="条形码"-->
<!--right-icon="scan"-->
<!--@click-right-icon="_scan"-->
<!--&gt;</van-field>-->
</table-col>
</table-row>
<table-row>
<table-col>
<van-field
label-class="cus-field-class"
label-width="25%"
label-align="center"
v-model="sample.firstClass"
label="大类"
right-icon="add-o"
@click-right-icon="_classSelect('大类')"
></van-field>
</table-col>
<table-col>
<van-field
label="样品来源">
<template #input>
<van-radio-group v-model="sample.source" direction="horizontal">
<van-radio :name="item" :key="item" shape="square" v-for="item in sourceList">
{{ item }}
</van-radio>
</van-radio-group>
<div style="border-bottom: 1px solid #000">
<van-field :readonly="sample.source!=='其他'"
label-class="cus-field-class"
label-width="25%"
label-width="50%"
label-align="center"
v-model="sample.secondClass"
label="亚类"
right-icon="add-o"
@click-right-icon="_classSelect('亚类')"
v-model="sample.sourceRemark"
></van-field>
</div>
</template>
</van-field>
</table-col>
</table-row>
<table-row>
......@@ -334,22 +267,23 @@
label-class="cus-field-class"
label-width="25%"
label-align="center"
v-model="sample.thirdClass"
label="次亚类"
right-icon="add-o"
@click-right-icon="_classSelect('次亚类')"
></van-field>
</table-col>
<table-col>
<van-field
label="样品属性">
<template #input>
<van-radio-group v-model="sample.properties" direction="horizontal">
<van-radio :name="item" :key="item" shape="square"
v-for="item in propertiesList">{{ item }}
</van-radio>
</van-radio-group>
<div style="border-bottom: 1px solid #000">
<van-field :readonly="sample.properties!=='其他'"
label-class="cus-field-class"
label-width="25%"
label-width="50%"
label-align="center"
v-model="sample.fourthClass"
label="细类"
right-icon="add-o"
@click-right-icon="_classSelect('细类')"
v-model="sample.propertiesRemark"
></van-field>
</div>
</template>
</van-field>
</table-col>
</table-row>
<table-row>
......@@ -361,7 +295,7 @@
<template #input>
<van-radio-group v-model="sample.type" direction="horizontal">
<van-radio :name="item" :key="item" shape="square" v-for="item in sampleTypeList">
{{item}}
{{ item }}
</van-radio>
<div style="border-bottom: 1px solid #000">
<van-field :readonly="sample.type!=='其他'"
......@@ -381,53 +315,25 @@
label-class="cus-field-class"
label-width="25%"
label-align="center"
label="样品来源">
<template #input>
<van-radio-group v-model="sample.source" direction="horizontal">
<van-radio :name="item" :key="item" shape="square" v-for="item in sourceList">
{{item}}
</van-radio>
</van-radio-group>
<div style="border-bottom: 1px solid #000">
<van-field :readonly="sample.source!=='其他'"
label-class="cus-field-class"
label-width="50%"
label-align="center"
v-model="sample.sourceRemark"
v-model="sample.name"
label="样品名称"
></van-field>
</div>
</template>
</van-field>
</table-col>
<table-col>
<van-field
label-class="cus-field-class"
label-width="25%"
label-align="center"
label="样品属性">
<template #input>
<van-radio-group v-model="sample.properties" direction="horizontal">
<van-radio :name="item" :key="item" shape="square"
v-for="item in propertiesList">{{item}}
</van-radio>
</van-radio-group>
<div style="border-bottom: 1px solid #000">
<van-field :readonly="sample.properties!=='其他'"
label-class="cus-field-class"
label-width="50%"
label-align="center"
v-model="sample.propertiesRemark"
v-model="sample.trademark"
label="商标"
></van-field>
</div>
</template>
</van-field>
</table-col>
</table-row>
<table-row>
<table-col>
<van-radio-group v-model="sample.dateType" direction="horizontal">
<van-radio v-for="item in dateTypeList" :key="item" :name="item" shape="square">
{{item}}
{{ item }}
</van-radio>
</van-radio-group>
</table-col>
......@@ -442,17 +348,18 @@
@click="_selectDate('sample.sampleDate')"
></van-field>
</table-col>
</table-row>
<table-row>
<table-col>
<van-field
label-class="cus-field-class"
label-width="50%"
label-align="center"
v-model="sample.standard"
label="执行标准/技术文档"
v-model="sample.specification"
label="规格型号"
></van-field>
</table-col>
</table-row>
<table-row>
<table-col>
<van-field
label-class="cus-field-class"
......@@ -467,8 +374,8 @@
label-class="cus-field-class"
label-width="50%"
label-align="center"
v-model="sample.specification"
label="规格型号"
v-model="sample.shelfLife"
label="保质期"
></van-field>
</table-col>
</table-row>
......@@ -478,17 +385,28 @@
label-class="cus-field-class"
label-width="50%"
label-align="center"
v-model="sample.standard"
label="执行标准/技术文档"
></van-field>
</table-col>
<table-col>
<van-field
label-class="cus-field-class"
label-width="50%"
label-align="center"
v-model="sample.qualityGrade"
label="质量等级"
></van-field>
</table-col>
</table-row>
<table-row>
<table-col>
<van-field
label-class="cus-field-class"
label-width="50%"
label-align="center"
v-model="sample.shelfLife"
label="保质期"
v-model="formObj.proLicense"
label="生产许可编号"
></van-field>
</table-col>
<table-col>
......@@ -500,24 +418,30 @@
label="单价"
></van-field>
</table-col>
</table-row>
<table-row>
<table-col>
<van-field
label-class="cus-field-class"
label-width="50%"
label-align="center"
v-model="sample.samplingBase"
label="抽样基数"
></van-field>
label="是否进口">
<template #input>
<van-radio-group v-model="sample.inward" direction="horizontal">
<van-radio v-for="item in trueOrFalseList" :key="item.value" :name="item.value"
shape="square">{{ item.label }}
</van-radio>
</van-radio-group>
</template>
</van-field>
</table-col>
</table-row>
<table-row>
<table-col>
<van-field
label-class="cus-field-class"
label-width="50%"
label-align="center"
v-model="sample.quantity"
label="抽样数量"
v-model="sample.samplingBase"
label="抽样基数/批量"
></van-field>
</table-col>
<table-col>
......@@ -525,8 +449,8 @@
label-class="cus-field-class"
label-width="50%"
label-align="center"
v-model="sample.unit"
label="抽样数量单位"
v-model="sample.quantity"
label="抽样数量(含备样)"
></van-field>
</table-col>
<table-col>
......@@ -545,11 +469,11 @@
label-class="cus-field-class"
label-width="50%"
label-align="center"
label="抽样方式">
label="样品形态">
<template #input>
<van-radio-group v-model="sample.samplingMethod" direction="horizontal">
<van-radio :name="item" v-for="item in samplingMethodList" :key="item"
shape="square">{{item}}
<van-radio-group v-model="sample.shape" direction="horizontal">
<van-radio v-for="item in shapeList" :name="item" :key="item"
shape="square">{{ item }}
</van-radio>
</van-radio-group>
</template>
......@@ -558,67 +482,18 @@
<table-col>
<van-field
label-class="cus-field-class"
label-width="50%"
label-align="center"
label="是否进口">
<template #input>
<van-radio-group v-model="sample.inward" direction="horizontal">
<van-radio v-for="item in trueOrFalseList" :key="item.value" :name="item.value"
shape="square">{{item.label}}
</van-radio>
</van-radio-group>
</template>
</van-field>
</table-col>
<table-col>
<van-field
label-class="cus-field-class"
label-width="50%"
label-align="center"
v-model="sample.originPlace"
label="原产地"
></van-field>
</table-col>
</table-row>
<table-row>
<table-col>
<van-field
label-class="cus-field-class"
label-width="25%"
label-align="center"
label="包装分类">
<template #input>
<van-radio-group v-model="sample.packClass" direction="horizontal">
<van-radio v-for="item in packClassList" :name="item" :key="item"
shape="square">{{item}}
shape="square">{{ item }}
</van-radio>
</van-radio-group>
</template>
</van-field>
</table-col>
<table-col>
<van-field
label-class="cus-field-class"
label-width="25%"
label-align="center"
label="储存条件">
<template #input>
<van-checkbox-group v-model="storageCondition" direction="horizontal">
<van-checkbox v-for="item in storageConditionList" :name="item" :key="item"
shape="square">{{item}}
</van-checkbox>
</van-checkbox-group>
<div style="border-bottom: 1px solid #000">
<van-field
label-class="cus-field-class"
label-width="50%"
label-align="center"
v-model="sample.storageConditionRemark"
></van-field>
</div>
</template>
</van-field>
</table-col>
</table-row>
</table-col>
</table-row>
......@@ -631,19 +506,6 @@
label-class="cus-field-class"
label-width="25%"
label-align="center"
v-model="formObj.proName"
label="生产者名称"
right-icon="add-o"
@click-right-icon="_companySelect('formObj.proName')"
></van-field>
</table-col>
</table-row>
<table-row>
<table-col>
<van-field
label-class="cus-field-class"
label-width="25%"
label-align="center"
v-model="formObj.proAddress"
label="生产者地址"
></van-field>
......@@ -655,8 +517,10 @@
label-class="cus-field-class"
label-width="25%"
label-align="center"
v-model="formObj.proLicense"
label="生产许可证号"
v-model="formObj.proName"
label="生产者名称"
right-icon="add-o"
@click-right-icon="_companySelect('formObj.proName')"
></van-field>
</table-col>
<table-col>
......@@ -672,16 +536,43 @@
</table-col>
</table-row>
<table-row flex-none>
<table-col>(标称)第三方企业信息</table-col>
<table-col>(标称)样品储存条件</table-col>
<table-col>
<van-field
label-class="cus-field-class"
label-width=""
label-align="center"
label="">
<template #input>
<div style="display: flex">
<van-checkbox-group v-model="storageCondition" direction="horizontal">
<van-checkbox v-for="item in storageConditionList" :name="item" :key="item"
shape="square">{{ item }}
</van-checkbox>
</van-checkbox-group>
<div style="border-bottom: 1px solid #000">
<van-field
label-class="cus-field-class"
label-width="50%"
label-align="center"
v-model="sample.storageConditionRemark"
></van-field>
</div>
</div>
</template>
</van-field>
</table-col>
<table-col flex-none>
<table-row>
<table-col>
<van-field
<van-field readonly
label-class="cus-field-class"
label-width="25%"
label-width="50%"
label-align="center"
v-model="formObj.thirdPartyName"
label="企业名称"
v-model="sample.sandDeadline"
label="寄送样品截止日期"
@click="_selectDate('sample.sandDeadline')"
></van-field>
</table-col>
</table-row>
......@@ -689,32 +580,35 @@
<table-col>
<van-field
label-class="cus-field-class"
label-width="25%"
label-width="50%"
label-align="center"
v-model="formObj.thirdPartyAddress"
label="企业地址"
v-model="sample.sandAddress"
label="寄送样品地址"
></van-field>
</table-col>
</table-row>
<table-row>
</table-col>
</table-row>
<table-row flex-none>
<table-col>抽样样品包装</table-col>
<table-col>
<van-field
label-class="cus-field-class"
label-width="25%"
label-width=""
label-align="center"
label="企业性质">
label="">
<template #input>
<van-radio-group v-model="formObj.thirdPartyNature" direction="horizontal">
<van-radio v-for="item in thirdPartyNatureList" :key="item" :name="item"
shape="square">{{item}}
<van-radio-group v-model="sample.pack" direction="horizontal">
<van-radio v-for="item in packList" :name="item" :key="item"
shape="square">{{ item }}
</van-radio>
</van-radio-group>
<div style="border-bottom: 1px solid #000">
<van-field :readonly="formObj.thirdPartyNature!=='其他'"
<van-field
label-class="cus-field-class"
label-width="50%"
label-align="center"
v-model="formObj.thirdPartyNatureRemark"
v-model="sample.packRemark"
></van-field>
</div>
</template>
......@@ -723,22 +617,17 @@
<table-col>
<van-field
label-class="cus-field-class"
label-width="25%"
label-align="center"
v-model="formObj.thirdPartyLicense"
label="企业许可证号"
></van-field>
</table-col>
<table-col>
<van-field
label-class="cus-field-class"
label-width="25%"
label-width="50%"
label-align="center"
v-model="formObj.thirdPartyTel"
label="联系电话"
></van-field>
</table-col>
</table-row>
label="抽样方式">
<template #input>
<van-radio-group v-model="sample.samplingMethod" direction="horizontal">
<van-radio :name="item" v-for="item in samplingMethodList" :key="item"
shape="square">{{ item }}
</van-radio>
</van-radio-group>
</template>
</van-field>
</table-col>
</table-row>
<table-row flex-none>
......@@ -844,37 +733,31 @@
></van-area>
</van-popup>
<SelectClass ref="class" @on-result-change="_classResult"></SelectClass>
<SelectTester ref="tester" @on-result-change="_testerResult"></SelectTester>
<SelectProducter ref="producter" @on-result-change="_producterResult"></SelectProducter>
<SelectTested ref="tested" @on-result-change="_testedResult"></SelectTested>
<ScanBar ref="scan" @on-result-change="_scanResult"></ScanBar>
</div>
</template>
<script>
import SamplingListAddTable from './components/SamplingListAddTable'
import TableRow from './components/TableRow'
import TableCol from './components/TableCol'
import {samplingSummary, samplingSample} from '../../api'
import {default as areaList} from '../../lib/area'
import SelectClass from './components/SelectClass'
import SelectTester from './components/SelectTester'
import SelectProducter from './components/SelectProducter'
import SelectTested from './components/SelectTested'
import ScanBar from './components/ScanBar'
import SamplingListAddTable from './components/SamplingListAddTable'
import TableRow from './components/TableRow'
import TableCol from './components/TableCol'
import {samplingSummary, samplingSample} from '../../api'
import {default as areaList} from '../../lib/area'
import SelectTester from './components/SelectTester'
import SelectProducter from './components/SelectProducter'
import SelectTested from './components/SelectTested'
export default {
export default {
name: "SamplingListAdd",
components: {
"add-table": SamplingListAddTable,
"table-row": TableRow,
"table-col": TableCol,
SelectClass,
SelectTester,
SelectProducter,
SelectTested,
ScanBar
},
data() {
return {
......@@ -887,22 +770,12 @@
formObj: {
samplingNum: '',
taskNum: '',
source: '',
taskType: '',
proName: '',
proAddress: '',
proLicense: '',
proAddress: '',
proName: '',
proTel: '',
thirdPartyName: '',
thirdPartyAddress: '',
thirdPartyNature: '',
thirdPartyNatureRemark: '',
thirdPartyLicense: '',
thirdPartyTel: '',
testName: '',
testAddress: '',
testLinkman: '',
......@@ -910,88 +783,81 @@
testEmail: '',
testFax: '',
remark: '',
samplingDate: '',
testMembers: '',
},
nonNetTested: {
name: '',
areaType: '',
testedProvince: '',
testedCity: '',
testedCountry: '',
address: '',
areaType: '',
areaTypeRemark: '',
permitType: '',
permitNum: '',
legalPerson: '',
linkman: '',
sales: '',
license: '',
linkman: '',
permitType: '',
permitNum: '',
tel: '',
fax: '',
postalCode: '',
placeLink: '',//保存时单独赋值 从place字段分离出
place: '', //保存时单独赋值 从place字段分离出
placeRemark: '' //保存时单独赋值 根据环节取对应的placeRemark
},
sample: {
name: '',
trademark: '',
qrcode: '',
firstClass: '',
secondClass: '',
thirdClass: '',
fourthClass: '',
type: '',
typeRemark: '',
source: '',
sourceRemark: '',
properties: '',
propertiesRemark: '',
type: '',
typeRemark: '',
name: '',
trademark: '',
dateType: '',
sampleDate: '',
standard: '',
batchNo: '',
specification: '',
qualityGrade: '',
batchNo: '',
shelfLife: '',
standard: '',
qualityGrade: '',
price: '',
inward: '',
samplingBase: '',
quantity: '',
unit: '',
backupQuanity: '',
samplingMethod: '',
inward: '',
originPlace: '',
shape: '',
pack: '',
packClass: '',
storageCondition: '',
storageConditionRemark: ''
storageConditionRemark: '',
sandDeadline: '',
sandAddress: '',
samplingMethod: '',
},
taskTypeList: ['监督抽检', '风险监测', '评价性抽检'],
areaTypeList: ['景点', '城市', '乡镇', '学校周边', '其他'],
taskTypeList: ['监督抽检', '风险监测'],
areaTypeList: ['城市', '乡村', '景点'],
permitTypeList: ['经营许可证号', '生产许可证号'],
sampleTypeList: ['食用农产品', '工业加工食品', '餐饮加工食品', '食品添加剂', '食品相关产品', '其他',],
sourceList: ['加工/自制', '委托生产', '外购', '其他'],
propertiesList: ['普通食品', '特殊食品', '节令食品', '重大活动保障食品', '其他',],
dateTypeList: ['生产日期', '购进日期', '加工日期', '检疫日期'],
dateTypeList: ['生产日', '加工日', '购进日'],
samplingMethodList: ['无菌抽样', '非无菌抽样'],
trueOrFalseList: [{label: '是', value: 1}, {label: '否', value: 0}],
packClassList: ['预包装', '非定量包装', '无包装'],
storageConditionList: ['常温', '冷藏', '冷冻', '避光', '密闭', '阴凉', '通风', '干燥', '其他'],
shapeList: ['固体', '半固体', '液体', '气体'],
packClassList: ['散装', '预包装'],
storageConditionList: ['常温', '冷藏', '冷冻', '避光', '密闭', '其他'],
thirdPartyNatureList: ['委托', '代理', '经销', '进口', '其他'],
packList: ['玻璃瓶', '塑料瓶', '塑料袋', '无菌袋', '其他'],
storageCondition: [],
place: '', //1生产环节2流通环节3餐饮环节 值为“环节,地点”
placeRemark1: '',
placeRemark2: '',
placeRemark3: '',
placeRemark1Readonly: true,
placeRemark2Readonly: true,
placeRemark3Readonly: true,
proLinkList: ['原辅料库', '生产线', '半成品库', '成品库待检区', '成品库已检区', '其他'],
flowLinkList: ['农贸市场', '菜市场', '批发市场', '商场', '超市', '小食杂店', '其他'],
proLinkList: ['原辅料库', '生产线', '半成品库', '成品库待检区', '成品库已检区'],
flowLinkList: ['农贸市场', '菜市场', '批发市场', '商场', '超市', '小食杂店', '网购', '其他'],
restLinkList1: [
{label: '特大型餐馆', value: '餐馆(特大型餐馆)'},
{label: '大型餐馆', value: '餐馆(大型餐馆)'},
......@@ -1005,7 +871,7 @@
{label: '企事业单位食堂', value: '食堂(企事业单位食堂)'},
{label: '建筑工地食堂', value: '食堂(建筑工地食堂)'},
],
restLinkList3: ['小吃店', '快餐店', '饮品店','集体用餐配送单位', '中央厨房', '其他'],
restLinkList3: ['小吃店', '快餐店', '饮品店', '集体用餐配送单位', '中央厨房', '其他'],
id: '',
......@@ -1014,15 +880,14 @@
}
},
watch: {
//除储存条件 选其他以外的选项备注清空
'nonNetTested.areaType': function (val) {
'sample.type': function (val) {
if (val !== '' && val !== '其他') {
this.nonNetTested.areaTypeRemark = ''
this.sample.typeRemark = ''
}
},
'sample.type': function (val) {
'sample.pack': function (val) {
if (val !== '' && val !== '其他') {
this.sample.typeRemark = ''
this.sample.packRemark = ''
}
},
'sample.source': function (val) {
......@@ -1040,19 +905,17 @@
this.formObj.thirdPartyNatureRemark = ''
}
},
storageCondition: function (val) {
if (val !== '' && val !== '其他') {
this.sample.storageConditionRemark = ''
}
},
//抽样地点特殊处理
place: function (val) {
if (val !== '') {
let placeLink = val.split(',')[0]
let place = val.split(',')[1]
if (placeLink === '1') {
if (place === '其他') {
this.placeRemark1Readonly = false
} else {
this.placeRemark1 = ''
this.placeRemark1Readonly = true
}
} else if (placeLink === '2') {
if (placeLink === '2') {
if (place === '其他') {
this.placeRemark2Readonly = false
} else {
......@@ -1068,7 +931,6 @@
}
}
} else {
this.placeRemark1Readonly = true
this.placeRemark2Readonly = true
this.placeRemark3Readonly = true
}
......@@ -1080,42 +942,16 @@
}
},
mounted() {
// mui.init({
// beforeback: function () {
// localStorage.removeItem('summary')
// localStorage.removeItem('sample')
// return true
// }
// })
this._open()
},
// beforeDestroy(){
// localStorage.removeItem('summary')
// localStorage.removeItem('sample')
// },
methods: {
_open() {
if (this.$route.query.id) {//编辑
this.id = this.$route.query.id
// if (localStorage.getItem('summary')) {
// this._initData(JSON.parse(localStorage.getItem('summary')))
// if (localStorage.getItem('sample')) {
// this._scanResult(JSON.parse(localStorage.getItem('sample')))
// }
// } else {
this._getData()
// }
} else {//添加
this.id = ''
// if (localStorage.getItem('summary')) {
// this._initData(JSON.parse(localStorage.getItem('summary')))
// if (localStorage.getItem('sample')) {
// this._scanResult(JSON.parse(localStorage.getItem('sample')))
// }
// } else {
this.formObj.testMembers = this.$global.getUserInfo().realname
this._getLastTester()
// }
}
},
_companySelect(type) {
......@@ -1159,76 +995,6 @@
this.nonNetTested.license = res.license ? res.license : ''
this.nonNetTested.tel = res.tel ? res.tel : ''
},
_scan() {
//将已经填写过的存起来
localStorage.setItem('summary', JSON.stringify(this._getSaveObj()))
// this.$refs.scan._open()
this.$router.push('/sampling_list/scan_bar')
},
_scanResult(result) {
for (let key in this.sample) {
if (result[key] !== '') {
if (key === 'sampleDate') {
this.sample[key] = result[key] ? this.$dateformat(result[key], 'yyyy-mm-dd') : ''
} else if (key === 'storageCondition') {
this.storageCondition = result[key].split(',')
this.sample[key] = result[key]
} else {
this.sample[key] = result[key]
}
}
}
},
_classSelect(type) {
switch (type) {
case '大类':
this.$refs.class._open(0)
break
case '亚类':
if (this.sample.firstClass) {
this.$refs.class._open(1, this.sample.firstClass)
} else {
this.$toast('请先选择大类!')
}
break
case '次亚类':
if (this.sample.secondClass) {
this.$refs.class._open(2, this.sample.secondClass)
} else {
this.$toast('请先选择亚类!')
}
break
case '细类':
if (this.sample.thirdClass) {
this.$refs.class._open(3, this.sample.thirdClass)
} else {
this.$toast('请先选择次亚类!')
}
break
}
},
_classResult(res, level) {
switch (level) {
case 0:
this.sample.firstClass = res
this.sample.secondClass = ''
this.sample.thirdClass = ''
this.sample.fourthClass = ''
break
case 1:
this.sample.secondClass = res
this.sample.thirdClass = ''
this.sample.fourthClass = ''
break
case 2:
this.sample.thirdClass = res
this.sample.fourthClass = ''
break
case 3:
this.sample.fourthClass = res
break
}
},
//获取最近填写的抽样单位信息
_getLastTester: async function () {
let result = await samplingSummary.lastTester()
......@@ -1250,7 +1016,7 @@
_initData(result) {
for (let key in this.formObj) {
if (result[key] !== '') {
if (key === 'samplingDate') {
if (key === 'sandDeadline') {
this.formObj[key] = result[key] ? this.$dateformat(result[key], 'yyyy-mm-dd') : ''
} else {
this.formObj[key] = result[key]
......@@ -1262,9 +1028,6 @@
if (key === 'placeLink') {
this.place = result.nonNetTested.placeLink + ',' + result.nonNetTested.place
switch (result.nonNetTested.placeLink) {
case '1':
this.placeRemark1 = result.nonNetTested.placeRemark ? result.nonNetTested.placeRemark : ''
break
case '2':
this.placeRemark2 = result.nonNetTested.placeRemark ? result.nonNetTested.placeRemark : ''
break
......@@ -1281,9 +1044,11 @@
if (result.sample[key] !== '') {
if (key === 'sampleDate') {
this.sample[key] = result.sample[key] ? this.$dateformat(result.sample[key], 'yyyy-mm-dd') : ''
} else if (key === 'sandDeadline') {
this.sample[key] = result.sample[key] ? this.$dateformat(result.sample[key], 'yyyy-mm-dd') : ''
} else if (key === 'storageCondition') {
this.storageCondition = result.sample[key].split(',')
this.sample[key] = result.sample[key]
this.storageCondition = result.sample[key] ? result.sample[key].split(',') : []
this.sample[key] = result.sample[key] ? result.sample[key] : ''
} else {
this.sample[key] = result.sample[key]
}
......@@ -1333,9 +1098,6 @@
data.nonNetTested.placeLink = this.place.split(',')[0]
data.nonNetTested.place = this.place.split(',')[1]
switch (data.nonNetTested.placeLink) {
case '1':
data.nonNetTested.placeRemark = this.placeRemark1
break
case '2':
data.nonNetTested.placeRemark = this.placeRemark2
break
......@@ -1376,8 +1138,8 @@
case 'sample.sampleDate':
this.sample.sampleDate = this.$dateformat(date, 'yyyy-mm-dd')
break
case 'formObj.samplingDate':
this.formObj.samplingDate = this.$dateformat(date, 'yyyy-mm-dd')
case 'sample.sandDeadline':
this.sample.sandDeadline = this.$dateformat(date, 'yyyy-mm-dd')
break
}
this.showDatePicker = false
......@@ -1390,7 +1152,7 @@
},
_getSample: async function () {
if (this.sample.qrcode&&this.id==='') {
if (this.sample.qrcode && this.id === '') {
let res = await samplingSample.scanSample({qrcode: this.sample.qrcode})
if (res) {
this._scanResult(res)
......@@ -1398,10 +1160,10 @@
}
},
}
}
}
</script>
<style lang="less">
@import "../../styles/sampling-list-add.less";
@import "../../styles/sampling-list-add.less";
</style>
......@@ -5,7 +5,7 @@
<table-col>
<van-field readonly
label-class="cus-field-class"
label-width="50%"
label-width="25%"
label-align="center"
name="samplingNum"
v-model="formObj.samplingNum"
......@@ -13,15 +13,6 @@
:rules="[{ required: true, message: '请填写抽样单编号' }]"
></van-field>
</table-col>
<table-col>
<van-field readonly
label-class="cus-field-class"
label-width="50%"
label-align="center"
v-model="formObj.taskNum"
label="No."
></van-field>
</table-col>
</table-row>
<table-row>
<table-col>
......@@ -42,7 +33,7 @@
<template #input>
<van-radio-group disabled v-model="formObj.taskType" direction="horizontal">
<van-radio :name="item" :key="item" shape="square" v-for="item in taskTypeList">
{{item}}
{{ item }}
</van-radio>
</van-radio-group>
</template>
......@@ -62,6 +53,8 @@
label-align="center"
v-model="nonNetTested.name"
label="单位名称"
right-icon="add-o"
@click-right-icon="_companySelect('nonNetTested.name')"
></van-field>
</table-col>
<table-col>
......@@ -69,9 +62,15 @@
label-class="cus-field-class"
label-width="25%"
label-align="center"
v-model="areaObj"
label="省市区"
></van-field>
label="区域类型">
<template #input>
<van-radio-group disabled v-model="nonNetTested.areaType" direction="horizontal">
<van-radio v-for="item in areaTypeList" :key="item" :name="item" shape="square">
{{ item }}
</van-radio>
</van-radio-group>
</template>
</van-field>
</table-col>
</table-row>
<table-row>
......@@ -80,9 +79,10 @@
label-class="cus-field-class"
label-width="25%"
label-align="center"
v-model="nonNetTested.address"
v-model="areaObj"
label="单位地址"
placeholder="如证照与许可证不一致,以许可证为准"
@click="showCityPicker=true"
:columns-placeholder="['请选择', '请选择', '请选择']"
></van-field>
</table-col>
</table-row>
......@@ -90,59 +90,54 @@
<table-col>
<van-field readonly
label-class="cus-field-class"
label-width="25%"
label-width="50%"
label-align="center"
label="区域类型">
<template #input>
<van-radio-group disabled v-model="nonNetTested.areaType" direction="horizontal">
<van-radio v-for="item in areaTypeList" :key="item" :name="item" shape="square">
{{item}}
</van-radio>
</van-radio-group>
<div style="border-bottom: 1px solid #000">
v-model="nonNetTested.legalPerson"
label="法人代表"
></van-field>
</table-col>
<table-col>
<van-field readonly
label-class="cus-field-class"
label-width="50%"
label-align="center"
v-model="nonNetTested.areaTypeRemark"
v-model="nonNetTested.sales"
label="年销售额(万元)"
></van-field>
</div>
</template>
</van-field>
</table-col>
</table-row>
<table-row>
<table-col>
<van-radio-group disabled v-model="nonNetTested.permitType" direction="horizontal">
<van-radio v-for="item in permitTypeList" :key="item" :name="item" shape="square">
{{item}}
</van-radio>
</van-radio-group>
</table-col>
<table-col>
<van-field readonly
label-class="cus-field-class"
label-width="50%"
label-align="center"
v-model="nonNetTested.permitNum"
v-model="nonNetTested.license"
label="营业执照号"
></van-field>
</table-col>
</table-row>
<table-row>
<table-col>
<van-field readonly
label-class="cus-field-class"
label-width="50%"
label-align="center"
v-model="nonNetTested.legalPerson"
label="法人代表"
v-model="nonNetTested.linkman"
label="联系人"
></van-field>
</table-col>
<table-col>
<van-radio-group disabled v-model="nonNetTested.permitType" direction="horizontal">
<van-radio v-for="item in permitTypeList" :key="item" :name="item" shape="square">
{{ item }}
</van-radio>
</van-radio-group>
</table-col>
<table-col>
<van-field readonly
label-class="cus-field-class"
label-width="50%"
label-align="center"
v-model="nonNetTested.linkman"
label="联系人"
v-model="nonNetTested.permitNum"
></van-field>
</table-col>
</table-row>
......@@ -152,8 +147,8 @@
label-class="cus-field-class"
label-width="50%"
label-align="center"
v-model="nonNetTested.license"
label="营业执照号/社会信用代码"
v-model="nonNetTested.tel"
label="电话"
></van-field>
</table-col>
<table-col>
......@@ -161,8 +156,17 @@
label-class="cus-field-class"
label-width="50%"
label-align="center"
v-model="nonNetTested.tel"
label="联系电话"
v-model="nonNetTested.fax"
label="传真"
></van-field>
</table-col>
<table-col>
<van-field readonly
label-class="cus-field-class"
label-width="50%"
label-align="center"
v-model="nonNetTested.postalCode"
label="邮编"
></van-field>
</table-col>
</table-row>
......@@ -178,21 +182,13 @@
<div style="display: flex;padding: 5px 10px;flex-wrap: wrap">
<div style="align-self: center">生产环节:</div>
<van-radio v-for="item in proLinkList" :key="item" :name="1+','+item" shape="square">
{{item}}
{{ item }}
</van-radio>
<div style="border-bottom: 1px solid #000">
<van-field readonly
label-class="cus-field-class"
label-width="50%"
label-align="center"
v-model="placeRemark1"
></van-field>
</div>
</div>
<div style="display: flex;padding: 5px 10px;flex-wrap: wrap">
<div style="align-self: center">流通环节:</div>
<van-radio v-for="item in flowLinkList" :key="item" :name="2+','+item" shape="square">
{{item}}
{{ item }}
</van-radio>
<div style="border-bottom: 1px solid #000">
<van-field readonly
......@@ -207,20 +203,20 @@
<div style="align-self: center;">餐饮环节:</div>
<van-radio v-for="item in restLinkList1" :key="item.value" :name="3+','+item.value"
shape="square">
{{item.label}}
{{ item.label }}
</van-radio>
</div>
<div style="display: flex;padding: 5px 10px;flex-wrap: wrap">
<div style="align-self: center;width:72px"></div>
<van-radio v-for="item in restLinkList2" :key="item.value" :name="3+','+item.value"
shape="square">
{{item.label}}
{{ item.label }}
</van-radio>
</div>
<div style="display: flex;padding: 5px 10px;flex-wrap: wrap">
<div style="align-self: center;width:72px"></div>
<van-radio v-for="item in restLinkList3" :key="item.value" :name="3+','+item"
shape="square">{{item}}
shape="square">{{ item }}
</van-radio>
<div style="border-bottom: 1px solid #000">
<van-field readonly
......@@ -233,27 +229,6 @@
</div>
</div>
</van-radio-group>
</table-col>
</table-row>
<table-row>
<table-col>
<van-field readonly
label-class="cus-field-class"
label-width="50%"
label-align="center"
v-model="formObj.samplingDate"
label="抽样日期"
></van-field>
</table-col>
<table-col>
<van-field readonly
label-class="cus-field-class"
label-width="50%"
label-align="center"
v-model="formObj.testMembers"
label="抽样人员"
></van-field>
</table-col>
</table-row>
<table-row flex-none>
......@@ -265,49 +240,25 @@
<table-col>
<van-field readonly
label-class="cus-field-class"
label-width="50%"
label-align="center"
v-model="sample.name"
label="样品名称"
></van-field>
</table-col>
<table-col>
<van-field readonly
label-class="cus-field-class"
label-width="50%"
label-align="center"
v-model="sample.trademark"
label="商标"
></van-field>
</table-col>
<table-col>
<van-field readonly
label-class="cus-field-class"
label-width="50%"
label-align="center"
v-model="sample.qrcode"
label="条形码"
></van-field>
</table-col>
</table-row>
<table-row>
<table-col>
<van-field readonly
label-class="cus-field-class"
label-width="25%"
label-align="center"
v-model="sample.firstClass"
label="大类"
></van-field>
</table-col>
<table-col>
label="样品来源">
<template #input>
<van-radio-group disabled v-model="sample.source" direction="horizontal">
<van-radio :name="item" :key="item" shape="square" v-for="item in sourceList">
{{ item }}
</van-radio>
</van-radio-group>
<div style="border-bottom: 1px solid #000">
<van-field readonly
label-class="cus-field-class"
label-width="25%"
label-width="50%"
label-align="center"
v-model="sample.secondClass"
label="亚类"
v-model="sample.sourceRemark"
></van-field>
</div>
</template>
</van-field>
</table-col>
</table-row>
<table-row>
......@@ -316,18 +267,23 @@
label-class="cus-field-class"
label-width="25%"
label-align="center"
v-model="sample.thirdClass"
label="次亚类"
></van-field>
</table-col>
<table-col>
label="样品属性">
<template #input>
<van-radio-group disabled v-model="sample.properties" direction="horizontal">
<van-radio :name="item" :key="item" shape="square"
v-for="item in propertiesList">{{ item }}
</van-radio>
</van-radio-group>
<div style="border-bottom: 1px solid #000">
<van-field readonly
label-class="cus-field-class"
label-width="25%"
label-width="50%"
label-align="center"
v-model="sample.fourthClass"
label="细类"
v-model="sample.propertiesRemark"
></van-field>
</div>
</template>
</van-field>
</table-col>
</table-row>
<table-row>
......@@ -339,7 +295,7 @@
<template #input>
<van-radio-group disabled v-model="sample.type" direction="horizontal">
<van-radio :name="item" :key="item" shape="square" v-for="item in sampleTypeList">
{{item}}
{{ item }}
</van-radio>
<div style="border-bottom: 1px solid #000">
<van-field readonly
......@@ -359,59 +315,30 @@
label-class="cus-field-class"
label-width="25%"
label-align="center"
label="样品来源">
<template #input>
<van-radio-group disabled v-model="sample.source" direction="horizontal">
<van-radio :name="item" :key="item" shape="square" v-for="item in sourceList">
{{item}}
</van-radio>
</van-radio-group>
<div style="border-bottom: 1px solid #000">
<van-field readonly
label-class="cus-field-class"
label-width="50%"
label-align="center"
v-model="sample.sourceRemark"
v-model="sample.name"
label="样品名称"
></van-field>
</div>
</template>
</van-field>
</table-col>
<table-col>
<van-field readonly
label-class="cus-field-class"
label-width="25%"
label-align="center"
label="样品属性">
<template #input>
<van-radio-group disabled v-model="sample.properties" direction="horizontal">
<van-radio :name="item" :key="item" shape="square"
v-for="item in propertiesList">{{item}}
</van-radio>
</van-radio-group>
<div style="border-bottom: 1px solid #000">
<van-field readonly
label-class="cus-field-class"
label-width="50%"
label-align="center"
v-model="sample.propertiesRemark"
v-model="sample.trademark"
label="商标"
></van-field>
</div>
</template>
</van-field>
</table-col>
</table-row>
<table-row>
<table-col>
<van-radio-group disabled v-model="sample.dateType" direction="horizontal">
<van-radio v-for="item in dateTypeList" :key="item" :name="item" shape="square">
{{item}}
{{ item }}
</van-radio>
</van-radio-group>
</table-col>
<table-col>
<van-field
readonly
<van-field readonly
label-class="cus-field-class"
label-width="50%"
label-align="center"
......@@ -419,17 +346,18 @@
label=""
></van-field>
</table-col>
</table-row>
<table-row>
<table-col>
<van-field readonly
label-class="cus-field-class"
label-width="50%"
label-align="center"
v-model="sample.standard"
label="执行标准/技术文档"
v-model="sample.specification"
label="规格型号"
></van-field>
</table-col>
</table-row>
<table-row>
<table-col>
<van-field readonly
label-class="cus-field-class"
......@@ -444,8 +372,8 @@
label-class="cus-field-class"
label-width="50%"
label-align="center"
v-model="sample.specification"
label="规格型号"
v-model="sample.shelfLife"
label="保质期"
></van-field>
</table-col>
</table-row>
......@@ -455,17 +383,28 @@
label-class="cus-field-class"
label-width="50%"
label-align="center"
v-model="sample.standard"
label="执行标准/技术文档"
></van-field>
</table-col>
<table-col>
<van-field readonly
label-class="cus-field-class"
label-width="50%"
label-align="center"
v-model="sample.qualityGrade"
label="质量等级"
></van-field>
</table-col>
</table-row>
<table-row>
<table-col>
<van-field readonly
label-class="cus-field-class"
label-width="50%"
label-align="center"
v-model="sample.shelfLife"
label="保质期"
v-model="formObj.proLicense"
label="生产许可编号"
></van-field>
</table-col>
<table-col>
......@@ -477,24 +416,30 @@
label="单价"
></van-field>
</table-col>
</table-row>
<table-row>
<table-col>
<van-field readonly
label-class="cus-field-class"
label-width="50%"
label-align="center"
v-model="sample.samplingBase"
label="抽样基数"
></van-field>
label="是否进口">
<template #input>
<van-radio-group disabled v-model="sample.inward" direction="horizontal">
<van-radio v-for="item in trueOrFalseList" :key="item.value" :name="item.value"
shape="square">{{ item.label }}
</van-radio>
</van-radio-group>
</template>
</van-field>
</table-col>
</table-row>
<table-row>
<table-col>
<van-field readonly
label-class="cus-field-class"
label-width="50%"
label-align="center"
v-model="sample.quantity"
label="抽样数量"
v-model="sample.samplingBase"
label="抽样基数/批量"
></van-field>
</table-col>
<table-col>
......@@ -502,8 +447,8 @@
label-class="cus-field-class"
label-width="50%"
label-align="center"
v-model="sample.unit"
label="抽样数量单位"
v-model="sample.quantity"
label="抽样数量(含备样)"
></van-field>
</table-col>
<table-col>
......@@ -522,26 +467,11 @@
label-class="cus-field-class"
label-width="50%"
label-align="center"
label="抽样方式">
<template #input>
<van-radio-group disabled v-model="sample.samplingMethod" direction="horizontal">
<van-radio :name="item" v-for="item in samplingMethodList" :key="item"
shape="square">{{item}}
</van-radio>
</van-radio-group>
</template>
</van-field>
</table-col>
<table-col>
<van-field readonly
label-class="cus-field-class"
label-width="50%"
label-align="center"
label="是否进口">
label="样品形态">
<template #input>
<van-radio-group disabled v-model="sample.inward" direction="horizontal">
<van-radio v-for="item in trueOrFalseList" :key="item.value" :name="item.value"
shape="square">{{item.label}}
<van-radio-group disabled v-model="sample.shape" direction="horizontal">
<van-radio v-for="item in shapeList" :name="item" :key="item"
shape="square">{{ item }}
</van-radio>
</van-radio-group>
</template>
......@@ -550,52 +480,18 @@
<table-col>
<van-field readonly
label-class="cus-field-class"
label-width="50%"
label-align="center"
v-model="sample.originPlace"
label="原产地"
></van-field>
</table-col>
</table-row>
<table-row>
<table-col>
<van-field readonly
label-class="cus-field-class"
label-width="25%"
label-align="center"
label="包装分类">
<template #input>
<van-radio-group disabled v-model="sample.packClass" direction="horizontal">
<van-radio v-for="item in packClassList" :name="item" :key="item"
shape="square">{{item}}
shape="square">{{ item }}
</van-radio>
</van-radio-group>
</template>
</van-field>
</table-col>
<table-col>
<van-field readonly
label-class="cus-field-class"
label-width="25%"
label-align="center"
label="储存条件">
<template #input>
<van-checkbox-group disabled v-model="storageCondition" direction="horizontal">
<van-checkbox v-for="item in storageConditionList" :name="item" :key="item"
shape="square">{{item}}
</van-checkbox>
</van-checkbox-group>
<div style="border-bottom: 1px solid #000">
<van-field readonly
label-class="cus-field-class"
label-width="50%"
label-align="center"
v-model="sample.storageConditionRemark"
></van-field>
</div>
</template>
</van-field>
</table-col>
</table-row>
</table-col>
</table-row>
......@@ -608,17 +504,6 @@
label-class="cus-field-class"
label-width="25%"
label-align="center"
v-model="formObj.proName"
label="生产者名称"
></van-field>
</table-col>
</table-row>
<table-row>
<table-col>
<van-field readonly
label-class="cus-field-class"
label-width="25%"
label-align="center"
v-model="formObj.proAddress"
label="生产者地址"
></van-field>
......@@ -630,8 +515,10 @@
label-class="cus-field-class"
label-width="25%"
label-align="center"
v-model="formObj.proLicense"
label="生产许可证号"
v-model="formObj.proName"
label="生产者名称"
right-icon="add-o"
@click-right-icon="_companySelect('formObj.proName')"
></van-field>
</table-col>
<table-col>
......@@ -647,16 +534,41 @@
</table-col>
</table-row>
<table-row flex-none>
<table-col>(标称)第三方企业信息</table-col>
<table-col>(标称)样品储存条件</table-col>
<table-col>
<van-field readonly
label-class="cus-field-class"
label-width=""
label-align="center"
label="">
<template #input>
<div style="display: flex">
<van-checkbox-group disabled v-model="storageCondition" direction="horizontal">
<van-checkbox v-for="item in storageConditionList" :name="item" :key="item"
shape="square">{{ item }}
</van-checkbox>
</van-checkbox-group>
<div style="border-bottom: 1px solid #000">
<van-field readonly
label-class="cus-field-class"
label-width="50%"
label-align="center"
v-model="sample.storageConditionRemark"
></van-field>
</div>
</div>
</template>
</van-field>
</table-col>
<table-col flex-none>
<table-row>
<table-col>
<van-field readonly
label-class="cus-field-class"
label-width="25%"
label-width="50%"
label-align="center"
v-model="formObj.thirdPartyName"
label="企业名称"
v-model="sample.sandDeadline"
label="寄送样品截止日期"
></van-field>
</table-col>
</table-row>
......@@ -664,24 +576,27 @@
<table-col>
<van-field readonly
label-class="cus-field-class"
label-width="25%"
label-width="50%"
label-align="center"
v-model="formObj.thirdPartyAddress"
label="企业地址"
v-model="sample.sandAddress"
label="寄送样品地址"
></van-field>
</table-col>
</table-row>
<table-row>
</table-col>
</table-row>
<table-row flex-none>
<table-col>抽样样品包装</table-col>
<table-col>
<van-field readonly
label-class="cus-field-class"
label-width="25%"
label-width=""
label-align="center"
label="企业性质">
label="">
<template #input>
<van-radio-group disabled v-model="formObj.thirdPartyNature" direction="horizontal">
<van-radio v-for="item in thirdPartyNatureList" :key="item" :name="item"
shape="square">{{item}}
<van-radio-group disabled v-model="sample.pack" direction="horizontal">
<van-radio v-for="item in packList" :name="item" :key="item"
shape="square">{{ item }}
</van-radio>
</van-radio-group>
<div style="border-bottom: 1px solid #000">
......@@ -689,7 +604,7 @@
label-class="cus-field-class"
label-width="50%"
label-align="center"
v-model="formObj.thirdPartyNatureRemark"
v-model="sample.packRemark"
></van-field>
</div>
</template>
......@@ -698,22 +613,17 @@
<table-col>
<van-field readonly
label-class="cus-field-class"
label-width="25%"
label-align="center"
v-model="formObj.thirdPartyLicense"
label="企业许可证号"
></van-field>
</table-col>
<table-col>
<van-field readonly
label-class="cus-field-class"
label-width="25%"
label-width="50%"
label-align="center"
v-model="formObj.thirdPartyTel"
label="联系电话"
></van-field>
</table-col>
</table-row>
label="抽样方式">
<template #input>
<van-radio-group disabled v-model="sample.samplingMethod" direction="horizontal">
<van-radio :name="item" v-for="item in samplingMethodList" :key="item"
shape="square">{{ item }}
</van-radio>
</van-radio-group>
</template>
</van-field>
</table-col>
</table-row>
<table-row flex-none>
......@@ -727,6 +637,8 @@
label-align="center"
v-model="formObj.testName"
label="单位名称"
right-icon="add-o"
@click-right-icon="_companySelect('formObj.testName')"
></van-field>
</table-col>
<table-col>
......@@ -796,126 +708,152 @@
<div class="bottom-btn">
<van-button block type="info" @click="_goto">返回</van-button>
</div>
<van-popup v-model="showDatePicker" position="bottom"
:safe-area-inset-bottom="true"
:close-on-popstate="true">
<van-datetime-picker
type="date"
v-model="currentDate"
@confirm="_dateConfirm"
@cancel="showDatePicker = false"
></van-datetime-picker>
</van-popup>
<van-popup v-model="showCityPicker" position="bottom"
:safe-area-inset-bottom="true"
:close-on-popstate="true">
<van-area title="省市区"
:area-list="areaList"
@confirm="_areaConfirm"
@cancel="showCityPicker=false"
></van-area>
</van-popup>
<SelectTester ref="tester" @on-result-change="_testerResult"></SelectTester>
<SelectProducter ref="producter" @on-result-change="_producterResult"></SelectProducter>
<SelectTested ref="tested" @on-result-change="_testedResult"></SelectTested>
</div>
</template>
<script>
import SamplingListAddTable from './components/SamplingListAddTable'
import TableRow from './components/TableRow'
import TableCol from './components/TableCol'
import {samplingSummary} from '../../api'
import SamplingListAddTable from './components/SamplingListAddTable'
import TableRow from './components/TableRow'
import TableCol from './components/TableCol'
import {samplingSummary, samplingSample} from '../../api'
import {default as areaList} from '../../lib/area'
import SelectTester from './components/SelectTester'
import SelectProducter from './components/SelectProducter'
import SelectTested from './components/SelectTested'
export default {
export default {
name: "SamplingListAdd",
components: {
"add-table": SamplingListAddTable,
"table-row": TableRow,
"table-col": TableCol
"table-col": TableCol,
SelectTester,
SelectProducter,
SelectTested,
},
data() {
return {
showDatePicker: false,
currentDate: new Date(),
selectDateType: '',
showCityPicker: false,
areaList: areaList,
formObj: {
samplingNum: '',
taskNum: '',
source: '',
taskType: '',
proName: '',
proAddress: '',
proLicense: '',
proAddress: '',
proName: '',
proTel: '',
thirdPartyName: '',
thirdPartyAddress: '',
thirdPartyNature: '',
thirdPartyNatureRemark: '',
thirdPartyLicense: '',
thirdPartyTel: '',
testName: '',
testAddress: '',
testLinkman: '',
testTel: '',
testEmail: '',
testFax: '',
remark: '',
samplingDate:'',
testMembers:'',
testEmail:'',
},
nonNetTested: {
name: '',
testedProvince:'',
testedCity:'',
testedCountry:'',
address: '',
areaType: '',
areaTypeRemark: '',
permitType: '',
permitNum: '',
testedProvince: '',
testedCity: '',
testedCountry: '',
legalPerson: '',
linkman: '',
sales: '',
license: '',
linkman: '',
permitType: '',
permitNum: '',
tel: '',
fax: '',
postalCode: '',
placeLink: '',//保存时单独赋值 从place字段分离出
place: '', //保存时单独赋值 从place字段分离出
placeRemark: '' //保存时单独赋值 根据环节取对应的placeRemarkN
placeRemark: '' //保存时单独赋值 根据环节取对应的placeRemark
},
sample: {
name:'',
trademark: '',
qrcode: '',
firstClass:'',
secondClass:'',
thirdClass:'',
fourthClass:'',
type: '',
typeRemark: '',
source: '',
sourceRemark: '',
properties: '',
propertiesRemark: '',
type: '',
typeRemark: '',
name: '',
trademark: '',
dateType: '',
sampleDate:'',
standard: '',
batchNo: '',
sampleDate: '',
specification: '',
qualityGrade: '',
batchNo: '',
shelfLife: '',
standard: '',
qualityGrade: '',
price: '',
inward: '',
samplingBase: '',
quantity: '',
unit:'',
backupQuanity: '',
samplingMethod: '',
inward: '',
originPlace: '',
shape: '',
pack: '',
packClass: '',
storageCondition: [],
storageConditionRemark: ''
storageCondition: '',
storageConditionRemark: '',
sandDeadline: '',
sandAddress: '',
samplingMethod: '',
},
taskTypeList: ['监督抽检', '风险监测', '评价性抽检'],
areaTypeList: ['景点', '城市', '乡镇', '学校周边', '其他'],
taskTypeList: ['监督抽检', '风险监测'],
areaTypeList: ['城市', '乡村', '景点'],
permitTypeList: ['经营许可证号', '生产许可证号'],
sampleTypeList: ['食用农产品', '工业加工食品', '餐饮加工食品', '食品添加剂', '食品相关产品', '其他',],
sourceList: ['加工/自制', '委托生产', '外购', '其他'],
propertiesList: ['普通食品', '特殊食品', '节令食品', '重大活动保障食品', '其他',],
dateTypeList: ['生产日期', '购进日期', '加工日期', '检疫日期'],
dateTypeList: ['生产日', '加工日', '购进日'],
samplingMethodList: ['无菌抽样', '非无菌抽样'],
trueOrFalseList: [{label: '是', value: 1}, {label: '否', value: 0}],
packClassList: ['预包装', '非定量包装', '无包装'],
storageConditionList: ['常温', '冷藏', '冷冻', '避光', '密闭', '阴凉', '通风', '干燥', '其他'],
shapeList: ['固体', '半固体', '液体', '气体'],
packClassList: ['散装', '预包装'],
storageConditionList: ['常温', '冷藏', '冷冻', '避光', '密闭', '其他'],
thirdPartyNatureList: ['委托', '代理', '经销', '进口', '其他'],
packList: ['玻璃瓶', '塑料瓶', '塑料袋', '无菌袋', '其他'],
storageCondition:[],
storageCondition: [],
place: '', //1生产环节2流通环节3餐饮环节 值为“环节,地点”
placeRemark1: '',
placeRemark2: '',
placeRemark3: '',
proLinkList: ['原辅料库', '生产线', '半成品库', '成品库待检区', '成品库已检区', '其他'],
flowLinkList: ['农贸市场', '菜市场', '批发市场', '商场', '超市', '小食杂店', '其他'],
placeRemark2Readonly: true,
placeRemark3Readonly: true,
proLinkList: ['原辅料库', '生产线', '半成品库', '成品库待检区', '成品库已检区'],
flowLinkList: ['农贸市场', '菜市场', '批发市场', '商场', '超市', '小食杂店', '网购', '其他'],
restLinkList1: [
{label: '特大型餐馆', value: '餐馆(特大型餐馆)'},
{label: '大型餐馆', value: '餐馆(大型餐馆)'},
......@@ -929,15 +867,74 @@
{label: '企事业单位食堂', value: '食堂(企事业单位食堂)'},
{label: '建筑工地食堂', value: '食堂(建筑工地食堂)'},
],
restLinkList3: ['小吃店', '快餐店', '饮品店','集体用餐配送单位', '中央厨房', '其他'],
restLinkList3: ['小吃店', '快餐店', '饮品店', '集体用餐配送单位', '中央厨房', '其他'],
id: '',
testedType: this.$route.query.testedType,
shelfId: this.$route.query.shelfId
}
},
watch: {
'sample.type': function (val) {
if (val !== '' && val !== '其他') {
this.sample.typeRemark = ''
}
},
'sample.pack': function (val) {
if (val !== '' && val !== '其他') {
this.sample.packRemark = ''
}
},
'sample.source': function (val) {
if (val !== '' && val !== '其他') {
this.sample.sourceRemark = ''
}
},
'sample.properties': function (val) {
if (val !== '' && val !== '其他') {
this.sample.propertiesRemark = ''
}
},
'formObj.thirdPartyNature': function (val) {
if (val !== '' && val !== '其他') {
this.formObj.thirdPartyNatureRemark = ''
}
},
storageCondition: function (val) {
if (val !== '' && val !== '其他') {
this.sample.storageConditionRemark = ''
}
},
//抽样地点特殊处理
place: function (val) {
if (val !== '') {
let placeLink = val.split(',')[0]
let place = val.split(',')[1]
if (placeLink === '2') {
if (place === '其他') {
this.placeRemark2Readonly = false
} else {
this.placeRemark2 = ''
this.placeRemark2Readonly = true
}
} else if (placeLink === '3') {
if (place === '其他') {
this.placeRemark3Readonly = false
} else {
this.placeRemark3 = ''
this.placeRemark3Readonly = true
}
}
} else {
this.placeRemark2Readonly = true
this.placeRemark3Readonly = true
}
},
},
computed: {
areaObj:function(){
return this.nonNetTested.testedProvince+this.nonNetTested.testedCity+this.nonNetTested.testedCountry
areaObj: function () {
return this.nonNetTested.testedProvince + this.nonNetTested.testedCity + this.nonNetTested.testedCountry
}
},
mounted() {
......@@ -945,31 +942,88 @@
},
methods: {
_open() {
if (this.$route.query.id) {//编辑
this.id = this.$route.query.id
this._getData()
} else {//添加
this.id = ''
this._getLastTester()
}
},
_companySelect(type) {
switch (type) {
case 'nonNetTested.name':
this.$refs.tested._open()
break
case 'formObj.proName':
this.$refs.producter._open()
break
case 'formObj.testName':
this.$refs.tester._open()
break
}
},
_testerResult(res) {
this.formObj.testName = res.testName ? res.testName : ''
this.formObj.testAddress = res.testAddress ? res.testAddress : ''
this.formObj.testLinkman = res.testLinkman ? res.testLinkman : ''
this.formObj.testTel = res.testTel ? res.testTel : ''
this.formObj.testEmail = res.testEmail ? res.testEmail : ''
this.formObj.testFax = res.testFax ? res.testFax : ''
},
_producterResult(res) {
this.formObj.proName = res.proName ? res.proName : ''
this.formObj.proAddress = res.proAddress ? res.proAddress : ''
this.formObj.proLicense = res.proLicense ? res.proLicense : ''
this.formObj.proTel = res.proTel ? res.proTel : ''
},
_testedResult(res) {
this.nonNetTested.name = res.name ? res.name : ''
this.nonNetTested.testedProvince = res.testedProvince ? res.testedProvince : ''
this.nonNetTested.testedCity = res.testedCity ? res.testedCity : ''
this.nonNetTested.testedCountry = res.testedCountry ? res.testedCountry : ''
this.nonNetTested.address = res.address ? res.address : ''
this.nonNetTested.areaType = res.areaType ? res.areaType : ''
this.nonNetTested.permitType = res.permitType ? res.permitType : ''
this.nonNetTested.permitNum = res.permitNum ? res.permitNum : ''
this.nonNetTested.legalPerson = res.legalPerson ? res.legalPerson : ''
this.nonNetTested.linkman = res.linkman ? res.linkman : ''
this.nonNetTested.license = res.license ? res.license : ''
this.nonNetTested.tel = res.tel ? res.tel : ''
},
//获取最近填写的抽样单位信息
_getLastTester: async function () {
let result = await samplingSummary.lastTester()
if (result) {
this.formObj.testName = result.testName ? result.testName : ''
this.formObj.testAddress = result.testAddress ? result.testAddress : ''
this.formObj.testLinkman = result.testLinkman ? result.testLinkman : ''
this.formObj.testTel = result.testTel ? result.testTel : ''
this.formObj.testEmail = result.testEmail ? result.testEmail : ''
this.formObj.testFax = result.testFax ? result.testFax : ''
}
},
_getData: async function () {
let result = await samplingSummary.getById(this.id)
if (result) {
this._initData(result)
}
},
_initData(result) {
for (let key in this.formObj) {
if (result[key]!=='') {
if (key === 'samplingDate') {
if (result[key] !== '') {
if (key === 'sandDeadline') {
this.formObj[key] = result[key] ? this.$dateformat(result[key], 'yyyy-mm-dd') : ''
} else {
this.formObj[key] = result[key]
}
}
}
for(let key in this.nonNetTested){
if(result.nonNetTested[key]!==''){
for (let key in this.nonNetTested) {
if (result.nonNetTested[key] !== '') {
if (key === 'placeLink') {
this.place = result.nonNetTested.placeLink + ',' + result.nonNetTested.place
switch (result.nonNetTested.placeLink) {
case '1':
this.placeRemark1 = result.nonNetTested.placeRemark ? result.nonNetTested.placeRemark : ''
break
case '2':
this.placeRemark2 = result.nonNetTested.placeRemark ? result.nonNetTested.placeRemark : ''
break
......@@ -982,13 +1036,15 @@
}
}
}
for(let key in this.sample){
if(result.sample[key]!==''){
for (let key in this.sample) {
if (result.sample[key] !== '') {
if (key === 'sampleDate') {
this.sample[key] = result.sample[key] ? this.$dateformat(result.sample[key], 'yyyy-mm-dd') : ''
}else if(key==='storageCondition'){
this.storageCondition = result.sample[key].split(',')
this.sample[key] = result.sample[key]
} else if (key === 'sandDeadline') {
this.sample[key] = result.sample[key] ? this.$dateformat(result.sample[key], 'yyyy-mm-dd') : ''
} else if (key === 'storageCondition') {
this.storageCondition = result.sample[key] ? result.sample[key].split(',') : []
this.sample[key] = result.sample[key] ? result.sample[key] : ''
} else {
this.sample[key] = result.sample[key]
}
......@@ -996,16 +1052,68 @@
}
this.testedType = result.testedType
this.shelfId = result.shelfId
},
_valParams() {
if (this.formObj.samplingNum === '') {
this.$toast('请输入抽样单编号')
return true
}
if (this.sample.firstClass === '') {
this.$toast('请输入大类')
return true
}
if (this.sample.secondClass === '') {
this.$toast('请输入大亚类')
return true
}
if (this.sample.thirdClass === '') {
this.$toast('请输入次亚类')
return true
}
if (this.sample.fourthClass === '') {
this.$toast('请输入细类')
return true
}
return false
},
_goto(){
_goto() {
this.$router.go(-1)
},
_selectDate(type) {
this.selectDateType = type
this.showDatePicker = true
},
_dateConfirm(date) {
switch (this.selectDateType) {
case 'sample.sampleDate':
this.sample.sampleDate = this.$dateformat(date, 'yyyy-mm-dd')
break
case 'sample.sandDeadline':
this.sample.sandDeadline = this.$dateformat(date, 'yyyy-mm-dd')
break
}
this.showDatePicker = false
},
_areaConfirm(value) {
this.nonNetTested.testedProvince = value[0].name
this.nonNetTested.testedCity = value[1].name
this.nonNetTested.testedCountry = value[2].name
this.showCityPicker = false
},
_getSample: async function () {
if (this.sample.qrcode && this.id === '') {
let res = await samplingSample.scanSample({qrcode: this.sample.qrcode})
if (res) {
this._scanResult(res)
}
}
},
}
}
</script>
<style lang="less">
@import "../../styles/sampling-list-add.less";
@import "../../styles/sampling-list-add.less";
</style>
......@@ -10,14 +10,14 @@
:close-on-popstate="true"
:style="{ height: '70%' }">
<div class="popup-cont-btn popup-shelves">
<div>
<p>抽样单类型</p>
<van-radio-group v-model="radio" direction="horizontal">
<van-radio :name="1">网络</van-radio>
<van-radio :name="0">非网络</van-radio>
<van-radio :name="2">农产品</van-radio>
</van-radio-group>
</div>
<!-- <div>-->
<!-- <p>抽样单类型</p>-->
<!-- <van-radio-group v-model="radio" direction="horizontal">-->
<!-- <van-radio :name="1">网络</van-radio>-->
<!-- <van-radio :name="0">非网络</van-radio>-->
<!-- <van-radio :name="2">农产品</van-radio>-->
<!-- </van-radio-group>-->
<!-- </div>-->
<div>
<p>所属货架</p>
<van-tree-select
......@@ -44,7 +44,7 @@
data() {
return {
showPopup: false,
radio: -1,
radio: 0,
places: [
{
text: '地点1',
......@@ -94,7 +94,7 @@
methods: {
_open(planId) {
this.showPopup = true
this.radio = -1
this.radio = 0
this.activeId = ''
this.planId = planId
this._getShelves()
......
......@@ -98,6 +98,11 @@ export default {
},
_create: async function () {
if (this.count) {
this.$toast.loading({
duration: 0,
message: '随机生成中...',
forbidClick: true,
});
let result = await samplingPlan.generateSampler({count: this.count, planId: this.planId})
if (result) {
this.$toast('生成成功!')
......@@ -142,6 +147,11 @@ export default {
},
_locCreate: async function () {
if (this.locCount) {
this.$toast.loading({
duration: 0,
message: '随机生成中...',
forbidClick: true,
});
let result = await samplingPlan.generatePlace({count: this.locCount, planId: this.planId})
if (result) {
this.$toast('生成成功!')
......
......@@ -94,8 +94,14 @@ export default {
},
_create: async function () {
if (this.count) {
this.$toast.loading({
duration: 0,
message: '随机生成中...',
forbidClick: true,
});
let result = await samplingPlan.generateSampler({count: this.count, planId: this.planId})
if (result) {
// this.$toast.clear();
this.$toast('生成成功!')
this.userList = result
}
......@@ -138,8 +144,14 @@ export default {
},
_locCreate: async function () {
if (this.locCount) {
this.$toast.loading({
duration: 0,
message: '随机生成中...',
forbidClick: true,
});
let result = await samplingPlan.generatePlace({count: this.locCount, planId: this.planId})
if (result) {
// this.$toast.clear();
this.$toast('生成成功!')
this.locList = result
}
......
......@@ -17,7 +17,7 @@ export default [
{path: 'sampling_list_add', component: SamplingListAdd, meta: {customerNavBarTitle: true}},
{path: 'sampling_list_add_agriculture', component: SamplingListAddAgriculture, meta: {customerNavBarTitle: true}},
{path: 'sampling_list_add_net', component: SamplingListAddNet, meta: {customerNavBarTitle: true}},
{path: 'sampling_list_detail', component: SamplingListDetail, meta: {title: '抽样单详情-非网络'}},
{path: 'sampling_list_detail', component: SamplingListDetail, meta: {title: '抽样单详情'}},
{path: 'sampling_list_detail_agriculture', component: SamplingListDetailAgriculture, meta: {title: '抽样单详情-农产品'}},
{path: 'sampling_list_detail_net', component: SamplingListDetailNet, meta: {title: '抽样单详情-网络'}},
{path: 'file', component: File, meta: {title: '附件'}},
......
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