|
|
@@ -154,7 +154,17 @@
|
|
|
</el-col>
|
|
|
<el-col :span="12">
|
|
|
<el-form-item label="供应商库位">
|
|
|
- <el-input v-model="form.purContact" placeholder="库位编码" />
|
|
|
+ <el-select
|
|
|
+ v-model="form.purContact"
|
|
|
+ filterable
|
|
|
+ clearable
|
|
|
+ allow-create
|
|
|
+ default-first-option
|
|
|
+ placeholder="请选择供应商库位"
|
|
|
+ style="width: 100%"
|
|
|
+ >
|
|
|
+ <el-option v-for="opt in locationOptions" :key="opt.value" :label="opt.label" :value="opt.value" />
|
|
|
+ </el-select>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="12">
|
|
|
@@ -204,30 +214,43 @@
|
|
|
<el-switch v-model="form.taxIn" />
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
- <el-col :span="12">
|
|
|
- <el-form-item label="对账周期1开始">
|
|
|
- <el-input-number v-model="form.apStartDay1" :min="0" :max="999" controls-position="right" style="width: 100%" />
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- <el-col :span="12">
|
|
|
- <el-form-item label="对账周期1结束">
|
|
|
- <el-input-number v-model="form.apEndDay1" :min="0" :max="999" controls-position="right" style="width: 100%" />
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- <el-col :span="12">
|
|
|
- <el-form-item label="对账周期2开始">
|
|
|
- <el-input-number v-model="form.apStartDay2" :min="0" :max="999" controls-position="right" style="width: 100%" />
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- <el-col :span="12">
|
|
|
- <el-form-item label="对账周期2结束">
|
|
|
- <el-input-number v-model="form.apEndDay2" :min="0" :max="999" controls-position="right" style="width: 100%" />
|
|
|
+ <el-col :span="24">
|
|
|
+ <el-form-item label="对账周期">
|
|
|
+ <el-radio-group v-model="apCyclePreset" @change="onApCyclePresetChange">
|
|
|
+ <el-radio-button value="none">未启用</el-radio-button>
|
|
|
+ <el-radio-button value="fullMonth">整月对账</el-radio-button>
|
|
|
+ <el-radio-button value="firstHalf">上半月</el-radio-button>
|
|
|
+ <el-radio-button value="secondHalf">下半月</el-radio-button>
|
|
|
+ <el-radio-button value="dualHalf">上下半月双周期</el-radio-button>
|
|
|
+ <el-radio-button value="crossMonth">跨月(26-下月25)</el-radio-button>
|
|
|
+ <el-radio-button value="custom">自定义</el-radio-button>
|
|
|
+ </el-radio-group>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
+ <template v-if="apCyclePreset === 'custom'">
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="对账周期1开始">
|
|
|
+ <el-input-number v-model="form.apStartDay1" :min="0" :max="999" controls-position="right" style="width: 100%" />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="对账周期1结束">
|
|
|
+ <el-input-number v-model="form.apEndDay1" :min="0" :max="999" controls-position="right" style="width: 100%" />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="对账周期2开始">
|
|
|
+ <el-input-number v-model="form.apStartDay2" :min="0" :max="999" controls-position="right" style="width: 100%" />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="对账周期2结束">
|
|
|
+ <el-input-number v-model="form.apEndDay2" :min="0" :max="999" controls-position="right" style="width: 100%" />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </template>
|
|
|
<el-col :span="24">
|
|
|
- <div class="ap-hint">
|
|
|
- 对账周期为整数编码:0 表示空;低位为日(01–31,31 展示为「最后」);大于 200 表示「下月」,否则为「每月」。示例:每月 5 日 → 5;下月 10 日 → 210。
|
|
|
- </div>
|
|
|
+ <div class="ap-hint">{{ apCyclePresetHint }}</div>
|
|
|
</el-col>
|
|
|
<el-col :span="24">
|
|
|
<el-form-item label="备注">
|
|
|
@@ -258,6 +281,30 @@ import {
|
|
|
type S0SuppMasterRow,
|
|
|
type S0SuppMasterUpsert,
|
|
|
} from '../api/s0SupplyApi';
|
|
|
+import { s0LocationsApi, type S0LocationOptionRow } from '../api/s0WarehouseApi';
|
|
|
+
|
|
|
+type ApCyclePresetKey = 'none' | 'fullMonth' | 'firstHalf' | 'secondHalf' | 'dualHalf' | 'crossMonth' | 'custom';
|
|
|
+
|
|
|
+const AP_CYCLE_PRESETS: Record<Exclude<ApCyclePresetKey, 'custom'>, { s1: number; e1: number; s2: number; e2: number; label: string }> = {
|
|
|
+ none: { s1: 0, e1: 0, s2: 0, e2: 0, label: '未启用' },
|
|
|
+ fullMonth: { s1: 101, e1: 131, s2: 0, e2: 0, label: '整月对账(每月 01 - 月最后日)' },
|
|
|
+ firstHalf: { s1: 101, e1: 115, s2: 0, e2: 0, label: '上半月对账(每月 01 - 15 日)' },
|
|
|
+ secondHalf: { s1: 116, e1: 131, s2: 0, e2: 0, label: '下半月对账(每月 16 日 - 月最后日)' },
|
|
|
+ dualHalf: { s1: 101, e1: 115, s2: 116, e2: 131, label: '上下半月双周期(每月 01-15、16 日-月最后日)' },
|
|
|
+ crossMonth: { s1: 126, e1: 225, s2: 0, e2: 0, label: '跨月对账(每月 26 日 - 下月 25 日)' },
|
|
|
+};
|
|
|
+
|
|
|
+function normalizeApDay(value: number | null | undefined): number {
|
|
|
+ return value == null ? 0 : value;
|
|
|
+}
|
|
|
+
|
|
|
+function identifyApPreset(s1: number | null | undefined, e1: number | null | undefined, s2: number | null | undefined, e2: number | null | undefined): ApCyclePresetKey {
|
|
|
+ const t = [normalizeApDay(s1), normalizeApDay(e1), normalizeApDay(s2), normalizeApDay(e2)];
|
|
|
+ for (const [key, p] of Object.entries(AP_CYCLE_PRESETS)) {
|
|
|
+ if (t[0] === p.s1 && t[1] === p.e1 && t[2] === p.s2 && t[3] === p.e2) return key as ApCyclePresetKey;
|
|
|
+ }
|
|
|
+ return 'custom';
|
|
|
+}
|
|
|
|
|
|
const route = useRoute();
|
|
|
const pageTitle = computed(() => (route.meta?.title as string) || '供应商维护');
|
|
|
@@ -290,6 +337,39 @@ const factoryOptions = ref<OrgOption[]>([]);
|
|
|
const currencyOptions = ref<OptionItem[]>([]);
|
|
|
const crTermsOptions = ref<OptionItem[]>([]);
|
|
|
const taxClassOptions = ref<OptionItem[]>([]);
|
|
|
+const locationOptions = ref<S0LocationOptionRow[]>([]);
|
|
|
+const apCyclePreset = ref<ApCyclePresetKey>('none');
|
|
|
+
|
|
|
+const apCyclePresetHint = computed(() => {
|
|
|
+ if (apCyclePreset.value === 'custom') {
|
|
|
+ return '自定义编码:0 表示空;低位为日(01–31,31 展示为「最后」);大于 200 表示「下月」,否则为「每月」。示例:每月 5 日 → 5;下月 10 日 → 210。';
|
|
|
+ }
|
|
|
+ return AP_CYCLE_PRESETS[apCyclePreset.value]?.label ?? '';
|
|
|
+});
|
|
|
+
|
|
|
+function onApCyclePresetChange(value: string | number | boolean | undefined) {
|
|
|
+ const key = value as ApCyclePresetKey;
|
|
|
+ if (key === 'custom') return;
|
|
|
+ const p = AP_CYCLE_PRESETS[key];
|
|
|
+ if (!p) return;
|
|
|
+ form.apStartDay1 = p.s1;
|
|
|
+ form.apEndDay1 = p.e1;
|
|
|
+ form.apStartDay2 = p.s2;
|
|
|
+ form.apEndDay2 = p.e2;
|
|
|
+}
|
|
|
+
|
|
|
+async function loadLocationOptions(domainCode?: string) {
|
|
|
+ try {
|
|
|
+ const list = await s0LocationsApi.options({
|
|
|
+ domainCode: domainCode || undefined,
|
|
|
+ isActive: true,
|
|
|
+ limit: 500,
|
|
|
+ });
|
|
|
+ locationOptions.value = Array.isArray(list) ? list : [];
|
|
|
+ } catch {
|
|
|
+ locationOptions.value = [];
|
|
|
+ }
|
|
|
+}
|
|
|
|
|
|
const form = reactive<S0SuppMasterUpsert>({
|
|
|
companyRefId: undefined,
|
|
|
@@ -337,6 +417,7 @@ const formFactoryOptions = computed(() => {
|
|
|
function syncDomainCodeFromFactory() {
|
|
|
const f = factoryOptions.value.find((item) => item.id === form.factoryRefId);
|
|
|
form.domainCode = f?.code ?? '';
|
|
|
+ void loadLocationOptions(form.domainCode);
|
|
|
}
|
|
|
|
|
|
watch(
|
|
|
@@ -447,8 +528,10 @@ function resetForm() {
|
|
|
|
|
|
function openCreate() {
|
|
|
resetForm();
|
|
|
+ apCyclePreset.value = 'none';
|
|
|
dialogTitle.value = '新增供应商';
|
|
|
dialogVisible.value = true;
|
|
|
+ void loadLocationOptions(form.domainCode);
|
|
|
}
|
|
|
|
|
|
function openEdit(row: S0SuppMasterRow) {
|
|
|
@@ -481,7 +564,9 @@ function openEdit(row: S0SuppMasterRow) {
|
|
|
createUser: row.createUser ?? '',
|
|
|
updateUser: row.updateUser ?? '',
|
|
|
});
|
|
|
+ apCyclePreset.value = identifyApPreset(row.apStartDay1, row.apEndDay1, row.apStartDay2, row.apEndDay2);
|
|
|
dialogVisible.value = true;
|
|
|
+ void loadLocationOptions(form.domainCode);
|
|
|
}
|
|
|
|
|
|
async function submitForm() {
|