Home.vue 55 KB

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