Selaa lähdekoodia

修改通用配置:公司名称和后端请求地址

chrislee 4 kuukautta sitten
vanhempi
sitoutus
7e887d1725

+ 9 - 7
config/index.js

@@ -1,4 +1,7 @@
 'use strict'
+
+const currentHost = (window.SITE_CONFIG && window.SITE_CONFIG.domain)
+
 // Template version: 1.2.5
 // see http://vuejs-templates.github.io/webpack for documentation.
 
@@ -14,12 +17,7 @@ module.exports = {
     // 代理列表, 是否开启代理通过[./dev.env.js]配置
     proxyTable: devEnv.OPEN_PROXY === false ? {} : {
       '/proxyApi': {
-        // 线上环境
-        target: 'https://www.muzhikeji.cn/api',
-        // 东齐环境
-        // target: 'https://192.168.2.124/api',
-        // 昌柘环境
-        // target: 'https://192.168.110.222/api',
+        target: `https://${currentHost}/api`,
         changeOrigin: true,
         pathRewrite: {
           '^/proxyApi': ''
@@ -60,6 +58,7 @@ module.exports = {
     // (https://github.com/webpack/css-loader#sourcemaps)
     // In our experience, they generally work as expected,
     // just be aware of this issue when enabling this option.
+
     cssSourceMap: false,
   },
 
@@ -92,5 +91,8 @@ module.exports = {
     // `npm run build --report`
     // Set to `true` or `false` to always turn it on or off
     bundleAnalyzerReport: process.env.npm_config_report
-  }
+  },
+  
+  // 导出host变量,供其他文件引用
+  currentHost: currentHost
 }

+ 6 - 1
index.html

@@ -5,7 +5,7 @@
   <meta name="viewport" content="width=device-width, initial-scale=1.0">
   <meta http-equiv="X-UA-Compatible" content="ie=edge">
   <link rel="shortcut icon" type="image/x-icon" href="./static/img/logo.png">
-  <title>木之云数字化平台</title>
+  <title></title>
   <% if (process.env.NODE_ENV === 'production') { %>
     <!-- 生产环境 -->
     <script>document.write('<script src="./config/index.js?t=' + new Date().getTime() + '"><\/script>')</script>
@@ -22,4 +22,9 @@
 <body>
   <div id="app"></div>
 </body>
+<script>
+  if (window.SITE_CONFIG && window.SITE_CONFIG['systemName']) {
+    document.title = window.SITE_CONFIG['systemName'];
+  }
+</script>
 </html>

+ 168 - 155
src/views/common/login.vue

@@ -1,21 +1,22 @@
 <template>
-    <div class="site-wrapper site-page--login">
-      <div class="site-content__wrapper">
-        <div class="site-content">
-          <div class="brand-info">
-            <h2 class="brand-info__text">木之云数字化平台</h2>
-            <p class="brand-info__intro">即时生产数字化平台,服务于各类生产型企业</p>
-          </div>
-          <div class="login-main">
-            <h3 class="login-title">用户登录</h3>
-            <el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmit()" status-icon>
-              <el-form-item prop="userName">
-                <el-input v-model="dataForm.userName" placeholder="帐号"></el-input>
-              </el-form-item>
-              <el-form-item prop="password">
-                <el-input v-model="dataForm.password" type="password" placeholder="密码"></el-input>
-              </el-form-item>
-              <!-- <el-form-item prop="captcha">
+  <div class="site-wrapper site-page--login">
+    <div class="site-content__wrapper">
+      <div class="site-content">
+        <div class="brand-info">
+          <h2 class="brand-info__text">{{ systemName }}</h2>
+          <p class="brand-info__intro">即时生产数字化平台,服务于各类生产型企业</p>
+        </div>
+        <div class="login-main">
+          <h3 class="login-title">用户登录</h3>
+          <el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmit()"
+            status-icon>
+            <el-form-item prop="userName">
+              <el-input v-model="dataForm.userName" placeholder="帐号"></el-input>
+            </el-form-item>
+            <el-form-item prop="password">
+              <el-input v-model="dataForm.password" type="password" placeholder="密码"></el-input>
+            </el-form-item>
+            <!-- <el-form-item prop="captcha">
                 <el-row :gutter="20">
                   <el-col :span="14">
                     <el-input v-model="dataForm.captcha" placeholder="验证码">
@@ -26,163 +27,175 @@
                   </el-col>
                 </el-row>
               </el-form-item> -->
-              <el-form-item>
-                <el-button class="login-btn-submit" type="primary" @click="dataFormSubmit()">登录</el-button>
-              </el-form-item>
-            </el-form>
-          </div>
-          <!-- 发布客户环境时注释这段代码 -- Start -->
-          <div style="bottom: 20px;position: fixed;color:white">
-            ©2023 muzhikeji.cn 版权所有ICP证:<a href="https://beian.miit.gov.cn/" target="_blank">赣ICP备2021005225号-2</a>
-          </div>
-          <!-- 发布客户环境时注释这段代码 -- End -->
+            <el-form-item>
+              <el-button class="login-btn-submit" type="primary" @click="dataFormSubmit()">登录</el-button>
+            </el-form-item>
+          </el-form>
+        </div>
+        <!-- 发布客户环境时注释这段代码 -- Start -->
+        <div style="bottom: 20px;position: fixed;color:white">
+          ©2023 muzhikeji.cn 版权所有ICP证:<a href="https://beian.miit.gov.cn/" target="_blank">赣ICP备2021005225号-2</a>
         </div>
+        <!-- 发布客户环境时注释这段代码 -- End -->
       </div>
-<!--      <div class="site-wrapper site-sidebar&#45;&#45;fold"-->
-<!--        v-loading.fullscreen.lock="loading"-->
-<!--        element-loading-text="加载中">-->
-<!--      </div>-->
     </div>
+    <!--      <div class="site-wrapper site-sidebar&#45;&#45;fold"-->
+    <!--        v-loading.fullscreen.lock="loading"-->
+    <!--        element-loading-text="加载中">-->
+    <!--      </div>-->
+  </div>
 </template>
 
 <script>
-  import { getUUID } from '@/utils'
-  export default {
-    data () {
-      return {
-        dataForm: {
-          userName: '',
-          password: '',
-          uuid: '',
-          captcha: ''
-        },
-        dataRule: {
-          userName: [
-            { required: true, message: '帐号不能为空', trigger: 'blur' }
-          ],
-          password: [
-            { required: true, message: '密码不能为空', trigger: 'blur' }
-          ],
-          captcha: [
-            { required: true, message: '验证码不能为空', trigger: 'blur' }
-          ]
-        },
-        captchaPath: ''
-      }
-    },
-    created () {
-      // console.log('login')
-      // this.getCaptcha()
-    },
-    methods: {
-      // 提交表单
-      dataFormSubmit () {
-        this.$refs['dataForm'].validate((valid) => {
-          if (valid) {
-            this.$http({
-              url: this.$http.adornUrl('/user-service/user/login'),
-              method: 'post',
-              data: this.$http.adornData({
-                'username': this.dataForm.userName,
-                'password': this.dataForm.password,
-                'appCode': 'ERP-SYSTEM'
-              })
-            }).then(({data}) => {
-              if (data && data.code === '200') {
-                this.$cookie.set('token', data.data.access_token)
-                this.$router.replace({ name: this.dataForm.userName === 'admin' ? 'home-admin' : 'home-customer' })
-              } else {
-                // this.getCaptcha()
-                this.$message.error(data.msg)
-              }
-            })
-          }
-        })
+import { getUUID } from '@/utils'
+export default {
+  data() {
+    return {
+      dataForm: {
+        userName: '',
+        password: '',
+        uuid: '',
+        captcha: ''
+      },
+      dataRule: {
+        userName: [
+          { required: true, message: '帐号不能为空', trigger: 'blur' }
+        ],
+        password: [
+          { required: true, message: '密码不能为空', trigger: 'blur' }
+        ],
+        captcha: [
+          { required: true, message: '验证码不能为空', trigger: 'blur' }
+        ]
       },
-      // 获取验证码
-      getCaptcha () {
-        this.dataForm.uuid = getUUID()
-        this.captchaPath = this.$http.adornUrl(`/captcha.jpg?uuid=${this.dataForm.uuid}`)
-      }
+      captchaPath: '',
+      systemName: (window.SITE_CONFIG && window.SITE_CONFIG.systemName) || '木之云数字化平台'
+    }
+  },
+  created() {
+    // console.log('login')
+    // this.getCaptcha()
+  },
+  methods: {
+    // 提交表单
+    dataFormSubmit() {
+      this.$refs['dataForm'].validate((valid) => {
+        if (valid) {
+          this.$http({
+            url: this.$http.adornUrl('/user-service/user/login'),
+            method: 'post',
+            data: this.$http.adornData({
+              'username': this.dataForm.userName,
+              'password': this.dataForm.password,
+              'appCode': 'ERP-SYSTEM'
+            })
+          }).then(({ data }) => {
+            if (data && data.code === '200') {
+              this.$cookie.set('token', data.data.access_token)
+              this.$router.replace({ name: this.dataForm.userName === 'admin' ? 'home-admin' : 'home-customer' })
+            } else {
+              // this.getCaptcha()
+              this.$message.error(data.msg)
+            }
+          })
+        }
+      })
+    },
+    // 获取验证码
+    getCaptcha() {
+      this.dataForm.uuid = getUUID()
+      this.captchaPath = this.$http.adornUrl(`/captcha.jpg?uuid=${this.dataForm.uuid}`)
     }
   }
+}
 </script>
 
 <style lang="scss">
-  .site-wrapper.site-page--login {
+.site-wrapper.site-page--login {
+  position: absolute;
+  top: 0;
+  right: 0;
+  bottom: 0;
+  left: 0;
+  background-color: rgba(38, 50, 56, .6);
+  overflow: hidden;
+
+  &:before {
+    position: fixed;
+    top: 0;
+    left: 0;
+    z-index: -1;
+    width: 100%;
+    height: 100%;
+    content: "";
+    /*background-image: url(~@/assets/img/login_bg.png);*/
+    background-image: url(~@/assets/img/login_bg2.jpg);
+    background-size: cover;
+  }
+
+  .site-content__wrapper {
     position: absolute;
     top: 0;
     right: 0;
     bottom: 0;
     left: 0;
-    background-color: rgba(38, 50, 56, .6);
+    padding: 0;
+    margin: 0;
+    overflow-x: hidden;
+    overflow-y: auto;
+    background-color: transparent;
+  }
+
+  .site-content {
+    min-height: 100%;
+    padding: 30px 500px 30px 30px;
+  }
+
+  .brand-info {
+    margin: 220px 100px 0 90px;
+    color: #fff;
+  }
+
+  .brand-info__text {
+    margin: 0 0 22px 0;
+    font-size: 48px;
+    font-weight: 400;
+    text-transform: uppercase;
+  }
+
+  .brand-info__intro {
+    margin: 10px 0;
+    font-size: 16px;
+    line-height: 1.58;
+    opacity: .6;
+  }
+
+  .login-main {
+    position: absolute;
+    top: 0;
+    right: 0;
+    padding: 150px 60px 180px;
+    width: 470px;
+    min-height: 100%;
+    background-color: #fff;
+  }
+
+  .login-title {
+    font-size: 16px;
+  }
+
+  .login-captcha {
     overflow: hidden;
-    &:before {
-      position: fixed;
-      top: 0;
-      left: 0;
-      z-index: -1;
-      width: 100%;
-      height: 100%;
-      content: "";
-      /*background-image: url(~@/assets/img/login_bg.png);*/
-      background-image: url(~@/assets/img/login_bg2.jpg);
-      background-size: cover;
-    }
-    .site-content__wrapper {
-      position: absolute;
-      top: 0;
-      right: 0;
-      bottom: 0;
-      left: 0;
-      padding: 0;
-      margin: 0;
-      overflow-x: hidden;
-      overflow-y: auto;
-      background-color: transparent;
-    }
-    .site-content {
-      min-height: 100%;
-      padding: 30px 500px 30px 30px;
-    }
-    .brand-info {
-      margin: 220px 100px 0 90px;
-      color: #fff;
-    }
-    .brand-info__text {
-      margin:  0 0 22px 0;
-      font-size: 48px;
-      font-weight: 400;
-      text-transform : uppercase;
-    }
-    .brand-info__intro {
-      margin: 10px 0;
-      font-size: 16px;
-      line-height: 1.58;
-      opacity: .6;
-    }
-    .login-main {
-      position: absolute;
-      top: 0;
-      right: 0;
-      padding: 150px 60px 180px;
-      width: 470px;
-      min-height: 100%;
-      background-color: #fff;
-    }
-    .login-title {
-      font-size: 16px;
-    }
-    .login-captcha {
-      overflow: hidden;
-      > img {
-        width: 100%;
-        cursor: pointer;
-      }
-    }
-    .login-btn-submit {
+
+    >img {
       width: 100%;
-      margin-top: 38px;
+      cursor: pointer;
     }
   }
+
+  .login-btn-submit {
+    width: 100%;
+    margin-top: 38px;
+  }
+}
 </style>

+ 100 - 103
src/views/main-navbar.vue

@@ -2,14 +2,12 @@
   <nav class="site-navbar" :class="'site-navbar--' + navbarLayoutType">
     <div class="site-navbar__header">
       <h1 class="site-navbar__brand" @click="$router.push({ name: 'home' })">
-        <a class="site-navbar__brand-lg" href="javascript:">木之云数字化平台</a>
-        <a class="site-navbar__brand-mini" href="javascript:">木之云</a>
+        <a class="site-navbar__brand-lg" href="javascript:">{{ systemName }}</a>
+        <a class="site-navbar__brand-mini" href="javascript:"></a>
       </h1>
     </div>
     <div class="site-navbar__body clearfix">
-      <el-menu
-        class="site-navbar__menu"
-        mode="horizontal">
+      <el-menu class="site-navbar__menu" mode="horizontal">
         <el-menu-item class="site-navbar__switch" index="0" @click="sidebarFold = !sidebarFold">
           <icon-svg name="zhedie"></icon-svg>
         </el-menu-item>
@@ -17,9 +15,7 @@
           <b style="color: #ff0311;font-size: 24px">涉密不上网、上网不涉密</b>
         </el-menu-item>
       </el-menu>
-      <el-menu
-        class="site-navbar__menu site-navbar__menu--right"
-        mode="horizontal">
+      <el-menu class="site-navbar__menu site-navbar__menu--right" mode="horizontal">
         <el-menu-item index="0" @click="$router.push({ name: 'msgCenter' })">
           <template slot="title">
             <el-badge :value="cnt" :hidden="cnt < 1">
@@ -60,111 +56,112 @@
     <!-- 弹窗, 修改密码 -->
     <update-password v-if="updatePasswordVisible" ref="updatePassowrd"></update-password>
     <update-user-sign v-if="updateUserSignVisible" ref="updateUserSign"></update-user-sign>
-    <Msg ref="msgDialog" @noticeAdded="noticeAdded"/>
-    <youli-component v-if="previewVisible" ref="preview"/>
+    <Msg ref="msgDialog" @noticeAdded="noticeAdded" />
+    <youli-component v-if="previewVisible" ref="preview" />
   </nav>
 </template>
 
 <script>
-  import NotifyType from './main-navbar-notify-type'
-  import UpdatePassword from './main-navbar-update-password'
-  import UpdateUserSign from './main-navbar-update-sign'
-  import Msg from './common/msg'
-  import { clearLoginInfo } from '@/utils'
-  import PreviewComponent from '@/views/modules/common/preview-component'
-  import YouliComponent from '@/views/modules/common/youli-component'
-  import Vue from 'vue'
+import NotifyType from './main-navbar-notify-type'
+import UpdatePassword from './main-navbar-update-password'
+import UpdateUserSign from './main-navbar-update-sign'
+import Msg from './common/msg'
+import { clearLoginInfo } from '@/utils'
+import PreviewComponent from '@/views/modules/common/preview-component'
+import YouliComponent from '@/views/modules/common/youli-component'
+import Vue from 'vue'
 export default {
-    data () {
-      return {
-        notifyTypeVisible: false,
-        updatePasswordVisible: false,
-        updateUserSignVisible: false,
-        cnt: 0,
-        previewVisible: false
-      }
+  data() {
+    return {
+      notifyTypeVisible: false,
+      updatePasswordVisible: false,
+      updateUserSignVisible: false,
+      cnt: 0,
+      previewVisible: false,
+      systemName: (window.SITE_CONFIG && window.SITE_CONFIG.systemName) || '木之云数字化平台'
+    }
+  },
+  components: {
+    YouliComponent,
+    PreviewComponent,
+    UpdatePassword,
+    UpdateUserSign,
+    Msg,
+    NotifyType
+  },
+  computed: {
+    navbarLayoutType: {
+      get() { return this.$store.state.common.navbarLayoutType }
+    },
+    sidebarFold: {
+      get() { return this.$store.state.common.sidebarFold },
+      set(val) { this.$store.commit('common/updateSidebarFold', val) }
     },
-    components: {
-      YouliComponent,
-      PreviewComponent,
-      UpdatePassword,
-      UpdateUserSign,
-      Msg,
-      NotifyType
+    mainTabs: {
+      get() { return this.$store.state.common.mainTabs },
+      set(val) { this.$store.commit('common/updateMainTabs', val) }
     },
-    computed: {
-      navbarLayoutType: {
-        get () { return this.$store.state.common.navbarLayoutType }
-      },
-      sidebarFold: {
-        get () { return this.$store.state.common.sidebarFold },
-        set (val) { this.$store.commit('common/updateSidebarFold', val) }
-      },
-      mainTabs: {
-        get () { return this.$store.state.common.mainTabs },
-        set (val) { this.$store.commit('common/updateMainTabs', val) }
-      },
-      userName: {
-        get () {
+    userName: {
+      get() {
         // return this.$store.state.user.name
-          return Vue.cookie.get('name')
-        }
+        return Vue.cookie.get('name')
       }
+    }
+  },
+  methods: {
+    // 消息设置
+    notifyTypeHandle() {
+      this.notifyTypeVisible = true
+      this.$nextTick(() => {
+        this.$refs.notifyType.init()
+      })
     },
-    methods: {
-      // 消息设置
-      notifyTypeHandle () {
-        this.notifyTypeVisible = true
-        this.$nextTick(() => {
-          this.$refs.notifyType.init()
-        })
-      },
-      // 修改密码
-      updatePasswordHandle () {
-        this.updatePasswordVisible = true
-        this.$nextTick(() => {
-          this.$refs.updatePassowrd.init()
-        })
-      },
-      // 修改个人签名
-      updateSignHandle () {
-        this.updateUserSignVisible = true
-        this.$nextTick(() => {
-          this.$refs.updateUserSign.init()
-        })
-      },
-      // 退出
-      logoutHandle () {
-        this.$confirm(`确定进行[退出]操作?`, '提示', {
-          confirmButtonText: '确定',
-          cancelButtonText: '取消',
-          type: 'warning'
-        }).then(() => {
-          clearLoginInfo()
-          this.$router.push({ name: 'login' })
-          // this.$http({
-          //   url: this.$http.adornUrl('/sys/logout'),
-          //   method: 'post',
-          //   data: this.$http.adornData()
-          // }).then(({data}) => {
-          //   if (data && data.code === 0) {
-          //     clearLoginInfo()
-          //     this.$router.push({ name: 'login' })
-          //   }
-          // })
-        }).catch(() => {})
-      },
-      // 通知数量变化
-      noticeAdded (num) {
-        this.cnt = num
-      },
-      // 小程序图片预览
-      previewPic () {
-        this.previewVisible = true
-        this.$nextTick(() => {
-          this.$refs.preview.init()
-        })
-      }
+    // 修改密码
+    updatePasswordHandle() {
+      this.updatePasswordVisible = true
+      this.$nextTick(() => {
+        this.$refs.updatePassowrd.init()
+      })
+    },
+    // 修改个人签名
+    updateSignHandle() {
+      this.updateUserSignVisible = true
+      this.$nextTick(() => {
+        this.$refs.updateUserSign.init()
+      })
+    },
+    // 退出
+    logoutHandle() {
+      this.$confirm(`确定进行[退出]操作?`, '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(() => {
+        clearLoginInfo()
+        this.$router.push({ name: 'login' })
+        // this.$http({
+        //   url: this.$http.adornUrl('/sys/logout'),
+        //   method: 'post',
+        //   data: this.$http.adornData()
+        // }).then(({data}) => {
+        //   if (data && data.code === 0) {
+        //     clearLoginInfo()
+        //     this.$router.push({ name: 'login' })
+        //   }
+        // })
+      }).catch(() => { })
+    },
+    // 通知数量变化
+    noticeAdded(num) {
+      this.cnt = num
+    },
+    // 小程序图片预览
+    previewPic() {
+      this.previewVisible = true
+      this.$nextTick(() => {
+        this.$refs.preview.init()
+      })
     }
   }
+}
 </script>

+ 81 - 83
src/views/main.vue

@@ -1,8 +1,5 @@
 <template>
-  <div
-    class="site-wrapper"
-    :class="{ 'site-sidebar--fold': sidebarFold }"
-    v-loading.fullscreen.lock="loading"
+  <div class="site-wrapper" :class="{ 'site-sidebar--fold': sidebarFold }" v-loading.fullscreen.lock="loading"
     element-loading-text="拼命加载中">
     <template v-if="!loading">
       <main-navbar />
@@ -15,93 +12,94 @@
 </template>
 
 <script>
-  import MainNavbar from './main-navbar'
-  import MainSidebar from './main-sidebar'
-  import MainContent from './main-content'
-  export default {
-    provide () {
-      return {
-        // 刷新
-        refresh () {
-          this.$store.commit('common/updateContentIsNeedRefresh', true)
-          this.$nextTick(() => {
-            this.$store.commit('common/updateContentIsNeedRefresh', false)
-          })
-        }
-      }
-    },
-    data () {
-      return {
-        loading: true
+import MainNavbar from './main-navbar'
+import MainSidebar from './main-sidebar'
+import MainContent from './main-content'
+import config from '../../config/index'
+export default {
+  provide() {
+    return {
+      // 刷新
+      refresh() {
+        this.$store.commit('common/updateContentIsNeedRefresh', true)
+        this.$nextTick(() => {
+          this.$store.commit('common/updateContentIsNeedRefresh', false)
+        })
       }
+    }
+  },
+  data() {
+    return {
+      loading: true
+    }
+  },
+  components: {
+    MainNavbar,
+    MainSidebar,
+    MainContent
+  },
+  computed: {
+    documentClientHeight: {
+      get() { return this.$store.state.common.documentClientHeight },
+      set(val) { this.$store.commit('common/updateDocumentClientHeight', val) }
     },
-    components: {
-      MainNavbar,
-      MainSidebar,
-      MainContent
+    sidebarFold: {
+      get() { return this.$store.state.common.sidebarFold }
     },
-    computed: {
-      documentClientHeight: {
-        get () { return this.$store.state.common.documentClientHeight },
-        set (val) { this.$store.commit('common/updateDocumentClientHeight', val) }
-      },
-      sidebarFold: {
-        get () { return this.$store.state.common.sidebarFold }
-      },
-      userId: {
-        get () { return this.$store.state.user.id },
-        set (val) { this.$store.commit('user/updateId', val) }
-      },
-      userName: {
-        get () { return this.$store.state.user.name },
-        set (val) { this.$store.commit('user/updateName', val) }
-      },
-      orgId: {
-        get () { return this.$store.state.user.orgId },
-        set (val) { this.$store.commit('user/updateOrgId', val) }
-      },
-      msgCollection: {
-        get () { return this.$store.state.common.msgCollection },
-        set (val) { this.$store.commit('common/updateMsgCollection', val) }
-      }
+    userId: {
+      get() { return this.$store.state.user.id },
+      set(val) { this.$store.commit('user/updateId', val) }
     },
-    created () {
-      this.getUserInfo()
+    userName: {
+      get() { return this.$store.state.user.name },
+      set(val) { this.$store.commit('user/updateName', val) }
     },
-    mounted () {
-      this.resetDocumentClientHeight()
+    orgId: {
+      get() { return this.$store.state.user.orgId },
+      set(val) { this.$store.commit('user/updateOrgId', val) }
     },
-    methods: {
-      // 重置窗口可视高度
-      resetDocumentClientHeight () {
+    msgCollection: {
+      get() { return this.$store.state.common.msgCollection },
+      set(val) { this.$store.commit('common/updateMsgCollection', val) }
+    }
+  },
+  created() {
+    this.getUserInfo()
+  },
+  mounted() {
+    this.resetDocumentClientHeight()
+  },
+  methods: {
+    // 重置窗口可视高度
+    resetDocumentClientHeight() {
+      this.documentClientHeight = document.documentElement['clientHeight']
+      window.onresize = () => {
         this.documentClientHeight = document.documentElement['clientHeight']
-        window.onresize = () => {
-          this.documentClientHeight = document.documentElement['clientHeight']
-        }
-      },
-      // 获取当前管理员信息
-      getUserInfo () {
-        this.$http({
-          url: this.$http.adornUrl('/user-service/user/info'),
-          method: 'get'
-        }).then(({data}) => {
-          if (data && data.code === '200') {
-            this.loading = false
-            this.userId = data.data.userId
-            this.userName = data.data.username
-            this.orgId = data.data.orgId
-            this.$cookie.set('name', data.data.name)
-
-            // websocket初始化
-            // 线上地址
-            this.$store.dispatch('websocket/WEBSOCKET_INIT', 'wss://www.muzhikeji.cn/wss/web_socket/' + data.data.userId + '_' + (Math.ceil(Math.random() * 100000000)).toString())
-            // 东齐环境
-            // this.$store.dispatch('websocket/WEBSOCKET_INIT', 'wss://192.168.2.124/wss/web_socket/' + data.data.userId + '_' + (Math.ceil(Math.random() * 100000000)).toString())
-            // 昌柘环境
-            // this.$store.dispatch('websocket/WEBSOCKET_INIT', 'wss://192.168.110.222/wss/web_socket/' + data.data.userId + '_' + (Math.ceil(Math.random() * 100000000)).toString())
-          }
-        })
       }
+    },
+    // 获取当前管理员信息
+    getUserInfo() {
+      this.$http({
+        url: this.$http.adornUrl('/user-service/user/info'),
+        method: 'get'
+      }).then(({ data }) => {
+        if (data && data.code === '200') {
+          this.loading = false
+          this.userId = data.data.userId
+          this.userName = data.data.username
+          this.orgId = data.data.orgId
+          this.$cookie.set('name', data.data.name)
+
+          // websocket初始化
+          // 线上地址
+          this.$store.dispatch('websocket/WEBSOCKET_INIT', `wss://${config.currentHost}/wss/web_socket/${data.data.userId}_${Math.ceil(Math.random() * 100000000)}`)
+          // 东齐环境
+          // this.$store.dispatch('websocket/WEBSOCKET_INIT', 'wss://192.168.2.124/wss/web_socket/' + data.data.userId + '_' + (Math.ceil(Math.random() * 100000000)).toString())
+          // 昌柘环境
+          // this.$store.dispatch('websocket/WEBSOCKET_INIT', 'wss://192.168.110.222/wss/web_socket/' + data.data.userId + '_' + (Math.ceil(Math.random() * 100000000)).toString())
+        }
+      })
     }
   }
+}
 </script>

+ 81 - 183
src/views/modules/home/admin.vue

@@ -6,7 +6,7 @@
       <el-col :span="6" class="bg1-1">
         <el-row :span="24" class="bg1-1-1">
           <div class="box-company-title">
-            <div class="company-title">木之云数字化平台</div>
+            <div class="company-title">{{ systemName }}</div>
           </div>
         </el-row>
         <el-row :span="24" class="bg1-1-2">
@@ -30,7 +30,8 @@
       <el-col :span="12" class="bg1-2">
         <el-row :span="24" class="bg1-2-1">
           <div ref="boxnoticetitle" class="box-notice-title" @dblclick="doubleClick">
-            <div ref="noticetitle" :class="isTran ? 'notice-title notice-title-animation' : 'notice-title'">{{ noticeContent }}</div>
+            <div ref="noticetitle" :class="isTran ? 'notice-title notice-title-animation' : 'notice-title'">{{
+              noticeContent }}</div>
           </div>
         </el-row>
         <el-row :span="24" class="bg1-2-2">
@@ -58,45 +59,20 @@
         <el-row :span="24" class="bg1-2-3">
           <div class="box-contract-table">
             <div class="contract-table table">
-              <el-table
-                ref="contractProdTable"
-                :data="contractProdList"
-                height="100%"
-                :row-class-name="contractProdListAddClass"
-                style="width: 100%"
-              >
+              <el-table ref="contractProdTable" :data="contractProdList" height="100%"
+                :row-class-name="contractProdListAddClass" style="width: 100%">
                 <el-table-column type="index" label="序号"></el-table-column>
-                <el-table-column
-                  prop="orderCode"
-                  label="合同号"
-                ></el-table-column>
-                <el-table-column
-                  prop="productName"
-                  label="物料名称"
-                ></el-table-column>
-                <el-table-column
-                  prop="prodCode"
-                  label="物料编号"
-                ></el-table-column>
-                <el-table-column
-                  prop="batchNo"
-                  label="批次号"
-                ></el-table-column>
+                <el-table-column prop="orderCode" label="合同号"></el-table-column>
+                <el-table-column prop="productName" label="物料名称"></el-table-column>
+                <el-table-column prop="prodCode" label="物料编号"></el-table-column>
+                <el-table-column prop="batchNo" label="批次号"></el-table-column>
                 <el-table-column label="生产进度" width="180">
                   <template slot-scope="scope">
-                    <el-progress
-                      :percentage="parseInt(scope.row.progressBar)"
-                    ></el-progress>
+                    <el-progress :percentage="parseInt(scope.row.progressBar)"></el-progress>
                   </template>
                 </el-table-column>
-                <el-table-column
-                  prop="customerName"
-                  label="客户名称"
-                ></el-table-column>
-                <el-table-column
-                  prop="curOperator"
-                  label="当前操作人"
-                ></el-table-column>
+                <el-table-column prop="customerName" label="客户名称"></el-table-column>
+                <el-table-column prop="curOperator" label="当前操作人"></el-table-column>
               </el-table>
             </div>
           </div>
@@ -112,25 +88,13 @@
           <div class="box-custom-ranking">
             <div class="custom-ranking">
               <div class="table">
-                <el-table
-                  ref="customerRankTable"
-                  :data="customerRankList"
-                  height="100%"
-                  row-class-name="custom-ranking-table-row"
-                  style="width: 100%"
-                >
-                  <el-table-column
-                    prop="customerName"
-                    label="客户名称"
-                  ></el-table-column>
+                <el-table ref="customerRankTable" :data="customerRankList" height="100%"
+                  row-class-name="custom-ranking-table-row" style="width: 100%">
+                  <el-table-column prop="customerName" label="客户名称"></el-table-column>
                   <el-table-column label="合同金额占比">
                     <template slot-scope="scope">
-                      <el-progress
-                        :text-inside="true"
-                        :stroke-width="16"
-                        :percentage="scope.row.percentage * 100"
-                        status="success"
-                      ></el-progress>
+                      <el-progress :text-inside="true" :stroke-width="16" :percentage="scope.row.percentage * 100"
+                        status="success"></el-progress>
                     </template>
                   </el-table-column>
                 </el-table>
@@ -151,32 +115,14 @@
           <div class="box-contract-alert">
             <div class="contract-alert">
               <div class="table">
-                <el-table
-                  ref="contractAlarmTable"
-                  :data="contractAlarmList"
-                  height="100%"
-                  row-class-name="custom-ranking-table-row"
-                  style="width: 100%"
-                >
+                <el-table ref="contractAlarmTable" :data="contractAlarmList" height="100%"
+                  row-class-name="custom-ranking-table-row" style="width: 100%">
                   <el-table-column type="index" label="序号"></el-table-column>
-                  <el-table-column
-                    prop="contractNumber"
-                    label="合同号"
-                  ></el-table-column>
+                  <el-table-column prop="contractNumber" label="合同号"></el-table-column>
                   <!-- <el-table-column prop="orderCode" label="任务单号"></el-table-column> -->
-                  <el-table-column
-                    prop="remainTime"
-                    label="剩余时间(天)"
-                    width="100"
-                  ></el-table-column>
-                  <el-table-column
-                    prop="deliveryTime"
-                    label="交付日期"
-                  ></el-table-column>
-                  <el-table-column
-                    prop="customerName"
-                    label="客户名称"
-                  ></el-table-column>
+                  <el-table-column prop="remainTime" label="剩余时间(天)" width="100"></el-table-column>
+                  <el-table-column prop="deliveryTime" label="交付日期"></el-table-column>
+                  <el-table-column prop="customerName" label="客户名称"></el-table-column>
                   <!-- <el-table-column prop="salesmenName" label="业务员"></el-table-column> -->
                 </el-table>
               </div>
@@ -194,32 +140,14 @@
           <div class="box-contract-alert">
             <div class="contract-alert">
               <div class="table">
-                <el-table
-                  ref="damageTable"
-                  :data="damageList"
-                  height="100%"
-                  row-class-name="custom-ranking-table-row"
-                  style="width: 100%"
-                >
+                <el-table ref="damageTable" :data="damageList" height="100%" row-class-name="custom-ranking-table-row"
+                  style="width: 100%">
                   <el-table-column type="index" label="序号"></el-table-column>
-                  <el-table-column
-                    prop="productName"
-                    label="物料"
-                  ></el-table-column>
-                  <el-table-column
-                    prop="prodCode"
-                    label="编号"
-                  ></el-table-column>
+                  <el-table-column prop="productName" label="物料"></el-table-column>
+                  <el-table-column prop="prodCode" label="编号"></el-table-column>
                   <!-- <el-table-column prop="damageReason" label="原因"></el-table-column> -->
-                  <el-table-column
-                    prop="liableUserName"
-                    label="报损人"
-                    width="80"
-                  ></el-table-column>
-                  <el-table-column
-                    prop="createTime"
-                    label="报损时间"
-                  ></el-table-column>
+                  <el-table-column prop="liableUserName" label="报损人" width="80"></el-table-column>
+                  <el-table-column prop="createTime" label="报损时间"></el-table-column>
                 </el-table>
               </div>
             </div>
@@ -236,31 +164,13 @@
           <div class="box-contract-alert">
             <div class="contract-alert">
               <div class="table">
-                <el-table
-                  ref="submittedRecordTable"
-                  :data="submittedRecordList"
-                  height="100%"
-                  row-class-name="custom-ranking-table-row"
-                  style="width: 100%"
-                >
+                <el-table ref="submittedRecordTable" :data="submittedRecordList" height="100%"
+                  row-class-name="custom-ranking-table-row" style="width: 100%">
                   <el-table-column type="index" label="序号"></el-table-column>
-                  <el-table-column
-                    prop="nodeName"
-                    label="工序"
-                    width="70"
-                  ></el-table-column>
-                  <el-table-column
-                    prop="taskName"
-                    label="物料名字"
-                  ></el-table-column>
-                  <el-table-column
-                    prop="endTime"
-                    label="完成时间"
-                  ></el-table-column>
-                  <el-table-column
-                    prop="operatorName"
-                    label="操作人名字"
-                  ></el-table-column>
+                  <el-table-column prop="nodeName" label="工序" width="70"></el-table-column>
+                  <el-table-column prop="taskName" label="物料名字"></el-table-column>
+                  <el-table-column prop="endTime" label="完成时间"></el-table-column>
+                  <el-table-column prop="operatorName" label="操作人名字"></el-table-column>
                 </el-table>
               </div>
             </div>
@@ -277,31 +187,13 @@
           <div class="box-contract-alert">
             <div class="contract-alert">
               <div class="table">
-                <el-table
-                  ref="outboundRecordTable"
-                  :data="outboundRecordList"
-                  height="100%"
-                  row-class-name="custom-ranking-table-row"
-                  style="width: 100%"
-                >
+                <el-table ref="outboundRecordTable" :data="outboundRecordList" height="100%"
+                  row-class-name="custom-ranking-table-row" style="width: 100%">
                   <el-table-column type="index" label="序号"></el-table-column>
-                  <el-table-column
-                    prop="materialName"
-                    label="物品"
-                  ></el-table-column>
-                  <el-table-column
-                    prop="cnt"
-                    label="数量"
-                    width="50"
-                  ></el-table-column>
-                  <el-table-column
-                    prop="createTime"
-                    label="时间"
-                  ></el-table-column>
-                  <el-table-column
-                    prop="applicant"
-                    label="申请人"
-                  ></el-table-column>
+                  <el-table-column prop="materialName" label="物品"></el-table-column>
+                  <el-table-column prop="cnt" label="数量" width="50"></el-table-column>
+                  <el-table-column prop="createTime" label="时间"></el-table-column>
+                  <el-table-column prop="applicant" label="申请人"></el-table-column>
                 </el-table>
               </div>
             </div>
@@ -336,9 +228,14 @@ import {
   getProduceCensus
 } from '@/api/home'
 export default {
+  computed: {
+    systemName() {
+      return (window.SITE_CONFIG && window.SITE_CONFIG.systemName) || '木之云数字化平台';
+    }
+  },
   name: 'admin',
   components: {},
-  data () {
+  data() {
     return {
       analytics: {
         clients: '', // 客户数
@@ -380,7 +277,7 @@ export default {
       isTran: false
     }
   },
-  created () {
+  created() {
     this.getAnalytics()
     this.analyticsTimer = setInterval(this.getAnalytics, 1000 * 3600) // 1小时刷新
 
@@ -427,7 +324,7 @@ export default {
 
     this.setTitleScroll()
   },
-  mounted () {
+  mounted() {
     this.contractProdTableScroll()
     this.customerRankTableScroll()
     this.contractAlarmTableScroll()
@@ -435,7 +332,7 @@ export default {
     this.submittedRecordTableScroll()
     this.damageTableScroll()
   },
-  beforeDestroy () {
+  beforeDestroy() {
     clearInterval(this.analyticsTimer)
     clearInterval(this.contractAlarmListTimer)
     clearInterval(this.damageListTimer)
@@ -446,7 +343,7 @@ export default {
     clearInterval(this.produceCensusTimer)
   },
   methods: {
-    setTitleScroll () {
+    setTitleScroll() {
       this.$nextTick(() => {
         let boxWidth = this.$refs.boxnoticetitle.offsetWidth
         let contentWidth = this.$refs.noticetitle.offsetWidth
@@ -456,7 +353,7 @@ export default {
         }
       })
     },
-    getNoticeContent () {
+    getNoticeContent() {
       let content = sessionStorage.getItem('noticeContent')
       if (content == null || content === '') {
         content = '双击此处修改通知内容'
@@ -464,17 +361,17 @@ export default {
 
       this.noticeContent = content
     },
-    doubleClick () {
+    doubleClick() {
       this.dialogFormVisible = true
     },
-    dialogSubmit () {
+    dialogSubmit() {
       this.noticeContent = this.noticeForm.content
       this.dialogFormVisible = false
       sessionStorage.setItem('noticeContent', this.noticeContent)
       this.setTitleScroll()
     },
     // 合同统计
-    getAnalytics () {
+    getAnalytics() {
       getAnalytics({}).then(({ data }) => {
         if (data && data.code === '200') {
           this.analytics = { ...data.data }
@@ -482,7 +379,7 @@ export default {
       })
     },
     // 合同预警列表
-    getContractAlarmList () {
+    getContractAlarmList() {
       let params = {
         current: 1,
         size: 20
@@ -494,7 +391,7 @@ export default {
       })
     },
     // 客户排名列表
-    getCustomerRankList () {
+    getCustomerRankList() {
       let params = {
         current: 1,
         size: 20
@@ -506,7 +403,7 @@ export default {
       })
     },
     // 报损记录列表
-    getDamageList () {
+    getDamageList() {
       let params = {
         current: 1,
         size: 20
@@ -518,7 +415,7 @@ export default {
       })
     },
     // 出库记录列表
-    getOutboundRecordList () {
+    getOutboundRecordList() {
       let params = {
         current: 1,
         size: 20
@@ -530,7 +427,7 @@ export default {
       })
     },
     // 合同生产记录列表
-    getContractProdList () {
+    getContractProdList() {
       let params = {
         current: 1,
         size: 20
@@ -541,7 +438,7 @@ export default {
         }
       })
     },
-    contractProdListAddClass ({row, rowIndex}) {
+    contractProdListAddClass({ row, rowIndex }) {
       if (row.warningState === '3') {
         return 'custom-ranking-table-row overdue-row'
       }
@@ -553,7 +450,7 @@ export default {
       return 'custom-ranking-table-row'
     },
     // 报工列表
-    getSubmittedRecordList () {
+    getSubmittedRecordList() {
       let params = {
         current: 1,
         size: 20
@@ -565,14 +462,14 @@ export default {
       })
     },
     // 生产统计
-    getProduceCensus () {
+    getProduceCensus() {
       getProduceCensus({}).then(({ data }) => {
         if (data && data.code === '200') {
           this.produceCensus = data.data
         }
       })
     },
-    contractProdTableScroll () {
+    contractProdTableScroll() {
       this.$nextTick(() => {
         const divData = this.$refs.contractProdTable.bodyWrapper
         setInterval(() => {
@@ -586,7 +483,7 @@ export default {
         }, 50)
       })
     },
-    customerRankTableScroll () {
+    customerRankTableScroll() {
       this.$nextTick(() => {
         const divData = this.$refs.customerRankTable.bodyWrapper
         setInterval(() => {
@@ -600,7 +497,7 @@ export default {
         }, 50)
       })
     },
-    contractAlarmTableScroll () {
+    contractAlarmTableScroll() {
       this.$nextTick(() => {
         const divData = this.$refs.contractAlarmTable.bodyWrapper
         setInterval(() => {
@@ -614,7 +511,7 @@ export default {
         }, 50)
       })
     },
-    outboundRecordTableScroll () {
+    outboundRecordTableScroll() {
       this.$nextTick(() => {
         const divData = this.$refs.outboundRecordTable.bodyWrapper
         setInterval(() => {
@@ -628,7 +525,7 @@ export default {
         }, 50)
       })
     },
-    submittedRecordTableScroll () {
+    submittedRecordTableScroll() {
       this.$nextTick(() => {
         const divData = this.$refs.submittedRecordTable.bodyWrapper
         setInterval(() => {
@@ -642,7 +539,7 @@ export default {
         }, 50)
       })
     },
-    damageTableScroll () {
+    damageTableScroll() {
       this.$nextTick(() => {
         const divData = this.$refs.damageTable.bodyWrapper
         setInterval(() => {
@@ -657,7 +554,7 @@ export default {
       })
     },
     // 全屏显示
-    fullScreen () {
+    fullScreen() {
       const element = document.getElementById('content')
       element.requestFullscreen()
     }
@@ -684,7 +581,7 @@ body,
 }
 
 .el-table .warning-row {
-  color:#FFD700;
+  color: #FFD700;
 }
 
 .el-table .overdue-row {
@@ -692,7 +589,6 @@ body,
 }
 </style>
 <style scoped>
-
 .mod-home {
   /* line-height: 1.5; */
   height: 100%;
@@ -853,22 +749,24 @@ body,
   animation: wordsLoop 25s linear infinite normal;
 }
 
-@keyframes wordsLoop{
+@keyframes wordsLoop {
   0% {
     transform: translateX(0);
     -webkit-transform: translateX(0);
   }
+
   100% {
     transform: translateX(-51%);
     -webkit-transform: translateX(-51%);
   }
 }
 
-@-webkit-keyframes wordsLoop{
+@-webkit-keyframes wordsLoop {
   0% {
     transform: translateX(0);
     -webkit-transform: translateX(0);
   }
+
   100% {
     transform: translateX(-51%);
     -webkit-transform: translateX(-51%);
@@ -891,18 +789,18 @@ body,
   width: 100%;
 }
 
-.stat-number > .item {
+.stat-number>.item {
   height: 80%;
   display: flex;
   flex-direction: column;
   justify-content: space-around;
 }
 
-.stat-number > .item > .title {
+.stat-number>.item>.title {
   color: darkturquoise;
 }
 
-.stat-number > .item > .number {
+.stat-number>.item>.number {
   text-align: center;
 }
 
@@ -954,7 +852,7 @@ body,
   height: 100%;
 }
 
-.custom-ranking > .table {
+.custom-ranking>.table {
   background-color: darkturquoise;
   height: 100%;
   width: 100%;
@@ -990,7 +888,7 @@ body,
   height: 100%;
 }
 
-.contract-alert > .title > div {
+.contract-alert>.title>div {
   background-color: #415065;
   width: 100%;
   display: flex;
@@ -999,7 +897,7 @@ body,
   text-align: justify;
 }
 
-.contract-alert > .table {
+.contract-alert>.table {
   background-color: darkturquoise;
   height: 100%;
   width: 100%;

Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 188 - 449
src/views/modules/works/work.vue


+ 8 - 4
static/config/index.js

@@ -1,14 +1,18 @@
-/**
- * 开发环境
- */
 ;(function () {
   window.SITE_CONFIG = {}
 
-  // api接口请求地址
+  // api接口请求地址(测试)
   window.SITE_CONFIG['baseUrl'] = 'https://www.muzhikeji.cn/api'
 
   // cdn地址 = 域名 + 版本号
   window.SITE_CONFIG['domain'] = './' // 域名
   window.SITE_CONFIG['version'] = ''   // 版本号(年月日时分)
   window.SITE_CONFIG['cdnUrl'] = window.SITE_CONFIG.domain + window.SITE_CONFIG.version
+  // 系统名称
+  window.SITE_CONFIG['systemName'] = '木之云数字化平台'
+  // window.SITE_CONFIG['systemName'] = '昌柘伟业数字化平台'
+  // 域名
+  window.SITE_CONFIG['domain'] = 'www.muzhikeji.cn' // 测试环境
+  // window.SITE_CONFIG['domain'] = '192.168.2.124' // 东齐环境
+  // window.SITE_CONFIG['domain'] = '192.168.110.222' // 昌柘环境
 })()

Kaikkia tiedostoja ei voida näyttää, sillä liian monta tiedostoa muuttui tässä diffissä