no message
parent
bf360febbe
commit
df31755799
|
|
@ -130,15 +130,21 @@ export default {
|
||||||
props: {
|
props: {
|
||||||
permission: {
|
permission: {
|
||||||
type: Object,
|
type: Object,
|
||||||
default: () => { return {} }
|
default: () => {
|
||||||
|
return {}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
ignoreColumns: {
|
ignoreColumns: {
|
||||||
type: Array,
|
type: Array,
|
||||||
default: () => { return [] }
|
default: () => {
|
||||||
|
return []
|
||||||
|
}
|
||||||
},
|
},
|
||||||
tableKey: {
|
tableKey: {
|
||||||
type: String,
|
type: String,
|
||||||
default: () => { return '' }
|
default: () => {
|
||||||
|
return ''
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
|
|
@ -180,83 +186,57 @@ export default {
|
||||||
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
|
||||||
initcolumn() {
|
initcolumn() {
|
||||||
this.updateTableColumns()
|
this.updateTableColumns()
|
||||||
const strHidden = sessionStorage.getItem(this.tableKey)
|
const strHidden = sessionStorage.getItem(this.tableKey)
|
||||||
|
this.hiddenColumns = JSON.parse(strHidden);
|
||||||
// 检查 sessionStorage 值是否存在
|
if (this.hiddenColumns) {
|
||||||
if (!strHidden) {
|
|
||||||
this.hiddenColumns = []
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// 安全解析 JSON 数据
|
|
||||||
try {
|
|
||||||
this.hiddenColumns = JSON.parse(strHidden) || []
|
|
||||||
} catch (error) {
|
|
||||||
this.hiddenColumns = []
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.hiddenColumns.length > 0) {
|
|
||||||
const table = this.crud.props.table
|
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) => {
|
this.table_configs_xs.forEach((column, index) => {
|
||||||
const vm = labelToColumnMap[column.label]
|
const vm = table.$children.find(e => e.label === column.label)
|
||||||
|
|
||||||
// 检查元素是否存在
|
|
||||||
if (!vm) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
const columnConfig = vm.columnConfig
|
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
|
this.ignoreNextTableColumnsChange = false
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
// 方法区
|
// 方法区
|
||||||
this.showcolumn()
|
this.showcolumn();
|
||||||
}, 200)
|
}, 200)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
showcolumn() {
|
showcolumn() {
|
||||||
console.log("------显示列------")
|
try {
|
||||||
|
// 从sessionStorage安全地获取并解析hiddenColumns
|
||||||
const strHidden = sessionStorage.getItem(this.tableKey)
|
const strHidden = sessionStorage.getItem(this.tableKey)
|
||||||
|
if (strHidden) {
|
||||||
this.hiddenColumns = JSON.parse(strHidden);
|
this.hiddenColumns = JSON.parse(strHidden);
|
||||||
const table = this.crud.props.table
|
} else {
|
||||||
this.hiddenColumns.forEach((column,index) => {
|
// 如果没有找到相应的存储信息,可以初始化为空数组或相应的默认值
|
||||||
|
this.hiddenColumns = [];
|
||||||
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)
|
|
||||||
}
|
}
|
||||||
})
|
|
||||||
console.log("------显示列完成------")
|
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();
|
this.updateTableColumns();
|
||||||
|
} catch (error) {
|
||||||
|
console.error("处理列配置时发生错误:", error);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
//列拖拽
|
//列拖拽
|
||||||
columnDrop() {
|
columnDrop() {
|
||||||
|
|
@ -460,9 +440,11 @@ export default {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.crud-opts .crud-opts-right {
|
.crud-opts .crud-opts-right {
|
||||||
margin-left: auto;
|
margin-left: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
.crud-opts .crud-opts-right span {
|
.crud-opts .crud-opts-right span {
|
||||||
float: left;
|
float: left;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,8 +6,10 @@
|
||||||
<el-form ref="form" :inline="true" :model="form" label-width="70px">
|
<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"
|
<el-input v-model="query.itemCode" clearable placeholder="品番" style="width: 140px;" class="filter-item"
|
||||||
@keyup.enter.native="crud.toQuery"/>
|
@keyup.enter.native="crud.toQuery"
|
||||||
<el-select v-model="query.status" clearable placeholder="状态" value-key="id" class="filter-item" style="width: 150px"
|
/>
|
||||||
|
<el-select v-model="query.status" clearable placeholder="状态" value-key="id" class="filter-item"
|
||||||
|
style="width: 150px"
|
||||||
@keyup.enter.native="crud.toQuery"
|
@keyup.enter.native="crud.toQuery"
|
||||||
>
|
>
|
||||||
<el-option
|
<el-option
|
||||||
|
|
@ -19,10 +21,14 @@
|
||||||
>
|
>
|
||||||
</el-option>
|
</el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
<AreaSelect v-model="query.area" />
|
<AreaSelect v-model="query.ckAreaCode" :return-type="'value'" :return-value-key="'code'" :bexb="false"
|
||||||
<PointCodeSelect :value-key="'id'" :point_type="'CH'" v-model="query.itemCode2" />
|
class="filter-item" placeholder="拣货库区" style="width: 155px;"
|
||||||
<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;"/>
|
/>
|
||||||
|
<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"/>
|
<date-range-picker v-model="query.createTime" class="date-item" style="width: 100px"/>
|
||||||
<!-- 搜索-->
|
<!-- 搜索-->
|
||||||
<rrOperation :crud="crud"/>
|
<rrOperation :crud="crud"/>
|
||||||
|
|
@ -92,7 +98,8 @@
|
||||||
<el-table ref="table" v-loading="crud.loading" :data="crud.data" size="small"
|
<el-table ref="table" v-loading="crud.loading" :data="crud.data" size="small"
|
||||||
style="width: 100%;"
|
style="width: 100%;"
|
||||||
height="58vh"
|
height="58vh"
|
||||||
@selection-change="selectionChangeHandlerTwo" border>
|
@selection-change="selectionChangeHandlerTwo" border
|
||||||
|
>
|
||||||
<el-table-column type="selection" width="50"/>
|
<el-table-column type="selection" width="50"/>
|
||||||
<el-table-column prop="id" label="序号"/>
|
<el-table-column prop="id" label="序号"/>
|
||||||
<!-- <el-table-column prop="shArea.gcCode" label="工厂" width="150px"/>-->
|
<!-- <el-table-column prop="shArea.gcCode" label="工厂" width="150px"/>-->
|
||||||
|
|
@ -113,26 +120,25 @@
|
||||||
<el-table-column prop="xdPf" label="箱单品番" width="100px"/>
|
<el-table-column prop="xdPf" label="箱单品番" width="100px"/>
|
||||||
<el-table-column prop="orderQty" label="订单数量"/>
|
<el-table-column prop="orderQty" label="订单数量"/>
|
||||||
<el-table-column prop="allocatedQty" 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="remark" label="备注"/>
|
||||||
|
|
||||||
<el-table-column prop="createBy" label="创建人"/>
|
<el-table-column prop="createBy" label="创建人"/>
|
||||||
<el-table-column prop="createTime" width="150px" label="创建时间"/>
|
<el-table-column prop="createTime" width="150px" label="创建时间"/>
|
||||||
<el-table-column label="操作" width="150px" align="center">
|
<el-table-column label="操作" width="150px" align="center">
|
||||||
|
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-button size="mini" :disabled="scope.row.status!='OPEN'" type="primary" icon="el-icon-edit"
|
<el-button size="mini" :disabled="scope.row.status!='OPEN'" type="primary" icon="el-icon-edit"
|
||||||
@click="editPick(scope.row)"/>
|
@click="editPick(scope.row)"
|
||||||
|
/>
|
||||||
<template>
|
<template>
|
||||||
<el-popconfirm
|
<el-popconfirm
|
||||||
title="确定删除吗?"
|
title="确定删除吗?"
|
||||||
icon='el-icon-delete'
|
icon="el-icon-delete"
|
||||||
icon-color='red'
|
icon-color="red"
|
||||||
@confirm="deletePick(scope.row)"
|
@confirm="deletePick(scope.row)"
|
||||||
>
|
>
|
||||||
<el-button slot="reference" :disabled="scope.row.status!='OPEN'" size="mini" type="danger"
|
<el-button slot="reference" :disabled="scope.row.status!='OPEN'" size="mini" type="danger"
|
||||||
icon="el-icon-delete"/>
|
icon="el-icon-delete"
|
||||||
|
/>
|
||||||
</el-popconfirm>
|
</el-popconfirm>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
@ -193,18 +199,18 @@ import rrOperation from '@crud/RR.operation.vue'
|
||||||
import crudOperation from '@crud/CRUD.operation.vue'
|
import crudOperation from '@crud/CRUD.operation.vue'
|
||||||
import udOperation from '@crud/UD.operation.vue'
|
import udOperation from '@crud/UD.operation.vue'
|
||||||
import pagination from '@crud/Pagination.vue'
|
import pagination from '@crud/Pagination.vue'
|
||||||
import {queryBomAccountPoints} from "@/api/bomAccount"
|
import { queryBomAccountPoints } from '@/api/bomAccount'
|
||||||
import {getItems} from "@/api/item"
|
import { getItems } from '@/api/item'
|
||||||
import PickTask from "@/views/business-pick/pickDetail/pickTicketTask.vue"
|
import PickTask from '@/views/business-pick/pickDetail/pickTicketTask.vue'
|
||||||
import XdTask from "@/views/business-pick/pickDetail/xdTask.vue"
|
import XdTask from '@/views/business-pick/pickDetail/xdTask.vue'
|
||||||
import DateRangePicker from "@/components/DateRangePicker/index.vue";
|
import DateRangePicker from '@/components/DateRangePicker/index.vue'
|
||||||
import { formatDate } from '@/utils/commonUtils'
|
import { formatDate } from '@/utils/commonUtils'
|
||||||
import ItemSelect from "@/views/generic-component/ItemSelect.vue";
|
import ItemSelect from '@/views/generic-component/ItemSelect.vue'
|
||||||
import BomAccountPointSelect from "@/views/generic-component/BomAccountPointSelect.vue";
|
import BomAccountPointSelect from '@/views/generic-component/BomAccountPointSelect.vue'
|
||||||
import {queryPickDetailXd} from "@/api/inventory";
|
import { queryPickDetailXd } from '@/api/inventory'
|
||||||
import AreaCodeSelect from "@/views/generic-component/AreaCodeSelect.vue";
|
import AreaCodeSelect from '@/views/generic-component/AreaCodeSelect.vue'
|
||||||
import AreaSelect from "@/views/generic-component/AreaSelect.vue";
|
import AreaSelect from '@/views/generic-component/AreaSelect.vue'
|
||||||
import PointCodeSelect from "@/views/generic-component/PointCodeSelect.vue";
|
import PointCodeSelect from '@/views/generic-component/PointCodeSelect.vue'
|
||||||
|
|
||||||
const defaultForm = {
|
const defaultForm = {
|
||||||
id: null,
|
id: null,
|
||||||
|
|
@ -218,7 +224,8 @@ export default {
|
||||||
AreaCodeSelect,
|
AreaCodeSelect,
|
||||||
XdTask,
|
XdTask,
|
||||||
BomAccountPointSelect,
|
BomAccountPointSelect,
|
||||||
ItemSelect, DateRangePicker, PickTask,pagination, crudOperation, rrOperation, udOperation},
|
ItemSelect, DateRangePicker, PickTask, pagination, crudOperation, rrOperation, udOperation
|
||||||
|
},
|
||||||
mixins: [presenter(), header(), form(defaultForm), crud()],
|
mixins: [presenter(), header(), form(defaultForm), crud()],
|
||||||
dicts: ['pick_status'],
|
dicts: ['pick_status'],
|
||||||
cruds() {
|
cruds() {
|
||||||
|
|
@ -235,7 +242,7 @@ export default {
|
||||||
reset: false,
|
reset: false,
|
||||||
download: true
|
download: true
|
||||||
}
|
}
|
||||||
},)
|
})
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
|
@ -245,10 +252,22 @@ export default {
|
||||||
radio3: '未拣货',
|
radio3: '未拣货',
|
||||||
items: [],
|
items: [],
|
||||||
cxjlFromFlag: false,
|
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 },
|
cxjlFrom: {
|
||||||
permission: {
|
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: {
|
rules: {
|
||||||
item: [
|
item: [
|
||||||
{ required: true, message: '品番必填', trigger: 'blur' }
|
{ required: true, message: '品番必填', trigger: 'blur' }
|
||||||
|
|
@ -267,7 +286,7 @@ export default {
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
//初始化数据
|
//初始化数据
|
||||||
this.getItem();
|
this.getItem()
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
// 钩子:在获取表格数据之前执行,false 则代表不获取数据
|
// 钩子:在获取表格数据之前执行,false 则代表不获取数据
|
||||||
|
|
@ -292,39 +311,38 @@ export default {
|
||||||
selectionChangeHandlerTwo(val) {
|
selectionChangeHandlerTwo(val) {
|
||||||
this.crud.selections = val
|
this.crud.selections = val
|
||||||
if (this.crud.selections.length == 0) {
|
if (this.crud.selections.length == 0) {
|
||||||
this.show_jh = true;
|
this.show_jh = true
|
||||||
this.show_fp = true;
|
this.show_fp = true
|
||||||
this.show_cancelfp = true;
|
this.show_cancelfp = true
|
||||||
return;
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
const status = [];
|
const status = []
|
||||||
for (let i = 0; i < val.length; i++) {
|
for (let i = 0; i < val.length; i++) {
|
||||||
status.push(this.crud.selections[i].status)
|
status.push(this.crud.selections[i].status)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.isAllEqual(status) && status[0] == "OPEN") {
|
if (this.isAllEqual(status) && status[0] == 'OPEN') {
|
||||||
this.show_jh = true;
|
this.show_jh = true
|
||||||
this.show_fp = false;
|
this.show_fp = false
|
||||||
return;
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.isAllEqual(status) && status[0] == "ALLOCATE") {
|
if (this.isAllEqual(status) && status[0] == 'ALLOCATE') {
|
||||||
this.show_jh = true;
|
this.show_jh = true
|
||||||
this.show_fp = false;
|
this.show_fp = false
|
||||||
this.show_cancelfp = false;
|
this.show_cancelfp = false
|
||||||
}
|
}
|
||||||
//拣货
|
//拣货
|
||||||
if (this.crud.selections.length == 1 && this.crud.selections[0].orderQty == this.crud.selections[0].allocatedQty) {
|
if (this.crud.selections.length == 1 && this.crud.selections[0].orderQty == this.crud.selections[0].allocatedQty) {
|
||||||
this.show_jh = false;
|
this.show_jh = false
|
||||||
this.show_fp = true;
|
this.show_fp = true
|
||||||
return;
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
},
|
},
|
||||||
btnAllocate(datas) {
|
btnAllocate(datas) {
|
||||||
const ids = [];
|
const ids = []
|
||||||
for (let i = 0; i < datas.length; i++) {
|
for (let i = 0; i < datas.length; i++) {
|
||||||
ids.push(datas[i].id)
|
ids.push(datas[i].id)
|
||||||
}
|
}
|
||||||
|
|
@ -334,7 +352,7 @@ export default {
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
btnCancelAllocate(datas) {
|
btnCancelAllocate(datas) {
|
||||||
const ids = [];
|
const ids = []
|
||||||
for (let i = 0; i < datas.length; i++) {
|
for (let i = 0; i < datas.length; i++) {
|
||||||
ids.push(datas[i].id)
|
ids.push(datas[i].id)
|
||||||
}
|
}
|
||||||
|
|
@ -353,25 +371,25 @@ export default {
|
||||||
this.$refs.xdTask.queryPickDetailXd(id)
|
this.$refs.xdTask.queryPickDetailXd(id)
|
||||||
},
|
},
|
||||||
shuaxin() {
|
shuaxin() {
|
||||||
this.crud.toQuery();
|
this.crud.toQuery()
|
||||||
},
|
},
|
||||||
clickChange(lab) {
|
clickChange(lab) {
|
||||||
if (lab === "全部") {
|
if (lab === '全部') {
|
||||||
this.crud.resetQuery();
|
this.crud.resetQuery()
|
||||||
this.crud.toQuery();
|
this.crud.toQuery()
|
||||||
} else if (lab === "未拣货") {
|
} else if (lab === '未拣货') {
|
||||||
this.query.status = 'OPEN'
|
this.query.status = 'OPEN'
|
||||||
this.crud.toQuery();
|
this.crud.toQuery()
|
||||||
} else if (lab === "已拣未发") {
|
} else if (lab === '已拣未发') {
|
||||||
this.query.status = 'PICK_ALL'
|
this.query.status = 'PICK_ALL'
|
||||||
this.crud.toQuery();
|
this.crud.toQuery()
|
||||||
} else if (lab === "已发未收") {
|
} else if (lab === '已发未收') {
|
||||||
this.query.status = 'SHIP_ALL'
|
this.query.status = 'SHIP_ALL'
|
||||||
this.crud.toQuery();
|
this.crud.toQuery()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
resetQuery() {
|
resetQuery() {
|
||||||
this.radio3 = '未拣货';
|
this.radio3 = '未拣货'
|
||||||
this.crud.resetQuery()
|
this.crud.resetQuery()
|
||||||
},
|
},
|
||||||
editPick(data) {
|
editPick(data) {
|
||||||
|
|
@ -382,23 +400,23 @@ export default {
|
||||||
}, isAllEqual(array) {
|
}, isAllEqual(array) {
|
||||||
if (array.length > 0) {
|
if (array.length > 0) {
|
||||||
return !array.some(function(value, index) {
|
return !array.some(function(value, index) {
|
||||||
return value !== array[0];
|
return value !== array[0]
|
||||||
});
|
})
|
||||||
} else {
|
} else {
|
||||||
return true;
|
return true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
getChangeVule(dben) {
|
getChangeVule(dben) {
|
||||||
this.cxjlFrom.order_qty=dben.srs;
|
this.cxjlFrom.order_qty = dben.srs
|
||||||
this.cxjlFrom.item_code=dben.item_code;
|
this.cxjlFrom.item_code = dben.item_code
|
||||||
this.cxjlFrom.item_name=dben.item_name;
|
this.cxjlFrom.item_name = dben.item_name
|
||||||
this.cxjlFrom.gw_code=dben.gw_code;
|
this.cxjlFrom.gw_code = dben.gw_code
|
||||||
this.cxjlFrom.gw_name=dben.gw_name;
|
this.cxjlFrom.gw_name = dben.gw_name
|
||||||
this.cxjlFrom.bom_account_id = dben.bom_account_id
|
this.cxjlFrom.bom_account_id = dben.bom_account_id
|
||||||
this.cxjlFrom.item_id=dben.item_id;
|
this.cxjlFrom.item_id = dben.item_id
|
||||||
this.cxjlFrom.zzkw_id=dben.zzkw_id;
|
this.cxjlFrom.zzkw_id = dben.zzkw_id
|
||||||
this.cxjlFrom.rk_id=dben.rk_id;
|
this.cxjlFrom.rk_id = dben.rk_id
|
||||||
this.cxjlFrom.bonded=dben.bonded;
|
this.cxjlFrom.bonded = dben.bonded
|
||||||
},
|
},
|
||||||
|
|
||||||
btnZzjl() {
|
btnZzjl() {
|
||||||
|
|
@ -415,13 +433,13 @@ export default {
|
||||||
},
|
},
|
||||||
//日期格式化
|
//日期格式化
|
||||||
getFormatDate(data) {
|
getFormatDate(data) {
|
||||||
return formatDate(data);
|
return formatDate(data)
|
||||||
},
|
},
|
||||||
//重置表单
|
//重置表单
|
||||||
resetForm() {
|
resetForm() {
|
||||||
this.$refs['cxjlFrom'].resetFields()
|
this.$refs['cxjlFrom'].resetFields()
|
||||||
this.$data.cxjlFrom = JSON.parse(JSON.stringify(this.$options.data().cxjlFrom))
|
this.$data.cxjlFrom = JSON.parse(JSON.stringify(this.$options.data().cxjlFrom))
|
||||||
},
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
|
||||||
|
|
@ -91,7 +91,8 @@ export default {
|
||||||
{key: 'true', display_name: '成功'},
|
{key: 'true', display_name: '成功'},
|
||||||
{key: 'false', display_name: '失败'}
|
{key: 'false', display_name: '失败'}
|
||||||
],
|
],
|
||||||
tsakSelectData: []
|
tsakSelectData: [],
|
||||||
|
dialogTableHight: 0
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
|
|
||||||
|
|
@ -16,55 +16,48 @@
|
||||||
v-for="item in items"
|
v-for="item in items"
|
||||||
:key="item.id"
|
:key="item.id"
|
||||||
:label="item.code"
|
:label="item.code"
|
||||||
:value="item"
|
:value="returnType === 'object' ? item : item[returnValueKey]"
|
||||||
>
|
>
|
||||||
|
|
||||||
<span>{{ item.code }}</span>
|
<span>{{ item.code }}</span>
|
||||||
<span>{{ item.name }}</span>
|
<span>{{ item.name }}</span>
|
||||||
</el-option>
|
</el-option>
|
||||||
|
|
||||||
</el-select>
|
</el-select>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import curdArea from '@/api/area'
|
import curdArea from '@/api/area'
|
||||||
|
import CRUD from '@crud/crud'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'AreaSelect',
|
name: 'AreaSelect',
|
||||||
props: {
|
props: {
|
||||||
// 选中值,支持 v-model
|
|
||||||
value: {
|
value: {
|
||||||
type: [String, Number, Boolean, Array],
|
type: [String, Number, Boolean, Array, Object],
|
||||||
default: ''
|
default: ''
|
||||||
},
|
},
|
||||||
width: {
|
width: {
|
||||||
type: String,
|
type: String,
|
||||||
default: '200px'
|
default: '200px'
|
||||||
},
|
},
|
||||||
// 占位文本
|
|
||||||
placeholder: {
|
placeholder: {
|
||||||
type: String,
|
type: String,
|
||||||
default: '请选择'
|
default: '请选择'
|
||||||
},
|
},
|
||||||
// 是否禁用
|
|
||||||
disabled: {
|
disabled: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false
|
default: false
|
||||||
},
|
},
|
||||||
// 是否可清空
|
|
||||||
clearable: {
|
clearable: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false
|
default: true
|
||||||
},
|
},
|
||||||
// 是否支持多选
|
|
||||||
multiple: {
|
multiple: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false
|
default: false
|
||||||
},
|
},
|
||||||
// 是否可搜索
|
|
||||||
filterable: {
|
filterable: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false
|
default: true
|
||||||
},
|
},
|
||||||
valueKey: {
|
valueKey: {
|
||||||
type: String,
|
type: String,
|
||||||
|
|
@ -78,6 +71,19 @@ export default {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: true
|
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() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
|
@ -86,7 +92,6 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
// 处理 v-model 双向绑定
|
|
||||||
selectedValue: {
|
selectedValue: {
|
||||||
get() {
|
get() {
|
||||||
return this.value
|
return this.value
|
||||||
|
|
@ -96,12 +101,19 @@ export default {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// 组件挂载时加载数据
|
watch: {
|
||||||
|
// 监听returnType变化,重新初始化选中值
|
||||||
|
returnType: {
|
||||||
|
handler() {
|
||||||
|
this.handleReturnTypeChange()
|
||||||
|
},
|
||||||
|
immediate: true
|
||||||
|
}
|
||||||
|
},
|
||||||
created() {
|
created() {
|
||||||
this.initData()
|
this.initData()
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
// 获取数据
|
|
||||||
async initData() {
|
async initData() {
|
||||||
this.loading = true
|
this.loading = true
|
||||||
try {
|
try {
|
||||||
|
|
@ -115,17 +127,52 @@ export default {
|
||||||
this.loading = false
|
this.loading = false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// 选中值变化时触发
|
|
||||||
handleChange(val) {
|
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() {
|
handleClear() {
|
||||||
this.$emit('clear')
|
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>
|
</script>
|
||||||
<style scoped>
|
|
||||||
/* 可根据需要添加组件样式 */
|
|
||||||
</style>
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue