heyang 10 months ago
parent
commit
ab18a673c6

+ 1 - 1
src/apiDemo/laboratory/chart.js

@@ -30,7 +30,7 @@ export function addChart(data) {
 export function updateChart(data) {
   return request({
     url: '/laboratory/chart',
-    method: 'put',
+    method: 'post',
     data: data
   })
 }

+ 9 - 20
src/views/systemManagement/chart/addPage.vue

@@ -1,8 +1,9 @@
 <template>
-  <div class="add-chart-page">
-    <div class="top-title-box">
-      <p>{{propsData.id?'编辑':'新增'}}</p>
-      <p class="reset-button-one" @click="backPage">返回</p>
+  <div class="page-container add-chart-page">
+    <div class="page-top-title-box">
+      <p class="page-top-title-name-p">{{form.id?'编辑':'新增'}}</p>
+      <p class="page-top-title-out-p" @click="backPage">返回</p>
+      <p class="page-top-title-submit-p" @click="submitForm">保存</p>
     </div>
     <el-form ref="form" :model="form" :rules="rules" label-width="120px">
       <el-form-item label="标题:" prop="imgName">
@@ -53,14 +54,7 @@
           <img v-if="form.imgUrl" :src="form.imgUrl" class="avatar" style="height:80px;width:80px;">
         </el-upload>
       </el-form-item>
-      <!--<el-form-item label="轮播图类型" prop="imgType">-->
-        <!--<template>-->
-          <!--<el-radio v-model="form.imgType" label="1">轮播</el-radio>-->
-          <!--<el-radio v-model="form.imgType" label="2">文化图</el-radio>-->
-        <!--</template>-->
-      <!--</el-form-item>-->
     </el-form>
-    <p class="bottom-button-p inquire-button-one" @click="submitForm">保存</p>
   </div>
 </template>
 
@@ -121,21 +115,16 @@
           imgCategory : this.propsData.imgCategory,
           imgRange : this.propsData.imgRange,
           imgOrder : this.propsData.imgOrder,
-          validBeginTime : this.propsData.validBeginTime,
-          validEndTime : this.propsData.validEndTime,
+          validBeginTime : this.propsData.validBeginTime+'',
+          validEndTime : this.propsData.validEndTime+'',
           imgUrl : this.propsData.imgUrl,
         }
+        this.dateRange=[this.propsData.validBeginTime,this.propsData.validEndTime]
         this.$set(this,'form',obj);
       }
     },
     methods: {
       /** 查询学院列表 */
-      // getDeptList() {
-      //   listDepartments().then(response => {
-      //     this.$set(this, 'deptOptions', response.data)
-      //     this.deptOptions.unshift({deptId:-1,deptName:'全校'})
-      //   });
-      // },
       imgRangeChange(){
         let self=this;
         this.deptOptions.forEach(function(item) {
@@ -152,7 +141,7 @@
       },
       // 返回按钮
       backPage(){
-        this.$parent.buttonClick(1);
+        this.$parent.tableButton('out');
       },
       /** 提交按钮 */
       submitForm() {

+ 27 - 134
src/views/systemManagement/chart/index.vue

@@ -38,25 +38,13 @@
               end-placeholder="结束日期"
             ></el-date-picker>
           </el-form-item>
-          <p class="page-inquire-common-style-button" @click="handleQuery">查询</p>
+          <p class="page-inquire-common-style-button" style="margin: 0 10px" @click="handleQuery">查询</p>
           <p class="page-reset-common-style-button" @click="resetQuery">重置</p>
           <p class="page-submit-common-style-button"
              style="float: right;"
              @click="tableButton(2)"
              v-hasPermiRouter="['cabinet:info:add']"
           >新增</p>
-<!--          <el-form-item style="float: right;">
-            <el-col :span="1.5">
-              <p class="add-button-one-120"
-                 @click="buttonClick(2)"
-                 v-hasPermi="['laboratory:chart:add']"
-              ><i class="el-icon-plus"></i>新增</p>
-            </el-col>
-          </el-form-item>
-          <el-form-item>
-            <p class="inquire-button-one" style="margin:0 20px;" @click="handleQuery">查询</p>
-            <p class="reset-button-one" @click="resetQuery">重置</p>
-          </el-form-item>-->
         </el-form>
         <el-table style="margin:20px 0;" v-loading="loading" border :data="chartList" @selection-change="handleSelectionChange">
           <el-table-column label="内容" align="left" prop="imgUrl" width="180">
@@ -77,12 +65,12 @@
           <el-table-column label="创建人" align="left" prop="imgName" width="200">
             <template slot-scope="scope">
               <div style="display: flex">
-                <span style="height:23px;width:90px;margin-right:10px;overflow:hidden">{{scope.row.createBy}}</span>
+                <span style="height:23px;width:90px;margin-right:10px;overflow:hidden">{{scope.row.createByName}}</span>
                 <el-switch
-                  @click.native="statusCaptcha(scope.row)"
+                  @click.native="tableButton(4,scope.row)"
                   class="switch captcha-img"
                   :active-value="1"
-                  :inactive-value="2"
+                  :inactive-value="0"
                   active-color="#0183FA"
                   inactive-color="#999"
                   v-model="scope.row.imgType"
@@ -113,22 +101,6 @@
               </div>
             </template>
           </el-table-column>
-<!--          <el-table-column label="操作" align="left" class-name="small-padding fixed-width" width="160" v-if="tableButtonType">
-            <template slot-scope="scope">
-              <div class="button-box">
-                <p class="table-min-button" @click="buttonClick(3,scope.row)">查看</p>
-                <el-dropdown size="mini" @command="(command) => handleCommand(command, scope.row)">
-                  <span class="table-min-button">
-                    更多<i class="el-icon-d-arrow-right el-icon&#45;&#45;right"></i>
-                  </span>
-                  <el-dropdown-menu slot="dropdown">
-                    <el-dropdown-item command="1" v-hasPermiAnd="['laboratory:chart:query','laboratory:chart:edit']">编辑</el-dropdown-item>
-                    <el-dropdown-item command="2" v-hasPermi="['laboratory:chart:remove']">删除</el-dropdown-item>
-                  </el-dropdown-menu>
-                </el-dropdown>
-              </div>
-            </template>
-          </el-table-column>-->
         </el-table>
         <pagination :page-sizes="[20, 30, 40, 50]"
           v-show="total>0"
@@ -141,51 +113,18 @@
     </div>
     <add-page v-if="pageType == 2" :propsData="propsData"></add-page>
     <info-page v-if="pageType == 3" :propsData="propsData"></info-page>
-    <!-- 添加或修改轮播图对话框 -->
-    <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body :close-on-click-modal="false">
-      <el-form ref="form" :model="form" :rules="rules" label-width="120px">
-        <el-form-item label="图片名称" prop="imgName">
-          <el-input v-model="form.imgName" placeholder="请输入图片名称" />
-        </el-form-item>
-        <el-form-item label="上传图片" prop="imgUrl">
-          <el-upload
-            class="certificate-avatar-uploader"
-            :action="uploadImgUrl"
-            :show-file-list="false"
-            accept="image/jpeg,image/gif,image/png"
-            :on-success="handleAvatarSuccess"
-            :headers="headers"
-            :before-upload="beforeAvatarUpload">
-            <img v-if="form.imgUrl" :src="form.imgUrl" class="avatar" style="height:80px;width:80px;">
-            <i v-if="!form.imgUrl" class="el-icon-plus avatar-uploader-icon"></i>
-          </el-upload>
-        </el-form-item>
-        <el-form-item label="轮播图类型" prop="imgType">
-          <template>
-            <el-radio v-model="form.imgType" label="1">轮播</el-radio>
-            <el-radio v-model="form.imgType" label="2">文化图</el-radio>
-          </template>
-        </el-form-item>
-      </el-form>
-      <div slot="footer" class="dialog-footer">
-        <el-button type="primary" @click="submitForm">确 定</el-button>
-        <el-button @click="cancel">取 消</el-button>
-      </div>
-    </el-dialog>
   </div>
 </template>
 
 <script>
-import { listChart, getChart, delChart, addChart, updateChart, editRotationType } from "@/apiDemo/laboratory/chart";
 import {
   systemRotationChartDelete,
-  systemRotationChartDetail,
+  systemRotationChartDetail, systemRotationChartEdit,
   systemRotationChartList
 } from '@/api/systemManagement/index'
 import { getToken } from "@/utils/auth";
 import addPage from "./addPage.vue"
 import infoPage from "./infoPage.vue"
-import { chemicalCabinetDelete, chemicalCabinetDetail, chemicalCabinetGetDoorList } from '@/api/chemicalManage'
 
 export default {
   name: "Chart",
@@ -263,6 +202,27 @@ export default {
         //新增
         this.$set(this,'pageType',2);
         this.$set(this,'propsData','');
+      }else if(type == 3){
+        //详情
+        systemRotationChartDetail(row.id).then(response => {
+          this.$set(this,'propsData',response.data);
+          this.$set(this,'pageType',3);
+        })
+      }else if (type == 4) {
+        //启用&停用
+        let text = row.imgType==0 ? '停用' : '启用'
+        this.$confirm('是否确认' + text + '?', '警告', {
+          confirmButtonText: '确定',
+          cancelButtonText: '取消',
+          type: 'warning'
+        }).then(function() {
+        }).then(() => {
+          systemRotationChartEdit({id:row.id,imgType:row.imgType==0?1:0}).then(response => {
+            self.msgSuccess(response.message)
+            self.getList()
+          })
+        }).catch(() => {
+        })
       }else if(type == 'out'){
         //返回并刷新
         this.$set(this,'pageType',1);
@@ -276,7 +236,7 @@ export default {
 
       }else if(val == '2'){
         //编辑
-        systemRotationChartDetail({cabinetId:row.cabinetId}).then(response => {
+        systemRotationChartDetail(row.id).then(response => {
           this.$set(this,'propsData',response.data);
           this.$set(this,'pageType',2);
         })
@@ -311,24 +271,6 @@ export default {
       }).then(() => {
       }).catch(() => {});
     },
-    buttonClick(type,row){
-      if(this.pageType!=type){
-        if(type == 1){
-          this.pageType = type
-          this.getList();
-          this.propsData = {};
-        }else if(type == 3){
-          const id = row.id || this.ids
-          systemRotationChartDetail(id).then( response => {
-            this.$set(this,'propsData',response.data)
-            this.pageType = 3
-          });
-        }else{
-          this.pageType = type
-        }
-      }
-    },
-
     // 选项卡切换
     buttonPageType(type){
       if(this.queryParams.tagCard != type){
@@ -405,55 +347,6 @@ export default {
       this.single = selection.length!==1
       this.multiple = !selection.length
     },
-    /** 新增按钮操作 */
-    handleAdd() {
-      this.reset();
-      this.open = true;
-      this.title = "添加轮播图";
-    },
-    /** 修改按钮操作 */
-    handleUpdate(row) {
-      this.reset();
-      const id = row.id || this.ids
-      getChart(id).then( response => {
-        this.$set(this,'propsData',response.data)
-        this.pageType = 2
-      });
-    },
-    /** 提交按钮 */
-    submitForm() {
-      this.$refs["form"].validate(valid => {
-        if (valid) {
-          if (this.form.id != null) {
-            updateChart(this.form).then( response => {
-              this.msgSuccess("修改成功");
-              this.open = false;
-              this.getList();
-            });
-          } else {
-            addChart(this.form).then( response => {
-              this.msgSuccess("新增成功");
-              this.open = false;
-              this.getList();
-            });
-          }
-        }
-      });
-    },
-    /** 删除按钮操作 */
-    handleDelete(row) {
-      const ids = row.id || this.ids;
-      this.$confirm('是否确认删除?', "警告", {
-          confirmButtonText: "确定",
-          cancelButtonText: "取消",
-          type: "warning"
-        }).then(function() {
-          return delChart(ids);
-        }).then(() => {
-          this.getList();
-          this.msgSuccess("删除成功");
-        }).catch(() => {});
-    },
     /** 导出按钮操作 */
     handleExport() {
       this.download('laboratory/chart/export', {

+ 7 - 3
src/views/systemManagement/chart/infoPage.vue

@@ -1,8 +1,12 @@
 <template>
-  <div class="infoPage">
-    <div class="top-title-box">
+  <div class="page-container infoPage">
+<!--    <div class="top-title-box">
       <p>详情</p>
       <p class="reset-button-one" @click="backPage">返回</p>
+    </div>-->
+    <div class="page-top-title-box">
+      <p class="page-top-title-name-p" style="margin-left: 20px">详情</p>
+      <p class="page-top-title-out-p" @click="backPage">返回</p>
     </div>
     <div class="text-box">
       <p>标题</p>
@@ -64,7 +68,7 @@
       },
       // 返回按钮
       backPage(){
-        this.$parent.buttonClick(1);
+        this.$parent.tableButton('out');
       },
     }
   }