Guoxiaohuan 5 years ago
parent
commit
d119beb02e
4 changed files with 444 additions and 123 deletions
  1. 136 115
      src/components/todayStrategy.vue
  2. 11 5
      src/router/index.js
  3. 285 0
      src/views/appeal/appealDetails.vue
  4. 12 3
      src/views/strategy/index.vue

+ 136 - 115
src/components/todayStrategy.vue

@@ -1,135 +1,156 @@
 <template>
-<div class="remarks">
-  <el-table
-    :data="data"
-    border
-    style="width: 100%;height:400px;">
-    <el-table-column
-      type="index"
-      width="80"
-      label="序号">
-    </el-table-column>
-    <el-table-column
-      prop="pushTime"
-      label="策略推送时间"
-      >
-       <template slot-scope='{row}'>{{row.pushTime?timestamp2String(row.pushTime).slice(8,10)+":"+timestamp2String(row.pushTime).slice(10,12) : '--'}}</template>
-    </el-table-column>
-    <el-table-column
-      prop="executeTime"
-      label="策略执行时间"
-      >
-       <template slot-scope='{row}'>{{row.executeTime?row.executeTime.slice(8,10)+":"+row.executeTime.slice(10,12):"--"}}</template>
-    </el-table-column>
-    <el-table-column prop label='冷水机组开启台数'  align='center'>
-        <template slot-scope='{row}'>{{row.chillerNumSetL+row.chillerNumSetS}}</template>
-    </el-table-column>
-    <el-table-column
-      prop="chillWaterOutTempSet"
-      label="出水温度设定值"
-      >
-    </el-table-column>
-     <el-table-column prop label='冷冻泵开启台数' align='center'>
-        <template slot-scope='{row}'>{{row.coolPumpNumSetL+'大'+row.coolPumpNumSetS+'小'}}</template>
-    </el-table-column>
-     <el-table-column prop label='冷却泵开启台数' min-width='120' align='center'>
-          <template slot-scope='{row}'>{{row.chillPumpNumSetL+row.chillPumpNumSetS}}</template>
+  <div class="remarks">
+    <el-table :data="data" border style="width: 100%;height:400px;">
+      <el-table-column type="index" width="80" label="序号"></el-table-column>
+      <el-table-column prop="pushTime" label="策略推送时间">
+        <template
+          slot-scope="{row}"
+        >{{row.pushTime?timestamp2String(row.pushTime).slice(8,10)+":"+timestamp2String(row.pushTime).slice(10,12) : '--'}}</template>
       </el-table-column>
-    <el-table-column prop label='冷却塔开启组数' min-width='120' align='center'>
-          <template slot-scope='{row}'>{{row.coolTowerNumSetL+row.coolTowerNumSetS}}</template>
+      <el-table-column prop="executeTime" label="策略执行时间">
+        <template
+          slot-scope="{row}"
+        >{{row.executeTime?row.executeTime.slice(8,10)+":"+row.executeTime.slice(10,12):"--"}}</template>
       </el-table-column>
-    <el-table-column
-      prop="zip"
-      label="通风策略"
-      >
-    </el-table-column>
-    <el-table-column
-    
-      label="执行情况"
-      >
-      <template slot-scope="{row}"> {{row.isExecuted==0?'未执行':'已执行'}}</template>
-    </el-table-column>
-    <el-table-column
-      label="操作"
-      width="100">
-      <template slot-scope="scope">
-        <el-button @click="handleClick(scope.row)" type="text" size="small">备注</el-button>
-        <el-button @click="dumpAduit(scope.row)" v-if="scope.row.isExecuted==false" type="text" size="small">申诉</el-button>
-      </template>
-    </el-table-column>
-  </el-table>
-  
-  <el-dialog
-  title="备注"
-  :visible.sync="dialogVisible"
-  width="30%"
-  >
-   <el-input
-  type="textarea"
-  :autosize="{ minRows: 2, maxRows: 4}"
-  placeholder="请填写备注内容"
-  v-model="remarks">
-</el-input>
-  <span slot="footer" class="dialog-footer">
-    <el-button @click="dialogVisible = false">关闭</el-button>
-    <el-button type="primary" @click="saveCommand">保存</el-button>
-  </span>
-</el-dialog>
-</div>
-    
+      <el-table-column prop label="冷水机组开启台数" align="center">
+        <template slot-scope="{row}">{{row.chillerNumSetL+row.chillerNumSetS}}</template>
+      </el-table-column>
+      <el-table-column prop="chillWaterOutTempSet" label="出水温度设定值"></el-table-column>
+      <el-table-column prop label="冷冻泵开启台数" align="center">
+        <template slot-scope="{row}">{{row.coolPumpNumSetL+'大'+row.coolPumpNumSetS+'小'}}</template>
+      </el-table-column>
+      <el-table-column prop label="冷却泵开启台数" min-width="120" align="center">
+        <template slot-scope="{row}">{{row.chillPumpNumSetL+row.chillPumpNumSetS}}</template>
+      </el-table-column>
+      <el-table-column prop label="冷却塔开启组数" min-width="120" align="center">
+        <template slot-scope="{row}">{{row.coolTowerNumSetL+row.coolTowerNumSetS}}</template>
+      </el-table-column>
+      <el-table-column prop="zip" label="通风策略"></el-table-column>
+      <el-table-column label="执行情况">
+        <template slot-scope="{row}">{{row.isExecuted==0?'未执行':'已执行'}}</template>
+      </el-table-column>
+      <el-table-column label="操作" width="100">
+        <template slot-scope="scope">
+          <el-button @click="handleClick(scope.row)" type="text" size="small">备注</el-button>
+          <el-button
+            @click="dumpAduit(scope.row)"
+            v-if="isShow(scope.row)"
+            type="text"
+            size="small"
+          >申诉</el-button>
+        </template>
+      </el-table-column>
+    </el-table>
+
+    <el-dialog title="备注" :visible.sync="dialogVisible" width="30%">
+      <el-input
+        type="textarea"
+        :autosize="{ minRows: 2, maxRows: 4}"
+        placeholder="请填写备注内容"
+        v-model="remarks"
+      ></el-input>
+      <span slot="footer" class="dialog-footer">
+        <el-button @click="dialogVisible = false">关闭</el-button>
+        <el-button type="primary" @click="saveCommand">保存</el-button>
+      </span>
+    </el-dialog>
+  </div>
 </template>
 
 <script>
 import { updateCommand } from "@/api/strategy/strategy.js";
-import {timestamp2String} from '@/utils/helper.js'
+import { timestamp2String } from "@/utils/helper.js";
+import { queryWorkflow } from "@/api/appeal/appeal.js";
+
 export default {
-    data() {
-        return {
-           timestamp2String,
-           dialogVisible:false,
-           remarks:'',
-           row:""
+  data() {
+    return {
+      timestamp2String,
+      dialogVisible: false,
+      remarks: "",
+      row: "",
+      newData: []
+    };
+  },
+  props: ["data", "idArr"],
+  methods: {
+    isShow(data) {
+      let isShow = false
+      if (this.newData.length) {
+        this.newData.forEach(el => {
+          if (data.appealId == el.id) {
+            if(el.status == 301 || el.status == 305){
+              isShow = true
+            }
+          }
+        });
+      }
+      return isShow
+    },
+    appealsIng(id) {
+      let params = {
+        postParams: {
+          criteria: {
+            id: id
+          },
+          withColumns: ["customAttribute"]
         }
+      };
+      queryWorkflow(params).then(res => {
+        this.newData = res.content ? res.content : [];
+        console.log(res);
+        // let arr = [];
+        // arr = res.content ? res.content : [];
+        // if (arr.length > 0) {
+        //   arr.forEach(item => {
+        //     arr.push(item.commandId);
+        //     this.newArr.push(item);
+        //   });
+        //   this.queryExecute(arr);
+        // }
+      });
     },
-    props:['data'],
-    methods:{
-      handleClick(row){
-        this.row = row
-        this.dialogVisible = true
-      },
-      saveCommand(row){
-        this.dialogVisible = false
-        let postParams = {
-            id: this.row.id,
-            remarks: this.remarks
-          
-        };
-        updateCommand({ postParams }).then(res => {
-          if (res.result == "success") {
-            this.$message.success("添加备注成功!");
-          }
-        })
+    handleClick(row) {
+      this.row = row;
+      this.dialogVisible = true;
+    },
+    saveCommand(row) {
+      this.dialogVisible = false;
+      let postParams = {
+        id: this.row.id,
+        remarks: this.remarks
+      };
+      updateCommand({ postParams }).then(res => {
+        if (res.result == "success") {
+          this.$message.success("添加备注成功!");
+        }
+      });
     },
-      dumpAduit(row){
-        console.log(row)
-        this.$router.push({
-        path: "/appeal/appealDetail",
-        query: { id:row.id }
+    dumpAduit(row) {
+      console.log(row);
+      this.$router.push({
+        path: "/appeal/appealDetails",
+        query: { item: JSON.stringify(row) }
       });
-      }
     }
-}
+  },
+  mounted() {
+    if (this.data && this.idArr) {
+      this.appealsIng(this.idArr);
+    }
+  }
+};
 </script>
 
 <style lang='scss' >
-.remarks{
-  .el-dialog{
+.remarks {
+  .el-dialog {
     margin-top: 30vh !important;
-    z-index:999999 !important;
+    z-index: 999999 !important;
   }
 }
- .v-modal{
-    z-index:1!important;
-    background: #fff !important;
-  }
+.v-modal {
+  z-index: 1 !important;
+  background: #fff !important;
+}
 </style>

+ 11 - 5
src/router/index.js

@@ -4,13 +4,14 @@ const Main = () => import('@/views/main/index')
 const Strategy = () => import('@/views/strategy/index')
 const Appeal = () => import('@/views/appeal/index')
 const AppealDetail = () => import('@/views/appeal/appealDetail')
+const AppealDetails = () => import('@/views/appeal/appealDetails')
 const Audit = () => import('@/views/audit/index')
 const DoBusiness = () => import('@/views/doBusiness/index')
 const Evaluate = () => import('@/views/evaluate/index')
 const EvTwoLevelMenu = () => import('@/views/evaluate/evTwoLevelMenu')
 
 import store from '../store'
-import {query} from '../utils/query'
+import { query } from '../utils/query'
 
 Vue.use(Router)
 
@@ -38,6 +39,11 @@ const router = new Router({
       component: AppealDetail
     },
     {
+      path: '/appeal/appealDetails',
+      name: 'appealDetails',
+      component: AppealDetails
+    },
+    {
       path: '/audit',
       name: 'audit',
       component: Audit
@@ -64,17 +70,17 @@ router.beforeEach(async (to, from, next) => {
   const token = query().token || sessionStorage.getItem('token')
   if (store.state.token && Object.keys(store.state.userInfo).length > 0) {
     next()
-  } else if (token){
+  } else if (token) {
     store.commit('setSsoToken', token)
-    await store.dispatch('loadUserInfo', {token})
+    await store.dispatch('loadUserInfo', { token })
     // 去除浏览器地址栏token
     if (query().token) {
-     router.replace(location.pathname + location.search.replace(/(&?token=\w+&?)/, ''))
+      router.replace(location.pathname + location.search.replace(/(&?token=\w+&?)/, ''))
     }
     next()
   } else {
     let ssoServer = 'http://sso.sagacloud.cn'
-    let redirectUrl = window.location.protocol + '//' + window.location.host +'/strategy'
+    let redirectUrl = window.location.protocol + '//' + window.location.host + '/strategy'
     window.location.href = `${ssoServer}/login?redirectUrl=${redirectUrl}`
   }
 })

+ 285 - 0
src/views/appeal/appealDetails.vue

@@ -0,0 +1,285 @@
+<template>
+  <div>
+    <Head :headText="headText"></Head>
+    <div class="nav-right">
+      <el-button type="info" plain size="mini" @click="back">返回</el-button>
+      <el-button type="primary" @click="submission" size="mini">提交</el-button>
+    </div>
+    <div class="detailContainer" v-if="Object.keys(detailObj).length>0">
+      <div class="title Micbold">未执行申诉单</div>
+      <div class="nav MicrYaHei">
+        <span>项目名称:{{localName}}</span>
+        <span>申请人:{{ $store.state.userInfo.username}}</span>
+        <span>申请时间:{{dateNow||'--'}}</span>
+      </div>
+      <div
+        class="cont1 MicrYaHei"
+      >申诉未执行指令:{{formatterStr(detailObj.date)}} {{formatterStr1(detailObj.time)}} {{detailObj.title||'--'}}</div>
+      <div class="cont2">
+        <audit-table :tableList="tableList"></audit-table>
+      </div>
+      <div class="cont3">
+        <span class="Micbold">策略评价</span>
+        <span class="MicrYaHei">{{detailObj.evaluateStrategy||detailObj.remarks||'--'}}</span>
+      </div>
+      <div class="cont4">
+        <span class="Micbold">申请原因</span>
+        <span>
+          <el-select size="mini" v-model="detailObj.reasonType" placeholder="请选择">
+            <el-option
+              v-for="item in options"
+              :key="item.value"
+              :label="item.label"
+              :value="item.label"
+            ></el-option>
+          </el-select>
+        </span>
+        <span>
+          <textarea placeholder="填写申请原因" v-model="detailObj.reason"></textarea>
+        </span>
+      </div>
+      <div class="foot">
+        <upload-img :souseArr="detailObj.pics"></upload-img>
+      </div>
+    </div>
+  </div>
+</template>
+<script>
+var moment = require("moment");
+import "moment/locale/zh-cn";
+import Head from "../main/index";
+import AuditTable from "../audit/auditTable";
+import UploadImg from "../../components/uploadImg";
+import {
+  queryWorkflow,
+  querySimpleInfo,
+  queryChillerExecuteInfo
+} from "@/api/appeal/appeal.js";
+import { updateWorkflow } from "@/api/audit/audit.js";
+export default {
+  data() {
+    return {
+      headText: "申诉审核",
+      reason: "",
+      options: [
+        {
+          value: "0",
+          label: "策略原因"
+        },
+        {
+          value: "1",
+          label: "设备原因"
+        },
+        {
+          value: "2",
+          label: "其他"
+        }
+      ],
+      value: "",
+      detailObj: {},
+      souseArr: [],
+      appealId: "",
+      commandId: "",
+      tableList: [],
+      dateNow: "",
+      applyUser: "",
+      localName: ""
+    };
+  },
+  components: {
+    Head,
+    AuditTable,
+    UploadImg
+  },
+  methods: {
+    formatterStr(str) {
+      if (str) {
+        return (
+          str.substring(0, 4) +
+          "." +
+          str.substring(4, 6) +
+          "." +
+          str.substring(6, 8)
+        );
+      }
+    },
+    formatterStr1(str) {
+      if (str) {
+        return str.substring(0, 2) + ":" + str.substring(2, 4);
+      }
+    },
+    quertName(id) {
+      querySimpleInfo(id, {}).then(res => {
+        this.applyUser = res.realname;
+      });
+    },
+    back() {
+      this.$router.push("/appeal");
+    },
+    queryDetail(commandId) {
+      let params = {
+        postParams: {
+          criteria: {
+            id: commandId
+          }
+        }
+      };
+      queryChillerExecuteInfo(params).then(res => {
+        const list = res.data || [{}, {}, {}];
+        this.tableList = Object.values(list[0]).map(i => i || {});
+        this.tableList[0].title = "当前运行状态";
+        this.tableList[1].title = "推送策略";
+        this.tableList[2].title = "执行策略";
+      });
+    },
+    submission() {
+      // this.detailObj.applyUser
+      let params = {
+        postParams: {
+          id: this.detailObj.appealId,
+          commit: "apply",
+          updateUser: this.$store.state.userInfo.userId, //申请人
+          applyUser: this.$store.state.userInfo.userId, //申请人
+          // judgement:
+          //   this.detailObj.recommend.evaluateStrategy ||
+          //   this.detailObj.recommend.remarks ||
+          //   "", //策略评价
+          reasonType: this.detailObj.reasonType, //申诉原因类型:策略原因;设备原因;其他
+          reason: this.detailObj.reason, //具体申诉原因
+          pics: this.detailObj.souseArr
+        }
+      };
+      updateWorkflow(params).then(res => {
+        if (res.result == "success") {
+          this.$message.success("申诉成功");
+        } else {
+          this.$message.error("申诉失败: " + res.message);
+        }
+        this.$router.push("/strategy");
+      });
+    }
+  },
+  mounted() {
+    this.detailObj = JSON.parse(this.$route.query.item);
+    this.dateNow = moment()
+      .locale("zh-cn")
+      .format("YYYY.MM.DD");
+    if (Object.keys(this.detailObj).length > 0) {
+      console.log(this.detailObj);
+      this.quertName(this.detailObj.applyUser);
+      let projects = this.$store.state.projects.projects;
+      projects.forEach(el => {
+        if (this.detailObj.projectId == el.id) {
+          this.localName = el.localName;
+        }
+      });
+    }
+  }
+};
+</script>
+<style lang="scss" scoped>
+.nav-right {
+  height: 48px;
+  position: fixed;
+  right: 24px;
+  top: 53px;
+  z-index: 1;
+  display: flex;
+  align-items: center;
+}
+.detailContainer {
+  max-width: 762px;
+  width: 60%;
+  margin: 0 auto;
+  padding-top: 36px;
+  padding-bottom: 24px;
+  .title {
+    height: 32px;
+    font-size: 24px;
+    color: rgba(31, 36, 41, 1);
+    line-height: 32px;
+    text-align: center;
+  }
+  .nav {
+    display: flex;
+    justify-content: space-between;
+    margin-top: 40px;
+    margin-bottom: 12px;
+    span {
+      height: 22px;
+      font-size: 14px;
+      color: rgba(31, 36, 41, 1);
+      line-height: 19px;
+    }
+  }
+  .cont1 {
+    height: 22px;
+    font-size: 14px;
+    color: rgba(31, 36, 41, 1);
+    line-height: 19px;
+    margin-bottom: 16px;
+  }
+  .cont2 {
+    margin-bottom: 24px;
+    height: 180px;
+  }
+  .cont3 {
+    margin-bottom: 24px;
+    span {
+      display: block;
+    }
+    span:nth-of-type(1) {
+      height: 24px;
+      font-size: 16px;
+      color: rgba(31, 36, 41, 1);
+      line-height: 21px;
+      margin-bottom: 8px;
+    }
+    span:nth-of-type(2) {
+      height: 22px;
+      font-size: 14px;
+      color: rgba(100, 108, 115, 1);
+      line-height: 19px;
+    }
+  }
+  .cont4 {
+    margin-bottom: 8px;
+    span {
+      display: block;
+    }
+    span:nth-of-type(1) {
+      height: 24px;
+      font-size: 16px;
+      color: rgba(31, 36, 41, 1);
+      line-height: 21px;
+    }
+    span:nth-of-type(2) {
+      margin: 8px 0;
+    }
+    span:nth-of-type(3) {
+      textarea {
+        width: 100%;
+        // max-width: 762px;
+        height: 64px;
+        border-radius: 4px;
+        border: 1px solid rgba(195, 199, 203, 1);
+        color: rgba(195, 199, 203, 1);
+      }
+    }
+  }
+  .foot {
+    // width: 112px;
+    // height: 112px;
+    // background: rgba(248, 249, 250, 1);
+    // border: 1px solid red;
+  }
+}
+</style>
+<style lang="scss">
+.detailContainer {
+  .el-input--mini .el-input__inner {
+    height: 32px;
+    border: 1px solid rgba(195, 199, 203, 1);
+  }
+}
+</style>

+ 12 - 3
src/views/strategy/index.vue

@@ -40,7 +40,7 @@
       </div>
     </div>
     <el-dialog title="提示" :visible.sync="showTodayStrategy" width="1260px">
-      <today-strategy :data="tableData"></today-strategy>
+      <today-strategy v-if="tableData.length>0 && idArr.length>0" :data="tableData" :idArr="idArr"></today-strategy>
     </el-dialog>
   </div>
 </template>
@@ -67,7 +67,8 @@ export default {
       chillerOrg: {},
       chillerOrgQ: {},
       chillerHourList: [],
-      chillerHourListQ: []
+      chillerHourListQ: [],
+      idArr: []
     };
   },
   components: {
@@ -80,7 +81,7 @@ export default {
     lookSnapshot() {
       this.showTodayStrategy = true;
       this.getData();
-      console.log(this.$store.state.userId);
+      // console.log(this.$store.state);
     },
     formatTime() {
       let year = new Date().getFullYear();
@@ -135,6 +136,7 @@ export default {
       });
     },
     getData() {
+      this.idArr = [];
       let params = {
         postParams: {
           criteria: {
@@ -143,8 +145,15 @@ export default {
           }
         }
       };
+      console.log(this.$store.state.userInfo.userId);
+      // return
       getCommand(params).then(res => {
         this.tableData = res.content ? res.content : [];
+        if (this.tableData.length > 0) {
+          this.tableData.forEach(el => {
+            this.idArr.push(el.appealId);
+          });
+        }
         console.log(this.tableData);
       });
     }