From 9095d5c5ac226f74615fdc4fca2d7db331684592 Mon Sep 17 00:00:00 2001
From: peng <peng.com>
Date: 星期五, 13 六月 2025 14:59:32 +0800
Subject: [PATCH] insert 完成厨神标签后台页面及接口对接(增删改查)
---
manager/src/api/kitchen.js | 41 +++++
manager/src/views/kitchen/kitchenType.vue | 370 ++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 411 insertions(+), 0 deletions(-)
diff --git a/manager/src/api/kitchen.js b/manager/src/api/kitchen.js
new file mode 100644
index 0000000..e66be77
--- /dev/null
+++ b/manager/src/api/kitchen.js
@@ -0,0 +1,41 @@
+import service from "@/libs/axios";
+
+// 绁炲帹鍒嗛〉
+export const getKitchenType = (data) => {
+ return service({
+ url: "/lmk/kitchen-type/page",
+ method: "GET",
+ params: data
+ })
+}
+// 娣诲姞绁炲帹鏍囩
+export const addKitchenType = (data) => {
+ return service({
+ url: "/lmk/kitchen-type",
+ method: "POST",
+ data: data
+ })
+}
+// 娣诲姞绁炲帹鏍囩
+export const editKitchenType = (data) => {
+ return service({
+ url: "/lmk/kitchen-type",
+ method: "PUT",
+ data: data
+ })
+}
+// 鍒犻櫎绁炲帹鏍囩
+export const delKitchenType = (id) => {
+ return service({
+ url: "/lmk/kitchen-type/"+id,
+ method: "DELETE",
+ })
+}
+// 鎵归噺鍒犻櫎绁炲帹鏍囩
+export const deleteBatch = (data) => {
+ return service({
+ url: "/lmk/kitchen-type/batch",
+ method: "DELETE",
+ data: data
+ })
+}
diff --git a/manager/src/views/kitchen/kitchenType.vue b/manager/src/views/kitchen/kitchenType.vue
new file mode 100644
index 0000000..7123251
--- /dev/null
+++ b/manager/src/views/kitchen/kitchenType.vue
@@ -0,0 +1,370 @@
+<template>
+ <div>
+ <Card>
+ <Form
+ ref="searchForm"
+ @keydown.enter.native="handleSearch"
+ :model="searchForm"
+ inline
+ :label-width="70"
+ class="search-form"
+ >
+ <Form-item label="鏍囩鍚嶇О" prop="typeName">
+ <Input
+ type="text"
+ v-model="searchForm.typeName"
+ clearable
+ @on-clear="handleSearch"
+ @on-change="handleSearch"
+ style="width: 160px"
+ />
+ </Form-item>
+ <Button
+ @click="handleSearch"
+ type="primary"
+ icon="ios-search"
+ class="search-btn"
+ >鎼滅储</Button
+ >
+ </Form>
+
+ <Row class="operation padding-row">
+ <Button @click="openAdd" type="info">娣诲姞</Button>
+ <Button @click="delBatch" type="error">鎵归噺鍒犻櫎</Button>
+ </Row>
+
+ <Modal
+ v-model="modelShow"
+ :title="modelTitle"
+ >
+ <Form ref="form" :model="form" :label-width="70" :rules="rules">
+ <Row :gutter="24">
+ <Col span="12">
+ <FormItem label="鏍囩鍚嶇О" prop="typeName">
+ <Input v-model="form.typeName" autocomplete="off"/>
+ </FormItem>
+ </Col>
+ <Col span="12">
+ <FormItem label="鎺掑簭" prop="sortNum">
+ <Input v-model="form.sortNum" autocomplete="off"/>
+ </FormItem>
+ </Col>
+ </Row>
+ </Form>
+ <div slot="footer">
+ <Button type="text" @click="modelClose">鍙栨秷</Button>
+ <Button type="primary" :loading="submitLoading" @click="saveOrUpdate">鎻愪氦</Button>
+ </div>
+ </Modal>
+
+ <Table
+ :loading="loading"
+ border
+ :columns="columns"
+ :data="data"
+ ref="table"
+ sortable="custom"
+ @on-sort-change="changeSort"
+ @on-selection-change="showSelect"
+ >
+ <template slot-scope="{ row, index }" slot="action">
+ <Button type="info" size="small" style="margin-right: 5px" @click="openEdit(row)">缂栬緫</Button>
+ <Button type="error" size="small" @click="delById(row)">鍒犻櫎</Button>
+ </template>
+ </Table>
+
+ <Row type="flex" justify="end" class="mt_10">
+ <Page
+ :current="searchForm.pageNumber"
+ :total="total"
+ :page-size="searchForm.pageSize"
+ @on-change="changePage"
+ @on-page-size-change="changePageSize"
+ :page-size-opts="[10, 20, 50]"
+ size="small"
+ show-total
+ show-elevator
+ show-sizer
+ ></Page>
+ </Row>
+ </Card>
+ </div>
+</template>
+
+<script>
+import JsonExcel from "vue-json-excel";
+import {deleteVideoTagById, getVideoTags, editVideoTag, addVideoTag, deleteVideoTagByIds} from "@/api/videoTag";
+import {addKitchenType, deleteBatch, delKitchenType, editKitchenType, getKitchenType} from "@/api/kitchen";
+export default {
+ name: "VideoTagList",
+ components: {
+ "download-excel": JsonExcel,
+ },
+ data() {
+ return {
+ // 淇濆瓨鍔犺浇
+ submitLoading: false,
+ // 鏂板淇敼琛ㄥ崟
+ form: {
+ id: '',
+ typeName: '',
+ sortNum: '',
+ },
+ rules: {
+ typeName: [
+ {required: true, message: "鏍囩鍚嶇О涓嶈兘涓虹┖", trigger: "blur",
+ validator: (rule, value, callback) => {
+ if (value === null || value === '') {
+ callback(new Error('鏍囩鍚嶇О涓嶈兘涓虹┖'));
+ } else {
+ callback();
+ }
+ }
+ }
+ ],
+ sortNum : [
+ {required: true, message: "搴忓彿涓嶈兘涓虹┖", trigger: "blur",
+ validator: (rule, value, callback) => {
+ if (value === null || value === '') {
+ callback(new Error('搴忓彿涓嶈兘涓虹┖'));
+ } else {
+ callback();
+ }
+ }}
+ ],
+ },
+ modelShow: false, // 寮圭獥鏄鹃殣
+ modelTitle: '', // 寮圭獥title
+ // 琛ㄦ牸鐨勮〃澶翠互鍙婂唴瀹�
+ fields: {
+ 绫诲瀷: "tagName",
+ 寮曠敤娆℃暟: "useNum",
+ 鎺掑簭: "sort_num",
+ 鎿嶄綔: "action"
+ },
+ loading: true, // 琛ㄥ崟鍔犺浇鐘舵��
+ searchForm: {
+ // 鎼滅储妗嗗垵濮嬪寲瀵硅薄
+ pageNumber: 1, // 褰撳墠椤垫暟
+ pageSize: 10, // 椤甸潰澶у皬
+ typeName: '', // 鏍囩鍚嶇О
+ },
+ selectDate: null,
+ columns: [
+ {
+ type: 'selection',
+ width: 60,
+ align: 'center'
+ },
+ {
+ title: "鏍囩",
+ key: "typeName",
+ minWidth: 170,
+ tooltip: true,
+ },
+ // {
+ // title: "寮曠敤娆℃暟",
+ // key: "useNum",
+ // width: 170,
+ // sortable: true
+ // },
+ {
+ title: "鎺掑簭",
+ key: "sortNum",
+ width: 400,
+ },
+ {
+ title: "鎿嶄綔",
+ key: "action",
+ slot: "action",
+ align: "center",
+ width: 400,
+ },
+ ],
+ data: [], // 琛ㄥ崟鏁版嵁
+ total: 0, // 琛ㄥ崟鏁版嵁鎬绘暟
+ selectCount: 0, // 宸查�夋暟閲�
+ selectList: [], // 宸查�夋暟鎹垪琛�
+ };
+ },
+ methods: {
+ showSelect(e) {
+ this.selectList = e.map(d => d.id);
+ this.selectCount = e.length;
+ },
+ // 鎺掑簭
+ changeSort(e) {
+ this.searchForm.sort = e.key;
+ this.searchForm.order = e.order;
+ if (e.order == "normal") {
+ this.searchForm.order = "";
+ }
+ this.getDataList();
+ },
+ // 鎵归噺鍒犻櫎
+ delBatch() {
+ if (this.selectCount <= 0) {
+ this.$Message.warning("鎮ㄨ繕鏈�夋嫨瑕佸垹闄ょ殑鏁版嵁");
+ return;
+ }
+ this.$Modal.confirm({
+ title: "纭鍒犻櫎",
+ content: "鎮ㄧ‘璁よ鍒犻櫎鎵�閫夌殑 " + this.selectCount + " 鏉℃暟鎹�?",
+ loading: true,
+ onOk: () => {
+ deleteBatch(this.selectList).then(res => {
+ this.$Modal.remove();
+ if (res.code == 200) {
+ this.$Message.success("鍒犻櫎鎴愬姛");
+ this.selectList = [];
+ this.selectCount = 0;
+ this.getDataList();
+ }
+ });
+ }
+ });
+ },
+ // id鍒犻櫎
+ delById(row) {
+ this.$Modal.confirm({
+ title: "纭鍒犻櫎",
+ content: "鎮ㄧ‘璁よ鍒犻櫎鏍囩锛� " + row.typeName + " ?",
+ loading: true,
+ onOk: () => {
+ delKitchenType(row.id).then(res => {
+ this.$Modal.remove();
+ if (res.code == 200) {
+ this.$Message.success("鍒犻櫎鎴愬姛");
+ this.getDataList();
+ }
+ });
+ }
+ });
+ },
+ // 鎵撳紑鏂板
+ openAdd() {
+ this.modelTitle = "鏂板鏍囩"
+ this.modelShow = true
+ this.form ={}
+ },
+ // 鎵撳紑淇敼
+ openEdit(row) {
+ this.modelTitle = "淇敼鏍囩"
+ this.form = {};
+ this.form.id = row.id
+ this.form.typeName = row.typeName
+ this.form.sortNum = row.sortNum
+ this.modelShow = true
+ console.log(this.form)
+ },
+ // 鏂板鎴栦慨鏀�
+ saveOrUpdate() {
+ this.$refs.form.validate(valid => {
+ try {
+ if (valid) {
+ this.submitLoading = true
+ if (this.form.id) {
+ // 淇敼
+ editKitchenType(this.form).then(res => {
+ if (res.code == 200) {
+ this.$Message.success("淇敼鎴愬姛");
+ this.modelClose()
+ this.getDataList()
+ }
+ })
+ } else {
+ // 鏂板
+ addKitchenType(this.form).then(res => {
+ if (res.code == 200) {
+ this.$Message.success("娣诲姞鎴愬姛");
+ this.modelClose()
+ this.getDataList()
+ }
+ })
+ }
+ }
+ }finally {
+ this.submitLoading = false
+ }
+ });
+ },
+ // 鍏抽棴寮圭獥
+ modelClose() {
+ this.submitLoading = false
+ this.modelShow = false
+ },
+ // 鍒濆鍖栨暟鎹�
+ init() {
+ this.getDataList();
+ },
+ // 鍒嗛〉 鏀瑰彉椤电爜
+ changePage(v) {
+ this.searchForm.pageNumber = v;
+ this.getDataList();
+ },
+ // 鍒嗛〉 鏀瑰彉椤垫暟
+ changePageSize(v) {
+ this.searchForm.pageNumber = 1;
+ this.searchForm.pageSize = v;
+ this.getDataList();
+ },
+ // 鎼滅储
+ handleSearch() {
+ this.searchForm.pageNumber = 1;
+ this.searchForm.pageSize = 10;
+ this.getDataList();
+ },
+ // 璧锋鏃堕棿浠庢柊璧嬪��
+ selectDateRange(v) {
+ if (v) {
+ this.searchForm.startDate = v[0];
+ this.searchForm.endDate = v[1];
+ }
+ },
+ // 鑾峰彇鍒楄〃鏁版嵁
+ getDataList() {
+ this.loading = true;
+ getKitchenType(this.searchForm).then((res) => {
+ console.log(res)
+ this.loading = false;
+ if (res.code == 200) {
+ this.data = res.data;
+ this.total = res.total;
+ }
+ });
+ this.total = this.data.length;
+ this.loading = false;
+ },
+ },
+ mounted() {
+ this.init();
+ },
+};
+</script>
+<style lang="scss" scoped>
+.export {
+ margin: 10px 20px 10px 0;
+}
+.export-excel-wrapper {
+ display: inline;
+}
+.order-tab {
+ width: 950px;
+ height: 36px;
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ background-color: #f0f0f0;
+ padding: 0 10px;
+ margin-bottom: 10px;
+ div {
+ text-align: center;
+ padding: 4px 12px;
+ border-radius: 4px;
+ cursor: pointer;
+ }
+ .current {
+ background-color: #ffffff;
+ }
+}
+</style>
--
Gitblit v1.8.0