<template>
|
<PageWrapper dense contentFullHeight contentClass="flex">
|
<WareHouseTree class="w-1/4 xl:w-1/5" @select="handleSelect" @delete="handleDelete" />
|
<WareHouseForm v-if="WareHouse" class="w-3/4 xl:w-4/5 m-4" @success="handleSuccess" :data="Wdata"></WareHouseForm>
|
<RegionForm v-if="Region" class="w-3/4 xl:w-4/5 m-4" @success="handleSuccess" :data="Rdata"></RegionForm>
|
<ShelfForm v-if="Shelf" class="w-3/4 xl:w-4/5 m-4" @success="handleSuccess" :data="Sdata" :whcode="wh_code"></ShelfForm>
|
</PageWrapper>
|
</template>
|
<script lang="ts">
|
import { defineComponent, reactive, ref } from 'vue';
|
|
import { BasicTable, useTable, TableAction } from '/@/components/Table';
|
import { PageWrapper } from '/@/components/Page';
|
import WareHouseTree from './WareHouseTree.vue';
|
import WareHouseForm from './WareHouseForm.vue';
|
import RegionForm from './RegionForm.vue';
|
import ShelfForm from './ShelfForm.vue';
|
import { useModal } from '/@/components/Modal';
|
import { useGo } from '/@/hooks/web/usePage';
|
import { getAccParams, DeleteUser } from '/@/api/tigerapi/account';
|
|
import { getWHList } from '/@/api/tigerapi/wms/house';
|
import { useI18n } from '/@/hooks/web/useI18n';
|
const { t } = useI18n();
|
//import { WhListItem, RegionListItem, ShelfListItem } from '@/api/model/warehoueseModel';
|
|
export default defineComponent({
|
name: 'AccountManagement',
|
components: { BasicTable, PageWrapper, WareHouseTree, TableAction, WareHouseForm, RegionForm, ShelfForm },
|
setup() {
|
//var wareHouse=reactive<WhListItem>({})
|
const go = useGo();
|
const [registerModal, { openModal }] = useModal();
|
const searchInfo = reactive<Recordable>({});
|
const [registerTable, { reload, updateTableDataRecord }] = useTable({
|
title: t('账号列表'),
|
api: getAccParams,
|
rowKey: 'ID',
|
formConfig: {
|
labelWidth: 120,
|
autoSubmitOnEnter: true,
|
},
|
useSearchForm: true,
|
showTableSetting: true,
|
bordered: true,
|
canResize:true,
|
handleSearchInfoFn(info) {
|
console.log('handleSearchInfoFn', info);
|
return info;
|
},
|
actionColumn: {
|
width: 120,
|
title: t('操作'),
|
dataIndex: 'action',
|
slots: { customRender: 'action' },
|
},
|
});
|
|
function handleCreate() {
|
openModal(true, {
|
isUpdate: false,
|
});
|
}
|
var Wdata=ref();
|
var Rdata=ref();
|
var Sdata=ref();
|
var wh_code=ref();
|
async function handleEdit(params: string) {
|
var Code = params;
|
var data = await getWHList(params)
|
if (params.slice(0, 1) == 'W') {
|
Wdata.value = data
|
wh_code.value=data[0].WH_CODE
|
WareHouse.value=false;
|
}
|
if (params.slice(0, 1) == 'R') {
|
Rdata.value = data
|
Region.value=false;
|
}
|
if (params.slice(0, 1) == 'S') {
|
Sdata.value = data
|
Shelf.value=false;
|
}
|
}
|
|
function handleDelete(record: Recordable) {
|
WareHouse.value=false
|
Region.value=false
|
Shelf.value=false
|
}
|
|
function handleSuccess({ isUpdate, values }) {
|
if (isUpdate) {
|
// 演示不刷新表格直接更新内部数据。
|
// 注意:updateTableDataRecord要求表格的rowKey属性为string并且存在于每一行的record的keys中
|
const result = updateTableDataRecord(values.ID, values);
|
/*console.log(result);*/
|
} else {
|
reload();
|
}
|
}
|
|
var WareHouse = ref(false);
|
var Region = ref(false);
|
var Shelf = ref(false);
|
async function handleSelect(WareHouseCode) {
|
// WareHouse.value=false;
|
// Region.value=false;
|
// Shelf.value=false;
|
await handleEdit(WareHouseCode)
|
WareHouse.value = WareHouseCode.slice(0, 1) == 'W' ? true : false;
|
Region.value = WareHouseCode.slice(0, 1) == 'R' ? true : false;
|
Shelf.value = WareHouseCode.slice(0, 1) == 'S' ? true : false;
|
|
//WareHouse.value=WareHouseCode==''?false:true;
|
//searchInfo.deptCode = WareHouseCode;
|
console.log(WareHouseCode, 15);
|
reload();
|
}
|
|
function handleView(record: Recordable) {
|
//console.log(1,record);
|
go('/account_detail/' + record.USER_ID);
|
}
|
|
return {
|
registerTable,
|
registerModal,
|
handleCreate,
|
handleEdit,
|
handleDelete,
|
handleSuccess,
|
handleSelect,
|
handleView,
|
searchInfo,
|
WareHouse,
|
Region,
|
Shelf,
|
Wdata,
|
Rdata,
|
Sdata,
|
wh_code,
|
t
|
};
|
},
|
});
|
</script>
|
<style>
|
.addHouse {
|
position: relative;
|
left: 10px;
|
top: 20px;
|
height: 0px;
|
}
|
</style>
|