no message

main
HUOJIN\92525 2025-03-24 16:15:28 +08:00
parent 7b4bb0b05d
commit d7e2542a00
5 changed files with 267 additions and 131 deletions

View File

@ -112,7 +112,6 @@ function changeAreaSelect(selectValue: any) {
if(selectValue){ if(selectValue){
form.areaId = selectValue.areaId; form.areaId = selectValue.areaId;
} }
} }
// //

View File

@ -345,7 +345,6 @@ function changeLocationSelect(selectValue: any) {
if (selectValue) { if (selectValue) {
queryForm.locationId = selectValue.locationId; queryForm.locationId = selectValue.locationId;
} }
} }

View File

@ -7,41 +7,39 @@
--> -->
<template> <template>
<a-modal <a-modal
:title="form.stockId ? '编辑' : '添加'" :title="form.stockId ? '编辑容器' : '添加容器'"
:width="600" :width="600"
:open="visibleFlag" :open="visibleFlag"
@cancel="onClose" @cancel="onClose"
: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="容器id" name="stockId">
<a-input-number style="width: 100%" v-model:value="form.stockId" placeholder="容器id" />
</a-form-item>
<a-form-item label="容器编码" name="stockCode"> <a-form-item label="容器编码" name="stockCode">
<a-input style="width: 100%" v-model:value="form.stockCode" placeholder="容器编码" /> <a-input style="width: 100%" v-model:value="form.stockCode" placeholder="容器编码"/>
</a-form-item>
<a-form-item label="类型" name="stockType">
<DictSelect width="100%" key-code="STOCK_TYPE" v-model:value="form.stockType"/>
</a-form-item> </a-form-item>
<a-form-item label="状态" name="status"> <a-form-item label="状态" name="status">
<SmartEnumSelect width="100%" v-model:value="form.status" enumName="" placeholder="状态"/> <SmartEnumSelect style="width: 100%" enum-name="USAGE_STATUS_ENUM" v-model:value="form.status"/>
</a-form-item> </a-form-item>
<a-form-item label="启用状态" name="disabledFlag">
<BooleanSelect v-model:value="form.disabledFlag" style="width: 100%" /> <a-form-item label="库位" name="locationId" v-show="form.stockId" >
<LocationSelect style="width: 100%" v-model:value="form.locationId" :disabled-flag="true" @change="changeLocationSelect"/>
</a-form-item> </a-form-item>
<a-form-item label="容器类型" name="stockType">
<DictSelect width="100%" v-model:value="form.stockType" keyCode="STOCK_TYPE" placeholder="容器类型"/> <a-form-item label="是否启用" name="disabledFlag">
</a-form-item> <a-switch
<a-form-item label="创建人ID" name="createUserId"> v-model:checked="form.disabledFlag"
<a-input-number style="width: 100%" v-model:value="form.createUserId" placeholder="创建人ID" /> checked-children="启用"
</a-form-item> un-checked-children="禁用"
<a-form-item label="创建人" name="createUserName"> />
<a-input style="width: 100%" v-model:value="form.createUserName" placeholder="创建人" />
</a-form-item>
<a-form-item label="创建时间" name="createTime">
<a-date-picker show-time valueFormat="YYYY-MM-DD HH:mm:ss" v-model:value="form.createTime" style="width: 100%" placeholder="创建时间" />
</a-form-item>
<a-form-item label="更新时间" name="updateTime">
<a-date-picker show-time valueFormat="YYYY-MM-DD HH:mm:ss" v-model:value="form.updateTime" style="width: 100%" placeholder="更新时间" />
</a-form-item> </a-form-item>
</a-form> </a-form>
<template #footer> <template #footer>
@ -53,89 +51,87 @@
</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 { stockApi } from '/@/api/business/base/stock/stock-api'; import {stockApi} from '/@/api/business/base/stock/stock-api';
import { smartSentry } from '/@/lib/smart-sentry'; import {smartSentry} from '/@/lib/smart-sentry';
import BooleanSelect from '/@/components/framework/boolean-select/index.vue'; import DictSelect from '/@/components/support/dict-select/index.vue';
import DictSelect from '/@/components/support/dict-select/index.vue'; import SmartEnumSelect from '/@/components/framework/smart-enum-select/index.vue';
import SmartEnumSelect from '/@/components/framework/smart-enum-select/index.vue'; import {USAGE_STATUS_ENUM} from "/@/constants/business/base/usagestatus-const";
import LocationSelect from "/@/views/business/base/location/location-select.vue";
// ------------------------ ------------------------ //
function changeLocationSelect(selectValue: any) {
if(selectValue){
form.locationId = selectValue.locationId;
}
const emits = defineEmits(['reloadList']); }
// ------------------------ ------------------------ // ------------------------ ------------------------
//
const visibleFlag = ref(false);
function show(rowData:object) { const emits = defineEmits(['reloadList']);
// ------------------------ ------------------------
//
const visibleFlag = ref(false);
function show(rowData: object) {
Object.assign(form, formDefault); Object.assign(form, formDefault);
if (rowData && !_.isEmpty(rowData)) { if (rowData && !_.isEmpty(rowData)) {
Object.assign(form, rowData); Object.assign(form, rowData);
} }
// 使
// if (form.status && form.status.length > 0) {
// form.status = form.status.map((e) => e.valueCode);
// }
visibleFlag.value = true; visibleFlag.value = true;
nextTick(() => { nextTick(() => {
formRef.value.clearValidate(); formRef.value.clearValidate();
}); });
} }
function onClose() { function onClose() {
Object.assign(form, formDefault); Object.assign(form, formDefault);
visibleFlag.value = false; visibleFlag.value = false;
} }
// ------------------------ ------------------------ // ------------------------ ------------------------
// ref // ref
const formRef = ref(); const formRef = ref();
const formDefault = { const formDefault = {
stockId: undefined, //id stockId: undefined, //id
stockCode: undefined, // stockCode: undefined, //
status: undefined, // status: USAGE_STATUS_ENUM.FREE.value, //
disabledFlag: undefined, // disabledFlag: true, //
stockType: undefined, // stockType: [], //
createUserId: undefined, //ID locationId: undefined,//
createUserName: undefined, // };
createTime: undefined, //
updateTime: undefined, //
};
let form = reactive({ ...formDefault }); let form = reactive({...formDefault});
const rules = { const rules = {
stockId: [{ required: true, message: '容器id 必填' }], stockCode: [{required: true, message: '容器编码 必填'}],
stockCode: [{ required: true, message: '容器编码 必填' }], status: [{required: true, message: '状态 必填'}],
status: [{ required: true, message: '状态 必填' }], disabledFlag: [{required: true, message: '启用状态 必填'}],
disabledFlag: [{ required: true, message: '启用状态 必填' }], stockType: [{required: true, message: '容器类型 必填'}],
stockType: [{ required: true, message: '容器类型 必填' }], };
createUserId: [{ required: true, message: '创建人ID 必填' }],
createUserName: [{ required: true, message: '创建人 必填' }],
createTime: [{ required: true, message: '创建时间 必填' }],
updateTime: [{ required: true, message: '更新时间 必填' }],
};
// //
async function onSubmit() { async function onSubmit() {
try { try {
await formRef.value.validateFields(); await formRef.value.validateFields();
save(); await save();
} catch (err) { } catch (err) {
message.error('参数验证错误,请仔细填写表单数据!'); message.error('参数验证错误,请仔细填写表单数据!');
} }
} }
// API // API
async function save() { async function save() {
SmartLoading.show(); SmartLoading.show();
try { try {
console.log(form)
if (form.stockId) { if (form.stockId) {
await stockApi.update(form); await stockApi.update(form);
} else { } else {
@ -149,9 +145,9 @@
} finally { } finally {
SmartLoading.hide(); SmartLoading.hide();
} }
} }
defineExpose({ defineExpose({
show, show,
}); });
</script> </script>

View File

@ -9,8 +9,20 @@
<!---------- 查询表单form begin -----------> <!---------- 查询表单form begin ----------->
<a-form class="smart-query-form"> <a-form class="smart-query-form">
<a-row class="smart-query-form-row"> <a-row class="smart-query-form-row">
<a-form-item label="容器编码" class="smart-query-form-item"> <a-form-item label="容器" class="smart-query-form-item">
<a-input style="width: 200px" v-model:value="queryForm.stockCode" placeholder="容器编码"/> <StockSelect v-model:value="queryForm.stockId" :disabled-flag="true" @change="changeStockSelect"/>
</a-form-item>
<a-form-item label="库位" class="smart-query-form-item">
<LocationSelect v-model:value="queryForm.locationId" :disabledFlag="true" @change="changeLocationSelect"/>
</a-form-item>
<a-form-item label="状态" class="smart-query-form-item">
<SmartEnumSelect style="width: 200px" enum-name="USAGE_STATUS_ENUM" v-model:value="queryForm.status"/>
</a-form-item>
<a-form-item label="是否启用" class="smart-query-form-item">
<a-select style="width: 200px" v-model:value="queryForm.disabledFlag" allowClear placeholder="请选择">
<a-select-option :value="true">启用</a-select-option>
<a-select-option :value="false">禁用</a-select-option>
</a-select>
</a-form-item> </a-form-item>
<a-form-item class="smart-query-form-item"> <a-form-item class="smart-query-form-item">
<a-button type="primary" @click="onSearch" class="smart-margin-left10"> <a-button type="primary" @click="onSearch" class="smart-margin-left10">
@ -177,10 +189,13 @@ import {smartSentry} from '/@/lib/smart-sentry';
import TableOperator from '/@/components/support/table-operator/index.vue'; import TableOperator from '/@/components/support/table-operator/index.vue';
import StockForm from '/@/views/business/base/stock/stock-form.vue'; import StockForm from '/@/views/business/base/stock/stock-form.vue';
import {TABLE_ID_CONST} from "/@/constants/support/table-id-const"; import {TABLE_ID_CONST} from "/@/constants/support/table-id-const";
import DictPreview from "/@/components/dict-preview/index.vue"; import DictPreview from '/@/components/dict-preview/index.vue';
import {useDict} from "/@/utils/dict"; import {useDict} from "/@/utils/dict";
import {UploadFile} from 'ant-design-vue'; import {UploadFile} from 'ant-design-vue';
import {fileApi} from "/@/api/support/file-api"; import {fileApi} from "/@/api/support/file-api";
import StockSelect from "/@/views/business/base/stock/stock-select.vue";
import SmartEnumSelect from "/@/components/framework/smart-enum-select/index.vue";
import LocationSelect from "/@/views/business/base/location/location-select.vue";
// //
@ -235,7 +250,10 @@ const columns = ref([
// ---------------------------- ---------------------------- // ---------------------------- ----------------------------
const queryFormState = { const queryFormState = {
stockCode: undefined, // stockId: undefined, //
locationId: undefined,//
disabledFlag: undefined,//
status: undefined,//
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
}; };
@ -262,6 +280,20 @@ function onSearch() {
queryData(); queryData();
} }
//
function changeStockSelect(selectValue: any) {
if (selectValue) {
queryForm.stockId = selectValue.stockId;
}
}
//
function changeLocationSelect(selectValue: any) {
if (selectValue) {
queryForm.locationId = selectValue.locationId;
}
}
// //
async function queryData() { async function queryData() {
tableLoading.value = true; tableLoading.value = true;

View File

@ -0,0 +1,110 @@
<!--
* 容器 下拉选择框
*
*
-->
<template>
<a-select
v-model:value="selectValue"
:style="`width: ${width}`"
:placeholder="props.placeholder"
:showSearch="true"
:allowClear="true"
:size="size"
@change="handleChange"
:disabled="disabled"
:mode="multiple ? 'multiple' : ''"
optionFilterProp="label"
>
<a-select-option v-for="stock in stocks" :key="stock.stockId" :label="stock.stockCode">
{{ stock.stockCode }}
<div style="float: right">
<template v-if="stock.stockType">
<DictPreview :options="stockType.STOCK_TYPE" :value="stock.stockType"/>
</template>
</div>
</a-select-option>
</a-select>
</template>
<script setup lang="ts">
import {onMounted, ref, watch} from 'vue';
import {stockApi} from "/@/api/business/base/stock/stock-api";
import {useDict} from "/@/utils/dict";
import DictPreview from "/@/components/dict-preview/index.vue";
//
const stockType = useDict('STOCK_TYPE');
const props = defineProps({
value: [Number, String, Object, Array],
width: {
type: String,
default: '200px',
},
placeholder: {
type: String,
default: '请选择',
},
size: {
type: String,
default: 'default',
},
disabled: {
type: Boolean,
default: false,
},
multiple: {
type: Boolean,
default: false,
},
status: {
type: String,
default: null,
},
disabledFlag: {
type: Boolean,
default: null,
},
});
const stocks = ref([]);
async function queryData() {
let res = await stockApi.queryStock({
status: props.status,
disabledFlag: props.disabledFlag
});
stocks.value = res.data;
}
const emit = defineEmits(['update:value', 'change']);
const selectValue = ref(props.value);
// value
watch(
() => props.value,
(newValue) => {
selectValue.value = newValue;
}
);
function handleChange(value: any) {
let selectedStocks: any[] | any;
if (Array.isArray(value)) {
//
selectedStocks = value.map((id) => stocks.value.find((item: any) => item.stockId === id)).filter(Boolean);
} else {
//
selectedStocks = stocks.value.find((item: any) => item.stockId === value);
}
emit('update:value', value);
emit('change', selectedStocks);
}
onMounted(queryData);
</script>