|
|
@@ -210,6 +210,23 @@
|
|
|
</span>
|
|
|
</el-dialog>
|
|
|
|
|
|
+ <el-dialog title="样本导出" :visible.sync="sampleExportVisible" width = "800px">
|
|
|
+ <el-form>
|
|
|
+ <el-form-item label="样本类型">
|
|
|
+ <el-select v-model="SampleType" placeholder="请选择样本类型">
|
|
|
+ <el-option v-for="(item, index) in ExportSampleTypeList"
|
|
|
+ :label="item.name"
|
|
|
+ :value="item.id"
|
|
|
+ :key="index"></el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ <span slot="footer" class="dialog-footer">
|
|
|
+ <el-button size="mini" @click="sampleExportVisible = false">取 消</el-button>
|
|
|
+ <el-button size="mini" type="primary" @click="exportsamples">导 出</el-button>
|
|
|
+ </span>
|
|
|
+ </el-dialog>
|
|
|
+
|
|
|
<el-dialog title="选中显示列(拖拽可以实现排序)" :visible.sync="columndialogVisible" top="5vh">
|
|
|
<el-checkbox :indeterminate="isIndeterminate" v-model="checkAll" @change="handleCheckAllChange"
|
|
|
style="margin-left:15px;">全选</el-checkbox>
|
|
|
@@ -255,6 +272,8 @@ export default {
|
|
|
data () {
|
|
|
return {
|
|
|
dialogVisible: false,
|
|
|
+ sampleExportVisible: false, // 样本导出弹框
|
|
|
+ exportType: '',
|
|
|
currentItemCount: 0, // 当前页显示数量
|
|
|
currentPage: 1, // 当前页
|
|
|
size: 200, // 每页显示数量
|
|
|
@@ -274,6 +293,7 @@ export default {
|
|
|
CreateOn: [], // 录入时期
|
|
|
StartDate: '', // 开始时期
|
|
|
EndDate: '', // 结束时期
|
|
|
+ ExportSampleTypeList: [], // 导出的样本类型列表
|
|
|
GroupName: '', // 所属分组
|
|
|
Name: '', // 名称
|
|
|
SourceName: '', // 样本来源
|
|
|
@@ -550,8 +570,12 @@ export default {
|
|
|
.then(res => {
|
|
|
this.ExpandInfoList = res.data
|
|
|
})
|
|
|
+ // 获取样本类型列表
|
|
|
+ service.postRequest('dashoo.biobank.bee-0.1', 'SampleRelated', 'GetSampleType')
|
|
|
+ .then(res => {
|
|
|
+ this.SampleTypeList = res.data
|
|
|
+ })
|
|
|
},
|
|
|
- // 获取容器名称列表
|
|
|
GetEquipmentInfos () {
|
|
|
if (this.DItem != ''){
|
|
|
service.postRequest('dashoo.biobank.bee-0.1', 'Equipment', 'GetEquipmentInfos', {DItem: this.DItem})
|
|
|
@@ -585,7 +609,10 @@ export default {
|
|
|
_currentPage: -1
|
|
|
})
|
|
|
.then(res => {
|
|
|
- _this.sampletypes = res.data.items
|
|
|
+ this.getSampleTypeList(this.multipleSelection)
|
|
|
+ this.exportType = 'exportchosen'
|
|
|
+ this.sampleExportVisible = true
|
|
|
+ // _this.exportsamples('exportchosen')
|
|
|
if (store.get('samplewaitstoreseach').searchWithTemplate && store.get('samplewaitstoreseach').searchWithTemplate !==
|
|
|
'') { // 自定义查询
|
|
|
this.handleSearchCommand(store.get('samplewaitstoreseach').searchWithTemplate)
|
|
|
@@ -716,7 +743,7 @@ export default {
|
|
|
Name: name,
|
|
|
Fields: []
|
|
|
}),
|
|
|
- this.currentSearchTemplateName = name
|
|
|
+ this.currentSearchTemplateName = name
|
|
|
|
|
|
for (let i = 0; i < this.searchTemplates.length; i++) {
|
|
|
if (this.searchTemplates[i].Name == this.currentSearchTemplateName) {
|
|
|
@@ -1053,7 +1080,10 @@ export default {
|
|
|
})
|
|
|
return
|
|
|
}
|
|
|
- _this.exportsamples('exportpage')
|
|
|
+ this.getSampleTypeList(null)
|
|
|
+ this.exportType = 'exportpage'
|
|
|
+ this.sampleExportVisible = true
|
|
|
+ // _this.exportsamples('exportpage')
|
|
|
} else if (command == 'exportall') { // 导出所有数据
|
|
|
_this.$confirm('此操作将导出所有满足条件的数据!是否继续导出?', '提示', {
|
|
|
confirmButtonText: '确定',
|
|
|
@@ -1064,7 +1094,45 @@ export default {
|
|
|
}).catch(() => {})
|
|
|
}
|
|
|
},
|
|
|
- exportsamples (val) {
|
|
|
+ // 获取当前选择样本的类型
|
|
|
+ getSampleTypeList (multipleSelection) {
|
|
|
+ let _this = this
|
|
|
+ _this.ExportSampleTypeList = [{
|
|
|
+ name: '全部',
|
|
|
+ id: 0
|
|
|
+ }]
|
|
|
+ // 导出当前页,遍历当前页数据的样本类型
|
|
|
+ if (multipleSelection != null) {
|
|
|
+ for (var i = 0; i < multipleSelection.length; i++) {
|
|
|
+ var items = undefined
|
|
|
+ items = this.ExportSampleTypeList.find((item) => {
|
|
|
+ if (item.id == multipleSelection[i].SampleType) {
|
|
|
+ return item
|
|
|
+ }
|
|
|
+ })
|
|
|
+ if (items == undefined) {
|
|
|
+ _this.ExportSampleTypeList.push(...this.SampleTypeList.filter(function (e) {
|
|
|
+ return e.id == multipleSelection[i].SampleType
|
|
|
+ }))
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else if (multipleSelection == null) {
|
|
|
+ for (var i = 0; i < _this.list.length; i++) {
|
|
|
+ var items = undefined
|
|
|
+ items = this.ExportSampleTypeList.find((item) => {
|
|
|
+ if (item.id == _this.list[i].SampleType) {
|
|
|
+ return item
|
|
|
+ }
|
|
|
+ })
|
|
|
+ if (items == undefined) {
|
|
|
+ this.ExportSampleTypeList.push(...this.SampleTypeList.filter(function (e) {
|
|
|
+ return e.id == _this.list[i].SampleType
|
|
|
+ }))
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ exportsamples () {
|
|
|
let _this = this
|
|
|
// 显示列
|
|
|
let showcolumnarr = []
|
|
|
@@ -1077,8 +1145,8 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
let params = {
|
|
|
- _currentPage: this.currentPage,
|
|
|
- _size: this.size,
|
|
|
+ currentPage: this.currentPage,
|
|
|
+ size: this.size,
|
|
|
BarCode: this.BarCode,
|
|
|
SampleCode: this.SampleCode,
|
|
|
SampleType: this.SampleType,
|
|
|
@@ -1094,9 +1162,12 @@ export default {
|
|
|
Validity: this.Validity,
|
|
|
InnerCode: this.InnerCode,
|
|
|
GroupName: this.GroupName,
|
|
|
- showcolumnarr: showcolumnarr + '',
|
|
|
- showcolumnnamearr: showcolumnnamearr + '',
|
|
|
- ExportFlag: 'archived'
|
|
|
+ showColumn: showcolumnarr + '',
|
|
|
+ showColumnName: showcolumnnamearr + '',
|
|
|
+ type: 'archived'
|
|
|
+ // showcolumnarr: showcolumnarr + '',
|
|
|
+ // showcolumnnamearr: showcolumnnamearr + '',
|
|
|
+ // ExportFlag: 'archived'
|
|
|
}
|
|
|
if (this.CreateOn && this.CreateOn.length === 2) {
|
|
|
let params2 = {
|
|
|
@@ -1113,7 +1184,7 @@ export default {
|
|
|
params = Object.assign(params, params3)
|
|
|
}
|
|
|
// 导出所选样本
|
|
|
- if (val == 'exportchosen') {
|
|
|
+ if (_this.exportType == 'exportchosen') {
|
|
|
for (var i = 0; i < _this.multipleSelection.length; i++) {
|
|
|
if (i == _this.multipleSelection.length - 1) {
|
|
|
id += _this.multipleSelection[i].Id
|
|
|
@@ -1127,7 +1198,7 @@ export default {
|
|
|
params = Object.assign(params, paramsid)
|
|
|
}
|
|
|
// 导出当前页样本
|
|
|
- if (val == 'exportpage') {
|
|
|
+ if (_this.exportType == 'exportpage') {
|
|
|
for (var i = 0; i < _this.list.length; i++) {
|
|
|
if (i == _this.list.length - 1) {
|
|
|
id += _this.list[i].Id
|
|
|
@@ -1140,15 +1211,31 @@ export default {
|
|
|
}
|
|
|
params = Object.assign(params, paramsid)
|
|
|
}
|
|
|
- _this.$axios.get('/sampleinput/exportexcel', {
|
|
|
- params
|
|
|
- })
|
|
|
- .then(res => {
|
|
|
- window.location = 'http://' + res.data
|
|
|
- })
|
|
|
- .catch(err => {
|
|
|
- console.error(err)
|
|
|
- })
|
|
|
+ const dateInfo = this.formatExportDate(new Date())
|
|
|
+ const name = dateInfo + '样本来源.xlsx'
|
|
|
+ console.log('filename', name)
|
|
|
+ // 样本来源相关导出
|
|
|
+ service.downloadExcel('dashoo.biobank.bee-0.1', 'SampleRelated', 'ExportExcel', name, params)
|
|
|
+ // _this.$axios.get('/sampleinput/exportexcel', {
|
|
|
+ // params
|
|
|
+ // })
|
|
|
+ // .then(res => {
|
|
|
+ // _this.exportloading = false
|
|
|
+ // // window.location = 'http://' + res.data
|
|
|
+ // })
|
|
|
+ // .catch(err => {
|
|
|
+ // _this.exportloading = false
|
|
|
+ // // handle error
|
|
|
+ // console.error(err)
|
|
|
+ // })
|
|
|
+ },
|
|
|
+ formatExportDate (date) {
|
|
|
+ var y = date.getFullYear()
|
|
|
+ var m = date.getMonth() + 1
|
|
|
+ m = m < 10 ? ('0' + m) : m
|
|
|
+ var d = date.getDate()
|
|
|
+ d = d < 10 ? ('0' + d) : d
|
|
|
+ return y + m + d
|
|
|
},
|
|
|
// 样本条码批量打印
|
|
|
batchprint () {
|