Commit 68964eb2 by zhuzhequan

仓库添加地址

parent 132b32d6
...@@ -14,6 +14,30 @@ export interface LogListData { ...@@ -14,6 +14,30 @@ export interface LogListData {
description: string description: string
createdTime?: string | null createdTime?: string | null
} }
export interface Address {
id: number; // 主键,自动递增
shipperName: string; // 发货人姓名
addressLine1: string; // 地址 1
addressLine2?: string | null; // 地址 2
addressLine3?: string | null; // 地址 3
city: string; // 城市
cityCode?: string | null; // 城市编码
district?: string | null; // 区
districtCode?: string | null; // 区编码
cspAccount?: string | null; // CSP账号
stateProvince?: string | null; // 州/省
stateProvinceAbbr?: string | null; // 州/省简称
postalCode?: string | null; // 邮编
countryName: string; // 国家名称
countryCode?: string | null; // 国家代码
phoneNumber?: string | null; // 电话
rfcTaxId?: string | null; // RFC税号
swDefault?: number | null; // 是否默认 1是,0不是
createTime: string; // 创建时间
updateTime: string; // 更新时间
}
export interface PrintData { export interface PrintData {
code: string code: string
list: { list: {
...@@ -78,6 +102,7 @@ export interface warehouseInfo { ...@@ -78,6 +102,7 @@ export interface warehouseInfo {
id?: number | string id?: number | string
name: string name: string
code: string code: string
addressId: string
sort: string sort: string
defaulted: number defaulted: number
factoryId?: number factoryId?: number
...@@ -229,6 +254,12 @@ export function updateWarehouseApi(data: positionInfo | UpdateDefaulted) { ...@@ -229,6 +254,12 @@ export function updateWarehouseApi(data: positionInfo | UpdateDefaulted) {
) )
} }
export function logisticsAddressGetAllList() {
return axios.get<never, BaseRespData<Address[]>>(
'/logisticsAddress/getAllList'
)
}
export function updatePositionApi(data: positionInfo) { export function updatePositionApi(data: positionInfo) {
return axios.post<never, BaseRespData<never>>( return axios.post<never, BaseRespData<never>>(
'/factoryWarehouseLocation/update', '/factoryWarehouseLocation/update',
......
...@@ -4,9 +4,10 @@ import { ...@@ -4,9 +4,10 @@ import {
factoryWarehouseInfo, factoryWarehouseInfo,
warehouseInfo, warehouseInfo,
createWarehouseApi, createWarehouseApi,
updateWarehouseApi, deleteWarehouseApi, updateWarehouseApi, deleteWarehouseApi, logisticsAddressGetAllList, Address,
} from '@/api/warehouse.ts' } from '@/api/warehouse.ts'
import { nextTick, ref } from 'vue' import { nextTick, ref } from 'vue'
import { add } from 'lodash-es'
const selections = ref<warehouseInfo[]>([]) const selections = ref<warehouseInfo[]>([])
const formRef = ref() const formRef = ref()
...@@ -17,6 +18,7 @@ const createData = ref({ ...@@ -17,6 +18,7 @@ const createData = ref({
form: { form: {
name: '', name: '',
code: '', code: '',
addressId: '',
sort: '', sort: '',
defaulted: 0, defaulted: 0,
remarks: '', remarks: '',
...@@ -32,6 +34,9 @@ const rules = { ...@@ -32,6 +34,9 @@ const rules = {
defaulted: [ defaulted: [
{ required: true, message: '请选择是否默认仓库', trigger: 'change' }, { required: true, message: '请选择是否默认仓库', trigger: 'change' },
], ],
addressId: [
{ required: true, message: '请选择地址', trigger: 'change' },
],
} }
const leftData = ref<warehouseInfo[]>([]) const leftData = ref<warehouseInfo[]>([])
const pagination = ref<factoryWarehouseInfo>({ const pagination = ref<factoryWarehouseInfo>({
...@@ -39,6 +44,7 @@ const pagination = ref<factoryWarehouseInfo>({ ...@@ -39,6 +44,7 @@ const pagination = ref<factoryWarehouseInfo>({
currentPage: 1, currentPage: 1,
total: 0, total: 0,
}) })
const addressList = ref<Address[]>([])
async function getData() { async function getData() {
const res = await getFactoryWarehouseInfo({ const res = await getFactoryWarehouseInfo({
...@@ -96,6 +102,7 @@ const createWarehouse = () => { ...@@ -96,6 +102,7 @@ const createWarehouse = () => {
createData.value.form = { createData.value.form = {
name: '', name: '',
code: '', code: '',
addressId: '',
sort: '', sort: '',
defaulted: 0, defaulted: 0,
remarks: '', remarks: '',
...@@ -120,7 +127,23 @@ const updateWarehouse = (item: warehouseInfo) => { ...@@ -120,7 +127,23 @@ const updateWarehouse = (item: warehouseInfo) => {
formRef.value?.clearValidate() formRef.value?.clearValidate()
}) })
} }
const getAddress = (id:number) => {
if(!id) return ''
const item = addressList.value.find((el) => el.id === id)
if(!item) return ''
return [item.countryName,
item.stateProvince,
item.city,
item.addressLine1,
item.addressLine2 ,
item.addressLine3 ,].filter(el => el).join(' ')
}
const getAddressList = async () => {
const data = await logisticsAddressGetAllList()
addressList.value = data.data
}
getData() getData()
getAddressList()
</script> </script>
<template> <template>
...@@ -138,9 +161,14 @@ getData() ...@@ -138,9 +161,14 @@ getData()
<el-table-column type="index" label="序号" width="60" /> <el-table-column type="index" label="序号" width="60" />
<el-table-column label="仓库名称" prop="name" align="center" /> <el-table-column label="仓库名称" prop="name" align="center" />
<el-table-column label="仓库编码" prop="code" align="center" /> <el-table-column label="仓库编码" prop="code" align="center" />
<el-table-column label="仓库序号" prop="sort" align="center" /> <el-table-column show-overflow-tooltip label="地址" prop="addressId" align="center">
<template #default="{row}">
{{getAddress(row.addressId)}}
</template>
</el-table-column>
<el-table-column width="90" label="仓库序号" prop="sort" align="center" />
<el-table-column label="备注" prop="remarks" align="center" /> <el-table-column label="备注" prop="remarks" align="center" />
<el-table-column label="默认仓库" prop="defaulted" align="center"> <el-table-column width="90" label="默认仓库" prop="defaulted" align="center">
<template #default="{row}"> <template #default="{row}">
<el-switch <el-switch
v-model="row.defaulted" :active-value="1" :inactive-value="0" v-model="row.defaulted" :active-value="1" :inactive-value="0"
...@@ -176,6 +204,19 @@ getData() ...@@ -176,6 +204,19 @@ getData()
<el-form-item label="仓库编码" prop="code"> <el-form-item label="仓库编码" prop="code">
<el-input v-model="createData.form.code" clearable placeholder="请输入仓库编码"></el-input> <el-input v-model="createData.form.code" clearable placeholder="请输入仓库编码"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="地址" prop="addressId">
<el-select v-model="createData.form.addressId" clearable filterable>
<el-option
v-for="it in addressList" :key="it.id" :value="it.id" :label="[
it.countryName,
it.stateProvince,
it.city,
it.addressLine1,
it.addressLine2 ,
it.addressLine3 ,
].filter(el=>el).join(' ')"></el-option>
</el-select>
</el-form-item>
<el-form-item label="仓库序号" prop="sort"> <el-form-item label="仓库序号" prop="sort">
<el-input-number v-model="createData.form.sort"></el-input-number> <el-input-number v-model="createData.form.sort"></el-input-number>
</el-form-item> </el-form-item>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment