全局修改标准选择

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">
<Standardselection :query="item"
:disabled="disabled"
:standard="formInline"
:standardId="formInline[item.db_field_name+'_id']"
@change="StandardselectionChange"
v-model="formInline[item.db_field_name]"/>
</a-form-model-item>
</div>
@@ -283,6 +286,10 @@
this.getForm()
},
methods: {
StandardselectionChange(value, id) {
this.formInline[value + '_id'] = id
this.formInline = { ...this.formInline }
},
sumber() {
// console.log('vilidate',this.formInline)
this.$refs.ruleForm1.validate(valid => {
@@ -207,6 +207,9 @@
<a-form-model-item class="itemModel" :prop="item.db_field_name">
<Standardselection :query="item"
:disabled="disabled"
:standard="formInline"
:standardId="formInline[item.db_field_name+'_id']"
@change="StandardselectionChange"
v-model="formInline[item.db_field_name]"/>
</a-form-model-item>
</div>
@@ -305,6 +308,10 @@
// console.log('idssss111',this.ids)
},
methods: {
StandardselectionChange(value, id) {
this.formInline[value + '_id'] = id
this.formInline = { ...this.formInline }
},
sumber() {
// console.log('vilidate',this.formInline)
this.$refs.ruleForm1.validate(valid => {
@@ -1,13 +1,27 @@
<template>
<div>
<div class="box-title-text">
<a-input class="box-input" :value="value" :title="value" @input="indexclick($event)"
:disabled="isDisabled"
: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-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"
@@ -28,7 +42,7 @@
<a-table
:components="drag(columns,'cloumns')"
:columns="columns"
rowKey="serial_number"
:rowKey="(record)=>record.id+'-'+record.serial_number"
:scroll="{x: 1500}"
:data-source="dataList"
:pagination="false"
@@ -68,7 +82,7 @@
components: {
currencySearch
},
props: ['query', 'value', 'standard'],
props: ['query', 'value', 'standard', 'standardId'],
computed: {
isDisabled() {
if (this.query.db_field_name === 'replaced_standard') {
@@ -77,13 +91,14 @@
return false
}
},
mixins: [ResizeColumnProvide,ResizeHeader],
mixins: [ResizeColumnProvide, ResizeHeader],
data() {
return {
visible: false,
dictOptions: [],
arrayValue: !this.value ? [] : this.value.split(','),
confirmLoading: false,
selectedRowKeys: [],
selectedRowList: [],
content: [],
loading: false,
queryParam: {},
@@ -125,22 +140,44 @@
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.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 = []
}
@@ -150,18 +187,21 @@
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)
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', 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.$emit('input', number.join(','))
this.$emit('change', this.query.db_field_name, id.join(','))
this.visible = false
} else {
this.$message.warning(this.$t('selectLeastOne'))
@@ -170,19 +210,19 @@
indexclick(event) {
this.$emit('input', event.target.value)
},
onSelectChange(value,row) {
console.log(value)
console.log(row)
onSelectChange(value, row) {
this.selectedRowKeys = value
this.selectedRowList = row
// this.content = []
// value.forEach(val => {
// this.dataList.forEach((res) => {
// if (res.id === val) {
// this.content.push(res)
// }
// })
// })
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))
@@ -206,6 +246,38 @@
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
}
}
}
@@ -227,7 +299,10 @@
margin-left: 10px;
height: 38px;
line-height: 38px;
display: inline-block;
width: 80px;
overflow: hidden;
padding: 0;
}
.drawer-bootom-button {
@@ -257,11 +332,11 @@
margin-right: 16px;
}
.box-input-index {
.box-input-select {
display: inline-block;
width: 80%;
width: calc(100% - 90px);
height: 38px;
margin-top: 2px;
float: left;
}
.box-button {
@@ -274,15 +349,33 @@
margin-top: 20px;
}
/deep/.ant-table-thead > tr > th {
/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-title-text .ant-select-dropdown--multiple {
display: none !important;
}
/*.ant-input-disabled{*/
/* background-color: #f5f5f5!important;*/
/*}*/
@@ -169,6 +169,7 @@
<Standardselection :query="item"
:disabled="disabled"
:standard="formInline"
:standardId="formInline[item.db_field_name+'_id']"
@change="StandardselectionChange"
v-model="formInline[item.db_field_name]"/>
</a-form-model-item>
@@ -834,7 +835,6 @@
this.getForm()
},
StandardselectionChange(value, id) {
console.log(id)
this.formInline[value + '_id'] = id
this.formInline = { ...this.formInline }
},
@@ -173,6 +173,8 @@
<Standardselection :query="item"
:disabled="disabled"
:standard="formInline"
:standardId="formInline[item.db_field_name+'_id']"
@change="StandardselectionChange"
v-model="formInline[item.db_field_name]"/>
</a-form-model-item>
</div>
@@ -626,6 +628,10 @@
this.loadFormInfo()
},
methods:{
StandardselectionChange(value, id) {
this.formInline[value + '_id'] = id
this.formInline = { ...this.formInline }
},
loadData(){
this.loading=true
getAction(`split/sarFileSplitItemsVal/getItemsValList`,{itemId:this.itemId}).then(res=>{
@@ -123,6 +123,8 @@
:standard="formInline"
v-if="!disabled"
:disabled="disabled"
:standardId="formInline.correspondingStandardId"
@change="StandardselectionChange"
v-model="formInline.correspondingStandard"/>
<a-input class="box-input"
v-else
@@ -763,6 +765,10 @@
this.getFirstLevelDutyTerritory()
},
methods: {
StandardselectionChange(value, id) {
this.formInline.correspondingStandardId = id
this.formInline = { ...this.formInline }
},
DutyDepartChange(event) {
this.formInline.dutyTerritory = []
this.formInline = { ...this.formInline }
@@ -75,6 +75,7 @@
:query="{'db_field_txt':$t('Relevantlawsregulations')}"
:standard="formInline"
:disabled="false"
:standardId="formInline.lawsId"
@input="Standardselectioninput"
@change="StandardselectionChange"
v-model="formInline.lawsName"/>
@@ -74,6 +74,7 @@
<Standardselection
:query="{'db_field_txt':$t('Relevantlawsregulations')}"
:standard="formInline"
:standardId="formInline.lawsId"
:disabled="false"
@input="Standardselectioninput"
@change="StandardselectionChange"
@@ -73,6 +73,7 @@
:query="{'db_field_txt':$t('Relevantlawsregulations')}"
:standard="formInline"
:disabled="false"
:standardId="formInline.lawsId"
@input="Standardselectioninput"
@change="StandardselectionChange"
v-model="formInline.lawsName"/>