Browse Source

配合世利修改智能报表中报表上报页面所需修改问题;开发黑色版本与白色版本

SunZehao 1 year ago
parent
commit
2b4b944a8b

+ 3 - 0
.env.development

@@ -5,6 +5,9 @@ NODE_ENV = 'development'
 VUE_APP_TITLE = '页面标题'
 
 # 开发环境/重写路径(公共路径)
+
+# 登录
+VUE_APP_LOGIN_URL = 'http://123.60.219.66:48080'
 # 发电能力分析
 VUE_APP_GENERAT_URL = 'http://123.60.219.66:9002'
 # VUE_APP_GENERAT_URL = 'http://192.168.2.12:9002'

+ 9 - 0
.env.production

@@ -11,11 +11,20 @@ NODE_ENV = 'production'
 # 页面标题
 VUE_APP_TITLE = '页面标题'
 
+# 登录
+VUE_APP_LOGIN_URL = 'http://123.60.219.66:48080'
+
 # 生产环境/重写路径(公共路径)
+
+# 发电能力分析
 VUE_APP_GENERAT_URL = 'http://123.60.219.66:9002'
+# VUE_APP_GENERAT_URL = 'http://192.168.2.12:9002'
 
+# 智能报表
 VUE_APP_REPORT_URL = 'http://123.60.219.66:9001'
+# VUE_APP_REPORT_URL = 'http://192.168.2.3:9001'
 
+# 功率预测
 VUE_APP_BASE_URL = 'http://123.60.219.66:8086'
 
 # 百度地图KEY

+ 10 - 0
src/api/gengra.js

@@ -1,5 +1,15 @@
 import httpRequest from '@/utils/request.js'
 
+//登录
+export function apiProjectLogin(params) {
+    return httpRequest({
+        baseURL: process.env.VUE_APP_LOGIN_URL,
+        url: 'admin-api/system/auth/login',
+        data: params,
+        method: "post"
+    })
+}
+
 // 风电数据准备页面
 export function apiGetbaseStation() {
     return httpRequest({

+ 27 - 0
src/api/report.js

@@ -26,4 +26,31 @@ export function run(data) {
         method: 'post',
         data: data
     })
+}
+
+// 修改已有脚本
+export function updateScript(params) {
+    return httpRequest({
+        baseURL: process.env.VUE_APP_REPORT_URL,
+        url: 'script/update',
+        method: 'post',
+        data: params
+    })
+}
+// 删除脚本
+export function deleteScript(parmas) {
+    return httpRequest({
+        baseURL: process.env.VUE_APP_REPORT_URL,
+        url: `script/delete?id=${parmas.id}`,
+        method: 'get'
+    })
+}
+
+// 每天运行一次脚本
+export function dayRunScript(parmas) {
+    return httpRequest({
+        baseURL: process.env.VUE_APP_REPORT_URL,
+        url: `script/timerun?time=${parmas.time}`,
+        method: 'post'
+    })
 }

+ 23 - 0
src/assets/css/eleCss/el-popper.less

@@ -185,6 +185,29 @@
                         }
 
                     }
+
+                    .el-year-table {
+                        .today {
+                            .cell {
+                                color: #409eff !important;
+                            }
+                        }
+
+                        .current {
+                            .cell {
+                                color: #fff !important;
+                            }
+                        }
+
+                        .available {
+                            .cell {
+                                color: #B3BDC0;
+                            }
+
+                        }
+
+
+                    }
                 }
             }
 

+ 11 - 5
src/components/commonHeaders.vue

@@ -165,11 +165,17 @@
                 })
                 this.$emit('headerName', item.name)
             },
-            async backLogin() {
-                let loginName = this.userName
-                if (loginName) {
-                    await this.LogoutInfor(loginName)
-                }
+            // async backLogin() {
+            //     let loginName = this.userName
+            //     if (loginName) {
+            //         await this.LogoutInfor(loginName)
+            //     }
+            // },
+            backLogin() {
+                window.sessionStorage.clear()
+                this.$router.push({
+                    path: "/login"
+                })
             },
             // 插入登出信息
             LogoutInfor(name) {

+ 116 - 5
src/views/intelligentReporting/existing.vue

@@ -8,17 +8,54 @@
         </el-table-column>
         <el-table-column align="right">
             <template #default="scope">
-                <el-button type="primary">编辑</el-button>
+                <el-button type="primary" @click="openDetil(scope.row)">编辑</el-button>
+                <el-button style="margin-right:10px" type="danger" @click="deleteRow(scope.row)">删除</el-button>
             </template>
         </el-table-column>
     </el-table>
+    <el-dialog title="详情" custom-class="windLifeDialog" v-model="dialogVisible" width="1000px"
+        :close-on-click-modal="false">
+        <div class="periodFrom">
+            <div style="margin-bottom: 12px">
+                <el-input v-model="scriptname" style="width: 500px">
+                    <template #prepend>输入脚本名称:</template>
+                </el-input>
+                <el-button type="primary" @click="saveJson" style="margin-left: 10px">保存脚本</el-button>
+            </div>
+            <el-table :data="editTable" :height="listHeight">
+                <el-table-column type="index" width="30" />
+                <el-table-column label="脚本步骤">
+                    <template #default="scope">
+                        <el-input v-model="scope.row.beforeText" v-if="scope.row.before && scope.row.before !==''"
+                            style="width: 419px">
+                            <template #prepend>{{ scope.row.before }}</template>
+                        </el-input>
+                        <el-input v-model="scope.row.behindText" v-if="scope.row.behind && scope.row.behind !==''"
+                            style="width: 250px">
+                            <template #prepend>{{ scope.row.behind }}</template>
+                        </el-input>
+                        <el-button v-if="scope.row.scriptName !==''" type="warning" round>{{ scope.row.scriptName}}
+                        </el-button>
+                    </template>
+                </el-table-column>
+                <el-table-column align="right" width="80">
+                    <template #default="scope">
+                        <el-button type="danger" @click="handleDelete(scope.$index)">删除
+                        </el-button>
+                    </template>
+                </el-table-column>
+            </el-table>
+        </div>
+    </el-dialog>
 </template>
 
 <script>
     import {
-        read
+        read,
+        save,
+        updateScript,
+        deleteScript
     } from "@/api/report";
-
     export default {
         props: {
             height: {
@@ -30,9 +67,12 @@
         },
         data() {
             return {
+                listHeight: document.documentElement.clientHeight - 220,
                 tableData2: [],
                 childCurrentRow: {},
-
+                dialogVisible: false,
+                scriptname: '',
+                editTable: []
             }
         },
         mounted() {
@@ -58,7 +98,55 @@
             },
             tableRow() {
 
-            }
+            },
+            handleDelete(index) {
+                this.editTable.splice(index, 1)
+            },
+            openDetil(row) {
+                this.scriptObj = row
+                this.dialogVisible = true
+                this.scriptname = row.scriptName
+                this.editTable = row.scripts
+            },
+            deleteRow(row) {
+                this.$confirm('此操作将永久删除该数据, 是否继续?', '提示', {
+                    confirmButtonText: '确定',
+                    cancelButtonText: '取消',
+                    type: 'warning'
+                }).then(() => {
+                    let that = this
+                    let params = {
+                        id: row.id
+                    }
+                    deleteScript(params).then(res => {
+                        if (res.code === 0) {
+                            that.$message({
+                                message: res.msg,
+                                type: 'success'
+                            });
+                            that.getData()
+                        }
+                    });
+                })
+            },
+            saveJson() {
+                let that = this
+                let params = {
+                    id: that.scriptObj.id,
+                    scriptName: that.scriptname,
+                    scripts: that.editTable
+                }
+                updateScript(params).then(res => {
+                    if (res.code === 0) {
+                        that.$message({
+                            message: res.msg,
+                            type: 'success'
+                        });
+                        that.dialogVisible = false
+                        that.getData()
+                    }
+                });
+            },
         }
     }
 </script>
@@ -66,5 +154,28 @@
 
 
 <style scoped lang="less">
+    .el-overlay {
+        .startToDia {
+            .el-dialog__body {
+                padding: 30px 60px 30px 20px !important;
+
+                .periodFrom {
+
+                    .el-select,
+                    .el-input {
+                        width: 100%;
+                    }
+
+                    .el-input {
+                        height: 30px;
+                    }
+                }
 
+                .flowSty {
+                    width: 100%;
+                    height: 70vh;
+                }
+            }
+        }
+    }
 </style>

+ 27 - 7
src/views/intelligentReporting/reporting/index.vue

@@ -35,7 +35,7 @@
                             <template #default="scope">
                                 <el-button type="primary" :disabled="btnloading" @click="handleRun(scope.$index)">运行
                                 </el-button>
-                                <el-button type="danger" @click="handleDelete(scope.$index)">删除
+                                <el-button type="danger" @click="handleDeleteList(scope.$index)">删除
                                 </el-button>
                             </template>
                         </el-table-column>
@@ -48,8 +48,10 @@
                     <p class="tableTit">每天运行一次</p>
                     <el-table :data="tableData4" :height="listHeight">
                         <el-table-column label="时间" width="300">
-                            <el-time-select v-model="timeValue" start="00:05" step="00:05" end="23:55"
-                                placeholder="选择时间" />
+                            <template #default="scope">
+                                <el-time-select v-model="scope.row.time" start="00:05" step="00:05" end="23:55"
+                                    placeholder="选择时间" />
+                            </template>
                         </el-table-column>
                         <el-table-column label="脚本名称">
                             <template #default="scope">
@@ -60,8 +62,8 @@
                         </el-table-column>
                         <el-table-column align="right">
                             <template #default="scope">
-                                <el-button type="primary" @click="handleDelete(scope.$index)">运行</el-button>
-                                <el-button type="danger" @click="handleDelete(scope.$index)">取消
+                                <el-button type="primary" @click="dayRun(scope.row)">运行</el-button>
+                                <el-button type="danger" @click="handleDeleteDayRun(scope.$index)">取消
                                 </el-button>
                             </template>
                         </el-table-column>
@@ -74,7 +76,8 @@
 </template>
 <script>
     import {
-        run
+        run,
+        dayRunScript
     } from '@/api/report';
     import existing from "../existing.vue";
     export default {
@@ -135,9 +138,26 @@
                     this.btnloading = false
                 })
             },
-            handleDelete(index) {
+            handleDeleteList(index) {
                 this.tableData.splice(index, 1)
             },
+            dayRun(row) {
+                let that = this
+                let params = {
+                    time: row.time
+                }
+                dayRunScript(params).then(res => {
+                    if (res.code === 0) {
+                        that.$message({
+                            message: res.msg,
+                            type: 'success'
+                        });
+                    }
+                });
+            },
+            handleDeleteDayRun(index) {
+                this.tableData4.splice(index, 1)
+            },
             getData(data) {
                 console.log("data:", data)
                 this.childCurrentRow = data

+ 1 - 0
src/views/intelligentReporting/scriptgeneration/index.vue

@@ -79,6 +79,7 @@
             return {
                 tableHeight: (document.documentElement.clientHeight - 120) / 2,
                 listHeight: document.documentElement.clientHeight - 160,
+                scriptname: '',
                 tableData: [{
                         id: '',
                         scriptName: '',

+ 28 - 9
src/views/login/index.vue

@@ -16,13 +16,13 @@
                 </el-input>
             </div>
             <div class="loginMima">
-                <el-input type="password" v-model="inputMima" placeholder="请输入密码">
+                <el-input type="password" v-model="inputMima" placeholder="请输入密码" @keyup.enter="handleLogin">
                     <template #prepend>
                         <i class="el-input__icon icon-mima" />
                     </template>
                 </el-input>
             </div>
-            <div class="loginYanzhengma">
+            <!-- <div class="loginYanzhengma">
                 <el-input type="password" v-model="inputYanzhengma" placeholder="请输入验证码" @keyup.enter="handleLogin">
                     <template #prepend>
                         <i class="el-input__icon icon-yanzhengma" />
@@ -31,7 +31,7 @@
                 <div class="login-code">
                     <img :src="codeUrl" @click="getCode" class="login-code-img" />
                 </div>
-            </div>
+            </div> -->
             <div class="remeber">
                 <el-checkbox v-model="ememberMe" disabled>记住密码</el-checkbox>
             </div>
@@ -55,6 +55,9 @@
         toLoginApi,
         apiGetWeather
     } from '@/api/api'
+    import {
+        apiProjectLogin
+    } from '@/api/gengra'
     export default {
         data() {
             return {
@@ -69,7 +72,7 @@
             }
         },
         created() {
-            this.getCode();
+            // this.getCode();
         },
         methods: {
             getCode() {
@@ -85,7 +88,8 @@
                 if (this.loginText === this.$utils.strChangeCase(this.inputYanzhengma, 5)) {
                     if (this.inputUser && this.inputMima) {
                         this.loading = true
-                        this.toLogin(this.inputUser, this.inputMima)
+                        // this.toLogin(this.inputUser, this.inputMima)
+                        this.toNewLogin(this.inputUser, this.inputMima)
                     } else {
                         ElMessage.error('请输入账号或密码');
                     }
@@ -96,7 +100,7 @@
                     this.getCode()
                 }
             },
-            //登录接口
+            //登录接口---带token
             toLogin(name, pass) {
                 let params = {
                     username: name,
@@ -123,9 +127,24 @@
                     } else {
                         ElMessage.error(datas.msg);
                     }
-                }).catch(e => {
-                    this.loading = false
-                    window.location.reload();
+                })
+            },
+            //现登录接口---不带token
+            toNewLogin(name, pass) {
+                let that = this
+                let params = {
+                    username: name,
+                    password: pass
+                }
+                apiProjectLogin(params).then(datas => {
+                    if (datas && datas.code === 0) {
+                        setToken(datas.data.accessToken)
+                        that.$router.push({
+                            path: "/home"
+                        })
+                    } else {
+                        ElMessage.error(datas.msg);
+                    }
                 })
             }
         }