Files
erp-next/ruoyi-ui/src/views/bid/category/index.vue
王文昊 41b2e3e772 feat(bid): 完成批量业务优化与功能完善
1.  统一所有表格操作列样式,移除固定宽度避免布局溢出
2.  新增报价单自动编号与脏数据清理功能
3.  优化订单状态筛选与展示逻辑,新增closed状态支持
4.  完善操作日志管理,新增统计分析与详情查看功能
5.  优化报价单流程,调整提交审批逻辑与权限控制
6.  修复客户端订单查询SQL,优化关联查询逻辑
7.  新增报价单提交时自动更新提交时间的功能
2026-06-18 20:17:02 +08:00

121 lines
4.6 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<div class="app-container">
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd(null)">新增根分类</el-button>
</el-col>
</el-row>
<el-table v-loading="loading" :data="categoryList" row-key="categoryId"
:tree-props="{children: 'children', hasChildren: 'hasChildren'}"
border default-expand-all>
<el-table-column label="分类名称" prop="categoryName" min-width="200" />
<el-table-column label="排序" prop="sort" width="80" align="center" />
<el-table-column label="状态" width="80" align="center">
<template slot-scope="scope">
<el-tag :type="scope.row.status === '0' ? 'success' : 'danger'" size="mini">
{{ scope.row.status === '0' ? '启用' : '禁用' }}
</el-tag>
</template>
</el-table-column>
<el-table-column label="操作" class-name="col-ops" align="center">
<template slot-scope="scope">
<el-button size="mini" type="text" icon="el-icon-plus" @click="handleAdd(scope.row)">新增子类</el-button>
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)">修改</el-button>
<el-button size="mini" type="text" icon="el-icon-delete" style="color:#f56c6c" @click="handleDelete(scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table>
<el-dialog :title="dialogTitle" :visible.sync="dialogOpen" width="480px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="90px">
<el-form-item v-if="form.parentId !== null && form.parentId !== undefined" label="父级分类">
<span style="color:#606266">{{ parentName || '根节点' }}</span>
</el-form-item>
<el-form-item label="分类名称" prop="categoryName">
<el-input v-model="form.categoryName" placeholder="请输入分类名称" />
</el-form-item>
<el-row>
<el-col :span="12">
<el-form-item label="排序">
<el-input-number v-model="form.sort" :min="0" :max="999" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="状态">
<el-radio-group v-model="form.status">
<el-radio label="0">启用</el-radio>
<el-radio label="1">禁用</el-radio>
</el-radio-group>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div slot="footer">
<el-button @click="dialogOpen = false">取消</el-button>
<el-button type="primary" @click="submitForm">确定</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { getCategoryList, addCategory, updateCategory, delCategory } from "@/api/bid/category";
export default {
name: "Category",
data() {
return {
loading: false,
categoryList: [],
dialogOpen: false,
dialogTitle: "",
parentName: "",
form: {},
rules: {
categoryName: [{ required: true, message: "分类名称不能为空", trigger: "blur" }]
}
};
},
created() { this.getList(); },
methods: {
getList() {
this.loading = true;
getCategoryList().then(res => {
this.categoryList = res.data || [];
this.loading = false;
}).catch(() => { this.loading = false; });
},
handleAdd(parent) {
this.form = { categoryName: "", parentId: parent ? parent.categoryId : 0, sort: 0, status: "0" };
this.parentName = parent ? parent.categoryName : "";
this.dialogTitle = parent ? "新增子分类(" + parent.categoryName + "" : "新增根分类";
this.dialogOpen = true;
},
handleUpdate(row) {
this.form = { categoryId: row.categoryId, categoryName: row.categoryName, sort: row.sort, status: row.status };
this.dialogTitle = "修改分类";
this.dialogOpen = true;
},
handleDelete(row) {
this.$modal.confirm("确认删除分类【" + row.categoryName + "】?子分类也将被删除!").then(() => {
return delCategory(row.categoryId);
}).then(() => {
this.$modal.msgSuccess("删除成功");
this.getList();
});
},
submitForm() {
this.$refs.form.validate(valid => {
if (!valid) return;
const action = this.form.categoryId ? updateCategory : addCategory;
action(this.form).then(() => {
this.$modal.msgSuccess("保存成功");
this.dialogOpen = false;
this.getList();
});
});
}
}
};
</script>