| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625 |
- <template>
- <div>
- <el-card class="box-card" style="height: calc(100vh - 92px);">
- <div slot="header" style="height: 20px;">
- <span style="float: left;">
- <i class="icon icon-table2"></i>
- </span>
- <el-breadcrumb class="heading" style="float: left; margin-left: 5px">
- <el-breadcrumb-item :to="{ path: '/' }">平台首页</el-breadcrumb-item>
- <el-breadcrumb-item>已存储样本</el-breadcrumb-item>
- </el-breadcrumb>
- <span style="float: right;">
- <el-dropdown split-button type="primary" size="mini" style="margin-left:10px; margin-top: -4px;" @command="handleExportsamplesCommand">
- 导出
- <el-dropdown-menu slot="dropdown">
- <el-dropdown-item style="color:black;" command="exportchosen">导出所选样本</el-dropdown-item>
- <el-dropdown-item style="color:black;" command="exportpage">导出当前页样本</el-dropdown-item>
- <el-dropdown-item style="color:black;" command="exportall">导出所有样本</el-dropdown-item>
- </el-dropdown-menu>
- </el-dropdown>
- <el-button type="primary" size="mini" style="margin-left:10px; margin-top: -4px;" @click="batchprint">打印</el-button>
- <el-dropdown split-button type="primary" size="mini" style="margin-left:10px; margin-top: -4px;" @command="chooseType">
- 复苏
- <el-dropdown-menu slot="dropdown">
- <el-dropdown-item style="color:black;" command="batchrecovery">复苏所选样本</el-dropdown-item>
- <el-dropdown-item style="color:black;" command="Apply">审核复苏样本</el-dropdown-item>
- </el-dropdown-menu>
- </el-dropdown>
- <el-button type="primary" size="mini" style="margin-left:10px; margin-top: -4px;" @click="batchdelete">删除</el-button>
- <el-button type="primary" size="mini" style="margin-left:10px; margin-top: -4px;" @click="columndialogVisible = true">显示列</el-button>
- </span>
- <el-form ref="form" :inline="true" style="float: right; margin-top: -10px">
- <el-form-item label="样本条码">
- <el-input size="mini" style="width: 165px;" v-model="BarCode" placeholder="请输入样本条码"></el-input>
- </el-form-item>
- <el-form-item>
- <el-dropdown split-button type="primary" size="mini" @click="seachdata" @command="handleSearchCommand">
- 查询
- <el-dropdown-menu slot="dropdown">
- <el-dropdown-item command="search">高级查询</el-dropdown-item>
- <el-dropdown-item command="clear">查询重置</el-dropdown-item>
- <el-dropdown-item style="color:black;" v-for="item in searchTemplates" :key="item.Name" :command="item.Name">{{item.Name}}</el-dropdown-item>
- <el-dropdown-item divided style="color:black;" command="编辑">自定义</el-dropdown-item>
- </el-dropdown-menu>
- </el-dropdown>
- </el-form-item>
- </el-form>
- </div>
- <el-table ref="multipleTable" :data="list" bordertooltip-effect="dark" border height="calc(100vh - 230px)" style="width: 100%;"
- @selection-change="handleSelectionChange" @header-dragend="header_dragend">
- <el-table-column type="selection" width="55"></el-table-column>
- <el-table-column label="操作" width="130" align="center" fixed>
- <template slot-scope="scope">
- <router-link :to="'/samples/stored/'+scope.row.Id + '/edit?pname=samples-stored&size='+size+'¤tPage='+currentPage">
- <el-button size="small" type="text" title="编辑" icon="el-icon-edit"></el-button>
- </router-link>
- <el-button size="small" type="text" title="删除" style="margin-left:3px;" icon="el-icon-delete" @click="deletedata(scope.row)"></el-button>
- <el-button type="text" size="small" title="打印" style="margin-left:3px;" @click="openPrintDialog(scope.row)">
- <i class="icon icon-printer"></i>
- </el-button>
- <router-link :to="'/samples/stored/'+scope.row.Id + '/detailed?pname=samples-stored&size='+size+'¤tPage='+currentPage">
- <el-button type="text" size="small" title="详情" style="margin-left:3px;">
- <i class="icon icon-eye"></i>
- </el-button>
- </router-link>
- <router-link :to="'/equipment/'+scope.row.EquipmentId+'/manage_new'+getstationurl(scope.row)">
- <el-button type="text" size="small" title="样本存储信息" style="margin-left:3px;">
- <i class="icon icon-location"></i>
- </el-button>
- </router-link>
- <router-link :to="'/samples/stored/'+scope.row.Id + '/detailed?pname=samples-stored&size='+size+'¤tPage='+currentPage">
- <el-button v-if="scope.row.IsAttachment == 1" size="small" type="text" title="上传附件" style="margin-left:3px;">
- <i class="icon icon-upload2"></i>
- </el-button>
- </router-link>
- <el-button v-if="scope.row.IsAttachment == 0" size="small" type="text" title="上传附件" style="margin-left:3px;color:#CDC5BF"
- @click="uploadfile(scope.row)">
- <i class="icon icon-upload2"></i>
- </el-button>
- </template>
- </el-table-column>
- <el-table-column :label="item.name" :key="item.name" v-if="item.show" v-for="item in showcolumn" :width="item.columnwidth"
- align="center" show-overflow-tooltip>
- <template slot-scope="scope">
- <template v-if="item.filed === 'SourceName' && acc != 'sBBo4' && acc !='ssqOy' && acc != 'saB4v'">
- <router-link :to="'/biobank/source/'+ scope.row.SourceId + '/sourceinfo?pname=samples-prerecorded&size='+size+'¤tPage='+currentPage"
- :style="{color: scope.row.FamilyState === 0 ? 'blue' : 'red'}">
- {{scope.row.SourceName}}
- </router-link>
- </template>
- <template v-else-if="item.filed === 'SourceName' && (acc == 'sBBo4' || acc == 'saB4v')">
- <router-link :to="'/biobank/source/'+ scope.row.SourceId + '/sourcedetail?pname=samples-prerecorded&size='+size+'¤tPage='+currentPage"
- :style="{color: scope.row.FamilyState === 0 ? 'blue' : 'red'}">
- {{scope.row.SourceName}}
- </router-link>
- </template>
- <template v-else-if="item.filed === 'SourceName' && acc == 'ssqOy'">
- <router-link :to="'/biobank/source/'+ scope.row.SourceId + '/sourcemicinfo?pname=samples-prerecorded&size='+size+'¤tPage='+currentPage"
- :style="{color: scope.row.FamilyState === 0 ? 'blue' : 'red'}">
- {{scope.row.SourceName}}
- </router-link>
- </template>
- <template v-else-if="item.filed === 'ValidityDate' || item.filed === 'ReceiveDate'">
- {{jstimehandle(scope.row[item.filed])}}
- </template>
- <template v-else-if="item.filed === 'Location'">
- <router-link :to="'/equipment/'+scope.row.EquipmentId +'/manage_new' + getstationurl(scope.row)">
- {{scope.row.ECode}}-{{numtoupchar(scope.row.ShelfY)}}{{scope.row.ShelfX}}-{{numtoupchar(scope.row.BoxY)}}{{scope.row.BoxX}}-{{postiontoupchar(scope.row.Position)}}
- </router-link>
- </template>
- <template v-else>
- {{scope.row[item.filed]}}
- </template>
- </template>
- </el-table-column>
- </el-table>
- <div class="block">
- <span class="demonstration"></span>
- <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="currentPage"
- :page-sizes="[10, 15, 20]" :page-size="size" layout="total, sizes, prev, pager, next, jumper" :total="currentItemCount">
- </el-pagination>
- </div>
- <el-dialog title="高级查询" :visible.sync="dialogVisible" width="1000px">
- <el-form ref="advancedSearchForm" label-width="90px">
- <el-row>
- <el-col :span="8">
- <el-form-item label="样本条码">
- <el-input v-model="BarCode" placeholder="请输入样本条码" size="mini" style="width:100%"></el-input>
- </el-form-item>
- <el-form-item label="样本内码" v-if="acc !='srNA2'">
- <el-input v-model="InnerCode" placeholder="请输入样本内码" size="mini" style="width:100%"></el-input>
- </el-form-item>
- <el-form-item label="录入日期">
- <el-date-picker v-model="CreateOn" type="daterange" range-separator="至" start-placeholder="开始日期"
- end-placeholder="结束日期" size="mini" style="width:100%"></el-date-picker>
- </el-form-item>
- <el-form-item label="样本类型">
- <el-select v-model="SampleType" clearable placeholder="请选择" @change="selsampletypeChange" size="mini"
- style="width:100%">
- <el-option v-for="item in sampletypes" :label="item.Name" :value="item.Id" :key="item.Id"></el-option>
- </el-select>
- </el-form-item>
- <!-- <el-form-item label="公共扩展">
- <el-select v-model="Noteitem" multiple placeholder="请选择" size="mini" style="width:100%">
- <el-option v-for="item in publicsampletypes" :label="item.Name" :value="item.FieldName" :key="item.FieldName"></el-option>
- </el-select>
- </el-form-item> -->
- </el-col>
- <el-col :span="8">
- <el-form-item label="样本编码">
- <el-input v-model="SampleCode" placeholder="请输入样本编码" size="mini" style="width:100%"></el-input>
- </el-form-item>
- <el-form-item label="名称">
- <el-input v-model="Name" placeholder="请输入名称" size="mini" style="width:100%"></el-input>
- </el-form-item>
- <el-form-item label="组织器官">
- <el-cascader :options="zuzhitreelist" :props="sampinputtreeprops" change-on-select :show-all-levels="false"
- v-model="selectedzuzhi" @change="zuzhitreehandleChange" placeholder="请选择组织" size="mini" style="width:100%"></el-cascader>
- </el-form-item>
- <el-form-item label="特有扩展">
- <el-select v-model="STNoteField" multiple placeholder="请选择" size="mini" style="width:100%">
- <el-option v-for="item in typetykzlist" :label="item.Name" :value="item.FieldName" :key="item.FieldName"></el-option>
- </el-select>
- </el-form-item>
- <!-- <el-form-item label="公共检索">
- <el-input v-model="Noteitemvalue" placeholder="请输入检索内容" size="mini" style="width:100%"></el-input>
- </el-form-item> -->
- </el-col>
- <el-col :span="8">
- <el-form-item label="样本来源">
- <el-input v-model="SourceName" placeholder="请输入身份证号或名称" size="mini" style="width:100%"></el-input>
- </el-form-item>
- <el-form-item label="录入人">
- <el-input v-model="CreateBy" placeholder="请输入录入人" size="mini" style="width:100%"></el-input>
- </el-form-item>
- <el-form-item label="取材部位">
- <el-select v-model="SamplingSite" clearable placeholder="请选择" size="mini" style="width:100%">
- <el-option v-for="item in samplesitenames" :label="item.Name" :value="item.Code" :key="item.Code"></el-option>
- </el-select>
- </el-form-item>
- <el-form-item label="特有检索">
- <el-input v-model="Stnotevalue" placeholder="输入检索内容" size="mini" style="width:100%"></el-input>
- </el-form-item>
- <el-form-item label="所属分组">
- <el-input v-model="GroupName" placeholder="输入所属分组" size="mini" style="width:100%"></el-input>
- </el-form-item>
- </el-col>
- </el-row>
- </el-form>
- <span slot="footer" class="dialog-footer">
- <el-button size="mini" @click="dialogVisible = false">取 消</el-button>
- <el-button size="mini" type="primary" @click="seachdata">查 询</el-button>
- </span>
- </el-dialog>
- <el-dialog title="打印" :visible.sync="dialogPrintVisible" size="tiny">
- <el-select v-model="Printscheme" placeholder="请选择">
- <el-option v-for="item in printschemelist" :label="item.Name" :value="item.FileName" :key="item.FileName"></el-option>
- </el-select>
- <br>
- <br>
- <el-button type="primary" @click="doprintscheme">打 印</el-button>
- </el-dialog>
- </el-card>
- <el-dialog title="选中显示列(拖拽可以实现排序)" :visible.sync="columndialogVisible" top="5vh">
- <el-checkbox :indeterminate="isIndeterminate" v-model="checkAll" @change="handleCheckAllChange" style="margin-left:15px;">全选</el-checkbox>
- <div style="margin: 10px 0;"></div>
- <draggable v-model="showcolumn">
- <transition-group class="sampshowfiledsort_ul sampshowfiledsort_ul_tags" tag="ul">
- <li v-for="item in showcolumn" :key="item.filed">
- <el-checkbox v-model="item.show" :label="item.filed" @change="checkedshowall()">{{item.name}}</el-checkbox>
- </li>
- </transition-group>
- </draggable>
- <div slot="footer" class="dialog-footer">
- <el-button @click="columndialogVisible = false">取 消</el-button>
- <el-button type="primary" @click="saveshowfiled()">确 定</el-button>
- </div>
- </el-dialog>
- <batchrecoverydialog @close="recoverydialogcallback" :applyform="shenhe" :visible.sync="dialogfusuVisible"></batchrecoverydialog>
- <el-dialog title="自定义搜索" :visible.sync="searchDialogVisible" width="1000px" top="5vh">
- <el-form ref="form" inline label-width="120px">
- <el-row :gutter="0">
- <el-col :span="10">
- <el-form-item label="自定义搜索名称">
- <el-input v-model="searchTemplateName" placeholder="请输入自定义名称" style="width:80%">
- </el-input>
- </el-form-item>
- </el-col>
- <el-col :span="2">
- <el-button @click="addSearchTab(searchTemplateName)">添加</el-button>
- </el-col>
- </el-row>
- </el-form>
- <el-row :gutter="0">
- <el-col :span="5">
- <div class="searchDialogLeftStyle">
- <el-tag v-for="tag in searchTemplates" :id="tag.Name" :key="tag.Name" closable class="reporttag reportselect"
- :onclick="'clickmodeltypetag(' + tag.Name + ')'" style="display:block;text-align:center;color:white;"
- @close="removeSearchTab(tag.Name)">
- <i class="el-icon-caret-right" v-if="tag.Name == currentSearchTemplateName"></i>
- {{tag.Name}}
- </el-tag>
- </div>
- </el-col>
- <el-col :span="19">
- <div class="searchDialogRightStyle">
- <el-form ref="form" inline label-width="0px">
- <el-row style="margin-top:10px;">
- <el-col :span="24" style="margin-left:10px;">{{">> "+currentSearchTemplateName}}</el-col>
- </el-row>
- <el-row style="margin-top:10px;margin-bottom:10px;">
- <el-col class="line" :span="24" style="background-color:lightgrey; line-height: 2px;"> </el-col>
- </el-row>
- <el-row :gutter="1">
- <el-col :span="5">
- <el-select v-model="searchField" @change="changeSearchField()" placeholder="请选择" style="margin-left:5px;margin-right:5px;">
- <el-option v-for="item in searchcolumn" :key="item.field" :label="item.name" :value="item.filed"></el-option>
- </el-select>
- </el-col>
- <el-col :span="8">
- <el-input v-if="searchField == 'BarCode'" v-model="searchValue.BarCode" placeholder="请输入样本条码" style="margin-left:5px;display:inline-block;"></el-input>
- <el-input v-else-if="searchField == 'SampleCode'" v-model="searchValue.SampleCode" placeholder="请输入样本编码"></el-input>
- <el-input v-else-if="searchField == 'SourceName'" v-model="searchValue.SourceName" placeholder="请输入身份证号或姓名"></el-input>
- <el-input v-else-if="searchField == 'InnerCode'" v-model="searchValue.InnerCode" placeholder="请输入样本内码"></el-input>
- <el-input v-else-if="searchField == 'Name'" v-model="searchValue.Name" placeholder="请输入名称"></el-input>
- <el-input v-else-if="searchField == 'CreateBy'" v-model="searchValue.CreateBy" placeholder="请输入录入人"></el-input>
- <el-input v-else-if="searchField == 'GroupName'" v-model="searchValue.GroupName" placeholder="请输入所属分组"></el-input>
- <el-date-picker v-else-if="searchField == 'ReceiveDate'" v-model="searchValue.CreateOn" type="daterange"
- range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" style="width:100%"></el-date-picker>
- <el-cascader v-else-if="searchField == 'SamplingOrganName'" :options="zuzhitreelist" :props="sampinputtreeprops2"
- change-on-select :show-all-levels="false" v-model="searchValue.selectedzuzhi" @change="zuzhitreehandleChange2"
- placeholder="请选择组织" style="width:100%">
- </el-cascader>
- <span v-else-if="searchField == 'SamplingSiteName'">
- <el-cascader :options="zuzhitreelist" :props="sampinputtreeprops" change-on-select :show-all-levels="false"
- v-model="selectedzuzhi2" @change="zuzhitreehandleChange2" placeholder="请选择组织" style="width:50%">
- </el-cascader>
- <el-select v-model="searchValue.SamplingSite" clearable placeholder="请选择" style="width:45%;margin-left:5px;">
- <el-option v-for="item in samplesitenames2" :key="item.Code" :label="item.Name" :value="item.Name"></el-option>
- </el-select>
- </span>
- <el-select v-else-if="searchField == 'SampleTypeName'" v-model="searchValue.SampleType" clearable
- placeholder="请选择" @change="selsampletypeChange" style="width:100%">
- <el-option v-for="item in sampletypes" :key="item.Id" :label="item.Name" :value="item.Name"></el-option>
- </el-select>
- <el-date-picker v-else-if="searchField == 'ValidityDate'" v-model="searchValue.Validity" type="daterange"
- range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" style="width:100%">
- </el-date-picker>
- <el-input v-else-if="searchField == 'Capacity'" v-model="searchValue.Capacity" placeholder="请输入容量"></el-input>
- <el-input v-else-if="searchField == 'Location'" v-model="searchValue.Location" placeholder=" 请输入存储位置"></el-input>
- <el-input v-else v-model="searchValue.Extension" placeholder="" style="margin-left:5px;display:inline-block;"></el-input>
- </el-col>
- <el-col :span="3">
- <el-select v-model="orAnd" placeholder="请选择" style="margin-left:15px;">
- <el-option v-for="item in orAndData" :key="item.value" :label="item.name" :value="item.value"></el-option>
- </el-select>
- </el-col>
- <el-col :span="3">
- <el-button type="primary" size="middle" style="margin-left:5px;display:inline-block;" @click="addSearchField">添加</el-button>
- </el-col>
- <el-col :span="5">
- <el-button type="primary" size="middle" style="display:inline-block;" @click="saveAndSearchWithTemplate">查询</el-button>
- <el-button type="primary" size="middle" style="display:inline-block;" @click="saveSearchTemplate">保存</el-button>
- </el-col>
- </el-row>
- <el-row style="margin-top:10px;">
- <el-col class="line" :span="24" style="background-color:lightgrey; line-height: 2px;"> </el-col>
- </el-row>
- <el-row>
- <el-table :data="searchTableData" border style="width: 100%">
- <el-table-column prop="Name" label="检索名称" show-overflow-tooltip>
- </el-table-column>
- <el-table-column prop="Value" label="数值范围" width="300px" show-overflow-tooltip>
- </el-table-column>
- <el-table-column prop="Guanxi" label="查询关系" show-overflow-tooltip>
- </el-table-column>
- <el-table-column prop="Operate" label="操作" show-overflow-tooltip>
- <template slot-scope="scope">
- <el-button @click="deleteSearchField(scope.row)" type="text" size="small">删除</el-button>
- </template>
- </el-table-column>
- </el-table>
- </el-row>
- </el-form>
- </div>
- </el-col>
- </el-row>
- </el-dialog>
- <uploadattachdialog @close="uploaddialogcallback" :sampleinfo="sampleinfodetail" :visible.sync="dialoguploadVisible"></uploadattachdialog>
- </div>
- </template>
- <script>
- import batchrecoverydialog from '../../../components/samples/batchrecoverydialog'
- import store from 'store'
- import uploadattachdialog from '@/components/samples/uploadattachdialog'
- import draggable from 'vuedraggable'
- import {
- mapGetters
- } from 'vuex'
- export default {
- name: 'sampleinput',
- computed: {
- ...mapGetters({
- authUser: 'authUser'
- }),
- },
- components: {
- draggable,
- batchrecoverydialog,
- uploadattachdialog
- },
- data() {
- return {
- dialogVisible: false,
- sampleinfodetail: {
- BarCode: '',
- SampleCode: ''
- },
- dialoguploadVisible: false, // 上传附件
- exportloading: false,
- currentItemCount: 0, // 当前页显示数量
- currentPage: 1, // 当前页
- size: 10, // 每页显示数量
- list: [], // table显示数据集
- showquerydiv: false,
- Id: 0, // ID
- BarCode: '', // 样本条码
- SampleCode: '', // 样本编码
- SampleType: '', // 样本类型
- SamplingSite: '', // 取材部位
- Stnotevalue: '', // 特有扩展检索值
- STNoteField: [], // 特有扩展名称
- Noteitemvalue: '', // 公共扩展检索值
- Noteitem: [], // 公共扩展名称
- selectsigorg: '', // 组织器官
- CreateBy: '', // 录入人
- CreateOn: [], // 录入时期
- Name: '', // 名称
- SourceName: '', // 样本来源
- Validity: [], // 有效日期
- InnerCode: '', // 样本内码
- labelPosition: 'top',
- selectionraw: {}, // 点编辑时所选择的列的数据
- publicsampletypedata: [], // 样本公共扩展
- sampletypes: [], // 样本类型
- publicsampletypes: [], // 公共拓展
- publicdatas: [], // 样本取用记录
- relationSamples: [], // 相关样本
- GroupName: '', //所属分组
- path: '', // 上传文件路径
- userextends: [], // 扩展字段
- specialelist: [], // 特殊扩展字段
- dialogPrintVisible: false, // 打印弹框是否显示
- zuzhitreelist: [], // 组织器官
- samplesitenames: [], // 取材部位
- samplesitenames2: [], // 取材部位
- Printscheme: '', // 打印选项
- printschemelist: [], // 打印列表
- sampinputtreeprops: {
- value: 'code',
- label: 'name',
- children: 'children'
- },
- sampinputtreeprops2: {
- value: 'name',
- label: 'name',
- children: 'children'
- },
- selectedzuzhi: [],
- selectedzuzhi2: [],
- peintitemid: 0,
- shenhe: {
- applyfusu_flag: true,
- },
- multipleSelection: [],
- typetykzlist: [], // 特有扩展
- checkAll: true,
- isIndeterminate: false,
- columndialogVisible: false, // 自定义显示列弹框
- showcolumnselecd: [], // 选中的显示列
- showcolumn: [], // 显示列
- dialogfusuVisible: false, // 批量复苏弹框
- searchDialogVisible: false, // 自定义搜索弹框
- searchTableData: [],
- searchTemplateName: "自定义搜索1",
- currentSearchTemplateName: "",
- searchField: "BarCode",
- searchValue: {
- BarCode: '',
- SampleCode: '',
- SourceName: '',
- InnerCode: '',
- Name: '',
- CreateBy: '',
- CreateOn: [],
- selectedzuzhi: [],
- SamplingSite: '',
- SampleType: '',
- Validity: [],
- Capacity: '',
- Location: '',
- Extension: '',
- GroupName: '', //所属分组
- },
- orAnd: "and",
- searchTemplates: [],
- orAndData: [{
- name: "并且",
- value: "and",
- },
- {
- name: "或者",
- value: "or",
- }
- ],
- searchcolumn: [], // 搜索列
- currentSearchTemplate: '',
- acc: '',
- }
- },
- created() {
- this.acc = this.authUser.Profile.AccCode
- if (this.$route.query.size && this.$route.query.currentPage) {
- this.size = parseInt(this.$route.query.size)
- this.currentPage = parseInt(this.$route.query.currentPage)
- let searchmodel = store.get('samplestoredseach')
- if (typeof (searchmodel) != 'undefined') {
- if (searchmodel.BarCode && searchmodel.BarCode !== '') { //样本条码
- this.BarCode = searchmodel.BarCode
- }
- if (searchmodel.SampleCode && searchmodel.SampleCode !== '') { //样本编码
- this.SampleCode = searchmodel.SampleCode
- }
- if (searchmodel.SourceName && searchmodel.SourceName !== '') { //样本来源
- this.SourceName = searchmodel.SourceName
- }
- if (searchmodel.InnerCode && searchmodel.InnerCode !== '') { //样本内码
- this.InnerCode = searchmodel.InnerCode
- }
- if (searchmodel.Name && searchmodel.Name !== '') { //名称
- this.Name = searchmodel.Name
- }
- if (searchmodel.CreateBy && searchmodel.CreateBy !== '') { //录入人
- this.CreateBy = searchmodel.CreateBy
- }
- if (searchmodel.CreateOn && searchmodel.CreateOn.length === 2) { //录入日期
- this.CreateOn = [new Date(searchmodel.CreateOn[0]), new Date(searchmodel.CreateOn[1])]
- }
- if (searchmodel.SamplingOrgan && searchmodel.SamplingOrgan !== '') { //组织器官
- this.selectsigorg = searchmodel.SamplingOrgan
- this.getparentcodebytopcode(searchmodel.SamplingOrgan)
- // this.selectedzuzhi=searchmodel.SamplingOrgan
- }
- if (searchmodel.SamplingSite && searchmodel.SamplingSite !== '') { //取材部位
- this.SamplingSite = searchmodel.SamplingSite
- }
- if (searchmodel.SampleType && searchmodel.SampleType !== '') { //样本类型
- this.SampleType = searchmodel.SampleType
- this.searchsampletypeChange()
- }
- if (searchmodel.STNoteField && searchmodel.STNoteField.length > 0) { //特有扩展
- this.STNoteField = searchmodel.STNoteField
- }
- if (searchmodel.Stnotevalue && searchmodel.Stnotevalue !== '') { //特有检索内容
- this.Stnotevalue = searchmodel.Stnotevalue
- }
- if (searchmodel.Validity && searchmodel.Validity.length === 2) { //有效日期
- this.Validity = [new Date(searchmodel.Validity[0]), new Date(searchmodel.Validity[1])]
- }
- if (searchmodel.Noteitem && searchmodel.Noteitem.length > 0) { //公有扩展
- this.Noteitem = searchmodel.Noteitem
- }
- if (searchmodel.Noteitemvalue && searchmodel.Noteitemvalue !== '') { //公共检索内容
- this.Noteitemvalue = searchmodel.Noteitemvalue
- }
- if (searchmodel.GroupName && searchmodel.GroupName !== '') { //所属分组
- this.GroupName = searchmodel.GroupName
- }
- }
- } else {
- store.set('samplestoredseach', '')
- }
- let cachecols = store.get('sapminputshowcolumn')
- if (cachecols && cachecols !== '') {
- this.showcolumn = cachecols
- } else {
- this.showcolumn = [{
- filed: 'BarCode',
- name: '样本条码',
- show: true,
- kuoz: false
- }, {
- filed: 'SampleCode',
- name: '样本编码',
- show: true,
- kuoz: false
- }, {
- filed: 'SourceName',
- name: '样本来源',
- show: true,
- kuoz: false
- }, {
- filed: 'Name',
- name: '名称',
- show: true,
- kuoz: false
- }, {
- filed: 'SampleTypeName',
- name: '样本类型',
- show: true,
- kuoz: false
- }, {
- filed: 'Capacity',
- name: '可用容量',
- show: true,
- kuoz: false
- },
- // {
- // filed: 'SamplingOrganName',
- // name: '组织器官',
- // show: true,
- // kuoz: false
- // }, {
- // filed: 'SamplingSiteName',
- // name: '取材部位',
- // show: true,
- // kuoz: false
- // },
- {
- filed: 'InnerCode',
- name: '样本内码',
- show: true,
- kuoz: false
- }, {
- filed: 'ValidityDate',
- name: '有效日期',
- show: true,
- kuoz: false
- }, {
- filed: 'ReceiveDate',
- name: '接收日期',
- show: true,
- kuoz: false
- }, {
- filed: 'CreateBy',
- name: '录入人',
- show: true,
- kuoz: false
- }, {
- filed: 'Location',
- name: '存储位置',
- show: true,
- kuoz: false,
- columnwidth: 200
- }, {
- filed: 'GroupName',
- name: '所属分组',
- show: true,
- kuoz: false
- }]
- }
- this.getextends()
- this.loadprintdata()
- this.checkedshowall()
- this.getAllSearchTab()
- },
- mounted() {
- let _this = this
- window.clickmodeltypetag = function (val, e) {
- _this.clickmodeltypetag(val)
- }
- },
- methods: {
- initData() {
- this.currentSearchTemplate = ''
- let _this = this
- // 增加自定义显示列,存储位置,之后需要去掉
- let ishaslocation = false
- for (let i = 0; i < _this.showcolumn.length; i++) {
- if (_this.showcolumn[i].filed === 'Location') {
- ishaslocation = true
- break
- }
- }
- if (!ishaslocation) {
- _this.showcolumn.push({
- filed: 'Location',
- name: '存储位置',
- show: true,
- kuoz: false,
- columnwidth: 200
- })
- }
- let params = {
- _currentPage: this.currentPage,
- _size: this.size,
- BarCode: this.BarCode,
- SampleCode: this.SampleCode,
- SampleType: this.SampleType,
- SamplingSite: this.SamplingSite,
- Stnotevalue: this.Stnotevalue,
- STNoteField: this.STNoteField,
- Noteitemvalue: this.Noteitemvalue,
- Noteitem: this.Noteitem,
- CreateBy: this.CreateBy,
- SourceName: this.SourceName,
- Name: this.Name,
- Validity: this.Validity,
- CreateOn: this.CreateOn,
- InnerCode: this.InnerCode,
- SamplingOrgan: this.selectsigorg,
- GroupName: _this.GroupName
- }
- if (this.CreateOn && this.CreateOn.length === 2) {
- let params2 = {
- CreateOnstart: this.CreateOn[0] / 1000,
- CreateOnend: this.CreateOn[1] / 1000
- }
- params = Object.assign(params, params2)
- }
- if (this.Validity && this.Validity.length === 2) {
- let params3 = {
- Validitystart: this.Validity[0] / 1000,
- Validityend: this.Validity[1] / 1000
- }
- params = Object.assign(params, params3)
- }
- store.set('samplestoredseach', params)
-
- this.$axios.get('/sampleinput/list', {
- params
- })
- .then(res => {
- _this.list = res.data.items
- _this.currentItemCount = res.data.currentItemCount
- })
- .catch(err => {
- console.error(err)
- })
- },
- //根据子code获取所有父code
- getparentcodebytopcode(v) {
- let _this = this
- _this.$axios.get('/sampleorgan/getparentcodebytopcode/' + v, {})
- .then(res => {
- _this.selectedzuzhi = []
- let pidarr = res.data.split(',')
- for (var i = pidarr.length - 1; i >= 0; i--) {
- if (pidarr[i] !== '0') {
- _this.selectedzuzhi.push(pidarr[i])
- }
- }
- _this.searchzuzhitreehandleChange()
- })
- },
- uploadfile(val) {
- this.sampleinfodetail.BarCode = val.BarCode
- this.sampleinfodetail.SampleCode = val.SampleCode
- this.dialoguploadVisible = true
- },
- uploaddialogcallback() {
- this.initData()
- },
- loadprintdata() {
- this.$axios.get('/sampleinput/getprintschemelist', {
- _currentPage: -1
- })
- .then(res => {
- this.printschemelist = res.data.items
- }).catch(() => {})
- },
- getextends() {
- let _this = this
- this.$axios.get('/sampleinput/getsampletype', {
- _currentPage: -1
- })
- .then(res => {
- _this.sampletypes = res.data.items
- }).catch(() => {})
- this.$axios.get('/sampleinput/getpublicsampletype', {
- _currentPage: -1
- })
- .then(res => {
- _this.publicsampletypes = res.data.items
- // 扩展列增加到显示列中
- let cachecols = store.get('sapminputshowcolumn')
- if (!(cachecols && cachecols !== '')) {
- for (let i = 0; i < _this.publicsampletypes.length; i++) {
- _this.showcolumn.push({
- filed: _this.publicsampletypes[i].FieldName,
- name: _this.publicsampletypes[i].Name,
- show: true,
- kuoz: true
- })
- }
- } else {
- // 新增和修改
- for (let i = 0; i < _this.publicsampletypes.length; i++) {
- let matchindex = -1
- for (let j = 0; j < _this.showcolumn.length; j++) {
- if (_this.showcolumn[j].filed === _this.publicsampletypes[i].FieldName && _this.showcolumn[j].kuoz) {
- matchindex = j
- break
- }
- }
- if (matchindex >= 0) {
- _this.showcolumn[matchindex] = {
- filed: _this.publicsampletypes[i].FieldName,
- name: _this.publicsampletypes[i].Name,
- show: _this.showcolumn[matchindex].show,
- kuoz: true,
- columnwidth: _this.showcolumn[matchindex].columnwidth
- }
- } else {
- _this.showcolumn.push({
- filed: _this.publicsampletypes[i].FieldName,
- name: _this.publicsampletypes[i].Name,
- show: true,
- kuoz: true
- })
- }
- }
- // 删除
- let showcolumntemp = _this.showcolumn
- _this.showcolumn = []
- for (let j = 0; j < showcolumntemp.length; j++) {
- if (!showcolumntemp[j].kuoz) {
- _this.showcolumn.push(showcolumntemp[j])
- } else {
- for (let i = 0; i < _this.publicsampletypes.length; i++) {
- if (showcolumntemp[j].filed === _this.publicsampletypes[i].FieldName) {
- _this.showcolumn.push(showcolumntemp[j])
- break
- }
- }
- }
- }
- }
- if (store.get('samplestoredseach').searchWithTemplate && store.get('samplestoredseach').searchWithTemplate !==
- '') { //自定义查询
- this.handleSearchCommand(store.get('samplestoredseach').searchWithTemplate)
- } else {
- this.initData()
- }
- }).catch(() => {})
- this.$axios.get('/sampleinput/getoperations', {
- _currentPage: -1
- })
- .then(res => {
- _this.zuzhitreelist = window.toolfun_gettreejson(res.data.items, 'id', 'pId', 'id,name,code')
- }).catch(() => {})
- },
- seachdata() {
- if (this.selectedzuzhi.length > 0) {
- this.selectsigorg = this.selectedzuzhi[this.selectedzuzhi.length - 1]
- }
- this.currentPage = 1
- this.initData()
- },
- openPrintDialog(val) {
- this.peintitemid = val.Id
- this.dialogPrintVisible = true
- },
- selsampletypeChange() {
- // 获取特有扩展
- let _this = this
- if (_this.SampleType !== '') {
- _this.$axios.get('/sampletype/gettykzzd?SampleType=' + _this.SampleType, {})
- .then(res => {
- // response
- _this.STNoteField = []
- _this.typetykzlist = res.data
- })
- }
- },
- //返回查询条件执行
- searchsampletypeChange() {
- // 获取特有扩展
- let _this = this
- if (_this.SampleType !== '') {
- _this.$axios.get('/sampletype/gettykzzd?SampleType=' + _this.SampleType, {})
- .then(res => {
- // response
- _this.typetykzlist = res.data
- })
- }
- },
- // 自定义显示列保存操作
- saveshowfiled() {
- store.set('sapminputshowcolumn', this.showcolumn)
- this.columndialogVisible = false
- this.$message({
- type: 'success',
- message: '自定义显示列设置成功'
- })
- this.initData()
- },
- handleCheckAllChange(val) {
- for (var i = 0; i < this.showcolumn.length; i++) {
- this.showcolumn[i].show = val
- }
- },
- checkedshowall() {
- let tc = 0
- for (var i = 0; i < this.showcolumn.length; i++) {
- if (this.showcolumn[i].show) {
- tc++
- }
- }
- if (tc > 0 && tc < this.showcolumn.length) {
- this.isIndeterminate = true
- this.checkAll = false
- } else {
- this.isIndeterminate = false
- if (tc === 0) {
- this.checkAll = false
- } else {
- this.checkAll = true
- }
- }
- },
- handleSizeChange(value) {
- this.size = value
- this.currentPage = 1
- if (this.currentSearchTemplate) {
- this.searchWithTemplate(this.currentSearchTemplate)
- } else {
- this.initData()
- }
- },
- handleCurrentChange(value) {
- this.currentPage = value
- if (this.currentSearchTemplate) {
- this.searchWithTemplate(this.currentSearchTemplate)
- } else {
- this.initData()
- }
- },
- jstimehandle(val) {
- if (val === '') {
- return '----'
- } else if (val === '0001-01-01T08:00:00+08:00') {
- return '----'
- } else if (val === '5000-01-01T23:59:59+08:00') {
- return '永久'
- } else {
- val = val.replace('T', ' ')
- return val.substring(0, 19)
- }
- },
- jssubstrhandle(val, no) {
- let position = val.split(';')
- return position[no]
- },
- deletedata(val) {
- let _this = this
- _this.$confirm('此操作将永久删除该数据, 是否继续?', '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- }).then(() => {
- _this.$axios.delete('sampleinput/' + val.Id + '?sampletype=' + val.SampleType, null)
- .then(res => {
- // response
- if (res.data.code === 0) {
- _this.$message({
- type: 'success',
- message: res.data.message
- })
- // 更新界面
- this.initData()
- } else {
- _this.$message({
- type: 'warning',
- message: res.data.message
- })
- }
- })
- .catch(() => {})
- }).catch(() => {})
- },
- handleSelectionChange(val) {
- this.multipleSelection = val
- },
- header_dragend(newWidth, oldWidth, column, event) {
- for (var i = 0; i < this.showcolumn.length; i++) {
- if (this.showcolumn[i].name === column.label) {
- this.showcolumn[i].columnwidth = newWidth
- store.set('sapminputshowcolumn', this.showcolumn)
- return
- }
- }
- },
- zuzhitreehandleChange(value) {
- if (this.selectedzuzhi.length > 0) {
- this.selectsigorg = this.selectedzuzhi[this.selectedzuzhi.length - 1] + ''
- this.$axios.get('/samplesite/getsitebyfcode?code=' + this.selectsigorg, {})
- .then(res => {
- this.SamplingSite = ''
- this.samplesitenames = res.data
- }).catch(() => {})
- }
- },
- searchzuzhitreehandleChange(value) {
- if (this.selectedzuzhi.length > 0) {
- this.selectsigorg = this.selectedzuzhi[this.selectedzuzhi.length - 1] + ''
- this.$axios.get('/samplesite/getsitebyfcode?code=' + this.selectsigorg, {})
- .then(res => {
- this.samplesitenames = res.data
- }).catch(() => {})
- }
- },
- zuzhitreehandleChange2(value) {
- if (this.selectedzuzhi2.length > 0) {
- let selectsigorg = this.selectedzuzhi2[this.selectedzuzhi2.length - 1] + ''
- this.$axios.get('/samplesite/getsitebyfcode?code=' + selectsigorg, {})
- .then(res => {
- this.searchValue.SamplingSite = ''
- this.samplesitenames2 = res.data
- }).catch(() => {})
- }
- },
- chooseType(command) {
- let _this = this
- if (_this.multipleSelection.length < 1) {
- _this.$message({
- type: 'warning',
- message: '请选择要批量复苏的样本'
- })
- return
- }
- if (command == 'Apply') { //生成出库申请单:复苏
- _this.shenhe.applyfusu_flag = false
- }
- _this.shenhe = Object.assign(_this.shenhe, {
- samples: _this.multipleSelection
- })
- _this.dialogfusuVisible = true
- },
- //导出样本
- handleExportsamplesCommand(command) {
- let _this = this
- if (command == 'exportchosen') { //导出所选数据
- if (_this.multipleSelection.length < 1) {
- _this.$message({
- type: 'warning',
- message: '请选择要导出的样本'
- })
- return
- }
- _this.exportsamples('exportchosen')
- } else if (command == 'exportpage') { //导出当前页数据
- if (_this.list.length < 1) {
- _this.$message({
- type: 'warning',
- message: '当前页无样本'
- })
- return
- }
- _this.exportsamples('exportpage')
- } else if (command == 'exportall') { //导出所有数据
- _this.$confirm('此操作将导出所有满足条件的数据!是否继续导出?', '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'info'
- }).then(() => {
- _this.exportsamples()
- }).catch(() => {})
- }
- },
- exportsamples(val) {
- let _this = this
- _this.exportloading = true
- // 显示列
- let showcolumnarr = []
- let showcolumnnamearr = []
- let id = ''
- for (var i = 0; i < _this.showcolumn.length; i++) {
- if (_this.showcolumn[i].show) {
- showcolumnarr.push(_this.showcolumn[i].filed)
- showcolumnnamearr.push(_this.showcolumn[i].name.replace(/,/g, ','))
- }
- }
- let params = {
- _currentPage: this.currentPage,
- _size: this.size,
- BarCode: this.BarCode,
- SampleCode: this.SampleCode,
- SampleType: this.SampleType,
- SamplingSite: this.SamplingSite,
- Stnotevalue: this.Stnotevalue,
- STNoteField: this.STNoteField,
- Noteitemvalue: this.Noteitemvalue,
- Noteitem: this.Noteitem,
- CreateBy: this.CreateBy,
- SourceName: this.SourceName,
- Name: this.Name,
- Validity: this.Validity,
- InnerCode: this.InnerCode,
- GroupName: this.GroupName,
- SamplingOrgan: this.selectsigorg,
- showcolumnarr: showcolumnarr + '',
- showcolumnnamearr: showcolumnnamearr + '',
- ExportFlag: 'stored'
- }
- if (this.CreateOn && this.CreateOn.length === 2) {
- let params2 = {
- CreateOnstart: this.CreateOn[0] / 1000,
- CreateOnend: this.CreateOn[1] / 1000
- }
- params = Object.assign(params, params2)
- }
- if (_this.Validity && _this.Validity.length === 2) {
- let params3 = {
- Validitystart: _this.Validity[0] / 1000,
- Validityend: _this.Validity[1] / 1000
- }
- params = Object.assign(params, params3)
- }
- //导出所选样本
- if (val == 'exportchosen') {
- for (var i = 0; i < _this.multipleSelection.length; i++) {
- if (i == _this.multipleSelection.length - 1) {
- id += _this.multipleSelection[i].Id
- } else {
- id += _this.multipleSelection[i].Id + ","
- }
- }
- let paramsid = {
- Id: id
- }
- params = Object.assign(params, paramsid)
- }
- //导出当前页样本
- if (val == 'exportpage') {
- for (var i = 0; i < _this.list.length; i++) {
- if (i == _this.list.length - 1) {
- id += _this.list[i].Id
- } else {
- id += _this.list[i].Id + ","
- }
- }
- let paramsid = {
- Id: id
- }
- params = Object.assign(params, paramsid)
- }
- _this.$axios.get('/sampleinput/exportexcel', {
- params
- })
- .then(res => {
- console.log("wwwwwwwwwwwwwwww",res.data)
- _this.exportloading = false
- window.location = 'http://' + res.data
- })
- .catch(err => {
- _this.exportloading = false
- console.error(err)
- })
- },
- doprintscheme() {
- this.dialogPrintVisible = false
- // 执行打印操作
- window.PrintReport(this.Printscheme, `samples,${this.peintitemid},${this.authUser.Profile.AccCode}`)
- },
- getstationurl(val) {
- return `?station=${val.ShelfX};${val.ShelfY};${val.BoxX};${val.BoxY};${val.Position};${val.Id}&pname=samples-stored&size=${this.size}¤tPage=${this.currentPage}`
- },
- batchprint() {
- let _this = this
- if (_this.multipleSelection.length < 1) {
- _this.$message({
- type: 'warning',
- message: '请选择要批量打印的样本'
- })
- return
- }
- this.$axios.get('/printscheme/getdefaultprintscheme', {})
- .then(res => {
- if (res.data && res.data !== '') {
- let idstring = ''
- for (var i = 0; i < _this.multipleSelection.length; i++) {
- idstring += _this.multipleSelection[i].Id + ';'
- }
- idstring = idstring.substring(0, idstring.length - 1)
- // 执行打印操作
- window.PrintReport(res.data, `samplesbatch,${this.authUser.Profile.AccCode},${idstring}`)
- } else {
- _this.$message({
- type: 'warning',
- message: '未设置默认打印方案,可在"系统设置"-"打印方案"中进行设置!'
- })
- }
- })
- .catch(err => {
- // handle error
- console.error(err)
- })
- },
- batchdelete() {
- let _this = this
- if (_this.multipleSelection.length < 1) {
- _this.$message({
- type: 'warning',
- message: '请选择要批量删除的样本'
- })
- return
- }
- _this.$confirm('此操作将永久删除该数据, 是否继续?', '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- }).then(() => {
- let failedIds = []
- let succeedMsg = ''
- let errorMsg = ''
- let count = 0
- for (var i = 0; i < _this.multipleSelection.length; i++) {
- _this.$axios.delete('sampleinput/' + _this.multipleSelection[i].Id + '?sampletype=' + _this.multipleSelection[
- i].SampleType, null)
- .then(res => {
- // response
- if (res.data.code === 0) {
- succeedMsg = res.data.message
- } else {
- errorMsg = res.data.message
- failedIds.push(_this.multipleSelection[i].Id);
- }
- count++
- //最后一个请求结束
- if (count == _this.multipleSelection.length) {
- //更新界面
- this.initData()
- //全部删除成功
- if (failedIds.length == 0) {
- _this.$message({
- type: 'success',
- message: succeedMsg,
- })
- } else {
- //存在删除失败
- errorMsg = errorMsg + ",失败ID:" + failedIds.join(",")
- _this.$message({
- type: 'warning',
- message: errorMsg,
- })
- }
- }
- })
- }
- }).catch(err => {
- // handle error
- console.error(err)
- })
- },
- // batchrecovery() {
- // let _this = this
- // if (_this.multipleSelection.length < 1) {
- // _this.$message({
- // type: 'warning',
- // message: '请选择要批量复苏的样本'
- // })
- // return
- // }
- // _this.dialogfusuVisible = true
- // },
- numtoupchar(num) {
- return String.fromCharCode(64 + parseInt(num))
- },
- postiontoupchar(postion) {
- let pos = postion.split(';')
- if (pos.length === 2) {
- return this.numtoupchar(pos[1]) + pos[0]
- } else {
- return postion
- }
- },
- recoverydialogcallback(v) {
- this.multipleSelection = []
- this.initData()
- },
- addSearchField() {
- let searchValue
- for (let k in this.searchValue) {
- if (typeof this.searchValue[k] == 'number') {
- searchValue = this.searchValue[k]
- break
- } else if (this.searchValue[k] && this.searchValue[k].length > 0) {
- searchValue = this.searchValue[k]
- break
- }
- }
- if (!searchValue) {
- this.$message("请输入检索数值或范围")
- return
- }
- let s = ""
- if (searchValue instanceof Array && searchValue.length > 0) {
- if (searchValue[0] instanceof Date) {
- let arr = []
- for (let j = 0; j < searchValue.length; j++) {
- arr.push(this.formatDateTime(searchValue[j]))
- }
- s = arr.join("--")
- } else {
- s = searchValue[searchValue.length - 1]
- }
- } else {
- s = searchValue
- }
- for (let i = 0; i < this.searchTemplates.length; i++) {
- if (this.searchTemplates[i].Name == this.currentSearchTemplateName) {
- for (let index in this.searchTemplates[i].Fields) {
- let field = this.searchTemplates[i].Fields[index]
- if (field.Field == this.searchField && field.Value == this.searchValue && field.OrAnd == this.orAnd) {
- this.$message("此查询条件已经存在")
- return
- }
- }
- this.searchTemplates[i].Fields.push({
- Field: this.searchField,
- Value: s + '',
- OrAnd: this.orAnd,
- Name: this.getFieldName(this.searchField),
- })
- this.searchTableData = this.getSearchTableData(this.searchTemplates[i].Fields)
- break
- }
- }
- },
- deleteSearchField(v) {
- if (v.Name) {
- for (let i = 0; i < this.searchTemplates.length; i++) {
- if (this.searchTemplates[i].Name == this.currentSearchTemplateName) {
- this.searchTemplates[i].Fields = this.searchTemplates[i].Fields.filter(function (ele) {
- return !(ele.Value == v.Value && ele.Field == v.Field && ele.OrAnd == v.OrAnd)
- })
- this.searchTableData = this.getSearchTableData(this.searchTemplates[i].Fields)
- break
- }
- }
- }
- },
- getSearchTableData(searchFields) {
- let data = searchFields.map(function (ele) {
- if (ele["OrAnd"] == "or") {
- ele["Guanxi"] = "或者"
- } else {
- ele["Guanxi"] = "并且"
- }
- return ele
- })
- return data || []
- },
- getFieldName(field) {
- for (let i = 0; i < this.showcolumn.length; i++) {
- if (this.showcolumn[i].filed == field) {
- return this.showcolumn[i].name
- }
- }
- return ""
- },
- getFieldByName(name) {
- for (let i = 0; i < this.showcolumn.length; i++) {
- if (this.showcolumn[i].name == name) {
- return this.showcolumn[i].filed
- }
- }
- return ""
- },
- addSearchTab(name) {
- for (let i = 0; i < this.searchTemplates.length; i++) {
- if (this.searchTemplates[i].Name == name) {
- this.$message("名称已经存在")
- return
- }
- }
- this.searchTemplates.push({
- Name: name,
- Fields: [],
- }),
- this.currentSearchTemplateName = name
- for (let i = 0; i < this.searchTemplates.length; i++) {
- if (this.searchTemplates[i].Name == this.currentSearchTemplateName) {
- this.searchTableData = this.getSearchTableData(this.searchTemplates[i].Fields)
- }
- }
- },
- getAllSearchTab() {
- let _this = this
- this.$axios.get('/sampleinput/searchTemplate', {})
- .then(res => {
- if (res.data && res.data.items && res.data.items.length > 0) {
- _this.searchTemplates = res.data.items.map(function (e) {
- e.Fields = JSON.parse(e.Template)
- return e
- })
- _this.currentSearchTemplateName = _this.searchTemplates[0].Name
- _this.searchTableData = this.getSearchTableData(this.searchTemplates[0].Fields)
- } else {
- // _this.$message({
- // type: 'warning',
- // message: res.data.message,
- // })
- }
- })
- .catch(err => {
- // handle error
- console.error(err)
- })
- },
- removeSearchTab(targetName) {
- let _this = this
- this.$axios.delete('/sampleinput/searchTemplate?name=' + targetName, {})
- .then(res => {
- if (res.data.code == 0) {
- let tabs = _this.searchTemplates;
- let activeName = _this.currentSearchTemplateName;
- if (activeName === targetName) {
- tabs.forEach((tab, index) => {
- if (tab.Name === targetName) {
- let nextTab = tabs[index + 1] || tabs[index - 1];
- if (nextTab) {
- activeName = nextTab.Name
- _this.searchTableData = this.getSearchTableData(nextTab.Fields)
- }
- }
- });
- }
- _this.currentSearchTemplateName = activeName
- _this.searchTemplates = tabs.filter(tab => tab.Name !== targetName)
- } else {
- _this.$message({
- type: 'warning',
- message: res.data.message,
- })
- }
- })
- .catch(err => {
- // handle error
- console.error(err)
- })
- },
- clickmodeltypetag(val) {
- this.currentSearchTemplateName = val.getAttribute("id")
- for (let i = 0; i < this.searchTemplates.length; i++) {
- if (this.searchTemplates[i].Name == this.currentSearchTemplateName) {
- this.searchTableData = this.getSearchTableData(this.searchTemplates[i].Fields)
- }
- }
- },
- handleSearchCommand(command) {
- if (command == 'search') {
- this.dialogVisible = true
- } else if (command == 'clear') {
- this.clearSearch()
- } else if (command == "编辑") {
- this.searchDialogVisible = true
- this.searchcolumn = this.showcolumn.filter(function (e) {
- return e.filed != "Location"
- })
- } else {
- this.currentSearchTemplate = command
- let searchmodel = {
- searchWithTemplate: command
- }
- store.set('samplestoredseach', searchmodel)
- this.searchWithTemplate(command)
- }
- },
- searchWithTemplate(name) {
- this.searchDialogVisible = false
- let params = {
- _currentPage: this.currentPage,
- _size: this.size,
- }
- let _this = this
- // request
- this.$axios.get('/sampleinput/search?name=' + name, {
- params
- })
- .then(res => {
- // response
- if (res.data.items) {
- _this.list = res.data.items
- // toggle loading
- _this.currentItemCount = res.data.currentItemCount
- }
- })
- .catch(err => {
- // handle error
- console.error(err)
- })
- },
- saveAndSearchWithTemplate() {
- let _this = this
- this.saveSearchTemplate(function () {
- _this.currentSearchTemplate = _this.currentSearchTemplateName
- _this.searchWithTemplate(_this.currentSearchTemplateName)
- })
- },
- saveSearchTemplate(cb) {
- let _this = this
- let template = JSON.stringify(this.searchTableData)
- this.$axios.put('/sampleinput/searchTemplate?name=' + this.currentSearchTemplateName, template)
- .then(res => {
- if (res.data.code == 0) {
- _this.$message({
- type: 'success',
- message: res.data.message,
- })
- if (cb) {
- cb()
- }
- } else {
- _this.$message({
- type: 'warning',
- message: res.data.message,
- })
- }
- })
- .catch(err => {
- // handle error
- console.error(err)
- })
- },
- changeSearchField(val) {
- this.searchValue = {
- BarCode: '',
- SampleCode: '',
- SourceName: '',
- InnerCode: '',
- Name: '',
- CreateBy: '',
- CreateOn: [],
- selectedzuzhi: [],
- SamplingSite: '',
- SampleType: '',
- Validity: [],
- Capacity: '',
- Location: '',
- Extension: '',
- GroupName: ''
- }
- },
- clearSearch() {
- this.BarCode = ''
- this.SampleCode = ''
- this.SourceName = ''
- this.InnerCode = ''
- this.Name = ''
- this.CreateBy = ''
- this.CreateOn = []
- this.selectsigorg = ''
- this.selectedzuzhi = []
- this.SamplingSite = ''
- this.SampleType = ''
- this.STNoteField = ''
- this.Stnotevalue = ''
- this.Validity = []
- this.Noteitem = []
- this.Noteitemvalue = ''
- this.currentPage = 1
- this.GroupName = ''
- this.initData()
- },
- formatDateTime(date) {
- var y = date.getFullYear();
- var m = date.getMonth() + 1;
- m = m < 10 ? ('0' + m) : m;
- var d = date.getDate();
- d = d < 10 ? ('0' + d) : d;
- var h = date.getHours();
- var minute = date.getMinutes();
- var second = date.getSeconds();
- minute = minute < 10 ? ('0' + minute) : minute;
- minute = second < 10 ? ('0' + second) : second;
- return y + '-' + m + '-' + d + ' ' + h + ':' + minute + ':' + second;
- }
- }
- }
- </script>
- <style lang="scss">
- .el-pagination {
- margin: 1rem 0 2rem;
- text-align: right;
- }
- .sampshowfiledsort_ul_tags {
- padding-left: 12px;
- margin-top: -5px;
- }
- .sampshowfiledsort_ul_tags:after {
- clear: both;
- content: '';
- display: block;
- }
- .sampshowfiledsort_ul_tags li {
- color: #fff;
- float: left;
- margin: 2px 2px 3px 0;
- padding: 3px 3px;
- min-width: 15px;
- font-size: 16px;
- text-align: center;
- cursor: move;
- transition: all 1s;
- list-style-type: none;
- }
- .samptypeformcss.el-col-8 {
- height: 58px;
- }
- .searchDialogLeftStyle {
- border: 1px #CCCCCC solid;
- overflow: auto;
- height: 500px;
- padding: 4px;
- }
- .searchDialogLeftStyle .el-tag__close {
- color: white;
- }
- .searchDialogRightStyle {
- border: 1px #CCCCCC solid;
- overflow: auto;
- height: 500px;
- padding: 4px;
- }
- .reporttag {
- cursor: pointer;
- margin-top: 7px;
- margin-left: 5px;
- font-size: 14px; //background-color:#EBEBEB;
- }
- .reportselect {
- background-color: #5CACEE;
- color: #1E90FF;
- }
- </style>
|