新增DataSelect组件

This commit is contained in:
AlanScipio
2024-02-26 16:21:34 +08:00
parent 2366176f01
commit 603803f5e7
48 changed files with 1073 additions and 497 deletions

View File

@@ -9,10 +9,11 @@ export function listBaseStock(query) {
})
}
// TODO 查询基本库存详细 主键需要注意
export function getBaseStock(whsCd) {
// 询基本库存详细
export function getBaseStock(data) {
return request({
url: '/wms/BaseStock/' + whsCd,
method: 'get'
url: '/wms/BaseStock/getInfo',
method: 'post',
data: data
})
}

View File

@@ -0,0 +1,26 @@
import request from '@/utils/request'
// 查询入出库履历列表
export function listInvTransHis(query) {
return request({
url: '/wms/InvTransHis/list',
method: 'get',
params: query
})
}
// 查询入出库履历详细
export function getInvTransHis(invTransNo) {
return request({
url: '/wms/InvTransHis/' + invTransNo,
method: 'get'
})
}
// 删除入出库履历
export function delInvTransHis(invTransNo) {
return request({
url: '/wms/InvTransHis/' + invTransNo,
method: 'delete'
})
}

View File

@@ -0,0 +1,111 @@
<template>
<div>
<el-select
v-model="selectedValue"
:placeholder="placeholder"
:clearable="clearable"
@change="handleChange"
>
<el-option
v-for="dict in dataOptions"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</div>
</template>
<script setup>
import { getDicts } from '@/api/system/dict/data'
const { proxy } = getCurrentInstance();
const emit = defineEmits();
const props = defineProps({
// v-model
modelValue: {
type: [String, Number],
required: false,
},
// 直接自定义选项
options: {
type: Array,
default: () => [],
},
// 获取数据的方法
fetchData: {
type: Function,
required: false,
},
// 字典名称
dictName: {
type: String,
required: false
},
// 提示文本
placeholder: {
type: String,
default: '',
},
// 是否能够清空选项
clearable: {
type: Boolean,
default: true,
},
});
const dataOptions = ref([]);
const selectedValue = ref(null);
// v-model双向绑定更新父组件的值
function handleChange(value) {
emit('update:modelValue', value);
}
// v-model双向绑定更新子组件的值
watch(() => props.modelValue, (value) => {
selectedValue.value = value;
});
// 获取数据
async function doFetchData() {
if (props.options instanceof Array && props.options.length > 0) {
// 如果是直接自定义选项,则直接使用
dataOptions.value = props.options;
} else if (props.fetchData) {
// 如果是通过方法获取数据,则调用方法获取数据
const dataList = await props.fetchData();
dataList.map((item) => {
dataOptions.value.push({
label: item.label,
value: item.value,
});
});
} else if (props.dictName) {
// 如果是字典类型,则从字典中获取数据
const dicts = proxy.useDict(props.dictName);
let list = dicts[props.dictName]._object[props.dictName];
if (list.length > 0) {
//已经缓存过字典数据
list.map((item) => {
dataOptions.value.push({
label: item.label,
value: item.value,
});
});
} else {
//没有缓存过字典数据
const response = await getDicts(props.dictName);
response.data.map((item) => {
dataOptions.value.push({
label: item.dictLabel,
value: item.dictValue,
});
});
}
}
}
doFetchData()
</script>

View File

@@ -4,7 +4,7 @@
<el-tooltip class="item" effect="dark" :content="showSearch ? '隐藏搜索' : '显示搜索'" placement="top" v-if="search">
<el-button circle icon="Search" @click="toggleSearch()" />
</el-tooltip>
<el-tooltip class="item" effect="dark" content="刷新" placement="top">
<el-tooltip class="item" effect="dark" content="刷新" placement="top" v-if="showRefresh">
<el-button circle icon="Refresh" @click="refresh()" />
</el-tooltip>
<el-tooltip class="item" effect="dark" content="显隐列" placement="top" v-if="columns">
@@ -60,6 +60,11 @@ const props = defineProps({
type: Number,
default: 10,
},
/* 是否显示刷新图标 */
showRefresh: {
type: Boolean,
default: false,
},
})
const emits = defineEmits(['update:showSearch', 'queryTable']);

View File

@@ -24,7 +24,10 @@ import elementIcons from '@/components/SvgIcon/svgicon'
import './permission' // permission control
//字典
import { useDict } from '@/utils/dict'
import { optionselect } from '@/api/system/dict/type'
import { parseTime, resetForm, addDateRange, handleTree, selectDictLabel, selectDictLabels } from '@/utils/ruoyi'
// 分页组件
@@ -45,6 +48,8 @@ import TreeSelect from '@/components/TreeSelect'
import DictTag from '@/components/DictTag'
// FilePond文件上传组件
import FpFileUpload from '@/components/FpFileUpload'
// 自定义下拉选项组件
import DataSelect from '@/components/DataSelect'
const app = createApp(App)
@@ -68,6 +73,7 @@ app.component('ImagePreview', ImagePreview)
app.component('RightToolbar', RightToolbar)
app.component('Editor', Editor)
app.component('FpFileUpload', FpFileUpload)
app.component('DataSelect', DataSelect)
app.use(router)
app.use(store)

View File

@@ -113,7 +113,7 @@ const data = reactive({
form: {},
queryParams: {
pageNum: 1,
pageSize: 20,
pageSize: 30,
fileId: null,
savedName: null,
originalName: null,

View File

@@ -308,7 +308,7 @@ const data = reactive({
form: {},
queryParams: {
pageNum: 1,
pageSize: 10,
pageSize: 30,
jobName: undefined,
jobGroup: undefined,
status: undefined

View File

@@ -191,7 +191,7 @@ const data = reactive({
form: {},
queryParams: {
pageNum: 1,
pageSize: 10,
pageSize: 30,
dictName: undefined,
dictType: undefined,
status: undefined

View File

@@ -62,7 +62,7 @@ const onlineList = ref([]);
const loading = ref(true);
const total = ref(0);
const pageNum = ref(1);
const pageSize = ref(10);
const pageSize = ref(30);
const queryParams = ref({
ipaddr: undefined,

View File

@@ -170,7 +170,7 @@ const data = reactive({
form: {},
queryParams: {
pageNum: 1,
pageSize: 10,
pageSize: 30,
seqDistCd: null,
ruleName: null,
},

View File

@@ -185,7 +185,7 @@ const data = reactive({
form: {},
queryParams: {
pageNum: 1,
pageSize: 10,
pageSize: 30,
configName: undefined,
configKey: undefined,
configType: undefined

View File

@@ -209,7 +209,7 @@ const data = reactive({
form: {},
queryParams: {
pageNum: 1,
pageSize: 10,
pageSize: 30,
dictType: undefined,
dictLabel: undefined,
status: undefined

View File

@@ -193,7 +193,7 @@ const data = reactive({
form: {},
queryParams: {
pageNum: 1,
pageSize: 10,
pageSize: 30,
dictName: undefined,
dictType: undefined,
status: undefined

View File

@@ -140,7 +140,7 @@ const defaultSort = ref({ prop: "accessTime", order: "descending" });
// 查询参数
const queryParams = ref({
pageNum: 1,
pageSize: 10,
pageSize: 30,
ipaddr: undefined,
userName: undefined,
status: undefined,

View File

@@ -178,7 +178,7 @@ const data = reactive({
form: {},
queryParams: {
pageNum: 1,
pageSize: 10,
pageSize: 30,
noticeTitle: undefined,
createBy: undefined,
status: undefined

View File

@@ -220,7 +220,7 @@ const data = reactive({
form: {},
queryParams: {
pageNum: 1,
pageSize: 10,
pageSize: 30,
operIp: undefined,
title: undefined,
operName: undefined,

View File

@@ -164,7 +164,7 @@ const data = reactive({
form: {},
queryParams: {
pageNum: 1,
pageSize: 10,
pageSize: 30,
postCode: undefined,
postName: undefined,
status: undefined

View File

@@ -108,7 +108,7 @@ const userIds = ref([]);
const queryParams = reactive({
pageNum: 1,
pageSize: 10,
pageSize: 30,
roleId: route.params.roleId,
userName: undefined,
phonenumber: undefined,

View File

@@ -282,7 +282,7 @@ const data = reactive({
form: {},
queryParams: {
pageNum: 1,
pageSize: 10,
pageSize: 20,
roleName: undefined,
roleKey: undefined,
status: undefined

View File

@@ -79,7 +79,7 @@ const userIds = ref([]);
const queryParams = reactive({
pageNum: 1,
pageSize: 10,
pageSize: 30,
roleId: undefined,
userName: undefined,
phonenumber: undefined

View File

@@ -54,7 +54,7 @@ const { proxy } = getCurrentInstance();
const loading = ref(true);
const total = ref(0);
const pageNum = ref(1);
const pageSize = ref(10);
const pageSize = ref(30);
const roleIds = ref([]);
const roles = ref([]);
const form = ref({

View File

@@ -382,7 +382,7 @@ const data = reactive({
form: {},
queryParams: {
pageNum: 1,
pageSize: 10,
pageSize: 20,
userName: undefined,
phonenumber: undefined,
status: undefined,

View File

@@ -59,7 +59,7 @@ const { proxy } = getCurrentInstance();
const queryParams = reactive({
pageNum: 1,
pageSize: 10,
pageSize: 30,
tableName: undefined,
tableComment: undefined
});

View File

@@ -171,7 +171,7 @@ const uniqueId = ref("");
const data = reactive({
queryParams: {
pageNum: 1,
pageSize: 10,
pageSize: 30,
tableName: undefined,
tableComment: undefined
},

View File

@@ -1,13 +1,14 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="仓库代码" prop="whsCd">
<el-input
v-model="queryParams.whsCd"
placeholder="请输入仓库代码"
clearable
@keyup.enter="handleQuery"
/>
<el-form-item label="仓库" prop="whsCd">
<!-- <el-input-->
<!-- v-model="queryParams.whsCd"-->
<!-- placeholder="请输入仓库代码"-->
<!-- clearable-->
<!-- @keyup.enter="handleQuery"-->
<!-- />-->
<data-select v-model="queryParams.whsCd" :fetch-data="fetchWarehouseData" />
</el-form-item>
<el-form-item label="货架号" prop="stgBinCd">
<el-input
@@ -36,40 +37,40 @@
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="Plus"
@click="handleInstock"
v-hasPermi="['wms:BaseStock:instock']"
>入库</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="Edit"
:disabled="single"
@click="handleOutstock"
v-hasPermi="['wms:BaseStock:outstock']"
>出库</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="Download"
@click="handleExport"
v-hasPermi="['wms:BaseStock:export']"
>导出</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
</el-col>
<el-col :span="1.5">
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="Download"
@click="handleExport"
v-hasPermi="['wms:BaseStock:export']"
>导出</el-button>
</el-col>
<!-- <el-col :span="1.5">-->
<!-- <el-button-->
<!-- type="primary"-->
<!-- plain-->
<!-- icon="Plus"-->
<!-- @click="handleInstock"-->
<!-- v-hasPermi="['wms:BaseStock:instock']"-->
<!-- >入库</el-button>-->
<!-- </el-col>-->
<!-- <el-col :span="1.5">-->
<!-- <el-button-->
<!-- type="success"-->
<!-- plain-->
<!-- icon="Edit"-->
<!-- :disabled="single"-->
<!-- @click="handleOutstock"-->
<!-- v-hasPermi="['wms:BaseStock:outstock']"-->
<!-- >出库</el-button>-->
<!-- </el-col>-->
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
@@ -118,7 +119,9 @@
</template>
<script setup name="BaseStock">
import { listBaseStock, getBaseStock } from "@/api/wms/BaseStock";
import { listBaseStock, getBaseStock } from "@/api/wms/BaseStock"
import { listWarehouseInfo } from "@/api/wms/WarehouseInfo";
import DataSelect from "@/components/DataSelect/index.vue";
const { proxy } = getCurrentInstance();
@@ -136,7 +139,7 @@ const data = reactive({
form: {},
queryParams: {
pageNum: 1,
pageSize: 20,
pageSize: 30,
whsCd: null,
stgBinCd: null,
itemCd: null,
@@ -206,38 +209,45 @@ function resetQuery() {
handleQuery();
}
// TODO 多选框选中数据 需要修改主键
// 多选框选中数据
function handleSelectionChange(selection) {
ids.value = selection.map(item => item.whsCd);
ids.value = selection.map(item => {
return {
whsCd: item.whsCd,
stgBinCd: item.stgBinCd,
itemCd: item.itemCd,
lotNo: item.lotNo,
subLotNo: item.subLotNo,
};
});
single.value = selection.length != 1;
multiple.value = !selection.length;
}
/** 入库按钮操作 */
function handleInstock() {
proxy.$modal.msg("开发中...");
// reset();
// open.value = true;
// title.value = "入库";
reset();
open.value = true;
title.value = "入库";
}
/** 出库按钮操作 */
function handleOutstock(row) {
proxy.$modal.msg("开发中...");
// reset();
// const _whsCd = row.whsCd || ids.value
// getBaseStock(_whsCd).then(response => {
// form.value = response.data;
// open.value = true;
// title.value = "出库";
// });
function handleOutstock() {
reset();
let primaryKey = ids.value[0]
getBaseStock(primaryKey).then(response => {
form.value = response.data;
open.value = true;
title.value = "出库";
});
}
/** 提交按钮 */
function submitForm() {
//TODO 未完成
proxy.$refs["BaseStockRef"].validate(valid => {
if (valid) {
if (form.value.whsCd != null) {
if (form.value.deptId != null) {
// instock(form.value).then(response => {
// proxy.$modal.msgSuccess("出库成功");
// open.value = false;
@@ -261,6 +271,19 @@ function handleExport() {
}, `BaseStock_${new Date().getTime()}.xlsx`)
}
// 获取仓库数据
async function fetchWarehouseData() {
const response = await listWarehouseInfo({})
const dataList = []
response.rows.map(item => {
dataList.push({
label: item.whsName,
value: item.whsCd,
})
})
return dataList
}
//页面打开时查询
//getList();
</script>

View File

@@ -0,0 +1,234 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="85px">
<el-form-item label="入出库类型" prop="invTransType">
<data-select v-model="queryParams.invTransType" dict-name="wms_inv_trans_type" />
</el-form-item>
<el-form-item label="仓库" prop="whsCd">
<!-- <el-input-->
<!-- v-model="queryParams.whsCd"-->
<!-- placeholder="请输入仓库代码"-->
<!-- clearable-->
<!-- @keyup.enter="handleQuery"-->
<!-- />-->
<data-select v-model="queryParams.whsCd" :fetch-data="fetchWarehouseData" />
</el-form-item>
<el-form-item label="货架号" prop="stgBinCd">
<el-input
v-model="queryParams.stgBinCd"
placeholder="请输入货架号"
clearable
@keyup.enter="handleQuery"
/>
</el-form-item>
<el-form-item label="物品代码" prop="itemCd">
<el-input
v-model="queryParams.itemCd"
placeholder="请输入物品代码"
clearable
@keyup.enter="handleQuery"
/>
</el-form-item>
<el-form-item label="批号" prop="lotNo">
<el-input
v-model="queryParams.lotNo"
placeholder="请输入批号"
clearable
@keyup.enter="handleQuery"
/>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="Download"
@click="handleExport"
v-hasPermi="['wms:InvTransHis:export']"
>导出</el-button>
</el-col>
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="InvTransHisList" @selection-change="handleSelectionChange" :show-overflow-tooltip="true">
<el-table-column type="selection" width="30" align="center" />
<el-table-column label="入出库履历号" align="center" prop="invTransNo" />
<el-table-column label="入出库类型" align="center" prop="invTransType" >
<template #default="scope">
<dict-tag :options="wms_inv_trans_type" :value="scope.row.invTransType"/>
</template>
</el-table-column>
<el-table-column label="存储位置" align="center" >
<el-table-column label="仓库代码" align="center" prop="whsCd" />
<el-table-column label="货架号" align="center" prop="stgBinCd" />
</el-table-column>
<el-table-column label="物品代码" align="center" prop="itemCd" />
<el-table-column label="批号" align="center" prop="lotNo" />
<el-table-column label="子批号" align="center" prop="subLotNo" />
<el-table-column label="数量" align="center" >
<el-table-column label="标准单位数量" align="center" prop="stdUnitQty" />
<el-table-column label="标准单位" align="center" prop="stdUnitName" />
<el-table-column label="包装单位数量" align="center" prop="pkgUnitQty" />
<el-table-column label="包装单位" align="center" prop="pkgUnitName" />
</el-table-column>
<el-table-column label="创建者" align="center" prop="createByUser" />
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
<template #default="scope">
<span>{{ parseTime(scope.row.createTime) }}</span>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
v-model:page="queryParams.pageNum"
v-model:limit="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改入出库履历对话框 -->
<!-- <el-dialog :title="title" v-model="open" width="500px" append-to-body>-->
<!-- <el-form ref="InvTransHisRef" :model="form" :rules="rules" label-width="80px">-->
<!-- </el-form>-->
<!-- <template #footer>-->
<!-- <div class="dialog-footer">-->
<!-- <el-button type="primary" @click="submitForm"> </el-button>-->
<!-- <el-button @click="cancel"> </el-button>-->
<!-- </div>-->
<!-- </template>-->
<!-- </el-dialog>-->
</div>
</template>
<script setup name="InvTransHis">
import { listInvTransHis } from "@/api/wms/InvTransHis";
import { listWarehouseInfo } from "@/api/wms/WarehouseInfo";
import DataSelect from "@/components/DataSelect/index.vue";
const { proxy } = getCurrentInstance();
const {wms_inv_trans_type} = proxy.useDict("wms_inv_trans_type");
const InvTransHisList = ref([]);
const open = ref(false);
const loading = ref(false);
const showSearch = ref(true);
const ids = ref([]);
const single = ref(true);
const multiple = ref(true);
const total = ref(0);
const title = ref("");
const data = reactive({
form: {},
queryParams: {
pageNum: 1,
pageSize: 30,
invTransType: null,
whsCd: null,
stgBinCd: null,
itemCd: null,
lotNo: null,
},
});
const { queryParams, form, rules } = toRefs(data);
/** 查询入出库履历列表 */
function getList() {
loading.value = true;
listInvTransHis(queryParams.value).then(response => {
InvTransHisList.value = response.rows;
total.value = response.total;
loading.value = false;
});
}
// 取消按钮
function cancel() {
open.value = false;
reset();
}
// dialog表单重置(目前无用)
function reset() {
// form.value = {
// deptId: null,
// invTransNo: null,
// invTransType: null,
// whsCd: null,
// stgBinCd: null,
// palletId: null,
// stdUnitQty: null,
// pkgUnitQty: null,
// transOrderNo: null,
// transOrderDetlNo: null,
// operator: null,
// businessCls: null,
// itemCd: null,
// lotNo: null,
// subLotNo: null,
// serialNo: null,
// reason: null,
// remark1: null,
// remark2: null,
// remark3: null,
// remark4: null,
// remark5: null,
// updateCount: null,
// deleteFlag: null,
// createBy: null,
// createTime: null,
// updateBy: null,
// updateTime: null,
// remark: null
// };
// proxy.resetForm("InvTransHisRef");
}
/** 搜索按钮操作 */
function handleQuery() {
queryParams.value.pageNum = 1;
getList();
}
/** 重置按钮操作 */
function resetQuery() {
proxy.resetForm("queryRef");
handleQuery();
}
// 多选框选中数据
function handleSelectionChange(selection) {
ids.value = selection.map(item => item.invTransNo);
single.value = selection.length != 1;
multiple.value = !selection.length;
}
/** 导出按钮操作 */
function handleExport() {
proxy.download('wms/InvTransHis/export', {
...queryParams.value
}, `InvTransHis_${new Date().getTime()}.xlsx`)
}
// 获取仓库数据
async function fetchWarehouseData() {
const response = await listWarehouseInfo({})
const dataList = []
response.rows.map(item => {
dataList.push({
label: item.whsName,
value: item.whsCd,
})
})
return dataList
}
//页面打开时查询
//getList();
</script>

View File

@@ -440,7 +440,7 @@ const data = reactive({
form: {},
queryParams: {
pageNum: 1,
pageSize: 20,
pageSize: 30,
itemCd: null,
itemName: null,
},

View File

@@ -125,7 +125,7 @@ const data = reactive({
form: {},
queryParams: {
pageNum: 1,
pageSize: 20,
pageSize: 30,
itemTypeName: null,
remark1: null,
},

View File

@@ -125,7 +125,7 @@ const data = reactive({
form: {},
queryParams: {
pageNum: 1,
pageSize: 20,
pageSize: 30,
unitCode: null,
unitName: null,
},

View File

@@ -173,7 +173,7 @@ const data = reactive({
form: {},
queryParams: {
pageNum: 1,
pageSize: 20,
pageSize: 30,
whsCd: null,
whsName: null,
},