liyangzheng преди 1 година
родител
ревизия
ce323c7255

+ 6 - 6
src/api/scdCheck/scdCheck.js

@@ -1,42 +1,42 @@
 import request from '@/utils/request'
 function scdStart(data){//开始对比
     return request({
-        url:`/scd_check_tools/comp/start`,
+        url:`/scd/comp/start`,
         method:"post",
         data,
     })
 }
 function switchIed(data){//指定装置差异对比结果分类统计
     return request({
-        url:`/scd_check_tools/comp/iedstat/type`,
+        url:`/scd/comp/iedstat/type`,
         method:"get",
         params:data,
     })
 }
 function flashStation(data){
     return request({
-        url:`/scd_check_tools/comp/list`,//获取指定变电站的差异对比记录列表
+        url:`/scd/comp/list`,//获取指定变电站的差异对比记录列表
         method:"get",
         params:data
     })
 }
 function scdResult(data){
     return request({
-        url:`/scd_check_tools/comp/result`,//获取指定差异对比的详细结果列表
+        url:`/scd/comp/result`,//获取指定差异对比的详细结果列表
         method:"get",
         params:data
     })
 }
 function scdAll(data){
     return request({
-        url:`/scd_check_tools/comp/stat/result`,//获取scd差异对比结果概览统计
+        url:`/scd/comp/stat/result`,//获取scd差异对比结果概览统计
         method:"get",
         params:data
     })
 }
 function scdTree(data){
     return request({
-        url:`/scd_check_tools/comp/tree`,//获取SCD校验对象树
+        url:`/scd/comp/tree`,//获取SCD校验对象树
         method:"get",
         params:data
     })

+ 127 - 39
src/pages/components/drawModal/LineDouble.vue

@@ -18,7 +18,7 @@
                     <p class="background" :style="{ 'background-image': `url(${setBackground})`, 'color': setColor }">{{
                         setGooseOrSv }}</p>
                 </div>
-                <div class="rightBox">
+                <div class="rightBox" v-loading="loading">
                     <h1 style="
                     border-bottom: 1px solid #7484AB;
                     width: 73%;
@@ -26,14 +26,13 @@
                     padding-bottom: 10px;
                     ">{{ endTxt }}</h1>
                     <div>
-                        <div style="margin-bottom: 10px;" v-for="(item, index) in outList">
+                        <!-- <div style="margin-bottom: 10px;" v-for="(item, index) in outList">
                             <div
                                 style="width: 80%;display: flex;justify-content: space-around;align-items: center;margin: 0 auto;">
                                 <span style="display: block;border: 1px solid #2B5AE5;width: 42px;height: 42px;"
                                     @click="toggleVisibility(index)">
-                                    <svg v-show="visibleItems.includes(item)" t="1704938867254" class="icon"
-                                        viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4269"
-                                        width="40" height="40">
+                                    <svg v-show="isVisible(item)" t="1704938867254" class="icon" viewBox="0 0 1024 1024"
+                                        version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4269" width="40" height="40">
                                         <path
                                             d="M392.533333 806.4L85.333333 503.466667l59.733334-59.733334 247.466666 247.466667L866.133333 213.333333l59.733334 59.733334L392.533333 806.4z"
                                             fill="#2B5AE5" p-id="4270"></path>
@@ -42,7 +41,12 @@
                                 <span style="display: block;" :class="getClass(index)">{{ item.fcda_name
                                 }}</span>
                             </div>
-                        </div>
+                        </div> -->
+                        <el-checkbox-group  v-model="checkList" @change="checkChange">
+                            <el-checkbox v-for="(item, index) in outList" :label="item.id" :key="item.id">
+                                {{ item.fcda_name }}
+                            </el-checkbox>
+                        </el-checkbox-group>
                     </div>
                 </div>
             </div>
@@ -103,8 +107,12 @@ export default {
         let numStatus = ref(0)//判断goose还是sv
         let visibleItems = ref([])//选择的数组
         let fcdaIds = ref("")//需要的fcda_ids
-        let leftIndex = ref(0)//左侧选择的输出下标
+        let leftIndex = ref(-1)//左侧选择的输出下标
         let leftFcda = ref("")//左侧的fcdaid
+        let together = ref("")//绑定的id
+        let checkList = ref([])//select数据
+        let loading = ref(false)
+        let arrNew = ref([])//新的存储fdcdids
         watch(() => props.modelId, (newVal) => {
             modelIds.value = newVal
         })
@@ -130,12 +138,12 @@ export default {
                 model_id: modelIds.value - 0,
                 ied_type: starts.value.ied_type,
             }).then(res => {
-                if(res.code == 0){
+                if (res.code == 0) {
                     curList.value = res.data
-                }else{
+                } else {
                     ElMessage({
-                        message:res.msg,
-                        type:"error"
+                        message: res.msg,
+                        type: "error"
                     })
                 }
             })
@@ -143,12 +151,12 @@ export default {
                 model_id: modelIds.value - 0,
                 ied_type: ends.value.ied_type,
             }).then(res => {
-                if(res.code == 0){
+                if (res.code == 0) {
                     outList.value = res.data
-                }else{
+                } else {
                     ElMessage({
-                        message:res.msg,
-                        type:"error"
+                        message: res.msg,
+                        type: "error"
                     })
                 }
             })
@@ -160,6 +168,9 @@ export default {
         }
         // 确认关闭模态框
         function sureClose() {
+            if (leftFcda.value == '') {
+                leftFcda.value = curList.value[0].id
+            }
             flow.saveModelOn({
                 model_id: modelIds.value - 0,
                 from_ied_type: starts.value.ied_type,
@@ -168,10 +179,20 @@ export default {
                 to_fcda_ids: fcdaIds.value,
                 goosesv: setGooseOrSv.value,
             }).then(res => {
-                console.log(res, '设置');
+                if (res.code == 0) {
+                    ElMessage({
+                        type: "success",
+                        message: "关联成功!"
+                    })
+                    dialogVisible.value = false
+                    emit("lineBack", dialogVisible.value)
+                } else {
+                    ElMessage({
+                        type: "error",
+                        message: res.msg
+                    })
+                }
             })
-            dialogVisible.value = false
-            emit("lineBack", dialogVisible.value)
         }
         // 返回goose还是sv
         const setGooseOrSv = computed(() => {
@@ -197,28 +218,57 @@ export default {
                 return 'blue'
             }
         })
-        // 获取fcda_ids
-        function toggleVisibility(index) {
-            const item = outList.value[index];
-            const itemIndex = visibleItems.value.findIndex((i) => i === item);
-            if (itemIndex === -1) {
-                visibleItems.value.push(item);
-            } else {
-                visibleItems.value.splice(itemIndex, 1);
-            }
-            fcdaIds.value = visibleItems.value.map((item, index) => {
-                return item.id
-            }).join(",")
-        };
         // 下标选择
         function setIndex(row, num) {
-            leftFcda.value = row.id
-            leftIndex.value = num
+            loading.value = true
+            flow.getModelOn({
+                model_id: modelIds.value - 0,
+                from_fcda_id: row.id - 0
+            }).then(res => {
+                if (res.data != null) {
+                    together.value = res.data
+                    checkList.value = together.value.map(item => item.to_fcda_id);
+                    fcdaIds.value = res.data.map(item => {
+                        return item.to_fcda_id
+                    }).join(",")
+                    loading.value = false
+                } else {
+                    together.value = []
+                    checkList.value = []
+                    loading.value = false
+                }
+            })
+            if (row || num) {
+                leftFcda.value = row.id
+                leftIndex.value = num
+            }
         }
-        // 设置多选span的class
-        function getClass(index) {
-            const item = outList.value[index];
-            return visibleItems.value.includes(item) ? 'results' : 'anthers';
+        // function isVisible(item) {
+        //     if (together.value.length > 0) {
+        //         loading.value = false
+        //         return together.value.some((togetherItem) => togetherItem.to_fcda_id === item.id);
+        //     }
+        // };
+        // // 设置多选span的class
+        // function getClass(index) {
+        //     const item = outList.value[index];
+        //     return visibleItems.value.includes(item) ? 'results' : 'anthers';
+        // }
+        // // 获取fcda_ids
+        // function toggleVisibility(index) {
+        //     const item = outList.value[index];
+        //     const itemIndex = visibleItems.value.findIndex((i) => i === item);
+        //     if (itemIndex === -1) {
+        //         visibleItems.value.push(item);
+        //     } else {
+        //         visibleItems.value.splice(itemIndex, 1);
+        //     }
+        //     fcdaIds.value = visibleItems.value.map((item, index) => {
+        //         return item.id
+        //     }).join(",")
+        // };
+        function checkChange(e) {
+            fcdaIds.value = e.join(",")
         }
         onMounted(() => {
             reload()
@@ -239,13 +289,19 @@ export default {
             setBackground,//判断显示背景图
             setColor,//判断文字颜色
             visibleItems,//选择的数组
-            toggleVisibility,//模拟多选框方法
+            // toggleVisibility,//模拟多选框方法
             fcdaIds,//需要的fcda_ids
             leftIndex,//左侧下标选择
             setIndex,//下标选择函数
-            getClass,//设置多选span的class函数
+            // getClass,//设置多选span的class函数
             leftFcda,//左侧单选的fcdaid
             outList,//箭头指向端list
+            together,//绑定的id
+            // isVisible,
+            loading,
+            checkList,
+            checkChange,
+            arrNew,//新的存储ids
         }
     }
 }
@@ -341,4 +397,36 @@ export default {
     background-position: 100% 50%;
     line-height: calc(100vh - 850px);
 }
+
+:deep(.el-checkbox__inner) {
+    width: 40px !important;
+    height: 40px !important;
+    background-color: white !important;
+}
+
+:deep(.el-checkbox__inner::after) {
+    height: 30px !important;
+    left: 11px !important;
+    width: 15px !important;
+    top: -2px !important;
+    border-color: #2B5AE5;
+}
+
+:deep(.el-checkbox__input.is-checked .el-checkbox__inner::after) {
+    border-color: #2B5AE5;
+}
+
+:deep(.el-checkbox) {
+    width: 300px !important;
+    height: 50px !important;
+    margin-right: 0 !important;
+}
+
+:deep(.el-checkbox__label) {
+    width: 202px !important;
+    height: 42px !important;
+    margin-left: 10px !important;
+    line-height: 42px !important;
+    text-align: center;
+}
 </style>

+ 25 - 5
src/pages/mission/MissionVue.vue

@@ -4,8 +4,10 @@
             <!-- 三按钮盒子 -->
             <div class="btnBox">
                 <template v-for="(item, index) in btnList">
-                    <span :class="btnSelect == index ? 'result' : 'nowMission'" @click="misChange(item, index)">{{ item.name
-                    }}</span>
+                    <span :class="btnSelect == index ? 'result' : 'nowMission'" :style="{
+                        background: `url(${item.isSelected ? item.isImg : item.noImg})`,
+                        color: item.isSelected ? 'white' : 'black',
+                    }" @click="misChange(item, index)">{{ item.name }}</span>
                 </template>
                 <!-- <router-link to="/home/int">测试</router-link> -->
             </div>
@@ -37,6 +39,8 @@ import HaveMis from './components/HaveMis.vue';
 import StartMission from './components/StartMission.vue';
 import HistoryMis from './components/HistoryMis.vue';
 import task from '@/api/task';
+import blueBtn from '@/assets/image/btn_blue.png'
+import grayBtn from '@/assets/image/btn_gray.png'
 export default {
     setup() {
         document.documentElement.style.fontSize = (window.innerWidth / 1920 * 12) + "px"
@@ -44,14 +48,26 @@ export default {
         let btnList = ref([
             {
                 name: "当前检测任务",
+                id: 1,
+                noImg: grayBtn,
+                isImg: blueBtn,
+                isSelected: true, // 初始状态未选中
                 value: "1"
             },
             {
                 name: "新建检测任务",
-                value: "2",
+                id: 2,
+                noImg: grayBtn,
+                isImg: blueBtn,
+                isSelected: false, // 初始状态未选中
+                value: "2"
             },
             {
                 name: "历史任务",
+                id: 3,
+                noImg: grayBtn,
+                isImg: blueBtn,
+                isSelected: false, // 初始状态未选中
                 value: "3"
             }
         ])//按钮列表
@@ -91,6 +107,10 @@ export default {
             if (num == 1) {
                 status.value = 1
             }
+            // 将当前点击的标签设为选中状态,其他标签设为非选中
+            btnList.value.forEach((tag) => {
+                tag.isSelected = tag.id === row.id;
+            });
         }
         function createMis() {
             btnSelect.value = 1
@@ -185,7 +205,7 @@ export default {
     line-height: 40px;
     font-size: 14px;
     color: white;
-    border-radius: 8px;
+    /* border-radius: 8px; */
 }
 
 .result {
@@ -200,7 +220,7 @@ export default {
     line-height: 40px;
     font-size: 14px;
     color: white;
-    border-radius: 8px;
+    /* border-radius: 8px; */
 }
 
 .noMisBox {

+ 5 - 1
src/pages/mission/components/CreateMis.vue

@@ -314,6 +314,7 @@ export default {
                         if (res.code == 0) {
                             successScd.value = true
                             anyData.value = res.data
+                            console.log(anyData.value, 'any')
                         }
                     })
                 }
@@ -330,7 +331,7 @@ export default {
                 if (res.code == 0) {
                     loading.close()
                 }
-                scd.loadScd({ station_id: 861, scd_path: res.data.path, scd_name: res.data.filename }).then(the => {
+                scd.loadScd({ station_id: newMission.value.flashId - 0, scd_path: res.data.path, scd_name: res.data.filename }).then(the => {
                     // scd.getLoadScd({ scd_id: the.data - 0 }).then(lod => {
                     //     console.log(lod,'rsasdas');
                     if (the.code == 0) {
@@ -556,7 +557,10 @@ em {
 }
 
 .mx-1 {
+    width: 180px;
+    height: 30px;
     margin-right: 10px;
+    margin-top: 5px;
     border: 1px solid #5779D7;
 }
 </style>

+ 9 - 6
src/pages/mission/components/HaveMis.vue

@@ -73,19 +73,19 @@
                 <span>详情→</span>
               </p>
               <p>
-                <img src="../../../assets/icon/white_flash.png" alt="" />
+                <img style="width: 15px;height: 15px;" src="../../../assets/icon/flash_darkBlue.png" alt="" />
                 <span style="font-size: 12px;color:#7484AB" class="commonSpan">{{ item.station_name }}</span>
               </p>
               <p>
-                <img src="../../../assets/icon//white_clock.png" alt="" />
+                <img style="width: 15px;height: 15px;" src="../../../assets/icon/clock_darkBlue.png" alt="" />
                 <span style="font-size: 12px;color:#7484AB" class="commonSpan">{{ item.ct }}</span>
               </p>
             </div>
             <!-- 点击检测 -->
             <div class="setNow">
-              <span class="setnowspan" @click="goNetStructPicture(item)">scd可视化</span>
-              <span class="setnowspan">|</span>
-              <span class="setnowspan">检测结果</span>
+              <span style="color: #255CE7;" class="setnowspan" @click="goNetStructPicture(item)">scd可视化</span>
+              <span style="margin: 0 10px;color: #7484AB;" class="setnowspan">|</span>
+              <span style="color: #255CE7;" class="setnowspan">检测结果</span>
             </div>
           </div>
         </div>
@@ -129,7 +129,8 @@ export default {
         path: "/home/netStructPicture",
         query: {
           id: row.scd_id,
-          name: 'UnitTest_检测任务',
+          name: row.name,
+          station:row.station_id,
         },
       });
     }
@@ -214,9 +215,11 @@ export default {
 </script>
 
 <style scoped>
+@import url('https://fonts.font.im/css?family=Montserrat');
 p {
   margin: 0;
   padding: 0;
+  font-family: 'Montserrat', sans-serif;
 }
 
 .bigBox {

+ 15 - 3
src/pages/netStructPicture/components/scdTree.vue

@@ -35,7 +35,7 @@
             </el-table>
         </div>
         <div>
-            <LookScd v-if="lookScdModal" :lookScdModal="lookScdModal" :aktType="aktType" @lookScdBack="lookScdBack">
+            <LookScd v-if="lookScdModal" :lookScdModal="lookScdModal" :stations="stations" :aktType="aktType" @lookScdBack="lookScdBack">
             </LookScd>
         </div>
     </div>
@@ -49,6 +49,12 @@ import systemRow from '@/api/systemRow';
 import { ElMessage, ElLoading } from 'element-plus';
 import LookScd from '../modalCom/LookScd.vue';
 export default {
+    props: {
+        nowStation: {
+            type: String,
+            required: true
+        }
+    },
     setup(props, { emit }) {
         let tableList = ref([])
         let multipleTableRef = ref()
@@ -57,6 +63,10 @@ export default {
         const loading = ref(false)
         let lookScdArr = ref([])
         let lookScdModal = ref(false)
+        let stations = ref("")//变电站id
+        watch(() => props.nowStation, (newVal) => {
+            stations.value = newVal
+        })
         function handleSelectionChange(e) {//复选
         }
         function chooseAll(e) {//全选
@@ -90,7 +100,7 @@ export default {
             })
             scdCheck.scdResult({ comp_id: row.id }).then(res => {
                 console.log(res, '对比详细');
-                if(res.code == 0){
+                if (res.code == 0) {
                     loading.close()
                 }
             })
@@ -104,7 +114,8 @@ export default {
             emit('scdTreeBack', lookScdArr.value)
         }
         function aktType() {//初始化数据
-            scdCheck.flashStation({ station_id: 861 }).then(res => {//获取差异纪录列表
+            stations.value = props.nowStation
+            scdCheck.flashStation({ station_id: stations.value - 0 }).then(res => {//获取差异纪录列表
                 tableList.value = res.data
             })
         }
@@ -127,6 +138,7 @@ export default {
             searchScdCheck,//表格查看按钮
             lookScdArr,
             aktType,//初始化数据
+            stations,//变电站id
         }
     },
     components: {

+ 5 - 3
src/pages/netStructPicture/index.vue

@@ -54,7 +54,7 @@
           <!-- 内容 -->
           <div style="width: 100%;display: flex;justify-content: space-around;align-items: center;margin-top: 5px;">
             <div class="treeBtn">
-              <scdTree @scdTreeBack="scdTreeBack"></scdTree>
+              <scdTree :nowStation="nowStation" @scdTreeBack="scdTreeBack"></scdTree>
             </div>
             <div class="scdMap">
               <scdMap :antherBack="antherBack" :activeNav="activeNav"></scdMap>
@@ -105,6 +105,7 @@ let upFile = ref({})//上传文件流
 let backId = ref('')//返回id
 let nowScdId = ref('')//路由传参的scdid
 let antherBack = ref([])
+let nowStation = ref("")//变电站id
 watch(() => antherBack.value, (newVal) => {
   antherBack.value = newVal
 }, {
@@ -112,6 +113,7 @@ watch(() => antherBack.value, (newVal) => {
 })
 const reload = () => {
   nowScdId.value = route.query.id
+  nowStation.value = route.query.station
 }
 const clickNav = (navIndex) => {  //点击导航栏事件
   activeNav.value = navIndex;
@@ -135,14 +137,14 @@ const closeX = () => {
 const nowUpload = (file, e) => {
   upFile.value = file.file
   upName.value = file.file.name
-  cid.fileUpload({ station_id: 861, file: upFile.value, data_type: "cid" }).then(res => {
+  cid.fileUpload({ station_id: nowStation.value - 0, file: upFile.value, data_type: "cid" }).then(res => {
     if (res.code == 0) {
       let idp = `${file.file.uid},${backId.value}`
       ElMessage({
         type: 'success',
         message: "上传成功!"
       })
-      scdCheck.scdStart({ type: 'cid', station_id: 861, ids: idp }).then(res => {
+      scdCheck.scdStart({ type: 'cid', station_id: nowStation.value - 0, ids: idp }).then(res => {
         console.log(res, 'show');
       })
     }

+ 19 - 9
src/pages/netStructPicture/modalCom/LookScd.vue

@@ -42,9 +42,13 @@ export default {
             type: Boolean,
             required: true
         },
-        aktType:{
-            type:Function,
-            required:true
+        aktType: {
+            type: Function,
+            required: true
+        },
+        stations: {//变电站id
+            type: String,
+            required: true
         }
     },
     setup(props, { emit }) {
@@ -53,7 +57,11 @@ export default {
         let alreadyTriggered = ref(false)//全选开关
         let scdid = ref([])//表格选择的scd数组
         let multipleTableRef = ref()
+        let flashId = ref("")//本组件变电站id
         let loading = ref(false)//loading动画
+        watch(() => props.stations, (newVal) => {
+            flashId.value = newVal
+        })
         function handleClose() {//模态框关闭方法
             dialogVisible.value = false
             emit("lookScdBack", dialogVisible.value)
@@ -72,7 +80,7 @@ export default {
                 // idArr = idArr.toString(idArr)
                 scdCheck.scdStart({
                     type: 'scd',
-                    station_id: 861,
+                    station_id: flashId.value - 0,
                     source_scd_id: idArr[0] - 0,
                     target_scd_id: idArr[1] - 0,
                     comp_id: 0
@@ -81,12 +89,12 @@ export default {
                         loading.value = false
                         props.aktType()
                         dialogVisible.value = false
-                        emit("lookScdBack", dialogVisible.value,scdid.value)
-                    }else{
+                        emit("lookScdBack", dialogVisible.value, scdid.value)
+                    } else {
                         loading.value = false
                         ElMessage({
-                            type:"error",
-                            message:"错误"
+                            type: "error",
+                            message: "错误"
                         })
                     }
                 })
@@ -94,7 +102,8 @@ export default {
         }
         function motType() {//初始化数据
             dialogVisible.value = props.lookScdModal
-            scd.getAllScd({ stationid: 861, pageno: 1, pagesize: 20 }).then(res => {//获取所有scd文件
+            flashId.value = props.stations
+            scd.getAllScd({ stationid: flashId.value - 0, pageno: 1, pagesize: 20 }).then(res => {//获取所有scd文件
                 tableList.value = res.data
             })
         }
@@ -143,6 +152,7 @@ export default {
             scdid,//选择的scd文件数组
             multipleTableRef,
             loading,
+            flashId,//本组件变电站id
         }
     }
 }

+ 81 - 9
src/pages/setting/components/ReportModule.vue

@@ -17,13 +17,17 @@
                         <el-input style="width: 260px;" v-model="moduleName" placeholder="请输入模板名称"></el-input>
                     </div>
                     <div class="litBox">
-                        <span>日期范围</span>
-                        <el-date-picker v-model="getTime" @change="timeChange" type="datetimerange" start-placeholder="开始时间"
+                        <span>状态</span>
+                        <el-select v-model="stateValue" @change="stateChange" class="m-2" placeholder="选择状态" size="default"
+                            style="width: 240px">
+                            <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value" />
+                        </el-select>
+                        <!-- <el-date-picker v-model="getTime" @change="timeChange" type="datetimerange" start-placeholder="开始时间"
                             end-placeholder="结束时间" format="YYYY-MM-DD HH:mm:ss" date-format="YYYY/MM/DD ddd"
-                            time-format="A hh:mm:ss" />
+                            time-format="A hh:mm:ss" /> -->
                     </div>
                     <div class="litBox">
-                        <el-button type="primary" plain><el-icon>
+                        <el-button type="primary" plain @click="search"><el-icon>
                                 <Search />
                             </el-icon>查询</el-button>
                         <el-button @click="searchReport"><el-icon>
@@ -43,6 +47,11 @@
                         <el-table-column property="name" label="模板名称" width="auto" show-overflow-tooltip />
                         <el-table-column property="memo" label="模板描述" width="auto" show-overflow-tooltip />
                         <el-table-column property="ct" label="上传时间" width="auto" show-overflow-tooltip />
+                        <el-table-column property="state" label="状态" width="auto" show-overflow-tooltip>
+                            <template #default="scope">
+                                <span>{{ reState(scope.row.state) }}</span>
+                            </template>
+                        </el-table-column>
                         <el-table-column fixed="right" label="操作" width="180">
                             <template #default="scope">
                                 <el-button link type="primary" size="small" @click="openAdd(1, scope.row)">
@@ -66,9 +75,11 @@
                 <Pagination :tLength="totals"></Pagination>
             </div>
             <div class="modalBox">
-                <Addrm v-if="addModal" :addModal="addModal" :addOrEdit="addOrEdit" :editRow="editRow" :searchReport="searchReport" @armBack="armBack">
+                <Addrm v-if="addModal" :addModal="addModal" :addOrEdit="addOrEdit" :editRow="editRow"
+                    :searchReport="searchReport" @armBack="armBack">
                 </Addrm>
-                <Delrm v-if="delModal" :delModal="delModal" :delId="delId" :searchReport="searchReport" @delrmBack="delrmBack"></Delrm>
+                <Delrm v-if="delModal" :delModal="delModal" :delId="delId" :searchReport="searchReport"
+                    @delrmBack="delrmBack"></Delrm>
             </div>
         </div>
     </div>
@@ -81,6 +92,7 @@ import moment from 'moment';
 import Addrm from '../modalComp/Addrm.vue'
 import Delrm from '../modalComp/Delrm.vue'
 import Pagination from './Pagination.vue';
+import { ElMessage } from 'element-plus';
 export default {
     setup() {
         let reportList = ref([])//报告模板列表
@@ -94,11 +106,34 @@ export default {
         let addOrEdit = ref(0)//0为新增,1为修改
         let editRow = ref({})//需要回显的对象
         let delId = ref('')//需要删除的id
+        let options = ref([
+            {
+                label: "全部",
+                value: '',
+            },
+            {
+                label: "启用",
+                value: 1,
+            },
+            {
+                label: "禁用",
+                value: 2
+            }
+        ])
+        let stateValue = ref("")
         function searchReport() {//查询所有报告模板
             report.getReport({ pageno: 1, pagesize: 20 }).then(res => {
-                console.log(res, 'sss');
-                reportList.value = res.data
-                totals.value = res.count
+                if (res.data != null && res.code == 0) {
+                    reportList.value = res.data
+                    totals.value = res.count
+                    stateValue.value = ''//清空选择器
+                    moduleName.value = ''//清空名称
+                } else {
+                    ElMessage({
+                        message: res.msg,
+                        type: "error"
+                    })
+                }
             })
         }
         function handleSelectionChange(val) {//表格多选事件
@@ -108,6 +143,38 @@ export default {
             let a = moment(e[0]).format("YYYY-MM-DD HH:mm:ss")//开始时间
             let b = moment(e[1]).format("YYYY-MM-DD HH:mm:ss")//结束时间
         }
+        function search() {
+            report.getReport({
+                name: moduleName?.value,
+                state: stateValue?.value - 0,
+            }).then(res => {
+                if (res.code == 0 && res.data != null) {
+                    reportList.value = res.data
+                } else if (res.code == 0 && res.data == null) {
+                    console.log('进入了为查询');
+                    ElMessage({
+                        message: "未查询到数据",
+                        type: "info"
+                    })
+                } else if (res.code == 1) {
+                    console.log("进入了错误");
+                    ElMessage({
+                        message: res.msg,
+                        type: "error"
+                    })
+                }
+            })
+        }
+        function stateChange(e) {
+            stateValue.value = e
+        }
+        function reState(num) {
+            if (num == 1) {
+                return '已启用'
+            } else if (num == 2) {
+                return '已禁用'
+            }
+        }
         function openAdd(num, row) {//打开,新增编辑模态框
             addOrEdit.value = num
             editRow.value = row
@@ -145,6 +212,11 @@ export default {
             openDel,//打开删除模态框
             delId,//需要删除的id
             delrmBack,//delrm.vue返回模态框状态
+            search,//查询列表
+            options,//选择
+            stateValue,//选择状态value
+            stateChange,//选择器change事件
+            reState,//表格筛选状态
         }
     },
     components: {

+ 54 - 22
src/pages/setting/modalComp/Addrm.vue

@@ -12,7 +12,7 @@
                     <el-input style="width: 167px;" v-model="addForm.docName" disabled />
                     <el-upload v-model:file-list="fileList" class="upload-demo" :show-file-list="false"
                         :http-request="uploadFile" multiple :limit="1">
-                        <el-button type="primary" plain><el-icon>
+                        <el-button type="primary" plain :disabled="upState"><el-icon>
                                 <DocumentAdd />
                             </el-icon>点击上传文件</el-button>
                         <!-- <template #tip>
@@ -34,7 +34,7 @@
 </template>
 
 <script>
-import { ref, onMounted, toRefs, reactive } from 'vue';
+import { ref, onMounted, toRefs, reactive, watch } from 'vue';
 import report from '@/api/report';
 import cid from '@/api/cid/cid';
 import { ElMessage } from 'element-plus';
@@ -52,19 +52,22 @@ export default {
             type: Object,
             required: true
         },
-        searchReport:{
-            type:Function,
-            required:true
+        searchReport: {
+            type: Function,
+            required: true
         }
     },
     setup(props, { emit }) {
         let dialogVisible = ref(false)
         let result = props.addModal
         let obj = props.editRow
-        let tipsNow = props.addOrEdit
+        let tipsNow = ref(0)//新增编辑,0新增,1编辑
         let filesCacl = ref({})
+        let needRow = ref({})//需要编辑的数据
+        let needId = ref("")//需要的id
         let { cancels, sureAdd } = toRefs(props)
         let titleTips = ref('新增')
+        let upState = ref(false)//上传文件状态
         let addForm = ref({
             name: "",
             docid: "",
@@ -83,19 +86,32 @@ export default {
                 { required: true, message: '还未选择文件', trigger: 'blur' },
             ],
         })
+        watch(() => props.addOrEdit, (newVal) => {
+            tipsNow.value = newVal
+        })
         function lineList() {//接收父组件参数
-            if (tipsNow == 0) {
+            tipsNow.value = props.addOrEdit
+            if (tipsNow.value == 0) {
                 titleTips.value = '新增'
+                upState.value = false
             }
-            if (tipsNow == 1) {
+            if (tipsNow.value == 1) {
                 titleTips.value = '编辑'
+                upState.value = true
+                needRow.value = props.editRow
+                addForm.value.name = needRow.value.name
+                addForm.value.docid = needRow.value.doc_id
+                // addForm.value.docName = needRow.value.
+                addForm.value.memos = needRow.value.memo
+                addForm.value.states = needRow.value.state
+                needId.value = needRow.value.id
             }
             dialogVisible.value = result
         }
         function uploadFile(e) {
             addForm.value.docName = e.file.name
             filesCacl.value = e.file
-            cid.fileUpload({ station_id: 861, file: filesCacl.value,attachment_type:'tpl' }).then(res => {
+            cid.fileUpload({ station_id: 9999, file: filesCacl.value, attachment_type: "tpl" }).then(res => {
                 addForm.value.docid = res.data.fileid
             })
         }
@@ -104,32 +120,45 @@ export default {
             emit("armBack", dialogVisible.value)
         }
         function getSure() {
-            if (tipsNow == 0) {
+            if (tipsNow.value == 0) {
                 report.addReport({
                     name: addForm.value.name,
                     doc_id: addForm.value.docid - 0,
                     memo: addForm.value.memos,
                     state: addForm.value.states - 0,
                 }).then(res => {
-                    ElMessage({
-                        type:"success",
-                        message:"新增成功"
-                    })
-                    props.searchReport()
-                    dialogVisible.value = false
-                    emit("armBack", dialogVisible.value)
+                    if (res.code == 0) {
+                        ElMessage({
+                            type: "success",
+                            message: "新增成功"
+                        })
+                        props.searchReport()
+                        dialogVisible.value = false
+                        emit("armBack", dialogVisible.value)
+                    } else {
+                        ElMessage({
+                            type: "error",
+                            message: res.msg
+                        })
+                    }
                 })
-            } else if (tipsNow == 1) {
+            } else if (tipsNow.value == 1) {
                 report.addReport({
-                    id: "id",
+                    id: needId.value - 0,
                     name: addForm.value.name,
                     doc_id: addForm.value.docid - 0,
                     memo: addForm.value.memos,
                     state: addForm.value.states - 0,
                 }).then(res => {
-                    props.searchReport()
-                    dialogVisible.value = false
-                    emit("armBack", dialogVisible.value)
+                    if (res.code == 0 && res.data != null) {
+                        props.searchReport()
+                        dialogVisible.value = false
+                        emit("armBack", dialogVisible.value)
+                        ElMessage({
+                            message: "修改成功",
+                            type: "success"
+                        })
+                    }
                 })
             }
 
@@ -148,6 +177,9 @@ export default {
             titleTips,
             formRule,
             filesCacl,
+            needRow,//需要编辑的数据
+            needId,//需要的id
+            upState,//上传文件状态
         }
     }
 }