Files
foton-laws-system-front/src/pages/details/otherStandardDetails/components/RelatedTermsSelect.vue
T

332 lines
9.3 KiB
Vue

<template>
<div class="standard-select-box" style="height: 100%;background-color: #fff;position: relative;">
<!--<div>-->
<!-- <span>-->
<!-- 标准检索-->
<!-- </span>-->
<!--</div>-->
<!--<el-divider class="el-divider-low"></el-divider>-->
<div style="height: 100%;" class="standard-select">
<table-tools-bar style="padding:10px 0 0 10px;">
<!--<div slot="left">-->
<!-- <div class="search-area">-->
<!-- <el-form :model="searchForm" inline class="label-input-form">-->
<!-- <el-form-item :label="$t('m.standardNumAndName')" prop="standardKey" class="search-item">-->
<!-- <el-input-->
<!-- v-model="searchForm.standardKey"-->
<!-- :placeholder="$t('m.standardNumAndNameTips')"-->
<!-- clearable-->
<!-- :maxlength="100"/>-->
<!-- </el-form-item>-->
<!-- <el-form-item class="search-item btn-box">-->
<!-- <el-button-->
<!-- icon="el-icon-search"-->
<!-- type="primary"-->
<!-- class="common-button-primary"-->
<!-- round-->
<!-- @click="searchBtn"-->
<!-- ></el-button>-->
<!-- </el-form-item>-->
<!-- <el-form-item class="search-item btn-box">-->
<!-- <el-button-->
<!-- class="common-button-default"-->
<!-- icon="el-icon-refresh-left"-->
<!-- round-->
<!-- @click="resetSearchForm">{{$t('m.clearQuery')}}</el-button>-->
<!-- </el-form-item>-->
<!-- </el-form>-->
<!-- </div>-->
<!--</div>-->
</table-tools-bar>
<div class="content">
<loading :loading="tableDataLoading">{{$t('m.dataProcessing')}}</loading>
<el-table
border
ref="selection"
:data="tableList"
tooltip-effect="dark"
style="width: 100%;"
height="100%"
@selection-change="handleSelectionChange"
:header-cell-style="{background: '#e8e8e8', color: '#333333', fontSize: '16px',
fontWeight: 'bold', height: '48px'}"
row-key="id"
>
<el-table-column
type="selection"
width="55"
align="center">
</el-table-column>
<el-table-column
label="序号"
align="center"
type="index"
width="50">
<template slot-scope="{scope, column, $index}">
{{ ($index + 1) + (pageNo - 1) * $store.getters.userInfo.configContent }}
</template>
</el-table-column>
<el-table-column
prop="showNumber"
label="标准号"
align="center">
<template slot-scope="scope">
<div v-if="scope.row.standId == null || scope.row.standId === ''">{{ scope.row.standNumSplit }}</div>
<div v-else>{{ scope.row.showNumber }}</div>
</template>
</el-table-column>
<el-table-column
prop="standName"
label="标准名称"
show-overflow-tooltip
align="center">
<template slot-scope="scope">
<span v-if="scope.row.standId == null || scope.row.standId === ''">{{ scope.row.standNameSplit }}</span>
<span v-else>{{ scope.row.standName }}</span>
</template>
</el-table-column>
<el-table-column
prop="fileTypeShow"
label="标准状态"
align="center">
</el-table-column>
<el-table-column
prop="creationTime"
label="拆分时间"
align="center">
</el-table-column>
</el-table>
</div>
<pagination :total="total" @pageChange="pageChange" @pageSizeChange="pageSizeChange"></pagination>
<!--<div class="btn-group">-->
<!-- <el-button-->
<!-- round-->
<!-- class="common-button-primary"-->
<!-- type="primary"-->
<!-- icon="el-icon-check"-->
<!-- @click="handleSubmit"-->
<!-- >确定</el-button>-->
<!-- <el-button-->
<!-- round-->
<!-- class="common-button-default"-->
<!-- icon="el-icon-close"-->
<!-- @click="handleCancel">取消</el-button>-->
<!--</div>-->
</div>
</div>
</template>
<script>
export default {
name: 'RelatedTermsSelect',
props: ['standId', 'fileType'],
data () {
return {
tableDataLoading: false,
total: 0,
handleList: [],
selectRoleId: '',
searchForm: {
standardKey: '',
},
pageNo: 1,
pageSize: 10,
tableList: [],
}
},
methods: {
getDicTypeName(opt, type) {
const _type = type ? type.split(',') : []
let typeNames = []
// switch (opt) {
// case 'applyArcticOptions':
// this.applyArcticOptions.map(item => {
// _type.map(typeItem => {
// if (item.value === typeItem) {
// typeNames.push(item.label)
// }
// })
// })
// break
// case 'BZFGGXOUIUJ':
// this.BZFGGXOUIUJ.map(item => {
// _type.map(typeItem => {
// if (item.value === typeItem) {
// typeNames.push(item.label)
// }
// })
// })
// break
// }
return typeNames.join(',')
},
itemsTextDialog (itemsNum, text) {
this.itemsTextDialogs = true
this.itemsText = '<p>' + itemsNum + '</p>' + text.replace(/''/g, '\'')
},
// 根据条件查询信息
searchBtn () {
this.resetPageNo()
this.queryTablePage()
},
/**
* 重置搜索表单并重新加载表格数据
*/
resetSearchForm () {
this.searchForm.standardKey = ''
// this.resetSearchForm()
this.queryTablePage()
},
handleSelectionChange(data){
this.handleList = data
this.$emit('func',this.handleList)
},
pageChange (page) {
this.pageNo = page
this.queryTablePage()
},
pageSizeChange () {
this.queryTablePage()
},
resetPageNo() {
this.pageNo = 1
},
// 查询、加载表格
queryTablePage () {
const formData = {
page: this.pageNo,
pageSize: this.$store.getters.userInfo.configContent,
standId: this.standId,
fileType: this.fileType
}
// splitStatus: '2'
this.$http.get('lawss/sarFileSplitInfo/getSarFileSplitInfoEOPage',
formData,
{
_this: this,
loading: 'tableDataLoading'
},
res => {
this.tableList = res.data.list
this.total = res.data.count
this.$nextTick(() => {
this.$refs.selection.doLayout()
})
}, e => {})
},
handleSubmit(callback) {
const selection = this.$refs['selection'].selection
if (selection.length>0){
return new Promise((resolve, reject) => {
this.postListToServer(selection).then(res => {
// 关闭当前区域
this.handleCancel()
callback && callback()
resolve(res)
}).catch((err) => {
// 关闭当前区域
this.handleCancel()
callback && callback()
reject(err)
})
})
}else {
return new Promise(() => {
// 关闭当前区域
this.handleCancel()
callback && callback()
})
}
},
handleCancel() {
this.$emit('close')
},
postListToServer(selection) {
// const list = selection.map(item => {
// let standNum = ''
// if (item.standYear) {
// standNum = `${item.standSortShow} ${item.standNumber}-${item.standYear}`
// } else {
// standNum = `${item.standSortShow} ${item.standNumber}`
// }
//
// return {
// country: item.countryShow,
// standNum: standNum,
// standName: item.standName,
// standId: item.id,
// standType: item.standType
// }
// })
const formData = selection
return new Promise((resolve, reject) => {
this.$http.postData('lawss/sarFileSplitInfo/connectToStandItems', formData, {
_this: this
}, res => {
if (res.ok) {
resolve(res)
} else {
reject(res)
}
}, err => {
reject(err)
})
})
}
},
created() {
this.queryTablePage()
}
}
</script>
<style lang="less" scoped>
.standard-select-box{
display: flex;
flex-direction: column;
flex: auto;
.standard-select{
height: 100%;
display: flex;
flex-direction: column;
flex: auto;
.content {
padding: 0 10px;
//height: calc(~'100% - 55px - 50px');
flex: auto;
display: flex;
flex-direction: column;
}
.pagination {
position: static;
}
}
.el-divider-low {
margin: 15px 0;
}
.search-area {
padding: 0;
}
.btn-group {
position: absolute;
bottom: 20px;
right: 20px;
background: #ffffff;
z-index: 999;
}
}
</style>