no message

main
HUOJIN\92525 2025-09-25 12:29:46 +08:00
parent bf360febbe
commit df31755799
4 changed files with 268 additions and 220 deletions

View File

@ -2,7 +2,7 @@
<div class="crud-opts">
<span class="crud-opts-left">
<!--左侧插槽-->
<slot name="left" />
<slot name="left"/>
<el-button
v-if="crud.optShow.add"
v-permission="permission.add"
@ -51,7 +51,7 @@
@click="crud.doExport"
>导出</el-button>
<!--右侧-->
<slot name="right" />
<slot name="right"/>
</span>
<el-button-group class="crud-opts-right">
<el-button
@ -106,7 +106,7 @@
</div>
</template>
<script>
import CRUD, { crud } from '@crud/crud'
import CRUD, {crud} from '@crud/crud'
import crudTableConfig from '@/api/tableConfig'
import Sortable from 'sortablejs'
@ -130,22 +130,28 @@ export default {
props: {
permission: {
type: Object,
default: () => { return {} }
default: () => {
return {}
}
},
ignoreColumns: {
type: Array,
default: () => { return [] }
default: () => {
return []
}
},
tableKey: {
type: String,
default: () => { return '' }
default: () => {
return ''
}
}
},
data() {
return {
hiddenColumns:[],
table_configs:[],
table_configs_xs:[],
hiddenColumns: [],
table_configs: [],
table_configs_xs: [],
tableColumns: [],
allColumnsSelected: true,
allColumnsSelectedIndeterminate: false,
@ -180,83 +186,57 @@ export default {
},
methods: {
initcolumn() {
this.updateTableColumns()
const strHidden = sessionStorage.getItem(this.tableKey)
// sessionStorage
if (!strHidden) {
this.hiddenColumns = []
return
}
// JSON
try {
this.hiddenColumns = JSON.parse(strHidden) || []
} catch (error) {
this.hiddenColumns = []
return
}
if (this.hiddenColumns.length > 0) {
this.hiddenColumns = JSON.parse(strHidden);
if (this.hiddenColumns) {
const table = this.crud.props.table
// label column
const labelToColumnMap = {}
if (table && table.$children) {
table.$children.forEach(child => {
if (child.label) {
labelToColumnMap[child.label] = child
}
})
}
this.table_configs_xs.forEach((column, index) => {
const vm = labelToColumnMap[column.label]
//
if (!vm) {
return
}
const vm = table.$children.find(e => e.label === column.label)
const columnConfig = vm.columnConfig
// columnConfig
if (!columnConfig) {
return
}
if (vm.owner && vm.owner.store) {
vm.owner.store.commit('removeColumn', columnConfig, null)
}
vm.owner.store.commit('removeColumn', columnConfig, null)
})
this.ignoreNextTableColumnsChange = false
setTimeout(() => {
//
this.showcolumn()
this.showcolumn();
}, 200)
}
},
showcolumn() {
console.log("------显示列------")
const strHidden=sessionStorage.getItem(this.tableKey)
this.hiddenColumns= JSON.parse(strHidden);
const table = this.crud.props.table
this.hiddenColumns.forEach((column,index) => {
const vm = table.$children.find(e => e.prop === column.property)
const columnConfig = vm.columnConfig
console.log(columnConfig.label)
if(column.visible){
columnConfig.width=column.width
columnConfig.visible=column.visible
vm.owner.store.commit('insertColumn', columnConfig, index+1 , null)
try {
// sessionStoragehiddenColumns
const strHidden = sessionStorage.getItem(this.tableKey)
if (strHidden) {
this.hiddenColumns = JSON.parse(strHidden);
} else {
//
this.hiddenColumns = [];
}
})
console.log("------显示列完成------")
this. updateTableColumns();
const table = this.crud.props.table
//
this.hiddenColumns.forEach((column, index) => {
const vm = table.$children.find(e => e && e.prop === column.property)
if (vm) {
const columnConfig = vm.columnConfig;
// columnConfig
if (columnConfig) {
if (column.visible) {
//
columnConfig.width = column.width;
columnConfig.visible = column.visible;
vm.owner.store.commit('insertColumn', columnConfig, index + 1, null);
}
}
}
});
this.updateTableColumns();
} catch (error) {
console.error("处理列配置时发生错误:", error);
}
},
//
columnDrop() {
@ -266,51 +246,51 @@ export default {
delay: 0,
onEnd: evt => {
// label
this.ColumnsDrop(evt.item.innerText,evt.newIndex)
this.ColumnsDrop(evt.item.innerText, evt.newIndex)
}
})
},
//
ColumnsDrop(oldText,newIndex) {
ColumnsDrop(oldText, newIndex) {
const table = this.crud.props.table
let myindex = -1 //
let oldIndex1 = 0
let step = -1
let step = -1
let count = 0
//
this.tableColumns.some((column,index) => {
if(column.visible) {
this.tableColumns.some((column, index) => {
if (column.visible) {
count++
}
})
//
this.tableColumns.some((column,index) => {
if(column.label === oldText) {
this.tableColumns.some((column, index) => {
if (column.label === oldText) {
oldIndex1 = index
return true
}else{
} else {
//
if(step>index){
if (step > index) {
myindex++
}
}
step++
})
if (myindex === -1 ) {
if (myindex === -1) {
myindex = 0
}
let item= this.tableColumns[oldIndex1]
let item = this.tableColumns[oldIndex1]
const vm = table.$children.find(e => e.prop === item.property)
const columnConfig = vm.columnConfig
/*this.tableColumns.splice(oldIndex1-1, 1)
this.tableColumns.splice(myindex-1, 0, item)*/
if(oldIndex1 <newIndex){ //
vm.owner.store.commit('insertColumn', columnConfig, newIndex+myindex , null)
if (oldIndex1 < newIndex) { //
vm.owner.store.commit('insertColumn', columnConfig, newIndex + myindex, null)
vm.owner.store.commit('removeColumn', columnConfig, null)
}else { //
} else { //
vm.owner.store.commit('removeColumn', columnConfig, null)
vm.owner.store.commit('insertColumn', columnConfig, newIndex+myindex , null)
vm.owner.store.commit('insertColumn', columnConfig, newIndex + myindex, null)
}
//
this.ignoreNextTableColumnsChange = false
@ -381,7 +361,7 @@ export default {
})
if (selectedCount === 0) {
this.crud.notify('请至少选择一列', CRUD.NOTIFICATION_TYPE.WARNING)
this.$nextTick(function() {
this.$nextTick(function () {
item.visible = true
})
return
@ -404,8 +384,8 @@ export default {
crudTableConfig.add(post_table_config)*/
//this.postToTableConfig();
},
postToTableConfig(){
this. updateTableColumns();
postToTableConfig() {
this.updateTableColumns();
const columns = []
this.tableColumns.forEach(column => {
const table_config = {
@ -421,11 +401,11 @@ export default {
tableType: this.tableKey
}
this.crud.loading=true
this.crud.loading = true
crudTableConfig.add(post_table_config).then(res => {
setTimeout(() => {
//
this.crud.loading=false
this.crud.loading = false
}, 500)
})
@ -440,7 +420,7 @@ export default {
if (item.visible) {
//
const columnIndex = this.tableColumns.indexOf(item)
vm.owner.store.commit('insertColumn', columnConfig, columnIndex+1, null)
vm.owner.store.commit('insertColumn', columnConfig, columnIndex + 1, null)
} else {
vm.owner.store.commit('removeColumn', columnConfig, null)
}
@ -460,9 +440,11 @@ export default {
display: flex;
align-items: center;
}
.crud-opts .crud-opts-right {
margin-left: auto;
}
.crud-opts .crud-opts-right span {
float: left;
}

View File

@ -5,9 +5,11 @@
<!-- 查询操作-->
<el-form ref="form" :inline="true" :model="form" label-width="70px">
<el-input v-model="query.itemCode" clearable placeholder="品番" style="width: 140px;" class="filter-item"
@keyup.enter.native="crud.toQuery"/>
<el-select v-model="query.status" clearable placeholder="状态" value-key="id" class="filter-item" style="width: 150px"
<el-input v-model="query.itemCode" clearable placeholder="品番" style="width: 140px;" class="filter-item"
@keyup.enter.native="crud.toQuery"
/>
<el-select v-model="query.status" clearable placeholder="状态" value-key="id" class="filter-item"
style="width: 150px"
@keyup.enter.native="crud.toQuery"
>
<el-option
@ -19,11 +21,15 @@
>
</el-option>
</el-select>
<AreaSelect v-model="query.area" />
<PointCodeSelect :value-key="'id'" :point_type="'CH'" v-model="query.itemCode2" />
<AreaCodeSelect v-model="query.ckAreaCode" :bexb="false" class="filter-item" filterable placeholder="拣货库区" style="width: 155px;"/>
<AreaCodeSelect v-model="query.rkAreaCode" @keyup.enter.native="crud.toQuery" :bexb="true" class="filter-item" filterable placeholder="叫料库区" style="width: 155px;"/>
<date-range-picker v-model="query.createTime" class="date-item" style="width: 100px" />
<AreaSelect v-model="query.ckAreaCode" :return-type="'value'" :return-value-key="'code'" :bexb="false"
class="filter-item" placeholder="拣货库区" style="width: 155px;"
/>
<AreaSelect v-model="query.rkAreaCode" :return-type="'value'" :return-value-key="'code'" :bexb="true"
class="filter-item" placeholder="叫料库区" style="width: 155px;"
/>
<date-range-picker v-model="query.createTime" class="date-item" style="width: 100px"/>
<!-- 搜索-->
<rrOperation :crud="crud"/>
<!-- 重置-->
@ -92,13 +98,14 @@
<el-table ref="table" v-loading="crud.loading" :data="crud.data" size="small"
style="width: 100%;"
height="58vh"
@selection-change="selectionChangeHandlerTwo" border>
@selection-change="selectionChangeHandlerTwo" border
>
<el-table-column type="selection" width="50"/>
<el-table-column prop="id" label="序号"/>
<!-- <el-table-column prop="shArea.gcCode" label="工厂" width="150px"/>-->
<!-- <el-table-column prop="shArea.gcCode" label="工厂" width="150px"/>-->
<el-table-column prop="item.code" label="品番" width="150px"/>
<el-table-column prop="item.name" label="品名"/>
<el-table-column prop="item.code" label="品番" width="150px"/>
<el-table-column prop="item.name" label="品名"/>
<el-table-column prop="status" label="状态">
<template slot-scope="scope">
{{ dict.label.pick_status[scope.row.status] }}
@ -113,26 +120,25 @@
<el-table-column prop="xdPf" label="箱单品番" width="100px"/>
<el-table-column prop="orderQty" label="订单数量"/>
<el-table-column prop="allocatedQty" label="分配数量"/>
<el-table-column prop="pickedQty" label="拣货数量"/>
<el-table-column prop="pickedQty" label="拣货数量"/>
<el-table-column prop="remark" label="备注"/>
<el-table-column prop="createBy" label="创建人"/>
<el-table-column prop="createTime" width="150px" label="创建时间"/>
<el-table-column label="操作" width="150px" align="center">
<template slot-scope="scope">
<el-button size="mini" :disabled="scope.row.status!='OPEN'" type="primary" icon="el-icon-edit"
@click="editPick(scope.row)"/>
@click="editPick(scope.row)"
/>
<template>
<el-popconfirm
title="确定删除吗?"
icon='el-icon-delete'
icon-color='red'
icon="el-icon-delete"
icon-color="red"
@confirm="deletePick(scope.row)"
>
<el-button slot="reference" :disabled="scope.row.status!='OPEN'" size="mini" type="danger"
icon="el-icon-delete"/>
icon="el-icon-delete"
/>
</el-popconfirm>
</template>
@ -144,25 +150,25 @@
<XdTask ref="xdTask"/>
<!--表单组件-->
<el-dialog title="制造叫料" :visible.sync="cxjlFromFlag" width="500px" >
<el-dialog title="制造叫料" :visible.sync="cxjlFromFlag" width="500px">
<el-form ref="cxjlFrom" :model="cxjlFrom" :rules="rules" size="small" label-width="80px">
<el-form-item label="制造库位" prop="zzkwCode">
<BomAccountPointSelect v-model="cxjlFrom.zzkw_code" :value-key="'bom_account_id'" @change="getChangeVule"/>
<BomAccountPointSelect v-model="cxjlFrom.zzkw_code" :value-key="'bom_account_id'" @change="getChangeVule"/>
</el-form-item>
<el-form-item label="品番">
<el-input v-model="cxjlFrom.item_code" />
<el-input v-model="cxjlFrom.item_code"/>
</el-form-item>
<el-form-item label="品名">
<el-input v-model="cxjlFrom.item_name" />
<el-input v-model="cxjlFrom.item_name"/>
</el-form-item>
<el-form-item label="数量">
<el-input v-model="cxjlFrom.order_qty" />
<el-input v-model="cxjlFrom.order_qty"/>
</el-form-item>
<el-form-item label="税别">
<el-input v-model="cxjlFrom.bonded"/>
</el-form-item>
<el-form-item label="叫料库区">
<el-input v-model="cxjlFrom.gw_name" />
<el-input v-model="cxjlFrom.gw_name"/>
</el-form-item>
<el-form-item label="箱单品番">
<el-checkbox v-model="cxjlFrom.beXdPf"/>
@ -187,24 +193,24 @@
</template>
<script>
import crudPickDetail,{zzjl,allocatePickDetail,cancelAllocatePickDetail} from '@/api/pickDetail'
import CRUD, {presenter, header, form, crud} from '@crud/crud'
import crudPickDetail, { zzjl, allocatePickDetail, cancelAllocatePickDetail } from '@/api/pickDetail'
import CRUD, { presenter, header, form, crud } from '@crud/crud'
import rrOperation from '@crud/RR.operation.vue'
import crudOperation from '@crud/CRUD.operation.vue'
import udOperation from '@crud/UD.operation.vue'
import pagination from '@crud/Pagination.vue'
import {queryBomAccountPoints} from "@/api/bomAccount"
import {getItems} from "@/api/item"
import PickTask from "@/views/business-pick/pickDetail/pickTicketTask.vue"
import XdTask from "@/views/business-pick/pickDetail/xdTask.vue"
import DateRangePicker from "@/components/DateRangePicker/index.vue";
import { queryBomAccountPoints } from '@/api/bomAccount'
import { getItems } from '@/api/item'
import PickTask from '@/views/business-pick/pickDetail/pickTicketTask.vue'
import XdTask from '@/views/business-pick/pickDetail/xdTask.vue'
import DateRangePicker from '@/components/DateRangePicker/index.vue'
import { formatDate } from '@/utils/commonUtils'
import ItemSelect from "@/views/generic-component/ItemSelect.vue";
import BomAccountPointSelect from "@/views/generic-component/BomAccountPointSelect.vue";
import {queryPickDetailXd} from "@/api/inventory";
import AreaCodeSelect from "@/views/generic-component/AreaCodeSelect.vue";
import AreaSelect from "@/views/generic-component/AreaSelect.vue";
import PointCodeSelect from "@/views/generic-component/PointCodeSelect.vue";
import ItemSelect from '@/views/generic-component/ItemSelect.vue'
import BomAccountPointSelect from '@/views/generic-component/BomAccountPointSelect.vue'
import { queryPickDetailXd } from '@/api/inventory'
import AreaCodeSelect from '@/views/generic-component/AreaCodeSelect.vue'
import AreaSelect from '@/views/generic-component/AreaSelect.vue'
import PointCodeSelect from '@/views/generic-component/PointCodeSelect.vue'
const defaultForm = {
id: null,
@ -218,7 +224,8 @@ export default {
AreaCodeSelect,
XdTask,
BomAccountPointSelect,
ItemSelect, DateRangePicker, PickTask,pagination, crudOperation, rrOperation, udOperation},
ItemSelect, DateRangePicker, PickTask, pagination, crudOperation, rrOperation, udOperation
},
mixins: [presenter(), header(), form(defaultForm), crud()],
dicts: ['pick_status'],
cruds() {
@ -227,7 +234,7 @@ export default {
url: 'api/pickDetail/queryPickDetailZsc',
idField: 'id',
sort: 'id,desc',
crudMethod: {...crudPickDetail},
crudMethod: { ...crudPickDetail },
optShow: {
add: false,
edit: false,
@ -235,7 +242,7 @@ export default {
reset: false,
download: true
}
},)
})
},
data() {
return {
@ -245,29 +252,41 @@ export default {
radio3: '未拣货',
items: [],
cxjlFromFlag: false,
cxjlFrom: { bom_account_id: null,order_qty:0, item_code:null, item_name:null, zzkw_id:null, bonded:null,zzkw_code:null, gw_code:null, gw_name:null, status:null, remark:null,srs:0,beXdPf:false },
permission: {
cxjlFrom: {
bom_account_id: null,
order_qty: 0,
item_code: null,
item_name: null,
zzkw_id: null,
bonded: null,
zzkw_code: null,
gw_code: null,
gw_name: null,
status: null,
remark: null,
srs: 0,
beXdPf: false
},
permission: {},
rules: {
item: [
{required: true, message: '品番必填', trigger: 'blur'}
{ required: true, message: '品番必填', trigger: 'blur' }
],
zzkwCode: [
{required: true, message: '制造库位必填', trigger: 'blur'}
{ required: true, message: '制造库位必填', trigger: 'blur' }
]
},
itemListData: [],
//
itemOptions: [],
zzkwPointOptions: [],
loading_add:false
loading_add: false
}
},
mounted() {
//
this.getItem();
this.getItem()
},
methods: {
// false
@ -276,7 +295,7 @@ export default {
},
getItem() {
getItems({}).then(res => {
this.items = res.content.map(function (obj) {
this.items = res.content.map(function(obj) {
if (obj.hasChildren) {
obj.children = null
}
@ -292,49 +311,48 @@ export default {
selectionChangeHandlerTwo(val) {
this.crud.selections = val
if (this.crud.selections.length == 0) {
this.show_jh = true;
this.show_fp = true;
this.show_cancelfp = true;
return;
this.show_jh = true
this.show_fp = true
this.show_cancelfp = true
return
}
const status = [];
const status = []
for (let i = 0; i < val.length; i++) {
status.push(this.crud.selections[i].status)
}
if (this.isAllEqual(status) && status[0] == "OPEN") {
this.show_jh = true;
this.show_fp = false;
return;
if (this.isAllEqual(status) && status[0] == 'OPEN') {
this.show_jh = true
this.show_fp = false
return
}
if (this.isAllEqual(status) && status[0] == "ALLOCATE") {
this.show_jh = true;
this.show_fp = false;
this.show_cancelfp = false;
if (this.isAllEqual(status) && status[0] == 'ALLOCATE') {
this.show_jh = true
this.show_fp = false
this.show_cancelfp = false
}
//
if (this.crud.selections.length == 1 && this.crud.selections[0].orderQty == this.crud.selections[0].allocatedQty) {
this.show_jh = false;
this.show_fp = true;
return;
this.show_jh = false
this.show_fp = true
return
}
},
btnAllocate(datas) {
const ids = [];
for (let i = 0; i < datas.length; i++) {
ids.push(datas[i].id)
}
console.log(ids)
allocatePickDetail(ids).then(res => {
this.crud.toQuery()
})
const ids = []
for (let i = 0; i < datas.length; i++) {
ids.push(datas[i].id)
}
console.log(ids)
allocatePickDetail(ids).then(res => {
this.crud.toQuery()
})
},
btnCancelAllocate(datas) {
const ids = [];
const ids = []
for (let i = 0; i < datas.length; i++) {
ids.push(datas[i].id)
}
@ -353,25 +371,25 @@ export default {
this.$refs.xdTask.queryPickDetailXd(id)
},
shuaxin() {
this.crud.toQuery();
this.crud.toQuery()
},
clickChange(lab) {
if (lab === "全部") {
this.crud.resetQuery();
this.crud.toQuery();
} else if (lab === "未拣货") {
this.query.status ='OPEN'
this.crud.toQuery();
} else if (lab === "已拣未发") {
if (lab === '全部') {
this.crud.resetQuery()
this.crud.toQuery()
} else if (lab === '未拣货') {
this.query.status = 'OPEN'
this.crud.toQuery()
} else if (lab === '已拣未发') {
this.query.status = 'PICK_ALL'
this.crud.toQuery();
} else if (lab === "已发未收") {
this.crud.toQuery()
} else if (lab === '已发未收') {
this.query.status = 'SHIP_ALL'
this.crud.toQuery();
this.crud.toQuery()
}
},
resetQuery() {
this.radio3 = '未拣货';
this.radio3 = '未拣货'
this.crud.resetQuery()
},
editPick(data) {
@ -381,24 +399,24 @@ export default {
this.crud.doDelete(data)
}, isAllEqual(array) {
if (array.length > 0) {
return !array.some(function (value, index) {
return value !== array[0];
});
return !array.some(function(value, index) {
return value !== array[0]
})
} else {
return true;
return true
}
},
getChangeVule(dben) {
this.cxjlFrom.order_qty=dben.srs;
this.cxjlFrom.item_code=dben.item_code;
this.cxjlFrom.item_name=dben.item_name;
this.cxjlFrom.gw_code=dben.gw_code;
this.cxjlFrom.gw_name=dben.gw_name;
this.cxjlFrom.bom_account_id=dben.bom_account_id
this.cxjlFrom.item_id=dben.item_id;
this.cxjlFrom.zzkw_id=dben.zzkw_id;
this.cxjlFrom.rk_id=dben.rk_id;
this.cxjlFrom.bonded=dben.bonded;
this.cxjlFrom.order_qty = dben.srs
this.cxjlFrom.item_code = dben.item_code
this.cxjlFrom.item_name = dben.item_name
this.cxjlFrom.gw_code = dben.gw_code
this.cxjlFrom.gw_name = dben.gw_name
this.cxjlFrom.bom_account_id = dben.bom_account_id
this.cxjlFrom.item_id = dben.item_id
this.cxjlFrom.zzkw_id = dben.zzkw_id
this.cxjlFrom.rk_id = dben.rk_id
this.cxjlFrom.bonded = dben.bonded
},
btnZzjl() {
@ -414,14 +432,14 @@ export default {
})
},
//
getFormatDate(data){
return formatDate(data);
getFormatDate(data) {
return formatDate(data)
},
//
resetForm() {
this.$refs['cxjlFrom'].resetFields()
this.$data.cxjlFrom = JSON.parse(JSON.stringify(this.$options.data().cxjlFrom))
},
}
}
}
</script>

View File

@ -91,7 +91,8 @@ export default {
{key: 'true', display_name: '成功'},
{key: 'false', display_name: '失败'}
],
tsakSelectData: []
tsakSelectData: [],
dialogTableHight: 0
}
},
methods: {

View File

@ -16,55 +16,48 @@
v-for="item in items"
:key="item.id"
:label="item.code"
:value="item"
:value="returnType === 'object' ? item : item[returnValueKey]"
>
<span>{{ item.code }}</span>
<span>{{ item.code }}</span>
<span>{{ item.name }}</span>
</el-option>
</el-select>
</template>
<script>
import curdArea from '@/api/area'
import CRUD from '@crud/crud'
export default {
name: 'AreaSelect',
props: {
// v-model
value: {
type: [String, Number, Boolean, Array],
type: [String, Number, Boolean, Array, Object],
default: ''
},
width: {
type: String,
default: '200px'
},
//
placeholder: {
type: String,
default: '请选择'
},
//
disabled: {
type: Boolean,
default: false
},
//
clearable: {
type: Boolean,
default: false
default: true
},
//
multiple: {
type: Boolean,
default: false
},
//
filterable: {
type: Boolean,
default: false
default: true
},
valueKey: {
type: String,
@ -74,10 +67,23 @@ export default {
type: Boolean,
default: true
},
bexb:{
bexb: {
type: Boolean,
default: true
},
//
returnType: {
type: String,
default: 'object', // 'object' | 'value'
validator: function(value) {
return ['object', 'value'].includes(value)
}
},
// returnType'value'
returnValueKey: {
type: String,
default: 'id'
}
},
data() {
return {
@ -86,7 +92,6 @@ export default {
}
},
computed: {
// v-model
selectedValue: {
get() {
return this.value
@ -96,12 +101,19 @@ export default {
}
}
},
//
watch: {
// returnType
returnType: {
handler() {
this.handleReturnTypeChange()
},
immediate: true
}
},
created() {
this.initData()
},
methods: {
//
async initData() {
this.loading = true
try {
@ -115,17 +127,52 @@ export default {
this.loading = false
}
},
//
handleChange(val) {
this.$emit('change', val)
let emitValue = val
//
if (this.returnType === 'value' && val) {
if (this.multiple) {
//
emitValue = Array.isArray(val) ? val.map(item =>
typeof item === 'object' ? item[this.returnValueKey] : item
) : []
} else {
//
emitValue = typeof val === 'object' ? val[this.returnValueKey] : val
}
}
this.$emit('change', emitValue)
},
//
handleClear() {
this.$emit('clear')
},
//
handleReturnTypeChange() {
if (this.returnType === 'value') {
//
if (this.multiple) {
const values = Array.isArray(this.value) ? this.value.map(item => typeof item === 'object' ? item[this.returnValueKey] : item) : []
this.$emit('input', values)
} else {
const value = typeof this.value === 'object' ? this.value[this.returnValueKey] : this.value
this.$emit('input', value)
}
} else {
//
if (this.multiple) {
const objects = Array.isArray(this.value) ? this.value.map(val => this.items.find(item => item[this.returnValueKey] === val) || val) : []
this.$emit('input', objects)
} else {
const object = this.items.find(item => item[this.returnValueKey] === this.value) || this.value
this.$emit('input', object)
}
}
}
}
}
</script>
<style scoped>
/* 可根据需要添加组件样式 */
</style>