From c1e567ddda7f65651179a8a73ca849b07b066b14 Mon Sep 17 00:00:00 2001
From: zxl <763096477@qq.com>
Date: 星期四, 19 六月 2025 19:58:42 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/dev' into dev

---
 manager/src/views/kitchen/kitchenType.vue |  370 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 370 insertions(+), 0 deletions(-)

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