فهرست منبع

添加菜品相关

lijj 2 سال پیش
والد
کامیت
d1671686a7

+ 36 - 28
admin_ui/index.html

@@ -1,42 +1,50 @@
 <!DOCTYPE html>
 <html lang="en">
 
-<head>
-  <meta charset="UTF-8" />
-  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
-  <meta http-equiv="X-UA-Compatible" content="IE=edge">
-  <meta http-equiv="X-UA-Compatible" content="chrome=1" />
-  <meta name="renderer" content="webkit">
-  <meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0">
-  <meta name="apple-mobile-web-app-capable" content="yes">
-  <meta name="apple-mobile-web-app-status-bar-style" content="black">
-  <meta name="format-detection" content="telephone=no">
-  <link rel="icon" href="/favicon.png" />
-  <link rel="stylesheet" href="/iconfont/index.css">
-  <link rel="stylesheet" href="/iconfont/avue/iconfont.css">
-  <link rel="stylesheet" href="/iconfont/saber/iconfont.css">
-  <link rel="stylesheet" href="/css/loading.css">
-</head>
+  <head>
+    <meta charset="UTF-8" />
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+    <meta http-equiv="X-UA-Compatible" content="IE=edge">
+    <meta http-equiv="X-UA-Compatible" content="chrome=1" />
+    <meta name="renderer" content="webkit">
+    <meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0">
+    <meta name="apple-mobile-web-app-capable" content="yes">
+    <meta name="apple-mobile-web-app-status-bar-style" content="black">
+    <meta name="format-detection" content="telephone=no">
+    <link rel="icon" href="/favicon.png" />
+    <link rel="stylesheet" href="/iconfont/index.css">
+    <link rel="stylesheet" href="/iconfont/avue/iconfont.css">
+    <link rel="stylesheet" href="/iconfont/saber/iconfont.css">
+    <link rel="stylesheet" href="/css/loading.css">
+    <!-- 高德地图 -->
+    <!--<script>
+      window._AMapSecurityConfig = {
+        securityJsCode: 'xxxxx',
+      }
+    </script>-->
+    <script type="text/javascript" src='https://webapi.amap.com/maps?v=1.4.11&key=aac7b9040e0d51fd532399dbf5bde0fa&plugin=AMap.PlaceSearch'></script>
+    <script src="https://webapi.amap.com/ui/1.0/main.js?v=1.0.11"></script>
+  </head>
 
-<body>
-  <div id="app">
-    <div class="loading">
-      <div class="loading-wrap">
-        <div class="loading-dots">
-          <span class="dot dot-spin">
+  <body>
+    <div id="app">
+      <div class="loading">
+        <div class="loading-wrap">
+          <div class="loading-dots">
+            <span class="dot dot-spin">
             <i></i>
             <i></i>
             <i></i>
             <i></i>
           </span>
-        </div>
-        <div class="loading-title">
-          系统加载中
+          </div>
+          <div class="loading-title">
+            系统加载中
+          </div>
         </div>
       </div>
     </div>
-  </div>
-  <script type="module" src="/src/main.js"></script>
-</body>
+    <script type="module" src="/src/main.js"></script>
+  </body>
 
 </html>

+ 11 - 0
admin_ui/src/api/oss/oss.js

@@ -0,0 +1,11 @@
+import request from '@/axios';
+
+
+//图片上传
+export const uploadFile = (data) => {
+  return request({
+    url: '/api/blade-resource/oss/endpoint/put-file',
+    method: 'post',
+    data
+  })
+}

+ 37 - 35
admin_ui/src/option/ycwh/famousDish.js

@@ -1,16 +1,17 @@
 export default {
-  height:'auto',
+  height: 'auto',
   calcHeight: 30,
   tip: false,
   searchShow: true,
   searchMenuSpan: 6,
   border: true,
   index: true,
+  addBtn: false,
+  editBtn: false,
   viewBtn: true,
   selection: true,
   dialogClickModal: false,
-  column: [
-    {
+  column: [{
       label: "主键",
       prop: "id",
       type: "input",
@@ -82,16 +83,7 @@ export default {
       viewDisplay: false,
       hide: true,
     },
-    {
-      label: "备注",
-      prop: "remark",
-      type: "input",
-    },
-    {
-      label: "顺序",
-      prop: "sort",
-      type: "input",
-    },
+
     {
       label: "封面",
       prop: "cover",
@@ -108,35 +100,35 @@ export default {
       type: "input",
     },
     {
-      label: "视频(多个用英文逗号隔开)",
+      label: "视频",
       prop: "videos",
       type: "input",
     },
-    {
-      label: "内容",
-      prop: "content",
-      type: "input",
-    },
-    {
-      label: "所属地区id",
-      prop: "regionId",
-      type: "input",
-    },
+//  {
+//    label: "内容",
+//    prop: "content",
+//    type: "input",
+//  },
+    //  {
+    //    label: "所属地区id",
+    //    prop: "regionId",
+    //    type: "input",
+    //  },
     {
       label: "地址",
       prop: "address",
       type: "input",
     },
-    {
-      label: "纬度",
-      prop: "latitude",
-      type: "input",
-    },
-    {
-      label: "经度",
-      prop: "longitude",
-      type: "input",
-    },
+    //  {
+    //    label: "纬度",
+    //    prop: "latitude",
+    //    type: "input",
+    //  },
+    //  {
+    //    label: "经度",
+    //    prop: "longitude",
+    //    type: "input",
+    //  },
     {
       label: "置顶",
       prop: "top",
@@ -147,5 +139,15 @@ export default {
       prop: "views",
       type: "input",
     },
+//  {
+//    label: "备注",
+//    prop: "remark",
+//    type: "input",
+//  },
+    {
+      label: "顺序",
+      prop: "sort",
+      type: "input",
+    },
   ]
-}
+}

+ 96 - 0
admin_ui/src/views/ycwh/common/constants.js

@@ -0,0 +1,96 @@
+let nowTime = new Date();
+let todayStr = nowTime.getFullYear() + "-" + (nowTime.getMonth() + 1) + "-" + nowTime.getDate() + " 00:00:00";
+// 发布时间可选择的开始日期
+export const startPickTime = (new Date(todayStr)).getTime();
+// 发布时间可选择的结束日期
+export const endPickTime = startPickTime + 8 * 8.64e7 - 1;
+// aType 0:资讯发布   1:外链转载
+
+export const normalAType = 0;
+export const aTypeOptions = [{
+  label: '资讯发布',
+  value: 0
+}, {
+  label: '外链转载',
+  value: 1,
+}]
+
+// 板块类型   ZJGX(0, "走进高新"), GXTC(1, "高新同城"), GXMH(2, "门户首页");
+export const normalPlateType = 1;
+export const plateTypeOptions = [{
+  label: '走进高新',
+  value: 0
+}, {
+  label: '高新同城',
+  value: 1,
+}]
+// 走进高新
+//GXDT(0,"政策资讯"),
+//ZSCD(1,"产业资讯"),
+//GSTZ(4,"活动资讯"),
+//MTKT(5,"高新概况"),
+// 高新同城
+//WHGX(2,"文化高新"),
+//ZHGX(3,"智汇高新");
+// 板块对应的子分类 默认选择的子分类
+export const normalChildType = 2;
+export const childTypeOptions = [{
+  label: '文化高新',
+  value: 2
+}, {
+  label: '智汇高新',
+  value: 3,
+}]
+
+export const tabOption = {
+  column: [{
+    label: '文化高新',
+    prop: 2,
+  }, {
+    label: '智汇高新',
+    prop: 3,
+  }]
+
+}
+/** 活动 */
+export const normalAcitivityType = 0
+export const acitivityTypeOptions = [{
+  label: '线下活动',
+  value: 0
+}, {
+  label: '线上活动',
+  value: 1,
+}]
+export const acitivityTabOption = {
+  column: [{
+    label: '线下活动',
+    prop: 0,
+  }, {
+    label: '线上活动',
+    prop: 1,
+    disabled: true
+  }]
+
+}
+
+/***/
+export const normalSignChannel = 0
+export const signChannelOptions = [{
+  label: '跳转至报名链接',
+  value: 0
+}, {
+  label: '扫二维码报名',
+  value: 1,
+}]
+
+// 标签类型
+export const labelTypeOptions = [{
+  label: '文章标签',
+  value: 0
+}, {
+  label: '活动标签',
+  value: 1,
+}, {
+  label: '视频',
+  value: 2
+}]

+ 53 - 0
admin_ui/src/views/ycwh/components/editArticle/index.scss

@@ -0,0 +1,53 @@
+.article-form {
+    padding: 0 20px;
+}
+
+.avatar-uploader {
+     :deep(.el-upload) {
+        border: 1px dashed #d9d9d9;
+        border-radius: 6px;
+        cursor: pointer;
+        position: relative;
+        overflow: hidden;
+    }
+     :deep(.el-upload):hover {
+        border-color: #409EFF;
+    }
+}
+
+.avatar-uploader-icon {
+    font-size: 28px;
+    color: #8c939d;
+    width: 178px;
+    height: 178px;
+    line-height: 178px;
+    text-align: center;
+}
+
+.avatar {
+    width: 178px;
+    height: 178px;
+    display: block;
+}
+
+// Collapse 折叠面板 样式修改
+.form-collapse {
+    border: none;
+     :deep(.el-collapse-item .el-collapse-item__header) {
+        margin-bottom: 20px;
+        /* border-bottom: 1px solid #eee !important; */
+        border-bottom-color: #eee !important;
+    }
+     :deep(.el-collapse-item .el-collapse-item__wrap) {
+        border: none;
+    }
+}
+
+.form-title {
+    height: 30px;
+    line-height: 30px;
+    border-left: 5px solid #409eff;
+    font-size: 20px;
+    font-weight: bold;
+    padding-left: 15px;
+}

+ 368 - 0
admin_ui/src/views/ycwh/components/editArticle/index.vue

@@ -0,0 +1,368 @@
+<template>
+  <el-form ref="form" class="article-form" :model="form" :rules="rules" label-width="85px">
+    <el-form-item label="菜名" prop="name">
+      <el-input v-model="form.name" maxlength="80" show-word-limit />
+    </el-form-item>
+    <el-form-item label="副标题" prop="subTitle">
+      <el-input v-model="form.subTitle" type="textarea" maxlength="90" show-word-limit />
+    </el-form-item>
+    <el-form-item label="内容" prop="content">
+      <!--<content-item v-if="contentItemVisible" ref="contentComp" :html.sync="form.content" />-->
+      <avue-ueditor v-model="form.content" v-bing="editorOptions"></avue-ueditor>
+    </el-form-item>
+    <!--<el-form-item label="附件" prop="attachment">
+        <el-upload class="upload-demo" :http-request="uploadImg" :data="{type:'att'}" :file-list="attachmentList" :on-remove="handleRemoveImg" :on-preview="handlePreview" :accept='["image/jpeg", "image/png", "image/tga", "image/gif", "image/bmp"]'>
+          <el-button size="small" type="primary">点击上传</el-button>
+        </el-upload>
+      </el-form-item>-->
+
+    <el-form-item label="封面" prop="cover">
+      <div style="display: flex;">
+        <el-upload class="avatar-uploader cover-w16h9" style="margin-right: 30px !important;" :http-request="uploadImg" :data="{type:'img'}" :show-file-list="false" :before-upload="beforeAvatarUpload">
+          <el-image fit="contain" v-if="form.cover" :src="form.cover" class="avatar"></el-image>
+          <el-icon v-else class="el-icon-plus avatar-uploader-icon">
+            <Plus />
+          </el-icon>
+        </el-upload>
+        <!--1.建议长×宽比例为16:9,否则默认拉伸<br /> 2.像素最大不超过960*540<br />3.只能上传jpg/png文件,且不超过5MB-->
+      </div>
+    </el-form-item>
+    <el-form-item label="视频" prop="videos">
+      <div style="display: flex;">
+        <el-upload class="avatar-uploader cover-w16h9" style="margin-right: 30px !important;" :http-request="uploadImg" :data="{type:'video'}" :show-file-list="false" :before-upload="beforeAvatarUpload">
+          <el-image fit="contain" v-if="form.videos" :src="form.cover" class="avatar"></el-image>
+          <el-icon v-else class="el-icon-plus avatar-uploader-icon">
+            <Plus />
+          </el-icon>
+        </el-upload>
+      </div>
+    </el-form-item>
+    <el-form-item label="所属地区" prop="regionId">
+      <div style="display: flex;">
+        <el-input v-model="form.regionId" placeholder="请选择所属地区"></el-input>
+      </div>
+    </el-form-item>
+    <el-form-item label="详细地址" prop="address">
+      <div style="display: flex;width: 100%;">
+        <el-input v-model="form.address" @focus="showMap('input')" :readonly="!(form.latitude && form.longitude)" placeholder="请填写详细地址"></el-input>
+        <el-button type="primary" @click="showMap()">{{(form.latitude && form.latitude)?'重新选择':'选择地址'}}</el-button>
+      </div>
+    </el-form-item>
+    <div style="height: 72px;"></div>
+    <div style="position: fixed;bottom: 0;padding: 20px 0;z-index: 999;">
+      <el-button type="primary" @click="toSave(1)">发布</el-button>
+      <!--<el-button type="primary" @click="toSave(0)">存为草稿</el-button>-->
+      <!--<el-button type="primary" @click="toPreview">预览</el-button>-->
+      <el-button type="info" @click="toCancel">关闭</el-button>
+    </div>
+  </el-form>
+
+  <avue-input-map v-show="false" ref='amap' :params="{zoom:10, zoomEnable: true, dragEnable: false}" placeholder="请选择地址" v-model="mapForm"></avue-input-map>
+</template>
+
+<script>
+  // import contentItem from "@/components/richtext/tinymce.vue"
+  import {
+    getDetail,
+    add,
+    update
+  } from "@/api/ycwh/famousDish";
+  import {
+    uploadFile
+  } from "@/api/oss/oss";
+  //
+  import {
+    startPickTime,
+    endPickTime,
+    normalPlateType,
+    childTypeOptions,
+    normalChildType
+  } from "../../common/constants.js";
+
+  export default {
+    props: ['id'],
+    components: {
+      // contentItem
+    },
+    data() {
+      var checkListNull = (rule, value, cb) => {
+        if(value && value.length > 0) {
+          return cb();
+        }
+        cb(new Error("请选择标签"));
+      };
+      return {
+        loading: false,
+        //
+        attachmentList: [],
+        // 提交内容
+        form: {
+          id: null,
+          name: '',
+          subTitle: '',
+          content: '',
+          // 标签
+          videos: null,
+          address: '',
+          latitude: '',
+          longitude: '',
+          top: '',
+          sort: ''
+        },
+        //
+        contentItemVisible: false,
+        rules: {
+          name: [{
+              required: true,
+              message: '请输入菜名',
+              trigger: 'blur'
+            },
+            {
+              min: 1,
+              max: 80,
+              message: '长度不能超过80个字',
+              trigger: 'blur'
+            }
+          ],
+          subTitle: [{
+              required: true,
+              message: '请输入副标题',
+              trigger: 'blur'
+            },
+            {
+              min: 1,
+              max: 90,
+              message: '长度不能超过90个字',
+              trigger: 'blur'
+            }
+          ],
+          cover: [{
+            required: true,
+            message: '请上传封面',
+            trigger: 'blur'
+          }],
+          content: [{
+            required: true,
+            message: '请输入内容',
+            trigger: 'blur'
+          }],
+          regionId: [{
+            required: true,
+            message: '请选择所属区域',
+            trigger: 'blur'
+          }],
+          address: [{
+            required: true,
+            message: '请输入详细地址',
+            trigger: 'blur'
+          }],
+        },
+        // 富文本相关配置
+        editorOptions: {
+          //普通上传地址
+          action: "https://api.avuejs.com/imgupload",
+          customConfig: {}, //wangEditor编辑的配置
+          //是否启用oss(qiniu/ali)
+          oss: '',
+          headers: {},
+          data: {},
+          propsHttp: {
+            home: '',
+            url: 'url',
+            res: 'data'
+          },
+          //七牛云oss配置
+          qiniu: {
+            AK: "",
+            SK: "",
+            scope: "",
+            url: "",
+            deadline: 1
+          },
+          //阿里云oss配置
+          ali: {
+            region: "",
+            endpoint: "",
+            accessKeyId: "",
+            accessKeySecret: "",
+            bucket: ""
+          }
+        },
+        mapForm: [113.10235504165291, 41.03624227495205, "内蒙古自治区乌兰察布市集宁区新体路街道顺达源广告传媒"],
+      }
+    },
+    watch: {},
+    created() {
+      this.toReloadData()
+    },
+    mounted() {
+      if(this.id && this.id > 0) {
+        this.getDetail(this.id)
+      }
+    },
+    watch: {
+      'mapForm' () {
+        if(this.mapForm && this.mapForm.length == 3) {
+          this.form.longitude = this.mapForm[0];
+          this.form.latitude = this.mapForm[1];
+          this.form.address = this.mapForm[2];
+        }
+      },
+    },
+    methods: {
+      showMap(formType) {
+        if(formType === 'input') {
+          if(!(this.form.longitude && this.form.latitude)) {
+            this.$refs.amap.handleShow();
+          }
+        } else {
+          this.$refs.amap.handleShow();
+        }
+
+      },
+      getDetail(id) {
+        if(!(id && id > 0)) {
+          return;
+        }
+        /** 获取对应的文章详情 */
+        getDetail(id).then(res => {
+          if(res.data.success && res.data.data) {
+            let data = res.data.data;
+            //
+            this.form = data;
+          }
+        })
+      },
+      toReloadData(data) { //
+        this.form = data || {}
+        this.contentItemVisible = true
+      },
+      toSave(isPublish) {
+        if(this.loading) {
+          return;
+        }
+        this.loading = true;
+        this.$refs.form.validate((valid) => {
+          if(valid) { //校验通过
+            let submitObj = JSON.parse(JSON.stringify(this.form)) //克隆一份数据,避免影响到富文本编辑器
+            submitObj.content = encodeURIComponent(submitObj.content)
+
+            /** id不为空则为编辑,为空则新增 */
+            let saveFunc = submitObj.id ? update : add
+            this.loading = true;
+            //  发布或存为草稿
+            submitObj.isPublish = isPublish || 0;
+            // 处理附件列表
+            if(this.attachmentList && this.attachmentList.length > 0) {
+              submitObj.attachment = ""
+              this.attachmentList.map(e => {
+                if(submitObj.attachment) {
+                  submitObj.attachment += "," + e.name + "::" + e.url
+                } else {
+                  submitObj.attachment += e.name + "::" + e.url
+                }
+              })
+            } else {
+              submitObj.attachment = ''
+            }
+            // content
+            submitObj.content = submitObj.content || ''
+
+            saveFunc(submitObj).then(() => {
+              this.$message({
+                type: "success",
+                message: "保存成功!"
+              })
+              this.$emit("toCancel", true)
+            }, error => {
+              this.loading = false;
+              window.console.log(error)
+            })
+          } else { //校验不通过
+            this.$message.error('存在未完善的内容,请完善后再试!');
+            this.loading = false;
+            return false;
+          }
+        })
+      },
+      toView() {
+        // 预览
+      },
+      toCancel() {
+        this.$emit("toCancel", false)
+      },
+      // 图片上传
+      uploadImg(params) { // 调用接口上传不使用upload上传
+        if(!(params.data && params.data.type)) {
+          // att img
+          return;
+        }
+        let uploadType = params.data.type;
+        //
+        let fd = new FormData();
+        let f = params.file;
+        fd.append("file", f);
+        uploadFile(fd).then(res => {
+          if(res && res.data && res.data.success) {
+            // 提交内容
+            if(uploadType == 'img') {
+              this.form.cover = res.data.data.link;
+              this.$refs.form.validateField(["cover"], () => {
+                // 只触发校验不做其他处理
+              })
+            } else if(uploadType == 'video') {
+              this.form.videos = res.data.data.link;
+              this.$refs.form.validateField(["videos"], () => {
+                // 只触发校验不做其他处理
+              })
+            } else if(uploadType == 'att') {
+              this.attachmentList.push({
+                uid: f.uid,
+                name: f.name,
+                url: res.data.data.link
+              })
+            }
+            this.$forceUpdate();
+          }
+          this.loading = false;
+        }, e => {
+          console.log(e)
+          this.loading = false;
+        });
+      },
+      beforeAvatarUpload(file) {
+        // 封面限制5m    附件暂时不限制
+        //        const isJPG = file.type === 'image/jpeg';
+        //        if(!isJPG) {
+        //          this.$message.error('上传头像图片只能是 JPG 格式!');
+        //        }
+        const isLt5M = (file.size / 1024 / 1024) < 5;
+        if(!isLt5M) {
+          this.$message.error('上传头像图片大小不能超过 5MB!');
+        }
+        return true;
+      },
+      handlePreview(file) {
+        window.open(file.url);
+      },
+      handleRemoveImg(file, fileList) {
+        this.attachmentList = fileList;
+      },
+      toPreview() {
+        let submitObj = JSON.parse(JSON.stringify(this.form)) //克隆一份数据,避免影响到富文本编辑器
+        /** id不为空则为编辑,为空则新增 */
+        this.loading = true;
+        // 标签预览需要处理
+
+        // content
+        submitObj.content = submitObj.content || ''
+        // 新选择的标签、专栏需要单独赋值提供显示
+        // goPreview(this, "article", submitObj, this.tagOptions)
+      }
+    },
+  }
+</script>
+
+<style scoped lang="scss">
+  @import "./index.scss"
+</style>

+ 58 - 55
admin_ui/src/views/ycwh/famousDish.vue

@@ -1,55 +1,43 @@
 <template>
   <basic-container>
-    <avue-crud :option="option"
-               v-model:search="search"
-               v-model:page="page"
-               v-model="form"
-               :table-loading="loading"
-               :data="data"
-               :permission="permissionList"
-               :before-open="beforeOpen"
-               ref="crud"
-               @row-update="rowUpdate"
-               @row-save="rowSave"
-               @row-del="rowDel"
-               @search-change="searchChange"
-               @search-reset="searchReset"
-               @selection-change="selectionChange"
-               @current-change="currentChange"
-               @size-change="sizeChange"
-               @refresh-change="refreshChange"
-               @on-load="onLoad">
+    <avue-crud :option="option" v-model:search="search" v-model:page="page" v-model="form" :table-loading="loading" :data="data" :permission="permissionList" :before-open="beforeOpen" ref="crud" @row-update="rowUpdate" @row-save="rowSave" @row-del="rowDel" @search-change="searchChange" @search-reset="searchReset" @selection-change="selectionChange" @current-change="currentChange" @size-change="sizeChange" @refresh-change="refreshChange" @on-load="onLoad">
       <template #menu-left>
-        <el-button type="danger"
-                   icon="el-icon-delete"
-                   plain
-                   v-if="permission.famousDish_delete"
-                   @click="handleDelete">删 除
+        <el-button type="primary" icon="el-icon-plus" @click="toEdit()">新增</el-button>
+        <el-button type="danger" icon="el-icon-delete" plain v-if="permission.famousDish_delete" @click="handleDelete">删 除
         </el-button>
-        <el-button type="warning"
-                   plain
-                   icon="el-icon-download"
-                   @click="handleExport">导 出
+        <el-button type="warning" plain icon="el-icon-download" @click="handleExport">导 出
         </el-button>
       </template>
     </avue-crud>
+    <el-dialog :title="dialogTitle" fullscreen v-model="dialogVisible" :modal-append-to-body="false" :close-on-click-modal="false" @close="closeDialog()" top="5vh" width="70%">
+      <edit-article v-if="dialogVisible" :id="currentArticle?currentArticle.id:''" @afterSave="afterSave" @toCancel="closeDialog" />
+    </el-dialog>
   </basic-container>
 </template>
 
 <script>
-  import {getList, getDetail, add, update, remove} from "@/api/ycwh/famousDish";
+  import { getList, getDetail, add, update, remove } from "@/api/ycwh/famousDish";
   import option from "@/option/ycwh/famousDish";
-  import {mapGetters} from "vuex";
-  import {exportBlob} from "@/api/common";
-  import {getToken} from '@/utils/auth';
-  import {downloadXls} from "@/utils/util";
-  import {dateNow} from "@/utils/date";
+  import { mapGetters } from "vuex";
+  import { exportBlob } from "@/api/common";
+  import { getToken } from '@/utils/auth';
+  import { downloadXls } from "@/utils/util";
+  import { dateNow } from "@/utils/date";
   import NProgress from 'nprogress';
   import 'nprogress/nprogress.css';
+  //
+  import editArticle from "./components/editArticle/index.vue"
 
   export default {
+    components: {
+      editArticle
+    },
     data() {
       return {
+        dialogTitle: '',
+        currentArticle: null,
+        dialogVisible: false,
+        //
         form: {},
         query: {},
         search: {},
@@ -111,10 +99,10 @@
       },
       rowDel(row) {
         this.$confirm("确定将选择数据删除?", {
-          confirmButtonText: "确定",
-          cancelButtonText: "取消",
-          type: "warning"
-        })
+            confirmButtonText: "确定",
+            cancelButtonText: "取消",
+            type: "warning"
+          })
           .then(() => {
             return remove(row.id);
           })
@@ -127,15 +115,15 @@
           });
       },
       handleDelete() {
-        if (this.selectionList.length === 0) {
+        if(this.selectionList.length === 0) {
           this.$message.warning("请选择至少一条数据");
           return;
         }
         this.$confirm("确定将选择数据删除?", {
-          confirmButtonText: "确定",
-          cancelButtonText: "取消",
-          type: "warning"
-        })
+            confirmButtonText: "确定",
+            cancelButtonText: "取消",
+            type: "warning"
+          })
           .then(() => {
             return remove(this.ids);
           })
@@ -150,10 +138,8 @@
       },
       handleExport() {
         let downloadUrl = `/famous_dish/famousDish/export-famousDish?${this.website.tokenHeader}=${getToken()}`;
-        const {
-        } = this.query;
-        let values = {
-        };
+        const {} = this.query;
+        let values = {};
         this.$confirm("是否导出数据?", "提示", {
           confirmButtonText: "确定",
           cancelButtonText: "取消",
@@ -167,7 +153,7 @@
         });
       },
       beforeOpen(done, type) {
-        if (["edit", "view"].includes(type)) {
+        if(["edit", "view"].includes(type)) {
           getDetail(this.form.id).then(res => {
             this.form = res.data.data;
           });
@@ -191,10 +177,10 @@
         this.selectionList = [];
         this.$refs.crud.toggleSelection();
       },
-      currentChange(currentPage){
+      currentChange(currentPage) {
         this.page.currentPage = currentPage;
       },
-      sizeChange(pageSize){
+      sizeChange(pageSize) {
         this.page.pageSize = pageSize;
       },
       refreshChange() {
@@ -203,11 +189,9 @@
       onLoad(page, params = {}) {
         this.loading = true;
 
-        const {
-        } = this.query;
+        const {} = this.query;
 
-        let values = {
-        };
+        let values = {};
 
         getList(page.currentPage, page.pageSize, values).then(res => {
           const data = res.data.data;
@@ -216,10 +200,29 @@
           this.loading = false;
           this.selectionClear();
         });
+      },
+      // 新增文章相关
+      toEdit(row) {
+        if(row && row.id) {
+          this.dialogTitle += '编辑';
+          this.currentArticle = row;
+        } else {
+          this.dialogTitle += '新增'
+          this.currentArticle = null
+        }
+        this.dialogVisible = true;
+      },
+      closeDialog(needReflash) {
+        this.currentArticle = null;
+        if(needReflash) {
+          this.refreshChange();
+        }
+        this.dialogVisible = false;
       }
     }
   };
 </script>
 
 <style>
-</style>
+
+</style>