123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011 |
- <template>
- <el-row class="container">
- <v-tour name="myTour" :steps="steps" :options="myOptions" :callbacks="myCallbacks" v-if="tourFlg"></v-tour>
- <el-col :span="24" class="header">
- <div class="contentMask" v-if="vTourFlg"></div>
- <el-col :span="10" class="logo" :class="collapsed?'logo-collapse-width':'logo-width'" :style="collapsed?'padding:0':''">
- <img v-if="collapsed" class="headImg" src="../assets/image/head_logo.png" />
- <div v-else class="logo-sys">
- <img class="headImg" src="../assets/image/head_logo.png" />
- <span>{{$t('workingHoursHousekeeper')}}</span>
- </div>
- </el-col>
- <el-col :span="6">
- <div class="tools" @click.prevent="collapse" style="position: relative;">
- <i class="fa fa-align-justify"></i>
- <div class="gongshimingz">
- {{user.companyName}}
- </div>
- </div>
- </el-col>
- <el-col :span="12" class="userinfo" style="display: flex;align-items: center;justify-content: flex-end;">
- <!-- 中英文切换入口 -->
- <!-- <el-dropdown trigger="click" @command="langChange" style="margin-right:30px;">
- <span class="el-dropdown-link userinfo-inner">
- {{language}} <i class="el-icon-caret-bottom"></i>
- </span>
- <el-dropdown-menu slot="dropdown">
- <el-dropdown-item divided command="zh">中文</el-dropdown-item>
- <el-dropdown-item divided command="en">English</el-dropdown-item>
- </el-dropdown-menu>
- </el-dropdown> -->
- <el-dropdown trigger="hover" style="margin-right:30px;">
- <span class="el-dropdown-link userinfo-inner">
- <i class="el-icon-user" style="font-size:18px" ></i>
- <!-- {{$t('other.customerService')}} -->
- 帮助中心
- </span>
- <el-dropdown-menu slot="dropdown">
- <el-dropdown-item >
- <div v-if="!isCorpWX">
- <!-- <div>{{$t('other.sweepWeChatYards')}}</div> -->
- <!-- <div>扫码添加企业微信客服</div> -->
- <div>{{ $t('ke-fu-wei-xin') }}</div>
- <img
- style="width: 120px; height: 120px"
- src="../assets/image/code.jpg" />
- </div>
- <div v-if="isCorpWX">
- <div>扫码添加企业微信客服</div>
- <img
- style="width: 153px; height: 153px"
- src="../assets/image/qwcode.png" />
- </div>
- <div>
- <div>
- <el-link type="primary" :underline="false" href="https://www.ttkuaiban.com/download/%E5%B7%A5%E6%97%B6%E7%AE%A1%E5%AE%B6%E7%AE%A1%E7%90%86%E7%B3%BB%E7%BB%9F%E4%BD%BF%E7%94%A8%E8%AF%B4%E6%98%8E%E4%B9%A6.pdf">点击查看操作手册</el-link>
- </div>
- </div>
- </el-dropdown-item>
- </el-dropdown-menu>
- </el-dropdown>
-
- {{$t('time.dueDate')}}:{{remainingTime}}
- <el-badge class="itemNew" :value="num" :hidden="num == 0">
- <i class="el-icon-message-solid" style="font-size:24px" v-popover:popover1 @click="drawer = true"></i>
- </el-badge>
- <el-drawer :title="$t('other.messageCenter')" :visible.sync="drawer" direction="rtl" :with-header="false" size="35%">
- <el-table :data="popoverData" :height="tableHeight" size="small">
- <el-table-column property="type" :label="$t('other.messageContent')" align="left">
- <template slot-scope="scope">
- <el-link type="primary" :underline="false" @click="locationHerf(scope.row.id,scope.row.content, scope.row.type)">
- <span style="font-size:13px;">
- <span v-if="scope.row.msg == null">
- {{msgTypeTxt[scope.row.type]}}
- </span>
- <span v-else>
- <span v-if="user.userNameNeedTranslate != 1">
- {{scope.row.msg}}
- </span>
- <span v-if="user.userNameNeedTranslate == 1">
- {{scope.row.omg.textOne}}
- <ww-open-data type='userName' :openid='scope.row.omg.textTwo'></ww-open-data>
- {{scope.row.omg.textThree}}
- </span>
- </span>
- <!-- {{scope.row.msg==null?msgTypeTxt[scope.row.type]:scope.row.msg}} -->
- </span>
- </el-link>
- </template>
- </el-table-column>
- <el-table-column property="type" :label="$t('state.states')" align="center" width="60">
- <template slot-scope="scope">
- <span v-if="scope.row.checked == 0" style="color:red">{{$t('other.unread')}}</span>
- <span v-else style="color:green">{{$t('other.read')}}</span>
- </template>
- </el-table-column>
- <el-table-column property="time" :label="$t('time.times')" align="center" width="120"></el-table-column>
- </el-table>
- </el-drawer>
- <el-dropdown trigger="hover" style="margin-left:10px;">
- <span class="el-dropdown-link userinfo-inner">
- <img src="../assets/image/userHead.png" />
- <span v-if="user.userNameNeedTranslate == 1">
- <ww-open-data type='userName' :openid='sysUserName'></ww-open-data>
- </span>
- <span v-if="user.userNameNeedTranslate != 1">
- {{sysUserName}}
- </span>
- <!-- {{sysUserName}} -->
- </span>
- <el-dropdown-menu slot="dropdown">
- <!-- <el-dropdown-item disabled ><span style="font-size:12px;"><i class="el-icon-view" ></i>{{roleArray[user.role]}}</span></el-dropdown-item> -->
- <el-dropdown-item disabled ><span style="font-size:12px;"><i class="el-icon-view" ></i>{{user.roleName}}</span></el-dropdown-item>
- <el-dropdown-item disabled ><span style="font-size:12px;"><i class="el-icon-medal" v-if="user.jobNumber"></i>{{user.jobNumber}}</span></el-dropdown-item>
- <el-dropdown-item @click.native="reset" v-if="user.userNameNeedTranslate != 1">{{$t('other.changeThePassword')}}</el-dropdown-item>
- <!-- <el-dropdown-item @click.native="editInfoOpen">修改信息</el-dropdown-item> -->
- <el-dropdown-item divided @click.native="logout" v-if="!isCorpWX" >{{$t('other.launchTheLogin')}}</el-dropdown-item>
- </el-dropdown-menu>
- </el-dropdown>
- </el-col>
- </el-col>
- <el-col :span="24" class="main">
- <aside :class="collapsed?'menu-collapsed':'menu-expanded'">
- <el-scrollbar style="height:100%">
- <!--导航菜单-->
- <el-menu :default-active="$route.path" class="el-menu-vertical-demo" unique-opened router v-if="!collapsed" default-openeds="zhan">
- <template v-for="(item, index) in $router.options.routes" v-if="!item.hidden">
- <!-- <el-submenu :index="index+''" v-if="!item.leaf"> -->
- <el-submenu :index="'zhan'" v-if="!item.leaf">
- <template slot="title">
- <i :class="item.iconCls"></i>
- <!-- <span class="itemName">{{item.name}}</span> -->
- <span class="itemName bosx" v-if="$t(item.meta.text).length < 16">{{$t(item.meta.text)}}</span>
- <el-tooltip class="itemName bosx" v-if="$t(item.meta.text).length > 16" effect="dark" :content="$t(item.meta.text)" placement="top">
- <span>{{$t(item.meta.text)}}</span>
- </el-tooltip>
- </template>
- <el-menu-item v-for="child in item.children" :index="child.path" :key="child.path" v-if="!child.hidden" :data-v-step="child.path"><i :class="child.iconCls"></i>
- <!-- {{child.name}} -->
- <span class="bosx" v-if="$t(child.meta.text).length < 16">{{$t(child.meta.text)}}</span>
- <el-tooltip class="bosx" v-if="$t(child.meta.text).length > 16" effect="dark" :content="$t(child.meta.text)" placement="top">
- <span>{{$t(child.meta.text)}}</span>
- </el-tooltip>
- </el-menu-item>
- </el-submenu>
- <el-menu-item v-if="item.leaf && item.children.length > 0" :index="item.children[0].path" :data-v-step="item.children[0].path">
- <i :class="item.iconCls"></i>
- <!-- {{item.children[0].name}} -->
- <span class="bosx" v-if="$t(item.meta.text).length < 16">{{$t(item.meta.text)}}</span>
- <el-tooltip class="itemName bosx" v-if="$t(item.meta.text).length > 16" effect="dark" :content="$t(item.meta.text)" placement="top">
- <span>{{$t(item.meta.text)}}</span>
- </el-tooltip>
- <!-- {{$t('navigation.reports')}} -->
- <!-- this.$t('navigation.reports') // js-->
- </el-menu-item>
- </template>
- </el-menu>
- <!--导航菜单-折叠后-->
- <ul class="el-menu el-menu-vertical-demo collapsed" v-if="collapsed" ref="menuCollapsed">
- <li v-for="(item,index) in $router.options.routes" v-if="!item.hidden" class="el-submenu item" :style="{overflow:!item.leaf?'':'hidden'}">
- <template v-if="!item.leaf">
- <div class="el-submenu__title" style="padding-left: 20px;" @mouseover="showMenu(index,true)" @mouseout="showMenu(index,false)">
- <i :class="item.iconCls"></i>
- </div>
- <ul class="el-menu submenu" :class="'submenu-hook-'+index" @mouseover="showMenu(index,true)" @mouseout="showMenu(index,false)">
- <li v-for="child in item.children" v-if="!child.hidden" :key="child.path" class="el-menu-item" style="padding-left: 40px;" :class="$route.path==child.path?'is-active':''" @click="$router.push(child.path)">
- {{child.name}}
- </li>
- </ul>
- </template>
- <template v-else>
- <li class="el-submenu">
- <div class="el-submenu__title el-menu-item" :class="$route.path==item.children[0].path?'is-active':''" @click="$router.push(item.children[0].path)"
- style="padding-left: 20px;height: 56px;line-height: 56px;padding: 0 20px;">
- <i :class="item.iconCls"></i>
- </div>
- </li>
- </template>
- </li>
- </ul>
- </el-scrollbar>
- </aside>
- <section class="content-container">
- <div class="contentMask" v-if="vTourFlg"></div>
- <div class="grid-content bg-purple-light">
- <el-col :span="24" class="content-wrapper">
- <transition name="fade" mode="out-in">
- <router-view></router-view>
- </transition>
- </el-col>
- </div>
- <!--修改密码-->
- <el-dialog :title="$t('other.changeThePassword')" width='450px' v-if="editPassWord" :visible.sync="editPassWord" :close-on-click-modal="false" customClass="customWidth">
- <el-form :model="addForm" label-width="auto" :rules="passRule" ref="addForm">
- <el-form-item :label="$t('lable.originalPassword')" prop="originPassword">
- <el-input v-model="addForm.originPassword" autocomplete="off" :placeholder="$t('defaultText.pleaseEnterTheOldPassword')" show-password></el-input>
- </el-form-item>
- <el-form-item :label="$t('lable.newPassword')" prop="newPassword">
- <el-input v-model="addForm.newPassword" autocomplete="off" :placeholder="$t('defaultText.pleaseEnterTheNewPassword')" show-password></el-input>
- </el-form-item>
- </el-form>
- <div slot="footer" class="dialog-footer">
- <el-button @click.native="editPassWord = false">{{$t('btn.cancel')}}</el-button>
- <el-button type="primary" @click.native="resetPwd" :loading="editLoading">{{$t('btn.submit')}}</el-button>
- </div>
- </el-dialog>
- <!--修改信息-->
- <el-dialog :title="$t('title.modifyTheInformation')" width='450px' v-if="editInformation" :visible.sync="editInformation" :close-on-click-modal="false" customClass="customWidth">
- <el-form :model="editInfoForm" label-width="auto" :rules="passRule" ref="editInfoForm">
- <el-form-item :label="$t('lable.name')" prop="username">
- <el-input v-model="editInfoForm.username" autocomplete="off" :placeholder="$t('defaultText.PleaseEnterYourName')"></el-input>
- </el-form-item>
- </el-form>
- <el-form :model="editInfoForm" label-width="auto" :rules="passRule" ref="editInfoForm">
- <el-form-item :label="$t('lable.phone')" prop="mobile">
- <el-input v-model="editInfoForm.mobile" autocomplete="off" :placeholder="$t('defaultText.PleaseEnterYourPhone')" :disabled="true"></el-input>
- </el-form-item>
- </el-form>
- <div slot="footer" class="dialog-footer">
- <el-button @click.native="editInformation = false">{{$t('btn.cancel')}}</el-button>
- <el-button type="primary" @click.native="editInfo" :loading="editLoading2">{{$t('btn.submit')}}</el-button>
- </div>
- </el-dialog>
- </section>
- </el-col>
- </el-row>
- </template>
- <script>
- import util from "../common/js/util";
- export default {
- // 引用 app.vue reloads 方法
- inject:['reloads'],
- data() {
- return {
- tourFlg: false,
- steps: [],
- myOptions:{
- useKeyboardNavigation: false, //不使用←、→和ESC键来导航tour
- startTimeout: 1000, //1秒后执行
- highlight: true,
- labels: {
- buttonSkip: '跳过',
- buttonPrevious: '上一步',
- buttonNext: '下一步',
- buttonStop: '关闭'
- }
- },
- myCallbacks: {
- onSkip: this.onSkip, //在data中定义两个回调
- onFinish: this.onFinish
- },
- isCorpWX: false,
- // roleArray:["普通员工","超级管理员", "系统管理员", "公司高层","财务管理员", "项目管理员","公司领导"],
- roleArray:[this.$t('role.ordinaryEmployees'),this.$t('role.superAdministrator'),this.$t('role.systemAdministrator'),this.$t('role.companyTop'),this.$t('role.financialAdministrator'),this.$t('role.projectManager'),this.$t('role.companyLeadership')],
- helpImg: '../assets/image/userHead.png',
- user: sessionStorage.getItem("user"),
- collapsed: sessionStorage.collapsed!=null?(sessionStorage.collapsed=='true'?true:false):false,
- sysUserName: "",
- menu: [],
- // msgTypeTxt:["审批未通过","有新任务啦","任务有新进展","项目日报审核通过"],
- msgTypeTxt:[this.$t('state.notApproved'),this.$t('state.ThereIsAnewTask'),this.$t('state.TheresBeen'),this.$t('state.approvedProject')],
- editInformation: false,
- editPassWord: false,
- editLoading: false,
- editLoading2: false,
- addForm: {
- id: "",
- originPassword: "",
- newPassword: ""
- },
- editInfoForm: {
- id: "",
- username: "",
- mobile: "",
- companyName: ""
- },
- passRule: {
- originPassword: [{ required: true, message: this.$t('defaultText.pleaseEnterTheOldPassword'), trigger: "blur" }],
- newPassword: [{ required: true, message: this.$t('defaultText.pleaseEnterTheNewPassword'), trigger: "blur" }],
- username: [{ required: true, message: this.$t('defaultText.PleaseEnterYourName'), trigger: "blur" }]
- },
- //时间
- activeDate: new Date(),
- timer: null,
- remainingTime: '',
- drawer: false,
- tableHeight: 0,
- popoverData: [],
- num: 0,
- language: '',
- setTimeLoad: null,
- // 遮罩
- vTourFlg: false
- };
- },
- created() {
- var arr = []
- var routers = JSON.parse(sessionStorage.getItem("user")).moduleList
- for(var i in routers) {
- if(routers[i].path == '/timetype') {
- let obj = {
- target: '[data-v-step="/timetype"]',
- content: `查看基础设置,按照企业情况进行调整`,
- params: {
- placement: 'right',
- highlight: true
- }
- }
- arr.push(obj)
- }
- if(routers[i].path == '/list') {
- let obj = {
- target: '[data-v-step="/list"]',
- content: `创建项目和任务`,
- params: {
- placement: 'right',
- highlight: true
- }
- }
- arr.push(obj)
- }
- if(routers[i].path == '/daily') {
- let obj = {
- target: '[data-v-step="/daily"]',
- content: `填写每日工时报告`,
- params: {
- placement: 'right',
- highlight: true
- }
- }
- arr.push(obj)
- }
- if(routers[i].path == '/review') {
- let obj = {
- target: '[data-v-step="/review"]',
- content: `审核人审核日报`,
- params: {
- placement: 'right',
- highlight: true
- }
- }
- arr.push(obj)
- }
- if(routers[i].path == '/cost') {
- let obj = {
- target: '[data-v-step="/cost"]',
- content: `查看工时成本统计结果`,
- params: {
- placement: 'right',
- highlight: true
- }
- }
- arr.push(obj)
- }
- if(routers[i].path == '/finance') {
- let obj = {
- target: '[data-v-step="/finance"]',
- content: `导入薪资,校准成本并生成财务报表`,
- params: {
- placement: 'right',
- highlight: true
- }
- }
- arr.push(obj)
- }
- if(routers[i].path == '/team') {
- let obj = {
- target: '[data-v-step="/team"]',
- content: `编辑员工信息,分配角色`,
- params: {
- placement: 'right',
- highlight: true
- }
- }
- arr.push(obj)
- }
- }
- this.steps = arr
- console.log(this.steps, '数据', routers)
- },
- methods: {
- onSkip(currentStep) {
- console.log('看看')
- this.vTourFlg = false
- },
- onFinish(currentStep) {
- console.log('数据')
- this.vTourFlg = false
- },
- // 中英文切换
- langChange(command) {
- let flg = this.language
- this.$i18n.locale = command
- localStorage.setItem("lang", command)
- if(command == 'en') {
- this.language = 'English'
- } else if (command == 'zh') {
- this.language = '中文'
- }
- if(flg != this.language) {
- this.reloads()
- }
- },
-
- //退出登录
- logout: function() {
- var _this = this;
- this.$confirm(this.$t('other.confirmExit') + '?', this.$t('other.prompts'), {
- //type: 'warning'
- confirmButtonText: this.$t('btn.submit'),
- cancelButtonText: this.$t('btn.cancel'),
- }).then(() => {
- sessionStorage.removeItem("user");
- location.reload();
- _this.$router.push("/login");
- });
- },
- //折叠导航栏
- collapse: function() {
- this.collapsed = !this.collapsed;
- sessionStorage.collapsed = this.collapsed;
- },
- showMenu(i, status) {
- this.$refs.menuCollapsed.getElementsByClassName(
- "submenu-hook-" + i
- )[0].style.display = status ? "block" : "none";
- },
- //打开编辑信息界面
- editInfoOpen() {
- this.editInformation = true;
- this.editInfoForm.id = JSON.parse(sessionStorage.getItem("user")).id;
- this.editInfoForm.username = JSON.parse(
- sessionStorage.getItem("user")
- ).username;
- this.editInfoForm.mobile = JSON.parse(
- sessionStorage.getItem("user")
- ).account;
- this.editInfoForm.companyName = JSON.parse(
- sessionStorage.getItem("user")
- ).companyName;
- },
- //编辑信息
- editInfo() {
- this.$refs.editInfoForm.validate(valid => {
- if (valid) {
- this.editLoading2 = true;
- this.http.post(
- this.port.pwd.resetPwd,
- { id: this.editInfoForm.id, username: this.editInfoForm.username },
- res => {
- this.editLoading2 = false;
- this.editInformation = false;
- if (res.code == "ok") {
- this.$message({
- message: this.$t('message.modifyTheSuccess'),
- type: "success"
- });
- //读取并覆盖session storage
- var userObject = JSON.parse(sessionStorage.getItem("user"));
- userObject.username = this.editInfoForm.username;
- sessionStorage.setItem("user", JSON.stringify(userObject));
- this.sysUserName = this.editInfoForm.username;
- } else {
- this.$message({
- message: res.msg,
- type: "error"
- });
- }
- },
- error => {
- this.editLoading2 = false;
- this.editInformation = false;
- this.$message({
- message: error,
- type: "error"
- });
- }
- );
- }
- });
- },
- reset() {
- this.editPassWord = true;
- this.addForm.id = JSON.parse(sessionStorage.getItem("user")).id;
- this.addForm.account = JSON.parse(sessionStorage.getItem("user")).account;
- },
- resetPwd() {
- this.$refs.addForm.validate(valid => {
- if (valid) {
- this.editLoading = true;
- this.http.post( this.port.manage.editPassword, this.addForm,
- res => {
- this.editLoading = false;
- this.editPassWord = false;
- if (res.code == "ok") {
- this.$message({
- // message: "修改成功,请重新登录",
- message: this.$t('message.logAganin'),
- type: "success"
- });
- this.$router.push("/login");
- } else {
- this.$message({
- message: res.msg,
- type: "error"
- });
- }
- },
- error => {
- this.editLoading = false;
- this.editPassWord = false;
- this.$message({
- message: error,
- type: "error"
- });
- });
- }
- });
- },
- setTime() {
- var d = util.formatDate.cdTime(new Date(new Date().getTime() + this.user.remainingTime), new Date(), 'd');
- var h = util.formatDate.cdTime(new Date(new Date().getTime() + this.user.remainingTime), new Date(), 'h');
- var m = util.formatDate.cdTime(new Date(new Date().getTime() + this.user.remainingTime), new Date(), 'm');
- var s = util.formatDate.cdTime(new Date(new Date().getTime() + this.user.remainingTime), new Date(), 's');
- this.remainingTime = d+'天'+h+'时'+m+'分'+s+'秒';
- },
- // 加载消息
- loadNotice() {
- this.http.post( this.port.manage.msgList, {},
- res => {
- if (res.code == "ok") {
- var list = res.data;
- if(this.user.userNameNeedTranslate == 1) {
- let msgArr = res.data
- for(var i in msgArr) {
- if(msgArr[i].msg) {
- let caozuo = JSON.parse(JSON.stringify(msgArr[i].msg))
- if(caozuo.indexOf('$userName=') != '-1') {
- let textOne = caozuo.split('$userName=')[0]
- let textTwo = caozuo.split('$userName=')[1].split('$')[0]
- let textThree = caozuo.split('$userName=')[1].split('$')[1]
- msgArr[i].omg = {
- textOne: textOne,
- textTwo: textTwo,
- textThree: textThree
- }
- } else {
- msgArr[i].omg = {
- textOne: msgArr[i].msg,
- textTwo: '',
- textThree: ''
- }
- }
- } else {
- msgArr[i].omg = {
- textOne: '',
- textTwo: '',
- textThree: ''
- }
- }
- }
- }
- this.popoverData = res.data;
- var num = 0;
- for(var i in list) {
- if(list[i].checked != 1) {
- num ++;
- }
- }
- this.num = num;
- } else {
- this.$message({
- message: res.msg,
- type: "error"
- });
- }
- },
- error => {
- this.$message({
- message: error,
- type: "error"
- });
- });
- },
- //点击消息的跳转
- locationHerf(id, date, type) {
- this.http.post( this.port.manage.check, { id: id },
- res => {
- if (res.code == "ok") {
- this.loadNotice();
- if (type == 0) {
- //审批未通过的消息, 也包括审批通过的通知
- sessionStorage.msg = date;
- sessionStorage.from = 1;
- //本页面再点的话强制转移一下
- var currentRoute = this.$route.path.split("/");
- if (currentRoute[1] == "daily") {
- this.$router.go(0);
- this.drawer = false;
- return false;
- }
- this.$router.push("/daily");
- this.drawer = false;
- } else if (type == 1) {
- //1- 有新任务待执行
- this.$router.push("/projectInside/"+date);
- this.drawer = false;
- } else if (type == 2) {
- //2- 任务有新进展
- this.$router.push("/projectInside/"+date);
- this.drawer = false;
- } else if (type == 3) {
- //3- 费用报销
- this.$router.push("/expense");
- this.drawer = false;
- } else if (type == 4) {
- //4- 请假消息
- this.$router.push("/leave");
- this.drawer = false;
- } else if (type == 5) {
- //5- 出差消息
- this.$router.push("/awayOffice");
- this.drawer = false;
- } else if (type == 6 || type == 7 || type == 8) {
- // 6、7 合同通过、驳回
- this.$router.push("/contract");
- this.drawer = false;
- }
-
-
- } else {
- this.$message({
- message: res.msg,
- type: "error"
- });
- }
- },
- error => {
- this.$message({
- message: error,
- type: "error"
- });
- });
- },
- // 获取企业微信的参数
- agentConfig() {
- var isCorpWX = true
- var ua = navigator.userAgent.toLowerCase();
- if (ua.indexOf("wxwork") > 0) {
- isCorpWX = false;
- }
- var curUrl = location.href.split("#")[0];
- this.http.post("/wxcorp/getCorpWXConfig", {url: curUrl, token: this.user.id}, (res) => {
- if (res.code == "ok") {
- wx.config({
- beta: true,
- debug: isCorpWX, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
- appId: res.data.appid, // 必填,公众号的唯一标识
- timestamp: res.data.timestamp, // 必填,生成签名的时间戳
- nonceStr: res.data.noncestr, // 必填,生成签名的随机串
- signature: res.data.sign, // 必填,签名,见附录1
- jsApiList: ['chooseImage','previewImage','uploadImage','downloadImage','previewFile','getLocation','agentConfig','openAppManage']
- });
- var that = this;
- wx.ready(function(){
- // config信息验证后会执行ready方法,所有接口调用都必须在config接口获得结果之后,config是一个客户端的异步操作,所以如果需要在页面加载时就调用相关接口,则须把相关接口放在ready函数中调用来确保正确执行。对于用户触发时才调用的接口,则可以直接调用,不需要放在ready函数中。
- that.http.post("/wxcorp/getCorpWXAgentConfig", {url: curUrl, token: that.user.id}, (res) => {
- if (res.code == "ok") {
- console.log()
- wx.agentConfig({
- corpid: res.data.corpid, // 必填,企业微信的corpid,必须与当前登录的企业一致
- agentid: res.data.agentid, // 必填,企业微信的应用id (e.g. 1000247)
- timestamp: res.data.timestamp, // 必填,生成签名的时间戳
- nonceStr: res.data.nonceStr, // 必填,生成签名的随机串
- signature: res.data.signature, // 必填,签名,见附录-JS-SDK使用权限签名算法
- jsApiList: ['selectExternalContact', 'selectEnterpriseContact'], //必填,传入需要使用的接口名称
- success: function (result) {
- console.log(result, '请求微信成功')
- console.log(window, 'window')
- // wx.agentConfig成功回调后,WWOpenData 才会注入到 window 对象上面
- if(window.WWOpenData) {
- window.WWOpenData.bind(document.querySelector('ww-open-data'))
- if (WWOpenData.initCanvas) {
- WWOpenData.initCanvas()
- console.log('我企业微信 canvas 应该执行了吧')
- }
- }
- },
- fail: function (res) {
- console.log('查看错误信息', res)
- if (res.errMsg.indexOf('function not exist') > -1) {
- alert('版本过低请升级')
- }
- },
- })
- }
- }, (error) => {
- console.log('查看错误信息' + res)
- if (error.errMsg.indexOf('function not exist') > -1) {
- alert('版本过低请升级')
- }
- })
- });
- }
- }, (error) => {
- console.log(error, '哦耶')
- })
- },
- },
- mounted() {
- // console.log(this.$router.options.routes, '看看')
- console.log(this.$router.options.routes, '路由')
- var ua = navigator.userAgent.toLowerCase();
- if (ua.indexOf("wxwork") > 0) {
- this.isCorpWX = true;
- }
- let langse = localStorage.getItem("lang") || 'zh'
- if(langse == 'en') {
- this.language = 'English'
- } else if (langse == 'zh') {
- this.language = '中文'
- }
- let height = window.innerHeight;
- this.tableHeight = height - 15;
- const that = this;
- window.onresize = function temp() {
- that.tableHeight = window.innerHeight - 15;
- };
- if (this.user) {
- var user = JSON.parse(this.user);
- this.user = user;
- this.sysUserName = user.name || "";
- this.loadNotice();
- if(this.user.remainingTime != "" && this.user.remainingTime != 0) {
- this.remainingTime = util.formatDate.format(new Date(new Date().getTime() + this.user.remainingTime), "yyyy-MM-dd")
- } else {
- this.remainingTime = this.$t('other.expired');
- clearInterval(this.timer);
- }
- } else {
- this.$router.push("/login");
- }
- // console.log('啊,我被触发了呀')
- // 获取企业微信参数
- if(this.user.userNameNeedTranslate == '1') {
- this.agentConfig()
- }
- // 判断是否为新用户
- if(this.user.isFirstLogin == 1) {
- var thats = this
- this.tourFlg = true
- setTimeout(() => {
- thats.$tours['myTour'].start()
- setTimeout(() => {
- thats.vTourFlg = true
- }, 1000)
- }, 200)
- }
- },
- };
- </script>
- <style scoped lang="scss">
- .contentMask {
- width: 100%;
- height: 100%;
- position: absolute;
- top: 0;
- left: 0;
- background: #000;
- opacity: .4;
- z-index: 99;
- // box-shadow: 0 0 0 99999px rgba(0,0,0,.4) !important;
- }
- .gongshimingz {
- width: 100%;
- position: absolute;
- left: 0px;
- display: inline-block;
- overflow: hidden;
- white-space: nowrap;
- text-overflow: ellipsis;
- box-sizing: border-box;
- padding-left: 60px;
- }
- .el-menu-vertical-demo i {
- margin-right: 10px;
- }
- .container {
- position: absolute;
- top: 0px;
- bottom: 0px;
- width: 100%;
- .header {
- height: 60px;
- line-height: 60px;
- background: #20a0ff;
- color: #fff;
- position: relative;
- .userinfo {
- text-align: right;
- padding-right: 35px;
- float: right;
- .userinfo-inner {
- cursor: pointer;
- color: #fff;
- img {
- width: 40px;
- height: 40px;
- border-radius: 20px;
- margin: 10px 10px 10px 10px;
- float: left;
- }
- }
- .itemNew {
- height: 25px;
- margin: 0 0 0 10px;
- i {
- vertical-align: top;
- }
- }
- }
- .logo {
- height: 60px;
- font-size: 21px;
- padding-left: 20px;
- padding-right: 20px;
- border-color: rgba(238, 241, 146, 0.3);
- border-right-width: 1px;
- border-right-style: solid;
- img {
- width: 40px;
- float: left;
- margin: 10px 10px 10px 18px;
- }
- img.headImg {
- margin: 0;
- width: 40px;
- height: 40px;
- margin: 10px 0 0 10px;
- }
- .logo-sys {
- height: 100%;
- line-height: 100%;
- img.headImg {
- width: 40px;
- height: 40px;
- margin: 7.5px 0 0 10px;
- vertical-align: middle;
- }
- span {
- display: inline-block;
- height: 100%;
- line-height: 60px;
- margin-left: 15px;
- font-size: 18px;
- // margin: 20px 0 0 15px;
- vertical-align: middle;
- }
- }
- .txt {
- color: #fff;
- }
- }
- .logo-width {
- width: 200px;
- }
- .logo-collapse-width {
- width: 60px;
- }
- .tools {
- padding: 0px 23px;
- // width: 14px;
- height: 60px;
- line-height: 60px;
- cursor: pointer;
- }
- }
- .main {
- display: flex;
- position: absolute;
- top: 60px;
- bottom: 0px;
- overflow: hidden;
- aside {
- flex: 0 0 230px;
- width: 230px;
- .el-menu {
- height: 100%;
- }
- .collapsed {
- width: 60px;
- .item {
- position: relative;
- }
- .submenu {
- position: absolute;
- top: 0px;
- left: 60px;
- z-index: 99999;
- height: auto;
- display: none;
- box-shadow: 5px 5px 10px #ddd;
- }
- }
- }
- .menu-collapsed {
- flex: 0 0 60px;
- width: 60px;
- }
- .menu-expanded {
- flex: 0 0 200px;
- width: 200px;
- }
- .content-container {
- flex: 1;
- width: 80%;
- overflow-y: auto;
- overflow-x: hidden;
- position: relative;
- .breadcrumb-container {
- .title {
- width: 200px;
- float: left;
- color: #475669;
- }
- .breadcrumb-inner {
- float: right;
- }
- }
- .content-wrapper {
- background-color: #fff;
- box-sizing: border-box;
- position: relative;
- }
- }
- }
- }
- .popover-item {
- padding: 10px;
- border-bottom: 1px #eee solid;
- }
- .popover-item > div > p {
- margin: 0;
- line-height: 18px;
- }
- .popover-title {
- color: #409eff;
- padding-bottom: 8px;
- }
- .popover-type {
- color: #aaa;
- font-size: 8px;
- float: right;
- }
- .popover-button {
- font-weight: 900;
- padding: 10px;
- text-align: center;
- cursor: pointer;
- }
- .isRead {
- color: #999 !important;
- }
- .bosx {
- width: 110px;
- display: inline-block;
- overflow: hidden;
- white-space: nowrap;
- text-overflow: ellipsis;
- }
- </style>
|