no message

main
HUOJIN\92525 2025-04-18 17:20:51 +08:00
parent 3c7f2eb212
commit 8840675dc5
16 changed files with 237 additions and 161 deletions

View File

@ -41,6 +41,8 @@
"vue3-json-viewer": "2.2.2"
},
"devDependencies": {
"@types/lodash": "^4.17.16",
"@types/pinyin": "^2.10.2",
"@vitejs/plugin-vue": "5.1.4",
"@vitejs/plugin-vue-jsx": "4.0.1",
"@vue/eslint-config-prettier": "^10.0.0",
@ -1588,6 +1590,12 @@
"integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==",
"dev": true
},
"node_modules/@types/lodash": {
"version": "4.17.16",
"resolved": "https://registry.npmmirror.com/@types/lodash/-/lodash-4.17.16.tgz",
"integrity": "sha512-HX7Em5NYQAXKW+1T+FiuG27NGwzJfCX3s1GjOa7ujxZa52kjJLOr4FUxT+giF6Tgxv1e+/czV/iTtBw27WTU9g==",
"dev": true
},
"node_modules/@types/minimist": {
"version": "1.2.5",
"resolved": "https://registry.npmmirror.com/@types/minimist/-/minimist-1.2.5.tgz",
@ -1615,6 +1623,12 @@
"resolved": "https://registry.npmmirror.com/@types/parse-json/-/parse-json-4.0.2.tgz",
"integrity": "sha512-dISoDXWWQwUquiKsyZ4Ng+HX2KsPL7LyHKHQwgGFEA3IaKac4Obd+h2a/a6waisAoepJlBcx9paWqjA8/HVjCw=="
},
"node_modules/@types/pinyin": {
"version": "2.10.2",
"resolved": "https://registry.npmmirror.com/@types/pinyin/-/pinyin-2.10.2.tgz",
"integrity": "sha512-jLzlRkaLRLg+lgYPjOuP3HX2cozUkhXls5GTXopsKuKJ9lDGlIAb88OoIztH6TbNUsoJnl/7e/kjaumA5IKKJg==",
"dev": true
},
"node_modules/@typescript-eslint/eslint-plugin": {
"version": "8.29.1",
"resolved": "https://registry.npmmirror.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.29.1.tgz",

View File

@ -49,6 +49,8 @@
"vue3-json-viewer": "2.2.2"
},
"devDependencies": {
"@types/lodash": "^4.17.16",
"@types/pinyin": "^2.10.2",
"@vitejs/plugin-vue": "5.1.4",
"@vitejs/plugin-vue-jsx": "4.0.1",
"@vue/eslint-config-prettier": "^10.0.0",

View File

@ -6,27 +6,27 @@
* @Copyright
*/
import {postRequest, getRequest,getDownload} from '/@/lib/axios';
import {AddressAddOrUpdateForm, AddressQueryForm,} from "/@/api/business/wms/base/address/address";
export const addressApi = {
/**
* @author hj
*/
queryPage: (param:object) => {
queryPage: (param:AddressQueryForm) => {
return postRequest('/address/queryPage', param);
},
/**
* @author hj
*/
add: (param:object) => {
add: (param:AddressAddOrUpdateForm) => {
return postRequest('/address/add', param);
},
/**
* @author hj
*/
update: (param:object) => {
update: (param:AddressAddOrUpdateForm) => {
return postRequest('/address/update', param);
},

View File

@ -0,0 +1,39 @@
/**
* -TS
*/
//查询类型定义
export interface AddressQueryForm {
addressId?: number;
pageNum: number;
pageSize: number;
}
//表格数据类型定义
export interface AddressTableDate {
addressId: number;
name: string;
person: string;
telephone: string;
address: string;
createTime: Date;
}
//新增或修改表单类型定义
export interface AddressAddOrUpdateForm {
addressId?: number;
name?: string;
person?: string;
telephone?: string;
address?: string;
}
//下拉查询
interface AddressSelect {
addressId: number;
name: string;
}

View File

@ -14,19 +14,19 @@
:maskClosable="false"
:destroyOnClose="true"
>
<a-form ref="formRef" :model="form" :rules="rules" :label-col="{ span: 5 }" >
<a-form ref="formRef" :model="form" :rules="rules" :label-col="{ span: 5 }">
<a-form-item label="收货单位" name="name">
<a-input style="width: 100%" v-model:value="form.name" placeholder="收货单位" />
</a-form-item>
<a-form-item label="联系人" name="person">
<a-input style="width: 100%" v-model:value="form.person" placeholder="联系人" />
</a-form-item>
<a-form-item label="电话" name="telephone">
<a-input style="width: 100%" v-model:value="form.telephone" placeholder="电话" />
</a-form-item>
<a-form-item label="收货单位" name="name">
<a-input style="width: 100%" v-model:value="form.name" placeholder="收货单位"/>
</a-form-item>
<a-form-item label="联系人" name="person">
<a-input style="width: 100%" v-model:value="form.person" placeholder="联系人"/>
</a-form-item>
<a-form-item label="电话" name="telephone">
<a-input style="width: 100%" v-model:value="form.telephone" placeholder="电话"/>
</a-form-item>
<a-form-item label="地址" name="address">
<a-textarea v-model="form.address" style="width: 100%; height: 100px; outline: none" />
<a-textarea v-model="form.address" style="width: 100%; height: 100px; outline: none"/>
</a-form-item>
</a-form>
@ -39,90 +39,90 @@
</a-modal>
</template>
<script setup lang="ts">
import { reactive, ref, nextTick } from 'vue';
import _ from 'lodash';
import { message } from 'ant-design-vue';
import { SmartLoading } from '/@/components/framework/smart-loading';
import { addressApi } from '/@/api/business/wms/base/address/address-api';
import { smartSentry } from '/@/lib/smart-sentry';
import {reactive, ref, nextTick} from 'vue';
import _ from 'lodash';
import {message} from 'ant-design-vue';
import {SmartLoading} from '/@/components/framework/smart-loading';
import {addressApi} from '/@/api/business/wms/base/address/address-api';
import {smartSentry} from '/@/lib/smart-sentry';
import {AddressAddOrUpdateForm} from "/@/api/business/wms/base/address/address";
// ------------------------ ------------------------
// ------------------------ ------------------------
const emits = defineEmits(['reloadList']);
const emits = defineEmits(['reloadList']);
// ------------------------ ------------------------
//
const visibleFlag = ref(false);
// ------------------------ ------------------------
//
const visibleFlag = ref(false);
function show(rowData: object) {
Object.assign(form, formDefault);
if (rowData && !_.isEmpty(rowData)) {
Object.assign(form, rowData);
}
// 使
// if (form.status && form.status.length > 0) {
// form.status = form.status.map((e) => e.valueCode);
// }
visibleFlag.value = true;
nextTick(() => {
formRef.value.clearValidate();
});
function show(rowData: AddressAddOrUpdateForm) {
Object.assign(form, formDefault);
if (rowData && !_.isEmpty(rowData)) {
Object.assign(form, rowData);
}
function onClose() {
Object.assign(form, formDefault);
visibleFlag.value = false;
}
// ------------------------ ------------------------
// ref
const formRef = ref();
const formDefault = {
addressId: undefined, //id
name: undefined, ///
person: undefined, //
telephone: undefined, //
address: undefined, //
};
let form = reactive({ ...formDefault });
const rules = {
addressId: [{ required: true, message: '收货地址id 必填' }],
};
//
async function onSubmit() {
try {
await formRef.value.validateFields();
await save();
} catch (err) {
message.error('参数验证错误,请仔细填写表单数据!');
}
}
// API
async function save() {
SmartLoading.show();
try {
if (form.addressId) {
await addressApi.update(form);
} else {
await addressApi.add(form);
}
message.success('操作成功');
emits('reloadList');
onClose();
} catch (err) {
smartSentry.captureError(err);
} finally {
SmartLoading.hide();
}
}
defineExpose({
show,
// 使
// if (form.status && form.status.length > 0) {
// form.status = form.status.map((e) => e.valueCode);
// }
visibleFlag.value = true;
nextTick(() => {
formRef.value.clearValidate();
});
}
function onClose() {
Object.assign(form, formDefault);
visibleFlag.value = false;
}
// ------------------------ ------------------------
// ref
const formRef = ref();
const formDefault: AddressAddOrUpdateForm = {
addressId: undefined, //id
name: undefined, ///
person: undefined, //
telephone: undefined, //
address: undefined, //
};
let form = reactive({...formDefault});
const rules = {
addressId: [{required: true, message: '收货地址id 必填'}],
};
//
async function onSubmit() {
try {
await formRef.value.validateFields();
await save();
} catch (err) {
message.error('参数验证错误,请仔细填写表单数据!');
}
}
// API
async function save() {
SmartLoading.show();
try {
if (form.addressId) {
await addressApi.update(form);
} else {
await addressApi.add(form);
}
message.success('操作成功');
emits('reloadList');
onClose();
} catch (err) {
smartSentry.captureError(err);
} finally {
SmartLoading.hide();
}
}
defineExpose({
show,
});
</script>

View File

@ -97,8 +97,6 @@
<template v-if="column.dataIndex === 'action'">
<div class="smart-table-operate">
<a-space>
<a-button @click="showForm(record)" type="primary" ghost style="width:60px;height: 32px"
v-privilege="'address:update'">
编辑
@ -170,7 +168,7 @@
</template>
<script setup lang="ts">
import {reactive, ref, onMounted} from 'vue';
import {message, Modal, UploadFile} from 'ant-design-vue';
import {message, Modal, UploadFile, TableColumnType} from 'ant-design-vue';
import {SmartLoading} from '/@/components/framework/smart-loading';
import {addressApi} from '/@/api/business/wms/base/address/address-api';
import {PAGE_SIZE_OPTIONS} from '/@/constants/common-const';
@ -180,10 +178,17 @@ import AddressForm from '/@/views/business/wms/base/address/address-form.vue';
import {TABLE_ID_CONST} from "/@/constants/support/table-id-const";
import AddressSelect from "/@/views/business/wms/base/address/address-select.vue";
import {fileApi} from "/@/api/support/file-api";
import {AddressAddOrUpdateForm, AddressQueryForm, AddressTableDate} from "/@/api/business/wms/base/address/address";
// ---------------------------- ----------------------------
const columns = ref([
// ---------------------------- ----------------------------
// loading
const tableLoading = ref(false);
//
const tableData = ref(<AddressTableDate[]>[]);
//
const total = ref(0);
//
const columns = ref<TableColumnType<AddressTableDate>[]>([
{
title: '收货地址id',
dataIndex: 'addressId',
@ -224,20 +229,13 @@ const columns = ref([
]);
// ---------------------------- ----------------------------
const queryFormState = {
// form
const queryFormState: AddressQueryForm = {
addressId: undefined, //
pageNum: 1,
pageSize: 10,
};
// form
const queryForm = reactive({...queryFormState});
// loading
const tableLoading = ref(false);
//
const tableData = ref([]);
//
const total = ref(0);
const queryForm = reactive<AddressQueryForm>({...queryFormState});
//
function resetQuery() {
@ -254,7 +252,7 @@ function onSearch() {
}
//
function changeAddressSelect(selectValue: any) {
function changeAddressSelect(selectValue: { addressId: number }) {
if (selectValue) {
queryForm.addressId = selectValue.addressId;
}
@ -275,18 +273,16 @@ async function queryData() {
}
onMounted(queryData);
// ---------------------------- / ----------------------------
const formRef = ref();
function showForm(data: object) {
function showForm(data: AddressAddOrUpdateForm) {
formRef.value.show(data);
}
// ---------------------------- ----------------------------
//
function onDelete(data: object) {
function onDelete(data: AddressTableDate) {
Modal.confirm({
title: '提示',
content: '确定要删除选吗?',
@ -302,7 +298,7 @@ function onDelete(data: object) {
}
//
async function requestDelete(data: any) {
async function requestDelete(data:AddressTableDate) {
SmartLoading.show();
try {
await addressApi.delete(data.addressId);
@ -318,9 +314,9 @@ async function requestDelete(data: any) {
// ---------------------------- ----------------------------
//
const selectedRowKeyList = ref([]);
const selectedRowKeyList = ref<number[]>([]);
function onSelectChange(selectedRowKeys: any) {
function onSelectChange(selectedRowKeys: number[]) {
selectedRowKeyList.value = selectedRowKeys;
}
@ -347,6 +343,7 @@ async function requestBatchDelete() {
await addressApi.batchDelete(selectedRowKeyList.value);
message.success('删除成功');
await queryData();
selectedRowKeyList.value = [];
} catch (e) {
smartSentry.captureError(e);
} finally {
@ -406,8 +403,13 @@ async function onImportAddress() {
SmartLoading.show();
try {
const response = await addressApi.importAddress(formData);
const {success} = JSON.parse(response.msg);
message.success(success);
const {success, error} = JSON.parse(response.data);
if (success) {
message.success(success);
}
if (error) {
message.error(error);
}
importModalShowFlag.value = false;
await queryData();
} catch (e) {
@ -421,4 +423,7 @@ async function onImportAddress() {
function onExportAddress() {
addressApi.exportAddress();
}
onMounted(queryData);
</script>

View File

@ -25,6 +25,8 @@
<script setup lang="ts">
import {onMounted, ref, watch} from 'vue';
import {addressApi} from "/@/api/business/wms/base/address/address-api";
import {AddressSelect} from "/@/api/business/wms/base/address/address";
const props = defineProps({
value: [Number, String, Object, Array],
@ -50,7 +52,8 @@ const props = defineProps({
},
});
const addressList = ref([]);
const addressList = ref<AddressSelect[]>([]);
const selectValue = ref(props.value);
async function queryData() {
let res = await addressApi.queryAddress({});
@ -59,8 +62,6 @@ async function queryData() {
const emit = defineEmits(['update:value', 'change']);
const selectValue = ref(props.value);
// value
watch(
() => props.value,
@ -69,19 +70,20 @@ watch(
}
);
function handleChange(value: any) {
let selectedAddress: any[] | any;
function getSelectedAddress(value: number | number[] | undefined): AddressSelect | AddressSelect[] | undefined {
if (Array.isArray(value)) {
//
selectedAddress = value.map((id) => addressList.value.find((item: any) => item.addressId === id)).filter(Boolean);
return value
.map(id => addressList.value.find(item => item.addressId === id))
.filter((item): item is AddressSelect => Boolean(item));
} else {
//
selectedAddress = addressList.value.find((item: any) => item.addressId === value);
return addressList.value.find(item => item.addressId === value);
}
}
function handleChange(value: number | number[] | undefined) {
const selectedAddress = getSelectedAddress(value);
emit('update:value', value);
emit('change', selectedAddress);
}

View File

@ -51,7 +51,7 @@ import {message} from 'ant-design-vue';
import {SmartLoading} from '/@/components/framework/smart-loading';
import {areaApi} from '/@/api/business/wms/base/area/area-api';
import {smartSentry} from '/@/lib/smart-sentry';
import pinyin from 'pinyin';
import pinyin from 'pinyin';
// ------------------------ ------------------------

View File

@ -46,7 +46,7 @@
</a-col>
<a-col :span="12">
<a-form-item label="物料类型" name="itemType">
<DictSelect width="100%" :dict-code="'ITEM_TYPE'" v-model:value="form.unit" />
<DictSelect width="100%" :dict-code="'ITEM_TYPE'" v-model:value="form.itemType" />
</a-form-item>
</a-col>
</a-row>

View File

@ -452,8 +452,13 @@ async function onImportItems() {
SmartLoading.show();
try {
const response = await itemApi.importItems(formData);
const {success} = JSON.parse(response.msg);
message.success(success);
const {success, error} = JSON.parse(response.data);
if (success) {
message.success(success);
}
if (error) {
message.error(error);
}
importModalShowFlag.value = false;
await queryData();
} catch (e) {

View File

@ -536,8 +536,13 @@ async function onImportLocations() {
SmartLoading.show();
try {
const response = await locationApi.importLocations(formData);
const {success} = JSON.parse(response.msg);
message.success(success);
const {success, error} = JSON.parse(response.data);
if (success) {
message.success(success);
}
if (error) {
message.error(error);
}
importModalShowFlag.value = false;
await queryData();
} catch (e) {

View File

@ -467,8 +467,13 @@ async function onImportStocks() {
SmartLoading.show();
try {
const response = await stockApi.importStocks(formData);
const {success} = JSON.parse(response.msg);
message.success(success);
const {success, error} = JSON.parse(response.data);
if (success) {
message.success(success);
}
if (error) {
message.error(error);
}
importModalShowFlag.value = false;
await queryData();
} catch (e) {

View File

@ -109,20 +109,19 @@
<template v-if="column.dataIndex === 'action'">
<div class="smart-table-operate">
<a-button @click="showForm(record)" type="link" v-privilege="'asn:update'">
<template #icon>
<EditOutlined/>
</template>
编辑
</a-button>
<a-button @click="onDelete(record)" danger type="link"
:disabled="record.orderQuantity>0 && record.orderQuantity-record.receivedQuantity==0"
v-privilege="'asn:delete'">
<template #icon>
<DeleteOutlined/>
</template>
删除
</a-button>
<a-space>
<a-button @click="showForm(record)" type="primary" ghost style="width:60px;height: 32px"
v-privilege="'asn:update'">
编辑
</a-button>
<a-button @click="onDelete(record)" type="primary" danger ghost style="width:60px;height: 32px"
:disabled="record.orderQuantity>0 && record.orderQuantity-record.receivedQuantity==0"
v-privilege="'asn:delete'">
删除
</a-button>
</a-space>
</div>
</template>
</template>
@ -220,9 +219,9 @@ const columns = ref([
{
title: '操作',
dataIndex: 'action',
align: 'center',
fixed: 'right',
width: 140,
align: 'center',
width: 150,
},
]);

View File

@ -117,7 +117,7 @@ async function save() {
SmartLoading.show();
try {
const response = await receiveApi.batchReceive(form);
const {error, success} = JSON.parse(response.msg);
const {error, success} = JSON.parse(response.data);
if (error) {
message.error(error);
}

View File

@ -242,7 +242,7 @@ async function requestDelete(data: any) {
SmartLoading.show();
try {
const response = await asnDetailApi.delete(data.asnDetailId);
const {error, success} = JSON.parse(response.msg);
const {error, success} = JSON.parse(response.data);
if (error) {
message.error(error);
}
@ -278,7 +278,7 @@ async function requestBatchDelete() {
try {
SmartLoading.show();
const response = await asnDetailApi.batchDelete(selectedRowKeyList.value);
const {error, success} = JSON.parse(response.msg);
const {error, success} = JSON.parse(response.data);
if (error) {
message.error(error);
}

View File

@ -196,7 +196,7 @@ async function requestBatchReturn() {
taskIds: selectedRowKeyList.value,
};
const response = await receiveApi.batchReturn(param);
const {error, success} = JSON.parse(response.msg);
const {error, success} = JSON.parse(response.data);
if (error) {
message.error(error);
}