标准选择不能手动输入

This commit is contained in:
zyx.net
2023-08-29 15:28:06 +08:00
parent 7ba8679d46
commit 365f3c09fe
2 changed files with 303 additions and 7 deletions
@@ -0,0 +1,289 @@
<template>
<div>
<div class="box-title-text">
<a-input class="box-input" :value="value" :title="value" @input="indexclick($event)"
:disabled="true"
:placeholder="!isDisabled?$t('PleaseEnterOrSelect')+query.db_field_txt:query.db_field_txt"/>
<a-button v-if="!isDisabled" type="primary" class="button-box" @click="standardClick">
{{this.$t('standardSelection')}}
</a-button>
</div>
<a-drawer
:title="$t('standardSelection')"
: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">
<currencySearch
:flag="'1'"
:url="url"
:queryParam='queryParam'
@searchQuery="searchQuery"
@searchReset="searchReset"
/>
<a-table
:components="drag(columns,'cloumns')"
:columns="columns"
rowKey="serial_number"
:scroll="{x: 1500}"
:data-source="dataList"
:pagination="false"
:row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
: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" style="margin-right: 16px">{{$t('cancel')}}</a-button>
<a-button @click="handleSubmit" type="primary" :loading="confirmLoading">{{$t('submit')}}</a-button>
</div>
</a-drawer>
</div>
</template>
<script>
import { getAction, postAction } from '@/api/manage'
import currencySearch from '@/components/currencySearch/index'
import { ResizeHeader, ResizeColumnProvide } from '@/mixins/header'
export default {
name: 'index',
components: {
currencySearch
},
props: ['query', 'value', 'standard'],
computed: {
isDisabled() {
if (this.query.db_field_name === 'replaced_standard') {
return true
}
return false
}
},
mixins: [ResizeColumnProvide,ResizeHeader],
data() {
return {
visible: false,
confirmLoading: false,
selectedRowKeys: [],
selectedRowList: [],
content: [],
loading: false,
queryParam: {},
columns: [
{
title: this.$t('standard'),
dataIndex: 'serial_number',
ellipsis: true,
align: 'left',
width: 480
},
{
title: this.$t('title'),
dataIndex: 'title',
ellipsis: true,
align: 'left',
width: 480
},
{
title: this.$t('TextStatus'),
dataIndex: 'state',
align: 'left',
width: 480
}
],
dataList: [],
pageNo: 1,
pageSize: 10,
total: 0,
url: {
seachList: 'document/bussDocumentLibraryEO/queryCondition' //搜索字段
}
}
},
mounted() {
this.replacePage()
},
methods: {
standardClick() {
this.visible = true
this.queryParam = {}
this.replacePage()
},
replacePage() {
let query = {
...this.queryParam,
pageNo: this.pageNo,
pageSize: this.pageSize
}
this.selectedRowKeys = []
this.loading = true
postAction('document/bussDocumentLibraryEO/replacePageInfo', query).then((res) => {
this.loading = false
if (res.success) {
this.dataList = res.result.records
this.total = res.result.total
this.selectedRowKeys = this.standard[this.query.db_field_name] ? this.standard[this.query.db_field_name].split(',') : []
} else {
this.dataList = []
}
})
},
handleCancel() {
this.visible = false
},
handleSubmit() {
let serial_number = []
let replace_standard_id = []
if (this.selectedRowKeys && this.selectedRowKeys.length > 0) {
// let content = JSON.parse(JSON.stringify(this.selectedRowList))
this.selectedRowList.forEach(res => {
serial_number.push(res.serial_number)
replace_standard_id.push(res.id)
})
this.$emit('input', serial_number.join(','))
console.log(replace_standard_id)
this.$emit('change', this.query.db_field_name, replace_standard_id.join(','))
// this.$emit('changecontent', this.content)
this.visible = false
} else {
this.$message.warning(this.$t('selectLeastOne'))
}
},
indexclick(event) {
this.$emit('input', event.target.value)
},
onSelectChange(value,row) {
console.log(value)
console.log(row)
this.selectedRowKeys = value
this.selectedRowList = row
// this.content = []
// value.forEach(val => {
// this.dataList.forEach((res) => {
// if (res.id === val) {
// this.content.push(res)
// }
// })
// })
},
searchQuery(queryParam) {
let queryParamQuery = JSON.parse(JSON.stringify(queryParam))
Object.keys(queryParamQuery).forEach(res => {
if (queryParamQuery[res] instanceof Array) {
queryParamQuery[res] = queryParamQuery[res].join(',')
}
})
this.queryParam = queryParamQuery
this.replacePage()
},
searchReset(queryParam) {
this.queryParam = queryParam
this.replacePage()
},
onChange(page, pageSize) {
this.pageNo = page
this.replacePage()
},
SizeChange(page, pageSize) {
this.pageNo = 1
this.pageSize = pageSize
this.replacePage()
}
}
}
</script>
<style scoped>
.box-title-text {
line-height: 1.4;
display: flex;
}
.box-input {
display: inline-block;
height: 38px;
width: 100%;
}
.button-box {
margin-left: 10px;
height: 38px;
line-height: 38px;
}
.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-index {
line-height: 1.4;
display: flex;
align-items: center;
}
.title-text-index {
display: inline-block;
min-width: 60px;
font-weight: bold;
font-size: 14px;
margin-right: 16px;
}
.box-input-index {
display: inline-block;
width: 80%;
height: 38px;
margin-top: 2px;
}
.box-button {
height: 38px;
margin-top: 2px;
}
.page {
text-align: right;
margin-top: 20px;
}
/deep/.ant-table-thead > tr > th {
font-weight: bolder;
}
/*/deep/.ant-table-tbody > tr > td {*/
/* color: #040B29 ;*/
/*}*/
</style>
<style>
/*.ant-input-disabled{*/
/* background-color: #f5f5f5!important;*/
/*}*/
</style>
@@ -180,7 +180,6 @@
<Standardselection
:query="{'db_field_txt':$t('standard')}"
:standard="formInline"
:disabled="false"
@change="StandardselectionChange"
v-model="formInline.serialNumber"/>
</a-form-model-item>
@@ -228,7 +227,7 @@
import PersonnelSelection from '@/components/PersonnelSelection/index'
import SelectedBy from '@/components/SelectedBy/index'
import personBatting from './personBatting'
import Standardselection from '@/components/Standardselection/index'
import Standardselection from '@/components/StandardselectionRxswin/index'
import { getAction, postAction, downloadFile, putAction, deleteAction } from '@/api/manage'
import ImportFile from '@/components/ImportFile/index'
import transferList from './transferListRxswin'
@@ -333,7 +332,7 @@
url: {
page: '/project/projectRxswinEO/page',
edit: '/project/projectRelatedPersonnel/edit',
exportData: '/project/projectRelatedPersonnel/exportXls',
exportData: '/project/projectRxswinEO/exportXls',
importZipUrl: '/project/projectRelatedPersonnel/importExcel',
queryCertificationEngineer: '/project/projectRelatedPersonnel/queryCertificationEngineer'
},
@@ -563,11 +562,19 @@
},
handleExport() {
let selectedRowKeys = JSON.parse(JSON.stringify(this.selectedRowKeys))
let query = {
id: selectedRowKeys.join(','),
projectId: this.$route.query.id
let long = localStorage.getItem('language')
let cut = ''
if (long && long == 'zh-cn') {
this.cut = 'cn'
} else if (long && long == 'en-us') {
this.cut = 'en'
}
downloadFile(this.url.exportData, this.$t('ListOfRelevantPersonnel') + '.xls', query, this.Deselect)
let query = {
ids: selectedRowKeys.join(','),
cut:cut
// projectId: this.$route.query.id
}
downloadFile(this.url.exportData, 'RXSWIN' + '.xls', query, this.Deselect)
},
Deselect() {
this.selectedRowKeys = []