feat: 耗材分组
This commit is contained in:
@@ -542,6 +542,16 @@ export const constantRoutes: RouteRecordRaw[] = [
|
|||||||
hidden: true
|
hidden: true
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: "classification",
|
||||||
|
component: () => import("@/views/inventory/classification.vue"),
|
||||||
|
name: "classification",
|
||||||
|
meta: {
|
||||||
|
title: "分类管理",
|
||||||
|
affix: false,
|
||||||
|
hidden: true
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
@@ -619,7 +629,7 @@ export const constantRoutes: RouteRecordRaw[] = [
|
|||||||
{
|
{
|
||||||
path: "index",
|
path: "index",
|
||||||
component: () => import("@/views/mytemplate/index.vue"),
|
component: () => import("@/views/mytemplate/index.vue"),
|
||||||
name: "orderIndex",
|
name: "mytemplate",
|
||||||
meta: {
|
meta: {
|
||||||
title: "我的模板",
|
title: "我的模板",
|
||||||
affix: false,
|
affix: false,
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
<template>
|
<template>
|
||||||
<!-- 结款记录 -->
|
<!-- 结款记录 -->
|
||||||
<div style="padding: 15px;">
|
<div style="padding: 15px;">结款记录
|
||||||
<!-- 搜索 -->
|
<!-- 搜索 -->
|
||||||
<Search></Search>
|
<!-- <Search></Search> -->
|
||||||
<!-- 数据统计 -->
|
<!-- 数据统计 -->
|
||||||
<DataStatistics></DataStatistics>
|
<!-- <DataStatistics></DataStatistics> -->
|
||||||
<!-- 表格 -->
|
<!-- 表格 -->
|
||||||
<Content></Content>
|
<!-- <Content></Content> -->
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script setup>
|
<script setup>
|
||||||
|
|||||||
10
src/views/inventory/classification.vue
Normal file
10
src/views/inventory/classification.vue
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
<template>
|
||||||
|
<!-- 分类模块 -->
|
||||||
|
<div style="padding: 15px;">
|
||||||
|
<!-- 表格 -->
|
||||||
|
<Content></Content>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<script setup>
|
||||||
|
import Content from './classification/Content.vue'
|
||||||
|
</script>
|
||||||
157
src/views/inventory/classification/Content.vue
Normal file
157
src/views/inventory/classification/Content.vue
Normal file
@@ -0,0 +1,157 @@
|
|||||||
|
<template>
|
||||||
|
<div class="Table">
|
||||||
|
<!-- 按钮 -->
|
||||||
|
<AddButton @add="add"></AddButton>
|
||||||
|
<!-- 表格 -->
|
||||||
|
<Table :list="datas.tableData" @handleDelete="handleDelete" @handleEdit="handleEdit"
|
||||||
|
@handleStatusChange="handleStatusChange"></Table>
|
||||||
|
<!-- 分页 -->
|
||||||
|
<Paging :pagingConfig="datas.pagingConfig" @sizeChange="sizeChange" @currentChange="currentChange"></Paging>
|
||||||
|
<!-- 其他模板 -->
|
||||||
|
<!-- 新增/编辑 -->
|
||||||
|
<myDialog ref="myDialogRef" :title="datas.title" @confirm="confirm" width="30%">
|
||||||
|
<el-form ref="ruleFormRef" :rules="datas.rules" :model="datas.DialogForm" label-width="120px">
|
||||||
|
<el-form-item label="耗材类型名称" prop="name">
|
||||||
|
<el-input v-model="datas.DialogForm.name" placeholder="请输入供应商名称" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="是否禁用">
|
||||||
|
<el-switch v-model="datas.DialogForm.status" :active-value="1" :inactive-value="0" active-color="#13ce66"
|
||||||
|
inactive-color="#ff4949" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
</myDialog>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<script setup>
|
||||||
|
import AddButton from './component/AddButton.vue'
|
||||||
|
import Table from './component/Table.vue'
|
||||||
|
import Paging from './component/Paging.vue'
|
||||||
|
import myDialog from '@/components/mycomponents/myDialog.vue'
|
||||||
|
import eventBus from '@/utils/eventBus'
|
||||||
|
import API from './api'
|
||||||
|
|
||||||
|
const datas = reactive({
|
||||||
|
tableData: [], // 表格数据
|
||||||
|
title: '新增数据',
|
||||||
|
pagingConfig: {
|
||||||
|
total: 0, // 总数
|
||||||
|
pageSize: 10, // 每页数据数量
|
||||||
|
pageNumber: 1, // 当前页码
|
||||||
|
},
|
||||||
|
DialogForm: { // 弹窗表单数据
|
||||||
|
status: 1
|
||||||
|
},
|
||||||
|
rules: {
|
||||||
|
name: [
|
||||||
|
{ required: true, message: '请输入供应商名称', trigger: 'blur' },
|
||||||
|
], switch: [
|
||||||
|
{ required: true, message: ' ', trigger: 'blur' },
|
||||||
|
],
|
||||||
|
|
||||||
|
}
|
||||||
|
})
|
||||||
|
const myDialogRef = ref(null)
|
||||||
|
const ruleFormRef = ref(null)
|
||||||
|
onMounted(() => {
|
||||||
|
getList()
|
||||||
|
})
|
||||||
|
eventBus.on('search', (res) => {
|
||||||
|
getList(res)
|
||||||
|
})
|
||||||
|
async function getList(data = {}) {
|
||||||
|
const res = await API.getPage({ page: datas.pagingConfig.pageNumber, size: datas.pagingConfig.pageSize, ...data })
|
||||||
|
datas.tableData = res.records
|
||||||
|
datas.pagingConfig.total = res.totalRow
|
||||||
|
datas.pagingConfig.pageSize = res.pageSize
|
||||||
|
datas.pagingConfig.pageNumber = res.pageNumber
|
||||||
|
}
|
||||||
|
function add() {
|
||||||
|
rest()
|
||||||
|
datas.title = '新增数据'
|
||||||
|
myDialogRef.value.open()
|
||||||
|
}
|
||||||
|
async function handleEdit(row) {
|
||||||
|
datas.title = '编辑数据'
|
||||||
|
const res = await API.getinfo(row.id)
|
||||||
|
datas.DialogForm = res
|
||||||
|
myDialogRef.value.open()
|
||||||
|
}
|
||||||
|
// 修改状态
|
||||||
|
async function handleStatusChange(row) {
|
||||||
|
let res = null
|
||||||
|
if (row.status == 1) {
|
||||||
|
res = await API.onOff(row.id)
|
||||||
|
} else {
|
||||||
|
res = await API.onOff2(row.id)
|
||||||
|
}
|
||||||
|
if (res.code == 200) {
|
||||||
|
getList()
|
||||||
|
ElMessage({
|
||||||
|
message: '成功',
|
||||||
|
type: 'success',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
async function confirm() {
|
||||||
|
ruleFormRef.value.validate(async valid => {
|
||||||
|
if (valid) {
|
||||||
|
let res = null
|
||||||
|
if (datas.title == '新增数据') {
|
||||||
|
res = await API.add(datas.DialogForm)
|
||||||
|
} else {
|
||||||
|
res = await API.update(datas.DialogForm)
|
||||||
|
}
|
||||||
|
if (res.code == 200) {
|
||||||
|
ElMessage({
|
||||||
|
message: '成功',
|
||||||
|
type: 'success',
|
||||||
|
})
|
||||||
|
rest()
|
||||||
|
getList()
|
||||||
|
myDialogRef.value.close()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
// 重置
|
||||||
|
function rest() {
|
||||||
|
datas.DialogForm = { sort: "1" }
|
||||||
|
}
|
||||||
|
async function handleDelete(id) {
|
||||||
|
ElMessageBox.confirm("是否删除数据项?", "提示", {
|
||||||
|
confirmButtonText: "确定",
|
||||||
|
cancelButtonText: "取消",
|
||||||
|
type: "warning",
|
||||||
|
}).then(
|
||||||
|
async () => {
|
||||||
|
let res = await API.deleteByIds(id)
|
||||||
|
if (res.code == 200) {
|
||||||
|
ElMessage({
|
||||||
|
message: '删除成功',
|
||||||
|
type: 'success',
|
||||||
|
})
|
||||||
|
getList()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
// 分页
|
||||||
|
function sizeChange(val) {
|
||||||
|
datas.pagingConfig.pageSize = val
|
||||||
|
getList()
|
||||||
|
}
|
||||||
|
function currentChange(val) {
|
||||||
|
datas.pagingConfig.pageNumber = val
|
||||||
|
getList()
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
||||||
|
<style scoped lang="scss">
|
||||||
|
.Table {
|
||||||
|
padding: 20px;
|
||||||
|
background-color: #fff;
|
||||||
|
border: 1px solid #e4e7ed;
|
||||||
|
margin-top: 20px;
|
||||||
|
border-radius: 4px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
73
src/views/inventory/classification/api.ts
Normal file
73
src/views/inventory/classification/api.ts
Normal file
@@ -0,0 +1,73 @@
|
|||||||
|
import request from "@/utils/request";
|
||||||
|
const baseURL = "/product/admin/product/cons-group";
|
||||||
|
// 耗材-配置
|
||||||
|
const AuthAPI = {
|
||||||
|
// 列表
|
||||||
|
getList(params: any) {
|
||||||
|
return request<any, Responseres>({
|
||||||
|
url: `${baseURL}/list`,
|
||||||
|
method: "get",
|
||||||
|
params,
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/** 分页*/
|
||||||
|
getPage(params: any) {
|
||||||
|
return request<any, Responseres>({
|
||||||
|
url: `${baseURL}/page`,
|
||||||
|
method: "get",
|
||||||
|
params,
|
||||||
|
});
|
||||||
|
},
|
||||||
|
// 新增
|
||||||
|
add(data: any) {
|
||||||
|
return request<any, Responseres>({
|
||||||
|
url: `${baseURL}`,
|
||||||
|
method: "post",
|
||||||
|
data: { ...data },
|
||||||
|
});
|
||||||
|
},
|
||||||
|
// 详情
|
||||||
|
getinfo(id: number) {
|
||||||
|
return request<any, Responseres>({
|
||||||
|
url: `${baseURL}/${id}`,
|
||||||
|
method: "get",
|
||||||
|
});
|
||||||
|
},
|
||||||
|
// 编辑
|
||||||
|
update(data: Object) {
|
||||||
|
return request<any, Responseres>({
|
||||||
|
url: `${baseURL}`,
|
||||||
|
method: "put",
|
||||||
|
data,
|
||||||
|
});
|
||||||
|
},
|
||||||
|
// 删除
|
||||||
|
deleteByIds(id: number | String) {
|
||||||
|
return request<any, Responseres>({
|
||||||
|
url: `${baseURL}/${id}`,
|
||||||
|
method: "delete",
|
||||||
|
});
|
||||||
|
},
|
||||||
|
// 修改状态-启用
|
||||||
|
onOff(id: number | String) {
|
||||||
|
return request<any, Responseres>({
|
||||||
|
url: `${baseURL}/enable/${id}`,
|
||||||
|
method: "post",
|
||||||
|
});
|
||||||
|
},
|
||||||
|
// 修改状态-禁用
|
||||||
|
onOff2(id: number | String) {
|
||||||
|
return request<any, Responseres>({
|
||||||
|
url: `${baseURL}/disable/${id}`,
|
||||||
|
method: "post",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
export interface Responseres {
|
||||||
|
code?: number | null;
|
||||||
|
data?: any;
|
||||||
|
msg?: null | string;
|
||||||
|
[property: string]: any;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default AuthAPI;
|
||||||
11
src/views/inventory/classification/component/AddButton.vue
Normal file
11
src/views/inventory/classification/component/AddButton.vue
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
<template>
|
||||||
|
<el-button type="success" icon="Plus" @click="addEvent">新增</el-button>
|
||||||
|
</template>
|
||||||
|
<script setup>
|
||||||
|
import { useRouter } from 'vue-router';
|
||||||
|
const router = useRouter();
|
||||||
|
const emit = defineEmits(['add']);
|
||||||
|
function addEvent() {
|
||||||
|
emit('add');
|
||||||
|
}
|
||||||
|
</script>
|
||||||
24
src/views/inventory/classification/component/Paging.vue
Normal file
24
src/views/inventory/classification/component/Paging.vue
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
<template>
|
||||||
|
<div style="margin-top: 10px;">
|
||||||
|
<el-pagination background :page-size="props.pagingConfig.pageSize" :page-sizes="[10, 20, 30, 40]"
|
||||||
|
layout="prev,pager,next,jumper,total,sizes" v-model:current-page="props.pagingConfig.pageNumber"
|
||||||
|
:total="props.pagingConfig.total" @size-change="handleSizeChange" @current-change="handleCurrentChange" />
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<script setup>
|
||||||
|
const props = defineProps({
|
||||||
|
pagingConfig: {
|
||||||
|
type: Object,
|
||||||
|
default: () => { }
|
||||||
|
}
|
||||||
|
})
|
||||||
|
const emit = defineEmits(['sizeChange', 'currentChange'])
|
||||||
|
// 当前条改变
|
||||||
|
function handleSizeChange(val) {
|
||||||
|
emit('sizeChange', val)
|
||||||
|
}
|
||||||
|
// 当前页改变
|
||||||
|
function handleCurrentChange(val) {
|
||||||
|
emit('currentChange', val)
|
||||||
|
}
|
||||||
|
</script>
|
||||||
42
src/views/inventory/classification/component/Table.vue
Normal file
42
src/views/inventory/classification/component/Table.vue
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
<template>
|
||||||
|
<div style="margin-top: 10px;">
|
||||||
|
<el-table :data="props.list" border style="width: 100%">
|
||||||
|
<el-table-column prop="id" align="center" label="ID" />
|
||||||
|
<el-table-column prop="name" align="center" label="耗材类型名称" />
|
||||||
|
<el-table-column prop="status" align="center" label="状态">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-switch v-model="scope.row.status" :active-value="1" :inactive-value="0" active-color="#13ce66"
|
||||||
|
inactive-color="#ff4949" @change="handleStatusChange(scope.row)" />
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="操作" align="center">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-button size="small" type="primary" link icon="Edit" @click="handleEdit(scope.row)">编辑</el-button>
|
||||||
|
<!-- <el-button size="small" type="danger" link icon="Delete" style="color: #f89797;"
|
||||||
|
@click="handleDelete(scope.$index, scope.row)"> 删除 </el-button> -->
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
const emit = defineEmits(['handleDelete', 'handleEdit', 'handleStatusChange'])
|
||||||
|
const props = defineProps({
|
||||||
|
list: {
|
||||||
|
type: Array,
|
||||||
|
default: () => []
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
function handleEdit(row) {
|
||||||
|
emit('handleEdit', row)
|
||||||
|
}
|
||||||
|
function handleDelete(index, row) {
|
||||||
|
emit('handleDelete', row.id)
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleStatusChange(row) {
|
||||||
|
emit('handleStatusChange', row)
|
||||||
|
}
|
||||||
|
</script>
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
<el-button type="success" icon="Plus">新增</el-button>
|
<el-button type="success" icon="Plus">新增</el-button>
|
||||||
<el-button>入库</el-button>
|
<el-button>入库</el-button>
|
||||||
<el-button>出库</el-button>
|
<el-button>出库</el-button>
|
||||||
<el-button>分类管理</el-button>
|
<el-button @click="toUrl('classification')">分类管理</el-button>
|
||||||
<el-button @click="toUrl('supplier')">供应商管理</el-button>
|
<el-button @click="toUrl('supplier')">供应商管理</el-button>
|
||||||
</template>
|
</template>
|
||||||
<script setup>
|
<script setup>
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
<template>
|
<template>
|
||||||
<div style="margin-top: 10px;">
|
<div style="margin-top: 10px;">
|
||||||
<el-table :data="props.list" border style="width: 100%">
|
<el-table :data="props.list" border style="width: 100%">
|
||||||
<el-table-column prop="date" label="Date" width="180" />
|
<el-table-column prop="date" align="center" label="Date" width="180" />
|
||||||
<el-table-column prop="name" label="Name" width="180" />
|
<el-table-column prop="name" align="center" label="Name" width="180" />
|
||||||
<el-table-column prop="address" label="Address" />
|
<el-table-column prop="address" align="center" label="Address" />
|
||||||
<el-table-column label="操作">
|
<el-table-column label="操作" align="center">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-button size="small" type="primary" link icon="Edit" @click="handleEdit(scope.row)">编辑</el-button>
|
<el-button size="small" type="primary" link icon="Edit" @click="handleEdit(scope.row)">编辑</el-button>
|
||||||
<el-button size="small" type="danger" link icon="Delete" style="color: #f89797;"
|
<el-button size="small" type="danger" link icon="Delete" style="color: #f89797;"
|
||||||
@@ -16,7 +16,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
const emit = defineEmits(['handleDelete'])
|
const emit = defineEmits(['handleDelete', 'handleEdit'])
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
list: {
|
list: {
|
||||||
type: Array,
|
type: Array,
|
||||||
@@ -27,7 +27,7 @@ const props = defineProps({
|
|||||||
function handleEdit(row) {
|
function handleEdit(row) {
|
||||||
emit('handleEdit', row)
|
emit('handleEdit', row)
|
||||||
}
|
}
|
||||||
async function handleDelete(index, row) {
|
function handleDelete(index, row) {
|
||||||
emit('handleDelete', row.id)
|
emit('handleDelete', row.id)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user