Home.vue 53 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131
  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. }
  695. } else {
  696. this.$message({
  697. message: res.msg,
  698. type: "error"
  699. });
  700. }
  701. },
  702. error => {
  703. this.$message({
  704. message: error,
  705. type: "error"
  706. });
  707. });
  708. },
  709. // 获取企业微信的参数
  710. agentConfig() {
  711. var isCorpWX = true
  712. var ua = navigator.userAgent.toLowerCase();
  713. if (ua.indexOf("wxwork") > 0) {
  714. isCorpWX = false;
  715. }
  716. var curUrl = location.href.split("#")[0];
  717. this.http.post("/wxcorp/getCorpWXConfig", {url: curUrl, token: this.user.id}, (res) => {
  718. if (res.code == "ok") {
  719. wx.config({
  720. beta: true,
  721. debug: isCorpWX, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
  722. appId: res.data.appid, // 必填,公众号的唯一标识
  723. timestamp: res.data.timestamp, // 必填,生成签名的时间戳
  724. nonceStr: res.data.noncestr, // 必填,生成签名的随机串
  725. signature: res.data.sign, // 必填,签名,见附录1
  726. jsApiList: ['chooseImage','previewImage','uploadImage','downloadImage','previewFile','getLocation','agentConfig', 'getLocalImgData']
  727. });
  728. var that = this;
  729. wx.ready(function(){
  730. // config信息验证后会执行ready方法,所有接口调用都必须在config接口获得结果之后,config是一个客户端的异步操作,所以如果需要在页面加载时就调用相关接口,则须把相关接口放在ready函数中调用来确保正确执行。对于用户触发时才调用的接口,则可以直接调用,不需要放在ready函数中。
  731. that.http.post("/wxcorp/getCorpWXAgentConfig", {url: curUrl, token: that.user.id}, (res) => {
  732. if (res.code == "ok") {
  733. console.log()
  734. wx.agentConfig({
  735. corpid: res.data.corpid, // 必填,企业微信的corpid,必须与当前登录的企业一致
  736. agentid: res.data.agentid, // 必填,企业微信的应用id (e.g. 1000247)
  737. timestamp: res.data.timestamp, // 必填,生成签名的时间戳
  738. nonceStr: res.data.nonceStr, // 必填,生成签名的随机串
  739. signature: res.data.signature, // 必填,签名,见附录-JS-SDK使用权限签名算法
  740. jsApiList: ['selectExternalContact', 'selectEnterpriseContact', 'openAppManage'], //必填,传入需要使用的接口名称
  741. success: function (result) {
  742. console.log(result, '请求微信成功')
  743. console.log(window, 'window')
  744. // wx.agentConfig成功回调后,WWOpenData 才会注入到 window 对象上面
  745. if(window.WWOpenData) {
  746. window.WWOpenData.bind(document.querySelector('ww-open-data'))
  747. if (WWOpenData.initCanvas) {
  748. WWOpenData.initCanvas()
  749. console.log('我企业微信 canvas 应该执行了吧')
  750. }
  751. }
  752. },
  753. fail: function (res) {
  754. console.log('查看错误信息', res)
  755. if (res.errMsg.indexOf('function not exist') > -1) {
  756. alert('版本过低请升级')
  757. }
  758. },
  759. })
  760. }
  761. }, (error) => {
  762. console.log('查看错误信息' + res)
  763. if (error.errMsg.indexOf('function not exist') > -1) {
  764. alert('版本过低请升级')
  765. }
  766. })
  767. });
  768. }
  769. }, (error) => {
  770. console.log(error, '哦耶')
  771. })
  772. },
  773. // 完善工号
  774. editPerfectJobNumber(perfectForm) {
  775. this.$refs[perfectForm].validate((valid) => {
  776. if (valid) {
  777. const { id } = this.user
  778. this.http.post("/user/updateUserJobNumber", {
  779. jobNumber: this.perfectForm.jobNumber,
  780. userId: id
  781. },
  782. res => {
  783. if (res.code == "ok") {
  784. this.perfectJobNumber = false
  785. let nerUser = {
  786. ...this.user,
  787. jobNumber: this.perfectForm.jobNumber
  788. }
  789. sessionStorage.setItem('user', JSON.stringify(nerUser));
  790. this.$message({
  791. message: '操作成功',
  792. type: "success"
  793. });
  794. } else {
  795. this.$message({
  796. message: res.msg,
  797. type: "error"
  798. });
  799. }
  800. },
  801. error => {
  802. this.$message({
  803. message: error,
  804. type: "error"
  805. });
  806. });
  807. } else {
  808. return false;
  809. }
  810. });
  811. }
  812. },
  813. mounted() {
  814. var ua = navigator.userAgent.toLowerCase();
  815. if (ua.indexOf("wxwork") > 0) {
  816. this.isCorpWX = true;
  817. }
  818. let langse = localStorage.getItem("lang") || 'zh'
  819. if(langse == 'en') {
  820. this.language = 'English'
  821. } else if (langse == 'zh') {
  822. this.language = '中文'
  823. }
  824. let height = window.innerHeight;
  825. this.tableHeight = height - 15;
  826. const that = this;
  827. window.onresize = function temp() {
  828. that.tableHeight = window.innerHeight - 15;
  829. };
  830. if (this.user) {
  831. var user = JSON.parse(this.user);
  832. this.user = user;
  833. this.sysUserName = user.name || "";
  834. this.loadNotice();
  835. if(this.user.remainingTime != "" && this.user.remainingTime != 0) {
  836. this.remainingTime = util.formatDate.format(new Date(new Date().getTime() + this.user.remainingTime), "yyyy-MM-dd")
  837. } else {
  838. this.remainingTime = this.$t('other.expired');
  839. clearInterval(this.timer);
  840. }
  841. } else {
  842. this.$router.push("/login");
  843. }
  844. // console.log('啊,我被触发了呀')
  845. // 获取企业微信参数
  846. if(this.user.userNameNeedTranslate == '1') {
  847. this.agentConfig()
  848. }
  849. // 判断是否为新用户
  850. // console.log(this.firstTourFalse, '数据书数据123', 'true' == true)
  851. // if(this.firstTourFalse != 'false') {
  852. if(this.user.isFirstLogin == 1 && this.user.roleName == '超级管理员' && this.firstTourFalse != 'false' && this.user.createTime[0] > '2022') {
  853. var thats = this
  854. this.tourFlg = true
  855. setTimeout(() => {
  856. thats.$tours['myTour'].start()
  857. setTimeout(() => {
  858. thats.vTourFlg = true
  859. }, 1000)
  860. }, 200)
  861. }
  862. // 检查是否有工号
  863. const { jobNumber, companyId } = this.user
  864. if(this.jobNumberCheckCompanyId.includes(companyId) && !jobNumber) {
  865. this.perfectJobNumber = true
  866. }
  867. },
  868. };
  869. </script>
  870. <style scoped lang="scss">
  871. .contentMask {
  872. width: 100%;
  873. height: 100%;
  874. position: absolute;
  875. top: 0;
  876. left: 0;
  877. background: #000;
  878. opacity: .4;
  879. z-index: 99;
  880. // box-shadow: 0 0 0 99999px rgba(0,0,0,.4) !important;
  881. }
  882. .gongshimingz {
  883. width: 100%;
  884. position: absolute;
  885. left: 0px;
  886. display: inline-block;
  887. overflow: hidden;
  888. white-space: nowrap;
  889. text-overflow: ellipsis;
  890. box-sizing: border-box;
  891. padding-left: 60px;
  892. }
  893. .el-menu-vertical-demo i {
  894. margin-right: 10px;
  895. }
  896. .container {
  897. position: absolute;
  898. top: 0px;
  899. bottom: 0px;
  900. width: 100%;
  901. .header {
  902. height: 60px;
  903. line-height: 60px;
  904. background: #20a0ff;
  905. color: #fff;
  906. position: relative;
  907. .userinfo {
  908. text-align: right;
  909. padding-right: 35px;
  910. float: right;
  911. .userinfo-inner {
  912. cursor: pointer;
  913. color: #fff;
  914. img {
  915. width: 40px;
  916. height: 40px;
  917. border-radius: 20px;
  918. margin: 10px 10px 10px 10px;
  919. float: left;
  920. }
  921. }
  922. .itemNew {
  923. height: 25px;
  924. margin: 0 0 0 10px;
  925. i {
  926. vertical-align: top;
  927. }
  928. }
  929. }
  930. .logo {
  931. height: 60px;
  932. font-size: 21px;
  933. padding-left: 20px;
  934. padding-right: 20px;
  935. border-color: rgba(238, 241, 146, 0.3);
  936. border-right-width: 1px;
  937. border-right-style: solid;
  938. img {
  939. width: 40px;
  940. float: left;
  941. margin: 10px 10px 10px 18px;
  942. }
  943. img.headImg {
  944. margin: 0;
  945. width: 40px;
  946. height: 40px;
  947. margin: 10px 0 0 10px;
  948. }
  949. .logo-sys {
  950. height: 100%;
  951. line-height: 100%;
  952. img.headImg {
  953. width: 40px;
  954. height: 40px;
  955. margin: 7.5px 0 0 10px;
  956. vertical-align: middle;
  957. }
  958. span {
  959. display: inline-block;
  960. height: 100%;
  961. line-height: 60px;
  962. margin-left: 15px;
  963. font-size: 18px;
  964. // margin: 20px 0 0 15px;
  965. vertical-align: middle;
  966. }
  967. }
  968. .txt {
  969. color: #fff;
  970. }
  971. }
  972. .logo-width {
  973. width: 200px;
  974. }
  975. .logo-collapse-width {
  976. width: 60px;
  977. }
  978. .tools {
  979. padding: 0px 23px;
  980. // width: 14px;
  981. height: 60px;
  982. line-height: 60px;
  983. cursor: pointer;
  984. }
  985. }
  986. .main {
  987. display: flex;
  988. position: absolute;
  989. top: 60px;
  990. bottom: 0px;
  991. overflow: hidden;
  992. aside {
  993. flex: 0 0 230px;
  994. width: 230px;
  995. .el-menu {
  996. height: 100%;
  997. }
  998. .collapsed {
  999. width: 60px;
  1000. .item {
  1001. position: relative;
  1002. }
  1003. .submenu {
  1004. position: absolute;
  1005. top: 0px;
  1006. left: 60px;
  1007. z-index: 99999;
  1008. height: auto;
  1009. display: none;
  1010. box-shadow: 5px 5px 10px #ddd;
  1011. }
  1012. }
  1013. }
  1014. .menu-collapsed {
  1015. flex: 0 0 60px;
  1016. width: 60px;
  1017. }
  1018. .menu-expanded {
  1019. flex: 0 0 200px;
  1020. width: 200px;
  1021. }
  1022. .content-container {
  1023. flex: 1;
  1024. width: 80%;
  1025. overflow-y: auto;
  1026. overflow-x: hidden;
  1027. // position: relative;
  1028. .breadcrumb-container {
  1029. .title {
  1030. width: 200px;
  1031. float: left;
  1032. color: #475669;
  1033. }
  1034. .breadcrumb-inner {
  1035. float: right;
  1036. }
  1037. }
  1038. .content-wrapper {
  1039. background-color: #fff;
  1040. box-sizing: border-box;
  1041. // position: relative;
  1042. }
  1043. }
  1044. }
  1045. }
  1046. .popover-item {
  1047. padding: 10px;
  1048. border-bottom: 1px #eee solid;
  1049. }
  1050. .popover-item > div > p {
  1051. margin: 0;
  1052. line-height: 18px;
  1053. }
  1054. .popover-title {
  1055. color: #409eff;
  1056. padding-bottom: 8px;
  1057. }
  1058. .popover-type {
  1059. color: #aaa;
  1060. font-size: 8px;
  1061. float: right;
  1062. }
  1063. .popover-button {
  1064. font-weight: 900;
  1065. padding: 10px;
  1066. text-align: center;
  1067. cursor: pointer;
  1068. }
  1069. .isRead {
  1070. color: #999 !important;
  1071. }
  1072. .bosx {
  1073. width: 110px;
  1074. display: inline-block;
  1075. overflow: hidden;
  1076. white-space: nowrap;
  1077. text-overflow: ellipsis;
  1078. }
  1079. </style>