Browse Source

更新

master
常熟吴彦祖 3 weeks ago
parent
commit
6a4f900fbd
  1. 3
      src/api/order/poOrder.js
  2. 54
      src/views/modules/order/com_poOrder_CustomerPicker.vue
  3. 31
      src/views/modules/order/poOrder.vue
  4. 8
      src/views/modules/order/poOrderStatusOptions.js
  5. 3
      src/views/modules/order/poOrder_search.vue

3
src/api/order/poOrder.js

@ -22,6 +22,9 @@ export const closePoDetail = (data) => createAPI(`/pODetail/closePoDetail`, 'pos
/** 打开 PO 订单行(已关闭 → 按验货数量恢复状态) */ /** 打开 PO 订单行(已关闭 → 按验货数量恢复状态) */
export const openPoDetail = (data) => createAPI(`/pODetail/openPoDetail`, 'post', data) export const openPoDetail = (data) => createAPI(`/pODetail/openPoDetail`, 'post', data)
/** 下达 PO 订单行(草稿 → 已下达) */
export const issuePoDetail = (data) => createAPI(`/pODetail/issuePoDetail`, 'post', data)
// 根据PO订单查询验货申请明细 // 根据PO订单查询验货申请明细
export const getInspectionByPODetail = (data) => createAPI(`/pODetail/getInspectionByPODetail`, 'post', data) export const getInspectionByPODetail = (data) => createAPI(`/pODetail/getInspectionByPODetail`, 'post', data)

54
src/views/modules/order/com_poOrder_CustomerPicker.vue

@ -20,26 +20,6 @@
<span style="color: #f56c6c">当前账号无 Customer 权限</span> <span style="color: #f56c6c">当前账号无 Customer 权限</span>
</el-form-item> </el-form-item>
</el-form> </el-form>
<el-dialog
title="选择 Customer"
:visible.sync="forceDialogVisible"
width="420px"
:close-on-click-modal="false"
:show-close="false"
append-to-body>
<p style="margin-bottom: 12px">请先选择本次会话要操作的 Customer</p>
<el-select v-model="dialogCustomer" filterable placeholder="请选择" style="width: 100%">
<el-option
v-for="item in options"
:key="item.code"
:label="formatLabel(item)"
:value="item.code" />
</el-select>
<span slot="footer">
<el-button type="primary" :disabled="!dialogCustomer" @click="confirmDialog">确定</el-button>
</span>
</el-dialog>
</div> </div>
</template> </template>
@ -56,14 +36,18 @@ export default {
data () { data () {
return { return {
options: [], options: [],
innerCustomer: this.value,
forceDialogVisible: false,
dialogCustomer: ''
innerCustomer: this.value
} }
}, },
watch: { watch: {
value (val) { value (val) {
this.innerCustomer = val this.innerCustomer = val
if (!val) {
this.ensureDefaultCustomer()
}
},
site () {
this.loadOptions()
} }
}, },
mounted () { mounted () {
@ -79,12 +63,7 @@ export default {
return getPoCustomerScope({ site: this.site }).then(({ data }) => { return getPoCustomerScope({ site: this.site }).then(({ data }) => {
if (data && data.code === 0) { if (data && data.code === 0) {
this.options = data.data || [] this.options = data.data || []
if (this.options.length === 1) {
this.selectCustomer(this.options[0].code)
} else if (this.options.length > 1 && !this.innerCustomer) {
this.forceDialogVisible = true
this.dialogCustomer = ''
}
this.ensureDefaultCustomer()
} else { } else {
this.options = [] this.options = []
this.$message.error((data && data.msg) || '加载 Customer 权限失败') this.$message.error((data && data.msg) || '加载 Customer 权限失败')
@ -94,6 +73,18 @@ export default {
this.$message.error('加载 Customer 权限失败') this.$message.error('加载 Customer 权限失败')
}) })
}, },
ensureDefaultCustomer () {
if (!Array.isArray(this.options) || this.options.length === 0) {
return
}
if (this.innerCustomer) {
const exists = this.options.some(item => item && item.code === this.innerCustomer)
if (exists) {
return
}
}
this.selectCustomer(this.options[0].code)
},
selectCustomer (code) { selectCustomer (code) {
const option = this.options.find(item => item.code === code) || null const option = this.options.find(item => item.code === code) || null
this.innerCustomer = code this.innerCustomer = code
@ -104,11 +95,6 @@ export default {
const option = this.options.find(item => item.code === code) || null const option = this.options.find(item => item.code === code) || null
this.$emit('input', code) this.$emit('input', code)
this.$emit('change', code, option) this.$emit('change', code, option)
},
confirmDialog () {
if (!this.dialogCustomer) return
this.forceDialogVisible = false
this.selectCustomer(this.dialogCustomer)
} }
} }
} }

31
src/views/modules/order/poOrder.vue

@ -69,6 +69,10 @@
align="center" align="center"
width="70"> width="70">
<template slot-scope="scope"> <template slot-scope="scope">
<el-link
v-if="canIssuePoOrder(scope.row.status)"
type="primary"
@click.stop="handleIssuePoOrder(scope.row)">下达</el-link>
<el-link <el-link
v-if="canClosePoOrder(scope.row.status)" v-if="canClosePoOrder(scope.row.status)"
type="primary" type="primary"
@ -372,6 +376,7 @@ import {
batchUpdatePoDetail, batchUpdatePoDetail,
closePoDetail, closePoDetail,
openPoDetail, openPoDetail,
issuePoDetail,
createPoOrder, createPoOrder,
getPoCustomerOptions, getPoCustomerOptions,
getPoBuyerOptions, getPoBuyerOptions,
@ -392,6 +397,7 @@ import {
} from './poOrderFieldSchemaHelper.js' } from './poOrderFieldSchemaHelper.js'
import { import {
PO_ORDER_STATUS_OPTIONS, PO_ORDER_STATUS_OPTIONS,
canIssuePoOrder,
canClosePoOrder, canClosePoOrder,
canOpenPoOrder, canOpenPoOrder,
canEditPoColumnByStatus, canEditPoColumnByStatus,
@ -1584,6 +1590,7 @@ export default {
window.removeEventListener('resize', this.onWindowResize) window.removeEventListener('resize', this.onWindowResize)
}, },
methods: { methods: {
canIssuePoOrder,
canClosePoOrder, canClosePoOrder,
canOpenPoOrder, canOpenPoOrder,
canEditPoColumnByStatus, canEditPoColumnByStatus,
@ -1799,6 +1806,28 @@ export default {
}).catch(() => {}) }).catch(() => {})
}, },
handleIssuePoOrder (row) {
const params = buildPoDetailActionParams(row, this.$store.state.user.site)
if (!params.id && !(params.orderNo && params.site && params.itemNo != null)) {
this.$message.error('无法识别订单行,请刷新后重试')
return
}
const poLabel = row.poNo ? `PO ${row.poNo}` : '该订单'
const itemLabel = row.itemNo != null ? `${row.itemNo}` : ''
this.$confirm(`确定下达${poLabel}${itemLabel}`, '提示', { type: 'warning' }).then(() => {
issuePoDetail(params).then(({ data }) => {
if (data && data.code === 0) {
this.$message.success('下达成功')
this.getDataList()
} else {
this.$message.error((data && data.msg) || '下达失败')
}
}).catch(err => {
this.$message.error((err && err.message) || '下达失败')
})
}).catch(() => {})
},
handleOpenPoOrder (row) { handleOpenPoOrder (row) {
const params = buildPoDetailActionParams(row, this.$store.state.user.site) const params = buildPoDetailActionParams(row, this.$store.state.user.site)
if (!params.id && !(params.orderNo && params.site && params.itemNo != null)) { if (!params.id && !(params.orderNo && params.site && params.itemNo != null)) {
@ -2709,7 +2738,7 @@ export default {
shipVia: '', shipVia: '',
orderDate: '', orderDate: '',
enquiry: '', enquiry: '',
status: '已下达',
status: '草稿',
confirmed: '', confirmed: '',
wantReceiveDate: '', wantReceiveDate: '',
narrival: '', narrival: '',

8
src/views/modules/order/poOrderStatusOptions.js

@ -2,6 +2,7 @@
* PO 订单行状态选项静态数据查询下拉用不查库 * PO 订单行状态选项静态数据查询下拉用不查库
*/ */
export const PO_ORDER_STATUS_OPTIONS = [ export const PO_ORDER_STATUS_OPTIONS = [
{ label: '草稿', value: '草稿' },
{ label: '已下达', value: '已下达' }, { label: '已下达', value: '已下达' },
{ label: '待验货', value: '待验货' }, { label: '待验货', value: '待验货' },
{ label: '验货中', value: '验货中' }, { label: '验货中', value: '验货中' },
@ -30,7 +31,7 @@ export function canEditPoColumnByStatus (status, columnProp) {
/** 是否可「关闭」 */ /** 是否可「关闭」 */
export function canClosePoOrder (status) { export function canClosePoOrder (status) {
return !!status && status !== '已关闭' && status !== '已取消'
return !!status && status !== '草稿' && status !== '已关闭' && status !== '已取消'
} }
/** 是否可「打开」(仅已关闭) */ /** 是否可「打开」(仅已关闭) */
@ -38,6 +39,11 @@ export function canOpenPoOrder (status) {
return status === '已关闭' return status === '已关闭'
} }
/** 是否可「下达」(仅草稿) */
export function canIssuePoOrder (status) {
return status === '草稿'
}
/** /**
* 打开时根据验货数量推算恢复状态与后端 PoDetailStatusSupport 规则一致 * 打开时根据验货数量推算恢复状态与后端 PoDetailStatusSupport 规则一致
*/ */

3
src/views/modules/order/poOrder_search.vue

@ -695,9 +695,10 @@ export default {
/** 外部重置:仅清空顶部基础条件,不清 advancedQueryData */ /** 外部重置:仅清空顶部基础条件,不清 advancedQueryData */
resetSearch() { resetSearch() {
const currentCustomer = this.searchData.customer
this.searchData = { this.searchData = {
site: this.$store.state.user.site, site: this.$store.state.user.site,
customer: '',
customer: currentCustomer,
buyer: '', buyer: '',
poNo: '', poNo: '',
orderType: '', orderType: '',

Loading…
Cancel
Save