Files
foton-laws-system-front/src/pages/regulatoryRepository/systemSearch/components/DialogTable.vue
T
zhoulingpo 785dae86b2 Merge remote-tracking branch 'origin/dev_20230829_change' into dev_20230829_change
# Conflicts:
#	src/pages/regulatoryRepository/systemSearch/components/DialogTable.vue
2023-11-28 10:33:42 +08:00

476 lines
15 KiB
Vue

<template>
<el-dialog :title="title" :visible.sync="visible" custom-class="customDialog" width="1005px">
<div class="search-area">
<el-form :modal="searchForm" :inline="true" class="label-input-form">
<el-form-item label="体系结构" class="search-item">
<el-input v-model="searchForm.standSystem"
placeholder="请选择体系结构"
readonly
@click.native="choice"
></el-input>
</el-form-item>
<el-form-item label="标准编号" class="search-item">
<el-input v-model="searchForm.standNo"
placeholder="根据标准编号查找"
clearable
:maxlength="100"
></el-input>
</el-form-item>
<el-form-item label="标准名称" class="search-item">
<el-input v-model="searchForm.standName"
placeholder="根据标准名称查找"
clearable
:maxlength="100"
></el-input>
</el-form-item>
<el-form-item label="标准状态" class="search-item">
<el-select v-model="searchForm.standState"
placeholder="请选择标准状态">
<el-option v-for="item in dict.commonState" :value="item.value" :label="item.label"></el-option>
</el-select>
</el-form-item>
<el-form-item label="发布日期" class="search-item">
<el-date-picker
:value="releaseDate"
:picker-options="pickerOptions"
type="daterange"
range-separator=""
start-placeholder="起始时间"
end-placeholder="结束时间"
value-format="yyyy-MM-dd"
align="right"
@input="releaseDateChange">
</el-date-picker>
</el-form-item>
<el-form-item label="实施日期" class="search-item">
<el-date-picker
:value="implementDate"
:picker-options="pickerOptions"
type="daterange"
range-separator=""
start-placeholder="起始时间"
end-placeholder="结束时间"
value-format="yyyy-MM-dd"
align="right"
@input="implementDateChange">
</el-date-picker>
</el-form-item>
<el-form-item label="代替标准" class="search-item">
<el-input v-model="searchForm.replaceStandardNo"
placeholder="根据代替标准查找"
clearable
:maxlength="100"
></el-input>
</el-form-item>
<el-form-item label="编制单位" class="search-item">
<el-input v-model="searchForm.dept"
placeholder="根据编制单位查找"
clearable
:maxlength="100"
></el-input>
</el-form-item>
<el-form-item label="起草人" class="search-item">
<el-input v-model="searchForm.draftUserName"
placeholder="根据起草人查找"
clearable
:maxlength="100"
></el-input>
</el-form-item>
<el-form-item label="数据来源" class="search-item">
<el-select v-model="searchForm.dataSource"
placeholder="请选择数据来源">
<el-option value="INLAND" label="国内标准库"></el-option>
<el-option value="FOREIGN" label="海外标准库"></el-option>
<el-option value="ENTERPRISE" label="企业标准库"></el-option>
</el-select>
</el-form-item>
<el-form-item class="search-item btn-box">
<el-button
type="primary"
class="common-button-primary"
size="mini"
@click="onSearch"
>查询</el-button>
<el-button class="common-button-default"
size="mini"
@click="onResetSearch"
>清空</el-button>
<el-button class="common-button-default export-button"
@click="exportData"
size="mini"
title="不勾选时默认导出所有筛选项;勾选时仅导出勾选项"
>列表导出</el-button>
</el-form-item>
</el-form>
</div>
<el-table
ref="selections"
:data="data"
tooltip-effect="dark"
style="width: 100%;overflow-y: auto;overflow-x: hidden;"
border
:height="400"
:header-cell-style="{background: '#e8e8e8', color: '#333333', fontSize: '16px',fontWeight: 'bold', height: '48px'}"
@sort-change="sortChange"
@selection-change="selectionChange">
<el-table-column
type="selection"
width="55"
align="center">
</el-table-column>
<el-table-column
type="index"
width="55"
label="序号"
align="center">
<template slot-scope="{scope, column, $index}">
{{ ($index + 1) + (searchForm.page - 1) * searchForm.pageSize }}
</template>
</el-table-column>
<el-table-column
prop="standSystem"
width="160"
show-overflow-tooltip
label="体系结构">
</el-table-column>
<el-table-column
prop="standNo"
width="125"
show-overflow-tooltip
label="标准编号">
</el-table-column>
<el-table-column
prop="standName"
width="200"
show-overflow-tooltip
label="标准名称">
<template slot-scope="{row, column, $index}">
<a class="table-jump" style="color: #2d8cf0" @click="handlePreview(row)">{{ row.standName }}</a>
</template>
</el-table-column>
<el-table-column
prop="standState"
width="80"
show-overflow-tooltip
label="标准状态">
<!--<template slot-scope="scope">-->
<!--<span v-if="dict.commonState">{{ this.dict.commonState.find(item => item.value === scope.row.standState).label }}</span>-->
<!--</template>-->
</el-table-column>
<el-table-column
prop="releaseDate"
width="110"
sortable
show-overflow-tooltip
label="发布日期">
</el-table-column>
<el-table-column
prop="implementDate"
width="110"
sortable="custom"
show-overflow-tooltip
label="实施日期">
</el-table-column>
<el-table-column
prop="replaceStandardNo"
width="120"
show-overflow-tooltip
label="代替标准">
</el-table-column>
<el-table-column
prop="dept"
width="150"
show-overflow-tooltip
label="编制单位">
</el-table-column>
<el-table-column
prop="draftUserName"
width="200"
show-overflow-tooltip
label="起草人">
</el-table-column>
<el-table-column
prop="dataSource"
width="100"
show-overflow-tooltip
label="数据来源">
</el-table-column>
</el-table>
<pagination
style="position: relative;"
:page="searchForm.page"
:total="searchForm.total"
@pageChange="pageChange"
@pageSizeChange="pageSizeChange"></pagination>
<div slot="footer" class="demo-drawer-footer">
<el-button class="common-button-default" round icon="el-icon-close" @click="onCancel">取消</el-button>
</div>
<loading :loading="loading">加载中...</loading>
<ExportDialog appendToBody ref="exportDialogRef" @exportName="handleExport"></ExportDialog>
<!-- 组件树-->
<tree-select-new
:multiple=false
:lazy=false
:modalShowFlag="modalShowFlag"
drawerTitle="标准体系"
nodeKey="id"
width="500"
:data="standSystemData"
:defaultProps="defaultProps"
:checkedKeys="[]"
@popoverHide="popoverHide"
@popoverHideCancel="popoverHideCancel"></tree-select-new>
</el-dialog>
</template>
<script>
import ExportDialog from '@/components/hzwlComponents/exportDialog'
import TreeSelectNew from "@/components/treeSelect/treeSelectNew.vue";
export default {
name: "DialogTable",
components: {
ExportDialog,
TreeSelectNew,
},
data () {
const pickerOptions = {
shortcuts: [{
text: '最近一周',
onClick(picker) {
const end = new Date();
const start = new Date();
start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
picker.$emit('pick', [start, end]);
}
}, {
text: '最近一个月',
onClick(picker) {
const end = new Date();
const start = new Date();
start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
picker.$emit('pick', [start, end]);
}
}, {
text: '最近三个月',
onClick(picker) {
const end = new Date();
const start = new Date();
start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
picker.$emit('pick', [start, end]);
}
}]
}
const searchForm = {
menuId: '',
// 体系结构
standSystemId: '',
standSystem: '',
standNo: '',
standName: '',
standState: '',
startReleaseDate: '',
endReleaseDate: '',
startImplementDate: '',
endImplementDate: '',
replaceStandardNo: '',
dept: '',
draftUserName: '',
page: 1,
pageSize: this.$store.getters.userInfo.configContent,
total: 0,
sortField: '',
sortMode: '',
}
return {
visible: false,
title: '技术标准',
searchForm,
initSearchForm: JSON.parse(JSON.stringify(searchForm)),
pickerOptions,
releaseDate: ['', ''],
implementDate: ['', ''],
dict: {},
data: [],
selected: [],
loading: false,
// 标准体系树
modalShowFlag: false,
standSystemData: [],
defaultProps: {
children: 'children',
label: 'menuName'
},
api: {
getListStandLimit: "lawss/sarMenuStandardLimit/getListStandLimit",
},
}
},
created() {
this.getDicTypeListCode()
this.getListStandLimit()
},
methods: {
open (cfg) {
this.visible = true
this.title = `${cfg.menuName}( ${cfg.gbStandCount}/${cfg.fbStandCount}/${cfg.esStandCount} )`
this.initSearchForm.menuId = cfg.id
this.resetSearchForm()
this.onSearch()
},
onSearch () {
this.loading = true
this.$http._postData('lawss/sarMenuStandardLimit/standardSystemList', this.searchForm).then(res => {
if (res.ok) {
this.data = res.data.records
this.searchForm.total = res.data.total
}
}).finally(() => {
this.loading = false
})
},
onCancel () {
this.resetSearchForm()
this.visible = false
},
onResetSearch () {
this.resetSearchForm()
this.onSearch()
},
resetSearchForm () {
this.searchForm = JSON.parse(JSON.stringify(this.initSearchForm))
this.releaseDate = ['', '']
this.implementDate = ['', '']
this.selected = []
},
releaseDateChange (event) {
if (!event) {
this.releaseDate = ['', '']
this.searchForm.startReleaseDate = ''
this.searchForm.endReleaseDate = ''
return
}
this.releaseDate = event
const startTime = event[0]
const endTime = event[1]
this.searchForm.startReleaseDate = startTime
this.searchForm.endReleaseDate = endTime
},
implementDateChange (event) {
if (!event) {
this.implementDate = ['', '']
this.searchForm.startImplementDate = ''
this.searchForm.endImplementDate = ''
return
}
this.implementDate = event
const startTime = event[0]
const endTime = event[1]
this.searchForm.startImplementDate = startTime
this.searchForm.endImplementDate = endTime
},
pageChange (page) {
this.searchForm.page = page
this.onSearch()
},
pageSizeChange (pageSize) {
this.searchForm.pageSize = pageSize
this.onSearch()
},
selectionChange (row) {
this.selected = row
},
sortChange ({ column, prop, order }) {
this.searchForm.sortField = prop
this.searchForm.sortMode = 'asc'
if (order === 'descending') {
this.searchForm.sortMode = 'desc'
}
if (!order) {
this.searchForm.sortField = ''
this.searchForm.sortMode = ''
}
this.onSearch()
},
// 导出
exportData () {
this.$refs.exportDialogRef.openModel()
},
handleExport (exportName) {
const selectIds = this.selected.map(item => item.standId).join(',')
const params = {
...this.searchForm,
exportName: exportName,
selectIds
}
let query = '?'
for(let i in params){
if (params[i] && params[i]!=='') {
query = query + i + '=' + params[i] + '&'
}
}
query = query.slice(0,-1)
window.open('/api/lawss/sarMenuStandardLimit/standardSystemListExport' + query)
this.$refs.exportDialogRef.cancel()
this.$message.success('导出信息成功')
},
async getListStandLimit () {
const res = await this.$http._getData(this.api.getListStandLimit,{
dicId:'9m4qqqaansxmox5e82zm'
},{
_this:this,
loading: 'loading'
})
if (res.ok && res.data) {
this.standSystemData = res.data
}
},
choice () {
this.modalShowFlag = true
},
popoverHideCancel() {
this.modalShowFlag = false
},
popoverHide(checkedIds, checkedData) {
this.searchForm.standSystem = checkedData.menuName
this.searchForm.standSystemId = checkedIds
this.modalShowFlag = false
},
getDicTypeListCode () {
this.$http._getData('sys/dictype/getDicTypeListCode').then(res => {
this.dict = { ...res.data }
})
},
handlePreview (row) {
let name,pageType;
switch (row.dataSource) {
case '国内标准库':
name = 'OtherStandardDetails'
pageType = 'INLAND_STAND'
break
case '海外标准库':
name = 'OtherStandardDetails'
pageType = 'FOREIGN_STAND'
break
case '企业标准库':
name = 'OtherBussStandardDetails'
pageType = 'BUSINESS_STAND'
break
}
const id = row.standId
const routeUrl = this.$router.resolve({ name, params: { id, pageType } })
window.open(routeUrl.href, '_blank')
}
}
}
</script>
<style scoped lang="less">
/deep/ .customDialog {
.el-dialog__body {
padding: 0 20px !important;
}
}
</style>