123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017 |
- <template>
- <view class="page">
- <view class="DrawerPage" :class="modalName=='DrawerModalL'?'show':''">
- <scroll-view scroll-y style="height: 100vh;z-index: 3">
- <cu-custom class="home-custom" bgColor=".bg-sancolor"
- bgImage="https://ahwgh.oss-cn-hangzhou.aliyuncs.com/enterprise/6525f808df760.png"
- :isBack="true">
- <block slot="content">填报抽样单</block>
- </cu-custom>
- <view :style="'z-index:2;position: sticky;top:calc('+CustomBar+'px - 80rpx)' ">
- <view class="cu-list menu">
- <view class="cu-item" style="min-height: 80rpx">
- <view class="content">
- <text class="cuIcon-formfill text-black lg"></text>
- <text class="text-black">编号:{{ sampleDetailInfo.samplingNumber }}</text>
- </view>
- </view>
- </view>
- <view class="bg-white nav solid-bottom">
- <view class="flex text-center">
- <view class="cu-item flex-sub" :class="pageIndex === 0?'text-blue cur':''"
- @tap="pageIndex = 0">
- 抽样单信息
- </view>
- <view class="cu-item flex-sub" :class="pageIndex === 1?'text-blue cur':''"
- @tap="pageIndex = 1">
- 抽样填报
- </view>
- <view class="cu-item flex-sub" :class="pageIndex === 2?'text-blue cur':''"
- @tap="pageIndex = 2">
- 现场照片
- </view>
- </view>
- </view>
- </view>
- <view style="padding-bottom: 180rpx;">
- <!--基本信息-->
- <view v-show="pageIndex === 0">
- <view class="cu-list menu">
- <view class="cu-bar bg-white margin-top-sm solid-bottom">
- <view class="action">
- <text class="cuIcon-titles text-green"></text>
- <text>被抽查单位信息</text>
- </view>
- </view>
- <form>
- <view class="cu-form-group">
- <view class="title">单位名称</view>
- <view>
- {{ sampleDetailInfo.bySampleUnitName}}
- </view>
- <!-- <input :disabled="input_diabled" placeholder="请输入单位名称" name="input"
- v-model="sampleDetailInfo.bySampleUnitName"></input>-->
- </view>
- <view class="cu-form-group ">
- <view class="title">单位地址</view>
- <input placeholder="请输入单位地址"
- name="input"
- v-model="sampleDetailInfo.bySampleAddress" disabled></input>
- </view>
- <view class="cu-form-group ">
- <view class="title">联系人</view>
- <input placeholder="请输入联系人" name="input"
- v-model="sampleDetailInfo.bySampleContactName" disabled></input>
- </view>
- <view class="cu-form-group ">
- <view class="title">电话</view>
- <input placeholder="请输入电话" name="input"
- v-model="sampleDetailInfo.bySampleContactPhone" disabled></input>
- </view>
- </form>
- <view class="cu-bar bg-white margin-top-sm solid-bottom">
- <view class="action">
- <text class="cuIcon-titles text-green"></text>
- <text>抽样单位信息</text>
- </view>
- </view>
- <form>
- <view class="cu-form-group">
- <view class="title">单位名称</view>
- <input placeholder="请输入单位名称" name="input"
- v-model="sampleDetailInfo.sampleUnitName" disabled></input>
- </view>
- <view class="cu-form-group ">
- <view class="title">单位地址</view>
- <input placeholder="请输入单位地址" name="input"
- v-model="sampleDetailInfo.sampleAddress" disabled></input>
- </view>
- <view class="cu-form-group ">
- <view class="title">联系人</view>
- <input placeholder="请输入联系人" name="input"
- v-model="sampleDetailInfo.sampleContactName" disabled></input>
- </view>
- <view class="cu-form-group">
- <view class="title">电话</view>
- <input placeholder="请输入电话" name="input"
- v-model="sampleDetailInfo.sampleContactPhone" disabled></input>
- </view>
- <view class="cu-form-group align-start">
- <view class="title">备注</view>
- <textarea placeholder="请输入抽样备注" name="input"
- v-model="sampleDetailInfo.samplingMask" :disabled="input_diabled"></textarea>
- </view>
- </form>
- <!-- <view class="padding flex flex-direction">
- <button class="cu-btn bg-green lg" @tap="toSampleInfoList(sampleDetailInfo.id)">管理样品
- </button>
- </view>-->
- <!-- <view class="padding flex flex-direction">
- <!– <button class="cu-btn bg-green lg shadow-blur" @tap="saveSampleInfoList">保存</button>–>
- <button class="cu-btn bg-green lg shadow-blur" @tap="pageIndex = 1">填报抽样信息</button>
- </view>-->
- </view>
- </view>
- <view v-show="pageIndex === 1">
- <view class="cu-bar bg-white margin-top-sm solid-bottom">
- <view class="action">
- <text class="cuIcon-titles text-green"></text>
- <text>抽样基地信息</text>
- </view>
- </view>
- <form>
- <view class="cu-form-group">
- <view class="title">基地名称</view>
- <picker @tap="showBaseSelect" @change="baseSelectChange" :value="baseSelectIndex" :range="baseSelectList" :disabled="disabledBaseSelect">
- <view class="picker">
- {{ baseSelectList[baseSelectIndex] || "请选择抽样地点" }}
- </view>
- </picker>
- </view>
- <view class="cu-form-group">
- <view class="title">抽样地点</view>
- <input placeholder="请选择抽样地点" name="input"
- v-model="sampleDetailInfo.samplingAddress" disabled></input>
- </view>
- </form>
- <view class="cu-bar bg-white margin-top-sm solid-bottom">
- <view class="action">
- <text class="cuIcon-titles text-green"></text>
- <text>抽样信息</text>
- </view>
- <view class="action">
- <button class="cu-btn bg-green" type="" @tap="addSampleProduct" v-if="!input_diabled"> 增加样品</button>
- </view>
- </view>
- <view class="padding-sm">
- <view class="cu-list menu bg-white"
- v-for="(item, index) in ahSampleDetailList" :key="index">
- <view class="cu-item">
- <view class="title text-black text-bold text-lg">
- <text class="cuIcon-titles text-green"></text>
- {{ index + 1 }}.{{ item.name }}
- </view>
- <view class="action">
- {{ item.samplingDate }}
- </view>
- </view>
- <view class="content detail padding-sm solid-bottom">
- <div class="text-gray">样品来源:{{ item.source }}</div>
- <div class="text-gray">抽样数量:{{ item.samplingNumber }}{{ item.samplingType }}</div>
- <div class="text-gray">抽样基数:{{ item.samplingBase }}{{ item.samplingType }}</div>
- <div class="text-gray">生产日期:{{ item.manufactureDate }}</div>
- </view>
- <view class="tools padding-sm" v-if="!input_diabled">
- <view @tap="delSampleDetail(item.id)">
- <view class="cu-tag radius line-red padding-lr-sl">
- <text class="cuIcon-deletefill text-lg padding-right-xs"></text>
- 删除
- </view>
- </view>
- <view class="tool"
- @tap="editSampleDetail(index)">
- <view class="cu-tag bg-blue light text-df text-bold">
- <text class="cuIcon-edit text-lg padding-right-xs"></text>
- 修改
- </view>
- </view>
- </view>
- </view>
- <view class="radius shadow-warp bg-white text-lg" v-if="ahSampleDetailList.length === 0">
- <view class="cu-list menu-avatar">
- <view class="cu-item">
- <view class="content">
- <view class="text-sm text-center" style="justify-content: center;">
- <text class="text-cut text-lg">
- <text class="cuIcon-warn text-yellow margin-right-xs text-xl"></text>
- 未查询到样本数据
- </text>
- </view>
- </view>
- </view>
- </view>
- </view>
- </view>
- </view>
- <view v-show="pageIndex === 2">
- <view class="cu-list menu">
- <view class="cu-form-group margin-top-sm">
- <view class="title">同行抽检员</view>
- <picker :disabled="true" @tap="showSecondCyUserChoose">
- <view class="picker">
- {{ sampleDetailInfo.samplingPeopleSecond || '请选择' }}
- </view>
- </picker>
- </view>
- <view class="cu-bar bg-white margin-top-sm solid-bottom">
- <view class="action">
- <text class="cuIcon-titles text-green"></text>
- <text>抽样单照片</text>
- </view>
- </view>
- <view class="cu-form-group">
- <view class="grid col-3 grid-square flex-sub">
- <view class="bg-img" @tap="ViewImage(photo.sampleSheetPhoto)" v-if="photo.sampleSheetPhoto">
- <image :src='photo.sampleSheetPhoto' mode='aspectFill'></image>
- <view class="cu-tag bg-red" @tap="DelImg('sampleSheetPhoto')">
- <text class="cuIcon-close"></text>
- </view>
- </view>
- <view class="solids" @tap="ChooseImage('sampleSheetPhoto')" v-if="!photo.sampleSheetPhoto">
- <text class="cuIcon-cameraadd"></text>
- </view>
- </view>
- </view>
- <view class="cu-bar bg-white margin-top-sm solid-bottom">
- <view class="action">
- <text class="cuIcon-titles text-green"></text>
- <text>封样照片</text>
- </view>
- </view>
- <view class="cu-form-group">
- <view class="grid col-3 grid-square flex-sub">
- <view class="bg-img" @tap="ViewImage(photo.sealingPhoto)" v-if="photo.sealingPhoto">
- <image :src='photo.sealingPhoto' mode='aspectFill'></image>
- <view class="cu-tag bg-red" @tap="DelImg('sealingPhoto')">
- <text class="cuIcon-close"></text>
- </view>
- </view>
- <view class="solids" @tap="ChooseImage('sealingPhoto')" v-if="!photo.sealingPhoto">
- <text class="cuIcon-cameraadd"></text>
- </view>
- </view>
- </view>
- <view class="cu-bar bg-white margin-top-sm solid-bottom">
- <view class="action">
- <text class="cuIcon-titles text-green"></text>
- <text>抽样人员合影照片</text>
- </view>
- </view>
- <view class="cu-form-group">
- <view class="grid col-3 grid-square flex-sub">
- <view class="bg-img" @tap="ViewImage(photo.groupPhoto)" v-if="photo.groupPhoto">
- <image :src='photo.groupPhoto' mode='aspectFill'></image>
- <view class="cu-tag bg-red" @tap="DelImg('groupPhoto')">
- <text class="cuIcon-close"></text>
- </view>
- </view>
- <view class="solids" @tap="ChooseImage('groupPhoto')" v-if="!photo.groupPhoto">
- <text class="cuIcon-cameraadd"></text>
- </view>
- </view>
- </view>
- </view>
- </view>
- <view class="padding flex flex-direction padding-bottom-xl fixedFootBtn bg-white padding-top-xs" v-if="!sampleDetailInfo.filledPeopleId">
- <button class="cu-btn bg-blue lg margin-top-sm shadow-blur" type="" v-if="!input_diabled" :disabled="!disabledBaseSelect"
- @tap="publishSampleSheet">上报抽样单
- </button>
- </view>
- </view>
- </scroll-view>
- </view>
- <view class="cu-modal bottom-modal" :class="modalName==='addSimpleInfo'?'show':''" @tap="hideModal">
- <view class="cu-dialog btDialog padding-bottom-lg" @tap.stop.prevent>
- <view class="cu-bar bg-white padding-lr solid-bottom">
- <view></view>
- <view class="action text-orange" @tap="hideModal">关闭</view>
- </view>
- <!-- <view class="box">
- <view class="cu-bar justify-center bg-white">
- <view class="action sub-title">
- <text class="text-xl text-bold text-blue">添加样品</text>
- <text class="text-ABC text-blue">sample</text>
- <!– last-child选择器–>
- </view>
- </view>
- </view>-->
- <view class="padding-lr bg-white">
- <view class="cu-form-group">
- <view class="title">样品名称</view>
- <picker @change="productSelectChange" data-target="name" :value="ahSampleDetail.name"
- :range="productList">
- <view class="picker">
- {{ ahSampleDetail.name || "请选择样品名称" }}
- </view>
- </picker>
- </view>
- <view class="cu-form-group">
- <view class="title">样品来源</view>
- <radio-group class="block" @change="sourceTypeChange">
- <view>
- <checkbox class="radio" id="zc" :value="1" :checked="''+sourceType === '1'"></checkbox>
- <label class="title margin-left-sm" for="zc">自产</label>
- <checkbox class="radio" id="qt" :value="2" :checked="''+sourceType === '2'"></checkbox>
- <label class="title margin-left-sm" for="qt">其他</label>
- </view>
- </radio-group>
- </view>
- <view class="cu-form-group" v-show="''+sourceType === '2'">
- <view class="title">详细地址</view>
- <input placeholder="请输入详细地址" type="text" v-model="ahSampleDetail.source">
- </view>
- <view class="cu-form-group">
- <view class="title">抽样日期</view>
- <picker mode="date" :value="ahSampleDetail.samplingDate" data-target="samplingDate"
- start="2000-01-01" :end="nowDate" @change="dateChange">
- <view class="picker">
- {{ ahSampleDetail.samplingDate || "请选择抽样日期" }}
- </view>
- </picker>
- </view>
- <view class="cu-form-group">
- <view class="title">抽样数量</view>
- <input placeholder="请输入抽样数量" type="digit" v-model="ahSampleDetail.samplingNumber">
- </view>
- <view class="cu-form-group">
- <view class="title">抽样基数</view>
- <input placeholder="请输入抽样基数" type="digit" v-model="ahSampleDetail.samplingBase">
- </view>
- <view class="cu-form-group">
- <view class="title">样品单位</view>
- <picker @change="unitChange" data-target="samplingType" :value="ahSampleDetail.samplingType"
- :range="dictTypeList">
- <view class="picker">
- {{ ahSampleDetail.samplingType || "请选择样品单位" }}
- </view>
- </picker>
- </view>
- <view class="cu-form-group solid-bottom">
- <view class="title">生产日期</view>
- <picker mode="date" :value="ahSampleDetail.manufactureDate" data-target="manufactureDate"
- start="2000-01-01" :end="nowDate" @change="dateChange">
- <view class="picker">
- {{ ahSampleDetail.manufactureDate || "请选择生产日期" }}
- </view>
- </picker>
- </view>
- <view class="padding flex flex-direction">
- <button class="cu-btn bg-blue lg margin-tb-sm shadow-blur text-lg"
- @click="createAhSampleDetail">保存
- </button>
- <!-- <button class="cu-btn line-red lg shadow-blur text-lg" @tap="hideModal">取消</button>-->
- </view>
- </view>
- </view>
- </view>
- <view class="cu-modal bottom-modal" :class="modalName==='userListModal'?'show':''">
- <view class="cu-dialog" @tap.stop.prevent>
- <view class="cu-bar bg-white">
- <view class="action text-blue" @tap="hideModal">取消</view>
- <view class="content text-bold">选择抽样人员</view>
- </view>
- <view class="bg-white">
- <view class="cu-bar search bg-white">
- <view class="search-form radius text-left">
- <text class="cuIcon-search"></text>
- <input type="text" placeholder="输入样品名称搜索" confirm-type="search"
- v-model="queryUserName" />
- <text class="cuIcon cuIcon-close endClass text-xxl text-bold" @tap="resetQymcQuery"
- v-show="queryUserName !== ''"></text>
- </view>
- <view class="action"><!-- 全部的按钮 -->
- <button class="cu-btn bg-green shadow-blur round" @tap="searchProduct">搜索</button>
- </view>
- </view>
- <scroll-view scroll-y class="productScroll padding" @scrolltolower="getCyUserList">
- <radio-group @change="cyUserChange" style="width: 100%">
- <view class="flex flex-wrap text-left">
- <view class="basis-df padding-xs text-left" v-for="(item,index) in cyUserList"
- :key="index">
- <checkbox :value="item.id" class="radio" :id="'productName'+index"
- :checked="sampleDetailInfo.samplingPeopleSecondId === item.id"></checkbox>
- <label :for="'productName'+index">{{ item.name }}</label>
- </view>
- </view>
- </radio-group>
- </scroll-view>
- </view>
- </view>
- </view>
- </view>
- </template>
- <script>
- import { _sampleDetail } from "./sample-detail-model.js";
- export default {
- data() {
- return {
- CustomBar: this.CustomBar,
- pageIndex: 0,
- photo: {
- sampleSheetPhoto: null,
- sealingPhoto: null,
- groupPhoto: null,
- },
- basicsList: [{
- icon: "usefullfill",
- name: "开始"
- }, {
- icon: "formfill",
- name: "检查信息"
- }],
- sampleDetailInfo: {},
- regionArray: [],
- regionIndex: [],
- xzqObjList: [],
- queryXzq: "请选择",
- queryXzqdm: "",
- input_diabled: false,
- modalName: null,
- pageNum: 1,
- pageSize: 100,
- pageTotal: 1,
- cyUserList:[],
- enterprisesName: null,
- qyList: [],
- ahSampleDetail: {},
- nowDate: null,
- dictTypeList: [],
- baseList: [], //基地列表
- baseSelectList: [],
- baseSelectIndex: 0,
- productList: [],
- serviceProductList: [],
- productIndex: 0,
- sourceType: null, //样品来源类型
- ahSampleDetailList: [],
- userinfo:{},
- id:null,
- queryUserName:""
- };
- },
- onLoad(options) {
- this.id = options.id;
- this.userinfo = uni.getStorageSync("userInfo");
- const now = new Date();
- this.nowDate = now.getFullYear() + "-" + ("" + (now.getMonth())).padStart(2, "0") + "-" + ("" + now.getDate()).padStart(2, "0");
- this.getDictTypeList();
- this.getCyUserList();
- this.getSampleInfoDetail(this.id);
- },
- computed:{
- disabledBaseSelect(){
- return this.ahSampleDetailList.length >= 1
- }
- },
- methods: {
- ChooseImage(name) {
- uni.chooseImage({
- count: 1, //默认9
- sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
- sourceType: ['album'], //从相册选择
- success: (res) => {
- uni.showLoading({
- title: '图片上传中'
- })
- _sampleDetail.uploadPhoto(res.tempFilePaths[0], res => {
- const {code, data, message} = JSON.parse(res);
- uni.hideLoading()
- if (code === 200) {
- this.$set(this.photo,name,data);
- } else {
- this.$msg(message);
- }
- console.log(this.photo);
- })
- }
- });
- },
- ViewImage(url) {
- uni.previewImage({
- urls: [url],
- current: url
- });
- },
- DelImg(name) {
- uni.showModal({
- title: '图片删除',
- content: '确定要删除图片吗?',
- cancelText: '取消',
- confirmText: '确认',
- success: res => {
- if (res.confirm) {
- this.photo[name] = null
- }
- }
- })
- },
- showBaseSelect(){
- if(this.ahSampleDetailList.length >= 1){
- this.$msg("已上传抽样样品,基地信息不可修改")
- return
- }
- },
- addSampleProduct(){
- if(!this.sampleDetailInfo.baseNumber){
- this.$msg("请选择检查基地");
- } else {
- if(this.ahSampleDetailList.length >= 3){
- this.$msg("一个抽样单最多仅可添加3个样本");
- return
- }
- this.modalName = 'addSimpleInfo'
- }
- },
- getSubXzqList(xzqdm) {
- return new Promise(resolve => {
- _sampleDetail.getSubXzqList(xzqdm, res => {
- resolve(res);
- });
- });
- },
- /**
- * 获取单位选项
- */
- getDictTypeList() {
- _sampleDetail.getDictTypeList(res => {
- const { code, data: { records } } = res;
- if (code === 200) {
- this.dictTypeList = records.map(v => v.type);
- } else {
- this.$msg("单位获取失败");
- }
- });
- },
- /**
- * 样品单位改变
- * @param e
- */
- unitChange(e) {
- this.setDateHandle(this.ahSampleDetail, "samplingType", this.dictTypeList[e.detail.value]);
- },
- /**
- * 样品名称选择
- * @param e
- */
- productSelectChange(e) {
- // this.ahSampleDetail.name = ;
- const index = e.detail.value;
- if(index >= 1){
- this.setDateHandle(this.ahSampleDetail, "name", this.serviceProductList[index].productName);
- }else{
- this.setDateHandle(this.ahSampleDetail, "name", null);
- }
- },
- /**
- * 日期选择回调
- * @constructor
- */
- dateChange(e) {
- const { target } = e.currentTarget.dataset;
- const value = e.detail.value;
- if (this.ahSampleDetail.hasOwnProperty(target)) {
- this.ahSampleDetail[target] = value;
- } else {
- this.$set(this.ahSampleDetail, target, value);
- }
- },
- /**
- * 样品来源类型选择
- * @param e
- */
- sourceTypeChange(e) {
- this.sourceType = e.detail.value;
- },
- /**
- * 基地选择回调
- */
- baseSelectChange(e) {
- const value = e.detail.value;
- if ("" + value !== "0") {
- this.baseSelectIndex = value;
- const base = this.baseList[value];
- this.sampleDetailInfo.samplingAddress = base.city + base.county + base.towns + base.village;
- this.sampleDetailInfo.baseNumber = base.baseNumber;
- this.getProductBatchList(base);
- } else {
- this.$msg("请选择地址");
- this.sampleDetailInfo.samplingAddress = "";
- }
- },
- getSampleInfoDetail(id) {
- _sampleDetail.getAhSampleSheetDetail(id, res => {
- const {code,data,message} = res;
- if(code === 200){
- this.sampleDetailInfo = res.data.ahSampleSheet;
- this.sampleDetailInfo.sampleUnitName = this.sampleDetailInfo.sampleUnitName || res.data.AhZoneSampleCheck.checkUnitName;
- this.sampleDetailInfo.sampleAddress = this.sampleDetailInfo.sampleAddress || res.data.AhDictCheck.address;
- this.sampleDetailInfo.sampleId =this.sampleDetailInfo.sampleId || res.data.AhZoneSampleCheck.checkId;
- this.sampleDetailInfo.sampleContactName = this.sampleDetailInfo.sampleContactName || this.userinfo.name;
- this.sampleDetailInfo.sampleContactPhone =this.sampleDetailInfo.sampleContactPhone || res.data.AhDictCheck.phone;
- this.photo.groupPhoto = this.sampleDetailInfo.groupPhoto;
- this.photo.sealingPhoto = this.sampleDetailInfo.sealingPhoto;
- this.photo.sampleSheetPhoto = this.sampleDetailInfo.sampleSheetPhoto;
- const status = this.sampleDetailInfo.sampleStatus;
- const filledPeopleId = this.sampleDetailInfo.filledPeopleId;
- const commitPeopleId = this.sampleDetailInfo.commitPeopleId;
- // this.submitSampleSheet();
- if((filledPeopleId && this.userinfo.id !== filledPeopleId) || commitPeopleId){
- this.input_diabled = true;
- }
- if(this.sampleDetailInfo.qydm){
- //加载主体的基地信息
- this.getBaseByCheckList(this.sampleDetailInfo.qydm);
- //加载产品信息
- if(this.sampleDetailInfo.baseNumber){
- this.getProductBatchList({
- qydm: this.sampleDetailInfo.qydm,
- baseNumber: this.sampleDetailInfo.baseNumber
- });
- }
- }
- //status === "SAMPLE_FILLED" ||
- /*if (status === "SAMPLE_REPORT" || status === "CHECK_REPORT") {
- this.input_diabled = true;
- } else {
- this.input_diabled = false;
- }*/
- //查询抽样样品信息
- this.getSampleSheetDetailData();
- }else{
- this.$msg(message);
- this.input_diabled = true;
- }
- });
- },
- saveSampleInfoList() {
- _sampleDetail.updateAhSampleSheet(this.sampleDetailInfo, res => {
- const { code, message } = res;
- if (code !== 200) {
- this.$msg(message);
- }
- });
- },
- publishSampleSheet(){
- if(!this.ahSampleDetailList.some(v=>v.name === this.sampleDetailInfo.mustProductName)){
- this.$msg("抽样样本必须包含"+this.sampleDetailInfo.mustProductName);
- return
- }
- if (!this.sampleDetailInfo.samplingPeopleSecondId) {
- this.$msg("请选择同行抽样人员");
- return
- }
- if (!this.photo.sampleSheetPhoto) {
- this.$msg("请上传抽样单照片");
- return
- }
- if (!this.photo.sealingPhoto) {
- this.$msg("请上传封样照片");
- return
- }
- if (!this.photo.groupPhoto) {
- this.$msg("请上传抽样人员合影照片");
- return
- }
- const data = Object.assign(this.sampleDetailInfo, this.photo);
- uni.showModal({
- title: "提示",
- content: "确定上报当前抽样单",
- cancelText: "取消",
- confirmText: "确认",
- success: res => {
- if (res.confirm) {
- _sampleDetail.uploadCheckPhoto(data, res => {
- const {code, message} = res;
- if (code === 200) {
- _sampleDetail.publishSampleSheet(this.sampleDetailInfo.id,saveRes=>{
- const {code,message} = saveRes;
- if(code === 200){
- this.$msg("上报成功");
- setTimeout(()=>{
- uni.navigateBack({
- delta: 1
- });
- },1500)
- } else {
- this.$msg(message);
- }
- })
- }else{
- this.$msg(message);
- }
- });
- }
- }})
- },
- submitSampleSheet(){
- uni.showModal({
- title: "提示",
- content: "确认完成当前抽样单",
- cancelText: "取消",
- confirmText: "确认",
- success: res => {
- if (res.confirm) {
- _sampleDetail.submitSampleSheet(this.sampleDetailInfo.id,res=>{
- const {code,message} = res;
- if(code === 200){
- this.$msg("确认成功");
- setTimeout(()=>{
- uni.navigateBack({
- delta: 1
- });
- },1500)
- } else {
- this.$msg(message);
- }
- })
- }
- }})
- },
- /**
- * 新增样品信息
- */
- createAhSampleDetail() {
- if(this.ahSampleDetailList.length <= 0){
- this.saveSampleInfoList();
- }
- const ahSampleDetail = this.ahSampleDetail;
- if(!ahSampleDetail.name){
- this.$msg("请选择抽样产品");
- return
- }
- if(this.ahSampleDetailList.filter(v=>v.name === ahSampleDetail.name).length >= 2){
- this.$msg("同一产品最多可抽2个样");
- return
- }
- ahSampleDetail.sampleSheetId = this.sampleDetailInfo.id;
- if (!this.sourceType) {
- this.$msg("请选择样品来源");
- return false;
- }
- if ("" + this.sourceType === "1") {
- ahSampleDetail.source = "自产";
- }
- if ("" + this.sourceType !== "1" && !ahSampleDetail.source) {
- this.$msg("请输入来源详细地址");
- return false;
- }
- if (ahSampleDetail.hasOwnProperty("id")) {
- _sampleDetail.updateAhSampleDetail(this.ahSampleDetail, res => {
- const { code, message } = res;
- if (code === 200) {
- this.$msg("保存成功");
- this.modalName = null;
- this.getSampleSheetDetailData();
- this.ahSampleDetail= {};
- } else {
- this.$msg(message);
- }
- });
- } else {
- _sampleDetail.createAhSampleDetail(this.ahSampleDetail, res => {
- const { code, message } = res;
- if (code === 200) {
- this.$msg("保存成功");
- this.modalName = null;
- this.getSampleSheetDetailData();
- this.ahSampleDetail= {};
- } else {
- this.$msg(message);
- }
- });
- }
- },
- hideModal(e) {
- this.modalName = null;
- },
- getBaseByCheckList(qydm) {
- _sampleDetail.getBaseByCheckList(qydm, res => {
- const {data} = res;
- if (data.length === 0) {
- this.$msg("该主体未上报基地信息");
- } else {
- data.unshift({
- baseNumber: "",
- baseName: "请选择"
- });
- this.baseList = data;
- this.baseSelectList = data.map(v => v.baseName);
- if (this.sampleDetailInfo.qydm === qydm && !!this.sampleDetailInfo.baseNumber) {
- this.baseSelectIndex = data.findIndex(v => v.baseNumber === this.sampleDetailInfo.baseNumber);
- if (this.baseSelectIndex < 0) this.baseSelectIndex = 0;
- }
- }
- });
- },
- /**
- * 根据主体和基地查询产品列表
- */
- getProductBatchList({ qydm, baseNumber }) {
- _sampleDetail.getProductBatchList({ qydm, baseNumber }, res => {
- const {data} = res;
- if (data.length === 0) {
- this.$msg("该基地未上传产品信息");
- } else {
- this.productList = data.map(v => v.productName+"("+v.batchId+")");
- this.productList.unshift("请选择");
- this.serviceProductList = data;
- this.serviceProductList.unshift({
- pproductName:"请选择"
- });
- }
- });
- },
- setDateHandle(data, target, value) {
- if (data.hasOwnProperty(target)) {
- data[target] = value;
- } else {
- this.$set(data, target, value);
- }
- },
- getSampleSheetDetailData() {
- _sampleDetail.getSampleSheetDetailData({
- sampleSheetId: this.sampleDetailInfo.id,
- pageNum: 1,
- pageSize: 100
- }, res => {
- const { code, message, data: { records } } = res;
- if (code === 200) {
- this.ahSampleDetailList = records;
- } else {
- this.$msg(message);
- }
- });
- },
- /**
- * 删除抽样样品
- * @param id
- * @param callBack
- */
- delSampleDetail(id) {
- uni.showModal({
- title: "提示",
- content: "确定要删除当前样本么",
- cancelText: "取消",
- confirmText: "确认",
- success: res => {
- if (res.confirm) {
- _sampleDetail.delSampleDetail(id, res => {
- const {code,message} = res;
- if(code === 200){
- this.getSampleSheetDetailData();
- }else{
- this.$msg(message);
- }
- });
- }
- }
- });
- },
- editSampleDetail(index) {
- this.ahSampleDetail = this.ahSampleDetailList[index];
- if (this.ahSampleDetail.source !== "自产") {
- this.sourceType = "2";
- } else {
- this.sourceType = "1";
- }
- this.modalName = "addSimpleInfo";
- },
- showSecondCyUserChoose() {
- this.sampleDetailInfo.samplingPeopleSecond = null;
- this.modalName = "userListModal";
- },
- cyUserChange(e){
- const peopleId = e.detail.value;
- if (peopleId) {
- const person = this.cyUserList.find(v=>v.id === peopleId);
- this.sampleDetailInfo.samplingPeopleSecond = person.name;
- this.sampleDetailInfo.samplingPeopleSecondId = person.id;
- this.modalName = null;
- }else{
- this.sampleDetailInfo.samplingPeopleSecond = null;
- this.sampleDetailInfo.samplingPeopleSecondId = null;
- }
- },
- searchProduct() {
- this.pageNum = 1;
- this.pageTotal = 1;
- this.getCyUserList();
- },
- resetQymcQuery() {
- this.queryUserName = "";
- this.pageNum = 1;
- this.pageTotal = 1;
- this.getCyUserList();
- },
- getCyUserList() {
- if (this.pageNum === 1 || (this.pageNum <= this.pageTotal)) {
- _sampleDetail.getCyUserList({
- pageNum: this.pageNum,
- pageSize: this.pageSize,
- name: this.queryUserName
- }, res => {
- const { data, message, code } = res;
- if (code === 200) {
- this.cyUserList = data;
- /*const { list, total } = data;
- this.totalCount = total;
- this.pageTotal = Math.ceil(total / this.pageSize);
- if (this.pageNum === 1) {
- this.cyUserList = list;
- } else {
- this.cyUserList = this.cyUserList.concat(list);
- }
- this.pageNum++;*/
- } else {
- uni.showToast({
- icon: "none",
- title: message,
- duration: 1000
- });
- }
- });
- }
- },
- }
- };
- </script>
- <style scoped>
- .page {
- /*background-image: var(--gradualBlue);*/
- background-image: linear-gradient(45deg, #0081ff, #1cbbb4);
- width: 100vw;
- overflow: hidden;
- }
- .DrawerPage .nav .cu-item.cur {
- border-bottom: 4rpx solid;
- }
- .DrawerPage .nav .cu-item.cur::after {
- content: none;
- }
- /*.nav .cu-item{
- height: 70rpx;
- line-height: 70rpx;
- }*/
- .cu-modal.drawer-modal .cu-dialog {
- min-width: 85vw;
- }
- .btDialog {
- min-height: 80vh;
- }
- .detail view {
- height: 1.8em;
- line-height: 1.8em !important;
- border: none;
- color: gray;
- }
- label {
- padding-left: .5em;
- }
- .productScroll {
- height: 30em;
- max-height: 60vh;
- }
- .tools {
- display: flex;
- align-items: center;
- justify-content: space-between;
- padding: 20upx;
- }
- .fixedFootBtn {
- border-top: 1px solid #ddd;
- position: fixed;
- width: 100vw;
- bottom: 0;
- z-index: 1000;
- }
- </style>
|