licp
2024-12-20 d975fc4756806f5b51f006c19c33571b9b8c0b3b
src/view/index.vue
@@ -16,7 +16,7 @@
   }
   .logo {
      width: 130px;
      width: 118px;
      height: 40px;
   }
@@ -225,8 +225,8 @@
   .component_view {
      height: calc(100vh - 84px);
      width: calc(100% - 52px);
      padding: 0 26px;
      width: calc(100% - 40px);
      padding: 0 20px;
      background: rgb(245, 247, 251);
   }
@@ -295,6 +295,9 @@
         </div>
         <div class="label">LIMS实验室管理系统</div>
         <div class="user">
        <el-badge :is-dot="newMsg" style="cursor: pointer;margin-right: 10px;">
          <i class="el-icon-bell" style="font-size: 20px;" @click="openNotice"></i>
        </el-badge>
        <el-dropdown trigger="click" @command="handleCommand">
          <el-avatar :size="26">{{ userName.substring(0, 1) }}</el-avatar>
              <span>{{ userName }}</span>
@@ -345,7 +348,7 @@
         </div>
         <div class="component_view">
            <component class="com_index" v-for="(com, index) in tabs" :is="com.u" :key="com.k" v-show="com.k == tabActive"
               :ref="`com-${com.k}`">
               :ref="`com-${com.k}`" :param="param">
            </component>
         </div>
      </div>
@@ -354,15 +357,16 @@
         <el-col :span="24">
            <el-card :body-style="{padding: '6px'}">
               <ul>
                  <li @click="removeTab(activeIndex)"><i class="el-icon-close"></i>关闭</li>
                  <li @click="allDel"><i class="el-icon-delete"></i>关闭所有</li>
                  <li @click="rightDel(activeIndex)"><i class="el-icon-d-arrow-right"></i>关闭右侧页签</li>
                  <li @click="removeTab(activeIndex)" v-show="menuId!=0" style="text-align: left;"><i class="el-icon-close"></i>关闭</li>
                  <li @click="allDel" style="text-align: left;"><i class="el-icon-delete"></i>关闭所有</li>
                  <li @click="rightDel(activeIndex)" style="text-align: left;"><i class="el-icon-d-arrow-right"></i>关闭右侧页签</li>
                  <el-divider></el-divider>
                  <li @click="refreshTable"><i class="el-icon-refresh"></i>刷新</li>
                  <li @click="refreshTable" style="text-align: left;"><i class="el-icon-refresh"></i>刷新</li>
               </ul>
            </el-card>
         </el-col>
      </div>
    <!-- 修改密码 -->
    <el-dialog
      title="修改密码"
      :visible.sync="editVisible"
@@ -389,6 +393,8 @@
        <el-button type="primary" @click="handleEdit">确 定</el-button>
      </span>
    </el-dialog>
    <notice ref="notice" @goNoticeDetail="checkForUnreadData()" />
    <!-- <timer></timer> -->
   </div>
</template>
@@ -405,9 +411,11 @@
   });
   import menus from '../../static/js/menu.js'
   import nullFace from '../view/404.vue'
  import notice from './notice.vue'
  import timer from './timer.vue';
   comObj['nullFace'] = nullFace
   export default {
      components: comObj,
      components: {...comObj,notice,timer},
      data() {
         return {
            userName: "value",
@@ -421,11 +429,24 @@
            activeIndex: 0,
            power: [],
        editVisible:false,
        query:{}
        query:{},
        newMsg:false,
        timer:null,
        menuId: 0,
        param:null,
         };
      },
      created() {
         this.menu = menus.menu
      if (this.PROJECT !== '装备电缆') { // 检测中心暂无'原材料检验下单'功能
        const index = this.menu.findIndex(item => item.v === '业务管理')
        if (index > -1) {
          const index2 = this.menu[index].c.findIndex(obj => obj.v === '原材料检验下单')
          if (index2 > -1) {
            this.menu[index].c.splice(index2, 1)
          }
        }
      }
      },
      mounted() {
         this.userName = JSON.parse(localStorage.getItem("user")).name;
@@ -436,7 +457,7 @@
               k: 0,
               v: "个人首页",
               i: "font icon-a-Group1124",
               u: "nullFace"
               u: "index-index"
            }]
         }
         this.tabActive = JSON.parse(localStorage.getItem('tabActive'))
@@ -452,6 +473,11 @@
            this.activeBox = 0
         }
         this.getPower()
      this.timer&&clearInterval(this.timer);
      this.checkForUnreadData()
      this.timer = setInterval(()=>{
        this.checkForUnreadData()
      },30000)
      },
      methods: {
         saveClick(){
@@ -474,12 +500,33 @@
               if (ob.u == "") ob.u = "nullFace"
               this.tabs.push(ob);
            }
        if(ob.param){
          this.param = this.HaveJson(ob.param)
          this.param.textNum = Math.random(100)
        }else{
          this.param = null
        }
            this.$refs['popoverName'].forEach(a=>{
               a.doClose()
            })
            this.saveClick()
         },
         removeTab(index) {
        let obj = this.$refs[`com-${this.tabs[index].k}`][0]
        if(obj.state&&obj.state==1&&this.tabs[index].v=='检验任务'&&(obj.version===0||obj.version===1)){
          this.$confirm('请确认当前数据是否全部保存,是否关闭当前页面?', '提示', {
            confirmButtonText: '确定',
            cancelButtonText: '取消',
            type: 'warning'
          }).then( async () => {
            if(await obj.$refs.Inspection.$refs.CircuitParameters.saveAll()){
              this.tabs.splice(index, 1);
              let data = this.tabs[this.tabs.length - 1]
              this.upTabActive(data.k)
            }
          })
          return
        }
            this.tabs.splice(index, 1);
            let data = this.tabs[this.tabs.length - 1]
            this.upTabActive(data.k)
@@ -499,7 +546,7 @@
               k: 0,
               v: "个人首页",
               i: "font icon-a-Group1124",
               u: "nullFace"
               u: "index-index"
            }]
            this.saveClick()
         },
@@ -533,7 +580,8 @@
         },
         // 右键菜单
         rightKeyMenu(id, e) {
            if (id == 0) return
            // if (id == 0) return
        this.menuId = id
            this.activeIndex = id
            var x = e.clientX + 'px'
            var y = e.clientY + 'px'
@@ -585,13 +633,21 @@
        this.editVisible = true;
      },
      handleEdit(){
        const reg2 =
          /^(?=.*?[a-z])(?=.*?[A-Z])(?=.*?\d)(?=.*?[~!#@$%^*&()_+{}\[\]|\\;:'",<.>\/?])[a-zA-Z\d~!#@$%^*&()_+{}\[\]|\\;:'",<.>\/?]*$/;
        if (!this.query.oldPassword) {
          this.$message.error('请填写旧密码')
          return
        }else if (!reg2.test(this.query.oldPassword)) {
          this.$message.error('密码必须包括数字、大小写字母以及特殊字符')
            return
        }
        if (!this.query.newPassWord) {
          this.$message.error('请填写旧密码')
          return
        }else if (!reg2.test(this.query.newPassWord)) {
          this.$message.error('密码必须包括数字、大小写字母以及特殊字符')
            return
        }
        this.$axios.post(this.$api.user.upUserPassword, {...this.query}).then(res => {
            if (res.code == 201) {
@@ -607,7 +663,22 @@
      handleClose(){
        this.editVisible = false
        this.query = {}
      },
      openNotice(){
        this.$refs.notice.open()
        this.$refs.notice.handleType()
      },
      checkForUnreadData(){
        this.$axios.get(this.$api.informationNotification.checkForUnreadData).then(res => {
          if (res.code == 201) {
            return
          }
          this.newMsg = res.data
        })
      }
      }
      },
    destroyed() {
      this.timer&&clearInterval(this.timer);
    }
   };
</script>