index.vue 54 KB

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