Explorar el Código

Merge branch 'master' of http://94.191.59.107:3000/houwenfeng/scd_tools_ui

“yueshang” hace 1 año
padre
commit
983c3303fb

+ 9 - 0
src/api/flow/flow.js

@@ -119,6 +119,14 @@ function copyNowMap(data){
         data,
     })
 }
+// 关键词匹配测试
+function cruxTestNow(data){
+    return request({
+        url:`/reg/test`,
+        method:"get",
+        params:data
+    })
+}
 export default {
     getModelOn,
     saveModelOn,
@@ -132,4 +140,5 @@ export default {
     getIedType,
     delModelFcdaOn,
     copyNowMap,
+    cruxTestNow,
 }

+ 9 - 0
src/api/litLine.js

@@ -44,6 +44,14 @@ function delLine(data) {
         data
     })
 }
+// 删除模型
+function delModule(data){
+    return request({
+        url:`/admin/sysmodel/delete`,
+        method:"post",
+        data
+    })
+}
 export default{
     getAllLine,
     getLineModel,
@@ -51,4 +59,5 @@ export default{
     delLine,
     getAllm,
     addModule,
+    delModule,
 }

+ 16 - 0
src/pages/components/drawModal/AbilityModal.vue

@@ -21,6 +21,7 @@
                 </el-upload>
                 <el-button style="height: 30px;" type="success" plain @click="downloadFile">模板下载</el-button>
                 <el-button style="height: 30px;" type="danger" plain @click="clearAll">清除所有端子</el-button>
+                <el-button style="height: 30px;" type="warning" plain @click="cruxTest">关键词匹配测试</el-button>
                 <el-table :data="tableData" style="width: 100%;height: calc(100vh - 600px);">
                     <el-table-column label="序号" width="100">
                         <template #default="scope">
@@ -57,6 +58,7 @@
             :tableData="tableData"></AddAbility>
         <DelAbility v-if="delModal" :delModal="delModal" :modelIds="modelIds" :delFcda="delFcda"
             :copyReload="copyReload" @delBack="delBack"></DelAbility>
+            <KeyTest v-if="testType" :testType="testType" @ktBack="ktBack"></KeyTest>
     </div>
 </template>
 
@@ -66,6 +68,7 @@ import flow from "@/api/flow/flow"
 import system from '@/api/system';
 import AddAbility from './AddAbility.vue';
 import DelAbility from './DelAbility.vue';
+import KeyTest from './KeyTest.vue'
 import { ElMessage, ElLoading } from 'element-plus';
 import portExcel from "../../../../public/static/fanc_comp.xlsx"
 export default {
@@ -112,6 +115,7 @@ export default {
         let oldType = ref("")//旧的装置编码
         let newType = ref("")//新的装置编码
         let iedId = ref("")//节点的id
+        let testType =ref(false)//匹配关键词的模态框状态
         watch(() => props.modelId, (newVal) => {
             modelIds.value = newVal
         })
@@ -293,6 +297,10 @@ export default {
                 }
             })
         }
+        // 关键词匹配测试
+        function cruxTest(){
+            testType.value = true
+        }
         // 确认删除功能
         function firmSure() {
 
@@ -303,6 +311,10 @@ export default {
         function delBack(data) {
             delModal.value = data
         }
+        // keytest.vue 返回的模态框状态
+        function ktBack(data){
+            testType.value = data
+        }
         onMounted(() => {
             reload()
         })
@@ -335,11 +347,15 @@ export default {
             oldType,//旧的装置编码
             newType,//新的装置编码
             saveIedType,//保存装置编码函数
+            cruxTest,//关键词匹配测试
+            testType,//匹配关键词的模态框状态
+            ktBack,//KeyTest.vue返回的模态框状态
         }
     },
     components: {
         AddAbility,//嵌套新增功能窗口
         DelAbility,//嵌套删除模态框
+        KeyTest,//嵌套正则关键词匹配窗口
     }
 }
 </script>

+ 113 - 0
src/pages/components/drawModal/KeyTest.vue

@@ -0,0 +1,113 @@
+<template>
+    <div>
+        <el-dialog v-model="dialogVisible" title="匹配正则" width="30%" @close="handleClose" :close-on-click-modal="false">
+            <el-form ref="testFormRef" :model="testForm" :rules="rules" label-width="180px">
+                <el-form-item label="正则表达式" prop="txt">
+                    <el-input v-model="testForm.txt"></el-input>
+                </el-form-item>
+                <el-form-item label="匹配的字符串" prop="textTxt">
+                    <el-input v-model="testForm.textTxt"></el-input>
+                </el-form-item>
+            </el-form>
+            <template #footer>
+                <span class="dialog-footer">
+                    <el-button @click="cancels">取消</el-button>
+                    <el-button type="primary" @click="sureClick">确定</el-button>
+                </span>
+            </template>
+        </el-dialog>
+    </div>
+</template>
+
+<script>
+import { ElMessage } from 'element-plus';
+import { ref, onMounted, onBeforeUnmount, watch, reactive } from 'vue';
+import flow from '@/api/flow/flow';
+export default {
+    props: {
+        testType: {
+            type: Boolean,
+            required: true,
+        },//AbilityModal.vue传过来的模态框状态
+    },
+    setup(props, { emit }) {
+        let dialogVisible = ref(false)//本组件模态框状态
+        let testForm = ref({
+            txt: "",//正则表达式
+            textTxt: "",//需要验证的正则表达式
+        })//表单value
+        let testFormRef = ref()//表单的ref
+        let rules = reactive({
+            txt: [
+                { required: true, message: '请输入正则表达式', trigger: 'blur' },
+            ],
+            textTxt: [
+                { required: true, message: '请输入验证的正则表达式', trigger: 'blur' },
+            ],
+        })//表单输入验证
+        // 初始化本组件函数
+        function reload() {
+            dialogVisible.value = props.testType
+        }
+        // 关闭模态框
+        function closeModal() {
+            // 模态框状态设置为关闭
+            dialogVisible.value = false
+            // 传回给AbilityModal.vue
+            emit("ktBack", dialogVisible.value)
+        }
+        // 确认事件
+        function sureModal() {
+            // element plus表单组件自带验证
+            testFormRef.value.validate((val) => {
+                if (val) {
+                    // 调用接口拿到正确或错误
+                    flow.cruxTestNow({
+                        regstr: testForm.value.txt,
+                        str: testForm.value.textTxt,
+                    }).then(res => {
+                        // 判断接口返回是否成功
+                        if (res.code == 0) {
+                            ElMessage({
+                                message: "验证通过!",
+                                type: "success"
+                            })
+                            // 模态框状态设置为关闭
+                            dialogVisible.value = false
+                            // 传回给AbilityModal.vue
+                            emit("ktBack", dialogVisible.value)
+                        } else {
+                            ElMessage({
+                                message: "验证失败!",
+                                type: "error"
+                            })
+                        }
+                    })
+
+                } else {
+                    ElMessage({
+                        message: "您还有表单项没有输入!",
+                        type: "error"
+                    })
+                }
+            })
+
+        }
+        onMounted(() => {
+            reload()
+        })
+        return {
+            dialogVisible,//本组件模态框状态
+            reload,//初始化本组件函数
+            testForm,//表单value
+            cancels: closeModal,//取消按钮事件换为closemodal
+            handleClose: closeModal,//全局关闭模态框事件换为closemodal
+            sureClick: sureModal,//确认按钮函数替换为suremodal
+            testFormRef,//表单的ref
+            rules,//表单输入验证
+        }
+    }
+}
+</script>
+
+<style lang="scss" scoped></style>

+ 1 - 1
src/pages/system/components/LineTree.vue

@@ -163,6 +163,7 @@ export default {
             if (e.datatype === 'linkstyle') {
                 // 接线方式
                 litLine.getAllm({ pageno: 1, pagesize: 20, line_link_style: e.id }).then(res => {
+                    
                     if (res.code == 0) {
                         loading.value = true
                         counts.value = res.count
@@ -182,7 +183,6 @@ export default {
                     if (res.code == 0) {
                         loading.value = true
                         counts.value = res.count
-                        console.log(res.data, 'linetree');
                         emit("lineBack", loading.value)
                         emit("volBack", res.data, e.id, counts.value)
                     } else {

+ 69 - 8
src/pages/system/components/SetModule.vue

@@ -17,7 +17,7 @@
                     <el-table-column prop="model_name" label="模型名称" width="auto" />
                     <el-table-column prop="voltage_level_name" label="电压等级" width="auto" />
                     <el-table-column prop="area_type_name" label="间隔类型" width="auto" />
-                    <el-table-column fixed="right" label="操作" width="180">
+                    <el-table-column fixed="right" label="操作" width="280">
                         <template #default="scope">
                             <el-button link type="primary" size="small" @click="edit(scope.row, 1)"><el-icon>
                                     <EditPen />
@@ -25,6 +25,9 @@
                             <el-button link type="primary" size="small" @click="goMap(scope.row)"><el-icon>
                                     <Coin />
                                 </el-icon>编辑模型</el-button>
+                            <el-button link type="danger" size="small" @click="goDel(scope.row)"><el-icon>
+                                    <Delete />
+                                </el-icon>删除模型</el-button>
                         </template>
                     </el-table-column>
                 </el-table>
@@ -35,17 +38,20 @@
             <div>
                 <AddNode v-if="nodeMos" :nodeMos="nodeMos" :goMap="goMap" :needRow="needRow" :modelType="modelType"
                     @addBack="addBack"></AddNode>
+                <DelModule v-if="delType" :delType="delType" :delObj="delObj" :sunReady="sunReady" :checkFlash="checkFlash" :flashId="flashId" @dmBack="dmBack">
+                </DelModule>
             </div>
         </div>
     </div>
 </template>
 
 <script>
-import { ref, onMounted, toRefs, watch } from 'vue';
+import { ref, onMounted, toRefs, watch,onBeforeUnmount } from 'vue';
 import { ElMessage } from 'element-plus';
 import litLine from '@/api/litLine'
 import AddNode from '../modalComp/AddNode.vue';
 import Pagination from './Pagination.vue';
+import DelModule from '../modalComp/DelModule.vue'
 export default {
     props: {
         fuckList: {
@@ -59,7 +65,7 @@ export default {
         volId: {
             type: String,
             required: true
-        },
+        },//电压等级id
         moduleTotal: {
             type: Number,
             required: true,
@@ -79,6 +85,9 @@ export default {
         let modelType = ref(0)//0为新增1为修改
         let totals = ref(0)
         let loading = ref(false)
+        let delType = ref(false)//delmodule.vue状态
+        let delObj = ref({})//应该删除的模型对象
+        let flashId = ref("")//本组件的变电站id
         // let { goMap } = toRefs(props)
         watch(() => props.fuckList, (newVal) => {
             tableData.value = newVal
@@ -86,15 +95,18 @@ export default {
         watch(() => props.moduleTotal, (newVal) => {
             totals.value = newVal
         })
+        //监听变电站id变化
+        watch(()=>props.volId,(newVal)=>{
+            flashId.value = newVal
+        })
         function ready() {
-            // if (JSON.stringify(props.fuckList) =="[]") {
+            flashId.value = props.volId
             loading.value = true
             litLine.getAllm({ pageno: 1, pagesize: 20 }).then(res => {
                 if (res.code == 0) {
                     tableData.value = res.data
                     totals.value = res.count
                     loading.value = false
-                    console.log(totals.value, 'totals,module');
                 } else {
                     ElMessage({
                         message: res.msg,
@@ -102,11 +114,42 @@ export default {
                     })
                 }
             })
-            // } else {
-            //     tableData.value = props.fuckList
-            // }
             totals.value = props.moduleTotal
         }
+        //传给delmodule.vue的刷新数据方法
+        function sunReady() {
+            loading.value = true
+            litLine.getAllm({ pageno: 1, pagesize: 20 }).then(res => {
+                if (res.code == 0) {
+                    tableData.value = res.data
+                    totals.value = res.count
+                    loading.value = false
+                } else {
+                    ElMessage({
+                        message: res.msg,
+                        type: "error"
+                    })
+                    loading.value = false
+                }
+            })
+        }
+        //传给delmodule.vue的刷新数据方法
+        function checkFlash(e) {
+            loading.value = true
+            litLine.getAllm({ pageno: 1, pagesize: 20, vol_id: e - 0 }).then(res => {
+                if (res.code == 0) {
+                    tableData.value = res.data
+                    totals.value = res.count
+                    loading.value = false
+                } else {
+                    ElMessage({
+                        message: res.msg,
+                        type: "error"
+                    })
+                    loading.value = false
+                }
+            })
+        }
         function tableChange(e) {
             console.log(e, 'table');
         }
@@ -132,6 +175,10 @@ export default {
             needRow.value = row
             emit("backNum", kisNum.value, row.model_name, needRow.value)
         }
+        function goDel(row) {
+            delType.value = true//打开delmodule.vue
+            delObj.value = row//整个row对象赋值
+        }
         function addBack(isshow) {
             nodeMos.value = false
             needRow.value = null
@@ -144,9 +191,15 @@ export default {
         function pageBack(no, index) {
             emit("pageCase", no, index)
         }
+        function dmBack(data) {
+            delType.value = data//接收delmodule.vue传参,关闭模态框
+        }
         onMounted(() => {
             ready()
         })
+        onBeforeUnmount(()=>{
+            flashId.value = ""
+        })
         return {
             tableData,
             tableChange,
@@ -161,11 +214,19 @@ export default {
             totals,//总条数
             pageBack,//Pagination.vue返回数据
             loading,
+            goDel,//删除模型
+            delType,//delmodule.vue状态
+            delObj,//需要删除的模型对象
+            dmBack,
+            sunReady,//传给delmodule.vue的刷新数据方法
+            checkFlash,//传给delmodule.vue的刷新数据方法
+            flashId,//本组件的flashid
         }
     },
     components: {
         AddNode,
         Pagination,
+        DelModule,
     }
 }
 </script>

+ 112 - 0
src/pages/system/modalComp/DelModule.vue

@@ -0,0 +1,112 @@
+<template>
+    <div>
+        <el-dialog v-model="dialogVisible" title="删除信息" width="30%" @close="closes" :close-on-click-modal="false">
+            <div style="display: flex;justify-content:center;align-items: center;">
+                <el-icon style="color: red;font-size: 40px;display: block;">
+                    <WarningFilled />
+                </el-icon>
+                <span style="display: block;">是否确认删除该信息?</span>
+            </div>
+            <template #footer>
+                <span class="dialog-footer">
+                    <el-button @click="cancels">取消</el-button>
+                    <el-button type="primary" @click="sureClick">
+                        确定
+                    </el-button>
+                </span>
+            </template>
+        </el-dialog>
+    </div>
+</template>
+
+<script>
+import { ref, onMounted, onBeforeUnmount, watch } from 'vue';
+import litLine from '@/api/litLine';
+import { ElMessage } from 'element-plus';
+export default {
+    props: {
+        delType: {
+            type: Boolean,
+            required: true,
+        },//setmodule.vue传过来的模态框状态
+        delObj: {
+            type: Object,
+            required: true,
+        },//setmodule.vue传过来的需要删除的对象
+        sunReady: {
+            type: Function,
+            required: true,
+        },//setmodule.vue传过来的刷新总数据方法
+        checkFlash: {
+            type: Function,
+            required: true,
+        },//setmodule.vue传过来的刷新总数据方法
+        flashId: {
+            type: String,
+            required: true,
+        },//setmodule.vue传过来变电站id
+    },
+    setup(props, { emit }) {
+        let dialogVisible = ref(false)//本模态框打开关闭状态
+        let thisObj = ref({})//本组件需要删除的obj
+        let flashIds = ref('')///本组件的变电站id
+        // 监听传过来的flashid变化
+        watch(() => props.flashId, (newVal) => {
+            flashIds.value = newVal
+        })
+        // 初始化组件函数
+        function reload() {
+            dialogVisible.value = props.delType//赋值打开模态框
+            thisObj.value = props.delObj//赋值对象
+            flashIds.value = props.flashId//传过来的变电站id赋值给本组件的变电id
+        }
+        function closeModule() {
+            dialogVisible.value = false//模态框状态设置为关闭
+            emit("dmBack", dialogVisible.value)//传给父组件setmodule.vue
+        }
+        function sureModule() {
+            litLine.delModule({
+                id: thisObj.value.id - 0,
+            }).then(res => {
+                if (res.code == 0) {
+                    ElMessage({
+                        message: "删除成功!",
+                        type: "success"
+                    })
+                    if (flashIds.value) {
+                        props.checkFlash(flashIds.value)
+                        dialogVisible.value = false//模态框状态设置为关闭
+                        emit("dmBack", dialogVisible.value)//传给父组件setmodule.vue
+                    } else {
+                        props.sunReady()
+                        dialogVisible.value = false//模态框状态设置为关闭
+                        emit("dmBack", dialogVisible.value)//传给父组件setmodule.vue
+                    }
+
+                } else {
+                    ElMessage({
+                        message: res.msg,
+                        type: "success"
+                    })
+                    dialogVisible.value = false//模态框状态设置为关闭
+                    emit("dmBack", dialogVisible.value)//传给父组件setmodule.vue
+                }
+            })
+
+        }
+        onMounted(() => {
+            reload()
+        })
+        return {
+            dialogVisible,//本模态框打开关闭状态
+            reload,// 初始化组件函数
+            thisObj,//本组件需要删除的obj
+            cancels: closeModule,//取消按钮函数替换为colsemodule,
+            closes: closeModule,//全局关闭模态框函数替换为closemodule,
+            sureClick: sureModule,//确认按钮函数替换为suremodule,
+        }
+    }
+}
+</script>
+
+<style lang="scss" scoped></style>