Home.vue 53 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105
  1. <template>
  2. <el-row class="container">
  3. <v-tour name="myTour" :steps="steps" :options="myOptions" :callbacks="myCallbacks" v-if="tourFlg"></v-tour>
  4. <el-col :span="24" class="header">
  5. <div class="contentMask" v-if="vTourFlg"></div>
  6. <el-col :span="10" class="logo" :class="collapsed?'logo-collapse-width':'logo-width'" :style="collapsed?'padding:0':''">
  7. <img v-if="collapsed" class="headImg" :src="appLogo" />
  8. <div v-else class="logo-sys">
  9. <img class="headImg" :src="appLogo" />
  10. <span>{{appName}}</span>
  11. </div>
  12. </el-col>
  13. <el-col :span="6">
  14. <div class="tools" style="position: relative;">
  15. <i class="fa fa-align-justify" @click.prevent="collapse" style="position: relative;z-index: 10;"></i>
  16. <div class="gongshimingz">
  17. {{user.companyName}}
  18. <i v-if="user.roleName == '超级管理员'" class="el-icon-edit" @click="editCompanyNamedialog=true,companyForm.name = user.companyName" style="position: relative;z-index: 15; margin-left: 5px;"></i>
  19. </div>
  20. </div>
  21. </el-col>
  22. <el-col :span="12" class="userinfo" style="display: flex;align-items: center;justify-content: flex-end;">
  23. <el-dropdown trigger="hover" style="margin-right:30px;">
  24. <span class="el-dropdown-link userinfo-inner">
  25. <i class="el-icon-user" style="font-size:18px" ></i>
  26. <!-- {{$t('other.customerService')}} -->
  27. 帮助中心
  28. </span>
  29. <el-dropdown-menu slot="dropdown">
  30. <el-dropdown-item >
  31. <div v-if="!isCorpWX">
  32. <!-- <div>{{$t('other.sweepWeChatYards')}}</div> -->
  33. <!-- <div>扫码添加企业微信客服</div> -->
  34. <div>{{ $t('ke-fu-wei-xin') }}</div>
  35. <img
  36. style="width: 120px; height: 120px"
  37. src="../assets/image/code.jpg" />
  38. </div>
  39. <div v-if="isCorpWX">
  40. <div>扫码添加企业微信客服</div>
  41. <img
  42. style="width: 153px; height: 153px"
  43. src="../assets/image/qwcode.png" />
  44. </div>
  45. <div>
  46. <div>
  47. <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>
  48. </div>
  49. </div>
  50. </el-dropdown-item>
  51. </el-dropdown-menu>
  52. </el-dropdown>
  53. {{$t('time.dueDate')}}:{{remainingTime}}
  54. <el-badge class="itemNew" :value="num" :hidden="num == 0">
  55. <i class="el-icon-message-solid" style="font-size:24px" v-popover:popover1 @click="drawer = true"></i>
  56. </el-badge>
  57. <el-drawer :title="$t('other.messageCenter')" :visible.sync="drawer" direction="rtl" :with-header="false" size="35%">
  58. <el-table :data="popoverData" :height="tableHeight" size="small">
  59. <el-table-column property="type" :label="$t('other.messageContent')" align="left">
  60. <template slot-scope="scope">
  61. <el-link type="primary" :underline="false" @click="locationHerf(scope.row.id,scope.row.content, scope.row.type)">
  62. <span style="font-size:13px;">
  63. <span v-if="scope.row.msg == null">
  64. {{msgTypeTxt[scope.row.type]}}
  65. </span>
  66. <span v-else>
  67. <span v-if="user.userNameNeedTranslate != 1">
  68. {{scope.row.msg}}
  69. </span>
  70. <span v-if="user.userNameNeedTranslate == 1">
  71. {{scope.row.omg.textOne}}
  72. <ww-open-data type='userName' :openid='scope.row.omg.textTwo'></ww-open-data>
  73. {{scope.row.omg.textThree}}
  74. </span>
  75. </span>
  76. <!-- {{scope.row.msg==null?msgTypeTxt[scope.row.type]:scope.row.msg}} -->
  77. </span>
  78. </el-link>
  79. </template>
  80. </el-table-column>
  81. <el-table-column property="type" :label="$t('state.states')" align="center" width="60">
  82. <template slot-scope="scope">
  83. <span v-if="scope.row.checked == 0" style="color:red">{{$t('other.unread')}}</span>
  84. <span v-else style="color:green">{{$t('other.read')}}</span>
  85. </template>
  86. </el-table-column>
  87. <el-table-column property="time" :label="$t('time.times')" align="center" width="120"></el-table-column>
  88. </el-table>
  89. </el-drawer>
  90. <el-dropdown trigger="hover" style="margin-left:10px;">
  91. <span class="el-dropdown-link userinfo-inner">
  92. <img src="../assets/image/userHead.png" />
  93. <span v-if="user.userNameNeedTranslate == 1">
  94. <ww-open-data type='userName' :openid='sysUserName'></ww-open-data>
  95. </span>
  96. <span v-if="user.userNameNeedTranslate != 1">
  97. {{sysUserName}}
  98. </span>
  99. <!-- {{sysUserName}} -->
  100. </span>
  101. <el-dropdown-menu slot="dropdown">
  102. <!-- <el-dropdown-item disabled ><span style="font-size:12px;"><i class="el-icon-view" ></i>{{roleArray[user.role]}}</span></el-dropdown-item> -->
  103. <el-dropdown-item disabled ><span style="font-size:12px;"><i class="el-icon-view" ></i>{{user.roleName}}</span></el-dropdown-item>
  104. <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>
  105. <el-dropdown-item @click.native="reset" v-if="user.userNameNeedTranslate != 1">{{$t('other.changeThePassword')}}</el-dropdown-item>
  106. <!-- <el-dropdown-item @click.native="editInfoOpen">修改信息</el-dropdown-item> -->
  107. <el-dropdown-item divided @click.native="logout" v-if="!isCorpWX" >{{$t('other.launchTheLogin')}}</el-dropdown-item>
  108. </el-dropdown-menu>
  109. </el-dropdown>
  110. </el-col>
  111. </el-col>
  112. <el-col :span="24" class="main">
  113. <aside :class="collapsed?'menu-collapsed':'menu-expanded'">
  114. <el-scrollbar style="height:100%">
  115. <!--导航菜单-->
  116. <el-menu :default-active="$route.path" class="el-menu-vertical-demo" unique-opened router v-if="!collapsed" default-openeds="zhan">
  117. <template v-for="(item, index) in $router.options.routes" v-if="!item.hidden">
  118. <div v-if="item.name =='产品管理'">
  119. <el-submenu :index="'zhan'" >
  120. <template slot="title">
  121. <i :class="item.iconCls"></i>
  122. <span class="itemName bosx" v-if="item.name.length < 16">{{item.name}}</span>
  123. <el-tooltip class="itemName bosx" v-if="item.name.length > 16" effect="dark" :content="item.name" placement="top">
  124. <span>{{item.name}}</span>
  125. </el-tooltip>
  126. </template>
  127. <!-- 根据后台配置的产品分类来渲染产品管理的子菜单 -->
  128. <el-menu-item v-for="child in user.prodSubMenuList" :index="child.path" :key="child.path" v-if="!child.hidden" :data-v-step="child.path"><i :class="child.iconCls"></i>
  129. <span class="bosx" v-if="child.name.length < 16">{{child.name}}</span>
  130. <el-tooltip class="bosx" v-if="child.name.length > 16" effect="dark" :content="child.name" placement="top">
  131. <span>{{child.name}}</span>
  132. </el-tooltip>
  133. </el-menu-item>
  134. </el-submenu>
  135. </div>
  136. <div v-else>
  137. <el-submenu :index="'zhan'" v-if="!item.leaf">
  138. <template slot="title">
  139. <i :class="item.iconCls"></i>
  140. <span class="itemName bosx" v-if="item.name.length < 16">{{item.name}}</span>
  141. <el-tooltip class="itemName bosx" v-if="item.name.length > 16" effect="dark" :content="item.name" placement="top">
  142. <span>{{item.name}}</span>
  143. </el-tooltip>
  144. </template>
  145. <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>
  146. <!-- {{child.name}} -->
  147. <span class="bosx" v-if="child.name.length < 16">{{child.name}}</span>
  148. <el-tooltip class="bosx" v-if="child.name.length > 16" effect="dark" :content="child.name" placement="top">
  149. <span>{{child.name}}</span>
  150. </el-tooltip>
  151. </el-menu-item>
  152. </el-submenu>
  153. <el-menu-item v-if="item.leaf && item.children.length > 0" :index="item.children[0].path" :data-v-step="item.children[0].path">
  154. <i :class="item.iconCls"></i>
  155. <!-- {{item.children[0].name}} -->
  156. <span class="bosx" v-if="item.name.length < 16">{{item.name}}</span>
  157. <el-tooltip class="itemName bosx" v-if="item.name.length > 16" effect="dark" :content="item.name" placement="top">
  158. <span>{{item.name}}</span>
  159. </el-tooltip>
  160. </el-menu-item>
  161. </div>
  162. </template>
  163. </el-menu>
  164. <!--导航菜单-折叠后-->
  165. <ul class="el-menu el-menu-vertical-demo collapsed" v-if="collapsed" ref="menuCollapsed">
  166. <li v-for="(item,index) in $router.options.routes" v-if="!item.hidden" class="el-submenu item" :style="{overflow:!item.leaf?'':'hidden'}">
  167. <div v-if="item.name == '产品管理'">
  168. <template>
  169. <div class="el-submenu__title" style="padding-left: 20px;" @mouseover="showMenu(index,true)" @mouseout="showMenu(index,false)">
  170. <i :class="item.iconCls"></i>
  171. </div>
  172. <ul class="el-menu submenu" :class="'submenu-hook-'+index" @mouseover="showMenu(index,true)" @mouseout="showMenu(index,false)">
  173. <li v-for="child in user.prodSubMenuList" :key="child.path" class="el-menu-item" style="padding-left: 40px;" :class="$route.path==child.path?'is-active':''" @click="$router.push(child.path)">
  174. {{child.name}}
  175. </li>
  176. </ul>
  177. </template>
  178. </div>
  179. <div v-else>
  180. <template v-if="!item.leaf">
  181. <div class="el-submenu__title" style="padding-left: 20px;" @mouseover="showMenu(index,true)" @mouseout="showMenu(index,false)">
  182. <i :class="item.iconCls"></i>
  183. </div>
  184. <ul class="el-menu submenu" :class="'submenu-hook-'+index" @mouseover="showMenu(index,true)" @mouseout="showMenu(index,false)">
  185. <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)">
  186. {{child.name}}
  187. </li>
  188. </ul>
  189. </template>
  190. <template v-else>
  191. <li class="el-submenu">
  192. <div class="el-submenu__title el-menu-item" :class="$route.path==item.children[0].path?'is-active':''" @click="$router.push(item.children[0].path)"
  193. style="padding-left: 20px;height: 56px;line-height: 56px;padding: 0 20px;">
  194. <i :class="item.iconCls"></i>
  195. </div>
  196. </li>
  197. </template>
  198. </div>
  199. <!-- <template v-if="!item.leaf">
  200. <div class="el-submenu__title" style="padding-left: 20px;" @mouseover="showMenu(index,true)" @mouseout="showMenu(index,false)">
  201. <i :class="item.iconCls"></i>
  202. </div>
  203. <ul class="el-menu submenu" :class="'submenu-hook-'+index" @mouseover="showMenu(index,true)" @mouseout="showMenu(index,false)">
  204. <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)">
  205. {{child.name}}
  206. </li>
  207. </ul>
  208. </template>
  209. <template v-else>
  210. <li class="el-submenu">
  211. <div class="el-submenu__title el-menu-item" :class="$route.path==item.children[0].path?'is-active':''" @click="$router.push(item.children[0].path)"
  212. style="padding-left: 20px;height: 56px;line-height: 56px;padding: 0 20px;">
  213. <i :class="item.iconCls"></i>
  214. </div>
  215. </li>
  216. </template> -->
  217. </li>
  218. </ul>
  219. </el-scrollbar>
  220. </aside>
  221. <section class="content-container">
  222. <div class="contentMask" v-if="vTourFlg"></div>
  223. <div class="grid-content bg-purple-light" style="display: flex;height: 100%;">
  224. <el-col :span="24" class="content-wrapper" style="flex: 1;">
  225. <transition name="fade" mode="out-in">
  226. <router-view></router-view>
  227. </transition>
  228. </el-col>
  229. </div>
  230. <!--修改密码-->
  231. <el-dialog :title="$t('other.changeThePassword')" width='450px' v-if="editPassWord" :visible.sync="editPassWord" :close-on-click-modal="false" customClass="customWidth">
  232. <el-form :model="addForm" label-width="auto" :rules="passRule" ref="addForm">
  233. <el-form-item :label="$t('lable.originalPassword')" prop="originPassword">
  234. <el-input v-model="addForm.originPassword" autocomplete="off" :placeholder="$t('defaultText.pleaseEnterTheOldPassword')" show-password></el-input>
  235. </el-form-item>
  236. <el-form-item :label="$t('lable.newPassword')" prop="newPassword">
  237. <el-input v-model="addForm.newPassword" autocomplete="off" :placeholder="$t('defaultText.pleaseEnterTheNewPassword')" show-password></el-input>
  238. </el-form-item>
  239. </el-form>
  240. <div slot="footer" class="dialog-footer">
  241. <el-button @click.native="editPassWord = false">{{$t('btn.cancel')}}</el-button>
  242. <el-button type="primary" @click.native="resetPwd" :loading="editLoading">{{$t('btn.submit')}}</el-button>
  243. </div>
  244. </el-dialog>
  245. <!--修改信息-->
  246. <el-dialog :title="$t('title.modifyTheInformation')" width='450px' v-if="editInformation" :visible.sync="editInformation" :close-on-click-modal="false" customClass="customWidth">
  247. <el-form :model="editInfoForm" label-width="auto" :rules="passRule" ref="editInfoForm">
  248. <el-form-item :label="$t('lable.name')" prop="username">
  249. <el-input v-model="editInfoForm.username" autocomplete="off" :placeholder="$t('defaultText.PleaseEnterYourName')"></el-input>
  250. </el-form-item>
  251. </el-form>
  252. <el-form :model="editInfoForm" label-width="auto" :rules="passRule" ref="editInfoForm">
  253. <el-form-item :label="$t('lable.phone')" prop="mobile">
  254. <el-input v-model="editInfoForm.mobile" autocomplete="off" :placeholder="$t('defaultText.PleaseEnterYourPhone')" :disabled="true"></el-input>
  255. </el-form-item>
  256. </el-form>
  257. <div slot="footer" class="dialog-footer">
  258. <el-button @click.native="editInformation = false">{{$t('btn.cancel')}}</el-button>
  259. <el-button type="primary" @click.native="editInfo" :loading="editLoading2">{{$t('btn.submit')}}</el-button>
  260. </div>
  261. </el-dialog>
  262. <el-dialog
  263. title="修改公司名称"
  264. :visible.sync="editCompanyNamedialog"
  265. width="30%">
  266. <el-form :model="companyForm" :rules="rules" ref="companyForm" label-width="100px" class="demo-ruleForm">
  267. <el-form-item label="公司名称" prop="name">
  268. <el-input v-model.trim="companyForm.name"></el-input>
  269. </el-form-item>
  270. </el-form>
  271. <span slot="footer" class="dialog-footer">
  272. <el-button @click="editCompanyNamedialog = false">取 消</el-button>
  273. <el-button type="primary" @click="editCompanyName('companyForm')">确 定</el-button>
  274. </span>
  275. </el-dialog>
  276. </section>
  277. </el-col>
  278. </el-row>
  279. </template>
  280. <script>
  281. import util from "../common/js/util";
  282. export default {
  283. // 引用 app.vue reloads 方法
  284. inject:['reloads'],
  285. data() {
  286. return {
  287. appLogo: '../assets/image/head_logo.png',
  288. appName: localStorage.appName,
  289. companyForm:{
  290. name: '',
  291. },
  292. rules: {
  293. name: [
  294. { required: true, message: '请输入公司名称', trigger: 'blur' },
  295. { min: 1, max: 20, message: '长度为1-20个字符', trigger: 'blur' }
  296. ]
  297. },
  298. tourFlg: false,
  299. editCompanyNamedialog:false,
  300. firstTourFalse: localStorage.getItem('firstTourFalse') | true, // 是否需要新手指导
  301. steps: [
  302. {
  303. target: '[data-v-step="/timetype"]',
  304. content: `第一步,查看基础设置,按照企业情况进行调整`,
  305. params: {
  306. placement: 'right',
  307. highlight: true
  308. }
  309. },{
  310. target: '[data-v-step="/list"]',
  311. content: `第二步,创建项目和任务`,
  312. params: {
  313. placement: 'right',
  314. highlight: true
  315. }
  316. },{
  317. target: '[data-v-step="/report"]',
  318. content: `第三步,填写每日工时报告`,
  319. params: {
  320. placement: 'right',
  321. highlight: true
  322. }
  323. },{
  324. target: '[data-v-step="/review"]',
  325. content: `第四步,项目报告审核`,
  326. params: {
  327. placement: 'right',
  328. highlight: true
  329. }
  330. },{
  331. target: '[data-v-step="/cost"]',
  332. content: `第五步,查看工时成本统计结果`,
  333. params: {
  334. placement: 'right',
  335. highlight: true
  336. }
  337. },{
  338. target: '[data-v-step="/finance"]',
  339. content: `第六步,导入薪资,校准成本并生成财务报表`,
  340. params: {
  341. placement: 'right',
  342. highlight: true
  343. }
  344. }
  345. ],
  346. myOptions:{
  347. useKeyboardNavigation: false, //不使用←、→和ESC键来导航tour
  348. startTimeout: 1000, //1秒后执行
  349. highlight: true,
  350. labels: {
  351. buttonSkip: '跳过',
  352. buttonPrevious: '上一步',
  353. buttonNext: '下一步',
  354. buttonStop: '关闭'
  355. }
  356. },
  357. myCallbacks: {
  358. onSkip: this.onSkip, //在data中定义两个回调
  359. onFinish: this.onFinish
  360. },
  361. isCorpWX: false,
  362. // roleArray:["普通员工","超级管理员", "系统管理员", "公司高层","财务管理员", "项目管理员","公司领导"],
  363. 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')],
  364. helpImg: '../assets/image/userHead.png',
  365. user: sessionStorage.getItem("user"),
  366. collapsed: sessionStorage.collapsed!=null?(sessionStorage.collapsed=='true'?true:false):false,
  367. sysUserName: "",
  368. menu: [],
  369. // msgTypeTxt:["审批未通过","有新任务啦","任务有新进展","项目日报审核通过"],
  370. msgTypeTxt:[this.$t('state.notApproved'),this.$t('state.ThereIsAnewTask'),this.$t('state.TheresBeen'),this.$t('state.approvedProject')],
  371. editInformation: false,
  372. editPassWord: false,
  373. editLoading: false,
  374. editLoading2: false,
  375. addForm: {
  376. id: "",
  377. originPassword: "",
  378. newPassword: ""
  379. },
  380. editInfoForm: {
  381. id: "",
  382. username: "",
  383. mobile: "",
  384. companyName: ""
  385. },
  386. passRule: {
  387. originPassword: [{ required: true, message: this.$t('defaultText.pleaseEnterTheOldPassword'), trigger: "blur" }],
  388. newPassword: [{ required: true, message: this.$t('defaultText.pleaseEnterTheNewPassword'), trigger: "blur" }],
  389. username: [{ required: true, message: this.$t('defaultText.PleaseEnterYourName'), trigger: "blur" }]
  390. },
  391. //时间
  392. activeDate: new Date(),
  393. timer: null,
  394. remainingTime: '',
  395. drawer: false,
  396. tableHeight: 0,
  397. popoverData: [],
  398. num: 0,
  399. language: '',
  400. setTimeLoad: null,
  401. // 遮罩
  402. vTourFlg: false
  403. };
  404. },
  405. created() {
  406. this.firstTourFalse = localStorage.getItem('firstTourFalse') || true
  407. console.log(this.firstTourFalse, '数据书数据')
  408. console.log(localStorage.getItem('firstTourFalse'))
  409. if (localStorage.appLogo) {
  410. this.appLogo = '/upload/'+localStorage.appLogo;
  411. }
  412. },
  413. methods: {
  414. getSkipGuidance() {
  415. this.http.post('/user/skipGuidance', {},
  416. res => {
  417. if (res.code == "ok") {
  418. let users = JSON.parse(sessionStorage.getItem("user"))
  419. users.isFirstLogin == 0
  420. sessionStorage.setItem("user", JSON.stringify(users))
  421. }
  422. },
  423. error => {
  424. });
  425. },
  426. onSkip(currentStep) {
  427. console.log('看看')
  428. this.vTourFlg = false
  429. this.firstTourFalse = false
  430. localStorage.setItem('firstTourFalse', false)
  431. console.log(this.user, '用户信息')
  432. if(this.user.corpwxUserid != null) {
  433. this.getSkipGuidance()
  434. }
  435. },
  436. onFinish(currentStep) {
  437. console.log('数据')
  438. this.vTourFlg = false
  439. this.firstTourFalse = false
  440. localStorage.setItem('firstTourFalse', false)
  441. this.getSkipGuidance()
  442. if(this.user.corpwxUserid != null) {
  443. this.getSkipGuidance()
  444. }
  445. },
  446. // 中英文切换
  447. langChange(command) {
  448. let flg = this.language
  449. this.$i18n.locale = command
  450. localStorage.setItem("lang", command)
  451. if(command == 'en') {
  452. this.language = 'English'
  453. } else if (command == 'zh') {
  454. this.language = '中文'
  455. }
  456. if(flg != this.language) {
  457. this.reloads()
  458. }
  459. },
  460. //退出登录
  461. logout: function() {
  462. var _this = this;
  463. this.$confirm(this.$t('other.confirmExit') + '?', this.$t('other.prompts'), {
  464. //type: 'warning'
  465. confirmButtonText: this.$t('btn.submit'),
  466. cancelButtonText: this.$t('btn.cancel'),
  467. }).then(() => {
  468. sessionStorage.removeItem("user");
  469. location.reload();
  470. _this.$router.push("/login");
  471. });
  472. },
  473. //折叠导航栏
  474. collapse: function() {
  475. this.collapsed = !this.collapsed;
  476. sessionStorage.collapsed = this.collapsed;
  477. },
  478. showMenu(i, status) {
  479. this.$refs.menuCollapsed.getElementsByClassName(
  480. "submenu-hook-" + i
  481. )[0].style.display = status ? "block" : "none";
  482. },
  483. //打开编辑信息界面
  484. editInfoOpen() {
  485. this.editInformation = true;
  486. this.editInfoForm.id = JSON.parse(sessionStorage.getItem("user")).id;
  487. this.editInfoForm.username = JSON.parse(
  488. sessionStorage.getItem("user")
  489. ).username;
  490. this.editInfoForm.mobile = JSON.parse(
  491. sessionStorage.getItem("user")
  492. ).account;
  493. this.editInfoForm.companyName = JSON.parse(
  494. sessionStorage.getItem("user")
  495. ).companyName;
  496. },
  497. //编辑信息
  498. editInfo() {
  499. this.$refs.editInfoForm.validate(valid => {
  500. if (valid) {
  501. this.editLoading2 = true;
  502. this.http.post(
  503. this.port.pwd.resetPwd,
  504. { id: this.editInfoForm.id, username: this.editInfoForm.username },
  505. res => {
  506. this.editLoading2 = false;
  507. this.editInformation = false;
  508. if (res.code == "ok") {
  509. this.$message({
  510. message: this.$t('message.modifyTheSuccess'),
  511. type: "success"
  512. });
  513. //读取并覆盖session storage
  514. var userObject = JSON.parse(sessionStorage.getItem("user"));
  515. userObject.username = this.editInfoForm.username;
  516. sessionStorage.setItem("user", JSON.stringify(userObject));
  517. this.sysUserName = this.editInfoForm.username;
  518. } else {
  519. this.$message({
  520. message: res.msg,
  521. type: "error"
  522. });
  523. }
  524. },
  525. error => {
  526. this.editLoading2 = false;
  527. this.editInformation = false;
  528. this.$message({
  529. message: error,
  530. type: "error"
  531. });
  532. }
  533. );
  534. }
  535. });
  536. },
  537. //编辑公司名称
  538. editCompanyName(companyForm){
  539. this.$refs[companyForm].validate((valid) => {
  540. if (valid) {
  541. this.http.post("/company/editCompanyName", {name:this.companyForm.name},
  542. res => {
  543. if (res.code == "ok") {
  544. this.editCompanyNamedialog = false;
  545. let list = JSON.parse(sessionStorage.getItem("user") || '[]')
  546. sessionStorage.removeItem('user')
  547. this.user.companyName = this.companyForm.name
  548. list.companyName = this.companyForm.name
  549. sessionStorage.setItem("user",JSON.stringify(list))
  550. this.$message({
  551. message: res.msg,
  552. type: "success"
  553. });
  554. } else {
  555. this.$message({
  556. message: res.msg,
  557. type: "error"
  558. });
  559. }
  560. },
  561. error => {
  562. this.$message({
  563. message: error,
  564. type: "error"
  565. });
  566. });
  567. } else {
  568. return false;
  569. }
  570. });
  571. },
  572. reset() {
  573. this.editPassWord = true;
  574. this.addForm.id = JSON.parse(sessionStorage.getItem("user")).id;
  575. this.addForm.account = JSON.parse(sessionStorage.getItem("user")).account;
  576. },
  577. resetPwd() {
  578. this.$refs.addForm.validate(valid => {
  579. if (valid) {
  580. this.editLoading = true;
  581. this.http.post( this.port.manage.editPassword, this.addForm,
  582. res => {
  583. this.editLoading = false;
  584. this.editPassWord = false;
  585. if (res.code == "ok") {
  586. this.$message({
  587. // message: "修改成功,请重新登录",
  588. message: this.$t('message.logAganin'),
  589. type: "success"
  590. });
  591. this.$router.push("/login");
  592. } else {
  593. this.$message({
  594. message: res.msg,
  595. type: "error"
  596. });
  597. }
  598. },
  599. error => {
  600. this.editLoading = false;
  601. this.editPassWord = false;
  602. this.$message({
  603. message: error,
  604. type: "error"
  605. });
  606. });
  607. }
  608. });
  609. },
  610. setTime() {
  611. var d = util.formatDate.cdTime(new Date(new Date().getTime() + this.user.remainingTime), new Date(), 'd');
  612. var h = util.formatDate.cdTime(new Date(new Date().getTime() + this.user.remainingTime), new Date(), 'h');
  613. var m = util.formatDate.cdTime(new Date(new Date().getTime() + this.user.remainingTime), new Date(), 'm');
  614. var s = util.formatDate.cdTime(new Date(new Date().getTime() + this.user.remainingTime), new Date(), 's');
  615. this.remainingTime = d+'天'+h+'时'+m+'分'+s+'秒';
  616. },
  617. // 加载消息
  618. loadNotice() {
  619. this.http.post( this.port.manage.msgList, {},
  620. res => {
  621. if (res.code == "ok") {
  622. var list = res.data;
  623. if(this.user.userNameNeedTranslate == 1) {
  624. let msgArr = res.data
  625. for(var i in msgArr) {
  626. if(msgArr[i].msg) {
  627. let caozuo = JSON.parse(JSON.stringify(msgArr[i].msg))
  628. if(caozuo.indexOf('$userName=') != '-1') {
  629. let textOne = caozuo.split('$userName=')[0]
  630. let textTwo = caozuo.split('$userName=')[1].split('$')[0]
  631. let textThree = caozuo.split('$userName=')[1].split('$')[1]
  632. msgArr[i].omg = {
  633. textOne: textOne,
  634. textTwo: textTwo,
  635. textThree: textThree
  636. }
  637. } else {
  638. msgArr[i].omg = {
  639. textOne: msgArr[i].msg,
  640. textTwo: '',
  641. textThree: ''
  642. }
  643. }
  644. } else {
  645. msgArr[i].omg = {
  646. textOne: '',
  647. textTwo: '',
  648. textThree: ''
  649. }
  650. }
  651. }
  652. }
  653. this.popoverData = res.data;
  654. var num = 0;
  655. for(var i in list) {
  656. if(list[i].checked != 1) {
  657. num ++;
  658. }
  659. }
  660. this.num = num;
  661. } else {
  662. this.$message({
  663. message: res.msg,
  664. type: "error"
  665. });
  666. }
  667. },
  668. error => {
  669. this.$message({
  670. message: error,
  671. type: "error"
  672. });
  673. });
  674. },
  675. //点击消息的跳转
  676. locationHerf(id, date, type) {
  677. this.http.post( this.port.manage.check, { id: id },
  678. res => {
  679. if (res.code == "ok") {
  680. this.loadNotice();
  681. if (type == 0) {
  682. //审批未通过的消息, 也包括审批通过的通知
  683. sessionStorage.msg = date;
  684. sessionStorage.from = 1;
  685. //本页面再点的话强制转移一下
  686. var currentRoute = this.$route.path.split("/");
  687. if (currentRoute[1] == "daily") {
  688. this.$router.go(0);
  689. this.drawer = false;
  690. return false;
  691. }
  692. this.$router.push("/daily");
  693. this.drawer = false;
  694. } else if (type == 1) {
  695. //1- 有新任务待执行
  696. this.$router.push("/projectInside/"+date);
  697. this.drawer = false;
  698. } else if (type == 2) {
  699. //2- 任务有新进展
  700. this.$router.push("/projectInside/"+date);
  701. this.drawer = false;
  702. } else if (type == 3) {
  703. //3- 费用报销
  704. this.$router.push("/expense");
  705. this.drawer = false;
  706. } else if (type == 4) {
  707. //4- 请假消息
  708. this.$router.push("/leave");
  709. this.drawer = false;
  710. } else if (type == 5) {
  711. //5- 出差消息
  712. this.$router.push("/awayOffice");
  713. this.drawer = false;
  714. } else if (type == 6 || type == 7 || type == 8) {
  715. // 6、7 合同通过、驳回
  716. this.$router.push("/contract");
  717. this.drawer = false;
  718. }
  719. } else {
  720. this.$message({
  721. message: res.msg,
  722. type: "error"
  723. });
  724. }
  725. },
  726. error => {
  727. this.$message({
  728. message: error,
  729. type: "error"
  730. });
  731. });
  732. },
  733. // 获取企业微信的参数
  734. agentConfig() {
  735. var isCorpWX = true
  736. var ua = navigator.userAgent.toLowerCase();
  737. if (ua.indexOf("wxwork") > 0) {
  738. isCorpWX = false;
  739. }
  740. var curUrl = location.href.split("#")[0];
  741. this.http.post("/wxcorp/getCorpWXConfig", {url: curUrl, token: this.user.id}, (res) => {
  742. if (res.code == "ok") {
  743. wx.config({
  744. beta: true,
  745. debug: isCorpWX, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
  746. appId: res.data.appid, // 必填,公众号的唯一标识
  747. timestamp: res.data.timestamp, // 必填,生成签名的时间戳
  748. nonceStr: res.data.noncestr, // 必填,生成签名的随机串
  749. signature: res.data.sign, // 必填,签名,见附录1
  750. jsApiList: ['chooseImage','previewImage','uploadImage','downloadImage','previewFile','getLocation','agentConfig', 'getLocalImgData']
  751. });
  752. var that = this;
  753. wx.ready(function(){
  754. // config信息验证后会执行ready方法,所有接口调用都必须在config接口获得结果之后,config是一个客户端的异步操作,所以如果需要在页面加载时就调用相关接口,则须把相关接口放在ready函数中调用来确保正确执行。对于用户触发时才调用的接口,则可以直接调用,不需要放在ready函数中。
  755. that.http.post("/wxcorp/getCorpWXAgentConfig", {url: curUrl, token: that.user.id}, (res) => {
  756. if (res.code == "ok") {
  757. console.log()
  758. wx.agentConfig({
  759. corpid: res.data.corpid, // 必填,企业微信的corpid,必须与当前登录的企业一致
  760. agentid: res.data.agentid, // 必填,企业微信的应用id (e.g. 1000247)
  761. timestamp: res.data.timestamp, // 必填,生成签名的时间戳
  762. nonceStr: res.data.nonceStr, // 必填,生成签名的随机串
  763. signature: res.data.signature, // 必填,签名,见附录-JS-SDK使用权限签名算法
  764. jsApiList: ['selectExternalContact', 'selectEnterpriseContact', 'openAppManage'], //必填,传入需要使用的接口名称
  765. success: function (result) {
  766. console.log(result, '请求微信成功')
  767. console.log(window, 'window')
  768. // wx.agentConfig成功回调后,WWOpenData 才会注入到 window 对象上面
  769. if(window.WWOpenData) {
  770. window.WWOpenData.bind(document.querySelector('ww-open-data'))
  771. if (WWOpenData.initCanvas) {
  772. WWOpenData.initCanvas()
  773. console.log('我企业微信 canvas 应该执行了吧')
  774. }
  775. }
  776. },
  777. fail: function (res) {
  778. console.log('查看错误信息', res)
  779. if (res.errMsg.indexOf('function not exist') > -1) {
  780. alert('版本过低请升级')
  781. }
  782. },
  783. })
  784. }
  785. }, (error) => {
  786. console.log('查看错误信息' + res)
  787. if (error.errMsg.indexOf('function not exist') > -1) {
  788. alert('版本过低请升级')
  789. }
  790. })
  791. });
  792. }
  793. }, (error) => {
  794. console.log(error, '哦耶')
  795. })
  796. },
  797. },
  798. mounted() {
  799. var ua = navigator.userAgent.toLowerCase();
  800. if (ua.indexOf("wxwork") > 0) {
  801. this.isCorpWX = true;
  802. }
  803. let langse = localStorage.getItem("lang") || 'zh'
  804. if(langse == 'en') {
  805. this.language = 'English'
  806. } else if (langse == 'zh') {
  807. this.language = '中文'
  808. }
  809. let height = window.innerHeight;
  810. this.tableHeight = height - 15;
  811. const that = this;
  812. window.onresize = function temp() {
  813. that.tableHeight = window.innerHeight - 15;
  814. };
  815. if (this.user) {
  816. var user = JSON.parse(this.user);
  817. this.user = user;
  818. this.sysUserName = user.name || "";
  819. this.loadNotice();
  820. if(this.user.remainingTime != "" && this.user.remainingTime != 0) {
  821. this.remainingTime = util.formatDate.format(new Date(new Date().getTime() + this.user.remainingTime), "yyyy-MM-dd")
  822. } else {
  823. this.remainingTime = this.$t('other.expired');
  824. clearInterval(this.timer);
  825. }
  826. } else {
  827. this.$router.push("/login");
  828. }
  829. // console.log('啊,我被触发了呀')
  830. // 获取企业微信参数
  831. if(this.user.userNameNeedTranslate == '1') {
  832. this.agentConfig()
  833. }
  834. // 判断是否为新用户
  835. // console.log(this.firstTourFalse, '数据书数据123', 'true' == true)
  836. // if(this.firstTourFalse != 'false') {
  837. if(this.user.isFirstLogin == 1 && this.user.roleName == '超级管理员' && this.firstTourFalse != 'false' && this.user.createTime[0] > '2022') {
  838. var thats = this
  839. this.tourFlg = true
  840. setTimeout(() => {
  841. thats.$tours['myTour'].start()
  842. setTimeout(() => {
  843. thats.vTourFlg = true
  844. }, 1000)
  845. }, 200)
  846. }
  847. },
  848. };
  849. </script>
  850. <style scoped lang="scss">
  851. .contentMask {
  852. width: 100%;
  853. height: 100%;
  854. position: absolute;
  855. top: 0;
  856. left: 0;
  857. background: #000;
  858. opacity: .4;
  859. z-index: 99;
  860. // box-shadow: 0 0 0 99999px rgba(0,0,0,.4) !important;
  861. }
  862. .gongshimingz {
  863. width: 100%;
  864. position: absolute;
  865. left: 0px;
  866. display: inline-block;
  867. overflow: hidden;
  868. white-space: nowrap;
  869. text-overflow: ellipsis;
  870. box-sizing: border-box;
  871. padding-left: 60px;
  872. }
  873. .el-menu-vertical-demo i {
  874. margin-right: 10px;
  875. }
  876. .container {
  877. position: absolute;
  878. top: 0px;
  879. bottom: 0px;
  880. width: 100%;
  881. .header {
  882. height: 60px;
  883. line-height: 60px;
  884. background: #20a0ff;
  885. color: #fff;
  886. position: relative;
  887. .userinfo {
  888. text-align: right;
  889. padding-right: 35px;
  890. float: right;
  891. .userinfo-inner {
  892. cursor: pointer;
  893. color: #fff;
  894. img {
  895. width: 40px;
  896. height: 40px;
  897. border-radius: 20px;
  898. margin: 10px 10px 10px 10px;
  899. float: left;
  900. }
  901. }
  902. .itemNew {
  903. height: 25px;
  904. margin: 0 0 0 10px;
  905. i {
  906. vertical-align: top;
  907. }
  908. }
  909. }
  910. .logo {
  911. height: 60px;
  912. font-size: 21px;
  913. padding-left: 20px;
  914. padding-right: 20px;
  915. border-color: rgba(238, 241, 146, 0.3);
  916. border-right-width: 1px;
  917. border-right-style: solid;
  918. img {
  919. width: 40px;
  920. float: left;
  921. margin: 10px 10px 10px 18px;
  922. }
  923. img.headImg {
  924. margin: 0;
  925. width: 40px;
  926. height: 40px;
  927. margin: 10px 0 0 10px;
  928. }
  929. .logo-sys {
  930. height: 100%;
  931. line-height: 100%;
  932. img.headImg {
  933. width: 40px;
  934. height: 40px;
  935. margin: 7.5px 0 0 10px;
  936. vertical-align: middle;
  937. }
  938. span {
  939. display: inline-block;
  940. height: 100%;
  941. line-height: 60px;
  942. margin-left: 15px;
  943. font-size: 16px;
  944. // margin: 20px 0 0 15px;
  945. vertical-align: middle;
  946. }
  947. }
  948. .txt {
  949. color: #fff;
  950. }
  951. }
  952. .logo-width {
  953. width: 200px;
  954. }
  955. .logo-collapse-width {
  956. width: 60px;
  957. }
  958. .tools {
  959. padding: 0px 23px;
  960. // width: 14px;
  961. height: 60px;
  962. line-height: 60px;
  963. cursor: pointer;
  964. }
  965. }
  966. .main {
  967. display: flex;
  968. position: absolute;
  969. top: 60px;
  970. bottom: 0px;
  971. overflow: hidden;
  972. aside {
  973. flex: 0 0 230px;
  974. width: 230px;
  975. .el-menu {
  976. height: 100%;
  977. }
  978. .collapsed {
  979. width: 60px;
  980. .item {
  981. position: relative;
  982. }
  983. .submenu {
  984. position: absolute;
  985. top: 0px;
  986. left: 60px;
  987. z-index: 99999;
  988. height: auto;
  989. display: none;
  990. box-shadow: 5px 5px 10px #ddd;
  991. }
  992. }
  993. }
  994. .menu-collapsed {
  995. flex: 0 0 60px;
  996. width: 60px;
  997. }
  998. .menu-expanded {
  999. flex: 0 0 200px;
  1000. width: 200px;
  1001. }
  1002. .content-container {
  1003. flex: 1;
  1004. width: 80%;
  1005. overflow-y: auto;
  1006. overflow-x: hidden;
  1007. // position: relative;
  1008. .breadcrumb-container {
  1009. .title {
  1010. width: 200px;
  1011. float: left;
  1012. color: #475669;
  1013. }
  1014. .breadcrumb-inner {
  1015. float: right;
  1016. }
  1017. }
  1018. .content-wrapper {
  1019. background-color: #fff;
  1020. box-sizing: border-box;
  1021. // position: relative;
  1022. }
  1023. }
  1024. }
  1025. }
  1026. .popover-item {
  1027. padding: 10px;
  1028. border-bottom: 1px #eee solid;
  1029. }
  1030. .popover-item > div > p {
  1031. margin: 0;
  1032. line-height: 18px;
  1033. }
  1034. .popover-title {
  1035. color: #409eff;
  1036. padding-bottom: 8px;
  1037. }
  1038. .popover-type {
  1039. color: #aaa;
  1040. font-size: 8px;
  1041. float: right;
  1042. }
  1043. .popover-button {
  1044. font-weight: 900;
  1045. padding: 10px;
  1046. text-align: center;
  1047. cursor: pointer;
  1048. }
  1049. .isRead {
  1050. color: #999 !important;
  1051. }
  1052. .bosx {
  1053. width: 110px;
  1054. display: inline-block;
  1055. overflow: hidden;
  1056. white-space: nowrap;
  1057. text-overflow: ellipsis;
  1058. }
  1059. </style>