Commit b5e9caca by wuqian

Merge branch 'dev' of 47.122.114.111:qinjianhui/factory_front into wq

parents 15e919c3 e1a021c3
...@@ -51,6 +51,7 @@ declare module 'vue' { ...@@ -51,6 +51,7 @@ declare module 'vue' {
ElTag: typeof import('element-plus/es')['ElTag'] ElTag: typeof import('element-plus/es')['ElTag']
ElTooltip: typeof import('element-plus/es')['ElTooltip'] ElTooltip: typeof import('element-plus/es')['ElTooltip']
ElTree: typeof import('element-plus/es')['ElTree'] ElTree: typeof import('element-plus/es')['ElTree']
ElUpload: typeof import('element-plus/es')['ElUpload']
Icon: typeof import('./src/components/Icon.vue')['default'] Icon: typeof import('./src/components/Icon.vue')['default']
ImageView: typeof import('./src/components/ImageView.vue')['default'] ImageView: typeof import('./src/components/ImageView.vue')['default']
LogList: typeof import('./src/components/LogList.vue')['default'] LogList: typeof import('./src/components/LogList.vue')['default']
......
...@@ -193,6 +193,12 @@ export function deleteAddressByIds(params: { ids: string }) { ...@@ -193,6 +193,12 @@ export function deleteAddressByIds(params: { ids: string }) {
}, },
) )
} }
//获取国家名称及代码
export function getAllCountryApi() {
return axios.get<never, BaseRespData<never>>(
'/logisticsAddress/getAllCountry',
)
}
/** /**
* @description 物流报价 * @description 物流报价
......
...@@ -16,6 +16,7 @@ export interface LogisticsData { ...@@ -16,6 +16,7 @@ export interface LogisticsData {
status: boolean status: boolean
logisticsWayCode: string // 物流编码 logisticsWayCode: string // 物流编码
partition: string // 所在分区 partition: string // 所在分区
logisticsWayId?: number | null
} }
export function getOrderTabData() { export function getOrderTabData() {
return axios.get<never, BaseRespData<Tab[]>>( return axios.get<never, BaseRespData<Tab[]>>(
...@@ -270,3 +271,29 @@ export function cancelLogisticsOrderApi(orderIds: (string | number)[]) { ...@@ -270,3 +271,29 @@ export function cancelLogisticsOrderApi(orderIds: (string | number)[]) {
orderIds, orderIds,
) )
} }
// 更改物流
export function changeLogisticsApi(params: {
updateByIdParam: {
id: string | number
dataVersion: number
}
logisticsTrialCalculation: LogisticsData
}) {
return axios.post<never, BaseRespData<never>>(
'factory/podJomallOrderUs/changeLogistics',
params,
)
}
// 创建物流
export function createLogisticsOrderApi(params: {
updateByIdParam: {
id: string | number
dataVersion: number
}
logisticsTrialCalculation: LogisticsData
}) {
return axios.post<never, BaseRespData<never>>(
'factory/podJomallOrderUs/createLogisticsOrder',
params,
)
}
@import './common.scss'; @use './common.scss';
@import './element.scss'; @use './element.scss';
\ No newline at end of file \ No newline at end of file
...@@ -57,6 +57,8 @@ export interface PodUsOrderListData { ...@@ -57,6 +57,8 @@ export interface PodUsOrderListData {
version?: number version?: number
productList?: ProductList[] productList?: ProductList[]
orderNumber?: string orderNumber?: string
logisticsWayId?: number | null
logisticsWayName?: string
} }
export interface ProductList { export interface ProductList {
id: number id: number
......
...@@ -292,12 +292,12 @@ getLogisticsList() ...@@ -292,12 +292,12 @@ getLogisticsList()
<span>{{ item.description }}</span> <span>{{ item.description }}</span>
</div> </div>
</LogDialog> </LogDialog>
<el-dialog v-model="createData.show" :close-on-click-modal="false" width="700px" :title="createData.title"> <el-dialog v-model="createData.show" :close-on-click-modal="false" width="900px" :title="createData.title">
<el-form v-if="createData.show" ref="formRef" label-width="110px" :rules="rules" :model="form"> <el-form v-if="createData.show" ref="formRef" style="padding: 30px" label-width="110px" :rules="rules" :model="form" class="el-row">
<el-form-item label="物流公司编码" prop="code"> <el-form-item class="el-col-12" label="物流公司编码" prop="code">
<el-select v-model="form.code" clearable filterable @change="codeChange"> <el-select v-model="form.code" clearable filterable @change="codeChange">
<el-option <el-option
v-for="it in logisticsList" :key="it.code" :label="it.basicsName" v-for="it in logisticsList" :key="it.code" :label="it.code"
:value="it.code"> :value="it.code">
{{ it.code }} {{ it.code }}
<span style="font-size: 14px; color: #999; line-height: 24px"> <span style="font-size: 14px; color: #999; line-height: 24px">
...@@ -306,22 +306,22 @@ getLogisticsList() ...@@ -306,22 +306,22 @@ getLogisticsList()
</el-option> </el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="名称" prop="name"> <el-form-item class="el-col-12" label="名称" prop="name">
<el-input v-model="form.name" clearable placeholder="请输入名称"></el-input> <el-input v-model="form.name" clearable placeholder="请输入名称"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="联系人" prop="contact"> <el-form-item class="el-col-12" label="联系人" prop="contact">
<el-input v-model="form.contact" clearable placeholder="请输入联系人"></el-input> <el-input v-model="form.contact" clearable placeholder="请输入联系人"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="电话/手机" prop="phone"> <el-form-item class="el-col-12" label="电话/手机" prop="phone">
<el-input v-model="form.phone" clearable placeholder="请输入电话/手机"></el-input> <el-input v-model="form.phone" clearable placeholder="请输入电话/手机"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="网址" prop="siteUrl"> <el-form-item class="el-col-12" label="网址" prop="siteUrl">
<el-input v-model="form.siteUrl" clearable placeholder="请输入网址"></el-input> <el-input v-model="form.siteUrl" clearable placeholder="请输入网址"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="地址" prop="address"> <el-form-item class="el-col-12" label="地址" prop="address">
<el-input v-model="form.address" clearable placeholder="请输入地址"></el-input> <el-input v-model="form.address" clearable placeholder="请输入地址"></el-input>
</el-form-item> </el-form-item>
<el-form-item v-for="o in otherFields" :key="o" required :label="o" :prop="`apiData.${o}`"> <el-form-item v-for="o in otherFields" :key="o" class="el-col-12" required :label="o" :prop="`apiData.${o}`">
<el-input v-model="form.apiData[o]" clearable :placeholder="`请输入${o}`"></el-input> <el-input v-model="form.apiData[o]" clearable :placeholder="`请输入${o}`"></el-input>
</el-form-item> </el-form-item>
</el-form> </el-form>
......
...@@ -43,36 +43,11 @@ ...@@ -43,36 +43,11 @@
</el-tag> </el-tag>
</div> </div>
<p <p
:title=" style="white-space: pre"
[ :title="getJosn(item)"
item.countryName,
// item.countryCode,
item.stateProvince,
// item.stateProvinceAbbr,
item.district,
// item.districtCode,
item.city,
// item.cityCode,
]
.filter((el) => el != null && el !== '')
.join(' ')
"
class="address" class="address"
> >
{{ {{ getJosn(item) }}
[
item.countryName,
// item.countryCode,
item.stateProvince,
// item.stateProvinceAbbr,
item.district,
// item.districtCode,
item.city,
// item.cityCode,
]
.filter((el) => el != null && el !== '')
.join(' ')
}}
</p> </p>
<p <p
:title=" :title="
...@@ -187,6 +162,7 @@ import { ...@@ -187,6 +162,7 @@ import {
updateAddress, updateAddress,
getLogisticsLog, getLogisticsLog,
deleteAddressByIds, deleteAddressByIds,
getAllCountryApi,
} from '@/api/logistics' } from '@/api/logistics'
import { IFormConfig } from '@/components/CustomizeForm.tsx' import { IFormConfig } from '@/components/CustomizeForm.tsx'
...@@ -196,7 +172,7 @@ import CustomizeForm from '@/components/CustomizeForm.tsx' ...@@ -196,7 +172,7 @@ import CustomizeForm from '@/components/CustomizeForm.tsx'
import { Edit, Delete, List } from '@element-plus/icons-vue' import { Edit, Delete, List } from '@element-plus/icons-vue'
import { debounce } from 'lodash-es' import { debounce } from 'lodash-es'
import { ShippingAddressObj } from './types/shippingAddress.ts' import { ShippingAddressObj, ICountryObj } from './types/shippingAddress.ts'
import usePageList from '@/utils/hooks/usePageList' import usePageList from '@/utils/hooks/usePageList'
import { useValue } from './hooks/useValue' import { useValue } from './hooks/useValue'
import { showConfirm } from '@/utils/ui' import { showConfirm } from '@/utils/ui'
...@@ -205,6 +181,7 @@ const [editForm, resetEditForm] = useValue<ShippingAddressObj>({ ...@@ -205,6 +181,7 @@ const [editForm, resetEditForm] = useValue<ShippingAddressObj>({
swDefault: false, swDefault: false,
}) })
const { const {
loading,
currentPage, currentPage,
pageSize, pageSize,
total, total,
...@@ -225,8 +202,9 @@ const { ...@@ -225,8 +202,9 @@ const {
const dialogVisible = ref(false) const dialogVisible = ref(false)
const logDialogVisible = ref(false) const logDialogVisible = ref(false)
const editFormRef = ref<InstanceType<typeof CustomizeForm> | null>(null) const editFormRef = ref<InstanceType<typeof CustomizeForm> | null>(null)
const countryList = ref([])
const formConfig = ref<IFormConfig[]>([ const formConfig = computed<IFormConfig[]>(() => [
{ {
prop: 'shipperName', prop: 'shipperName',
type: 'input', type: 'input',
...@@ -265,88 +243,103 @@ const formConfig = ref<IFormConfig[]>([ ...@@ -265,88 +243,103 @@ const formConfig = ref<IFormConfig[]>([
}, },
}, },
{ {
prop: 'city', prop: 'countryCode',
type: 'input', type: 'select',
label: '城市', label: '国家代码',
attrs: { attrs: {
// options: [], options: countryList.value,
placeholder: '请输入城市', label: 'countryCode',
value: 'countryCode',
filterable: true,
placeholder: '请选择国家代码',
onChange: (val: ICountryObj) => {
editForm.value.countryName = val.nameCn
}, },
rules: [{ required: true, message: '请输入城市' }], },
rules: [{ required: true, message: '请选择国家代码' }],
}, },
{ {
prop: 'cityCode', prop: 'countryName',
type: 'input', type: 'select',
label: '城市编码', label: '国家名称',
attrs: { attrs: {
// options: [], options: countryList.value,
placeholder: '请输入城市编码', label: 'nameCn',
value: 'nameCn',
filterable: true,
placeholder: '请选择国家名称',
onChange: (val: ICountryObj) => {
editForm.value.countryCode = val.countryCode
},
}, },
rules: [{ required: true, message: '请选择国家名称' }],
}, },
{ {
prop: 'district', prop: 'stateProvince',
type: 'input', type: 'input',
label: '', label: '州/省',
attrs: { attrs: {
// options: [], // options: [],
placeholder: '请选择区', placeholder: '请输入州/省',
}, },
}, },
{ {
prop: 'districtCode', prop: 'stateProvinceAbbr',
type: 'input', type: 'input',
label: '区编码', label: '州/省简称',
attrs: { attrs: {
// options: [], // options: [],
placeholder: '请选择区', placeholder: '请输入州/省简称',
}, },
}, },
{ {
prop: 'postalCode', prop: 'cityCode',
type: 'input', type: 'input',
label: '邮编', label: '城市编码',
attrs: { attrs: {
placeholder: '请输入邮编', // options: [],
placeholder: '请输入城市编码',
}, },
}, },
{ {
prop: 'stateProvince', prop: 'city',
type: 'input', type: 'input',
label: '州/省', label: '城市',
attrs: { attrs: {
// options: [], // options: [],
placeholder: '请输入州/省', placeholder: '请输入城市',
}, },
rules: [{ required: true, message: '请输入城市' }],
}, },
{ {
prop: 'stateProvinceAbbr', prop: 'districtCode',
type: 'input', type: 'input',
label: '州/省简称', label: '区编码',
attrs: { attrs: {
// options: [], // options: [],
placeholder: '请输入州/省简称', placeholder: '请选择区',
}, },
}, },
{ {
prop: 'countryName', prop: 'district',
type: 'input', type: 'input',
label: '国家名称', label: '',
attrs: { attrs: {
// options: [], // options: [],
placeholder: '请输入国家名称', placeholder: '请选择区',
}, },
rules: [{ required: true, message: '请输入国家名称' }],
}, },
{ {
prop: 'countryCode', prop: 'postalCode',
type: 'input', type: 'input',
label: '国家代码', label: '邮编',
attrs: { attrs: {
// options: [], placeholder: '请输入邮编',
placeholder: '请输入国家代码',
}, },
rules: [{ required: true, message: '请输入邮编' }],
}, },
{ {
prop: 'phoneNumber', prop: 'phoneNumber',
...@@ -364,7 +357,36 @@ const formConfig = ref<IFormConfig[]>([ ...@@ -364,7 +357,36 @@ const formConfig = ref<IFormConfig[]>([
}, },
]) ])
const loading = ref(false) async function getCountryList() {
try {
const { data } = await getAllCountryApi()
countryList.value = data
console.log(372, countryList.value)
} catch (error) {
console.log(error)
}
}
function getJosn(item: ShippingAddressObj) {
return [
[item.countryName, item.countryCode],
[item.stateProvince, item.stateProvinceAbbr],
[item.district, item.districtCode],
[item.city, item.cityCode],
]
.map(([value, code]) => {
if (value && code) return `${value} (${code})`
if (value) return value
if (code) return code // 当 value 不存在但 code 存在时,不使用括号
return null
})
.filter(Boolean)
.join(` `) // 使用三个空格作为分隔符增大间距
}
onMounted(() => {
getCountryList()
})
/** /**
* @description: 取消按钮 * @description: 取消按钮
......
...@@ -22,3 +22,13 @@ export interface ShippingAddressObj { ...@@ -22,3 +22,13 @@ export interface ShippingAddressObj {
updateTime?: string updateTime?: string
checked?: boolean checked?: boolean
} }
export interface ICountryObj {
aeCountryCode: string
continentCode: string
countryCode: string
id: number
nameCn: string
nameEn: string
needProviceAbbr: number
}
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
@opened="handleOpened" @opened="handleOpened"
@close="onClose" @close="onClose"
> >
<template #title> <template #header>
<div class="title"> <div class="title">
<span>POD打单</span> <span>POD打单</span>
<span v-if="socketConnect === 'online'" class="online">[在线]</span> <span v-if="socketConnect === 'online'" class="online">[在线]</span>
...@@ -300,7 +300,6 @@ const boxChange = ref<boolean>(false) ...@@ -300,7 +300,6 @@ const boxChange = ref<boolean>(false)
const boxIndex = ref<number | null>(null) const boxIndex = ref<number | null>(null)
const orderStore = useOrderStore() const orderStore = useOrderStore()
const isLock = ref<boolean>(false) const isLock = ref<boolean>(false)
const renderLock = ref<boolean>(false)
const productionOrderRef = ref() const productionOrderRef = ref()
const socketConnect = computed(() => orderStore.socketConnect) const socketConnect = computed(() => orderStore.socketConnect)
const podBoxList = computed(() => orderStore.podBoxList) const podBoxList = computed(() => orderStore.podBoxList)
...@@ -372,6 +371,9 @@ watch( ...@@ -372,6 +371,9 @@ watch(
{ deep: true }, { deep: true },
) )
const podBoxIndex = computed(() => orderStore.podBoxIndex) const podBoxIndex = computed(() => orderStore.podBoxIndex)
let renderLock = false
const renderItemBox = (bool: boolean) => { const renderItemBox = (bool: boolean) => {
if ( if (
!podBoxList.value || !podBoxList.value ||
...@@ -380,13 +382,13 @@ const renderItemBox = (bool: boolean) => { ...@@ -380,13 +382,13 @@ const renderItemBox = (bool: boolean) => {
(bool && boxIndex.value !== podBoxIndex.value) (bool && boxIndex.value !== podBoxIndex.value)
) )
return return
if (renderLock.value) return if (renderLock) return
renderLock.value = true renderLock = true
let boxItem = podBoxList.value.find((item) => item.box === boxIndex.value) let boxItem = podBoxList.value.find((item) => item.box === boxIndex.value)
if (!boxItem) boxItem = { data: { productList: [] } } if (!boxItem) boxItem = { data: { productList: [] } }
const { data } = boxItem const { data } = boxItem
if (!data) { if (!data) {
renderLock.value = false renderLock = false
currentCode = '' currentCode = ''
podOrderDetailsData.value = {} podOrderDetailsData.value = {}
return return
...@@ -416,9 +418,12 @@ const renderItemBox = (bool: boolean) => { ...@@ -416,9 +418,12 @@ const renderItemBox = (bool: boolean) => {
} }
podOrderDetailsData.value = data podOrderDetailsData.value = data
if (productList.every((item) => item.power)) { if (productList.every((item) => item.power)) {
print(data) print(data, false, () => {
renderLock = false
})
} else {
renderLock = false
} }
renderLock.value = false
} }
const messageChange = (data: WebSocketMessage) => { const messageChange = (data: WebSocketMessage) => {
if (!data) return if (!data) return
...@@ -443,7 +448,7 @@ const setPodBoxList = (data: WebSocketMessage) => { ...@@ -443,7 +448,7 @@ const setPodBoxList = (data: WebSocketMessage) => {
const obj = data.txt const obj = data.txt
if (obj && typeof obj === 'string') { if (obj && typeof obj === 'string') {
const parsedData = JSON.parse(obj) const parsedData = JSON.parse(obj)
useOrderStore().setPodBoxList(parsedData) orderStore.setPodBoxList(parsedData)
} }
} }
const initPrintDevice = () => { const initPrintDevice = () => {
...@@ -511,6 +516,8 @@ const userStore = useUserStore() ...@@ -511,6 +516,8 @@ const userStore = useUserStore()
const getPackingData = async (code: string) => { const getPackingData = async (code: string) => {
const loading = ElLoading.service({ const loading = ElLoading.service({
fullscreen: true, fullscreen: true,
text: '加载中...',
background: 'rgba(0, 0, 0, 0.3)',
}) })
currentCode = code currentCode = code
try { try {
...@@ -587,6 +594,8 @@ const initOrderDetailBox = async () => { ...@@ -587,6 +594,8 @@ const initOrderDetailBox = async () => {
} }
const loading = ElLoading.service({ const loading = ElLoading.service({
fullscreen: true, fullscreen: true,
text: '加载中...',
background: 'rgba(0, 0, 0, 0.3)',
}) })
try { try {
const res = await getPodBoxListApi(factoryNo, warehouseId.value) const res = await getPodBoxListApi(factoryNo, warehouseId.value)
...@@ -657,7 +666,7 @@ const initOrderDetailBox = async () => { ...@@ -657,7 +666,7 @@ const initOrderDetailBox = async () => {
}) })
} }
renderLock.value = false renderLock = false
productionOrder.value = '' productionOrder.value = ''
isLock.value = false isLock.value = false
productionOrderRef.value.focus() productionOrderRef.value.focus()
...@@ -792,12 +801,16 @@ const handlePrinterChange = (value: string) => { ...@@ -792,12 +801,16 @@ const handlePrinterChange = (value: string) => {
emit('set-printer', value) emit('set-printer', value)
} }
const print = (data: OrderData, forcePrint = false) => { const print = (data: OrderData, forcePrint = false, callback?: () => void) => {
const _boxIndex = boxIndex.value const _boxIndex = boxIndex.value
if (!forcePrint && data.printResult) return if (!forcePrint && data.printResult) {
callback && callback()
return
}
props.printOrder(data, (status: boolean) => { props.printOrder(data, (status: boolean) => {
callback && callback()
const item = podBoxList.value?.find((item) => item.box === _boxIndex) const item = podBoxList.value?.find((item) => item.box === _boxIndex)
if (item && item.data) { if (item && item.data) {
if (status) { if (status) {
......
...@@ -178,6 +178,9 @@ ...@@ -178,6 +178,9 @@
</el-button> </el-button>
<template #dropdown> <template #dropdown>
<ElDropdownMenu> <ElDropdownMenu>
<ElDropdownItem @click="getOrderByIdApi('createLogisticsOrder')"
>创建物流订单</ElDropdownItem
>
<ElDropdownItem @click="getOrderByIdApi('getTrackingNumber')" <ElDropdownItem @click="getOrderByIdApi('getTrackingNumber')"
>获取跟踪号</ElDropdownItem >获取跟踪号</ElDropdownItem
> >
...@@ -187,6 +190,9 @@ ...@@ -187,6 +190,9 @@
<ElDropdownItem @click="getOrderByIdApi('cancelLogisticsOrder')" <ElDropdownItem @click="getOrderByIdApi('cancelLogisticsOrder')"
>取消物流订单</ElDropdownItem >取消物流订单</ElDropdownItem
> >
<ElDropdownItem @click="getOrderByIdApi('batchChangeLogistics')"
>更换物流</ElDropdownItem
>
</ElDropdownMenu> </ElDropdownMenu>
</template> </template>
</ElDropdown> </ElDropdown>
...@@ -894,6 +900,70 @@ ...@@ -894,6 +900,70 @@
:list="resultInfo" :list="resultInfo"
@confirm="resultConfim" @confirm="resultConfim"
></ResultInfo> ></ResultInfo>
<el-dialog
v-model="isChangeWay"
:close-on-click-modal="false"
:title="wayDialogTitle"
>
<el-table
v-loading="isChangeWayLoading"
ref="changeWayRef"
height="400px"
class="production-client-table"
:data="logisticsWayData"
border
highlight-current-row
@row-click="(v:LogisticsData) =>rowClick(v, wayDialogTitle)"
>
<el-table-column
label="序号"
width="60"
align="center"
type="index"
></el-table-column>
<el-table-column
label="物流名称"
align="center"
prop="logisticsWayName"
></el-table-column>
<el-table-column
label="发货仓库"
align="center"
prop="warehouseName"
></el-table-column>
<el-table-column
label="物流编码"
align="center"
prop="logisticsWayCode"
></el-table-column>
<el-table-column
label="所在分区"
align="center"
prop="partition"
></el-table-column>
<el-table-column label="状态" align="center">
<template #default="{ row }">
<b v-if="row.status" style="color: green">成功</b>
<b v-else-if="!row.status" style="color: red">失败</b>
</template>
</el-table-column>
<el-table-column label="预计运费($)" align="center" prop="payFreight">
</el-table-column>
</el-table>
<template #footer>
<el-button :disabled="isChangeWayLoading" @click="cancelWayDialog">
取消
</el-button>
<el-button
:loading="isChangeWayLoading"
type="primary"
@click="changeWaySubmit(wayDialogTitle)"
>
确定
</el-button>
</template>
</el-dialog>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { getUserMarkList } from '@/api/common' import { getUserMarkList } from '@/api/common'
...@@ -924,7 +994,11 @@ import { ...@@ -924,7 +994,11 @@ import {
getTrackingNumberApi, getTrackingNumberApi,
getfaceSimplexFileApi, getfaceSimplexFileApi,
cancelLogisticsOrderApi, cancelLogisticsOrderApi,
changeLogisticsApi,
createLogisticsOrderApi,
} from '@/api/podUsOrder' } from '@/api/podUsOrder'
import { BaseRespData } from '@/types/api'
import TableView from '@/components/TableView.vue' import TableView from '@/components/TableView.vue'
import { import {
LogListData, LogListData,
...@@ -950,6 +1024,7 @@ import useLodop, { LODOPObject } from '@/utils/hooks/useLodop' ...@@ -950,6 +1024,7 @@ import useLodop, { LODOPObject } from '@/utils/hooks/useLodop'
import dayjs from 'dayjs' import dayjs from 'dayjs'
import rightMenu from '../pod/rightMenu.vue' import rightMenu from '../pod/rightMenu.vue'
import ResultInfo from './components/ResultInfo.vue' import ResultInfo from './components/ResultInfo.vue'
import { isArray, isString } from '@/utils/validate'
declare global { declare global {
interface Window { interface Window {
ActiveXObject: { ActiveXObject: {
...@@ -967,7 +1042,9 @@ declare global { ...@@ -967,7 +1042,9 @@ declare global {
const tabsNav = ref<Tab[]>() const tabsNav = ref<Tab[]>()
const resultRefs = ref<InstanceType<typeof ResultInfo> | null>(null) const resultRefs = ref<InstanceType<typeof ResultInfo> | null>(null)
const confirmDialogShow = ref(false) const confirmDialogShow = ref(false)
const isChangeWay = ref(false)
const confirmData = ref([]) const confirmData = ref([])
const logisticsWayData = ref([])
const confirmSelectionData = ref<LogisticsData[]>([]) const confirmSelectionData = ref<LogisticsData[]>([])
const confirmRowData = ref<ProductList | null>(null) const confirmRowData = ref<ProductList | null>(null)
const status = ref('TO_BE_CONFIRMED') const status = ref('TO_BE_CONFIRMED')
...@@ -1257,6 +1334,11 @@ const handleUpdateRemark = async (item: ProductList) => { ...@@ -1257,6 +1334,11 @@ const handleUpdateRemark = async (item: ProductList) => {
inputPattern: /^.{1,2000}$/, inputPattern: /^.{1,2000}$/,
inputErrorMessage: '请输入备注', inputErrorMessage: '请输入备注',
}).then(async ({ value }) => { }).then(async ({ value }) => {
const loading = ElLoading.service({
fullscreen: true,
text: '操作中...',
background: 'rgba(0, 0, 0, 0.3)',
})
try { try {
const res = await updateRemarkApi(item.id, value) const res = await updateRemarkApi(item.id, value)
if (res.code !== 200) return if (res.code !== 200) return
...@@ -1264,6 +1346,8 @@ const handleUpdateRemark = async (item: ProductList) => { ...@@ -1264,6 +1346,8 @@ const handleUpdateRemark = async (item: ProductList) => {
search() search()
} catch (e) { } catch (e) {
console.error(e) console.error(e)
} finally {
loading.close()
} }
}) })
} }
...@@ -1288,6 +1372,11 @@ const loadProductionClient = async () => { ...@@ -1288,6 +1372,11 @@ const loadProductionClient = async () => {
} }
const submitConfirm = async () => { const submitConfirm = async () => {
const ids = selection.value.map((item) => item.id) const ids = selection.value.map((item) => item.id)
const loading = ElLoading.service({
fullscreen: true,
text: '操作中...',
background: 'rgba(0, 0, 0, 0.3)',
})
try { try {
const res = await confirmOrderApi( const res = await confirmOrderApi(
ids, ids,
...@@ -1301,6 +1390,8 @@ const submitConfirm = async () => { ...@@ -1301,6 +1390,8 @@ const submitConfirm = async () => {
loadTabData() loadTabData()
} catch (e) { } catch (e) {
console.error(e) console.error(e)
} finally {
loading.close()
} }
} }
const updateOrder = async () => { const updateOrder = async () => {
...@@ -1317,6 +1408,11 @@ const updateOrder = async () => { ...@@ -1317,6 +1408,11 @@ const updateOrder = async () => {
return return
} }
const ids = selection.value.map((item) => item.id) const ids = selection.value.map((item) => item.id)
const loading = ElLoading.service({
fullscreen: true,
text: '操作中...',
background: 'rgba(0, 0, 0, 0.3)',
})
try { try {
const res = await updateExceptionOrderApi(ids) const res = await updateExceptionOrderApi(ids)
if (res.code !== 200) return if (res.code !== 200) return
...@@ -1325,6 +1421,8 @@ const updateOrder = async () => { ...@@ -1325,6 +1421,8 @@ const updateOrder = async () => {
loadTabData() loadTabData()
} catch (e) { } catch (e) {
console.error(e) console.error(e)
} finally {
loading.close()
} }
} }
const printProductionOrder = async () => { const printProductionOrder = async () => {
...@@ -1332,6 +1430,11 @@ const printProductionOrder = async () => { ...@@ -1332,6 +1430,11 @@ const printProductionOrder = async () => {
return ElMessage.warning('请选择数据') return ElMessage.warning('请选择数据')
} }
const orderIds = selection.value.map((item) => item.id) const orderIds = selection.value.map((item) => item.id)
const loading = ElLoading.service({
fullscreen: true,
text: '操作中...',
background: 'rgba(0, 0, 0, 0.3)',
})
try { try {
const res = await printProductionOrderApi(orderIds) const res = await printProductionOrderApi(orderIds)
if (res.code !== 200) return if (res.code !== 200) return
...@@ -1339,6 +1442,8 @@ const printProductionOrder = async () => { ...@@ -1339,6 +1442,8 @@ const printProductionOrder = async () => {
window.open(filePath + res.message) window.open(filePath + res.message)
} catch (e) { } catch (e) {
console.error(e) console.error(e)
} finally {
loading.close()
} }
} }
const printPickingOrder = async () => { const printPickingOrder = async () => {
...@@ -1346,6 +1451,11 @@ const printPickingOrder = async () => { ...@@ -1346,6 +1451,11 @@ const printPickingOrder = async () => {
return ElMessage.warning('请选择数据') return ElMessage.warning('请选择数据')
} }
const orderIds = selection.value.map((item) => item.id) const orderIds = selection.value.map((item) => item.id)
const loading = ElLoading.service({
fullscreen: true,
text: '操作中...',
background: 'rgba(0, 0, 0, 0.3)',
})
try { try {
const res = await printPrintOrderApi(orderIds) const res = await printPrintOrderApi(orderIds)
if (res.code !== 200) return if (res.code !== 200) return
...@@ -1353,6 +1463,8 @@ const printPickingOrder = async () => { ...@@ -1353,6 +1463,8 @@ const printPickingOrder = async () => {
window.open(filePath + res.message) window.open(filePath + res.message)
} catch (e) { } catch (e) {
console.error(e) console.error(e)
} finally {
loading.close()
} }
} }
const pickingComplete = async () => { const pickingComplete = async () => {
...@@ -1369,6 +1481,11 @@ const pickingComplete = async () => { ...@@ -1369,6 +1481,11 @@ const pickingComplete = async () => {
return return
} }
const orderIds = selection.value.map((item) => item.id) const orderIds = selection.value.map((item) => item.id)
const loading = ElLoading.service({
fullscreen: true,
text: '操作中...',
background: 'rgba(0, 0, 0, 0.3)',
})
try { try {
const res = await printPickingOrderApi(orderIds) const res = await printPickingOrderApi(orderIds)
if (res.code !== 200) return if (res.code !== 200) return
...@@ -1377,6 +1494,8 @@ const pickingComplete = async () => { ...@@ -1377,6 +1494,8 @@ const pickingComplete = async () => {
loadTabData() loadTabData()
} catch (e) { } catch (e) {
console.error(e) console.error(e)
} finally {
loading.close()
} }
} }
...@@ -1391,6 +1510,11 @@ const changeExceptionOrder = async () => { ...@@ -1391,6 +1510,11 @@ const changeExceptionOrder = async () => {
inputPattern: /^.{1,2000}$/, inputPattern: /^.{1,2000}$/,
inputErrorMessage: '请输入异常原因', inputErrorMessage: '请输入异常原因',
}).then(async ({ value }) => { }).then(async ({ value }) => {
const loading = ElLoading.service({
fullscreen: true,
text: '操作中...',
background: 'rgba(0, 0, 0, 0.3)',
})
try { try {
const res = await changeExceptionOrderApi(orderIds, value) const res = await changeExceptionOrderApi(orderIds, value)
if (res.code !== 200) return if (res.code !== 200) return
...@@ -1399,6 +1523,8 @@ const changeExceptionOrder = async () => { ...@@ -1399,6 +1523,8 @@ const changeExceptionOrder = async () => {
loadTabData() loadTabData()
} catch (e) { } catch (e) {
console.error(e) console.error(e)
} finally {
loading.close()
} }
}) })
} }
...@@ -1413,6 +1539,11 @@ const cancelOrder = async () => { ...@@ -1413,6 +1539,11 @@ const cancelOrder = async () => {
inputPattern: /^.{1,2000}$/, inputPattern: /^.{1,2000}$/,
inputErrorMessage: '请输入取消原因', inputErrorMessage: '请输入取消原因',
}).then(async ({ value }) => { }).then(async ({ value }) => {
const loading = ElLoading.service({
fullscreen: true,
text: '操作中...',
background: 'rgba(0, 0, 0, 0.3)',
})
try { try {
const res = await cancelOrderApi(orderIds, value) const res = await cancelOrderApi(orderIds, value)
if (res.code !== 200) return if (res.code !== 200) return
...@@ -1421,6 +1552,8 @@ const cancelOrder = async () => { ...@@ -1421,6 +1552,8 @@ const cancelOrder = async () => {
loadTabData() loadTabData()
} catch (e) { } catch (e) {
console.error(e) console.error(e)
} finally {
loading.close()
} }
}) })
} }
...@@ -1489,6 +1622,11 @@ const downloadMaterial = async () => { ...@@ -1489,6 +1622,11 @@ const downloadMaterial = async () => {
offset: window.innerHeight / 2, offset: window.innerHeight / 2,
}) })
} }
const loading = ElLoading.service({
fullscreen: true,
text: '操作中...',
background: 'rgba(0, 0, 0, 0.3)',
})
try { try {
const res = await downloadMaterialApi(selectedIds) const res = await downloadMaterialApi(selectedIds)
if (res.code !== 200) return if (res.code !== 200) return
...@@ -1496,6 +1634,8 @@ const downloadMaterial = async () => { ...@@ -1496,6 +1634,8 @@ const downloadMaterial = async () => {
} catch (e) { } catch (e) {
// showError(e) // showError(e)
console.error(e) console.error(e)
} finally {
loading.close()
} }
} }
const logList = ref<LogListData[]>([]) const logList = ref<LogListData[]>([])
...@@ -1529,54 +1669,162 @@ const printPodOrder = async () => { ...@@ -1529,54 +1669,162 @@ const printPodOrder = async () => {
} }
/** /**
* @description: 获取跟踪号、获取打印面单、取消物流订单 * @description: 创建物流、获取跟踪号、获取打印面单、更改物流、取消物流订单
*/ */
const resultInfo = ref([])
const getOrderByIdApi = async (type: string) => { const getOrderByIdApi = async (type: string) => {
if (selection.value.length === 0) { if (selection.value.length === 0) {
return ElMessage.warning('请选择数据') return ElMessage.warning('请选择数据')
} }
let message = ''
let Fn
if (type == 'getTrackingNumber') { const operationMap: {
message = '获取跟踪号' [key: string]: {
Fn = getTrackingNumberApi message: string
} else if (type == 'getPrintOrder') { Fn: (orderIds: (string | number)[]) => Promise<BaseRespData<never>>
message = '获取打印面单' }
Fn = getfaceSimplexFileApi } = {
} else if (type === 'cancelLogisticsOrder') { getTrackingNumber: { message: '获取跟踪号', Fn: getTrackingNumberApi },
message = '取消物流订单' getPrintOrder: { message: '获取打印面单', Fn: getfaceSimplexFileApi },
Fn = cancelLogisticsOrderApi cancelLogisticsOrder: {
message: '取消物流订单',
Fn: cancelLogisticsOrderApi,
},
} }
if (['batchChangeLogistics', 'createLogisticsOrder'].includes(type)) {
if (selection.value.length !== 1) {
return ElMessage.warning('请选择单条数据')
}
wayDialogTitle.value =
type === 'batchChangeLogistics'
? `切换物流(当前物流方式:${selection.value[0]?.logisticsWayName})`
: '创建物流订单'
isChangeWay.value = true
const { data } = await getLogisticsCalculation(selection.value[0]?.id)
logisticsWayData.value = data
return
}
const operation = operationMap[type]
if (operation) {
try { try {
await showConfirm(`确定对该订单 ${message}?`, { await showConfirm(`确定对该订单 ${operation.message}?`, {
confirmButtonText: '确认', confirmButtonText: '确认',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning', type: 'warning',
}) })
const ids = selection.value.map((el) => el.id) const ids = selection.value.map((el) => el.id)
if (Fn) {
const res = await Fn(ids) const loading = ElLoading.service({
console.log(res) fullscreen: true,
text: '操作中...',
background: 'rgba(0, 0, 0, 0.3)',
})
const res = await operation.Fn(ids)
if (res.code === 200) { if (res.code === 200) {
if (isArray(res.data)) {
resultInfo.value = res.data resultInfo.value = res.data
resultRefs.value?.showDialog(type) resultRefs.value?.showDialog(type)
} else if (res.code === 205) { } else if (isString(res.data)) {
window.open(filePath + res.message) window.open(filePath + res.data)
}
} else { } else {
ElMessage.error(res.message) ElMessage.error(res.message)
} }
loading.close()
} catch (e) {
console.error(e)
} }
} catch { } else {
return ElMessage.warning('未知操作类型')
} }
} }
//展示返回结果
const resultInfo = ref([])
const resultConfim = () => { const resultConfim = () => {
search() search()
} }
/**
* @description: 更改物流方式
*/
const changeWayRow = ref<LogisticsData>({} as LogisticsData)
const isChangeWayLoading = ref(false)
const changeWayRef = ref()
const wayDialogTitle = ref('')
const rowClick = (row: LogisticsData, title: string) => {
try {
if (title == '创建物流订单') {
changeWayRow.value = row
} else {
if (row.logisticsWayId === selection.value[0]?.logisticsWayId) {
ElMessage.warning('不能选择相同的物流方式')
changeWayRow.value = {} as LogisticsData
changeWayRef.value?.setCurrentRow()
return
}
changeWayRow.value = row
}
} catch (error) {
console.log(error)
}
}
const cancelWayDialog = () => {
changeWayRow.value = {} as LogisticsData
changeWayRef.value?.setCurrentRow()
isChangeWay.value = false
}
//确认物流
const changeWaySubmit = async (title: string) => {
if (!changeWayRow.value?.logisticsWayId) {
return ElMessage.warning('请选择一条物流方式')
}
if (!changeWayRow.value.status) {
return ElMessage.warning('请选择状态为成功的物流方式')
}
let Fn
if (title !== '创建物流订单') {
if (
changeWayRow.value.logisticsWayId === selection.value[0]?.logisticsWayId
) {
return ElMessage.warning('更改的物流方式不能相同')
}
Fn = changeLogisticsApi
} else {
Fn = createLogisticsOrderApi
}
isChangeWayLoading.value = true
try {
const params = {
updateByIdParam: {
id: selection.value[0]?.id,
dataVersion: selection.value[0]?.version as number,
},
logisticsTrialCalculation: { ...changeWayRow.value },
}
await Fn(params)
isChangeWay.value = false
isChangeWayLoading.value = false
ElMessage.success('操作成功')
search()
loadTabData()
} catch (error) {
console.log(error)
} finally {
isChangeWayLoading.value = false
}
}
// 添加补货成功行的状态 // 添加补货成功行的状态
const stockOutSuccessIds = ref<number[]>([]) const stockOutSuccessIds = ref<number[]>([])
...@@ -1584,7 +1832,11 @@ const stockOutCheck = async () => { ...@@ -1584,7 +1832,11 @@ const stockOutCheck = async () => {
if (selection.value.length === 0) { if (selection.value.length === 0) {
return ElMessage.warning('请选择数据') return ElMessage.warning('请选择数据')
} }
const loading = ElLoading.service({
fullscreen: true,
text: '操作中...',
background: 'rgba(0, 0, 0, 0.3)',
})
try { try {
const selectedIds = selection.value.map((item) => item.id) const selectedIds = selection.value.map((item) => item.id)
const res = await stockOutCheckApi(selectedIds) const res = await stockOutCheckApi(selectedIds)
...@@ -1627,6 +1879,8 @@ const stockOutCheck = async () => { ...@@ -1627,6 +1879,8 @@ const stockOutCheck = async () => {
}) })
} catch (error) { } catch (error) {
console.error('补货校验失败:', error) console.error('补货校验失败:', error)
} finally {
loading.close()
} }
} }
const toBePicking = async () => { const toBePicking = async () => {
...@@ -1642,6 +1896,11 @@ const toBePicking = async () => { ...@@ -1642,6 +1896,11 @@ const toBePicking = async () => {
} catch (e) { } catch (e) {
return return
} }
const loading = ElLoading.service({
fullscreen: true,
text: '操作中...',
background: 'rgba(0, 0, 0, 0.3)',
})
try { try {
const res = await toBePickingApi(selection.value.map((item) => item.id)) const res = await toBePickingApi(selection.value.map((item) => item.id))
if (res.code !== 200) return if (res.code !== 200) return
...@@ -1650,6 +1909,8 @@ const toBePicking = async () => { ...@@ -1650,6 +1909,8 @@ const toBePicking = async () => {
loadTabData() loadTabData()
} catch (e) { } catch (e) {
console.error(e) console.error(e)
} finally {
loading.close()
} }
} }
const sheetPrinter = ref('') const sheetPrinter = ref('')
...@@ -1818,6 +2079,11 @@ const downloadPDF = (url: string) => { ...@@ -1818,6 +2079,11 @@ const downloadPDF = (url: string) => {
return strData return strData
} }
const openDetail = async (id: number) => { const openDetail = async (id: number) => {
const loading = ElLoading.service({
fullscreen: true,
text: '加载中...',
background: 'rgba(0, 0, 0, 0.3)',
})
try { try {
const res = await getOrderDetailById(id) const res = await getOrderDetailById(id)
if (res.code == 200) { if (res.code == 200) {
...@@ -1830,6 +2096,8 @@ const openDetail = async (id: number) => { ...@@ -1830,6 +2096,8 @@ const openDetail = async (id: number) => {
} }
} catch (e) { } catch (e) {
//showError(e) //showError(e)
} finally {
loading.close()
} }
} }
const onFastRefresh = () => { const onFastRefresh = () => {
...@@ -1862,6 +2130,11 @@ const refreshMaterial = async () => { ...@@ -1862,6 +2130,11 @@ const refreshMaterial = async () => {
if (selection.value.length === 0) { if (selection.value.length === 0) {
return ElMessage.warning('请选择数据') return ElMessage.warning('请选择数据')
} }
const loading = ElLoading.service({
fullscreen: true,
text: '刷新中...',
background: 'rgba(0, 0, 0, 0.3)',
})
try { try {
const res = await refreshMaterialApi( const res = await refreshMaterialApi(
selection.value.map((item) => item.id).join(','), selection.value.map((item) => item.id).join(','),
...@@ -1871,6 +2144,8 @@ const refreshMaterial = async () => { ...@@ -1871,6 +2144,8 @@ const refreshMaterial = async () => {
search() search()
} catch (e) { } catch (e) {
console.error(e) console.error(e)
} finally {
loading.close()
} }
} }
onMounted(() => { onMounted(() => {
...@@ -1998,6 +2273,16 @@ onMounted(() => { ...@@ -1998,6 +2273,16 @@ onMounted(() => {
gap: 10px; gap: 10px;
font-size: 12px; font-size: 12px;
margin-top: 10px; margin-top: 10px;
.grid-item {
display: flex;
overflow: hidden;
.grid-item-value {
flex: 1;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
}
} }
.factory-sub-order-number { .factory-sub-order-number {
...@@ -2006,12 +2291,24 @@ onMounted(() => { ...@@ -2006,12 +2291,24 @@ onMounted(() => {
.production-client-table { .production-client-table {
::v-deep(.current-row > td.el-table__cell) { ::v-deep(.current-row > td.el-table__cell) {
background-color: green; background-color: #409eff;
color: white; color: white;
& > td.el-table__cell { & > td.el-table__cell {
color: white !important; color: white !important;
background-color: green; background-color: #409eff;
}
// &:hover {
// color: #808285;
// }
}
:deep() {
.current-row {
&:hover {
td.el-table__cell {
color: #808285;
}
}
} }
} }
} }
......
...@@ -119,6 +119,14 @@ ...@@ -119,6 +119,14 @@
> >
<Edit /> <Edit />
</el-icon> </el-icon>
<el-icon
size="24"
title="重置密码"
color="#67C23A"
style="cursor: pointer; vertical-align: middle"
@click.stop="resetPwd(scope.row)"
><RefreshLeft
/></el-icon>
</template> </template>
</ElTableColumn> </ElTableColumn>
</ElTable> </ElTable>
...@@ -202,13 +210,14 @@ import { ...@@ -202,13 +210,14 @@ import {
deleteUserApi, deleteUserApi,
getDetailsByIdApi, getDetailsByIdApi,
changeUserStatusApi, changeUserStatusApi,
resetPasswordApi,
} from '@/api/auth' } from '@/api/auth'
import Icon from '@/components/Icon.vue' import Icon from '@/components/Icon.vue'
import { UserEditForm, userData, userSearchForm } from '@/types/api/user' import { UserEditForm, userData, userSearchForm } from '@/types/api/user'
import usePageList from '@/utils/hooks/usePageList' import usePageList from '@/utils/hooks/usePageList'
import { useValue } from '@/utils/hooks/useValue' import { useValue } from '@/utils/hooks/useValue'
import { showConfirm } from '@/utils/ui' import { showConfirm } from '@/utils/ui'
import { Edit } from '@element-plus/icons-vue' import { Edit, RefreshLeft } from '@element-plus/icons-vue'
import type { FormRules } from 'element-plus' import type { FormRules } from 'element-plus'
import { reactive, ref } from 'vue' import { reactive, ref } from 'vue'
const [searchForm, resetSearchForm] = useValue<userSearchForm>({}) const [searchForm, resetSearchForm] = useValue<userSearchForm>({})
...@@ -347,6 +356,27 @@ const onChangeStatus = async (value: number, item: userData) => { ...@@ -347,6 +356,27 @@ const onChangeStatus = async (value: number, item: userData) => {
//showError(e) //showError(e)
} }
} }
const resetPwd = async (row: userData) => {
try {
await showConfirm(`确认要重置用户${row.account}的密码?`, {
confirmButtonText: '确认',
cancelButtonText: '取消',
type: 'warning',
})
} catch {
return
}
try {
const res = await resetPasswordApi(row.id)
await ElMessageBox.alert('重置成功\n\r 新密码为:' + res.data.passWord, {
confirmButtonText: '确定',
type: 'warning',
})
search()
} catch (e) {
search()
}
}
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
......
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