Files
laws_weilai/jero-web/src/views/documentTools/documentTranslation/components/standardData.vue
T
2022-07-26 11:24:16 +08:00

317 lines
9.3 KiB
Java

<template>
<a-drawer
:title="$t('standardData')"
:maskClosable="false"
:width="1000"
placement="right"
:closable="true"
@close="handleCancel"
:visible="visible"
style="height: 100%;overflow: auto;padding-bottom: 53px;">
<div style="margin-bottom: 60px">
<div class="table-page-search-wrapper">
<a-form layout="inline" @keyup.enter.native="searchQuery">
<a-row :gutter="24">
<a-col :md="12" :sm="8">
<div class="box-title-text">
<div class="title-text" :title="$t('standard')">
<span>{{$t('standard')}}</span>
</div>
<a-input class="box-input" :placeholder="$t('PleaseEnter')+$t('standard')"
v-model="queryParam.serial_number"></a-input>
</div>
</a-col>
<a-col :md="12" :sm="8">
<div class="box-title-text">
<div class="title-text" :title="$t('title')">
<span>{{$t('title')}}</span>
</div>
<a-input class="box-input" :placeholder="$t('PleaseEnter')+$t('title')"
v-model="queryParam.title"></a-input>
</div>
</a-col>
<a-col :md="12" :sm="8">
<div class="box-title-text">
<div class="title-text" :title="$t('status')">
<span>{{$t('status')}}</span>
</div>
<j-dict-select-tag class="box-input" v-model="queryParam.state"
:placeholder="$t('PleaseSelect')+$t('status')"
:type="'select'"
:triggerChange="false" :dictCode="'state'"/>
</div>
</a-col>
<span style="float: right;overflow: hidden;" class="table-page-search-submitButtons">
<a-col :md="12" :sm="24">
<globalAdvancedQuery ref="globalAdvancedQueryRef"
@handleSuperQuery="handleSuperQuery"
:fieldList="fieldList"/>
<a-button class="box-button" type="primary" @click="searchQuery">{{$t('query')}}</a-button>
<a-button class="box-button" style="margin-left: 8px" @click="searchReset">{{$t('reset')}}</a-button>
</a-col>
</span>
</a-row>
</a-form>
</div>
<a-table
:columns="columns"
rowKey="id"
:scroll="{x: 1200}"
:data-source="dataList"
:pagination="false"
:row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange,columnTitle:' ' }"
:loading="loading">
</a-table>
<div class="page" v-if="dataList.length > 0">
<a-pagination
:show-total="total => $t('total')+`${total}`+$t('strip')"
show-quick-jumper
show-size-changer
:page-size.sync="pageSize"
:total="total"
:current="pageNo"
@change="onChange"
@showSizeChange="SizeChange"
/>
</div>
</div>
<div class="drawer-bootom-button">
<a-button @click="handleCancel" type="danger" style="margin-right: 16px">{{$t('cancel')}}</a-button>
<a-button @click="handleSubmit" type="primary" :loading="confirmLoading">{{$t('submit')}}</a-button>
</div>
</a-drawer>
</template>
<script>
import { getAction, postAction } from '@/api/manage'
import globalAdvancedQuery from '@/components/globalAdvancedQuery/index'
export default {
name: 'standardData',
components: {
globalAdvancedQuery
},
data() {
return {
visible: false,
queryParam: {},
confirmLoading: false,
selectedRowKeys: [],
columns: [
{
title: this.$t('standard'),
dataIndex: 'serial_number',
align: 'center',
ellipsis: true
},
{
title: this.$t('title'),
dataIndex: 'title',
align: 'center',
ellipsis: true
},
{
title: this.$t('zoneOfApplication'),
dataIndex: 'region',
align: 'center',
ellipsis: true
},
// {
// title: this.$t('status'),
// dataIndex: 'state',
// align: 'center',
// ellipsis: true
// },
// {
// title: this.$t('technicalField'),
// dataIndex: 'technology_territory',
// align: 'center',
// ellipsis: true
// },
{
title: this.$t('ImplementationDate'),
dataIndex: 'xin1_che1_xing2_shi2_shi1_ri4_qi1',
align: 'center',
ellipsis: true
},
{
title: this.$t('vehicleInProductionDate'),
dataIndex: 'implement_time',
align: 'center',
ellipsis: true
}
// {
// title: this.$t('correspondingStandard'),
// dataIndex: 'corresponding_standard',
// align: 'center',
// ellipsis: true
// }
],
dataList: [],
content: [],
loading: false,
pageNo: 1,
pageSize: 10,
total: 0,
fieldList: [],
queryConditionVOList: [],
selectedRowKeysRecord: []
}
},
mounted() {
},
methods: {
addModel() {
this.visible = true
this.queryParam = {}
this.selectedRowKeys = []
this.queryConditionVOList = []
this.replacePage()
this.queryConditionInventory()
},
searchQuery() {
this.pageNo = 1
this.replacePage()
},
searchReset() {
this.pageNo = 1
this.queryParam = {}
this.queryConditionVOList = []
this.$refs.globalAdvancedQueryRef.resetLine()
this.$refs.globalAdvancedQueryRef.emitCallback()
this.replacePage()
},
onChange(page, pageSize) {
this.pageNo = page
this.replacePage()
},
SizeChange(page, pageSize) {
this.pageNo = 1
this.pageSize = pageSize
this.replacePage()
},
replacePage() {
let queryConditionVOList = JSON.parse(JSON.stringify(this.queryConditionVOList))
let query = {
pageNo: this.pageNo,
pageSize: this.pageSize,
...this.queryParam,
queryConditionVOList: JSON.stringify(queryConditionVOList)
}
this.loading = true
postAction('/project/projectLawsInventoryEO/queryPageDummy', query).then((res) => {
if (res.success) {
this.dataList = res.result.records || []
this.total = res.result.total
this.loading = false
} else {
this.dataList = []
this.total = 0
this.loading = false
}
})
},
onSelectChange(value,record) {
this.selectedRowKeys = value
if (this.selectedRowKeys.length > 1) {
this.selectedRowKeys.shift()
}
this.selectedRowKeysRecord = record.filter(res => {
return res.id == this.selectedRowKeys[0]
})
this.selectedRowKeysRecord = [...this.selectedRowKeysRecord]
},
handleCancel() {
this.visible = false
},
handleSubmit() {
if (this.selectedRowKeys && this.selectedRowKeys.length > 0) {
this.$emit('standardDataForm', this.selectedRowKeysRecord[0])
this.visible = false
} else {
this.$message.warning(this.$t('selectLeastOne'))
}
},
queryConditionInventory() {
let query = {
flag: 1
}
getAction('/project/projectLawsInventoryEO/queryConditionInventory', query).then((res) => {
if (res.success) {
this.fieldList = res.result || []
} else {
this.fieldList = []
}
})
},
handleSuperQuery(params, matchType) {
let sqp = {}
if (!params || (params && params.length == 0)) {
this.queryConditionVOList = []
this.$refs.globalAdvancedQueryRef.superQueryFlag = false
} else {
this.$refs.globalAdvancedQueryRef.superQueryFlag = true
this.queryConditionVOList = params
this.queryConditionVOList.forEach(res => {
res.type = matchType
})
}
this.replacePage()
}
}
}
</script>
<style scoped>
.page {
text-align: right;
margin-top: 20px;
}
.drawer-bootom-button {
position: absolute;
bottom: 0;
width: 100%;
z-index: 100;
border-top: 1px solid #e8e8e8;
padding: 10px 16px;
text-align: right;
left: 0;
background: #fff;
border-radius: 0 0 2px 2px;
}
.box-title-text {
line-height: 1.4;
display: flex;
align-items: center;
margin-bottom: 10px;
}
.title-text {
width: 33px;
color: #000F16;
display: inline-block;
font-weight: 500;
font-size: 14px;
margin-right: 16px;
margin-top: 3px;
text-align: right;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.box-input {
display: inline-block;
width: 100%;
height: 38px;
}
.box-button {
height: 38px;
}
</style>