王震
2023-08-28 694ffa950bf2435affef95272c7bfd6b62704639
Merge remote-tracking branch 'origin/master'

# Conflicts:
# .env.development
已修改18个文件
914 ■■■■ 文件已修改
.env.development 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/laboratory/role.js 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/Breadcrumb/index.vue 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/experiment/checkTheReport/index.vue 36 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/layout/components/Navbar.vue 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/layout/components/Sidebar/Item.vue 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/layout/index.vue 16 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/router/index.js 161 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/utils/request.js 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/basicData/index.vue 34 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/experiment/checkTheReport/index.vue 9 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/home/index.vue 补丁 | 查看 | 原始文档 | blame | 历史
src/views/laboratory/measure/Add.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/laboratory/measure/index.vue 18 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/laboratory/personnel/index.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/laboratory/role/index.vue 477 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/login/index.vue 37 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/standardLibrary/index.vue 61 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
.env.development
@@ -2,6 +2,4 @@
ENV = 'development'
# base api
# VUE_APP_BASE_API =  'http://192.168.0.4:1234/'
VUE_APP_BASE_API = 'http://192.168.110.107:1234/'
VUE_APP_BASE_API =  'http://localhost:1234/'
src/api/laboratory/role.js
@@ -32,3 +32,20 @@
      params
    })
  }
  export function deleteRole(params) {
    return request({
      url: '/role-manager/deleteRole',
      method: 'get',
      params
    })
  }
  //updateRoleMenu
  export function updateRoleMenu(data) {
    return request({
      url: '/role-manager/updateRoleMenu',
      method: 'post',
      data
    })
  }
src/components/Breadcrumb/index.vue
@@ -11,8 +11,8 @@
  </el-breadcrumb>
  </el-col>
  <el-col :span="12" style="background-color: #fff;display: flex;justify-content: end; align-items: center;">
    <el-button v-if="backPlan" type="primary" icon="el-icon-refresh-left" size="mini" plain @click="backPlanUp">返回</el-button>
    <el-button v-if="add" size="mini" @click="breadd" style="width: 60px;" type="primary">保存</el-button>
    <!-- <el-button v-if="backPlan" type="primary" icon="el-icon-refresh-left" size="mini" plain @click="backPlanUp">返回</el-button> -->
    <!-- <el-button v-if="add" size="mini" @click="breadd" style="width: 60px;" type="primary">保存</el-button> -->
  <el-col :span="1"></el-col>
  </el-col>
</div>
src/components/experiment/checkTheReport/index.vue
@@ -5,7 +5,7 @@
        </div>
        <div class="center">
            <h1>原材料检测报告</h1>
            <table>
            <table height="30px">
                <tr>
                    <td>材料名称</td>
                    <td colspan="5">{{reportData.name}}</td>
@@ -26,7 +26,9 @@
                </tr>
                <tr>
                    <td>检测依据</td>
                    <td colspan="2">{{reportData.specifications.split("-")[0]}}</td>
                    <td colspan="2">
                        {{reportData.specifications.split("-")[0]}}
                    </td>
                    <td>检测类别</td>
                    <td colspan="2">原材料</td>
                </tr>
@@ -44,7 +46,7 @@
                    <td>{{item.unit}}</td>
                    <td>{{item.required}}</td>
                    <td>{{item.testValue}}</td>
                    <td>{{item.testState == 1 ? "√" : "X"}}</td>
                    <td>{{item.testState === 1 ? "√" : "X"}}</td>
                </tr>
                <tr>
                    <td colspan="6">检验结论:{{reportData.type == 1 ? "合格" : "不合格"}}</td>
@@ -55,14 +57,14 @@
                    </td>
                </tr>
            </table>
            <el-row class="date-group" :gutter="20">
                <el-col :span="12">检测、日期:<span>{{reportData.createTime}}</span></el-col>
                <el-col :span="12">审核、日期:<span>{{reportData.checkTime}}</span></el-col>
            <el-row class="date-group">
                <p>检测、日期:<span>{{reportData.createTime}}</span></p>
                <p>审核、日期:<span>{{reportData.checkTime}}</span></p>
            </el-row>
            <p class="footer">
                <span>编号:</span><span>{{reportData.reportCode}}</span>
                <span> 发行日期:</span><span>{{new Date() | formatDate}}</span>
                <span> 保存期限:</span><span>长期</span>
                <span>编号:</span><span>{{reportData.rcode}}  </span>
                <span>发行日期:</span><span>{{now}}  </span>
                <span>保存期限:</span><span>长期</span>
            </p>
        </div>
    </div>
@@ -72,6 +74,7 @@
    data() {
        return {
            logoSrc : require("@/assets/404_images/logo.png"),    
            now: new Date().toLocaleDateString()
        }
    },
    methods:{
@@ -107,7 +110,6 @@
            }
            table{
                width:100%;
                height:100vh;
                border-collapse: collapse;
                font-size: 18px;
            }
@@ -115,19 +117,23 @@
                border: 2px solid black;
            }
            tr,td,th{
                padding: 5px 5px;
                padding: 10px 10px;
            }
            .date-group .el-col{
            .date-group{
                width: 90%;
                margin-left: 5%;
                p{
                    width: 50%;
                    float: left;
                text-align: center;
                padding: 50px 0px;
                font-size: 18px;
            }
            }
            .footer{
                margin: 0;
                padding: 0;
                width:90%;
                margin-left: 5%;
                color: gray;
                color: lightgray;
                text-align: center;
                margin-top: 250px;
            }
src/layout/components/Navbar.vue
@@ -64,6 +64,10 @@
        newPwd: '',
        confirmPwd: ''
      },
      user: {
                id: null,
                name: 'value'
            },
      dialogFormVisible: false,
      formLabelWidth: '120px',
            user: {
@@ -103,11 +107,15 @@
    },
    async logout() {
      // await this.$store.dispatch('user/logout')
      sessionStorage.removeItem("user")
      this.$router.push(`/login?redirect=${this.$route.fullPath}`)
      this.$router.replace({path: '/login'});
      location.reload();
    },
        getUser(){
            get(this.$url.info).then(res=>{
                this.user = res.data
        sessionStorage.setItem("user",JSON.stringify(res.data))
            })
        }
  }
src/layout/components/Sidebar/Item.vue
@@ -16,6 +16,9 @@
      default: ''
    }
  },
  created(){
  },
  render(h, context) {
    const { icon, title } = context.props
    const vnodes = []
src/layout/index.vue
@@ -51,6 +51,12 @@
      }
    }
  },
  created() {
    if (sessionStorage.getItem("flushPage") == 0) {
      location.reload();
      sessionStorage.setItem("flushPage",1)
    }
  },
  methods: {
    handleClickOutside() {
      this.$store.dispatch('app/closeSideBar', { withoutAnimation: false })
@@ -80,30 +86,37 @@
    position: relative;
    height: 100%;
    width: 100%;
    &.mobile.openSidebar{
      position: fixed;
      top: 0;
    }
    .sidebar-container{
      box-shadow: 0 0 0.857143rem rgba(0,0,0,.12);
    }
    .main-container{
      position: relative;
      background:  #f0f2f5;
      .clearFixed{
        height: 50px;
      }
      .breadcrumb{
        position: fixed;
        left: 0.57rem !important;
        width: 93.8%;
        z-index: 999;
      }
      .app-main{
        margin-top: 4vh;
      }
    }
  }
  .drawer-bg {
    background: #000;
    opacity: 0.3;
@@ -130,5 +143,4 @@
  .mobile .fixed-header {
    width: 100%;
  }
</style>
}</style>
src/router/index.js
@@ -30,7 +30,8 @@
 * a base page that does not have permission requirements
 * all roles can be accessed
 */
export const constantRoutes = [
function getRoutes() {
  let constantRoutes = [
  {
    path: '/login',
    component: () => import('@/views/login/index'),
@@ -44,11 +45,6 @@
  {
    path: '/addCommision',
    component: () => import('@/views/inspectionManagement/commissionInspection/addCommision'),
    hidden:true
  },
  {
    path: '/testReport',
    component: () => import('@/views/template_testReport/index'),
    hidden:true
  },
  {
@@ -437,6 +433,7 @@
      {
        path: 'message',
        name: 'Message',
          // hidden: true,
        component: () => import('@/views/message/message/index'),
        // meta: { title: '我的消息', icon: 'table' }
      },
@@ -467,32 +464,154 @@
    path: '/baseData',
    component: Layout,
    redirect: '/baseData/basicDataMessage',
      name: 'BaseData',
    meta: { title: '基础数据', icon: 'el-icon-s-tools' },
    children: [
      {
        path: '/basicDataMessage',
          path: 'basicDataMessage',
        name: 'BasicDataMessage',
        component: () => import('@/views/basicData/index'),
        meta: { title: '基础数据', icon: 'el-icon-s-tools' }
      }
    ]
  },
  // 404 page must be placed at the end !!!
  { path: '*', redirect: '/404', hidden: true }
]
const createRouter = () => new Router({
  mode: 'history',
  scrollBehavior: () => ({ y: 0 }),
  routes: constantRoutes
})
const router = createRouter()
// Detail see: https://github.com/vuejs/vue-router/issues/1234#issuecomment-357941465
export function resetRouter() {
  const newRouter = createRouter()
  router.matcher = newRouter.matcher // reset router
  return constantRoutes
}
const baseRouter = [{
  path: '/login',
  component: () => import('@/views/login/index'),
  hidden: true
},
{
  path: '/404',
  component: () => import('@/views/404'),
  hidden: true
},
{
  path: '/addCommision',
  component: () => import('@/views/inspectionManagement/commissionInspection/addCommision'),
  hidden: true
},
{
  path: '/',
  component: Layout,
  redirect: '/home',
  // meta: { title: '主页', icon: 'el-icon-s-home' },
  children: [{
    path: 'home',
    name: 'Home',
    component: () => import('@/views/home/index'),
    meta: { title: '主页', icon: 'el-icon-s-home' }
  }]
}, {
  path: '/addCommision/:viewId',
  hidden: true,
  component: () => import('@/views/inspectionManagement/commissionInspection/addCommision'),
}]
function fn3(tempArr) {
  let result = [];
  let obj = {};
  for (let i = 0; i < tempArr.length; i++) {
      if (!obj[tempArr[i].path]) {
          result.push(tempArr[i]);
          obj[tempArr[i].path] = true;
      };
  };
  return result;
};
function createRouter(Routees) {
  if (JSON.parse(sessionStorage.getItem("user")) != undefined && JSON.parse(sessionStorage.getItem("user")) != null) {
    let role = JSON.parse(sessionStorage.getItem("user")).role
    let menuFather = baseRouter
    const dataMenuFather = fn3(menuFather)
    role.roleMenuList.forEach((r) => {
      dataMenuFather.push(Routees.filter(item => {
        return item.path === r.menuUrl
      })[0])
    })
    let eqChildren = [];
    role.roleMenuList.forEach((r) => {
      dataMenuFather.forEach(m => {
        if (r.menuUrl === m.path) {
          r.children.forEach(rc => {
            m.children.forEach(mc => {
              if (mc.meta != undefined) {
                eqChildren.push({ "path": mc.path, "meta": JSON.parse(JSON.stringify(mc.meta)) })
                delete mc["meta"]
              }
            })
          })
        }
      })
    })
    let once = []
    role.roleMenuList.forEach((r) => {
      r.children.forEach(rc => {
        eqChildren.forEach(eq => {
          if (eq != undefined) {
            if (eq.path == rc.menuUrl.split("/")[1]) {
              once.push(eq)
            }
          }
        })
      })
    })
    dataMenuFather.forEach(m => {
      let i = 0
      if (m.children != undefined) {
        m.children.forEach(mc => {
          once.forEach(eq => {
            if (eq != undefined) {
              if (mc.path == eq.path) {
                if (i === 0) {
                  m.redirect = m.path + "/" + eq.path
                }
                i++;
                mc.meta = eq.meta
              }
            }
          })
        })
      }
    })
    dataMenuFather.push({path: '*', redirect: '/404', hidden: true})
    dataMenuFather.push()
    Routees = dataMenuFather
  } else {
    Routees = baseRouter
  }
  return new Router({
    // mode: 'history', // require service support
    scrollBehavior: () => ({ y: 0 }),
    routes: Routees
  })
}
let router =  createRouter(getRoutes())
// Detail see: https://github.com/vuejs/vue-router/issues/1234#issuecomment-357941465
export async function resetRouter() {
  let newRouter = createRouter(getRoutes())
  router.matcher =  newRouter.matcher
}
router.beforeEach(async (to, from, next) => {
  // 1. 判断是不是登录页面
  // 是登录页面
  if (to.path === '/login') {
    next()
  } else {
    // 不是登录页面
    // 2. 判断 是否登录过
    let token = sessionStorage.getItem('user')
    if(token!=null&&token!=undefined){
      await resetRouter()
    }
    token ? next() : next('/login')
  }
})
export default router
src/utils/request.js
@@ -48,6 +48,31 @@
    // if the custom code is not 20000, it is judged as an error.
    if (res.code !== 200) {
      if(res.code===400){
        Message({
        message: res.message,
        type: 'warning',
        duration: 5 * 1000
      })
      }
      if(res.code===401){
        Message({
        message: res.message,
        type: 'warning',
        duration: 5 * 1000
      })
      sessionStorage.removeItem("user")
      sessionStorage.setItem("flushPage",1)
      this.$router.replace({path: '/login'});
      location.reload()
      }
      if(res.code===403){
        Message({
        message: res.message,
        type: 'warning',
        duration: 5 * 1000
      })
      }
      // Message({
      //   message: res.message || 'Error',
      //   type: 'error',
src/views/basicData/index.vue
@@ -52,12 +52,8 @@
          width="30%"
          right
          :before-close="handleClose"
          :title="isUpdate ? '更新' : '新增'"
        >
          <template slot="title">
            <div class="addTop">
              <span>{{ isUpdate ? "更新" : "新增" }}基础数据</span>
            </div>
          </template>
          <el-form :model="form" :rules="rules" ref="ruleForm" class="addForm">
            <el-form-item prop="material" required>
              <span>样品名称:</span>
@@ -387,13 +383,13 @@
      });
    },
    handleSelectionChange(val) {
      this.deleteList = []
      this.deleteList = [];
      val.forEach((v) => {
        if(v.id !== undefined) {
          this.deleteList.push(v.id)
          this.deleteList.push(v.id);
        }
      })
      console.log(`output->this.deleteList`,this.deleteList)
      });
      console.log(`output->this.deleteList`, this.deleteList);
    },
    // 表格树全部选中配置  结束
    deleteListClick() {
@@ -458,12 +454,6 @@
  position: relative;
  padding: 0 10px 10px 10px;
}
.el-dialog__header {
  padding: 0;
}
.el-dialog__headerbtn {
  top: 0;
}
.el-dialog__close {
  padding: 8px 0;
  color: #ffffff !important;
@@ -479,20 +469,6 @@
}
.el-dialog__body {
  padding: 30px 20px 0 20px;
}
.addTop {
  border-top-left-radius: 10px;
  border-top-right-radius: 10px;
  background-color: #00a5ff;
  color: #ffffff;
  padding: 8px 20px;
  float: left;
  height: 30px;
  width: 100%;
}
.addTop span {
  font-size: 16px;
  font-weight: 700;
}
.table_div {
  margin-top: 10px;
src/views/experiment/checkTheReport/index.vue
@@ -60,7 +60,8 @@
          <el-button type="primary" @click="printFun()">打印</el-button>
        </span>
        <div class="printStyle">
          <preview id="printDiv" :reportData="reportData"></preview>
          <preview id="printDiv" :reportData="reportData" v-if="reportType===0"></preview>
          <div v-else>成品检测报告</div>
        </div>
      </el-dialog>
      <div class="table-box">
@@ -186,6 +187,7 @@
  data() {
    return {
      reportData: [],
      reportType: 0,
      searchData:{
        sample_code:'',
        reportCode:'',
@@ -217,6 +219,7 @@
    //查看报告按钮
    previewFun(row){
      this.dialogVisible = true;
      this.reportType = row.type;
      this.queryReportByRCode(row.reportCode);
    },
    //打印按钮
@@ -295,6 +298,8 @@
  }
}
.library-table {
  height: 80vh;
  overflow: scroll;
  background-color: #fff;
  flex: 1;
  margin: 0px -15px;
@@ -324,7 +329,7 @@
  }
  .printStyle{
    overflow: scroll;
    height:600px;
    height:500px;
    .el-button{
      position: absolute;
      top: 10vh;
src/views/home/index.vue
src/views/laboratory/measure/Add.vue
@@ -40,7 +40,7 @@
        <el-col style="width:93%;height: 20vh;margin-top: 30px; margin-left: 40px;">
            <el-button icon="el-icon-plus" @click="addcodePointsTable()" style="margin-bottom: 10px;"
                type="primary">新增计量</el-button>
            <el-table ref="codePointsTable" :cell-style="{ textAlign: 'center' }"
            <el-table max-height="300" ref="codePointsTable" :cell-style="{ textAlign: 'center' }"
                :header-cell-style="{ border: '0px', background: '#f5f7fa', color: '#606266', boxShadow: 'inset 0 1px 0 #ebeef5', textAlign: 'center' }"
                :data="codePointsTable" style="width: 100%">
                <el-table-column type="index" v-model="codePointsTable.index" label="序号" min-width="90" />
src/views/laboratory/measure/index.vue
@@ -117,6 +117,13 @@
          </div>
        </div>
      </div>
      <div>
        <el-button v-if="selectInfoBtn" @click="combackLookPlan" style="position: fixed;top: 43px;right: 14px; z-index: 1000;" type="primary" icon="el-icon-refresh-left" size="mini" plain >返回</el-button>
        <div v-if="addBtn" style="display: flex;justify-content: center;width: 10%;position: fixed;top: 43px;right: 14px; z-index: 1000;">
          <el-button @click="addTop = -82;addBtn=false" size="mini" style="width: 60px;" >返回</el-button>
          <el-button size="mini" @click="measureAdd" style="width: 60px;" type="primary">保存</el-button>
        </div>
      </div>
      <div
        :style="`position: absolute;top:${addTop}vh;left: 9px;transition: 1s;width: 99%;height: 82vh;background-color: #fff;z-index: 21;`">
        <Add ref="add" />
@@ -150,7 +157,7 @@
          </el-col>
        </el-col>
        <el-col style="width:93%;height: 20vh;margin-top: 30px; margin-left: 40px;">
          <el-table :data="measureData">
          <el-table max-height="300" :data="measureData">
            <el-table-column type="index" label="序号" />
            <el-table-column prop="equipmentCode" label="仪器设备编号" />
            <el-table-column prop="equipmentName" label="仪器设备名称" />
@@ -276,6 +283,8 @@
    return {
      dialogVisible: false,
      tableIndex: null,
      selectInfoBtn: false,
      addBtn: false,
      measureUpInfo: {
        id: null,
        code: null,
@@ -370,18 +379,16 @@
      this.measureUpInfo.termValidity = scope.row.termValidity
    },
    measureAdd() {
      let add = this.$refs.add.add()
      if (add) {
        this.addTop = -82
        this.$message({
          message: '操作成功!',
          type: 'success'
        });
        this.lookVisible = false
      }
    },
    async handleSizeChangePlan(num) {
      this.pageSizePlan = num
      this.currentPagePlan=1
      await this.limitGetPlanMeasureInstrument()
    },
    async handleCurrentChangePllan(num) {
@@ -392,6 +399,7 @@
      this.addTop = 2
      this.lookVisible = true
      this.$parent.mainShowAdd()
      this.addBtn=true
    },
    async limitGetPlanMeasureInstrument() {
      let param = {
@@ -408,6 +416,7 @@
      this.getPlanAndInfoAndIns(id)
      this.lookVisible = true
      this.mymodelTop = 2
      this.selectInfoBtn=true
      this.$parent.triggerMainBtnPlan()
    },
    async getPlanAndInfoAndIns(id) {
@@ -429,6 +438,7 @@
    combackLookPlan() {
      this.lookVisible = false
      this.mymodelTop = -85
      this.selectInfoBtn=false
    },
    blurSearch() {
      if (this.radioValue === 1) {
src/views/laboratory/personnel/index.vue
@@ -86,7 +86,7 @@
              <el-select
                v-model="form.roleId"
                clearable
                style="100%"
                style="width: 100%"
                placeholder="请选择权限"
              >
                <el-option
src/views/laboratory/role/index.vue
@@ -8,7 +8,7 @@
            </el-input>
          </el-form-item>
          <el-form-item class="rightBtn">
            <el-button type="primary">查询</el-button>
            <el-button type="primary" @click="searchRole">查询</el-button>
            <el-button type="primary" plain>重置</el-button>
          </el-form-item>
        </el-form>
@@ -16,7 +16,6 @@
          <el-form-item class="rightBtn">
            <el-button type="primary" @click="addClickRole" icon="el-icon-plus">新增角色</el-button>
          </el-form-item>
        </el-form>
        </el-form>
      </div>
      <div class="library-table">
@@ -30,8 +29,9 @@
            <el-table-column prop="updateTime" label="更新时间" min-width="20%" />
            <el-table-column label="操作" min-width="12%">
              <template slot-scope="scope">
                <el-button type="text" size="small">编辑</el-button>
                <el-button type="text" size="small">删除</el-button>
                <el-button type="text" @click="selectRoleInfo(scope)" size="small">查看</el-button>
                <el-button type="text" @click="upRole(scope)" size="small">编辑</el-button>
                <el-button type="text" @click="removeRole(scope)" size="small">删除</el-button>
              </template>
            </el-table-column>
          </el-table>
@@ -67,10 +67,10 @@
          :default-expand-all="false" :tree-props="{ children: 'children', hasChildren: 'hasChildren' }">
          <el-table-column highlight-current-row prop="parentId" label="菜单类型" sortable width="180">
            <template slot-scope="scope">
              <span v-if="scope.row.parentId == 0 && scope.row.children != undefined" style="color: #409eff;">主菜单</span>
              <span v-if="scope.row.parentId == 0 && scope.row.children === undefined" style="color: #409eff;">
              <span v-if="scope.row.parentId == 0" style="color: #409eff;">主菜单</span>
              <!-- <span v-if="scope.row.parentId == 0 && scope.row.children === undefined" style="color: #409eff;">
                主菜单
              </span>
              </span> -->
            </template>
          </el-table-column>
          <el-table-column prop="name" label="菜单名" sortable width="180">
@@ -103,11 +103,125 @@
        <el-button type="primary" @click="addRole">确 定</el-button>
      </span>
    </el-dialog>
    <el-dialog top="5vh" title="编辑角色" :visible.sync="dialogTableVisibleUpdate" width="50%">
      <el-form :model="updateRole" ref="updateRole" label-position="right" label-width="100px">
        <el-col :span="24" style="display: flex;justify-content: space-between;">
          <el-form-item :rules="nameaRules" label="角色名:">
            <el-input @blur="assertUpName" style="width: 300px" v-model="updateRole.roleName" placeholder="请输入角色名">
            </el-input>
          </el-form-item>
          <!-- <el-form-item label="菜单选择:">
            <el-cascader style="width: 300px" collapse-tags size="medium " filterable :props="props"
              v-model="roleAdd.menuData" :options="menuInfo">
              <template slot-scope="{ data }">
                <span>{{ data.label }}</span>
              </template>
            </el-cascader>
          </el-form-item> -->
        </el-col>
      </el-form>
      <el-col :span="24">
        <el-table height="500" :data="menuUpdateInfo" style="width: 100%;margin-bottom: 20px;" row-key="id"
          :default-expand-all="true" :tree-props="{ children: 'children', hasChildren: 'hasChildren' }">
          <el-table-column highlight-current-row prop="parentId" label="菜单类型" sortable width="180">
            <template slot-scope="scope">
              <span v-if="scope.row.parentId == 0" style="color: #409eff;">主菜单</span>
              <!-- <span v-if="scope.row.parentId == 0 && scope.row.children === undefined" style="color: #409eff;">
                主菜单
              </span> -->
            </template>
          </el-table-column>
          <el-table-column prop="name" label="菜单名" sortable width="180">
            <template slot-scope="scope">
              <el-col v-if="scope.row.parentId == 0">
                <span style="color: #409eff;">{{ scope.row.name }}</span>
              </el-col>
              <el-col v-else>
                <span style="color: #40b815;">{{ scope.row.name }}</span>
              </el-col>
            </template>
          </el-table-column>
          <el-table-column prop="id" label="操作权限">
            <template slot-scope="scope">
              <el-col v-if="scope.row.parentId == 0 && scope.row.children != undefined">
                <!-- <el-checkbox v-model="scope.row.select">查询</el-checkbox> -->
              </el-col>
              <el-col v-else>
                <el-checkbox size="medium" v-model="scope.row.selected" @change="chekSelect(scope)">查询</el-checkbox>
                <el-checkbox size="medium" v-model="scope.row.added" @change="chekAdd(scope)">添加</el-checkbox>
                <el-checkbox size="medium" v-model="scope.row.updated" @change="chekUpdate(scope)">修改</el-checkbox>
                <el-checkbox size="medium" v-model="scope.row.deleted" @change="chekDelet(scope)">删除</el-checkbox>
              </el-col>
            </template>
          </el-table-column>
        </el-table>
      </el-col>
      <span slot="footer" class="dialog-footer">
        <el-button @click="clearUPAll">取 消</el-button>
        <el-button type="primary" @click="cilckUP">确 定</el-button>
      </span>
    </el-dialog>
    <el-dialog top="5vh" title="角色察看" :visible.sync="dialogTableSelectVisible" width="50%">
      <el-form :model="selectMenuInfo" ref="selectMenuInfo" label-position="right" label-width="100px">
        <el-col :span="24" style="display: flex;justify-content: space-between;">
          <el-form-item label="角色名:">
            <el-input style="width: 300px" v-model="selectMenuInfo.roleName" readonly>
            </el-input>
          </el-form-item>
          <!-- <el-form-item label="菜单选择:">
            <el-cascader style="width: 300px" collapse-tags size="medium " filterable :props="props"
              v-model="roleAdd.menuData" :options="menuInfo">
              <template slot-scope="{ data }">
                <span>{{ data.label }}</span>
              </template>
            </el-cascader>
          </el-form-item> -->
        </el-col>
      </el-form>
      <el-col :span="24">
        <el-table height="500" :data="selectMenuInfo.menuData" style="width: 100%;margin-bottom: 20px;" row-key="menuId"
          :default-expand-all="true" :tree-props="{ children: 'children', hasChildren: 'hasChildren' }">
          <el-table-column highlight-current-row prop="parentId" label="菜单类型" sortable width="180">
            <template slot-scope="scope">
              <span v-if="scope.row.parentId == 0" style="color: #409eff;">主菜单</span>
              <!-- <span v-if="scope.row.parentId == 0 && scope.row.children === undefined" style="color: #409eff;">
                主菜单
              </span> -->
            </template>
          </el-table-column>
          <el-table-column prop="menuName" label="菜单名" sortable width="180">
            <template slot-scope="scope">
              <el-col v-if="scope.row.parentId == 0">
                <span style="color: #409eff;">{{ scope.row.menuName }}</span>
              </el-col>
              <el-col v-else>
                <span style="color: #40b815;">{{ scope.row.menuName }}</span>
              </el-col>
            </template>
          </el-table-column>
          <el-table-column prop="menuId" label="操作权限">
            <template slot-scope="scope">
              <el-col v-if="scope.row.parentId == 0 && scope.row.children.length > 0">
                <!-- <el-checkbox v-model="scope.row.select">查询</el-checkbox> -->
              </el-col>
              <el-col id="selectRoleCheck" class="selectRoleCheck" v-else>
                <el-checkbox size="medium" disabled v-model="scope.row.selected">查询</el-checkbox>
                <el-checkbox size="medium" disabled v-model="scope.row.added">添加</el-checkbox>
                <el-checkbox size="medium" disabled v-model="scope.row.updated">修改</el-checkbox>
                <el-checkbox size="medium" disabled v-model="scope.row.deleted">删除</el-checkbox>
              </el-col>
            </template>
          </el-table-column>
        </el-table>
      </el-col>
    </el-dialog>
  </div>
</template>
<script>
import { getMenusTree, addRoleInfo, assertRepeat, getAllRoleAndMenuInfo } from '@/api/laboratory/role'
import { getMenusTree, addRoleInfo, assertRepeat, getAllRoleAndMenuInfo, deleteRole, updateRoleMenu } from '@/api/laboratory/role'
import { default as menuPower } from './menuPower.vue'
export default {
  components: {
@@ -116,6 +230,15 @@
  data() {
    return {
      props: { multiple: true },
      dialogTableVisibleUpdate: false,
      updateRole: {
        roleId: null,
        roleName: null,
        lastName: null,
        menuData: null,
        lastMenuSelect: null
      },
      selectRole: [],
      roleAdd: {
        roleName: null,
        menuData: null
@@ -124,10 +247,14 @@
      menuTableTree: null,
      searchData: {
        roleName: '',
        permission: ''
      },
      assertRepeatName: true,
      menuInfo: [],
      menuUpdateInfo: [],
      selectMenuInfo: {
        roleName: null,
        menuData: null
      },
      roleTable: [],
      updateData: {
        oldPassWord: '',
@@ -135,6 +262,8 @@
        confirmPassWord: ''
      },
      dialogTableVisible: false,
      dialogTableSelectVisible: false,
      addOrUp: false,
      currentPage: 1,
      pageSize: 5,
      total: 20
@@ -147,13 +276,169 @@
    this.start()
  },
  methods: {
    chekSelect(scope) {
    selectRoleInfo(scope) {
      this.selectMenuInfo.roleName = scope.row.roleName
      this.selectMenuInfo.menuData = scope.row.roleMenuList
      console.log(this.selectMenuInfo.menuData);
      this.dialogTableSelectVisible = true
    },
    searchRole() {
      this.start()
    },
    clearUPAll() {
      this.updateRole = {
        roleId: null,
        roleName: null,
        lastName: null,
        menuData: null,
        lastMenuSelect: null
      }
      this.menuUpdateInfo = []
      this.dialogTableVisibleUpdate = false
    },
    async cilckUP() {
      if (this.updateRole.roleName == null || this.updateRole.roleName == '') {
        this.$message({
          message: '请输入角色名',
          type: 'warning'
        });
        return
      }
      if (!this.assertRepeatName) {
        this.$message({
          message: '角色名重复,请重新输入',
          type: 'warning'
        });
        return
      }
      this.menuUpdateInfo.forEach(item => {
        if (item.children != undefined) {
          item.children.forEach(c => {
            if (c.added) {
              item.selected = true
            }
            if (c.selected) {
              item.selected = true
            }
            if (c.updated) {
              item.selected = true
            }
            if (c.deleted) {
              item.selected = true
            }
          })
        }
      })
      console.log(this.menuUpdateInfo);
      this.updateRole.menuData = JSON.parse(JSON.stringify(this.menuUpdateInfo));
      this.updateRole.menuData.forEach(item => {
        if (item.children != undefined) {
          let child = item.children.filter(c => {
            return c.added == true || c.selected == true || c.deleted == true || c.updated === true
          })
          item.children = child
        }
      })
      this.updateRole.menuData = this.updateRole.menuData.filter(item => {
        return item.selected == true
      })
      this.assertDeleteOrUp()
      console.log(this.updateRole);
      let up = await updateRoleMenu(this.updateRole)
      if (up.data) {
        this.$message({
          type: 'success',
          message: '编辑成功!'
        });
        this.start()
        this.clearUPAll()
      } else {
        this.$message.error('编辑失败!请重新操作');
      }
    },
    async upRole(scope) {
      console.log(scope);
      this.updateRole.roleId = scope.row.roleId
      this.updateRole.roleName = scope.row.roleName
      this.updateRole.lastName = scope.row.roleName
      let menuSelect = scope.row.roleMenuList
      this.updateRole.lastMenuSelect = scope.row.roleMenuList
      console.log(menuSelect);
      let res = await getMenusTree();
      this.menuUpdateInfo = res.data
      this.menuUpdateInfo.forEach(item => {
        this.$set(item, 'added', false);
        this.$set(item, 'updated', false);
        this.$set(item, 'deleted', false);
        this.$set(item, 'selected', false);
        if (item.children.length == 0) {
          delete item['children']
        } else {
          item.children.forEach(c => {
            this.$set(c, 'selected', false);
            this.$set(c, 'added', false);
            this.$set(c, 'updated', false);
            this.$set(c, 'deleted', false);
            if (c.children.length == 0) {
              delete c['children']
            }
          })
        }
      })
      console.log(this.menuUpdateInfo);
      menuSelect.forEach(ms => {
        this.menuUpdateInfo.forEach(item => {
          if (ms.menuName === item.name) {
            item.selected = ms.selected
            item.added = ms.added
            item.deleted = ms.deleted
            item.updated = ms.updated
            ms.children.forEach(msc => {
              if (item.children != undefined) {
                item.children.forEach(itemc => {
                  if (itemc.name === msc.menuName) {
                    itemc.selected = msc.selected
                    itemc.added = msc.added
                    itemc.deleted = msc.deleted
                    itemc.updated = msc.updated
                  }
                })
              }
            })
          }
        })
      })
      this.dialogTableVisibleUpdate = true
    },
    removeRole(scope) {
      this.$confirm('此操作将删除该角色, 是否继续?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(async () => {
        this.roleTable = this.roleTable.filter(item => {
          return item.roleId != scope.row.roleId
        });
        this.$message({
          type: 'success',
          message: '删除成功!'
        });
        await deleteRole({ id: scope.row.roleId })
      }).catch(() => {
        this.$message({
          type: 'info',
          message: '已取消删除'
        });
      });
    },
    async start() {
      let res = await getAllRoleAndMenuInfo()
      this.roleTable = res.data
      console.log(res);
      let res = await getAllRoleAndMenuInfo({ currentPage: this.currentPage, pageSize: this.pageSize, name: this.searchData.roleName })
      res.data.list.forEach(item => {
        item.roleId = String(item.roleId)
      })
      this.roleTable = res.data.list
      this.total = res.data.total
    },
    async assertName() {
      if (this.roleAdd.roleName == null || this.roleAdd.roleName == '') {
@@ -175,13 +460,81 @@
      }
    },
    chekAdd(scope) {
      if (scope.row.added) {
      scope.row.selected = true
      }
      this.updateFatherState(scope)
    },
    chekUpdate(scope) {
      if (scope.row.updated) {
      scope.row.selected = true
      }
      this.updateFatherState(scope)
    },
    chekDelet(scope) {
      if (scope.row.deleted) {
      scope.row.selected = true
      }
      this.updateFatherState(scope)
    },
    chekSelect(scope) {
      this.updateFatherState(scope)
    },
    updateFatherState(scope) {
      if (this.menuUpdateInfo != []) {
        this.menuUpdateInfo.forEach(item => {
          if (item.id == scope.row.parentId) {
            if (item.children != undefined) {
              let childrenFalse = item.children.length * 4;
              let countFalse = 0;
              item.children.forEach(c => {
                if (c.added == false) {
                  countFalse++;
                }
                if (c.deleted == false) {
                  countFalse++;
                }
                if (c.updated == false) {
                  countFalse++;
                }
                if (c.selected == false) {
                  countFalse++;
                }
              })
              if (childrenFalse === countFalse) {
                item.selected = false
              }
            }
          }
        })
      }
      if (this.menuInfo != []) {
        this.menuInfo.forEach(item => {
          if (item.id == scope.row.parentId) {
            if (item.children != undefined) {
              let childrenFalse = item.children.length * 4;
              let countFalse = 0;
              item.children.forEach(c => {
                if (c.added == false) {
                  countFalse++;
                }
                if (c.deleted == false) {
                  countFalse++;
                }
                if (c.updated == false) {
                  countFalse++;
                }
                if (c.selected == false) {
                  countFalse++;
                }
              })
              if (childrenFalse === countFalse) {
                item.selected = false
              }
            }
          }
        })
      }
    },
    async addClickRole() {
      let res = await getMenusTree();
@@ -254,6 +607,7 @@
        return item.selected == true
      })
      let res = await addRoleInfo(this.roleAdd);
      this.start()
      if (res.data) {
        this.$message({
          message: '添加角色成功',
@@ -287,6 +641,92 @@
      this.menuInfo = []
      this.assertRepeatName = true
      this.dialogTableVisible = false
    },
    assertDeleteOrUp() {
      console.log("---------");
      console.log(this.updateRole.menuData);
      this.updateRole.lastMenuSelect
      this.updateRole.menuData
      let newTree = []
      let oldTree = []
      this.updateRole.menuData.forEach(item => {
        const obj = {
          menuId: item.id,
          menuName: item.name,
          added: item.added,
          parentId: item.parentId,
          deleted: item.deleted,
          updated: item.updated,
          selected: item.selected
        }
        newTree.push(obj)
        if (item.children != undefined && obj.selected != false) {
          item.children.forEach(c => {
            const objc = {
              menuId: c.id,
              menuName: c.name,
              parentId: c.parentId,
              added: c.added,
              deleted: c.deleted,
              updated: c.updated,
              selected: c.selected
            }
            newTree.push(objc)
          })
        }
      })
      console.log(newTree);
      // this.updateRole.lastMenuSelect.forEach(item => {
      //   const obj = {
      //     menuId: item.menuId,
      //     menuName: item.menuName,
      //     added: item.added,
      //     deleted: item.deleted,
      //     updated: item.updated,
      //     selected: item.selected
      //   }
      //   if (obj.selected) {
      //     oldTree.push(obj)
      //   }
      //   if (item.children != [] && obj.selected != false) {
      //     item.children.forEach(c => {
      //       const objc = {
      //         menuId: c.menuId,
      //         menuName: c.menuName,
      //         added: c.added,
      //         deleted: c.deleted,
      //         updated: c.updated,
      //         selected: c.selected
      //       }
      //       oldTree.push(objc)
      //     })
      //   }
      // })
      console.log(oldTree);
      // this.updateRole.lastMenuSelect = oldTree
      this.updateRole.menuData = newTree
    },
    async assertUpName() {
      if (this.updateRole.roleName == null || this.updateRole.roleName == '') {
        this.$message({
          message: '请输入角色名称!',
          type: 'warning'
        });
        return
      }
      if (this.updateRole.roleName === this.updateRole.lastName) {
        return
      }
      let res = await assertRepeat({ roleName: this.updateRole.roleName })
      if (!res.data) {
        this.assertRepeatName = false
        this.$message({
          message: '角色名重复,请重新输入!',
          type: 'warning'
        });
      } else {
        this.assertRepeatName = true
      }
    }
  }
}
@@ -336,5 +776,16 @@
    justify-content: end;
    margin-top: 20px
  }
}
</style>
<style>
#selectRolecheck .el-checkbox__input.is-disabled.is-checked .el-checkbox__inner::after {
  border-color: #fff !important;
}
#selectRoleCheck .el-checkbox__input.is-disabled.is-checked .el-checkbox__inner {
  background-color: #409EFF;
  border-color: #409EFF;
}
</style>
src/views/login/index.vue
@@ -11,38 +11,23 @@
        <span class="svg-container">
          <svg-icon icon-class="user" />
        </span>
        <el-input
          ref="username"
          v-model="loginForm.username"
          placeholder="Username"
          name="username"
          type="text"
          tabindex="1"
          auto-complete="on"
        />
        <el-input ref="username" v-model="loginForm.username" placeholder="Username" name="username" type="text"
          tabindex="1" auto-complete="on" />
      </el-form-item>
      <el-form-item prop="password">
        <span class="svg-container">
          <svg-icon icon-class="password" />
        </span>
        <el-input
          :key="passwordType"
          ref="password"
          v-model="loginForm.password"
          :type="passwordType"
          placeholder="Password"
          name="password"
          tabindex="2"
          auto-complete="on"
          @keyup.enter.native="handleLogin"
        />
        <el-input :key="passwordType" ref="password" v-model="loginForm.password" :type="passwordType"
          placeholder="Password" name="password" tabindex="2" auto-complete="on" @keyup.enter.native="handleLogin" />
        <span class="show-pwd" @click="showPwd">
          <svg-icon :icon-class="passwordType === 'password' ? 'eye' : 'eye-open'" />
        </span>
      </el-form-item>
      <el-button :loading="loading" type="primary" style="width:100%;margin-bottom:30px;" @click.native.prevent="handleLogin">Login</el-button>
      <el-button :loading="loading" type="primary" style="width:100%;margin-bottom:30px;"
        @click.native.prevent="handleLogin">Login</el-button>
      <!-- <div class="tips">
        <span style="margin-right:20px;">username: admin</span>
        <span> password: any</span>
@@ -53,7 +38,7 @@
<script>
import { validUsername } from '@/utils/validate'
import { get } from "@/api/util/requestUtil.js"
export default {
  name: 'Login',
  data() {
@@ -108,7 +93,12 @@
      this.$refs.loginForm.validate(valid => {
        if (valid) {
          this.loading = true
          this.$store.dispatch('user/login', this.loginForm).then(() => {
          this.$store.dispatch('user/login', this.loginForm).then(async () => {
            await get(this.$url.info).then(res => {
              this.user = res.data
              sessionStorage.setItem("user", JSON.stringify(res.data))
              sessionStorage.setItem("flushPage",0)
            })
            this.$router.push({ path: this.redirect || '/' })
            this.loading = false
          }).catch(() => {
@@ -182,6 +172,7 @@
  background:url('../../assets/404_images/backgroud.png') no-repeat;
  background-size: 100vw 100vh;
  overflow: hidden;
  .login-form {
    position: relative;
    width: 520px;
src/views/standardLibrary/index.vue
@@ -25,7 +25,11 @@
        <div class="table-header">
          <div class="serve-btn">
            <span class="tipMsg">{{ msg !== "" ? msg : "" }}</span>
            <el-select v-model="versionValue" @change="changeSelect" placeholder="请选择版本号">
            <el-select
              v-model="versionValue"
              @change="changeSelect"
              placeholder="请选择版本号"
            >
              <el-option
                v-for="item in options"
                :key="item.value"
@@ -34,7 +38,9 @@
                >
              </el-option>
            </el-select>
            <el-button type="primary" @click="addVersionFun">新增版本号</el-button>
            <el-button type="primary" @click="addVersionFun"
              >新增版本号</el-button
            >
            <el-button
              type="primary"
              icon="el-icon-plus"
@@ -172,7 +178,7 @@
  deleteListApi,
  blurUpdateApi,
  getVersion,
  addVersion
  addVersion,
} from "@/api/standardLibrary";
import { selectproductModelApi } from "@/api/basicData/index";
@@ -180,7 +186,7 @@
  data() {
    return {
      options:[],
      versionValue: '',
      versionValue: "",
      deleteList: [],
      msg: "",
      isAllSelect: false,
@@ -213,21 +219,21 @@
  created() {
    this.getStandardTree();
  },
  mounted(){
  },
  mounted() {},
  methods: {
    async initSelect(){
        this.options = [];
        this.versionValue = "";
        const response = await getVersion({"specificationsId":this.selectData.id});
      const response = await getVersion({
        specificationsId: this.selectData.id,
      });
        if(response.code===200 && response.data.length>0){
          this.getTableByClick(this.selectData,response.data[0])
        this.getTableByClick(this.selectData, response.data[0]);
          for(let i=0;i<response.data.length;i++){
            this.options.push({
              value: response.data[i],
              label: "V" + response.data[i]
            })
            label: "V" + response.data[i],
          });
            this.versionValue = response.data[0];
          }
        }
@@ -237,23 +243,25 @@
      this.getTableByClick(this.selectData,this.versionValue);
    },
    async insertVersion(){
      const resp = await addVersion({"specificationsId":this.selectData.id});
      const resp = await addVersion({ specificationsId: this.selectData.id });
      if(resp.code===200){
        this.initSelect();
        this.$message({
            type: 'success',
            message: resp.message
          type: "success",
          message: resp.message,
          });
      }
    },
     addVersionFun() {
        this.$confirm('确认添加新的版本号吗?', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
      this.$confirm("确认添加新的版本号吗?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          this.insertVersion();
        }).catch(() => {});
        })
        .catch(() => {});
    },
    filterNode(value, data) {
      if (!value) return true;
@@ -327,7 +335,7 @@
    async getTableByClick(data,versionVal) {
      await getProductList({
        specificationsId: data.id,
        version: versionVal
        version: versionVal,
      }).then((res) => {
        res.data.forEach((i) => {
          if (i.name === undefined) {
@@ -349,10 +357,9 @@
      this.$router.push(`/standardLibrary/SpecificationDetails/${row.id}`);
    },
    renderContent(h, { node, data, store }) {
      // console.log('data', data)
      // console.log('node', node)
      // 判断是否是父节点或文件夹
      const isFolder = "children" in data;
      console.log(`output->data`, isFolder);
      return (
        <span class="tree-node">
          {isFolder ? (
@@ -499,13 +506,13 @@
      });
    },
    handleSelectionChange(val) {
      this.deleteList = []
      this.deleteList = [];
      val.forEach((v) => {
        if(v.id !== undefined){
          this.deleteList.push(v.id)
          this.deleteList.push(v.id);
        }
      })
      console.log(`output->this.deleteList`,this.deleteList)
      });
      console.log(`output->this.deleteList`, this.deleteList);
    },
    // 表格树全部选中配置  结束
    deleteListClick() {