Home.vue 53 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144
  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 == '超级管理员' && user.companyName != '成都明夷电子科技有限公司'" 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. <!-- 完善工号弹窗 -->
  241. <el-dialog title="完善工号" :visible.sync="perfectJobNumber" width="500px" :show-close="false">
  242. <el-form :model="perfectForm" :rules="rules" ref="perfectForm" label-width="80px" class="demo-ruleForm">
  243. <el-form-item label="工号" prop="jobNumber">
  244. <el-input v-model.trim="perfectForm.jobNumber"></el-input>
  245. </el-form-item>
  246. </el-form>
  247. <span slot="footer" class="dialog-footer">
  248. <el-button type="primary" @click="editPerfectJobNumber('perfectForm')">确 定</el-button>
  249. </span>
  250. </el-dialog>
  251. </el-row>
  252. </template>
  253. <script>
  254. import util from "../common/js/util";
  255. export default {
  256. // 引用 app.vue reloads 方法
  257. inject:['reloads'],
  258. data() {
  259. return {
  260. companyForm:{
  261. name: '',
  262. },
  263. perfectForm:{
  264. jobNumber: '',
  265. },
  266. rules: {
  267. name: [
  268. { required: true, message: '请输入公司名称', trigger: 'blur' },
  269. { min: 1, max: 20, message: '长度为1-20个字符', trigger: 'blur' }
  270. ],
  271. jobNumber: [
  272. { required: true, message: '请输入工号', trigger: 'blur' }
  273. ]
  274. },
  275. tourFlg: false,
  276. editCompanyNamedialog:false,
  277. firstTourFalse: localStorage.getItem('firstTourFalse') | true, // 是否需要新手指导
  278. steps: [
  279. {
  280. target: '[data-v-step="/timetype"]',
  281. content: `第一步,查看基础设置,按照企业情况进行调整`,
  282. params: {
  283. placement: 'right',
  284. highlight: true
  285. }
  286. },{
  287. target: '[data-v-step="/list"]',
  288. content: `第二步,创建项目和任务`,
  289. params: {
  290. placement: 'right',
  291. highlight: true
  292. }
  293. },{
  294. target: '[data-v-step="/daily"]',
  295. content: `第三步,填写每日工时报告`,
  296. params: {
  297. placement: 'right',
  298. highlight: true
  299. }
  300. },{
  301. target: '[data-v-step="/review"]',
  302. content: `第四步,项目报告审核`,
  303. params: {
  304. placement: 'right',
  305. highlight: true
  306. }
  307. },{
  308. target: '[data-v-step="/cost"]',
  309. content: `第五步,查看工时成本统计结果`,
  310. params: {
  311. placement: 'right',
  312. highlight: true
  313. }
  314. },{
  315. target: '[data-v-step="/finance"]',
  316. content: `第六步,导入薪资,校准成本并生成财务报表`,
  317. params: {
  318. placement: 'right',
  319. highlight: true
  320. }
  321. }
  322. ],
  323. myOptions:{
  324. useKeyboardNavigation: false, //不使用←、→和ESC键来导航tour
  325. startTimeout: 1000, //1秒后执行
  326. highlight: true,
  327. labels: {
  328. buttonSkip: '跳过',
  329. buttonPrevious: '上一步',
  330. buttonNext: '下一步',
  331. buttonStop: '关闭'
  332. }
  333. },
  334. myCallbacks: {
  335. onSkip: this.onSkip, //在data中定义两个回调
  336. onFinish: this.onFinish
  337. },
  338. isCorpWX: false,
  339. // roleArray:["普通员工","超级管理员", "系统管理员", "公司高层","财务管理员", "项目管理员","公司领导"],
  340. 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')],
  341. helpImg: '../assets/image/userHead.png',
  342. user: sessionStorage.getItem("user"),
  343. collapsed: sessionStorage.collapsed!=null?(sessionStorage.collapsed=='true'?true:false):false,
  344. sysUserName: "",
  345. menu: [],
  346. // msgTypeTxt:["审批未通过","有新任务啦","任务有新进展","项目日报审核通过"],
  347. msgTypeTxt:[this.$t('state.notApproved'),this.$t('state.ThereIsAnewTask'),this.$t('state.TheresBeen'),this.$t('state.approvedProject')],
  348. editInformation: false,
  349. editPassWord: false,
  350. editLoading: false,
  351. editLoading2: false,
  352. addForm: {
  353. id: "",
  354. originPassword: "",
  355. newPassword: ""
  356. },
  357. editInfoForm: {
  358. id: "",
  359. username: "",
  360. mobile: "",
  361. companyName: ""
  362. },
  363. passRule: {
  364. originPassword: [{ required: true, message: this.$t('defaultText.pleaseEnterTheOldPassword'), trigger: "blur" }],
  365. newPassword: [{ required: true, message: this.$t('defaultText.pleaseEnterTheNewPassword'), trigger: "blur" }],
  366. username: [{ required: true, message: this.$t('defaultText.PleaseEnterYourName'), trigger: "blur" }]
  367. },
  368. //时间
  369. activeDate: new Date(),
  370. timer: null,
  371. remainingTime: '',
  372. drawer: false,
  373. tableHeight: 0,
  374. popoverData: [],
  375. num: 0,
  376. language: '',
  377. setTimeLoad: null,
  378. // 遮罩
  379. vTourFlg: false,
  380. perfectJobNumber: false, // 完善工号弹窗
  381. jobNumberCheckCompanyId: [936], // 定制需求,需要完善工号的公司id
  382. };
  383. },
  384. created() {
  385. this.firstTourFalse = localStorage.getItem('firstTourFalse') || true
  386. console.log(this.firstTourFalse, '数据书数据')
  387. console.log(localStorage.getItem('firstTourFalse'))
  388. },
  389. methods: {
  390. getSkipGuidance() {
  391. this.http.post('/user/skipGuidance', {},
  392. res => {
  393. if (res.code == "ok") {
  394. let users = JSON.parse(sessionStorage.getItem("user"))
  395. users.isFirstLogin == 0
  396. sessionStorage.setItem("user", JSON.stringify(users))
  397. }
  398. },
  399. error => {
  400. });
  401. },
  402. onSkip(currentStep) {
  403. console.log('看看')
  404. this.vTourFlg = false
  405. this.firstTourFalse = false
  406. localStorage.setItem('firstTourFalse', false)
  407. console.log(this.user, '用户信息')
  408. if(this.user.corpwxUserid != null) {
  409. this.getSkipGuidance()
  410. }
  411. },
  412. onFinish(currentStep) {
  413. console.log('数据')
  414. this.vTourFlg = false
  415. this.firstTourFalse = false
  416. localStorage.setItem('firstTourFalse', false)
  417. this.getSkipGuidance()
  418. if(this.user.corpwxUserid != null) {
  419. this.getSkipGuidance()
  420. }
  421. },
  422. // 中英文切换
  423. langChange(command) {
  424. let flg = this.language
  425. this.$i18n.locale = command
  426. localStorage.setItem("lang", command)
  427. if(command == 'en') {
  428. this.language = 'English'
  429. } else if (command == 'zh') {
  430. this.language = '中文'
  431. }
  432. if(flg != this.language) {
  433. this.reloads()
  434. }
  435. },
  436. //退出登录
  437. logout: function() {
  438. var _this = this;
  439. this.$confirm(this.$t('other.confirmExit') + '?', this.$t('other.prompts'), {
  440. //type: 'warning'
  441. confirmButtonText: this.$t('btn.submit'),
  442. cancelButtonText: this.$t('btn.cancel'),
  443. }).then(() => {
  444. sessionStorage.removeItem("user");
  445. location.reload();
  446. _this.$router.push("/login");
  447. });
  448. },
  449. //折叠导航栏
  450. collapse: function() {
  451. this.collapsed = !this.collapsed;
  452. sessionStorage.collapsed = this.collapsed;
  453. },
  454. showMenu(i, status) {
  455. this.$refs.menuCollapsed.getElementsByClassName(
  456. "submenu-hook-" + i
  457. )[0].style.display = status ? "block" : "none";
  458. },
  459. //打开编辑信息界面
  460. editInfoOpen() {
  461. this.editInformation = true;
  462. this.editInfoForm.id = JSON.parse(sessionStorage.getItem("user")).id;
  463. this.editInfoForm.username = JSON.parse(
  464. sessionStorage.getItem("user")
  465. ).username;
  466. this.editInfoForm.mobile = JSON.parse(
  467. sessionStorage.getItem("user")
  468. ).account;
  469. this.editInfoForm.companyName = JSON.parse(
  470. sessionStorage.getItem("user")
  471. ).companyName;
  472. },
  473. //编辑信息
  474. editInfo() {
  475. this.$refs.editInfoForm.validate(valid => {
  476. if (valid) {
  477. this.editLoading2 = true;
  478. this.http.post(
  479. this.port.pwd.resetPwd,
  480. { id: this.editInfoForm.id, username: this.editInfoForm.username },
  481. res => {
  482. this.editLoading2 = false;
  483. this.editInformation = false;
  484. if (res.code == "ok") {
  485. this.$message({
  486. message: this.$t('message.modifyTheSuccess'),
  487. type: "success"
  488. });
  489. //读取并覆盖session storage
  490. var userObject = JSON.parse(sessionStorage.getItem("user"));
  491. userObject.username = this.editInfoForm.username;
  492. sessionStorage.setItem("user", JSON.stringify(userObject));
  493. this.sysUserName = this.editInfoForm.username;
  494. } else {
  495. this.$message({
  496. message: res.msg,
  497. type: "error"
  498. });
  499. }
  500. },
  501. error => {
  502. this.editLoading2 = false;
  503. this.editInformation = false;
  504. this.$message({
  505. message: error,
  506. type: "error"
  507. });
  508. }
  509. );
  510. }
  511. });
  512. },
  513. //编辑公司名称
  514. editCompanyName(companyForm){
  515. this.$refs[companyForm].validate((valid) => {
  516. if (valid) {
  517. this.http.post("/company/editCompanyName", {name:this.companyForm.name},
  518. res => {
  519. if (res.code == "ok") {
  520. this.editCompanyNamedialog = false;
  521. let list = JSON.parse(sessionStorage.getItem("user") || '[]')
  522. sessionStorage.removeItem('user')
  523. this.user.companyName = this.companyForm.name
  524. list.companyName = this.companyForm.name
  525. sessionStorage.setItem("user",JSON.stringify(list))
  526. this.$message({
  527. message: res.msg,
  528. type: "success"
  529. });
  530. } else {
  531. this.$message({
  532. message: res.msg,
  533. type: "error"
  534. });
  535. }
  536. },
  537. error => {
  538. this.$message({
  539. message: error,
  540. type: "error"
  541. });
  542. });
  543. } else {
  544. return false;
  545. }
  546. });
  547. },
  548. reset() {
  549. this.editPassWord = true;
  550. this.addForm.id = JSON.parse(sessionStorage.getItem("user")).id;
  551. this.addForm.account = JSON.parse(sessionStorage.getItem("user")).account;
  552. },
  553. resetPwd() {
  554. this.$refs.addForm.validate(valid => {
  555. if (valid) {
  556. this.editLoading = true;
  557. this.http.post( this.port.manage.editPassword, this.addForm,
  558. res => {
  559. this.editLoading = false;
  560. this.editPassWord = false;
  561. if (res.code == "ok") {
  562. this.$message({
  563. // message: "修改成功,请重新登录",
  564. message: this.$t('message.logAganin'),
  565. type: "success"
  566. });
  567. this.$router.push("/login");
  568. } else {
  569. this.$message({
  570. message: res.msg,
  571. type: "error"
  572. });
  573. }
  574. },
  575. error => {
  576. this.editLoading = false;
  577. this.editPassWord = false;
  578. this.$message({
  579. message: error,
  580. type: "error"
  581. });
  582. });
  583. }
  584. });
  585. },
  586. setTime() {
  587. var d = util.formatDate.cdTime(new Date(new Date().getTime() + this.user.remainingTime), new Date(), 'd');
  588. var h = util.formatDate.cdTime(new Date(new Date().getTime() + this.user.remainingTime), new Date(), 'h');
  589. var m = util.formatDate.cdTime(new Date(new Date().getTime() + this.user.remainingTime), new Date(), 'm');
  590. var s = util.formatDate.cdTime(new Date(new Date().getTime() + this.user.remainingTime), new Date(), 's');
  591. this.remainingTime = d+'天'+h+'时'+m+'分'+s+'秒';
  592. },
  593. // 加载消息
  594. loadNotice() {
  595. this.http.post( this.port.manage.msgList, {},
  596. res => {
  597. if (res.code == "ok") {
  598. var list = res.data;
  599. if(this.user.userNameNeedTranslate == 1) {
  600. let msgArr = res.data
  601. for(var i in msgArr) {
  602. if(msgArr[i].msg) {
  603. let caozuo = JSON.parse(JSON.stringify(msgArr[i].msg))
  604. if(caozuo.indexOf('$userName=') != '-1') {
  605. let textOne = caozuo.split('$userName=')[0]
  606. let textTwo = caozuo.split('$userName=')[1].split('$')[0]
  607. let textThree = caozuo.split('$userName=')[1].split('$')[1]
  608. msgArr[i].omg = {
  609. textOne: textOne,
  610. textTwo: textTwo,
  611. textThree: textThree
  612. }
  613. } else {
  614. msgArr[i].omg = {
  615. textOne: msgArr[i].msg,
  616. textTwo: '',
  617. textThree: ''
  618. }
  619. }
  620. } else {
  621. msgArr[i].omg = {
  622. textOne: '',
  623. textTwo: '',
  624. textThree: ''
  625. }
  626. }
  627. }
  628. }
  629. this.popoverData = res.data;
  630. var num = 0;
  631. for(var i in list) {
  632. if(list[i].checked != 1) {
  633. num ++;
  634. }
  635. }
  636. this.num = num;
  637. } else {
  638. this.$message({
  639. message: res.msg,
  640. type: "error"
  641. });
  642. }
  643. },
  644. error => {
  645. this.$message({
  646. message: error,
  647. type: "error"
  648. });
  649. });
  650. },
  651. //点击消息的跳转
  652. locationHerf(id, date, type) {
  653. this.http.post( this.port.manage.check, { id: id },
  654. res => {
  655. if (res.code == "ok") {
  656. this.loadNotice();
  657. if (type == 0) {
  658. //审批未通过的消息, 也包括审批通过的通知
  659. sessionStorage.msg = date;
  660. sessionStorage.from = 1;
  661. //本页面再点的话强制转移一下
  662. var currentRoute = this.$route.path.split("/");
  663. if (currentRoute[1] == "daily") {
  664. this.$router.go(0);
  665. this.drawer = false;
  666. return false;
  667. }
  668. this.$router.push("/daily");
  669. this.drawer = false;
  670. } else if (type == 1) {
  671. //1- 有新任务待执行
  672. this.$router.push("/projectInside/"+date);
  673. this.drawer = false;
  674. } else if (type == 2) {
  675. //2- 任务有新进展
  676. this.$router.push("/projectInside/"+date);
  677. this.drawer = false;
  678. } else if (type == 3) {
  679. //3- 费用报销
  680. this.$router.push("/expense");
  681. this.drawer = false;
  682. } else if (type == 4) {
  683. //4- 请假消息
  684. this.$router.push("/leave");
  685. this.drawer = false;
  686. } else if (type == 5) {
  687. //5- 出差消息
  688. this.$router.push("/awayOffice");
  689. this.drawer = false;
  690. } else if (type == 6 || type == 7 || type == 8) {
  691. // 6、7 合同通过、驳回
  692. this.$router.push("/contract");
  693. this.drawer = false;
  694. } else if (type == 10) {
  695. // 10 预估工时审核 通过 驳回
  696. var action = '';
  697. //跳转进入项目的任务看板
  698. date = decodeURIComponent(date);
  699. if (date.includes('@adjustBudget-')) {
  700. //需要打开分组预估工时设置
  701. action = date.split('@')[1];
  702. date = date.split('@')[0];
  703. }
  704. sessionStorage.action = action
  705. this.$router.push("/projectInside/"+date);
  706. this.drawer = false;
  707. }
  708. } else {
  709. this.$message({
  710. message: res.msg,
  711. type: "error"
  712. });
  713. }
  714. },
  715. error => {
  716. this.$message({
  717. message: error,
  718. type: "error"
  719. });
  720. });
  721. },
  722. // 获取企业微信的参数
  723. agentConfig() {
  724. var isCorpWX = true
  725. var ua = navigator.userAgent.toLowerCase();
  726. if (ua.indexOf("wxwork") > 0) {
  727. isCorpWX = false;
  728. }
  729. var curUrl = location.href.split("#")[0];
  730. this.http.post("/wxcorp/getCorpWXConfig", {url: curUrl, token: this.user.id}, (res) => {
  731. if (res.code == "ok") {
  732. wx.config({
  733. beta: true,
  734. debug: isCorpWX, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
  735. appId: res.data.appid, // 必填,公众号的唯一标识
  736. timestamp: res.data.timestamp, // 必填,生成签名的时间戳
  737. nonceStr: res.data.noncestr, // 必填,生成签名的随机串
  738. signature: res.data.sign, // 必填,签名,见附录1
  739. jsApiList: ['chooseImage','previewImage','uploadImage','downloadImage','previewFile','getLocation','agentConfig', 'getLocalImgData']
  740. });
  741. var that = this;
  742. wx.ready(function(){
  743. // config信息验证后会执行ready方法,所有接口调用都必须在config接口获得结果之后,config是一个客户端的异步操作,所以如果需要在页面加载时就调用相关接口,则须把相关接口放在ready函数中调用来确保正确执行。对于用户触发时才调用的接口,则可以直接调用,不需要放在ready函数中。
  744. that.http.post("/wxcorp/getCorpWXAgentConfig", {url: curUrl, token: that.user.id}, (res) => {
  745. if (res.code == "ok") {
  746. console.log()
  747. wx.agentConfig({
  748. corpid: res.data.corpid, // 必填,企业微信的corpid,必须与当前登录的企业一致
  749. agentid: res.data.agentid, // 必填,企业微信的应用id (e.g. 1000247)
  750. timestamp: res.data.timestamp, // 必填,生成签名的时间戳
  751. nonceStr: res.data.nonceStr, // 必填,生成签名的随机串
  752. signature: res.data.signature, // 必填,签名,见附录-JS-SDK使用权限签名算法
  753. jsApiList: ['selectExternalContact', 'selectEnterpriseContact', 'openAppManage'], //必填,传入需要使用的接口名称
  754. success: function (result) {
  755. console.log(result, '请求微信成功')
  756. console.log(window, 'window')
  757. // wx.agentConfig成功回调后,WWOpenData 才会注入到 window 对象上面
  758. if(window.WWOpenData) {
  759. window.WWOpenData.bind(document.querySelector('ww-open-data'))
  760. if (WWOpenData.initCanvas) {
  761. WWOpenData.initCanvas()
  762. console.log('我企业微信 canvas 应该执行了吧')
  763. }
  764. }
  765. },
  766. fail: function (res) {
  767. console.log('查看错误信息', res)
  768. if (res.errMsg.indexOf('function not exist') > -1) {
  769. alert('版本过低请升级')
  770. }
  771. },
  772. })
  773. }
  774. }, (error) => {
  775. console.log('查看错误信息' + res)
  776. if (error.errMsg.indexOf('function not exist') > -1) {
  777. alert('版本过低请升级')
  778. }
  779. })
  780. });
  781. }
  782. }, (error) => {
  783. console.log(error, '哦耶')
  784. })
  785. },
  786. // 完善工号
  787. editPerfectJobNumber(perfectForm) {
  788. this.$refs[perfectForm].validate((valid) => {
  789. if (valid) {
  790. const { id } = this.user
  791. this.http.post("/user/updateUserJobNumber", {
  792. jobNumber: this.perfectForm.jobNumber,
  793. userId: id
  794. },
  795. res => {
  796. if (res.code == "ok") {
  797. this.perfectJobNumber = false
  798. let nerUser = {
  799. ...this.user,
  800. jobNumber: this.perfectForm.jobNumber
  801. }
  802. sessionStorage.setItem('user', JSON.stringify(nerUser));
  803. this.$message({
  804. message: '操作成功',
  805. type: "success"
  806. });
  807. } else {
  808. this.$message({
  809. message: res.msg,
  810. type: "error"
  811. });
  812. }
  813. },
  814. error => {
  815. this.$message({
  816. message: error,
  817. type: "error"
  818. });
  819. });
  820. } else {
  821. return false;
  822. }
  823. });
  824. }
  825. },
  826. mounted() {
  827. var ua = navigator.userAgent.toLowerCase();
  828. if (ua.indexOf("wxwork") > 0) {
  829. this.isCorpWX = true;
  830. }
  831. let langse = localStorage.getItem("lang") || 'zh'
  832. if(langse == 'en') {
  833. this.language = 'English'
  834. } else if (langse == 'zh') {
  835. this.language = '中文'
  836. }
  837. let height = window.innerHeight;
  838. this.tableHeight = height - 15;
  839. const that = this;
  840. window.onresize = function temp() {
  841. that.tableHeight = window.innerHeight - 15;
  842. };
  843. if (this.user) {
  844. var user = JSON.parse(this.user);
  845. this.user = user;
  846. this.sysUserName = user.name || "";
  847. this.loadNotice();
  848. if(this.user.remainingTime != "" && this.user.remainingTime != 0) {
  849. this.remainingTime = util.formatDate.format(new Date(new Date().getTime() + this.user.remainingTime), "yyyy-MM-dd")
  850. } else {
  851. this.remainingTime = this.$t('other.expired');
  852. clearInterval(this.timer);
  853. }
  854. } else {
  855. this.$router.push("/login");
  856. }
  857. // console.log('啊,我被触发了呀')
  858. // 获取企业微信参数
  859. if(this.user.userNameNeedTranslate == '1') {
  860. this.agentConfig()
  861. }
  862. // 判断是否为新用户
  863. // console.log(this.firstTourFalse, '数据书数据123', 'true' == true)
  864. // if(this.firstTourFalse != 'false') {
  865. if(this.user.isFirstLogin == 1 && this.user.roleName == '超级管理员' && this.firstTourFalse != 'false' && this.user.createTime[0] > '2022') {
  866. var thats = this
  867. this.tourFlg = true
  868. setTimeout(() => {
  869. thats.$tours['myTour'].start()
  870. setTimeout(() => {
  871. thats.vTourFlg = true
  872. }, 1000)
  873. }, 200)
  874. }
  875. // 检查是否有工号
  876. const { jobNumber, companyId } = this.user
  877. if(this.jobNumberCheckCompanyId.includes(companyId) && !jobNumber) {
  878. this.perfectJobNumber = true
  879. }
  880. },
  881. };
  882. </script>
  883. <style scoped lang="scss">
  884. .contentMask {
  885. width: 100%;
  886. height: 100%;
  887. position: absolute;
  888. top: 0;
  889. left: 0;
  890. background: #000;
  891. opacity: .4;
  892. z-index: 99;
  893. // box-shadow: 0 0 0 99999px rgba(0,0,0,.4) !important;
  894. }
  895. .gongshimingz {
  896. width: 100%;
  897. position: absolute;
  898. left: 0px;
  899. display: inline-block;
  900. overflow: hidden;
  901. white-space: nowrap;
  902. text-overflow: ellipsis;
  903. box-sizing: border-box;
  904. padding-left: 60px;
  905. }
  906. .el-menu-vertical-demo i {
  907. margin-right: 10px;
  908. }
  909. .container {
  910. position: absolute;
  911. top: 0px;
  912. bottom: 0px;
  913. width: 100%;
  914. .header {
  915. height: 60px;
  916. line-height: 60px;
  917. background: #20a0ff;
  918. color: #fff;
  919. position: relative;
  920. .userinfo {
  921. text-align: right;
  922. padding-right: 35px;
  923. float: right;
  924. .userinfo-inner {
  925. cursor: pointer;
  926. color: #fff;
  927. img {
  928. width: 40px;
  929. height: 40px;
  930. border-radius: 20px;
  931. margin: 10px 10px 10px 10px;
  932. float: left;
  933. }
  934. }
  935. .itemNew {
  936. height: 25px;
  937. margin: 0 0 0 10px;
  938. i {
  939. vertical-align: top;
  940. }
  941. }
  942. }
  943. .logo {
  944. height: 60px;
  945. font-size: 21px;
  946. padding-left: 20px;
  947. padding-right: 20px;
  948. border-color: rgba(238, 241, 146, 0.3);
  949. border-right-width: 1px;
  950. border-right-style: solid;
  951. img {
  952. width: 40px;
  953. float: left;
  954. margin: 10px 10px 10px 18px;
  955. }
  956. img.headImg {
  957. margin: 0;
  958. width: 40px;
  959. height: 40px;
  960. margin: 10px 0 0 10px;
  961. }
  962. .logo-sys {
  963. height: 100%;
  964. line-height: 100%;
  965. img.headImg {
  966. width: 40px;
  967. height: 40px;
  968. margin: 7.5px 0 0 10px;
  969. vertical-align: middle;
  970. }
  971. span {
  972. display: inline-block;
  973. height: 100%;
  974. line-height: 60px;
  975. margin-left: 15px;
  976. font-size: 18px;
  977. // margin: 20px 0 0 15px;
  978. vertical-align: middle;
  979. }
  980. }
  981. .txt {
  982. color: #fff;
  983. }
  984. }
  985. .logo-width {
  986. width: 200px;
  987. }
  988. .logo-collapse-width {
  989. width: 60px;
  990. }
  991. .tools {
  992. padding: 0px 23px;
  993. // width: 14px;
  994. height: 60px;
  995. line-height: 60px;
  996. cursor: pointer;
  997. }
  998. }
  999. .main {
  1000. display: flex;
  1001. position: absolute;
  1002. top: 60px;
  1003. bottom: 0px;
  1004. overflow: hidden;
  1005. aside {
  1006. flex: 0 0 230px;
  1007. width: 230px;
  1008. .el-menu {
  1009. height: 100%;
  1010. }
  1011. .collapsed {
  1012. width: 60px;
  1013. .item {
  1014. position: relative;
  1015. }
  1016. .submenu {
  1017. position: absolute;
  1018. top: 0px;
  1019. left: 60px;
  1020. z-index: 99999;
  1021. height: auto;
  1022. display: none;
  1023. box-shadow: 5px 5px 10px #ddd;
  1024. }
  1025. }
  1026. }
  1027. .menu-collapsed {
  1028. flex: 0 0 60px;
  1029. width: 60px;
  1030. }
  1031. .menu-expanded {
  1032. flex: 0 0 200px;
  1033. width: 200px;
  1034. }
  1035. .content-container {
  1036. flex: 1;
  1037. width: 80%;
  1038. overflow-y: auto;
  1039. overflow-x: hidden;
  1040. // position: relative;
  1041. .breadcrumb-container {
  1042. .title {
  1043. width: 200px;
  1044. float: left;
  1045. color: #475669;
  1046. }
  1047. .breadcrumb-inner {
  1048. float: right;
  1049. }
  1050. }
  1051. .content-wrapper {
  1052. background-color: #fff;
  1053. box-sizing: border-box;
  1054. // position: relative;
  1055. }
  1056. }
  1057. }
  1058. }
  1059. .popover-item {
  1060. padding: 10px;
  1061. border-bottom: 1px #eee solid;
  1062. }
  1063. .popover-item > div > p {
  1064. margin: 0;
  1065. line-height: 18px;
  1066. }
  1067. .popover-title {
  1068. color: #409eff;
  1069. padding-bottom: 8px;
  1070. }
  1071. .popover-type {
  1072. color: #aaa;
  1073. font-size: 8px;
  1074. float: right;
  1075. }
  1076. .popover-button {
  1077. font-weight: 900;
  1078. padding: 10px;
  1079. text-align: center;
  1080. cursor: pointer;
  1081. }
  1082. .isRead {
  1083. color: #999 !important;
  1084. }
  1085. .bosx {
  1086. width: 110px;
  1087. display: inline-block;
  1088. overflow: hidden;
  1089. white-space: nowrap;
  1090. text-overflow: ellipsis;
  1091. }
  1092. </style>