no message
parent
7b4bb0b05d
commit
d7e2542a00
|
|
@ -112,7 +112,6 @@ function changeAreaSelect(selectValue: any) {
|
|||
if(selectValue){
|
||||
form.areaId = selectValue.areaId;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// 点击确定,验证表单
|
||||
|
|
|
|||
|
|
@ -345,7 +345,6 @@ function changeLocationSelect(selectValue: any) {
|
|||
if (selectValue) {
|
||||
queryForm.locationId = selectValue.locationId;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
-->
|
||||
<template>
|
||||
<a-modal
|
||||
:title="form.stockId ? '编辑' : '添加'"
|
||||
:title="form.stockId ? '编辑容器' : '添加容器'"
|
||||
:width="600"
|
||||
:open="visibleFlag"
|
||||
@cancel="onClose"
|
||||
|
|
@ -15,33 +15,31 @@
|
|||
:destroyOnClose="true"
|
||||
>
|
||||
<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-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 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 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 label="容器类型" name="stockType">
|
||||
<DictSelect width="100%" v-model:value="form.stockType" keyCode="STOCK_TYPE" placeholder="容器类型"/>
|
||||
</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>
|
||||
<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 label="是否启用" name="disabledFlag">
|
||||
<a-switch
|
||||
v-model:checked="form.disabledFlag"
|
||||
checked-children="启用"
|
||||
un-checked-children="禁用"
|
||||
/>
|
||||
</a-form-item>
|
||||
|
||||
|
||||
</a-form>
|
||||
|
||||
<template #footer>
|
||||
|
|
@ -59,9 +57,18 @@
|
|||
import {SmartLoading} from '/@/components/framework/smart-loading';
|
||||
import {stockApi} from '/@/api/business/base/stock/stock-api';
|
||||
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 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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// ------------------------ 事件 ------------------------
|
||||
|
||||
|
|
@ -76,10 +83,6 @@
|
|||
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();
|
||||
|
|
@ -99,34 +102,26 @@
|
|||
const formDefault = {
|
||||
stockId: undefined, //容器id
|
||||
stockCode: undefined, //容器编码
|
||||
status: undefined, //状态
|
||||
disabledFlag: undefined, //启用状态
|
||||
stockType: undefined, //容器类型
|
||||
createUserId: undefined, //创建人ID
|
||||
createUserName: undefined, //创建人
|
||||
createTime: undefined, //创建时间
|
||||
updateTime: undefined, //更新时间
|
||||
status: USAGE_STATUS_ENUM.FREE.value, //状态
|
||||
disabledFlag: true, //是否禁用
|
||||
stockType: [], //容器类型
|
||||
locationId: 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();
|
||||
await save();
|
||||
} catch (err) {
|
||||
message.error('参数验证错误,请仔细填写表单数据!');
|
||||
}
|
||||
|
|
@ -136,6 +131,7 @@
|
|||
async function save() {
|
||||
SmartLoading.show();
|
||||
try {
|
||||
console.log(form)
|
||||
if (form.stockId) {
|
||||
await stockApi.update(form);
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -9,8 +9,20 @@
|
|||
<!---------- 查询表单form begin ----------->
|
||||
<a-form class="smart-query-form">
|
||||
<a-row class="smart-query-form-row">
|
||||
<a-form-item label="容器编码" class="smart-query-form-item">
|
||||
<a-input style="width: 200px" v-model:value="queryForm.stockCode" placeholder="容器编码"/>
|
||||
<a-form-item label="容器" class="smart-query-form-item">
|
||||
<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 class="smart-query-form-item">
|
||||
<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 StockForm from '/@/views/business/base/stock/stock-form.vue';
|
||||
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 {UploadFile} from 'ant-design-vue';
|
||||
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 = {
|
||||
stockCode: undefined, //容器编码
|
||||
stockId: undefined, //容器
|
||||
locationId: undefined,//库位
|
||||
disabledFlag: undefined,//是否启用
|
||||
status: undefined,//状态
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
};
|
||||
|
|
@ -262,6 +280,20 @@ function onSearch() {
|
|||
queryData();
|
||||
}
|
||||
|
||||
//选择容器
|
||||
function changeStockSelect(selectValue: any) {
|
||||
if (selectValue) {
|
||||
queryForm.stockId = selectValue.stockId;
|
||||
}
|
||||
}
|
||||
|
||||
//选择库位
|
||||
function changeLocationSelect(selectValue: any) {
|
||||
if (selectValue) {
|
||||
queryForm.locationId = selectValue.locationId;
|
||||
}
|
||||
}
|
||||
|
||||
// 查询数据
|
||||
async function queryData() {
|
||||
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