全局修改标准选择

This commit is contained in:
范强强
2023-10-23 15:33:19 +08:00
parent de87010a14
commit 5f1a78b74f
9 changed files with 164 additions and 42 deletions
@@ -215,6 +215,9 @@
<a-form-model-item class="itemModel" :prop="item.db_field_name"> <a-form-model-item class="itemModel" :prop="item.db_field_name">
<Standardselection :query="item" <Standardselection :query="item"
:disabled="disabled" :disabled="disabled"
:standard="formInline"
:standardId="formInline[item.db_field_name+'_id']"
@change="StandardselectionChange"
v-model="formInline[item.db_field_name]"/> v-model="formInline[item.db_field_name]"/>
</a-form-model-item> </a-form-model-item>
</div> </div>
@@ -283,6 +286,10 @@
this.getForm() this.getForm()
}, },
methods: { methods: {
StandardselectionChange(value, id) {
this.formInline[value + '_id'] = id
this.formInline = { ...this.formInline }
},
sumber() { sumber() {
// console.log('vilidate',this.formInline) // console.log('vilidate',this.formInline)
this.$refs.ruleForm1.validate(valid => { this.$refs.ruleForm1.validate(valid => {
@@ -207,6 +207,9 @@
<a-form-model-item class="itemModel" :prop="item.db_field_name"> <a-form-model-item class="itemModel" :prop="item.db_field_name">
<Standardselection :query="item" <Standardselection :query="item"
:disabled="disabled" :disabled="disabled"
:standard="formInline"
:standardId="formInline[item.db_field_name+'_id']"
@change="StandardselectionChange"
v-model="formInline[item.db_field_name]"/> v-model="formInline[item.db_field_name]"/>
</a-form-model-item> </a-form-model-item>
</div> </div>
@@ -305,6 +308,10 @@
// console.log('idssss111',this.ids) // console.log('idssss111',this.ids)
}, },
methods: { methods: {
StandardselectionChange(value, id) {
this.formInline[value + '_id'] = id
this.formInline = { ...this.formInline }
},
sumber() { sumber() {
// console.log('vilidate',this.formInline) // console.log('vilidate',this.formInline)
this.$refs.ruleForm1.validate(valid => { this.$refs.ruleForm1.validate(valid => {
@@ -1,13 +1,27 @@
<template> <template>
<div> <div>
<div class="box-title-text"> <a-select
<a-input class="box-input" :value="value" :title="value" @input="indexclick($event)" class="box-input-select"
:disabled="isDisabled" v-model="arrayValue"
:placeholder="!isDisabled?$t('PleaseEnterOrSelect')+query.db_field_txt:query.db_field_txt"/> @change="selectOnChange"
<a-button v-if="!isDisabled" type="primary" class="button-box" @click="standardClick"> :placeholder="!isDisabled?$t('PleaseSelect')+query.db_field_txt:query.db_field_txt"
{{this.$t('standardSelection')}} mode="multiple"
</a-button> :getPopupContainer="triggerNode=> triggerNode.parentNode">
</div> <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 <a-drawer
:title="$t('standardSelection')" :title="$t('standardSelection')"
:maskClosable="false" :maskClosable="false"
@@ -28,7 +42,7 @@
<a-table <a-table
:components="drag(columns,'cloumns')" :components="drag(columns,'cloumns')"
:columns="columns" :columns="columns"
rowKey="serial_number" :rowKey="(record)=>record.id+'-'+record.serial_number"
:scroll="{x: 1500}" :scroll="{x: 1500}"
:data-source="dataList" :data-source="dataList"
:pagination="false" :pagination="false"
@@ -68,7 +82,7 @@
components: { components: {
currencySearch currencySearch
}, },
props: ['query', 'value', 'standard'], props: ['query', 'value', 'standard', 'standardId'],
computed: { computed: {
isDisabled() { isDisabled() {
if (this.query.db_field_name === 'replaced_standard') { if (this.query.db_field_name === 'replaced_standard') {
@@ -77,13 +91,14 @@
return false return false
} }
}, },
mixins: [ResizeColumnProvide,ResizeHeader], mixins: [ResizeColumnProvide, ResizeHeader],
data() { data() {
return { return {
visible: false, visible: false,
dictOptions: [],
arrayValue: !this.value ? [] : this.value.split(','),
confirmLoading: false, confirmLoading: false,
selectedRowKeys: [], selectedRowKeys: [],
selectedRowList: [],
content: [], content: [],
loading: false, loading: false,
queryParam: {}, queryParam: {},
@@ -125,22 +140,44 @@
standardClick() { standardClick() {
this.visible = true this.visible = true
this.queryParam = {} this.queryParam = {}
this.selectedRowKeys = []
this.content = []
this.pageNo = 1
if (this.standardId) {
this.getQueryListByIds(this.standardId)
}
this.replacePage() 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() { replacePage() {
let query = { let query = {
...this.queryParam, ...this.queryParam,
pageNo: this.pageNo, pageNo: this.pageNo,
pageSize: this.pageSize pageSize: this.pageSize
} }
this.selectedRowKeys = []
this.loading = true this.loading = true
postAction('document/bussDocumentLibraryEO/replacePageInfo', query).then((res) => { postAction('document/bussDocumentLibraryEO/replacePageInfo', query).then((res) => {
this.loading = false this.loading = false
if (res.success) { if (res.success) {
this.dataList = res.result.records this.dataList = res.result.records
this.total = res.result.total this.total = res.result.total
this.selectedRowKeys = this.standard[this.query.db_field_name] ? this.standard[this.query.db_field_name].split(',') : []
} else { } else {
this.dataList = [] this.dataList = []
} }
@@ -150,18 +187,21 @@
this.visible = false this.visible = false
}, },
handleSubmit() { handleSubmit() {
let serial_number = []
let replace_standard_id = []
if (this.selectedRowKeys && this.selectedRowKeys.length > 0) { if (this.selectedRowKeys && this.selectedRowKeys.length > 0) {
// let content = JSON.parse(JSON.stringify(this.selectedRowList)) let number = []
this.selectedRowList.forEach(res => { let id = []
serial_number.push(res.serial_number) this.arrayValue = []
replace_standard_id.push(res.id) 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', serial_number.join(',')) this.$emit('input', number.join(','))
console.log(replace_standard_id) this.$emit('change', this.query.db_field_name, id.join(','))
this.$emit('change', this.query.db_field_name, replace_standard_id.join(','))
// this.$emit('changecontent', this.content)
this.visible = false this.visible = false
} else { } else {
this.$message.warning(this.$t('selectLeastOne')) this.$message.warning(this.$t('selectLeastOne'))
@@ -170,19 +210,19 @@
indexclick(event) { indexclick(event) {
this.$emit('input', event.target.value) this.$emit('input', event.target.value)
}, },
onSelectChange(value,row) { onSelectChange(value, row) {
console.log(value)
console.log(row)
this.selectedRowKeys = value this.selectedRowKeys = value
this.selectedRowList = row this.content = []
// this.content = [] this.selectedRowKeys.forEach(res => {
// value.forEach(val => { let index = res.indexOf('-')
// this.dataList.forEach((res) => { let index1 = res.length
// if (res.id === val) { let id = res.slice(0, index)
// this.content.push(res) let standNumber = res.slice(index + 1, index1)
// } this.content.push({
// }) id: id,
// }) serial_number: standNumber
})
})
}, },
searchQuery(queryParam) { searchQuery(queryParam) {
let queryParamQuery = JSON.parse(JSON.stringify(queryParam)) let queryParamQuery = JSON.parse(JSON.stringify(queryParam))
@@ -206,6 +246,38 @@
this.pageNo = 1 this.pageNo = 1
this.pageSize = pageSize this.pageSize = pageSize
this.replacePage() 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
} }
} }
} }
@@ -227,7 +299,10 @@
margin-left: 10px; margin-left: 10px;
height: 38px; height: 38px;
line-height: 38px; line-height: 38px;
display: inline-block;
width: 80px;
overflow: hidden;
padding: 0;
} }
.drawer-bootom-button { .drawer-bootom-button {
@@ -257,11 +332,11 @@
margin-right: 16px; margin-right: 16px;
} }
.box-input-index { .box-input-select {
display: inline-block; display: inline-block;
width: 80%; width: calc(100% - 90px);
height: 38px; height: 38px;
margin-top: 2px; float: left;
} }
.box-button { .box-button {
@@ -274,15 +349,33 @@
margin-top: 20px; margin-top: 20px;
} }
/deep/.ant-table-thead > tr > th { /deep/ .ant-table-thead > tr > th {
font-weight: bolder; font-weight: bolder;
} }
/*/deep/.ant-table-tbody > tr > td {*/ /*/deep/.ant-table-tbody > tr > td {*/
/* color: #040B29 ;*/ /* 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>
<style> <style>
.box-title-text .ant-select-dropdown--multiple {
display: none !important;
}
/*.ant-input-disabled{*/ /*.ant-input-disabled{*/
/* background-color: #f5f5f5!important;*/ /* background-color: #f5f5f5!important;*/
/*}*/ /*}*/
@@ -169,6 +169,7 @@
<Standardselection :query="item" <Standardselection :query="item"
:disabled="disabled" :disabled="disabled"
:standard="formInline" :standard="formInline"
:standardId="formInline[item.db_field_name+'_id']"
@change="StandardselectionChange" @change="StandardselectionChange"
v-model="formInline[item.db_field_name]"/> v-model="formInline[item.db_field_name]"/>
</a-form-model-item> </a-form-model-item>
@@ -834,7 +835,6 @@
this.getForm() this.getForm()
}, },
StandardselectionChange(value, id) { StandardselectionChange(value, id) {
console.log(id)
this.formInline[value + '_id'] = id this.formInline[value + '_id'] = id
this.formInline = { ...this.formInline } this.formInline = { ...this.formInline }
}, },
@@ -173,6 +173,8 @@
<Standardselection :query="item" <Standardselection :query="item"
:disabled="disabled" :disabled="disabled"
:standard="formInline" :standard="formInline"
:standardId="formInline[item.db_field_name+'_id']"
@change="StandardselectionChange"
v-model="formInline[item.db_field_name]"/> v-model="formInline[item.db_field_name]"/>
</a-form-model-item> </a-form-model-item>
</div> </div>
@@ -626,6 +628,10 @@
this.loadFormInfo() this.loadFormInfo()
}, },
methods:{ methods:{
StandardselectionChange(value, id) {
this.formInline[value + '_id'] = id
this.formInline = { ...this.formInline }
},
loadData(){ loadData(){
this.loading=true this.loading=true
getAction(`split/sarFileSplitItemsVal/getItemsValList`,{itemId:this.itemId}).then(res=>{ getAction(`split/sarFileSplitItemsVal/getItemsValList`,{itemId:this.itemId}).then(res=>{
@@ -123,6 +123,8 @@
:standard="formInline" :standard="formInline"
v-if="!disabled" v-if="!disabled"
:disabled="disabled" :disabled="disabled"
:standardId="formInline.correspondingStandardId"
@change="StandardselectionChange"
v-model="formInline.correspondingStandard"/> v-model="formInline.correspondingStandard"/>
<a-input class="box-input" <a-input class="box-input"
v-else v-else
@@ -763,6 +765,10 @@
this.getFirstLevelDutyTerritory() this.getFirstLevelDutyTerritory()
}, },
methods: { methods: {
StandardselectionChange(value, id) {
this.formInline.correspondingStandardId = id
this.formInline = { ...this.formInline }
},
DutyDepartChange(event) { DutyDepartChange(event) {
this.formInline.dutyTerritory = [] this.formInline.dutyTerritory = []
this.formInline = { ...this.formInline } this.formInline = { ...this.formInline }
@@ -75,6 +75,7 @@
:query="{'db_field_txt':$t('Relevantlawsregulations')}" :query="{'db_field_txt':$t('Relevantlawsregulations')}"
:standard="formInline" :standard="formInline"
:disabled="false" :disabled="false"
:standardId="formInline.lawsId"
@input="Standardselectioninput" @input="Standardselectioninput"
@change="StandardselectionChange" @change="StandardselectionChange"
v-model="formInline.lawsName"/> v-model="formInline.lawsName"/>
@@ -74,6 +74,7 @@
<Standardselection <Standardselection
:query="{'db_field_txt':$t('Relevantlawsregulations')}" :query="{'db_field_txt':$t('Relevantlawsregulations')}"
:standard="formInline" :standard="formInline"
:standardId="formInline.lawsId"
:disabled="false" :disabled="false"
@input="Standardselectioninput" @input="Standardselectioninput"
@change="StandardselectionChange" @change="StandardselectionChange"
@@ -73,6 +73,7 @@
:query="{'db_field_txt':$t('Relevantlawsregulations')}" :query="{'db_field_txt':$t('Relevantlawsregulations')}"
:standard="formInline" :standard="formInline"
:disabled="false" :disabled="false"
:standardId="formInline.lawsId"
@input="Standardselectioninput" @input="Standardselectioninput"
@change="StandardselectionChange" @change="StandardselectionChange"
v-model="formInline.lawsName"/> v-model="formInline.lawsName"/>