Commit 6c6bdec2 by zhuzhequan

Merge branch 'dev' into 'master'

仓库添加地址

See merge request !12
parents 132b32d6 68964eb2
......@@ -14,6 +14,30 @@ export interface LogListData {
description: string
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 {
code: string
list: {
......@@ -78,6 +102,7 @@ export interface warehouseInfo {
id?: number | string
name: string
code: string
addressId: string
sort: string
defaulted: number
factoryId?: number
......@@ -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) {
return axios.post<never, BaseRespData<never>>(
'/factoryWarehouseLocation/update',
......
......@@ -4,9 +4,10 @@ import {
factoryWarehouseInfo,
warehouseInfo,
createWarehouseApi,
updateWarehouseApi, deleteWarehouseApi,
updateWarehouseApi, deleteWarehouseApi, logisticsAddressGetAllList, Address,
} from '@/api/warehouse.ts'
import { nextTick, ref } from 'vue'
import { add } from 'lodash-es'
const selections = ref<warehouseInfo[]>([])
const formRef = ref()
......@@ -17,6 +18,7 @@ const createData = ref({
form: {
name: '',
code: '',
addressId: '',
sort: '',
defaulted: 0,
remarks: '',
......@@ -32,6 +34,9 @@ const rules = {
defaulted: [
{ required: true, message: '请选择是否默认仓库', trigger: 'change' },
],
addressId: [
{ required: true, message: '请选择地址', trigger: 'change' },
],
}
const leftData = ref<warehouseInfo[]>([])
const pagination = ref<factoryWarehouseInfo>({
......@@ -39,6 +44,7 @@ const pagination = ref<factoryWarehouseInfo>({
currentPage: 1,
total: 0,
})
const addressList = ref<Address[]>([])
async function getData() {
const res = await getFactoryWarehouseInfo({
......@@ -96,6 +102,7 @@ const createWarehouse = () => {
createData.value.form = {
name: '',
code: '',
addressId: '',
sort: '',
defaulted: 0,
remarks: '',
......@@ -120,7 +127,23 @@ const updateWarehouse = (item: warehouseInfo) => {
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()
getAddressList()
</script>
<template>
......@@ -138,9 +161,14 @@ getData()
<el-table-column type="index" label="序号" width="60" />
<el-table-column label="仓库名称" prop="name" 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="defaulted" align="center">
<el-table-column width="90" label="默认仓库" prop="defaulted" align="center">
<template #default="{row}">
<el-switch
v-model="row.defaulted" :active-value="1" :inactive-value="0"
......@@ -176,6 +204,19 @@ getData()
<el-form-item label="仓库编码" prop="code">
<el-input v-model="createData.form.code" clearable placeholder="请输入仓库编码"></el-input>
</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-input-number v-model="createData.form.sort"></el-input-number>
</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