4
0

index.vue 46 KB

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