浏览代码

评论模块前端

elis 2 年之前
父节点
当前提交
478d7a8210

+ 1 - 1
nngkxxdp/src/main/resources/static/naqwzsjtj/naqwzsjtj/src/api/index.js

@@ -296,7 +296,7 @@ export default {
   // 删除供应时间
   // 删除供应时间
   deleteSupplyTimeById(data) {
   deleteSupplyTimeById(data) {
     return request.post('supplyTime/delete', data)
     return request.post('supplyTime/delete', data)
-  }
+  },
 
 
   // 评论单个查询
   // 评论单个查询
   queryEvaluationById(data) {
   queryEvaluationById(data) {

+ 428 - 0
nngkxxdp/src/main/resources/static/naqwzsjtj/naqwzsjtj/src/views/canteen/EvaluationManage.vue

@@ -1,8 +1,436 @@
 <template>
 <template>
+  <div class="yxnaContent">
+    <!--操作栏-->
+    <div style="display: flex;justify-content: space-between;margin-bottom: 10px">
+      <div>
+<!--        <el-button type="primary" class="add" @click="openAddWork">新增</el-button>-->
+<!--        <el-button type="primary" class="add" style="margin-left: 10px"-->
+<!--                   @click="upload.open = true;upload.fileList = []">导入-->
+<!--        </el-button>-->
+      </div>
+      <div style="display: flex">
+        <el-input v-model.trim="query.dishesName" clearable placeholder="请输入菜品名称"
+                  style="margin: 0 10px;width: 200px" />
+        <el-button type="primary" class="search" @click="searchData">搜索</el-button>
+        <el-button type="primary" class="search" @click="reset" style="margin-left: 5px">重置</el-button>
+      </div>
+    </div>
+    <!--表格-->
+    <el-table :data="tableData" border ref='multipleTable' :height="tableH" stripe
+              :header-cell-style="{ background: '#e5e8ed', color: '#666', textAlign: 'center' }" :cell-style="tableStyle"
+              style="cursor: default">
+      <el-table-column width="50" label="序号">
+        <template slot-scope="scope">
+          {{ (sorts.page - 1) * sorts.limit + scope.$index + 1 }}
+        </template>
+      </el-table-column>
+      <el-table-column prop="dishesName" label="食堂名称" />
+      <el-table-column prop="typeName" label="菜品名称" />
+      <el-table-column prop="typeName" label="用户名" />
+      <el-table-column prop="typeName" label="评分" />
+      <el-table-column prop="typeName" label="评论" />
+      <el-table-column prop="createTime" label="创建时间" />
+      <el-table-column prop="updateTime" label="更新时间" />
+      <el-table-column label="操作" width="230">
+        <template slot-scope="scope">
+          <el-button class="btn" type="primary" @click="info(scope.row)">详情</el-button>
+          <el-button class="but" type="warning" @click="markEvaluation(scope.row.id)">
+            违规禁用</el-button>
+          <el-button class="but" type="danger" @click="handleDelete(scope.row.id, scope.$index)">删除
+          </el-button>
+        </template>
+      </el-table-column>
+    </el-table>
+    <div class="block">
+      <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
+                     :current-page="sorts.page" :page-sizes="[10, 20, 30, 40, 50]" :page-size="sorts.limit"
+                     layout="prev, pager,next,jumper,total,sizes" :total="total">
+      </el-pagination>
+    </div>
+
+  </div>
 </template>
 </template>
 
 
 <script>
 <script>
+import api from '../../api/index'
+
+export default {
+  name: 'EvaluationManage',
+  created() {
+    this.getData()
+  },
+  data() {
+    return {
+      tableStyle: {
+        textAlign: 'center',
+      },
+      tableH: 'calc(100vh - 230px)',
+      // 搜索参数
+      query: {
+        dishesName: ''
+      },
+      // 列表数据
+      tableData: [],
+      // 菜品类型数据
+      typeData: [],
+      // 总数
+      total: 0,
+      // 菜品类型总数
+      typeTotal: 0,
+      // 上传相关
+      upload: {
+        open: false,
+        isUploading: false,
+        file: null,
+        fileList: []
+      },
+      // 图片
+      picList: [],
+      //新增/编辑界面
+      workDialog: false,
+      // 菜品类型界面
+      typeVisible: false,
+      //新增/编辑标题
+      workTitle: '新增菜品',
+      // 新增/编辑表单
+      postManagement: {
+        dishesName: '',
+        typeId: '',
+        typeName: '',
+        pic: []
+      },
+      // 分页
+      sorts: {
+        page: 1,
+        limit: 10,
+      },
+      // 菜品类型分页
+      typeSorts: {
+        page: 1,
+        limit: 10,
+        typeName: ''
+      },
+    }
+  },
+  methods: {
+    //切换列表条数
+    handleSizeChange(pageSize) {
+      this.sorts.limit = pageSize
+      this.sorts.page = 1;
+      this.getData();
+    },
+    //切换页码
+    handleCurrentChange(currentPage) {
+      this.$refs.multipleTable.bodyWrapper.scrollTop = 0;
+      this.sorts.page = currentPage;
+      this.getData();
+    },
+    markEvaluation(id) {
+      this.$confirm("是否标记违规?", "提示", {
+        cancelButtonClass: "btn-custom-cancel",
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning"
+      }).then(() => {
+        let param= {
+          id: id
+        }
+        api.markEvaluation(param).then(res => {
+          if (res.data.result) {
+            this.$message({
+              type: 'success',
+              message: '标记成功!'
+            });
+            this.getData();
+          } else {
+            this.$message({
+              type: 'info',
+              message: '标记失败!'
+            });
+          }
+        })
+      }).catch(() => {
+        this.$message({
+          type: 'info',
+          message: '已取消标记'
+        });
+      })
+    }
+    ,
+    //删除
+    handleDelete(id, index) {
+      this.$confirm("您确定要删除该数据吗?", "提示", {
+        cancelButtonClass: "btn-custom-cancel",
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning"
+      }).then(() => {
+        let fd = new FormData();
+        fd.append('id', id);
+        api.deleteArticleById(fd).then(res => {
+          if (res.data.result) {
+            this.$message({
+              type: 'success',
+              message: '删除成功!'
+            });
+            this.tableData.splice(index, 1);
+            this.getData();
+          } else {
+            this.$message({
+              type: 'info',
+              message: '删除失败!'
+            });
+          }
+        })
+      }).catch(() => {
+        this.$message({
+          type: 'info',
+          message: '已取消删除'
+        });
+      })
+    },
+    // 获取列表数据
+    getData() {
+      api.queryEvaluationByPage({
+        page: this.sorts.page,
+        size: this.sorts.limit,
+        dishesName: this.query.dishesName
+      }).then(r => {
+        this.total = r.data.count
+        this.tableData = r.data.content
+      })
+    },
+    // 搜索
+    searchData() {
+      this.sorts.page = 1;
+      this.getData()
+    },
+    // 清空输入框
+    reset() {
+      this.query.dishesName = '';
+      this.sorts.page = 1;
+      this.getData()
+    },
+    // 更改文件
+    onChange(file, fileList) {
+      if (file.raw.type === 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' ||
+          file.raw
+              .type === 'application/vnd.ms-excel') {
+        this.upload.file = file;
+        // 覆盖上次上传的文件
+        if (fileList.length > 0) {
+          this.upload.fileList = [fileList[fileList.length - 1]];
+        }
+      } else {
+        this.$message.error('只能上传xls、xlsx文件!');
+      }
+    },
+    // 查看菜品类型信息
+    typeInfo() {
+      this.typeVisible = true;
+      this.typeSorts.page = 1;
+      this.typeSorts.limit = 10;
+      this.typeSorts.typeName = '';
+      this.getTypeData();
+    },
+    // 获取菜品类型信息数据
+    getTypeData() {
+      let params = {
+        page: this.typeSorts.page,
+        limit: this.typeSorts.limit,
+        typeName: this.typeSorts.typeName
+      }
+      api.getFoodTypePage({
+        params
+      }).then(r => {
+        this.typeTotal = r.data.count;
+        this.typeData = r.data.data;
+      })
+    },
+    //切换菜品类型条数
+    typeSizeChange(pageSize) {
+      this.typeSorts.limit = pageSize
+      this.typeSorts.page = 1;
+      this.getTypeData();
+    },
+    //切换菜品类型页码
+    typeCurrentChange(currentPage) {
+      this.$refs.typeTable.bodyWrapper.scrollTop = 0;
+      this.typeSorts.page = currentPage;
+      this.getTypeData();
+    },
+    // 选择菜品类型
+    chooseType(data) {
+      this.postManagement.typeId = data.id;
+      this.postManagement.typeName = data.typeName;
+      this.typeVisible = false;
+    },
+    // 搜索菜品类型信息
+    searchType() {
+      this.typeSorts.page = 1;
+      this.getTypeData();
+    },
+    // 清空菜品类型输入框
+    resetType() {
+      this.typeSorts.typeName = '';
+      this.typeSorts.page = 1;
+      this.getTypeData()
+    },
+
+    //删除文件
+    picRemove(file, fileList) {
+      console.log(file);
+      console.log(fileList);
+      console.log(this.postManagement.pic);
+      console.log(this.picList);
+    },
+  },
+}
 </script>
 </script>
 
 
 <style>
 <style>
+/* 全局取消按钮 */
+.btn-custom-cancel {
+  margin-left: 10px !important;
+  float: right;
+}
 </style>
 </style>
+
+<style scoped lang="less">
+/* 禁用后的勾选*/
+/deep/ .el-checkbox__input.is-disabled.is-checked .el-checkbox__inner::after {
+  border-color: #def5cb;
+}
+
+/deep/ .el-checkbox__input.is-disabled.is-checked .el-checkbox__inner {
+  background-color: #157de9;
+  border-color: #DCDFE6;
+}
+
+/deep/ .el-dialog__body {
+  padding: 0 0 30px 20px;
+  color: #606266;
+  font-size: 14px;
+  word-break: break-all;
+}
+
+/deep/ .el-dialog {
+  margin: 0 auto 0;
+}
+
+/deep/ .el-form-item__label {
+  padding: 0;
+}
+
+.yxnaContent {
+  padding: 10px;
+}
+
+.addTitle {
+  font-size: 18px;
+  font-weight: bold;
+  margin-bottom: 10px;
+}
+
+.add {
+  width: 66px;
+  height: 38px;
+  margin-left: 0;
+}
+
+/deep/ .el-col-12 {
+  width: 50%;
+  text-align: left;
+}
+
+.search {
+  width: 66px;
+  height: 38px;
+  margin-left: 0;
+}
+
+/deep/ .el-form-item__label {
+  height: 40px;
+  width: 110px;
+  background-color: #FAFAFA;
+  text-align: center;
+  border: 1px solid #DCDFE6;
+  border-radius: 2px 0 0 2px;
+}
+
+/deep/ .el-button.is-disabled {
+  color: #C0C4CC !important;
+}
+
+/deep/.el-button--primary.is-disabled {
+  color: #FFF !important;
+}
+
+/deep/ .el-input__inner {
+  border-radius: 2px 0 0 2px;
+}
+
+.el-select>.el-input {
+  width: 200px;
+}
+
+/deep/ .el-textarea__inner {
+  height: 100px;
+}
+
+
+/deep/ .el-dialog__title {
+  font-size: 14px;
+}
+
+/deep/ .el-pagination__total {
+  margin-left: 10px !important;
+}
+
+.el-pagination {
+  margin: 0;
+  margin-top: 10px;
+  /* position: fixed;
+  left: 13rem; */
+}
+
+/deep/ .el-table--scrollable-x .el-table__body-wrapper {
+  z-index: 2;
+}
+
+.but {
+  width: 36px;
+  height: 22px;
+  padding: 0;
+  font-size: 12px;
+}
+
+.el-checkbox {
+  margin: 0;
+  margin-right: 10px;
+}
+
+/deep/ .bewrite>.el-form-item__label {
+  width: 100%;
+  text-align: left;
+  padding-left: 21px;
+}
+
+/deep/ .el-form--inline .el-form-item {
+  margin-right: 0px;
+}
+
+/deep/ [data-v-2cde7735] .el-form-item__label {
+  border: 1px solid #DCDFE6;
+  /*border-right: transparent;*/
+}
+
+/*    空白框*/
+/deep/ .formTempBox {
+  height: 38px;
+  border: 1px solid #DCDFE6;
+  width: 100%;
+  border-left: transparent;
+  background-color: #FAFAFA;
+}
+</style>

+ 2 - 2
nngkxxdp/src/main/resources/static/naqwzsjtj/naqwzsjtj/vue.config.js

@@ -15,10 +15,10 @@ module.exports = {
         open: true,
         open: true,
         proxy: {
         proxy: {
             '/': {
             '/': {
-                // target:'http://192.168.0.230:7777/',//开发
+                target:'http://192.168.0.2:7777/',//开发
                 // target:'http://192.168.0.222:7777/',//开发
                 // target:'http://192.168.0.222:7777/',//开发
                 // target:'http://192.168.1.253:7777/',//测试
                 // target:'http://192.168.1.253:7777/',//测试
-                target:'http://data.cqna.gov.cn/',//线上
+                // target:'http://data.cqna.gov.cn/',//线上
                 changeOrigin: true,
                 changeOrigin: true,
                 pathRewrite: {
                 pathRewrite: {
                     '^ /': ''
                     '^ /': ''