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" "vue3-json-viewer": "2.2.2"
}, },
"devDependencies": { "devDependencies": {
"@types/lodash": "^4.17.16",
"@types/pinyin": "^2.10.2",
"@vitejs/plugin-vue": "5.1.4", "@vitejs/plugin-vue": "5.1.4",
"@vitejs/plugin-vue-jsx": "4.0.1", "@vitejs/plugin-vue-jsx": "4.0.1",
"@vue/eslint-config-prettier": "^10.0.0", "@vue/eslint-config-prettier": "^10.0.0",
@ -1588,6 +1590,12 @@
"integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==", "integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==",
"dev": true "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": { "node_modules/@types/minimist": {
"version": "1.2.5", "version": "1.2.5",
"resolved": "https://registry.npmmirror.com/@types/minimist/-/minimist-1.2.5.tgz", "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", "resolved": "https://registry.npmmirror.com/@types/parse-json/-/parse-json-4.0.2.tgz",
"integrity": "sha512-dISoDXWWQwUquiKsyZ4Ng+HX2KsPL7LyHKHQwgGFEA3IaKac4Obd+h2a/a6waisAoepJlBcx9paWqjA8/HVjCw==" "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": { "node_modules/@typescript-eslint/eslint-plugin": {
"version": "8.29.1", "version": "8.29.1",
"resolved": "https://registry.npmmirror.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.29.1.tgz", "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" "vue3-json-viewer": "2.2.2"
}, },
"devDependencies": { "devDependencies": {
"@types/lodash": "^4.17.16",
"@types/pinyin": "^2.10.2",
"@vitejs/plugin-vue": "5.1.4", "@vitejs/plugin-vue": "5.1.4",
"@vitejs/plugin-vue-jsx": "4.0.1", "@vitejs/plugin-vue-jsx": "4.0.1",
"@vue/eslint-config-prettier": "^10.0.0", "@vue/eslint-config-prettier": "^10.0.0",

View File

@ -6,27 +6,27 @@
* @Copyright * @Copyright
*/ */
import {postRequest, getRequest,getDownload} from '/@/lib/axios'; import {postRequest, getRequest,getDownload} from '/@/lib/axios';
import {AddressAddOrUpdateForm, AddressQueryForm,} from "/@/api/business/wms/base/address/address";
export const addressApi = { export const addressApi = {
/** /**
* @author hj * @author hj
*/ */
queryPage: (param:object) => { queryPage: (param:AddressQueryForm) => {
return postRequest('/address/queryPage', param); return postRequest('/address/queryPage', param);
}, },
/** /**
* @author hj * @author hj
*/ */
add: (param:object) => { add: (param:AddressAddOrUpdateForm) => {
return postRequest('/address/add', param); return postRequest('/address/add', param);
}, },
/** /**
* @author hj * @author hj
*/ */
update: (param:object) => { update: (param:AddressAddOrUpdateForm) => {
return postRequest('/address/update', param); 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" :maskClosable="false"
:destroyOnClose="true" :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-form-item label="收货单位" name="name">
<a-input style="width: 100%" v-model:value="form.name" placeholder="收货单位" /> <a-input style="width: 100%" v-model:value="form.name" placeholder="收货单位"/>
</a-form-item> </a-form-item>
<a-form-item label="联系人" name="person"> <a-form-item label="联系人" name="person">
<a-input style="width: 100%" v-model:value="form.person" placeholder="联系人" /> <a-input style="width: 100%" v-model:value="form.person" placeholder="联系人"/>
</a-form-item> </a-form-item>
<a-form-item label="电话" name="telephone"> <a-form-item label="电话" name="telephone">
<a-input style="width: 100%" v-model:value="form.telephone" placeholder="电话" /> <a-input style="width: 100%" v-model:value="form.telephone" placeholder="电话"/>
</a-form-item> </a-form-item>
<a-form-item label="地址" name="address"> <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-item>
</a-form> </a-form>
@ -39,90 +39,90 @@
</a-modal> </a-modal>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { reactive, ref, nextTick } from 'vue'; import {reactive, ref, nextTick} from 'vue';
import _ from 'lodash'; import _ from 'lodash';
import { message } from 'ant-design-vue'; import {message} from 'ant-design-vue';
import { SmartLoading } from '/@/components/framework/smart-loading'; import {SmartLoading} from '/@/components/framework/smart-loading';
import { addressApi } from '/@/api/business/wms/base/address/address-api'; import {addressApi} from '/@/api/business/wms/base/address/address-api';
import { smartSentry } from '/@/lib/smart-sentry'; 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);
// ------------------------ ------------------------ function show(rowData: AddressAddOrUpdateForm) {
// Object.assign(form, formDefault);
const visibleFlag = ref(false); if (rowData && !_.isEmpty(rowData)) {
Object.assign(form, rowData);
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 onClose() { // if (form.status && form.status.length > 0) {
Object.assign(form, formDefault); // form.status = form.status.map((e) => e.valueCode);
visibleFlag.value = false; // }
} visibleFlag.value = true;
nextTick(() => {
// ------------------------ ------------------------ formRef.value.clearValidate();
// 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,
}); });
}
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> </script>

View File

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

View File

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

View File

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

View File

@ -46,7 +46,7 @@
</a-col> </a-col>
<a-col :span="12"> <a-col :span="12">
<a-form-item label="物料类型" name="itemType"> <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-form-item>
</a-col> </a-col>
</a-row> </a-row>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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