|
|
@@ -10,6 +10,16 @@
|
|
|
<el-breadcrumb-item :to="{ path: '/biobank/source' }">样本来源</el-breadcrumb-item>
|
|
|
</el-breadcrumb>
|
|
|
<span style="float: right;">
|
|
|
+ <el-dropdown split-button type="primary" size="mini" style="margin-left:10px; margin-top: -4px;"
|
|
|
+ @command="handleExportsamplesCommand">
|
|
|
+ 导出
|
|
|
+ <el-dropdown-menu slot="dropdown">
|
|
|
+ <el-dropdown-item style="color:black;" command="exportchosen">导出所选样本源</el-dropdown-item>
|
|
|
+ <el-dropdown-item style="color:black;" command="exportpage">导出当前页样本源</el-dropdown-item>
|
|
|
+ <el-dropdown-item style="color:black;" command="exportall">导出所有样本源</el-dropdown-item>
|
|
|
+ <el-dropdown-item style="color:black;" command="exportassociation">导出关联的样本</el-dropdown-item>
|
|
|
+ </el-dropdown-menu>
|
|
|
+ </el-dropdown>
|
|
|
<router-link :to="'/biobank/source/addsource/operationb'">
|
|
|
<el-button type="primary" size="mini" style="margin-left:10px; margin-top: -4px;">添加</el-button>
|
|
|
</router-link>
|
|
|
@@ -25,7 +35,7 @@
|
|
|
</el-form-item>
|
|
|
<el-form-item label="创建日期">
|
|
|
<el-date-picker size="mini" style="width: 220px" v-model="CreateOn" type="daterange" range-separator="至"
|
|
|
- start-placeholder="开始日期" end-placeholder="结束日期"></el-date-picker>
|
|
|
+ start-placeholder="开始日期" end-placeholder="结束日期"></el-date-picker>
|
|
|
</el-form-item>
|
|
|
<el-form-item>
|
|
|
<el-dropdown split-button type="primary" size="mini" @click="seachdata" @command="searchCommand">
|
|
|
@@ -39,15 +49,21 @@
|
|
|
</el-form>
|
|
|
</div>
|
|
|
|
|
|
- <el-table :data="donorsList" border style="width: 100%" height="calc(100vh - 230px)" @sort-change="orderby">
|
|
|
- <el-table-column label="操作" width="80" align="center" fixed>
|
|
|
+ <el-table ref="tableData" :data="donorsList" border style="width: 100%" height="calc(100vh - 230px)"
|
|
|
+ @selection-change="handleSelectionChange" @sort-change="orderby">
|
|
|
+ <el-table-column type="selection" width="55"></el-table-column>
|
|
|
+ <el-table-column label="操作" width="100" align="center" fixed>
|
|
|
<template slot-scope="scope">
|
|
|
<router-link
|
|
|
:to="'/biobank/source/'+scope.row.Id+'/operationb?pname=biobank-source-animal&size='+size+'¤tPage='+currentPage">
|
|
|
<el-button type="text" title="编辑" size="small" icon="el-icon-edit"></el-button>
|
|
|
</router-link>
|
|
|
+ <span
|
|
|
+ @click="handlePush(scope.row.Name)">
|
|
|
+ <el-button type="text" title="查看关联样本" size="small" icon="el-icon-link"></el-button>
|
|
|
+ </span>
|
|
|
<el-button size="small" type="text" icon="el-icon-delete" style="margin-left:3px;" title="删除"
|
|
|
- @click="delSamplesSource(scope.row)"></el-button>
|
|
|
+ @click="delSamplesSource(scope.row)"></el-button>
|
|
|
<router-link :to="'/biobank/source/'+ scope.row.Id + '/sourcedetail'">
|
|
|
<el-button size="small" title="详情" type="text" style="margin-left:3px;">
|
|
|
<i class="icon icon-eye"></i>
|
|
|
@@ -86,8 +102,8 @@
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
|
<el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="currentPage"
|
|
|
- :page-sizes="[10, 100, 200, 500]" :page-size="size" layout="total, sizes, prev, pager, next, jumper"
|
|
|
- :total="currentItemCount">
|
|
|
+ :page-sizes="[10, 100, 200, 500]" :page-size="size" layout="total, sizes, prev, pager, next, jumper"
|
|
|
+ :total="currentItemCount">
|
|
|
</el-pagination>
|
|
|
</el-card>
|
|
|
<el-dialog title="高级查询" :visible.sync="dialogVisible" width="700px">
|
|
|
@@ -114,7 +130,7 @@
|
|
|
<el-col :span="12">
|
|
|
<el-form-item label="蜂种">
|
|
|
<el-select ref="reftube" v-model="searchform.Genus" placeholder="请选择蜂种" style="width:100%" size="mini"
|
|
|
- filterable>
|
|
|
+ filterable>
|
|
|
<el-option v-for="item in genuslist" :label="item.Value" :value="item.Value" :key="item.Key">
|
|
|
</el-option>
|
|
|
</el-select>
|
|
|
@@ -128,13 +144,13 @@
|
|
|
<el-col :span="12">
|
|
|
<el-form-item label="采样日期">
|
|
|
<el-date-picker size="mini" style="width: 240px" v-model="SurveyDate" type="daterange" range-separator="至"
|
|
|
- start-placeholder="开始日期" end-placeholder="结束日期"></el-date-picker>
|
|
|
+ start-placeholder="开始日期" end-placeholder="结束日期"></el-date-picker>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="12">
|
|
|
<el-form-item label="项目属性">
|
|
|
<el-select ref="refProject" v-model="searchform.ProjectName" size="mini" style="width: 240px"
|
|
|
- placeholder="请选择项目属性">
|
|
|
+ placeholder="请选择项目属性">
|
|
|
<el-option v-for="item in projectlist" :label="item.Value" :value="item.Value" :key="item.Value">
|
|
|
</el-option>
|
|
|
</el-select>
|
|
|
@@ -143,7 +159,7 @@
|
|
|
<el-col :span="12">
|
|
|
<el-form-item label="审核状态">
|
|
|
<el-select ref="refplace" v-model="searchform.AuditorStatus" size="mini" style="width: 240px"
|
|
|
- placeholder="请选择样本来源">
|
|
|
+ placeholder="请选择样本来源">
|
|
|
<el-option label="未审核" value="0"></el-option>
|
|
|
<el-option label="审核成功" value="1"></el-option>
|
|
|
<el-option label="审核失败" value="2"></el-option>
|
|
|
@@ -172,7 +188,7 @@
|
|
|
|
|
|
<el-dialog title="样本批量导入" :visible.sync="importVisible">
|
|
|
<el-upload :action="filehost + '/api/uploads/exportanimal'" :show-file-list="false" :data="importfileparam"
|
|
|
- :on-success="handleexportfileSuccess" :before-upload="beforeexportfileUpload">
|
|
|
+ :on-success="handleexportfileSuccess" :before-upload="beforeexportfileUpload">
|
|
|
<el-button size="mini" type="primary">点击上传导入文件</el-button> <span>{{importmsg}}</span>
|
|
|
<div slot="tip" class="el-upload__tip">只能上传由导入模板录入的xlsx文件,其中模板中带星号(*)的为必填项,不填写将会被忽略</div>
|
|
|
</el-upload>
|
|
|
@@ -184,185 +200,167 @@
|
|
|
</div>
|
|
|
</template>
|
|
|
<script>
|
|
|
- import {
|
|
|
- mapGetters
|
|
|
- } from 'vuex'
|
|
|
- export default {
|
|
|
+import {
|
|
|
+ mapGetters
|
|
|
+} from 'vuex'
|
|
|
+export default {
|
|
|
|
|
|
- computed: {
|
|
|
- ...mapGetters({
|
|
|
- authUser: 'authUser'
|
|
|
- })
|
|
|
+ computed: {
|
|
|
+ ...mapGetters({
|
|
|
+ authUser: 'authUser'
|
|
|
+ })
|
|
|
+ },
|
|
|
+ name: 'samplessource',
|
|
|
+ data () {
|
|
|
+ return {
|
|
|
+ filehost: '',
|
|
|
+ importfileparam: {}, // 导入文件参数
|
|
|
+ importfilepath: '', // 导入文件路径
|
|
|
+ importVisible: false, // 导入对话框
|
|
|
+ importmsg: '未选择文件', // 导入文件
|
|
|
+ dialogVisible: false,
|
|
|
+ classificationlist: [],
|
|
|
+ multipleSelection: [],
|
|
|
+ list: [], // table显示数据集
|
|
|
+ exportloading: false,
|
|
|
+ searchform: {
|
|
|
+ GenusId: '',
|
|
|
+ Genus: '',
|
|
|
+ Address: '',
|
|
|
+ InnerNo: '',
|
|
|
+ CreateOn: '',
|
|
|
+ Name: '',
|
|
|
+ Weight: '',
|
|
|
+ SourceType: '',
|
|
|
+ currentPage: '',
|
|
|
+ size: '',
|
|
|
+ ProjectName: '',
|
|
|
+ AuditorStatus: '',
|
|
|
+ AuditorName: '',
|
|
|
+ Tive: '',
|
|
|
+ remark: '',
|
|
|
+ starttime: null,
|
|
|
+ endtime: null
|
|
|
+ },
|
|
|
+ SurveyDate: [], // 采样日期
|
|
|
+ CreateOn: [],
|
|
|
+ currentItemCount: 0,
|
|
|
+ currentPage: 1,
|
|
|
+ size: 200,
|
|
|
+ donorsList: [],
|
|
|
+ // 列表排序
|
|
|
+ Column: {
|
|
|
+ Order: '',
|
|
|
+ Prop: ''
|
|
|
+ },
|
|
|
+ acceptUsers: [],
|
|
|
+ userlist: [],
|
|
|
+ genuslist: [],
|
|
|
+ projectlist: []
|
|
|
+ }
|
|
|
+ },
|
|
|
+ created () {
|
|
|
+ if (this.$route.query.size && this.$route.query.currentPage) {
|
|
|
+ this.size = parseInt(this.$route.query.size)
|
|
|
+ this.currentPage = parseInt(this.$route.query.currentPage)
|
|
|
+ }
|
|
|
+ this.filehost = process.env.imgserverhost
|
|
|
+ this.initdata()
|
|
|
+ this.getAnimalGenus()
|
|
|
+ this.getProjectlist()
|
|
|
+ this.importfileparam = {
|
|
|
+ accode: this.authUser.Profile.AccCode
|
|
|
+ }
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ // 接收时this.$route.query.SourceName
|
|
|
+ handlePush (name) {
|
|
|
+ this.$router.push(
|
|
|
+ {path: '/samples/stored',
|
|
|
+ query: {name: name}
|
|
|
+ }
|
|
|
+ )
|
|
|
},
|
|
|
- name: 'samplessource',
|
|
|
- data () {
|
|
|
- return {
|
|
|
- filehost: '',
|
|
|
- importfileparam: {}, // 导入文件参数
|
|
|
- importfilepath: '', // 导入文件路径
|
|
|
- importVisible: false, // 导入对话框
|
|
|
- importmsg: '未选择文件', // 导入文件
|
|
|
- dialogVisible: false,
|
|
|
- classificationlist: [],
|
|
|
- searchform: {
|
|
|
- GenusId: '',
|
|
|
- Genus: '',
|
|
|
- Address: '',
|
|
|
- InnerNo: '',
|
|
|
- Name: '',
|
|
|
- Weight: '',
|
|
|
- SourceType: '',
|
|
|
- ProjectName: '',
|
|
|
- AuditorStatus: '',
|
|
|
- AuditorName: '',
|
|
|
- Tive: '',
|
|
|
- remark: '',
|
|
|
- starttime: null,
|
|
|
- endtime: null
|
|
|
- },
|
|
|
- SurveyDate: [], // 采样日期
|
|
|
- CreateOn: [new Date(new Date().getTime() - 3 * 30 * 24 * 60 * 60 * 1000), new Date()],
|
|
|
- currentItemCount: 0,
|
|
|
- currentPage: 1,
|
|
|
- size: 10,
|
|
|
- donorsList: [],
|
|
|
- // 列表排序
|
|
|
- Column: {
|
|
|
- Order: '',
|
|
|
- Prop: ''
|
|
|
- },
|
|
|
- acceptUsers: [],
|
|
|
- userlist: [],
|
|
|
- genuslist: [],
|
|
|
- projectlist: []
|
|
|
+ initdata () {
|
|
|
+ let _this = this
|
|
|
+ let SurveyDate = []
|
|
|
+ if (!_this.SurveyDate) {
|
|
|
+ _this.SurveyDate = []
|
|
|
}
|
|
|
- },
|
|
|
- created () {
|
|
|
- if (this.$route.query.size && this.$route.query.currentPage) {
|
|
|
- this.size = parseInt(this.$route.query.size)
|
|
|
- this.currentPage = parseInt(this.$route.query.currentPage)
|
|
|
+ if (_this.SurveyDate.length == 2) {
|
|
|
+ _this.SurveyDate[1].setHours(23)
|
|
|
+ _this.SurveyDate[1].setMinutes(59)
|
|
|
+ _this.SurveyDate[1].setSeconds(59)
|
|
|
+ SurveyDate.push(_this.formatDateTime(_this.SurveyDate[0]))
|
|
|
+ SurveyDate.push(_this.formatDateTime(_this.SurveyDate[1]))
|
|
|
}
|
|
|
- this.filehost = process.env.imgserverhost
|
|
|
- this.initdata()
|
|
|
- this.getAnimalGenus()
|
|
|
- this.getProjectlist()
|
|
|
- this.importfileparam = {
|
|
|
- accode: this.authUser.Profile.AccCode
|
|
|
+ let CreateOn = []
|
|
|
+ if (_this.CreateOn != null) {
|
|
|
+ if (_this.CreateOn.length == 2) {
|
|
|
+ _this.CreateOn[1].setHours(23)
|
|
|
+ _this.CreateOn[1].setMinutes(59)
|
|
|
+ _this.CreateOn[1].setSeconds(59)
|
|
|
+ CreateOn.push(_this.formatDateTime(_this.CreateOn[0]))
|
|
|
+ CreateOn.push(_this.formatDateTime(_this.CreateOn[1]))
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ const params = {
|
|
|
+ _currentPage: this.currentPage,
|
|
|
+ _size: this.size,
|
|
|
+ Order: this.Column.Order,
|
|
|
+ Prop: this.Column.Prop
|
|
|
}
|
|
|
+ Object.assign(params, _this.searchform)
|
|
|
+ _this.$axios.get('/samplessource/animallist?SurveyDate=' + SurveyDate.join(',') + '&CreateOn=' +
|
|
|
+ CreateOn.join(','), {
|
|
|
+ params
|
|
|
+ })
|
|
|
+ .then(res => {
|
|
|
+ _this.donorsList = res.data.items
|
|
|
+ _this.currentItemCount = res.data.currentItemCount
|
|
|
+ })
|
|
|
+ .catch(err => {
|
|
|
+ console.error(err)
|
|
|
+ })
|
|
|
},
|
|
|
- methods: {
|
|
|
- initdata () {
|
|
|
- let _this = this
|
|
|
- let SurveyDate = []
|
|
|
- if (!_this.SurveyDate) {
|
|
|
- _this.SurveyDate = []
|
|
|
- }
|
|
|
- if (_this.SurveyDate.length == 2) {
|
|
|
- _this.SurveyDate[1].setHours(23)
|
|
|
- _this.SurveyDate[1].setMinutes(59)
|
|
|
- _this.SurveyDate[1].setSeconds(59)
|
|
|
- SurveyDate.push(_this.formatDateTime(_this.SurveyDate[0]))
|
|
|
- SurveyDate.push(_this.formatDateTime(_this.SurveyDate[1]))
|
|
|
- }
|
|
|
- let CreateOn = []
|
|
|
- if (_this.CreateOn != null) {
|
|
|
- if (_this.CreateOn.length == 2) {
|
|
|
- _this.CreateOn[1].setHours(23)
|
|
|
- _this.CreateOn[1].setMinutes(59)
|
|
|
- _this.CreateOn[1].setSeconds(59)
|
|
|
- CreateOn.push(_this.formatDateTime(_this.CreateOn[0]))
|
|
|
- CreateOn.push(_this.formatDateTime(_this.CreateOn[1]))
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- const params = {
|
|
|
- _currentPage: this.currentPage,
|
|
|
- _size: this.size,
|
|
|
- Order: this.Column.Order,
|
|
|
- Prop: this.Column.Prop
|
|
|
- }
|
|
|
- Object.assign(params, _this.searchform)
|
|
|
- _this.$axios.get('/samplessource/animallist?SurveyDate=' + SurveyDate.join(',') + '&CreateOn=' +
|
|
|
- CreateOn.join(','), {
|
|
|
- params
|
|
|
+ getaddress (val) {
|
|
|
+ let address = val.ProvinceName + val.CityName + val.StreetName + val.Address
|
|
|
+ return address
|
|
|
+ },
|
|
|
+ getAnimalGenus () {
|
|
|
+ // 获取种属
|
|
|
+ let _this = this
|
|
|
+ _this.$axios.get('/items/worditem?code=AnimalGenus', {})
|
|
|
+ .then(res => {
|
|
|
+ _this.genuslist = res.data
|
|
|
})
|
|
|
+ },
|
|
|
+ // 获取项目属性
|
|
|
+ getProjectlist () {
|
|
|
+ let _this = this
|
|
|
+ _this.$axios.get('/items/worditem?code=ProjectName', {})
|
|
|
+ .then(res => {
|
|
|
+ _this.projectlist = res.data
|
|
|
+ })
|
|
|
+ },
|
|
|
+ delSamplesSource (val) {
|
|
|
+ let _this = this
|
|
|
+ _this.$confirm('此操作将永久删除该数据, 是否继续?', '提示', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning'
|
|
|
+ }).then(() => {
|
|
|
+ _this.$axios.delete('samplessource/delbioinfo/' + val.Id + '?GenusId=' + val.GenusId, null)
|
|
|
.then(res => {
|
|
|
- _this.donorsList = res.data.items
|
|
|
- _this.currentItemCount = res.data.currentItemCount
|
|
|
- })
|
|
|
- .catch(err => {
|
|
|
- console.error(err)
|
|
|
- })
|
|
|
- },
|
|
|
- getaddress (val) {
|
|
|
- let address = val.ProvinceName + val.CityName + val.StreetName + val.Address
|
|
|
- return address
|
|
|
- },
|
|
|
- getAnimalGenus () {
|
|
|
- // 获取种属
|
|
|
- let _this = this
|
|
|
- _this.$axios.get('/items/worditem?code=AnimalGenus', {})
|
|
|
- .then(res => {
|
|
|
- _this.genuslist = res.data
|
|
|
- })
|
|
|
- },
|
|
|
- // 获取项目属性
|
|
|
- getProjectlist () {
|
|
|
- let _this = this
|
|
|
- _this.$axios.get('/items/worditem?code=ProjectName', {})
|
|
|
- .then(res => {
|
|
|
- _this.projectlist = res.data
|
|
|
- })
|
|
|
- },
|
|
|
- delSamplesSource (val) {
|
|
|
- let _this = this
|
|
|
- _this.$confirm('此操作将永久删除该数据, 是否继续?', '提示', {
|
|
|
- confirmButtonText: '确定',
|
|
|
- cancelButtonText: '取消',
|
|
|
- type: 'warning'
|
|
|
- }).then(() => {
|
|
|
- _this.$axios.delete('samplessource/delbioinfo/' + val.Id + '?GenusId=' + val.GenusId, null)
|
|
|
- .then(res => {
|
|
|
- // response
|
|
|
- if (res.data.code === 0) {
|
|
|
- _this.$message({
|
|
|
- type: 'success',
|
|
|
- message: res.data.message
|
|
|
- })
|
|
|
- // 更新界面
|
|
|
- _this.initdata()
|
|
|
- } else {
|
|
|
- _this.$message({
|
|
|
- type: 'warning',
|
|
|
- message: res.data.message
|
|
|
- })
|
|
|
- }
|
|
|
- })
|
|
|
- .catch(() => {})
|
|
|
- }).catch(() => {})
|
|
|
- },
|
|
|
- // 导入蜜蜂样本来源
|
|
|
- importData () {
|
|
|
- let _this = this
|
|
|
- if (_this.importfilepath === '') {
|
|
|
- _this.$message({
|
|
|
- type: 'warning',
|
|
|
- message: '请先上传导入文件!'
|
|
|
- })
|
|
|
- return
|
|
|
- }
|
|
|
- _this.$axios.put('/samplessource/exceltosave?path=' + this.importfilepath, {})
|
|
|
- .then(res => {
|
|
|
+ // response
|
|
|
if (res.data.code === 0) {
|
|
|
_this.$message({
|
|
|
type: 'success',
|
|
|
message: res.data.message
|
|
|
})
|
|
|
- _this.importVisible = false
|
|
|
- _this.importfilepath = ''
|
|
|
- _this.importmsg = '未选择文件'
|
|
|
// 更新界面
|
|
|
- _this.initData()
|
|
|
+ _this.initdata()
|
|
|
} else {
|
|
|
_this.$message({
|
|
|
type: 'warning',
|
|
|
@@ -370,117 +368,277 @@
|
|
|
})
|
|
|
}
|
|
|
})
|
|
|
- .catch(err => {
|
|
|
- console.error(err)
|
|
|
+ .catch(() => {})
|
|
|
+ }).catch(() => {})
|
|
|
+ },
|
|
|
+ // 导入蜜蜂样本来源
|
|
|
+ importData () {
|
|
|
+ let _this = this
|
|
|
+ if (_this.importfilepath === '') {
|
|
|
+ _this.$message({
|
|
|
+ type: 'warning',
|
|
|
+ message: '请先上传导入文件!'
|
|
|
+ })
|
|
|
+ return
|
|
|
+ }
|
|
|
+ _this.$axios.put('/samplessource/exceltosave?path=' + this.importfilepath, {})
|
|
|
+ .then(res => {
|
|
|
+ if (res.data.code === 0) {
|
|
|
+ _this.$message({
|
|
|
+ type: 'success',
|
|
|
+ message: res.data.message
|
|
|
+ })
|
|
|
+ _this.importVisible = false
|
|
|
+ _this.importfilepath = ''
|
|
|
+ _this.importmsg = '未选择文件'
|
|
|
+ // 更新界面
|
|
|
+ _this.initData()
|
|
|
+ } else {
|
|
|
+ _this.$message({
|
|
|
+ type: 'warning',
|
|
|
+ message: res.data.message
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch(err => {
|
|
|
+ console.error(err)
|
|
|
+ })
|
|
|
+ },
|
|
|
+ handleexportfileSuccess (res, file) {
|
|
|
+ this.importfilepath = res
|
|
|
+ },
|
|
|
+ beforeexportfileUpload (file) {
|
|
|
+ let i = file.name.lastIndexOf('.')
|
|
|
+ let typename = ''
|
|
|
+ if (i > -1) {
|
|
|
+ typename = file.name.substring(i)
|
|
|
+ }
|
|
|
+ let istype = (typename === '.xlsx')
|
|
|
+ let isLt50k = file.size / 1024 / 1024 / 2 < 1
|
|
|
+ if (!istype) {
|
|
|
+ this.$message.error('上传导入文件只能是 xlsx 格式!')
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ if (!isLt50k) {
|
|
|
+ this.$message.error('上传导入文件大小不能超过 2M!')
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ this.importmsg = '上传文件:' + file.name
|
|
|
+ return true
|
|
|
+ },
|
|
|
+
|
|
|
+ // 列表排序功能
|
|
|
+ orderby (column) {
|
|
|
+ if (column.order == 'ascending') {
|
|
|
+ this.Column.Order = 'asc'
|
|
|
+ } else if (column.order == 'descending') {
|
|
|
+ this.Column.Order = 'desc'
|
|
|
+ }
|
|
|
+ this.Column.Prop = column.prop
|
|
|
+ this.initdata()
|
|
|
+ },
|
|
|
+ seachdata () {
|
|
|
+ this.currentPage = 1
|
|
|
+ this.initdata()
|
|
|
+ },
|
|
|
+ searchCommand (command) {
|
|
|
+ if (command == 'search') {
|
|
|
+ this.dialogVisible = true
|
|
|
+ } else if (command == 'clear') {
|
|
|
+ this.clearSearch()
|
|
|
+ }
|
|
|
+ },
|
|
|
+ clearSearch () {
|
|
|
+ this.searchform.GenusId = ''
|
|
|
+ this.searchform.Genus = ''
|
|
|
+ this.searchform.Address = ''
|
|
|
+ this.searchform.InnerNo = ''
|
|
|
+ this.searchform.SourceType = ''
|
|
|
+ this.searchform.ProjectName = ''
|
|
|
+ this.searchform.Name = ''
|
|
|
+ this.searchform.AuditorStatus = ''
|
|
|
+ this.searchform.AuditorName = ''
|
|
|
+ this.Name = ''
|
|
|
+ this.InnerNo = ''
|
|
|
+ this.CreateOn = []
|
|
|
+ this.SurveyDate = []
|
|
|
+ this.initdata()
|
|
|
+ },
|
|
|
+ handleSizeChange (value) {
|
|
|
+ this.size = value
|
|
|
+ this.currentPage = 1
|
|
|
+ this.initdata()
|
|
|
+ },
|
|
|
+ handleCurrentChange (value) {
|
|
|
+ this.currentPage = value
|
|
|
+ this.initdata()
|
|
|
+ },
|
|
|
+ formatDateTime (date) {
|
|
|
+ var y = date.getFullYear()
|
|
|
+ var m = date.getMonth() + 1
|
|
|
+ m = m < 10 ? ('0' + m) : m
|
|
|
+ var d = date.getDate()
|
|
|
+ d = d < 10 ? ('0' + d) : d
|
|
|
+ var h = date.getHours()
|
|
|
+ var minute = date.getMinutes()
|
|
|
+ minute = minute < 10 ? ('0' + minute) : minute
|
|
|
+ return y + '-' + m + '-' + d + ' ' + h + ':' + minute
|
|
|
+ },
|
|
|
+ // 导出样本
|
|
|
+ handleExportsamplesCommand (command) {
|
|
|
+ let _this = this
|
|
|
+ console.log(_this.$refs.tableData)
|
|
|
+ if (command === 'exportchosen') { // 导出所选数据
|
|
|
+ if (_this.$refs.tableData.selection.length < 1) {
|
|
|
+ _this.$message({
|
|
|
+ type: 'warning',
|
|
|
+ message: '请选择要导出的样本'
|
|
|
})
|
|
|
- },
|
|
|
- handleexportfileSuccess (res, file) {
|
|
|
- this.importfilepath = res
|
|
|
- },
|
|
|
- beforeexportfileUpload (file) {
|
|
|
- let i = file.name.lastIndexOf('.')
|
|
|
- let typename = ''
|
|
|
- if (i > -1) {
|
|
|
- typename = file.name.substring(i)
|
|
|
- }
|
|
|
- let istype = (typename === '.xlsx')
|
|
|
- let isLt50k = file.size / 1024 / 1024 / 2 < 1
|
|
|
- if (!istype) {
|
|
|
- this.$message.error('上传导入文件只能是 xlsx 格式!')
|
|
|
- return false
|
|
|
+ return
|
|
|
}
|
|
|
- if (!isLt50k) {
|
|
|
- this.$message.error('上传导入文件大小不能超过 2M!')
|
|
|
- return false
|
|
|
+ _this.exportsamples('exportchosen')
|
|
|
+ } else if (command === 'exportpage') { // 导出当前页数据
|
|
|
+ if (_this.$refs.tableData.data.length < 1) {
|
|
|
+ _this.$message({
|
|
|
+ type: 'warning',
|
|
|
+ message: '当前页无样本'
|
|
|
+ })
|
|
|
+ return
|
|
|
}
|
|
|
- this.importmsg = '上传文件:' + file.name
|
|
|
- return true
|
|
|
- },
|
|
|
+ _this.exportsamples('exportpage')
|
|
|
+ } else if (command === 'exportall') { // 导出所有数据
|
|
|
+ _this.$confirm('此操作将导出所有满足条件的数据!是否继续导出?', '提示', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'info'
|
|
|
+ }).then(() => {
|
|
|
+ _this.exportsamples()
|
|
|
+ }).catch(() => {
|
|
|
+ })
|
|
|
+ } else if (command === 'exporassociation') {
|
|
|
|
|
|
- // 列表排序功能
|
|
|
- orderby (column) {
|
|
|
- if (column.order == 'ascending') {
|
|
|
- this.Column.Order = 'asc'
|
|
|
- } else if (column.order == 'descending') {
|
|
|
- this.Column.Order = 'desc'
|
|
|
+ }
|
|
|
+ },
|
|
|
+ exportsamples (val) {
|
|
|
+ let _this = this
|
|
|
+ _this.exportloading = true
|
|
|
+ // 显示列
|
|
|
+ let showcolumnarr = []
|
|
|
+ let showcolumnnamearr = []
|
|
|
+ let id = ''
|
|
|
+ /* for (var i = 0; i < _this.showcolumn.length; i++) {
|
|
|
+ if (_this.showcolumn[i].show) {
|
|
|
+ showcolumnarr.push(_this.showcolumn[i].filed)
|
|
|
+ showcolumnnamearr.push(_this.showcolumn[i].name.replace(/,/g, ','))
|
|
|
}
|
|
|
- this.Column.Prop = column.prop
|
|
|
- this.initdata()
|
|
|
- },
|
|
|
- seachdata () {
|
|
|
- this.currentPage = 1
|
|
|
- this.initdata()
|
|
|
- },
|
|
|
- searchCommand (command) {
|
|
|
- if (command == 'search') {
|
|
|
- this.dialogVisible = true
|
|
|
- } else if (command == 'clear') {
|
|
|
- this.clearSearch()
|
|
|
+ } */
|
|
|
+ let params = {
|
|
|
+ _currentPage: this.currentPage,
|
|
|
+ _size: this.size,
|
|
|
+ GenusId: this.GenusId,
|
|
|
+ Genus: this.Genus,
|
|
|
+ Address: this.Address,
|
|
|
+ InnerNo: this.InnerNo,
|
|
|
+ CreateOn: this.CreateOn,
|
|
|
+ SourceType: this.SourceType,
|
|
|
+ ProjectName: this.ProjectName,
|
|
|
+ Name: this.Name,
|
|
|
+ AuditorStatus: this.AuditorStatus,
|
|
|
+ AuditorName: this.AuditorName,
|
|
|
+ showcolumnarr: showcolumnarr + '',
|
|
|
+ showcolumnnamearr: showcolumnnamearr + '',
|
|
|
+ ExportFlag: 'stored'
|
|
|
+ }
|
|
|
+ /* if (this.CreateOn && this.CreateOn.length === 2) {
|
|
|
+ let params2 = {
|
|
|
+ CreateOnstart: this.CreateOn[0] / 1000,
|
|
|
+ CreateOnend: this.CreateOn[1] / 1000
|
|
|
}
|
|
|
- },
|
|
|
- clearSearch () {
|
|
|
- this.searchform.GenusId = ''
|
|
|
- this.searchform.Genus = ''
|
|
|
- this.searchform.Address = ''
|
|
|
- this.searchform.InnerNo = ''
|
|
|
- this.searchform.SourceType = ''
|
|
|
- this.searchform.ProjectName = ''
|
|
|
- this.searchform.Name = ''
|
|
|
- this.searchform.AuditorStatus = ''
|
|
|
- this.searchform.AuditorName = ''
|
|
|
- this.SurveyDate = []
|
|
|
- this.CreateOn = []
|
|
|
- this.initdata()
|
|
|
- },
|
|
|
- handleSizeChange (value) {
|
|
|
- this.size = value
|
|
|
- this.currentPage = 1
|
|
|
- this.initdata()
|
|
|
- },
|
|
|
- handleCurrentChange (value) {
|
|
|
- this.currentPage = value
|
|
|
- this.initdata()
|
|
|
- },
|
|
|
- formatDateTime (date) {
|
|
|
- var y = date.getFullYear()
|
|
|
- var m = date.getMonth() + 1
|
|
|
- m = m < 10 ? ('0' + m) : m
|
|
|
- var d = date.getDate()
|
|
|
- d = d < 10 ? ('0' + d) : d
|
|
|
- var h = date.getHours()
|
|
|
- var minute = date.getMinutes()
|
|
|
- minute = minute < 10 ? ('0' + minute) : minute
|
|
|
- return y + '-' + m + '-' + d + ' ' + h + ':' + minute
|
|
|
- },
|
|
|
- jstimehandle (val) {
|
|
|
- if (val === '') {
|
|
|
- return '----'
|
|
|
- } else if (val === '0001-01-01T08:00:00+08:00') {
|
|
|
- return '----'
|
|
|
- } else if (val === '5000-01-01T23:59:59+08:00') {
|
|
|
- return '永久'
|
|
|
- } else {
|
|
|
- val = val.replace('T', ' ')
|
|
|
- return val.substring(0, 10)
|
|
|
+ params = Object.assign(params, params2)
|
|
|
+ }
|
|
|
+ if (_this.Validity && _this.Validity.length === 2) {
|
|
|
+ let params3 = {
|
|
|
+ Validitystart: _this.Validity[0] / 1000,
|
|
|
+ Validityend: _this.Validity[1] / 1000
|
|
|
+ }
|
|
|
+ params = Object.assign(params, params3)
|
|
|
+ } */
|
|
|
+ // 导出所选样本
|
|
|
+ if (val === 'exportchosen') {
|
|
|
+ for (var i = 0; i < _this.$refs.tableData.selection.length; i++) {
|
|
|
+ if (i === _this.$refs.tableData.selection.length - 1) {
|
|
|
+ id += _this.$refs.tableData.selection[i].Id
|
|
|
+ } else {
|
|
|
+ id += _this.$refs.tableData.selection[i].Id + ','
|
|
|
+ }
|
|
|
+ }
|
|
|
+ let paramsid = {
|
|
|
+ Id: id
|
|
|
}
|
|
|
+ params = Object.assign(params, paramsid)
|
|
|
}
|
|
|
+ // 导出当前页样本
|
|
|
+ if (val === 'exportpage') {
|
|
|
+ for (var i = 0; i < _this.$refs.tableData.data.length; i++) {
|
|
|
+ if (i === _this.$refs.tableData.data.length - 1) {
|
|
|
+ id += _this.$refs.tableData.data[i].Id
|
|
|
+ } else {
|
|
|
+ id += _this.$refs.tableData.data[i].Id + ','
|
|
|
+ }
|
|
|
+ }
|
|
|
+ let paramsid = {
|
|
|
+ Id: id
|
|
|
+ }
|
|
|
+ params = Object.assign(params, paramsid)
|
|
|
+ }
|
|
|
+ console.log(1)
|
|
|
+
|
|
|
+ _this.$axios.get('/samplesource/exportexcel', {
|
|
|
+ params
|
|
|
+ })
|
|
|
+ .then(res => {
|
|
|
+ _this.exportloading = false
|
|
|
+ window.location = 'http://' + res.data
|
|
|
+ })
|
|
|
+ .catch(err => {
|
|
|
+ _this.exportloading = false
|
|
|
+ // handle error
|
|
|
+ console.error(err)
|
|
|
+ })
|
|
|
+ },
|
|
|
+ jstimehandle (val) {
|
|
|
+ if (val === '') {
|
|
|
+ return '----'
|
|
|
+ } else if (val === '0001-01-01T08:00:00+08:00') {
|
|
|
+ return '----'
|
|
|
+ } else if (val === '5000-01-01T23:59:59+08:00') {
|
|
|
+ return '永久'
|
|
|
+ } else {
|
|
|
+ val = val.replace('T', ' ')
|
|
|
+ return val.substring(0, 10)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ handleSelectionChange (val) {
|
|
|
+ this.multipleSelection = val
|
|
|
+ console.log('this.multipleSelection', this.multipleSelection)
|
|
|
}
|
|
|
}
|
|
|
+}
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss">
|
|
|
- .el-pagination {
|
|
|
- margin: 1rem 0 2rem;
|
|
|
- text-align: right;
|
|
|
- }
|
|
|
+.el-pagination {
|
|
|
+ margin: 1rem 0 2rem;
|
|
|
+ text-align: right;
|
|
|
+}
|
|
|
|
|
|
- .plab {
|
|
|
- font-size: 13px;
|
|
|
- color: #999;
|
|
|
- }
|
|
|
+.plab {
|
|
|
+ font-size: 13px;
|
|
|
+ color: #999;
|
|
|
+}
|
|
|
|
|
|
- .daiyunscss {
|
|
|
- cursor: pointer;
|
|
|
- }
|
|
|
+.daiyunscss {
|
|
|
+ cursor: pointer;
|
|
|
+}
|
|
|
|
|
|
</style>
|