x
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
<script setup lang="ts">
|
||||
import { ref, computed, onMounted } from 'vue'
|
||||
import { ElMessageBox } from 'element-plus'
|
||||
import { useInventory } from '../composables/useInventory'
|
||||
import { apiRequest } from '@/shared/api'
|
||||
import { addNotification, handleApiError } from '@/shared/notification'
|
||||
@@ -139,7 +140,11 @@ async function savePurchaseOrder() {
|
||||
}
|
||||
|
||||
async function deleteOrder(id: number) {
|
||||
if (!confirm('确定要删除这个采购订单吗?')) return
|
||||
try {
|
||||
await ElMessageBox.confirm('确定要删除这个采购订单吗?', '删除确认', {
|
||||
confirmButtonText: '删除', cancelButtonText: '取消', type: 'warning'
|
||||
})
|
||||
} catch { return }
|
||||
try {
|
||||
await apiRequest(`/api/purchase-orders/${id}`, { method: 'DELETE' })
|
||||
addNotification('采购订单已删除', 'success')
|
||||
@@ -205,24 +210,35 @@ async function receivePurchaseOrder() {
|
||||
}
|
||||
}
|
||||
|
||||
async function markAsPaid(orderId: number) {
|
||||
if (!confirm('确认标记为已付款?')) return
|
||||
try {
|
||||
await apiRequest(`/api/purchase-orders/${orderId}/status`, {
|
||||
method: 'PATCH',
|
||||
body: JSON.stringify({ status: 'paid' })
|
||||
})
|
||||
addNotification('已标记为已付款', 'success')
|
||||
loadPurchaseOrders()
|
||||
loadMovements()
|
||||
} catch (e) {
|
||||
handleApiError(e, '更新状态')
|
||||
async function markAsPaid(orderId: number, receiptStatus: string) {
|
||||
if (receiptStatus !== 'received') {
|
||||
try {
|
||||
await ElMessageBox.confirm(
|
||||
'该订单尚未全部收货,确定要提前付款吗?建议先完成收货后再付款。',
|
||||
'非标准流程提醒',
|
||||
{ confirmButtonText: '仍要付款', cancelButtonText: '取消', type: 'warning' }
|
||||
)
|
||||
} catch { return }
|
||||
} else {
|
||||
try {
|
||||
await ElMessageBox.confirm('确认已向供应商支付该订单款项?', '付款确认', {
|
||||
confirmButtonText: '确认付款', cancelButtonText: '取消', type: 'success'
|
||||
})
|
||||
} catch { return }
|
||||
}
|
||||
await doUpdateStatus(orderId, 'paid', '已付款')
|
||||
}
|
||||
|
||||
async function updateStatus(orderId: number, status: string) {
|
||||
const label = status === 'cancelled' ? '作废' : status
|
||||
if (!confirm(`确认${label}该订单?`)) return
|
||||
async function cancelOrder(orderId: number) {
|
||||
try {
|
||||
await ElMessageBox.confirm('确定要作废该订单吗?此操作不可撤销。', '作废确认', {
|
||||
confirmButtonText: '确认作废', cancelButtonText: '取消', type: 'error'
|
||||
})
|
||||
} catch { return }
|
||||
await doUpdateStatus(orderId, 'cancelled', '已作废')
|
||||
}
|
||||
|
||||
async function doUpdateStatus(orderId: number, status: string, label: string) {
|
||||
try {
|
||||
await apiRequest(`/api/purchase-orders/${orderId}/status`, {
|
||||
method: 'PATCH',
|
||||
@@ -343,18 +359,18 @@ onMounted(() => {
|
||||
到货入库
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="row.receipt_status === 'received' && row.payment_status !== 'paid'"
|
||||
v-if="row.payment_status !== 'paid' && row.receipt_status !== 'cancelled'"
|
||||
type="warning"
|
||||
size="small"
|
||||
@click="markAsPaid(row.id)"
|
||||
@click="markAsPaid(row.id, row.receipt_status)"
|
||||
>
|
||||
标记为已付款
|
||||
标记已付款
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="row.payment_status !== 'paid' && row.receipt_status !== 'cancelled'"
|
||||
type="info"
|
||||
size="small"
|
||||
@click="updateStatus(row.id, 'cancelled')"
|
||||
@click="cancelOrder(row.id)"
|
||||
>
|
||||
作废
|
||||
</el-button>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<script setup lang="ts">
|
||||
import { ref, computed, onMounted } from 'vue'
|
||||
import { ElMessageBox } from 'element-plus'
|
||||
import { useInventory } from '../composables/useInventory'
|
||||
import { apiRequest } from '@/shared/api'
|
||||
import { addNotification, handleApiError } from '@/shared/notification'
|
||||
@@ -155,7 +156,11 @@ async function saveSalesOrder() {
|
||||
}
|
||||
|
||||
async function deleteOrder(id: number) {
|
||||
if (!confirm('确定要删除这个销售订单吗?')) return
|
||||
try {
|
||||
await ElMessageBox.confirm('确定要删除这个销售订单吗?', '删除确认', {
|
||||
confirmButtonText: '删除', cancelButtonText: '取消', type: 'warning'
|
||||
})
|
||||
} catch { return }
|
||||
try {
|
||||
await apiRequest(`/api/sales-orders/${id}`, { method: 'DELETE' })
|
||||
addNotification('销售订单已删除', 'success')
|
||||
@@ -167,15 +172,50 @@ async function deleteOrder(id: number) {
|
||||
}
|
||||
}
|
||||
|
||||
async function updateStatus(orderId: number, status: string) {
|
||||
const label = status === 'delivered' ? '已交付' : '已收款'
|
||||
if (!confirm(`确认标记为${label}?`)) return
|
||||
async function markDelivered(orderId: number) {
|
||||
try {
|
||||
await ElMessageBox.confirm('确认该订单已交付?', '交付确认', {
|
||||
confirmButtonText: '确认交付', cancelButtonText: '取消', type: 'success'
|
||||
})
|
||||
} catch { return }
|
||||
await doUpdateStatus(orderId, 'delivered', '已交付')
|
||||
}
|
||||
|
||||
async function markPaid(orderId: number, deliveryStatus: string) {
|
||||
if (deliveryStatus !== 'delivered') {
|
||||
try {
|
||||
await ElMessageBox.confirm(
|
||||
'当前订单尚未交付,确定要提前收款吗?建议先确认交付后再收款。',
|
||||
'非标准流程提醒',
|
||||
{ confirmButtonText: '仍要收款', cancelButtonText: '取消', type: 'warning' }
|
||||
)
|
||||
} catch { return }
|
||||
} else {
|
||||
try {
|
||||
await ElMessageBox.confirm('确认已收到该订单款项?', '收款确认', {
|
||||
confirmButtonText: '确认收款', cancelButtonText: '取消', type: 'success'
|
||||
})
|
||||
} catch { return }
|
||||
}
|
||||
await doUpdateStatus(orderId, 'paid', '已收款')
|
||||
}
|
||||
|
||||
async function cancelOrder(orderId: number) {
|
||||
try {
|
||||
await ElMessageBox.confirm('确定要作废该订单吗?此操作不可撤销。', '作废确认', {
|
||||
confirmButtonText: '确认作废', cancelButtonText: '取消', type: 'error'
|
||||
})
|
||||
} catch { return }
|
||||
await doUpdateStatus(orderId, 'cancelled', '已作废')
|
||||
}
|
||||
|
||||
async function doUpdateStatus(orderId: number, status: string, label: string) {
|
||||
try {
|
||||
await apiRequest(`/api/sales-orders/${orderId}/status`, {
|
||||
method: 'PATCH',
|
||||
body: JSON.stringify({ status })
|
||||
})
|
||||
addNotification(`已标记为${label}`, 'success')
|
||||
addNotification(`订单已${label}`, 'success')
|
||||
loadProductionOrders()
|
||||
loadMovements()
|
||||
} catch (e) {
|
||||
@@ -325,33 +365,29 @@ onMounted(() => {
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="240">
|
||||
<el-table-column label="操作" width="280">
|
||||
<template #default="{ row }">
|
||||
<el-dropdown style="margin-right: 8px;" v-if="row.delivery_status !== 'cancelled' && row.payment_status !== 'paid'">
|
||||
<el-button size="small">状态 ▾</el-button>
|
||||
<template #dropdown>
|
||||
<el-dropdown-menu>
|
||||
<el-dropdown-item v-if="row.delivery_status === 'manufacturing'" @click="updateStatus(row.id, 'delivered')">已交付</el-dropdown-item>
|
||||
<el-dropdown-item v-if="row.delivery_status === 'delivered' && row.payment_status !== 'paid'" @click="updateStatus(row.id, 'paid')">已收款</el-dropdown-item>
|
||||
<el-dropdown-item v-if="row.payment_status !== 'paid'" @click="updateStatus(row.id, 'cancelled')" style="color: #f56c6c;">作废</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</template>
|
||||
</el-dropdown>
|
||||
<el-button
|
||||
type="primary"
|
||||
size="small"
|
||||
v-if="row.delivery_status === 'manufacturing'"
|
||||
type="success" size="small"
|
||||
@click="markDelivered(row.id)"
|
||||
>已交付</el-button>
|
||||
<el-button
|
||||
v-if="row.payment_status !== 'paid' && row.delivery_status !== 'cancelled'"
|
||||
type="warning" size="small"
|
||||
@click="markPaid(row.id, row.delivery_status)"
|
||||
>已收款</el-button>
|
||||
<el-button
|
||||
type="primary" size="small"
|
||||
:disabled="row.payment_status === 'paid' || row.delivery_status === 'cancelled'"
|
||||
@click="editOrder(row)"
|
||||
>
|
||||
编辑
|
||||
</el-button>
|
||||
>编辑</el-button>
|
||||
<el-button type="danger" size="small" @click="deleteOrder(row.id)">删除</el-button>
|
||||
<el-button
|
||||
type="danger"
|
||||
size="small"
|
||||
@click="deleteOrder(row.id)"
|
||||
>
|
||||
删除
|
||||
</el-button>
|
||||
v-if="row.payment_status !== 'paid' && row.delivery_status !== 'cancelled'"
|
||||
type="info" size="small"
|
||||
@click="cancelOrder(row.id)"
|
||||
>作废</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
@@ -350,16 +350,10 @@ async def update_purchase_order_status(
|
||||
raise HTTPException(status_code=400, detail="已付款的采购订单禁止修改状态")
|
||||
if order.status == "cancelled":
|
||||
raise HTTPException(status_code=400, detail="已作废的采购订单禁止修改状态")
|
||||
|
||||
if order.status == "received" and new_status not in ("paid", "cancelled"):
|
||||
raise HTTPException(status_code=400, detail="已收货的采购订单只能标记为已付款或已作废")
|
||||
|
||||
if order.status == "partial_received" and new_status not in ("received", "paid", "cancelled"):
|
||||
raise HTTPException(status_code=400, detail="部分收货的采购订单只能标记为已收货、已付款或已作废")
|
||||
|
||||
if order.status == "pending" and new_status not in ("received", "cancelled"):
|
||||
raise HTTPException(status_code=400, detail="待收货的采购订单只能标记为已收货或已作废")
|
||||
|
||||
if new_status == "cancelled" and order.status == "paid":
|
||||
raise HTTPException(status_code=400, detail="已付款的订单不能作废")
|
||||
|
||||
|
||||
@@ -534,8 +534,6 @@ async def update_sales_order_status(
|
||||
raise HTTPException(status_code=400, detail="已收款的销售订单禁止修改状态")
|
||||
if order.status == "cancelled":
|
||||
raise HTTPException(status_code=400, detail="已作废的销售订单禁止修改状态")
|
||||
if order.status == "manufacturing" and payload.status == "paid":
|
||||
raise HTTPException(status_code=400, detail="制造中的订单不能直接标记为已收款,请先标记为已交付")
|
||||
if order.status == "delivered" and payload.status not in ("paid", "cancelled"):
|
||||
raise HTTPException(status_code=400, detail="已交付的销售订单只能修改为已收款或已作废")
|
||||
if payload.status == "cancelled" and order.status == "paid":
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
import{D as e,g as t,t as n,y as r}from"./index-Dyxl3OsB.js";var i={};function a(n,i){return e(),r(`div`,null,[...i[0]||=[t(`div`,{class:`page-header`},[t(`h1`,{class:`page-title`},`设计体系`),t(`p`,{class:`page-subtitle`},`迁移中...`)],-1)]])}var o=n(i,[[`render`,a]]);export{o as default};
|
||||
@@ -0,0 +1 @@
|
||||
import{O as e,_ as t,b as n,n as r}from"./index-Dwzy8ysZ.js";var i={};function a(r,i){return e(),n(`div`,null,[...i[0]||=[t(`div`,{class:`page-header`},[t(`h1`,{class:`page-title`},`设计体系`),t(`p`,{class:`page-subtitle`},`迁移中...`)],-1)]])}var o=r(i,[[`render`,a]]);export{o as default};
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1 @@
|
||||
import{B as e,F as t,O as n,P as r,_ as i,b as a,m as o,n as s,o as c,p as l,r as u,s as d,u as f,w as p,y as m}from"./index-Dwzy8ysZ.js";var h={class:`login-container`},g={class:`login-card`},_={class:`form-group`},v={class:`form-group`},y={key:0,class:`form-error`},b=[`disabled`],x=s(p({__name:`LoginView`,setup(s){let p=f(),x=t({username:``,password:``,error:``,loading:!1}),S=async()=>{x.error=``,x.loading=!0;try{let e=await d(`/api/auth/login/json`,{method:`POST`,body:JSON.stringify({username:x.username,password:x.password})});c(e.access_token,e.user),u(`登录成功`,`success`),p.push(`/`)}catch(e){x.error=e.message||`登录失败`}finally{x.loading=!1}};return(t,s)=>(n(),a(`div`,h,[i(`div`,g,[s[4]||=i(`div`,{class:`login-header`},[i(`div`,{class:`login-logo`},`G`),i(`h1`,{class:`login-title`},`Gemold`),i(`p`,{class:`login-subtitle`},`模具制造管理系统`)],-1),i(`form`,{onSubmit:o(S,[`prevent`])},[i(`div`,_,[s[2]||=i(`label`,{class:`form-label`},`用户名`,-1),r(i(`input`,{"onUpdate:modelValue":s[0]||=e=>x.username=e,type:`text`,class:`form-input`,placeholder:`请输入用户名`,required:``},null,512),[[l,x.username]])]),i(`div`,v,[s[3]||=i(`label`,{class:`form-label`},`密码`,-1),r(i(`input`,{"onUpdate:modelValue":s[1]||=e=>x.password=e,type:`password`,class:`form-input`,placeholder:`请输入密码`,required:``},null,512),[[l,x.password]])]),x.error?(n(),a(`div`,y,e(x.error),1)):m(``,!0),i(`button`,{type:`submit`,class:`btn btn-primary w-full mt-4`,disabled:x.loading},e(x.loading?`登录中...`:`登录`),9,b)],32)])]))}}),[[`__scopeId`,`data-v-01da5b35`]]);export{x as default};
|
||||
@@ -1 +0,0 @@
|
||||
import{C as e,D as t,N as n,P as r,a as i,f as a,g as o,l as s,n as c,o as l,p as u,t as d,v as f,y as p,z as m}from"./index-Dyxl3OsB.js";var h={class:`login-container`},g={class:`login-card`},_={class:`form-group`},v={class:`form-group`},y={key:0,class:`form-error`},b=[`disabled`],x=d(e({__name:`LoginView`,setup(e){let d=s(),x=r({username:``,password:``,error:``,loading:!1}),S=async()=>{x.error=``,x.loading=!0;try{let e=await l(`/api/auth/login/json`,{method:`POST`,body:JSON.stringify({username:x.username,password:x.password})});i(e.access_token,e.user),c(`登录成功`,`success`),d.push(`/`)}catch(e){x.error=e.message||`登录失败`}finally{x.loading=!1}};return(e,r)=>(t(),p(`div`,h,[o(`div`,g,[r[4]||=o(`div`,{class:`login-header`},[o(`div`,{class:`login-logo`},`G`),o(`h1`,{class:`login-title`},`Gemold`),o(`p`,{class:`login-subtitle`},`模具制造管理系统`)],-1),o(`form`,{onSubmit:u(S,[`prevent`])},[o(`div`,_,[r[2]||=o(`label`,{class:`form-label`},`用户名`,-1),n(o(`input`,{"onUpdate:modelValue":r[0]||=e=>x.username=e,type:`text`,class:`form-input`,placeholder:`请输入用户名`,required:``},null,512),[[a,x.username]])]),o(`div`,v,[r[3]||=o(`label`,{class:`form-label`},`密码`,-1),n(o(`input`,{"onUpdate:modelValue":r[1]||=e=>x.password=e,type:`password`,class:`form-input`,placeholder:`请输入密码`,required:``},null,512),[[a,x.password]])]),x.error?(t(),p(`div`,y,m(x.error),1)):f(``,!0),o(`button`,{type:`submit`,class:`btn btn-primary w-full mt-4`,disabled:x.loading},m(x.loading?`登录中...`:`登录`),9,b)],32)])]))}}),[[`__scopeId`,`data-v-01da5b35`]]);export{x as default};
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1 +0,0 @@
|
||||
import{D as e,g as t,t as n,y as r}from"./index-Dyxl3OsB.js";var i={};function a(n,i){return e(),r(`div`,null,[...i[0]||=[t(`div`,{class:`page-header`},[t(`h1`,{class:`page-title`},`灰度发布与回滚`),t(`p`,{class:`page-subtitle`},`迁移中...`)],-1)]])}var o=n(i,[[`render`,a]]);export{o as default};
|
||||
@@ -0,0 +1 @@
|
||||
import{O as e,_ as t,b as n,n as r}from"./index-Dwzy8ysZ.js";var i={};function a(r,i){return e(),n(`div`,null,[...i[0]||=[t(`div`,{class:`page-header`},[t(`h1`,{class:`page-title`},`灰度发布与回滚`),t(`p`,{class:`page-subtitle`},`迁移中...`)],-1)]])}var o=r(i,[[`render`,a]]);export{o as default};
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+1
-1
@@ -61,7 +61,7 @@
|
||||
} catch (e) {}
|
||||
})();
|
||||
</script>
|
||||
<script type="module" crossorigin src="/static/assets/index-Dyxl3OsB.js"></script>
|
||||
<script type="module" crossorigin src="/static/assets/index-Dwzy8ysZ.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="/static/assets/index-DBUUNurD.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
Reference in New Issue
Block a user