index.vue 62 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625
  1. <template>
  2. <div>
  3. <el-card class="box-card" style="height: calc(100vh - 92px);">
  4. <div slot="header" style="height: 20px;">
  5. <span style="float: left;">
  6. <i class="icon icon-table2"></i>
  7. </span>
  8. <el-breadcrumb class="heading" style="float: left; margin-left: 5px">
  9. <el-breadcrumb-item :to="{ path: '/' }">平台首页</el-breadcrumb-item>
  10. <el-breadcrumb-item>已存储样本</el-breadcrumb-item>
  11. </el-breadcrumb>
  12. <span style="float: right;">
  13. <el-dropdown split-button type="primary" size="mini" style="margin-left:10px; margin-top: -4px;" @command="handleExportsamplesCommand">
  14. 导出
  15. <el-dropdown-menu slot="dropdown">
  16. <el-dropdown-item style="color:black;" command="exportchosen">导出所选样本</el-dropdown-item>
  17. <el-dropdown-item style="color:black;" command="exportpage">导出当前页样本</el-dropdown-item>
  18. <el-dropdown-item style="color:black;" command="exportall">导出所有样本</el-dropdown-item>
  19. </el-dropdown-menu>
  20. </el-dropdown>
  21. <el-button type="primary" size="mini" style="margin-left:10px; margin-top: -4px;" @click="batchprint">打印</el-button>
  22. <el-dropdown split-button type="primary" size="mini" style="margin-left:10px; margin-top: -4px;" @command="chooseType">
  23. 复苏
  24. <el-dropdown-menu slot="dropdown">
  25. <el-dropdown-item style="color:black;" command="batchrecovery">复苏所选样本</el-dropdown-item>
  26. <el-dropdown-item style="color:black;" command="Apply">审核复苏样本</el-dropdown-item>
  27. </el-dropdown-menu>
  28. </el-dropdown>
  29. <el-button type="primary" size="mini" style="margin-left:10px; margin-top: -4px;" @click="batchdelete">删除</el-button>
  30. <el-button type="primary" size="mini" style="margin-left:10px; margin-top: -4px;" @click="columndialogVisible = true">显示列</el-button>
  31. </span>
  32. <el-form ref="form" :inline="true" style="float: right; margin-top: -10px">
  33. <el-form-item label="样本条码">
  34. <el-input size="mini" style="width: 165px;" v-model="BarCode" placeholder="请输入样本条码"></el-input>
  35. </el-form-item>
  36. <el-form-item>
  37. <el-dropdown split-button type="primary" size="mini" @click="seachdata" @command="handleSearchCommand">
  38. 查询
  39. <el-dropdown-menu slot="dropdown">
  40. <el-dropdown-item command="search">高级查询</el-dropdown-item>
  41. <el-dropdown-item command="clear">查询重置</el-dropdown-item>
  42. <el-dropdown-item style="color:black;" v-for="item in searchTemplates" :key="item.Name" :command="item.Name">{{item.Name}}</el-dropdown-item>
  43. <el-dropdown-item divided style="color:black;" command="编辑">自定义</el-dropdown-item>
  44. </el-dropdown-menu>
  45. </el-dropdown>
  46. </el-form-item>
  47. </el-form>
  48. </div>
  49. <el-table ref="multipleTable" :data="list" bordertooltip-effect="dark" border height="calc(100vh - 230px)" style="width: 100%;"
  50. @selection-change="handleSelectionChange" @header-dragend="header_dragend">
  51. <el-table-column type="selection" width="55"></el-table-column>
  52. <el-table-column label="操作" width="130" align="center" fixed>
  53. <template slot-scope="scope">
  54. <router-link :to="'/samples/stored/'+scope.row.Id + '/edit?pname=samples-stored&size='+size+'&currentPage='+currentPage">
  55. <el-button size="small" type="text" title="编辑" icon="el-icon-edit"></el-button>
  56. </router-link>
  57. <el-button size="small" type="text" title="删除" style="margin-left:3px;" icon="el-icon-delete" @click="deletedata(scope.row)"></el-button>
  58. <el-button type="text" size="small" title="打印" style="margin-left:3px;" @click="openPrintDialog(scope.row)">
  59. <i class="icon icon-printer"></i>
  60. </el-button>
  61. <router-link :to="'/samples/stored/'+scope.row.Id + '/detailed?pname=samples-stored&size='+size+'&currentPage='+currentPage">
  62. <el-button type="text" size="small" title="详情" style="margin-left:3px;">
  63. <i class="icon icon-eye"></i>
  64. </el-button>
  65. </router-link>
  66. <router-link :to="'/equipment/'+scope.row.EquipmentId+'/manage_new'+getstationurl(scope.row)">
  67. <el-button type="text" size="small" title="样本存储信息" style="margin-left:3px;">
  68. <i class="icon icon-location"></i>
  69. </el-button>
  70. </router-link>
  71. <router-link :to="'/samples/stored/'+scope.row.Id + '/detailed?pname=samples-stored&size='+size+'&currentPage='+currentPage">
  72. <el-button v-if="scope.row.IsAttachment == 1" size="small" type="text" title="上传附件" style="margin-left:3px;">
  73. <i class="icon icon-upload2"></i>
  74. </el-button>
  75. </router-link>
  76. <el-button v-if="scope.row.IsAttachment == 0" size="small" type="text" title="上传附件" style="margin-left:3px;color:#CDC5BF"
  77. @click="uploadfile(scope.row)">
  78. <i class="icon icon-upload2"></i>
  79. </el-button>
  80. </template>
  81. </el-table-column>
  82. <el-table-column :label="item.name" :key="item.name" v-if="item.show" v-for="item in showcolumn" :width="item.columnwidth"
  83. align="center" show-overflow-tooltip>
  84. <template slot-scope="scope">
  85. <template v-if="item.filed === 'SourceName' && acc != 'sBBo4' && acc !='ssqOy' && acc != 'saB4v'">
  86. <router-link :to="'/biobank/source/'+ scope.row.SourceId + '/sourceinfo?pname=samples-prerecorded&size='+size+'&currentPage='+currentPage"
  87. :style="{color: scope.row.FamilyState === 0 ? 'blue' : 'red'}">
  88. {{scope.row.SourceName}}
  89. </router-link>
  90. </template>
  91. <template v-else-if="item.filed === 'SourceName' && (acc == 'sBBo4' || acc == 'saB4v')">
  92. <router-link :to="'/biobank/source/'+ scope.row.SourceId + '/sourcedetail?pname=samples-prerecorded&size='+size+'&currentPage='+currentPage"
  93. :style="{color: scope.row.FamilyState === 0 ? 'blue' : 'red'}">
  94. {{scope.row.SourceName}}
  95. </router-link>
  96. </template>
  97. <template v-else-if="item.filed === 'SourceName' && acc == 'ssqOy'">
  98. <router-link :to="'/biobank/source/'+ scope.row.SourceId + '/sourcemicinfo?pname=samples-prerecorded&size='+size+'&currentPage='+currentPage"
  99. :style="{color: scope.row.FamilyState === 0 ? 'blue' : 'red'}">
  100. {{scope.row.SourceName}}
  101. </router-link>
  102. </template>
  103. <template v-else-if="item.filed === 'ValidityDate' || item.filed === 'ReceiveDate'">
  104. {{jstimehandle(scope.row[item.filed])}}
  105. </template>
  106. <template v-else-if="item.filed === 'Location'">
  107. <router-link :to="'/equipment/'+scope.row.EquipmentId +'/manage_new' + getstationurl(scope.row)">
  108. {{scope.row.ECode}}-{{numtoupchar(scope.row.ShelfY)}}{{scope.row.ShelfX}}-{{numtoupchar(scope.row.BoxY)}}{{scope.row.BoxX}}-{{postiontoupchar(scope.row.Position)}}
  109. </router-link>
  110. </template>
  111. <template v-else>
  112. {{scope.row[item.filed]}}
  113. </template>
  114. </template>
  115. </el-table-column>
  116. </el-table>
  117. <div class="block">
  118. <span class="demonstration"></span>
  119. <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="currentPage"
  120. :page-sizes="[10, 15, 20]" :page-size="size" layout="total, sizes, prev, pager, next, jumper" :total="currentItemCount">
  121. </el-pagination>
  122. </div>
  123. <el-dialog title="高级查询" :visible.sync="dialogVisible" width="1000px">
  124. <el-form ref="advancedSearchForm" label-width="90px">
  125. <el-row>
  126. <el-col :span="8">
  127. <el-form-item label="样本条码">
  128. <el-input v-model="BarCode" placeholder="请输入样本条码" size="mini" style="width:100%"></el-input>
  129. </el-form-item>
  130. <el-form-item label="样本内码" v-if="acc !='srNA2'">
  131. <el-input v-model="InnerCode" placeholder="请输入样本内码" size="mini" style="width:100%"></el-input>
  132. </el-form-item>
  133. <el-form-item label="录入日期">
  134. <el-date-picker v-model="CreateOn" type="daterange" range-separator="至" start-placeholder="开始日期"
  135. end-placeholder="结束日期" size="mini" style="width:100%"></el-date-picker>
  136. </el-form-item>
  137. <el-form-item label="样本类型">
  138. <el-select v-model="SampleType" clearable placeholder="请选择" @change="selsampletypeChange" size="mini"
  139. style="width:100%">
  140. <el-option v-for="item in sampletypes" :label="item.Name" :value="item.Id" :key="item.Id"></el-option>
  141. </el-select>
  142. </el-form-item>
  143. <!-- <el-form-item label="公共扩展">
  144. <el-select v-model="Noteitem" multiple placeholder="请选择" size="mini" style="width:100%">
  145. <el-option v-for="item in publicsampletypes" :label="item.Name" :value="item.FieldName" :key="item.FieldName"></el-option>
  146. </el-select>
  147. </el-form-item> -->
  148. </el-col>
  149. <el-col :span="8">
  150. <el-form-item label="样本编码">
  151. <el-input v-model="SampleCode" placeholder="请输入样本编码" size="mini" style="width:100%"></el-input>
  152. </el-form-item>
  153. <el-form-item label="名称">
  154. <el-input v-model="Name" placeholder="请输入名称" size="mini" style="width:100%"></el-input>
  155. </el-form-item>
  156. <el-form-item label="组织器官">
  157. <el-cascader :options="zuzhitreelist" :props="sampinputtreeprops" change-on-select :show-all-levels="false"
  158. v-model="selectedzuzhi" @change="zuzhitreehandleChange" placeholder="请选择组织" size="mini" style="width:100%"></el-cascader>
  159. </el-form-item>
  160. <el-form-item label="特有扩展">
  161. <el-select v-model="STNoteField" multiple placeholder="请选择" size="mini" style="width:100%">
  162. <el-option v-for="item in typetykzlist" :label="item.Name" :value="item.FieldName" :key="item.FieldName"></el-option>
  163. </el-select>
  164. </el-form-item>
  165. <!-- <el-form-item label="公共检索">
  166. <el-input v-model="Noteitemvalue" placeholder="请输入检索内容" size="mini" style="width:100%"></el-input>
  167. </el-form-item> -->
  168. </el-col>
  169. <el-col :span="8">
  170. <el-form-item label="样本来源">
  171. <el-input v-model="SourceName" placeholder="请输入身份证号或名称" size="mini" style="width:100%"></el-input>
  172. </el-form-item>
  173. <el-form-item label="录入人">
  174. <el-input v-model="CreateBy" placeholder="请输入录入人" size="mini" style="width:100%"></el-input>
  175. </el-form-item>
  176. <el-form-item label="取材部位">
  177. <el-select v-model="SamplingSite" clearable placeholder="请选择" size="mini" style="width:100%">
  178. <el-option v-for="item in samplesitenames" :label="item.Name" :value="item.Code" :key="item.Code"></el-option>
  179. </el-select>
  180. </el-form-item>
  181. <el-form-item label="特有检索">
  182. <el-input v-model="Stnotevalue" placeholder="输入检索内容" size="mini" style="width:100%"></el-input>
  183. </el-form-item>
  184. <el-form-item label="所属分组">
  185. <el-input v-model="GroupName" placeholder="输入所属分组" size="mini" style="width:100%"></el-input>
  186. </el-form-item>
  187. </el-col>
  188. </el-row>
  189. </el-form>
  190. <span slot="footer" class="dialog-footer">
  191. <el-button size="mini" @click="dialogVisible = false">取 消</el-button>
  192. <el-button size="mini" type="primary" @click="seachdata">查 询</el-button>
  193. </span>
  194. </el-dialog>
  195. <el-dialog title="打印" :visible.sync="dialogPrintVisible" size="tiny">
  196. <el-select v-model="Printscheme" placeholder="请选择">
  197. <el-option v-for="item in printschemelist" :label="item.Name" :value="item.FileName" :key="item.FileName"></el-option>
  198. </el-select>
  199. <br>
  200. <br>
  201. <el-button type="primary" @click="doprintscheme">打 印</el-button>
  202. </el-dialog>
  203. </el-card>
  204. <el-dialog title="选中显示列(拖拽可以实现排序)" :visible.sync="columndialogVisible" top="5vh">
  205. <el-checkbox :indeterminate="isIndeterminate" v-model="checkAll" @change="handleCheckAllChange" style="margin-left:15px;">全选</el-checkbox>
  206. <div style="margin: 10px 0;"></div>
  207. <draggable v-model="showcolumn">
  208. <transition-group class="sampshowfiledsort_ul sampshowfiledsort_ul_tags" tag="ul">
  209. <li v-for="item in showcolumn" :key="item.filed">
  210. <el-checkbox v-model="item.show" :label="item.filed" @change="checkedshowall()">{{item.name}}</el-checkbox>
  211. </li>
  212. </transition-group>
  213. </draggable>
  214. <div slot="footer" class="dialog-footer">
  215. <el-button @click="columndialogVisible = false">取 消</el-button>
  216. <el-button type="primary" @click="saveshowfiled()">确 定</el-button>
  217. </div>
  218. </el-dialog>
  219. <batchrecoverydialog @close="recoverydialogcallback" :applyform="shenhe" :visible.sync="dialogfusuVisible"></batchrecoverydialog>
  220. <el-dialog title="自定义搜索" :visible.sync="searchDialogVisible" width="1000px" top="5vh">
  221. <el-form ref="form" inline label-width="120px">
  222. <el-row :gutter="0">
  223. <el-col :span="10">
  224. <el-form-item label="自定义搜索名称">
  225. <el-input v-model="searchTemplateName" placeholder="请输入自定义名称" style="width:80%">
  226. </el-input>
  227. </el-form-item>
  228. </el-col>
  229. <el-col :span="2">
  230. <el-button @click="addSearchTab(searchTemplateName)">添加</el-button>
  231. </el-col>
  232. </el-row>
  233. </el-form>
  234. <el-row :gutter="0">
  235. <el-col :span="5">
  236. <div class="searchDialogLeftStyle">
  237. <el-tag v-for="tag in searchTemplates" :id="tag.Name" :key="tag.Name" closable class="reporttag reportselect"
  238. :onclick="'clickmodeltypetag(' + tag.Name + ')'" style="display:block;text-align:center;color:white;"
  239. @close="removeSearchTab(tag.Name)">
  240. <i class="el-icon-caret-right" v-if="tag.Name == currentSearchTemplateName"></i>
  241. {{tag.Name}}
  242. </el-tag>
  243. </div>
  244. </el-col>
  245. <el-col :span="19">
  246. <div class="searchDialogRightStyle">
  247. <el-form ref="form" inline label-width="0px">
  248. <el-row style="margin-top:10px;">
  249. <el-col :span="24" style="margin-left:10px;">{{">> "+currentSearchTemplateName}}</el-col>
  250. </el-row>
  251. <el-row style="margin-top:10px;margin-bottom:10px;">
  252. <el-col class="line" :span="24" style="background-color:lightgrey; line-height: 2px;">&nbsp;</el-col>
  253. </el-row>
  254. <el-row :gutter="1">
  255. <el-col :span="5">
  256. <el-select v-model="searchField" @change="changeSearchField()" placeholder="请选择" style="margin-left:5px;margin-right:5px;">
  257. <el-option v-for="item in searchcolumn" :key="item.field" :label="item.name" :value="item.filed"></el-option>
  258. </el-select>
  259. </el-col>
  260. <el-col :span="8">
  261. <el-input v-if="searchField == 'BarCode'" v-model="searchValue.BarCode" placeholder="请输入样本条码" style="margin-left:5px;display:inline-block;"></el-input>
  262. <el-input v-else-if="searchField == 'SampleCode'" v-model="searchValue.SampleCode" placeholder="请输入样本编码"></el-input>
  263. <el-input v-else-if="searchField == 'SourceName'" v-model="searchValue.SourceName" placeholder="请输入身份证号或姓名"></el-input>
  264. <el-input v-else-if="searchField == 'InnerCode'" v-model="searchValue.InnerCode" placeholder="请输入样本内码"></el-input>
  265. <el-input v-else-if="searchField == 'Name'" v-model="searchValue.Name" placeholder="请输入名称"></el-input>
  266. <el-input v-else-if="searchField == 'CreateBy'" v-model="searchValue.CreateBy" placeholder="请输入录入人"></el-input>
  267. <el-input v-else-if="searchField == 'GroupName'" v-model="searchValue.GroupName" placeholder="请输入所属分组"></el-input>
  268. <el-date-picker v-else-if="searchField == 'ReceiveDate'" v-model="searchValue.CreateOn" type="daterange"
  269. range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" style="width:100%"></el-date-picker>
  270. <el-cascader v-else-if="searchField == 'SamplingOrganName'" :options="zuzhitreelist" :props="sampinputtreeprops2"
  271. change-on-select :show-all-levels="false" v-model="searchValue.selectedzuzhi" @change="zuzhitreehandleChange2"
  272. placeholder="请选择组织" style="width:100%">
  273. </el-cascader>
  274. <span v-else-if="searchField == 'SamplingSiteName'">
  275. <el-cascader :options="zuzhitreelist" :props="sampinputtreeprops" change-on-select :show-all-levels="false"
  276. v-model="selectedzuzhi2" @change="zuzhitreehandleChange2" placeholder="请选择组织" style="width:50%">
  277. </el-cascader>
  278. <el-select v-model="searchValue.SamplingSite" clearable placeholder="请选择" style="width:45%;margin-left:5px;">
  279. <el-option v-for="item in samplesitenames2" :key="item.Code" :label="item.Name" :value="item.Name"></el-option>
  280. </el-select>
  281. </span>
  282. <el-select v-else-if="searchField == 'SampleTypeName'" v-model="searchValue.SampleType" clearable
  283. placeholder="请选择" @change="selsampletypeChange" style="width:100%">
  284. <el-option v-for="item in sampletypes" :key="item.Id" :label="item.Name" :value="item.Name"></el-option>
  285. </el-select>
  286. <el-date-picker v-else-if="searchField == 'ValidityDate'" v-model="searchValue.Validity" type="daterange"
  287. range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" style="width:100%">
  288. </el-date-picker>
  289. <el-input v-else-if="searchField == 'Capacity'" v-model="searchValue.Capacity" placeholder="请输入容量"></el-input>
  290. <el-input v-else-if="searchField == 'Location'" v-model="searchValue.Location" placeholder=" 请输入存储位置"></el-input>
  291. <el-input v-else v-model="searchValue.Extension" placeholder="" style="margin-left:5px;display:inline-block;"></el-input>
  292. </el-col>
  293. <el-col :span="3">
  294. <el-select v-model="orAnd" placeholder="请选择" style="margin-left:15px;">
  295. <el-option v-for="item in orAndData" :key="item.value" :label="item.name" :value="item.value"></el-option>
  296. </el-select>
  297. </el-col>
  298. <el-col :span="3">
  299. <el-button type="primary" size="middle" style="margin-left:5px;display:inline-block;" @click="addSearchField">添加</el-button>
  300. </el-col>
  301. <el-col :span="5">
  302. <el-button type="primary" size="middle" style="display:inline-block;" @click="saveAndSearchWithTemplate">查询</el-button>
  303. <el-button type="primary" size="middle" style="display:inline-block;" @click="saveSearchTemplate">保存</el-button>
  304. </el-col>
  305. </el-row>
  306. <el-row style="margin-top:10px;">
  307. <el-col class="line" :span="24" style="background-color:lightgrey; line-height: 2px;">&nbsp;</el-col>
  308. </el-row>
  309. <el-row>
  310. <el-table :data="searchTableData" border style="width: 100%">
  311. <el-table-column prop="Name" label="检索名称" show-overflow-tooltip>
  312. </el-table-column>
  313. <el-table-column prop="Value" label="数值范围" width="300px" show-overflow-tooltip>
  314. </el-table-column>
  315. <el-table-column prop="Guanxi" label="查询关系" show-overflow-tooltip>
  316. </el-table-column>
  317. <el-table-column prop="Operate" label="操作" show-overflow-tooltip>
  318. <template slot-scope="scope">
  319. <el-button @click="deleteSearchField(scope.row)" type="text" size="small">删除</el-button>
  320. </template>
  321. </el-table-column>
  322. </el-table>
  323. </el-row>
  324. </el-form>
  325. </div>
  326. </el-col>
  327. </el-row>
  328. </el-dialog>
  329. <uploadattachdialog @close="uploaddialogcallback" :sampleinfo="sampleinfodetail" :visible.sync="dialoguploadVisible"></uploadattachdialog>
  330. </div>
  331. </template>
  332. <script>
  333. import batchrecoverydialog from '../../../components/samples/batchrecoverydialog'
  334. import store from 'store'
  335. import uploadattachdialog from '@/components/samples/uploadattachdialog'
  336. import draggable from 'vuedraggable'
  337. import {
  338. mapGetters
  339. } from 'vuex'
  340. export default {
  341. name: 'sampleinput',
  342. computed: {
  343. ...mapGetters({
  344. authUser: 'authUser'
  345. }),
  346. },
  347. components: {
  348. draggable,
  349. batchrecoverydialog,
  350. uploadattachdialog
  351. },
  352. data() {
  353. return {
  354. dialogVisible: false,
  355. sampleinfodetail: {
  356. BarCode: '',
  357. SampleCode: ''
  358. },
  359. dialoguploadVisible: false, // 上传附件
  360. exportloading: false,
  361. currentItemCount: 0, // 当前页显示数量
  362. currentPage: 1, // 当前页
  363. size: 10, // 每页显示数量
  364. list: [], // table显示数据集
  365. showquerydiv: false,
  366. Id: 0, // ID
  367. BarCode: '', // 样本条码
  368. SampleCode: '', // 样本编码
  369. SampleType: '', // 样本类型
  370. SamplingSite: '', // 取材部位
  371. Stnotevalue: '', // 特有扩展检索值
  372. STNoteField: [], // 特有扩展名称
  373. Noteitemvalue: '', // 公共扩展检索值
  374. Noteitem: [], // 公共扩展名称
  375. selectsigorg: '', // 组织器官
  376. CreateBy: '', // 录入人
  377. CreateOn: [], // 录入时期
  378. Name: '', // 名称
  379. SourceName: '', // 样本来源
  380. Validity: [], // 有效日期
  381. InnerCode: '', // 样本内码
  382. labelPosition: 'top',
  383. selectionraw: {}, // 点编辑时所选择的列的数据
  384. publicsampletypedata: [], // 样本公共扩展
  385. sampletypes: [], // 样本类型
  386. publicsampletypes: [], // 公共拓展
  387. publicdatas: [], // 样本取用记录
  388. relationSamples: [], // 相关样本
  389. GroupName: '', //所属分组
  390. path: '', // 上传文件路径
  391. userextends: [], // 扩展字段
  392. specialelist: [], // 特殊扩展字段
  393. dialogPrintVisible: false, // 打印弹框是否显示
  394. zuzhitreelist: [], // 组织器官
  395. samplesitenames: [], // 取材部位
  396. samplesitenames2: [], // 取材部位
  397. Printscheme: '', // 打印选项
  398. printschemelist: [], // 打印列表
  399. sampinputtreeprops: {
  400. value: 'code',
  401. label: 'name',
  402. children: 'children'
  403. },
  404. sampinputtreeprops2: {
  405. value: 'name',
  406. label: 'name',
  407. children: 'children'
  408. },
  409. selectedzuzhi: [],
  410. selectedzuzhi2: [],
  411. peintitemid: 0,
  412. shenhe: {
  413. applyfusu_flag: true,
  414. },
  415. multipleSelection: [],
  416. typetykzlist: [], // 特有扩展
  417. checkAll: true,
  418. isIndeterminate: false,
  419. columndialogVisible: false, // 自定义显示列弹框
  420. showcolumnselecd: [], // 选中的显示列
  421. showcolumn: [], // 显示列
  422. dialogfusuVisible: false, // 批量复苏弹框
  423. searchDialogVisible: false, // 自定义搜索弹框
  424. searchTableData: [],
  425. searchTemplateName: "自定义搜索1",
  426. currentSearchTemplateName: "",
  427. searchField: "BarCode",
  428. searchValue: {
  429. BarCode: '',
  430. SampleCode: '',
  431. SourceName: '',
  432. InnerCode: '',
  433. Name: '',
  434. CreateBy: '',
  435. CreateOn: [],
  436. selectedzuzhi: [],
  437. SamplingSite: '',
  438. SampleType: '',
  439. Validity: [],
  440. Capacity: '',
  441. Location: '',
  442. Extension: '',
  443. GroupName: '', //所属分组
  444. },
  445. orAnd: "and",
  446. searchTemplates: [],
  447. orAndData: [{
  448. name: "并且",
  449. value: "and",
  450. },
  451. {
  452. name: "或者",
  453. value: "or",
  454. }
  455. ],
  456. searchcolumn: [], // 搜索列
  457. currentSearchTemplate: '',
  458. acc: '',
  459. }
  460. },
  461. created() {
  462. this.acc = this.authUser.Profile.AccCode
  463. if (this.$route.query.size && this.$route.query.currentPage) {
  464. this.size = parseInt(this.$route.query.size)
  465. this.currentPage = parseInt(this.$route.query.currentPage)
  466. let searchmodel = store.get('samplestoredseach')
  467. if (typeof (searchmodel) != 'undefined') {
  468. if (searchmodel.BarCode && searchmodel.BarCode !== '') { //样本条码
  469. this.BarCode = searchmodel.BarCode
  470. }
  471. if (searchmodel.SampleCode && searchmodel.SampleCode !== '') { //样本编码
  472. this.SampleCode = searchmodel.SampleCode
  473. }
  474. if (searchmodel.SourceName && searchmodel.SourceName !== '') { //样本来源
  475. this.SourceName = searchmodel.SourceName
  476. }
  477. if (searchmodel.InnerCode && searchmodel.InnerCode !== '') { //样本内码
  478. this.InnerCode = searchmodel.InnerCode
  479. }
  480. if (searchmodel.Name && searchmodel.Name !== '') { //名称
  481. this.Name = searchmodel.Name
  482. }
  483. if (searchmodel.CreateBy && searchmodel.CreateBy !== '') { //录入人
  484. this.CreateBy = searchmodel.CreateBy
  485. }
  486. if (searchmodel.CreateOn && searchmodel.CreateOn.length === 2) { //录入日期
  487. this.CreateOn = [new Date(searchmodel.CreateOn[0]), new Date(searchmodel.CreateOn[1])]
  488. }
  489. if (searchmodel.SamplingOrgan && searchmodel.SamplingOrgan !== '') { //组织器官
  490. this.selectsigorg = searchmodel.SamplingOrgan
  491. this.getparentcodebytopcode(searchmodel.SamplingOrgan)
  492. // this.selectedzuzhi=searchmodel.SamplingOrgan
  493. }
  494. if (searchmodel.SamplingSite && searchmodel.SamplingSite !== '') { //取材部位
  495. this.SamplingSite = searchmodel.SamplingSite
  496. }
  497. if (searchmodel.SampleType && searchmodel.SampleType !== '') { //样本类型
  498. this.SampleType = searchmodel.SampleType
  499. this.searchsampletypeChange()
  500. }
  501. if (searchmodel.STNoteField && searchmodel.STNoteField.length > 0) { //特有扩展
  502. this.STNoteField = searchmodel.STNoteField
  503. }
  504. if (searchmodel.Stnotevalue && searchmodel.Stnotevalue !== '') { //特有检索内容
  505. this.Stnotevalue = searchmodel.Stnotevalue
  506. }
  507. if (searchmodel.Validity && searchmodel.Validity.length === 2) { //有效日期
  508. this.Validity = [new Date(searchmodel.Validity[0]), new Date(searchmodel.Validity[1])]
  509. }
  510. if (searchmodel.Noteitem && searchmodel.Noteitem.length > 0) { //公有扩展
  511. this.Noteitem = searchmodel.Noteitem
  512. }
  513. if (searchmodel.Noteitemvalue && searchmodel.Noteitemvalue !== '') { //公共检索内容
  514. this.Noteitemvalue = searchmodel.Noteitemvalue
  515. }
  516. if (searchmodel.GroupName && searchmodel.GroupName !== '') { //所属分组
  517. this.GroupName = searchmodel.GroupName
  518. }
  519. }
  520. } else {
  521. store.set('samplestoredseach', '')
  522. }
  523. let cachecols = store.get('sapminputshowcolumn')
  524. if (cachecols && cachecols !== '') {
  525. this.showcolumn = cachecols
  526. } else {
  527. this.showcolumn = [{
  528. filed: 'BarCode',
  529. name: '样本条码',
  530. show: true,
  531. kuoz: false
  532. }, {
  533. filed: 'SampleCode',
  534. name: '样本编码',
  535. show: true,
  536. kuoz: false
  537. }, {
  538. filed: 'SourceName',
  539. name: '样本来源',
  540. show: true,
  541. kuoz: false
  542. }, {
  543. filed: 'Name',
  544. name: '名称',
  545. show: true,
  546. kuoz: false
  547. }, {
  548. filed: 'SampleTypeName',
  549. name: '样本类型',
  550. show: true,
  551. kuoz: false
  552. }, {
  553. filed: 'Capacity',
  554. name: '可用容量',
  555. show: true,
  556. kuoz: false
  557. },
  558. // {
  559. // filed: 'SamplingOrganName',
  560. // name: '组织器官',
  561. // show: true,
  562. // kuoz: false
  563. // }, {
  564. // filed: 'SamplingSiteName',
  565. // name: '取材部位',
  566. // show: true,
  567. // kuoz: false
  568. // },
  569. {
  570. filed: 'InnerCode',
  571. name: '样本内码',
  572. show: true,
  573. kuoz: false
  574. }, {
  575. filed: 'ValidityDate',
  576. name: '有效日期',
  577. show: true,
  578. kuoz: false
  579. }, {
  580. filed: 'ReceiveDate',
  581. name: '接收日期',
  582. show: true,
  583. kuoz: false
  584. }, {
  585. filed: 'CreateBy',
  586. name: '录入人',
  587. show: true,
  588. kuoz: false
  589. }, {
  590. filed: 'Location',
  591. name: '存储位置',
  592. show: true,
  593. kuoz: false,
  594. columnwidth: 200
  595. }, {
  596. filed: 'GroupName',
  597. name: '所属分组',
  598. show: true,
  599. kuoz: false
  600. }]
  601. }
  602. this.getextends()
  603. this.loadprintdata()
  604. this.checkedshowall()
  605. this.getAllSearchTab()
  606. },
  607. mounted() {
  608. let _this = this
  609. window.clickmodeltypetag = function (val, e) {
  610. _this.clickmodeltypetag(val)
  611. }
  612. },
  613. methods: {
  614. initData() {
  615. this.currentSearchTemplate = ''
  616. let _this = this
  617. // 增加自定义显示列,存储位置,之后需要去掉
  618. let ishaslocation = false
  619. for (let i = 0; i < _this.showcolumn.length; i++) {
  620. if (_this.showcolumn[i].filed === 'Location') {
  621. ishaslocation = true
  622. break
  623. }
  624. }
  625. if (!ishaslocation) {
  626. _this.showcolumn.push({
  627. filed: 'Location',
  628. name: '存储位置',
  629. show: true,
  630. kuoz: false,
  631. columnwidth: 200
  632. })
  633. }
  634. let params = {
  635. _currentPage: this.currentPage,
  636. _size: this.size,
  637. BarCode: this.BarCode,
  638. SampleCode: this.SampleCode,
  639. SampleType: this.SampleType,
  640. SamplingSite: this.SamplingSite,
  641. Stnotevalue: this.Stnotevalue,
  642. STNoteField: this.STNoteField,
  643. Noteitemvalue: this.Noteitemvalue,
  644. Noteitem: this.Noteitem,
  645. CreateBy: this.CreateBy,
  646. SourceName: this.SourceName,
  647. Name: this.Name,
  648. Validity: this.Validity,
  649. CreateOn: this.CreateOn,
  650. InnerCode: this.InnerCode,
  651. SamplingOrgan: this.selectsigorg,
  652. GroupName: _this.GroupName
  653. }
  654. if (this.CreateOn && this.CreateOn.length === 2) {
  655. let params2 = {
  656. CreateOnstart: this.CreateOn[0] / 1000,
  657. CreateOnend: this.CreateOn[1] / 1000
  658. }
  659. params = Object.assign(params, params2)
  660. }
  661. if (this.Validity && this.Validity.length === 2) {
  662. let params3 = {
  663. Validitystart: this.Validity[0] / 1000,
  664. Validityend: this.Validity[1] / 1000
  665. }
  666. params = Object.assign(params, params3)
  667. }
  668. store.set('samplestoredseach', params)
  669. this.$axios.get('/sampleinput/list', {
  670. params
  671. })
  672. .then(res => {
  673. _this.list = res.data.items
  674. _this.currentItemCount = res.data.currentItemCount
  675. })
  676. .catch(err => {
  677. console.error(err)
  678. })
  679. },
  680. //根据子code获取所有父code
  681. getparentcodebytopcode(v) {
  682. let _this = this
  683. _this.$axios.get('/sampleorgan/getparentcodebytopcode/' + v, {})
  684. .then(res => {
  685. _this.selectedzuzhi = []
  686. let pidarr = res.data.split(',')
  687. for (var i = pidarr.length - 1; i >= 0; i--) {
  688. if (pidarr[i] !== '0') {
  689. _this.selectedzuzhi.push(pidarr[i])
  690. }
  691. }
  692. _this.searchzuzhitreehandleChange()
  693. })
  694. },
  695. uploadfile(val) {
  696. this.sampleinfodetail.BarCode = val.BarCode
  697. this.sampleinfodetail.SampleCode = val.SampleCode
  698. this.dialoguploadVisible = true
  699. },
  700. uploaddialogcallback() {
  701. this.initData()
  702. },
  703. loadprintdata() {
  704. this.$axios.get('/sampleinput/getprintschemelist', {
  705. _currentPage: -1
  706. })
  707. .then(res => {
  708. this.printschemelist = res.data.items
  709. }).catch(() => {})
  710. },
  711. getextends() {
  712. let _this = this
  713. this.$axios.get('/sampleinput/getsampletype', {
  714. _currentPage: -1
  715. })
  716. .then(res => {
  717. _this.sampletypes = res.data.items
  718. }).catch(() => {})
  719. this.$axios.get('/sampleinput/getpublicsampletype', {
  720. _currentPage: -1
  721. })
  722. .then(res => {
  723. _this.publicsampletypes = res.data.items
  724. // 扩展列增加到显示列中
  725. let cachecols = store.get('sapminputshowcolumn')
  726. if (!(cachecols && cachecols !== '')) {
  727. for (let i = 0; i < _this.publicsampletypes.length; i++) {
  728. _this.showcolumn.push({
  729. filed: _this.publicsampletypes[i].FieldName,
  730. name: _this.publicsampletypes[i].Name,
  731. show: true,
  732. kuoz: true
  733. })
  734. }
  735. } else {
  736. // 新增和修改
  737. for (let i = 0; i < _this.publicsampletypes.length; i++) {
  738. let matchindex = -1
  739. for (let j = 0; j < _this.showcolumn.length; j++) {
  740. if (_this.showcolumn[j].filed === _this.publicsampletypes[i].FieldName && _this.showcolumn[j].kuoz) {
  741. matchindex = j
  742. break
  743. }
  744. }
  745. if (matchindex >= 0) {
  746. _this.showcolumn[matchindex] = {
  747. filed: _this.publicsampletypes[i].FieldName,
  748. name: _this.publicsampletypes[i].Name,
  749. show: _this.showcolumn[matchindex].show,
  750. kuoz: true,
  751. columnwidth: _this.showcolumn[matchindex].columnwidth
  752. }
  753. } else {
  754. _this.showcolumn.push({
  755. filed: _this.publicsampletypes[i].FieldName,
  756. name: _this.publicsampletypes[i].Name,
  757. show: true,
  758. kuoz: true
  759. })
  760. }
  761. }
  762. // 删除
  763. let showcolumntemp = _this.showcolumn
  764. _this.showcolumn = []
  765. for (let j = 0; j < showcolumntemp.length; j++) {
  766. if (!showcolumntemp[j].kuoz) {
  767. _this.showcolumn.push(showcolumntemp[j])
  768. } else {
  769. for (let i = 0; i < _this.publicsampletypes.length; i++) {
  770. if (showcolumntemp[j].filed === _this.publicsampletypes[i].FieldName) {
  771. _this.showcolumn.push(showcolumntemp[j])
  772. break
  773. }
  774. }
  775. }
  776. }
  777. }
  778. if (store.get('samplestoredseach').searchWithTemplate && store.get('samplestoredseach').searchWithTemplate !==
  779. '') { //自定义查询
  780. this.handleSearchCommand(store.get('samplestoredseach').searchWithTemplate)
  781. } else {
  782. this.initData()
  783. }
  784. }).catch(() => {})
  785. this.$axios.get('/sampleinput/getoperations', {
  786. _currentPage: -1
  787. })
  788. .then(res => {
  789. _this.zuzhitreelist = window.toolfun_gettreejson(res.data.items, 'id', 'pId', 'id,name,code')
  790. }).catch(() => {})
  791. },
  792. seachdata() {
  793. if (this.selectedzuzhi.length > 0) {
  794. this.selectsigorg = this.selectedzuzhi[this.selectedzuzhi.length - 1]
  795. }
  796. this.currentPage = 1
  797. this.initData()
  798. },
  799. openPrintDialog(val) {
  800. this.peintitemid = val.Id
  801. this.dialogPrintVisible = true
  802. },
  803. selsampletypeChange() {
  804. // 获取特有扩展
  805. let _this = this
  806. if (_this.SampleType !== '') {
  807. _this.$axios.get('/sampletype/gettykzzd?SampleType=' + _this.SampleType, {})
  808. .then(res => {
  809. // response
  810. _this.STNoteField = []
  811. _this.typetykzlist = res.data
  812. })
  813. }
  814. },
  815. //返回查询条件执行
  816. searchsampletypeChange() {
  817. // 获取特有扩展
  818. let _this = this
  819. if (_this.SampleType !== '') {
  820. _this.$axios.get('/sampletype/gettykzzd?SampleType=' + _this.SampleType, {})
  821. .then(res => {
  822. // response
  823. _this.typetykzlist = res.data
  824. })
  825. }
  826. },
  827. // 自定义显示列保存操作
  828. saveshowfiled() {
  829. store.set('sapminputshowcolumn', this.showcolumn)
  830. this.columndialogVisible = false
  831. this.$message({
  832. type: 'success',
  833. message: '自定义显示列设置成功'
  834. })
  835. this.initData()
  836. },
  837. handleCheckAllChange(val) {
  838. for (var i = 0; i < this.showcolumn.length; i++) {
  839. this.showcolumn[i].show = val
  840. }
  841. },
  842. checkedshowall() {
  843. let tc = 0
  844. for (var i = 0; i < this.showcolumn.length; i++) {
  845. if (this.showcolumn[i].show) {
  846. tc++
  847. }
  848. }
  849. if (tc > 0 && tc < this.showcolumn.length) {
  850. this.isIndeterminate = true
  851. this.checkAll = false
  852. } else {
  853. this.isIndeterminate = false
  854. if (tc === 0) {
  855. this.checkAll = false
  856. } else {
  857. this.checkAll = true
  858. }
  859. }
  860. },
  861. handleSizeChange(value) {
  862. this.size = value
  863. this.currentPage = 1
  864. if (this.currentSearchTemplate) {
  865. this.searchWithTemplate(this.currentSearchTemplate)
  866. } else {
  867. this.initData()
  868. }
  869. },
  870. handleCurrentChange(value) {
  871. this.currentPage = value
  872. if (this.currentSearchTemplate) {
  873. this.searchWithTemplate(this.currentSearchTemplate)
  874. } else {
  875. this.initData()
  876. }
  877. },
  878. jstimehandle(val) {
  879. if (val === '') {
  880. return '----'
  881. } else if (val === '0001-01-01T08:00:00+08:00') {
  882. return '----'
  883. } else if (val === '5000-01-01T23:59:59+08:00') {
  884. return '永久'
  885. } else {
  886. val = val.replace('T', ' ')
  887. return val.substring(0, 19)
  888. }
  889. },
  890. jssubstrhandle(val, no) {
  891. let position = val.split(';')
  892. return position[no]
  893. },
  894. deletedata(val) {
  895. let _this = this
  896. _this.$confirm('此操作将永久删除该数据, 是否继续?', '提示', {
  897. confirmButtonText: '确定',
  898. cancelButtonText: '取消',
  899. type: 'warning'
  900. }).then(() => {
  901. _this.$axios.delete('sampleinput/' + val.Id + '?sampletype=' + val.SampleType, null)
  902. .then(res => {
  903. // response
  904. if (res.data.code === 0) {
  905. _this.$message({
  906. type: 'success',
  907. message: res.data.message
  908. })
  909. // 更新界面
  910. this.initData()
  911. } else {
  912. _this.$message({
  913. type: 'warning',
  914. message: res.data.message
  915. })
  916. }
  917. })
  918. .catch(() => {})
  919. }).catch(() => {})
  920. },
  921. handleSelectionChange(val) {
  922. this.multipleSelection = val
  923. },
  924. header_dragend(newWidth, oldWidth, column, event) {
  925. for (var i = 0; i < this.showcolumn.length; i++) {
  926. if (this.showcolumn[i].name === column.label) {
  927. this.showcolumn[i].columnwidth = newWidth
  928. store.set('sapminputshowcolumn', this.showcolumn)
  929. return
  930. }
  931. }
  932. },
  933. zuzhitreehandleChange(value) {
  934. if (this.selectedzuzhi.length > 0) {
  935. this.selectsigorg = this.selectedzuzhi[this.selectedzuzhi.length - 1] + ''
  936. this.$axios.get('/samplesite/getsitebyfcode?code=' + this.selectsigorg, {})
  937. .then(res => {
  938. this.SamplingSite = ''
  939. this.samplesitenames = res.data
  940. }).catch(() => {})
  941. }
  942. },
  943. searchzuzhitreehandleChange(value) {
  944. if (this.selectedzuzhi.length > 0) {
  945. this.selectsigorg = this.selectedzuzhi[this.selectedzuzhi.length - 1] + ''
  946. this.$axios.get('/samplesite/getsitebyfcode?code=' + this.selectsigorg, {})
  947. .then(res => {
  948. this.samplesitenames = res.data
  949. }).catch(() => {})
  950. }
  951. },
  952. zuzhitreehandleChange2(value) {
  953. if (this.selectedzuzhi2.length > 0) {
  954. let selectsigorg = this.selectedzuzhi2[this.selectedzuzhi2.length - 1] + ''
  955. this.$axios.get('/samplesite/getsitebyfcode?code=' + selectsigorg, {})
  956. .then(res => {
  957. this.searchValue.SamplingSite = ''
  958. this.samplesitenames2 = res.data
  959. }).catch(() => {})
  960. }
  961. },
  962. chooseType(command) {
  963. let _this = this
  964. if (_this.multipleSelection.length < 1) {
  965. _this.$message({
  966. type: 'warning',
  967. message: '请选择要批量复苏的样本'
  968. })
  969. return
  970. }
  971. if (command == 'Apply') { //生成出库申请单:复苏
  972. _this.shenhe.applyfusu_flag = false
  973. }
  974. _this.shenhe = Object.assign(_this.shenhe, {
  975. samples: _this.multipleSelection
  976. })
  977. _this.dialogfusuVisible = true
  978. },
  979. //导出样本
  980. handleExportsamplesCommand(command) {
  981. let _this = this
  982. if (command == 'exportchosen') { //导出所选数据
  983. if (_this.multipleSelection.length < 1) {
  984. _this.$message({
  985. type: 'warning',
  986. message: '请选择要导出的样本'
  987. })
  988. return
  989. }
  990. _this.exportsamples('exportchosen')
  991. } else if (command == 'exportpage') { //导出当前页数据
  992. if (_this.list.length < 1) {
  993. _this.$message({
  994. type: 'warning',
  995. message: '当前页无样本'
  996. })
  997. return
  998. }
  999. _this.exportsamples('exportpage')
  1000. } else if (command == 'exportall') { //导出所有数据
  1001. _this.$confirm('此操作将导出所有满足条件的数据!是否继续导出?', '提示', {
  1002. confirmButtonText: '确定',
  1003. cancelButtonText: '取消',
  1004. type: 'info'
  1005. }).then(() => {
  1006. _this.exportsamples()
  1007. }).catch(() => {})
  1008. }
  1009. },
  1010. exportsamples(val) {
  1011. let _this = this
  1012. _this.exportloading = true
  1013. // 显示列
  1014. let showcolumnarr = []
  1015. let showcolumnnamearr = []
  1016. let id = ''
  1017. for (var i = 0; i < _this.showcolumn.length; i++) {
  1018. if (_this.showcolumn[i].show) {
  1019. showcolumnarr.push(_this.showcolumn[i].filed)
  1020. showcolumnnamearr.push(_this.showcolumn[i].name.replace(/,/g, ','))
  1021. }
  1022. }
  1023. let params = {
  1024. _currentPage: this.currentPage,
  1025. _size: this.size,
  1026. BarCode: this.BarCode,
  1027. SampleCode: this.SampleCode,
  1028. SampleType: this.SampleType,
  1029. SamplingSite: this.SamplingSite,
  1030. Stnotevalue: this.Stnotevalue,
  1031. STNoteField: this.STNoteField,
  1032. Noteitemvalue: this.Noteitemvalue,
  1033. Noteitem: this.Noteitem,
  1034. CreateBy: this.CreateBy,
  1035. SourceName: this.SourceName,
  1036. Name: this.Name,
  1037. Validity: this.Validity,
  1038. InnerCode: this.InnerCode,
  1039. GroupName: this.GroupName,
  1040. SamplingOrgan: this.selectsigorg,
  1041. showcolumnarr: showcolumnarr + '',
  1042. showcolumnnamearr: showcolumnnamearr + '',
  1043. ExportFlag: 'stored'
  1044. }
  1045. if (this.CreateOn && this.CreateOn.length === 2) {
  1046. let params2 = {
  1047. CreateOnstart: this.CreateOn[0] / 1000,
  1048. CreateOnend: this.CreateOn[1] / 1000
  1049. }
  1050. params = Object.assign(params, params2)
  1051. }
  1052. if (_this.Validity && _this.Validity.length === 2) {
  1053. let params3 = {
  1054. Validitystart: _this.Validity[0] / 1000,
  1055. Validityend: _this.Validity[1] / 1000
  1056. }
  1057. params = Object.assign(params, params3)
  1058. }
  1059. //导出所选样本
  1060. if (val == 'exportchosen') {
  1061. for (var i = 0; i < _this.multipleSelection.length; i++) {
  1062. if (i == _this.multipleSelection.length - 1) {
  1063. id += _this.multipleSelection[i].Id
  1064. } else {
  1065. id += _this.multipleSelection[i].Id + ","
  1066. }
  1067. }
  1068. let paramsid = {
  1069. Id: id
  1070. }
  1071. params = Object.assign(params, paramsid)
  1072. }
  1073. //导出当前页样本
  1074. if (val == 'exportpage') {
  1075. for (var i = 0; i < _this.list.length; i++) {
  1076. if (i == _this.list.length - 1) {
  1077. id += _this.list[i].Id
  1078. } else {
  1079. id += _this.list[i].Id + ","
  1080. }
  1081. }
  1082. let paramsid = {
  1083. Id: id
  1084. }
  1085. params = Object.assign(params, paramsid)
  1086. }
  1087. _this.$axios.get('/sampleinput/exportexcel', {
  1088. params
  1089. })
  1090. .then(res => {
  1091. console.log("wwwwwwwwwwwwwwww",res.data)
  1092. _this.exportloading = false
  1093. window.location = 'http://' + res.data
  1094. })
  1095. .catch(err => {
  1096. _this.exportloading = false
  1097. console.error(err)
  1098. })
  1099. },
  1100. doprintscheme() {
  1101. this.dialogPrintVisible = false
  1102. // 执行打印操作
  1103. window.PrintReport(this.Printscheme, `samples,${this.peintitemid},${this.authUser.Profile.AccCode}`)
  1104. },
  1105. getstationurl(val) {
  1106. return `?station=${val.ShelfX};${val.ShelfY};${val.BoxX};${val.BoxY};${val.Position};${val.Id}&pname=samples-stored&size=${this.size}&currentPage=${this.currentPage}`
  1107. },
  1108. batchprint() {
  1109. let _this = this
  1110. if (_this.multipleSelection.length < 1) {
  1111. _this.$message({
  1112. type: 'warning',
  1113. message: '请选择要批量打印的样本'
  1114. })
  1115. return
  1116. }
  1117. this.$axios.get('/printscheme/getdefaultprintscheme', {})
  1118. .then(res => {
  1119. if (res.data && res.data !== '') {
  1120. let idstring = ''
  1121. for (var i = 0; i < _this.multipleSelection.length; i++) {
  1122. idstring += _this.multipleSelection[i].Id + ';'
  1123. }
  1124. idstring = idstring.substring(0, idstring.length - 1)
  1125. // 执行打印操作
  1126. window.PrintReport(res.data, `samplesbatch,${this.authUser.Profile.AccCode},${idstring}`)
  1127. } else {
  1128. _this.$message({
  1129. type: 'warning',
  1130. message: '未设置默认打印方案,可在"系统设置"-"打印方案"中进行设置!'
  1131. })
  1132. }
  1133. })
  1134. .catch(err => {
  1135. // handle error
  1136. console.error(err)
  1137. })
  1138. },
  1139. batchdelete() {
  1140. let _this = this
  1141. if (_this.multipleSelection.length < 1) {
  1142. _this.$message({
  1143. type: 'warning',
  1144. message: '请选择要批量删除的样本'
  1145. })
  1146. return
  1147. }
  1148. _this.$confirm('此操作将永久删除该数据, 是否继续?', '提示', {
  1149. confirmButtonText: '确定',
  1150. cancelButtonText: '取消',
  1151. type: 'warning'
  1152. }).then(() => {
  1153. let failedIds = []
  1154. let succeedMsg = ''
  1155. let errorMsg = ''
  1156. let count = 0
  1157. for (var i = 0; i < _this.multipleSelection.length; i++) {
  1158. _this.$axios.delete('sampleinput/' + _this.multipleSelection[i].Id + '?sampletype=' + _this.multipleSelection[
  1159. i].SampleType, null)
  1160. .then(res => {
  1161. // response
  1162. if (res.data.code === 0) {
  1163. succeedMsg = res.data.message
  1164. } else {
  1165. errorMsg = res.data.message
  1166. failedIds.push(_this.multipleSelection[i].Id);
  1167. }
  1168. count++
  1169. //最后一个请求结束
  1170. if (count == _this.multipleSelection.length) {
  1171. //更新界面
  1172. this.initData()
  1173. //全部删除成功
  1174. if (failedIds.length == 0) {
  1175. _this.$message({
  1176. type: 'success',
  1177. message: succeedMsg,
  1178. })
  1179. } else {
  1180. //存在删除失败
  1181. errorMsg = errorMsg + ",失败ID:" + failedIds.join(",")
  1182. _this.$message({
  1183. type: 'warning',
  1184. message: errorMsg,
  1185. })
  1186. }
  1187. }
  1188. })
  1189. }
  1190. }).catch(err => {
  1191. // handle error
  1192. console.error(err)
  1193. })
  1194. },
  1195. // batchrecovery() {
  1196. // let _this = this
  1197. // if (_this.multipleSelection.length < 1) {
  1198. // _this.$message({
  1199. // type: 'warning',
  1200. // message: '请选择要批量复苏的样本'
  1201. // })
  1202. // return
  1203. // }
  1204. // _this.dialogfusuVisible = true
  1205. // },
  1206. numtoupchar(num) {
  1207. return String.fromCharCode(64 + parseInt(num))
  1208. },
  1209. postiontoupchar(postion) {
  1210. let pos = postion.split(';')
  1211. if (pos.length === 2) {
  1212. return this.numtoupchar(pos[1]) + pos[0]
  1213. } else {
  1214. return postion
  1215. }
  1216. },
  1217. recoverydialogcallback(v) {
  1218. this.multipleSelection = []
  1219. this.initData()
  1220. },
  1221. addSearchField() {
  1222. let searchValue
  1223. for (let k in this.searchValue) {
  1224. if (typeof this.searchValue[k] == 'number') {
  1225. searchValue = this.searchValue[k]
  1226. break
  1227. } else if (this.searchValue[k] && this.searchValue[k].length > 0) {
  1228. searchValue = this.searchValue[k]
  1229. break
  1230. }
  1231. }
  1232. if (!searchValue) {
  1233. this.$message("请输入检索数值或范围")
  1234. return
  1235. }
  1236. let s = ""
  1237. if (searchValue instanceof Array && searchValue.length > 0) {
  1238. if (searchValue[0] instanceof Date) {
  1239. let arr = []
  1240. for (let j = 0; j < searchValue.length; j++) {
  1241. arr.push(this.formatDateTime(searchValue[j]))
  1242. }
  1243. s = arr.join("--")
  1244. } else {
  1245. s = searchValue[searchValue.length - 1]
  1246. }
  1247. } else {
  1248. s = searchValue
  1249. }
  1250. for (let i = 0; i < this.searchTemplates.length; i++) {
  1251. if (this.searchTemplates[i].Name == this.currentSearchTemplateName) {
  1252. for (let index in this.searchTemplates[i].Fields) {
  1253. let field = this.searchTemplates[i].Fields[index]
  1254. if (field.Field == this.searchField && field.Value == this.searchValue && field.OrAnd == this.orAnd) {
  1255. this.$message("此查询条件已经存在")
  1256. return
  1257. }
  1258. }
  1259. this.searchTemplates[i].Fields.push({
  1260. Field: this.searchField,
  1261. Value: s + '',
  1262. OrAnd: this.orAnd,
  1263. Name: this.getFieldName(this.searchField),
  1264. })
  1265. this.searchTableData = this.getSearchTableData(this.searchTemplates[i].Fields)
  1266. break
  1267. }
  1268. }
  1269. },
  1270. deleteSearchField(v) {
  1271. if (v.Name) {
  1272. for (let i = 0; i < this.searchTemplates.length; i++) {
  1273. if (this.searchTemplates[i].Name == this.currentSearchTemplateName) {
  1274. this.searchTemplates[i].Fields = this.searchTemplates[i].Fields.filter(function (ele) {
  1275. return !(ele.Value == v.Value && ele.Field == v.Field && ele.OrAnd == v.OrAnd)
  1276. })
  1277. this.searchTableData = this.getSearchTableData(this.searchTemplates[i].Fields)
  1278. break
  1279. }
  1280. }
  1281. }
  1282. },
  1283. getSearchTableData(searchFields) {
  1284. let data = searchFields.map(function (ele) {
  1285. if (ele["OrAnd"] == "or") {
  1286. ele["Guanxi"] = "或者"
  1287. } else {
  1288. ele["Guanxi"] = "并且"
  1289. }
  1290. return ele
  1291. })
  1292. return data || []
  1293. },
  1294. getFieldName(field) {
  1295. for (let i = 0; i < this.showcolumn.length; i++) {
  1296. if (this.showcolumn[i].filed == field) {
  1297. return this.showcolumn[i].name
  1298. }
  1299. }
  1300. return ""
  1301. },
  1302. getFieldByName(name) {
  1303. for (let i = 0; i < this.showcolumn.length; i++) {
  1304. if (this.showcolumn[i].name == name) {
  1305. return this.showcolumn[i].filed
  1306. }
  1307. }
  1308. return ""
  1309. },
  1310. addSearchTab(name) {
  1311. for (let i = 0; i < this.searchTemplates.length; i++) {
  1312. if (this.searchTemplates[i].Name == name) {
  1313. this.$message("名称已经存在")
  1314. return
  1315. }
  1316. }
  1317. this.searchTemplates.push({
  1318. Name: name,
  1319. Fields: [],
  1320. }),
  1321. this.currentSearchTemplateName = name
  1322. for (let i = 0; i < this.searchTemplates.length; i++) {
  1323. if (this.searchTemplates[i].Name == this.currentSearchTemplateName) {
  1324. this.searchTableData = this.getSearchTableData(this.searchTemplates[i].Fields)
  1325. }
  1326. }
  1327. },
  1328. getAllSearchTab() {
  1329. let _this = this
  1330. this.$axios.get('/sampleinput/searchTemplate', {})
  1331. .then(res => {
  1332. if (res.data && res.data.items && res.data.items.length > 0) {
  1333. _this.searchTemplates = res.data.items.map(function (e) {
  1334. e.Fields = JSON.parse(e.Template)
  1335. return e
  1336. })
  1337. _this.currentSearchTemplateName = _this.searchTemplates[0].Name
  1338. _this.searchTableData = this.getSearchTableData(this.searchTemplates[0].Fields)
  1339. } else {
  1340. // _this.$message({
  1341. // type: 'warning',
  1342. // message: res.data.message,
  1343. // })
  1344. }
  1345. })
  1346. .catch(err => {
  1347. // handle error
  1348. console.error(err)
  1349. })
  1350. },
  1351. removeSearchTab(targetName) {
  1352. let _this = this
  1353. this.$axios.delete('/sampleinput/searchTemplate?name=' + targetName, {})
  1354. .then(res => {
  1355. if (res.data.code == 0) {
  1356. let tabs = _this.searchTemplates;
  1357. let activeName = _this.currentSearchTemplateName;
  1358. if (activeName === targetName) {
  1359. tabs.forEach((tab, index) => {
  1360. if (tab.Name === targetName) {
  1361. let nextTab = tabs[index + 1] || tabs[index - 1];
  1362. if (nextTab) {
  1363. activeName = nextTab.Name
  1364. _this.searchTableData = this.getSearchTableData(nextTab.Fields)
  1365. }
  1366. }
  1367. });
  1368. }
  1369. _this.currentSearchTemplateName = activeName
  1370. _this.searchTemplates = tabs.filter(tab => tab.Name !== targetName)
  1371. } else {
  1372. _this.$message({
  1373. type: 'warning',
  1374. message: res.data.message,
  1375. })
  1376. }
  1377. })
  1378. .catch(err => {
  1379. // handle error
  1380. console.error(err)
  1381. })
  1382. },
  1383. clickmodeltypetag(val) {
  1384. this.currentSearchTemplateName = val.getAttribute("id")
  1385. for (let i = 0; i < this.searchTemplates.length; i++) {
  1386. if (this.searchTemplates[i].Name == this.currentSearchTemplateName) {
  1387. this.searchTableData = this.getSearchTableData(this.searchTemplates[i].Fields)
  1388. }
  1389. }
  1390. },
  1391. handleSearchCommand(command) {
  1392. if (command == 'search') {
  1393. this.dialogVisible = true
  1394. } else if (command == 'clear') {
  1395. this.clearSearch()
  1396. } else if (command == "编辑") {
  1397. this.searchDialogVisible = true
  1398. this.searchcolumn = this.showcolumn.filter(function (e) {
  1399. return e.filed != "Location"
  1400. })
  1401. } else {
  1402. this.currentSearchTemplate = command
  1403. let searchmodel = {
  1404. searchWithTemplate: command
  1405. }
  1406. store.set('samplestoredseach', searchmodel)
  1407. this.searchWithTemplate(command)
  1408. }
  1409. },
  1410. searchWithTemplate(name) {
  1411. this.searchDialogVisible = false
  1412. let params = {
  1413. _currentPage: this.currentPage,
  1414. _size: this.size,
  1415. }
  1416. let _this = this
  1417. // request
  1418. this.$axios.get('/sampleinput/search?name=' + name, {
  1419. params
  1420. })
  1421. .then(res => {
  1422. // response
  1423. if (res.data.items) {
  1424. _this.list = res.data.items
  1425. // toggle loading
  1426. _this.currentItemCount = res.data.currentItemCount
  1427. }
  1428. })
  1429. .catch(err => {
  1430. // handle error
  1431. console.error(err)
  1432. })
  1433. },
  1434. saveAndSearchWithTemplate() {
  1435. let _this = this
  1436. this.saveSearchTemplate(function () {
  1437. _this.currentSearchTemplate = _this.currentSearchTemplateName
  1438. _this.searchWithTemplate(_this.currentSearchTemplateName)
  1439. })
  1440. },
  1441. saveSearchTemplate(cb) {
  1442. let _this = this
  1443. let template = JSON.stringify(this.searchTableData)
  1444. this.$axios.put('/sampleinput/searchTemplate?name=' + this.currentSearchTemplateName, template)
  1445. .then(res => {
  1446. if (res.data.code == 0) {
  1447. _this.$message({
  1448. type: 'success',
  1449. message: res.data.message,
  1450. })
  1451. if (cb) {
  1452. cb()
  1453. }
  1454. } else {
  1455. _this.$message({
  1456. type: 'warning',
  1457. message: res.data.message,
  1458. })
  1459. }
  1460. })
  1461. .catch(err => {
  1462. // handle error
  1463. console.error(err)
  1464. })
  1465. },
  1466. changeSearchField(val) {
  1467. this.searchValue = {
  1468. BarCode: '',
  1469. SampleCode: '',
  1470. SourceName: '',
  1471. InnerCode: '',
  1472. Name: '',
  1473. CreateBy: '',
  1474. CreateOn: [],
  1475. selectedzuzhi: [],
  1476. SamplingSite: '',
  1477. SampleType: '',
  1478. Validity: [],
  1479. Capacity: '',
  1480. Location: '',
  1481. Extension: '',
  1482. GroupName: ''
  1483. }
  1484. },
  1485. clearSearch() {
  1486. this.BarCode = ''
  1487. this.SampleCode = ''
  1488. this.SourceName = ''
  1489. this.InnerCode = ''
  1490. this.Name = ''
  1491. this.CreateBy = ''
  1492. this.CreateOn = []
  1493. this.selectsigorg = ''
  1494. this.selectedzuzhi = []
  1495. this.SamplingSite = ''
  1496. this.SampleType = ''
  1497. this.STNoteField = ''
  1498. this.Stnotevalue = ''
  1499. this.Validity = []
  1500. this.Noteitem = []
  1501. this.Noteitemvalue = ''
  1502. this.currentPage = 1
  1503. this.GroupName = ''
  1504. this.initData()
  1505. },
  1506. formatDateTime(date) {
  1507. var y = date.getFullYear();
  1508. var m = date.getMonth() + 1;
  1509. m = m < 10 ? ('0' + m) : m;
  1510. var d = date.getDate();
  1511. d = d < 10 ? ('0' + d) : d;
  1512. var h = date.getHours();
  1513. var minute = date.getMinutes();
  1514. var second = date.getSeconds();
  1515. minute = minute < 10 ? ('0' + minute) : minute;
  1516. minute = second < 10 ? ('0' + second) : second;
  1517. return y + '-' + m + '-' + d + ' ' + h + ':' + minute + ':' + second;
  1518. }
  1519. }
  1520. }
  1521. </script>
  1522. <style lang="scss">
  1523. .el-pagination {
  1524. margin: 1rem 0 2rem;
  1525. text-align: right;
  1526. }
  1527. .sampshowfiledsort_ul_tags {
  1528. padding-left: 12px;
  1529. margin-top: -5px;
  1530. }
  1531. .sampshowfiledsort_ul_tags:after {
  1532. clear: both;
  1533. content: '';
  1534. display: block;
  1535. }
  1536. .sampshowfiledsort_ul_tags li {
  1537. color: #fff;
  1538. float: left;
  1539. margin: 2px 2px 3px 0;
  1540. padding: 3px 3px;
  1541. min-width: 15px;
  1542. font-size: 16px;
  1543. text-align: center;
  1544. cursor: move;
  1545. transition: all 1s;
  1546. list-style-type: none;
  1547. }
  1548. .samptypeformcss.el-col-8 {
  1549. height: 58px;
  1550. }
  1551. .searchDialogLeftStyle {
  1552. border: 1px #CCCCCC solid;
  1553. overflow: auto;
  1554. height: 500px;
  1555. padding: 4px;
  1556. }
  1557. .searchDialogLeftStyle .el-tag__close {
  1558. color: white;
  1559. }
  1560. .searchDialogRightStyle {
  1561. border: 1px #CCCCCC solid;
  1562. overflow: auto;
  1563. height: 500px;
  1564. padding: 4px;
  1565. }
  1566. .reporttag {
  1567. cursor: pointer;
  1568. margin-top: 7px;
  1569. margin-left: 5px;
  1570. font-size: 14px; //background-color:#EBEBEB;
  1571. }
  1572. .reportselect {
  1573. background-color: #5CACEE;
  1574. color: #1E90FF;
  1575. }
  1576. </style>