no message
parent
7b4bb0b05d
commit
d7e2542a00
|
|
@ -112,7 +112,6 @@ function changeAreaSelect(selectValue: any) {
|
||||||
if(selectValue){
|
if(selectValue){
|
||||||
form.areaId = selectValue.areaId;
|
form.areaId = selectValue.areaId;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 点击确定,验证表单
|
// 点击确定,验证表单
|
||||||
|
|
|
||||||
|
|
@ -345,7 +345,6 @@ function changeLocationSelect(selectValue: any) {
|
||||||
if (selectValue) {
|
if (selectValue) {
|
||||||
queryForm.locationId = selectValue.locationId;
|
queryForm.locationId = selectValue.locationId;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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 label="容器编码" name="stockCode">
|
||||||
</a-form-item>
|
<a-input style="width: 100%" v-model:value="form.stockCode" placeholder="容器编码"/>
|
||||||
<a-form-item label="容器编码" name="stockCode">
|
</a-form-item>
|
||||||
<a-input style="width: 100%" v-model:value="form.stockCode" placeholder="容器编码" />
|
|
||||||
</a-form-item>
|
<a-form-item label="类型" name="stockType">
|
||||||
<a-form-item label="状态" name="status">
|
<DictSelect width="100%" key-code="STOCK_TYPE" v-model:value="form.stockType"/>
|
||||||
<SmartEnumSelect width="100%" v-model:value="form.status" enumName="" placeholder="状态"/>
|
</a-form-item>
|
||||||
</a-form-item>
|
<a-form-item label="状态" name="status">
|
||||||
<a-form-item label="启用状态" name="disabledFlag">
|
<SmartEnumSelect style="width: 100%" enum-name="USAGE_STATUS_ENUM" v-model:value="form.status"/>
|
||||||
<BooleanSelect v-model:value="form.disabledFlag" style="width: 100%" />
|
</a-form-item>
|
||||||
</a-form-item>
|
|
||||||
<a-form-item label="容器类型" name="stockType">
|
<a-form-item label="库位" name="locationId" v-show="form.stockId" >
|
||||||
<DictSelect width="100%" v-model:value="form.stockType" keyCode="STOCK_TYPE" placeholder="容器类型"/>
|
<LocationSelect style="width: 100%" v-model:value="form.locationId" :disabled-flag="true" @change="changeLocationSelect"/>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-form-item label="创建人ID" name="createUserId">
|
|
||||||
<a-input-number style="width: 100%" v-model:value="form.createUserId" placeholder="创建人ID" />
|
<a-form-item label="是否启用" name="disabledFlag">
|
||||||
</a-form-item>
|
<a-switch
|
||||||
<a-form-item label="创建人" name="createUserName">
|
v-model:checked="form.disabledFlag"
|
||||||
<a-input style="width: 100%" v-model:value="form.createUserName" placeholder="创建人" />
|
checked-children="启用"
|
||||||
</a-form-item>
|
un-checked-children="禁用"
|
||||||
<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>
|
|
||||||
<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>
|
</a-form>
|
||||||
|
|
||||||
<template #footer>
|
<template #footer>
|
||||||
|
|
@ -53,105 +51,103 @@
|
||||||
</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) {
|
||||||
const emits = defineEmits(['reloadList']);
|
if(selectValue){
|
||||||
|
form.locationId = selectValue.locationId;
|
||||||
// ------------------------ 显示与隐藏 ------------------------
|
|
||||||
// 是否显示
|
|
||||||
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 onClose() {
|
}
|
||||||
Object.assign(form, formDefault);
|
|
||||||
visibleFlag.value = false;
|
// ------------------------ 事件 ------------------------
|
||||||
|
|
||||||
|
const emits = defineEmits(['reloadList']);
|
||||||
|
|
||||||
|
// ------------------------ 显示与隐藏 ------------------------
|
||||||
|
// 是否显示
|
||||||
|
const visibleFlag = ref(false);
|
||||||
|
|
||||||
|
function show(rowData: object) {
|
||||||
|
Object.assign(form, formDefault);
|
||||||
|
if (rowData && !_.isEmpty(rowData)) {
|
||||||
|
Object.assign(form, rowData);
|
||||||
}
|
}
|
||||||
|
visibleFlag.value = true;
|
||||||
// ------------------------ 表单 ------------------------
|
nextTick(() => {
|
||||||
|
formRef.value.clearValidate();
|
||||||
// 组件ref
|
|
||||||
const formRef = ref();
|
|
||||||
|
|
||||||
const formDefault = {
|
|
||||||
stockId: undefined, //容器id
|
|
||||||
stockCode: undefined, //容器编码
|
|
||||||
status: undefined, //状态
|
|
||||||
disabledFlag: undefined, //启用状态
|
|
||||||
stockType: undefined, //容器类型
|
|
||||||
createUserId: undefined, //创建人ID
|
|
||||||
createUserName: undefined, //创建人
|
|
||||||
createTime: undefined, //创建时间
|
|
||||||
updateTime: undefined, //更新时间
|
|
||||||
};
|
|
||||||
|
|
||||||
let form = reactive({ ...formDefault });
|
|
||||||
|
|
||||||
const rules = {
|
|
||||||
stockId: [{ required: true, message: '容器id 必填' }],
|
|
||||||
stockCode: [{ required: true, message: '容器编码 必填' }],
|
|
||||||
status: [{ required: true, message: '状态 必填' }],
|
|
||||||
disabledFlag: [{ 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() {
|
|
||||||
try {
|
|
||||||
await formRef.value.validateFields();
|
|
||||||
save();
|
|
||||||
} catch (err) {
|
|
||||||
message.error('参数验证错误,请仔细填写表单数据!');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 新建、编辑API
|
|
||||||
async function save() {
|
|
||||||
SmartLoading.show();
|
|
||||||
try {
|
|
||||||
if (form.stockId) {
|
|
||||||
await stockApi.update(form);
|
|
||||||
} else {
|
|
||||||
await stockApi.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 = {
|
||||||
|
stockId: undefined, //容器id
|
||||||
|
stockCode: undefined, //容器编码
|
||||||
|
status: USAGE_STATUS_ENUM.FREE.value, //状态
|
||||||
|
disabledFlag: true, //是否禁用
|
||||||
|
stockType: [], //容器类型
|
||||||
|
locationId: undefined,//库位
|
||||||
|
};
|
||||||
|
|
||||||
|
let form = reactive({...formDefault});
|
||||||
|
|
||||||
|
const rules = {
|
||||||
|
stockCode: [{required: true, message: '容器编码 必填'}],
|
||||||
|
status: [{required: true, message: '状态 必填'}],
|
||||||
|
disabledFlag: [{required: true, message: '启用状态 必填'}],
|
||||||
|
stockType: [{required: true, message: '容器类型 必填'}],
|
||||||
|
};
|
||||||
|
|
||||||
|
// 点击确定,验证表单
|
||||||
|
async function onSubmit() {
|
||||||
|
try {
|
||||||
|
await formRef.value.validateFields();
|
||||||
|
await save();
|
||||||
|
} catch (err) {
|
||||||
|
message.error('参数验证错误,请仔细填写表单数据!');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 新建、编辑API
|
||||||
|
async function save() {
|
||||||
|
SmartLoading.show();
|
||||||
|
try {
|
||||||
|
console.log(form)
|
||||||
|
if (form.stockId) {
|
||||||
|
await stockApi.update(form);
|
||||||
|
} else {
|
||||||
|
await stockApi.add(form);
|
||||||
|
}
|
||||||
|
message.success('操作成功');
|
||||||
|
emits('reloadList');
|
||||||
|
onClose();
|
||||||
|
} catch (err) {
|
||||||
|
smartSentry.captureError(err);
|
||||||
|
} finally {
|
||||||
|
SmartLoading.hide();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
defineExpose({
|
||||||
|
show,
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
|
||||||
|
|
@ -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;
|
||||||
|
|
|
||||||
|
|
@ -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>
|
||||||
Loading…
Reference in New Issue