Home.vue 50 KB

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