key 2024-04-16 13:51:50 +08:00
parent ff2efbd604
commit 3ba0674c6b
2 changed files with 150 additions and 31 deletions

View File

@ -43,10 +43,10 @@
</el-col> </el-col>
</el-row> </el-row>
<el-form-item> <el-form-item>
<el-button type="primary" @click="onSubmit"></el-button> <el-button type="primary" @click="MaterialsPage"></el-button>
<el-button type="primary" @click="onSubmit"></el-button> <el-button type="primary" @click="onSubmit"></el-button>
<el-button @click="onSubmit"></el-button> <el-button @click="onSubmit"></el-button>
<el-button type="primary" @click="onSubmit"></el-button> <el-button type="primary" @click="add"></el-button>
<el-button @click="onSubmit" type="warning">删除</el-button> <el-button @click="onSubmit" type="warning">删除</el-button>
<el-button @click="onSubmit"></el-button> <el-button @click="onSubmit"></el-button>
<el-button @click="onSubmit"></el-button> <el-button @click="onSubmit"></el-button>
@ -67,9 +67,9 @@
<div class="main-table common-box"> <div class="main-table common-box">
<div class="tab-hed"> <div class="tab-hed">
<el-select v-model="formInline.region" placeholder="分类" clearable style="width: 200px;"> <el-select v-model="formInline.classify" placeholder="分类" clearable style="width: 200px;">
<el-option label="所有" value="0" /> <el-option label="所有" value="0" />
<el-option :label="item.name" :value="item.id" v-for="item,index in fyListData" :key="index"/> <el-option :label="item.name" :value="item.id" v-for="item, index in fyListData" :key="index" />
</el-select> </el-select>
<div> <div>
<el-button type="success" link <el-button type="success" link
@ -97,7 +97,11 @@
:scroll-y="{ gt: 20 }"> :scroll-y="{ gt: 20 }">
<vxe-column field="codeNum" sortable title="编码" width=""></vxe-column> <vxe-column field="codeNum" sortable title="编码" width=""></vxe-column>
<vxe-column field="name" sortable title="名称" width=""></vxe-column> <vxe-column field="name" sortable title="名称" width=""></vxe-column>
<vxe-column field="isEnable" sortable title="可用状态" width=""></vxe-column> <vxe-column field="isEnable" sortable title="可用状态" width="">
<template #default="{ row }">
<el-switch v-model="row.isEnable" inline-prompt active-text="" inactive-text="" />
</template>
</vxe-column>
<vxe-column field="" sortable title="仓库条码" width=""></vxe-column> <vxe-column field="" sortable title="仓库条码" width=""></vxe-column>
<vxe-column field="createTime" sortable title="创建时间" width=""></vxe-column> <vxe-column field="createTime" sortable title="创建时间" width=""></vxe-column>
@ -105,6 +109,8 @@
<vxe-column title="操作" width="200" fixed="right" show-overflow> <vxe-column title="操作" width="200" fixed="right" show-overflow>
<template #default="{ row }"> <template #default="{ row }">
<vxe-button type="text">查看</vxe-button> <vxe-button type="text">查看</vxe-button>
<vxe-button type="text" @click="editDelete(row.id)"></vxe-button>
<vxe-button @click="matterDelete(row.id)" type="text">删除</vxe-button>
<!-- <vxe-button type="text" icon="vxe-icon-delete"></vxe-button> --> <!-- <vxe-button type="text" icon="vxe-icon-delete"></vxe-button> -->
</template> </template>
</vxe-column> </vxe-column>
@ -118,14 +124,68 @@
</div> </div>
<el-dialog v-model="dialogTableVisible" :title="mTitle" width="850">
<el-form :inline="true" :model="matterFrom" class="demo-form-inline" label-width="70px">
<el-row>
<el-col :span="8">
<el-form-item label="名称">
<el-input v-model="matterFrom.name" placeholder="请输入名称" clearable />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="编码">
<el-input v-model="matterFrom.codeNum" placeholder="请输入编码" clearable />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="分类">
<el-select v-model="matterFrom.classify" placeholder="请选择" clearable>
<el-option label="所有" value="0" />
<el-option :label="item.name" :value="item.id" v-for="item, index in fyListData"
:key="index" />
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<el-form-item label="规格型号">
<el-input v-model="matterFrom.specifications" placeholder="请输入" clearable />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="助记码">
<el-input v-model="matterFrom.simpleNumber" placeholder="请输入" clearable />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="备注">
<el-input v-model="matterFrom.remarks" placeholder="请输入" clearable />
</el-form-item>
</el-col>
</el-row>
<el-col :span="8">
<el-form-item label="可用状态">
<el-switch v-model="matterFrom.isEnable" inline-prompt active-text="" inactive-text="" />
</el-form-item>
</el-col>
</el-form>
<el-row style="display: flex; justify-content: space-around;">
<el-button style="width: 100px;" type="primary" @click="matterSubmit"></el-button>
<el-button style="width: 100px;" @click="dialogTableVisible = false">取消</el-button>
</el-row>
</el-dialog>
</div> </div>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { onMounted, reactive ,ref} from 'vue'; import { onMounted, reactive, ref } from 'vue';
import {getAPI } from '/@/utils/axios-utils'; import { getAPI } from '/@/utils/axios-utils';
import { MaterialClassifyApi,MaterialsApi } from '/@/api-services/api'; import { MaterialClassifyApi, MaterialsApi } from '/@/api-services/api';
import { MaterialsOutput } from '/@/api-services/models'; import { AddMaterialsInput, DeleteMaterialsInput, MaterialsOutput } from '/@/api-services/models';
import { ElMessage } from 'element-plus';
// //
@ -133,32 +193,33 @@ let fyListData = ref();
const fyListGet = async () => { const fyListGet = async () => {
let res = await getAPI(MaterialClassifyApi).apiMaterialClassifyListGet(); let res = await getAPI(MaterialClassifyApi).apiMaterialClassifyListGet();
if(res.data.code === 200){ if (res.data.code === 200) {
fyListData.value = res.data.result; fyListData.value = res.data.result;
} }
} }
onMounted( () => { onMounted(() => {
fyListGet(); fyListGet();
MaterialsPage(); MaterialsPage();
} ) })
// //
const formInline = reactive({ const formInline = reactive({
name:'',// name: '',//
brand:'',// brand: '',//
isEnable:"",// isEnable: "",//
codeNum:'',// codeNum: '',//
simpleNumber:"",// simpleNumber: "",//
specifications:"",// specifications: "",//
classify: ""
}) })
const tableData = ref<MaterialsOutput[]>([]); const tableData = ref<MaterialsOutput[]>([]);
const MaterialsPage = async () => { const MaterialsPage = async (data) => {
let res = await getAPI(MaterialsApi).apiMaterialsPagePost({page:1,pageSize:10}); let res = await getAPI(MaterialsApi).apiMaterialsPagePost({ page: 1, pageSize: 10, ...formInline });
if(res.data.code === 200){ if (res.data.code === 200) {
pageVO1.total = res.data.result?.total!; pageVO1.total = res.data.result?.total!;
tableData.value = res.data.result?.items!; tableData.value = res.data.result?.items!;
} }
@ -168,8 +229,58 @@ const onSubmit = () => {
console.log('submit!') console.log('submit!')
} }
//
let mTitle = ref('新增');
let dialogTableVisible = ref(false);
let matterFrom = reactive({} as AddMaterialsInput)
const add = () => {
dialogTableVisible.value = true;
mTitle.value = '新增';
}
//
const matterSubmit = async () => {
let res;
if (mTitle.value == '新增')
res = await getAPI(MaterialsApi).apiMaterialsAddPost(matterFrom);
else
res = await getAPI(MaterialsApi).apiMaterialsUpdatePost(matterFrom);
if (res.data.code === 200) {
dialogTableVisible.value = false;
ElMessage({
message: '成功',
type: 'success',
})
} else
ElMessage.error(res.data.message!)
MaterialsPage()
}
//
const matterDelete = async (id: any) => {
let res = await getAPI(MaterialsApi).apiMaterialsDeletePost({ id });
if (res.data.code === 200) {
ElMessage({
message: '成功',
type: 'success',
})
MaterialsPage()
} else
ElMessage.error(res.data.message!)
}
//
const editDelete = async (id) => {
let res = await getAPI(MaterialsApi).apiMaterialsDetailGet(id);
if (res.data.code === 200) {
dialogTableVisible.value = true;
mTitle.value = '编辑';
Object.assign(matterFrom,res.data.result)
}
}
const pageVO1 = reactive({ const pageVO1 = reactive({
currentPage: 1, currentPage: 1,
pageSize: 10, pageSize: 10,
@ -207,7 +318,8 @@ const pageVO1 = reactive({
flex: 1; flex: 1;
overflow: scroll; overflow: scroll;
} }
.tab-hed{
.tab-hed {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
margin: 5px; margin: 5px;

View File

@ -74,8 +74,9 @@
</div> </div>
<div style="height: 100%;"> <div style="height: 100%;">
<vxe-table show-overflow height="100%" :data="data.unitGroup" :border=true <vxe-table show-overflow height="100%" :data="data.unitGroup" :border=true
:tree-config="{ transform: true }" :scroll-y="{ gt: 20 }"> :tree-config="{ transform: true }" :scroll-y="{ gt: 20 }" @radio-change="radioChangeEvent">
<vxe-column type="radio" title="单选" width="80" fixed="left"></vxe-column> <vxe-column type="radio" title="单选" width="80" fixed="left">
</vxe-column>
<vxe-column field="name" sortable title="名称" width=""></vxe-column> <vxe-column field="name" sortable title="名称" width=""></vxe-column>
@ -151,16 +152,22 @@ const unitGroup = async () => {
data.unitGroup = res.data.result || []; data.unitGroup = res.data.result || [];
} }
//
const radioChangeEvent = ({ row }) => {
console.log("🚀 ~ clearRadioRowEevnt ~ id:", row.id)
}
const formInline = reactive({ const formInline = reactive({
name:'',// name: '',//
isEnable:"",// isEnable: "",//
codeNum:'',// codeNum: '',//
brevityCode:'',// brevityCode: '',//
}) })
// //
const unitPage = async () => { const unitPage = async () => {
let res = await getAPI(SysUnitApi).apiSysUnitPagePost({page:1,pageSize:10}); let res = await getAPI(SysUnitApi).apiSysUnitPagePost({ page: 1, pageSize: 10 });
data.unit = res.data.result?.items as any; data.unit = res.data.result?.items as any;
pageVO1.total = res.data.result?.total!; pageVO1.total = res.data.result?.total!;
} }