382 lines
10 KiB
Java
382 lines
10 KiB
Java
<template>
|
|
<div class="box-stand-select">
|
|
<a-select
|
|
class="box-input-select"
|
|
v-model="arrayValue"
|
|
@change="selectOnChange"
|
|
:placeholder="!isDisabled?$t('PleaseSelect')+query.db_field_txt:query.db_field_txt"
|
|
mode="multiple"
|
|
:getPopupContainer="triggerNode=> triggerNode.parentNode">
|
|
<a-select-option
|
|
v-for="(item,index) in dictOptions"
|
|
:key="index"
|
|
:value="item.id">
|
|
<span class="itemOption" :title="item.standNumber">
|
|
{{ item.standNumber }}
|
|
</span>
|
|
</a-select-option>
|
|
</a-select>
|
|
<!-- <a-input class="box-input" :value="value" :title="value" @input="indexclick($event)"-->
|
|
<!-- :disabled="true"-->
|
|
<!-- :placeholder="!isDisabled?$t('PleaseSelect')+query.db_field_txt:query.db_field_txt"/>-->
|
|
<a-button v-if="!isDisabled" type="primary" :title="$t('standardSelection')" class="button-box" @click="standardClick">
|
|
{{this.$t('standardSelection')}}
|
|
</a-button>
|
|
<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="(record)=>record.id+'-'+record.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', 'standardId'],
|
|
computed: {
|
|
isDisabled() {
|
|
if (this.query.db_field_name === 'replaced_standard') {
|
|
return true
|
|
}
|
|
return false
|
|
}
|
|
},
|
|
mixins: [ResizeColumnProvide, ResizeHeader],
|
|
data() {
|
|
return {
|
|
visible: false,
|
|
dictOptions: [],
|
|
arrayValue: !this.value ? [] : this.value.split(','),
|
|
confirmLoading: false,
|
|
selectedRowKeys: [],
|
|
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.selectedRowKeys = []
|
|
this.content = []
|
|
this.pageNo = 1
|
|
if (this.standardId) {
|
|
this.getQueryListByIds(this.standardId)
|
|
}
|
|
this.replacePage()
|
|
},
|
|
getQueryListByIds(ids) {
|
|
getAction('/document/bussDocumentLibraryEO/queryListByIds', { ids: ids }).then((res) => {
|
|
if (res.success) {
|
|
if (res.result && res.result.length > 0) {
|
|
let content = []
|
|
res.result.forEach(val => {
|
|
this.content.push(val)
|
|
this.dictOptions.push({
|
|
id: val.id,
|
|
standNumber: val.serial_number
|
|
})
|
|
content.push(val.id + '-' + val.serial_number)
|
|
})
|
|
this.selectedRowKeys = content
|
|
}
|
|
}
|
|
})
|
|
},
|
|
replacePage() {
|
|
let query = {
|
|
...this.queryParam,
|
|
pageNo: this.pageNo,
|
|
pageSize: this.pageSize
|
|
}
|
|
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
|
|
} else {
|
|
this.dataList = []
|
|
}
|
|
})
|
|
},
|
|
handleCancel() {
|
|
this.visible = false
|
|
},
|
|
handleSubmit() {
|
|
if (this.selectedRowKeys && this.selectedRowKeys.length > 0) {
|
|
let number = []
|
|
let id = []
|
|
this.arrayValue = []
|
|
this.content.forEach(res => {
|
|
id.push(res.id)
|
|
number.push(res.serial_number)
|
|
this.dictOptions.push({
|
|
id: res.id,
|
|
standNumber: res.serial_number
|
|
})
|
|
this.arrayValue.push(res.id)
|
|
})
|
|
this.$emit('input', number.join(','))
|
|
this.$emit('change', this.query.db_field_name, id.join(','))
|
|
this.visible = false
|
|
} else {
|
|
this.$message.warning(this.$t('selectLeastOne'))
|
|
}
|
|
},
|
|
indexclick(event) {
|
|
this.$emit('input', event.target.value)
|
|
},
|
|
onSelectChange(value, row) {
|
|
this.selectedRowKeys = value
|
|
this.content = []
|
|
this.selectedRowKeys.forEach(res => {
|
|
let index = res.indexOf('-')
|
|
let index1 = res.length
|
|
let id = res.slice(0, index)
|
|
let standNumber = res.slice(index + 1, index1)
|
|
this.content.push({
|
|
id: id,
|
|
serial_number: standNumber
|
|
})
|
|
})
|
|
},
|
|
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()
|
|
},
|
|
selectOnChange(value) {
|
|
let content = []
|
|
let standNumber = []
|
|
this.content = []
|
|
let newArr = []
|
|
let dictOptions = JSON.parse(JSON.stringify(this.dictOptions))
|
|
if (value.length == 0) {
|
|
this.dictOptions = []
|
|
} else {
|
|
for (let i = 0; i < value.length; i++) {
|
|
for (let j = 0; j < dictOptions.length; j++) {
|
|
if (dictOptions[j].id === value[i]) {
|
|
newArr.push(dictOptions[j])
|
|
}
|
|
}
|
|
}
|
|
}
|
|
this.dictOptions = newArr
|
|
if (this.dictOptions && this.dictOptions.length > 0) {
|
|
this.dictOptions.forEach(val => {
|
|
content.push(val.id)
|
|
standNumber.push(val.standNumber)
|
|
this.content.push({
|
|
id: val.id,
|
|
serial_number: val.standNumber
|
|
})
|
|
})
|
|
}
|
|
this.$emit('input', standNumber.join(','))
|
|
this.$emit('change', this.query.db_field_name, content.join(','))
|
|
this.arrayValue = content
|
|
}
|
|
}
|
|
}
|
|
</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;
|
|
display: inline-block;
|
|
width: 80px;
|
|
overflow: hidden;
|
|
padding: 0;
|
|
}
|
|
|
|
.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-select {
|
|
display: inline-block;
|
|
width: calc(100% - 90px);
|
|
height: 38px;
|
|
float: left;
|
|
}
|
|
|
|
.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 ;*/
|
|
/*}*/
|
|
|
|
::v-deep .box-input-select .ant-select-selection--multiple::-webkit-scrollbar {
|
|
/*height: 52px!important;*/
|
|
display: block;
|
|
}
|
|
|
|
.itemOption {
|
|
display: inline-block;
|
|
width: 100%;
|
|
overflow: hidden;
|
|
white-space: nowrap;
|
|
text-overflow: ellipsis;
|
|
-o-text-overflow: ellipsis;
|
|
}
|
|
</style>
|
|
<style>
|
|
.box-stand-select .ant-select-dropdown--multiple {
|
|
display: none !important;
|
|
}
|
|
|
|
/*.ant-input-disabled{*/
|
|
/* background-color: #f5f5f5!important;*/
|
|
/*}*/
|
|
</style> |