main
parent
ff2efbd604
commit
3ba0674c6b
|
@ -43,10 +43,10 @@
|
|||
</el-col>
|
||||
</el-row>
|
||||
<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 @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">启用</el-button>
|
||||
<el-button @click="onSubmit">禁用</el-button>
|
||||
|
@ -67,9 +67,9 @@
|
|||
|
||||
<div class="main-table common-box">
|
||||
<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="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>
|
||||
<div>
|
||||
<el-button type="success" link
|
||||
|
@ -97,7 +97,11 @@
|
|||
:scroll-y="{ gt: 20 }">
|
||||
<vxe-column field="codeNum" 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="createTime" sortable title="创建时间" width=""></vxe-column>
|
||||
|
@ -105,6 +109,8 @@
|
|||
<vxe-column title="操作" width="200" fixed="right" show-overflow>
|
||||
<template #default="{ row }">
|
||||
<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> -->
|
||||
</template>
|
||||
</vxe-column>
|
||||
|
@ -118,14 +124,68 @@
|
|||
|
||||
</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>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { onMounted, reactive ,ref} from 'vue';
|
||||
import {getAPI } from '/@/utils/axios-utils';
|
||||
import { MaterialClassifyApi,MaterialsApi } from '/@/api-services/api';
|
||||
import { MaterialsOutput } from '/@/api-services/models';
|
||||
import { onMounted, reactive, ref } from 'vue';
|
||||
import { getAPI } from '/@/utils/axios-utils';
|
||||
import { MaterialClassifyApi, MaterialsApi } from '/@/api-services/api';
|
||||
import { AddMaterialsInput, DeleteMaterialsInput, MaterialsOutput } from '/@/api-services/models';
|
||||
import { ElMessage } from 'element-plus';
|
||||
|
||||
//获取物料分类
|
||||
|
||||
|
@ -133,32 +193,33 @@ let fyListData = ref();
|
|||
|
||||
const fyListGet = async () => {
|
||||
let res = await getAPI(MaterialClassifyApi).apiMaterialClassifyListGet();
|
||||
if(res.data.code === 200){
|
||||
if (res.data.code === 200) {
|
||||
fyListData.value = res.data.result;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
onMounted( () => {
|
||||
onMounted(() => {
|
||||
fyListGet();
|
||||
MaterialsPage();
|
||||
} )
|
||||
})
|
||||
|
||||
//获取物料列表数据
|
||||
const formInline = reactive({
|
||||
name:'',//名称
|
||||
brand:'',//品牌
|
||||
isEnable:"",//可用状态
|
||||
codeNum:'',//编码
|
||||
simpleNumber:"",//助记码
|
||||
specifications:"",//规格型号
|
||||
name: '',//名称
|
||||
brand: '',//品牌
|
||||
isEnable: "",//可用状态
|
||||
codeNum: '',//编码
|
||||
simpleNumber: "",//助记码
|
||||
specifications: "",//规格型号
|
||||
classify: ""
|
||||
})
|
||||
|
||||
const tableData = ref<MaterialsOutput[]>([]);
|
||||
|
||||
const MaterialsPage = async () => {
|
||||
let res = await getAPI(MaterialsApi).apiMaterialsPagePost({page:1,pageSize:10});
|
||||
if(res.data.code === 200){
|
||||
const MaterialsPage = async (data) => {
|
||||
let res = await getAPI(MaterialsApi).apiMaterialsPagePost({ page: 1, pageSize: 10, ...formInline });
|
||||
if (res.data.code === 200) {
|
||||
pageVO1.total = res.data.result?.total!;
|
||||
tableData.value = res.data.result?.items!;
|
||||
}
|
||||
|
@ -168,8 +229,58 @@ const onSubmit = () => {
|
|||
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({
|
||||
currentPage: 1,
|
||||
pageSize: 10,
|
||||
|
@ -207,10 +318,11 @@ const pageVO1 = reactive({
|
|||
flex: 1;
|
||||
overflow: scroll;
|
||||
}
|
||||
.tab-hed{
|
||||
|
||||
.tab-hed {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
margin: 5px;
|
||||
margin: 5px;
|
||||
align-items: center;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -74,8 +74,9 @@
|
|||
</div>
|
||||
<div style="height: 100%;">
|
||||
<vxe-table show-overflow height="100%" :data="data.unitGroup" :border=true
|
||||
:tree-config="{ transform: true }" :scroll-y="{ gt: 20 }">
|
||||
<vxe-column type="radio" title="单选" width="80" fixed="left"></vxe-column>
|
||||
:tree-config="{ transform: true }" :scroll-y="{ gt: 20 }" @radio-change="radioChangeEvent">
|
||||
<vxe-column type="radio" title="单选" width="80" fixed="left">
|
||||
</vxe-column>
|
||||
|
||||
<vxe-column field="name" sortable title="名称" width=""></vxe-column>
|
||||
|
||||
|
@ -98,7 +99,7 @@
|
|||
<vxe-column field="name" sortable title="名称" width=""></vxe-column>
|
||||
<vxe-column field="code" sortable title="代码" width=""></vxe-column>
|
||||
|
||||
<vxe-column sortable title="可用状态" width="">
|
||||
<vxe-column sortable title="可用状态" width="">
|
||||
<template #default="{ row }">
|
||||
{{ row.isEnable ? '启用' : '关闭' }}
|
||||
<!-- <vxe-button type="text" icon="vxe-icon-delete"></vxe-button> -->
|
||||
|
@ -151,16 +152,22 @@ const unitGroup = async () => {
|
|||
data.unitGroup = res.data.result || [];
|
||||
}
|
||||
|
||||
//单选
|
||||
|
||||
const radioChangeEvent = ({ row }) => {
|
||||
console.log("🚀 ~ clearRadioRowEevnt ~ id:", row.id)
|
||||
|
||||
}
|
||||
const formInline = reactive({
|
||||
name:'',//名称
|
||||
isEnable:"",//可用状态
|
||||
codeNum:'',//编码
|
||||
brevityCode:'',//简码
|
||||
name: '',//名称
|
||||
isEnable: "",//可用状态
|
||||
codeNum: '',//编码
|
||||
brevityCode: '',//简码
|
||||
})
|
||||
|
||||
//获取单位数据
|
||||
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;
|
||||
pageVO1.total = res.data.result?.total!;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue