index.vue 117 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221
  1. <template>
  2. <div class="home">
  3. <div class="grand flex">
  4. <div class="left-laowang" style="flex: 0 0 180px;overflow: hidden;">
  5. <el-col :span="24" class="left" :style="'height:'+ (tableHeight + 113) + 'px;'">
  6. <div class="department">
  7. <span><i class="iconfont firerock-iconzuzhijiegou" style="font-size:10px;" ></i>&nbsp;{{ $t('lable.department') }}</span>
  8. <div v-on:click="createDepartment(-1)">
  9. <i class="fa fa-plus-circle"></i>
  10. {{ $t('create') }}
  11. </div>
  12. </div>
  13. <el-divider style="margin: 0px 0px !important;height:0.5px;"></el-divider>
  14. <div v-if="user.companyId == '1081'">{{tixtass}}</div>
  15. <div class="tree" :style="'height:'+ (tableHeight + 83) + 'px'">
  16. <!-- <el-tree :data="data" :props="defaultProps" @node-click="handleNodeClick" accordion></el-tree> -->
  17. <!-- <el-tree :data="data" :props="defaultProps" node-key="id" :expand-on-click-node="false" accordion @node-click="handleNodeClick" :default-expanded-keys="jDarr" @node-expand="jieDian" @node-collapse="shutDown" @current-change="chufa"> -->
  18. <el-tree :data="data" :props="defaultProps" :expand-on-click-node="false" accordion @node-click="handleNodeClick" :default-expanded-keys="jDarr" @node-expand="jieDian" @node-collapse="shutDown" @current-change="chufa">
  19. <span class="custom-tree-node" style="position: relative;box-sizing: border-box;width: 10%;" slot-scope="{ node }" @mouseleave= mouseleave(data,$event) @mouseover= mouseover(data,$event)>
  20. <span style="padding-right: 50px;box-sizing: border-box;overflow:hidden;text-overflow:ellipsis;line-height: 36px; display: inline-block;">{{ node.label }}</span>
  21. <!-- <span v-if="node.label != '全部人员'" class="node none"> -->
  22. <span v-if="node.label != $t('lable.allStaff') && node.label != $t('lable.unassigned')" class="node none poAub">
  23. <el-button type="text" size="mini" @click="createDepartment(-2)" >
  24. <i class="el-icon-circle-plus-outline"></i> <!-- 新增 -->
  25. </el-button>
  26. <el-button type="text" size="mini" @click="deleteDep(null)">
  27. <i class="el-icon-delete"></i> <!-- 删除 -->
  28. </el-button>
  29. </span>
  30. </span>
  31. </el-tree>
  32. </div>
  33. </el-col>
  34. </div>
  35. <div class="line line-second" style="display:flex;justify-content: center;align-items: center;">
  36. <div style="line-height: 5px;text-align: center;color: rgb(151 151 151);">
  37. -
  38. -
  39. -
  40. </div>
  41. </div>
  42. <div style="width: 200px; flex: 1; background: green" class="box-second-father">
  43. <el-col :span="24" class="right">
  44. <!--工具条-->
  45. <el-col :span="24" class="toolbar" style="padding-bottom: 0px;">
  46. <el-form :inline="true">
  47. <!-- <div style="width: 300px;display: inline-block;">
  48. <el-input v-model="keyword" class="input-with-select" placeholder="请输入人员名字搜索" clearable="true">
  49. <el-button slot="append" @click="searchList" icon="el-icon-search"></el-button>
  50. </el-input>
  51. </div> -->
  52. <el-form-item>
  53. <div v-if="depData == null || depData.id == -1" class="nowTime" style="cursor:unset">
  54. <i class="fa fa-home"></i>{{ $t('lable.allStaff') }}
  55. </div>
  56. <div v-else-if="depData.id == 0" class="nowTime" style="cursor:unset">
  57. <i class="fa fa-home"></i>{{ $t('lable.unassigned') }}
  58. </div>
  59. <div v-else-if="depData != null && depData.id != -1 && depData.id != 0" class="nowTime" @click="createDepartment(0)">
  60. <i class="fa fa-pencil-square-o"></i>
  61. {{depData!=null?depData.label:''}}
  62. </div>
  63. </el-form-item>
  64. <el-form-item>
  65. <div style="color:#999;font-size:13px;">{{ $t('gong') }}<span :style="total>user.company.staffCountMax?'color:red;':''">{{total}}</span>{{ $t('other.people') }}
  66. <span v-if="depData == null || depData.id == -1">({{ $t('shangxian') }}{{user.company.staffCountMax}}{{$t('other.people')}})</span>
  67. </div>
  68. </el-form-item>
  69. <el-form-item style="float:right;" v-if="permissions.structureCustomConfig">
  70. <el-link type="primary" :underline="false" @click="customConfigShow">{{ $t('customConfiguration') }}</el-link>
  71. </el-form-item>
  72. <el-form-item style="float:right;" v-if="permissions.structureExport">
  73. <el-link type="primary" :underline="false" @click="showExportDialog">{{ $t('exportpersonnel') }}</el-link>
  74. </el-form-item>
  75. <el-form-item style="float:right;" v-if="user.dingdingUserid == null && permissions.structureAdd">
  76. <el-link type="primary" :underline="false" @click="openInsertDialog(null)">{{ $t('addpersonnel') }}</el-link>
  77. </el-form-item>
  78. <el-form-item style="float:right;" v-if="user.dingdingUserid == null && permissions.structureImport">
  79. <el-link type="primary" :underline="false" @click="importUserC">{{ $t('bulkimport') }}</el-link>
  80. </el-form-item>
  81. <el-form-item style="float:right;" v-if="user.corpwxUserid != null && permissions.structureImport && user.companyId==469">
  82. <el-link type="primary" :underline="false" @click="syncMembByCardTime">{{ $t('associateenterprisemicroidentity') }}</el-link>
  83. </el-form-item>
  84. <el-form-item style="float:right;" v-if="user.corpwxUserid != null && permissions.structureImport && user.companyId!=469">
  85. <el-link type="primary" :underline="false" @click="syncWithCorpWx">{{ $t('synchronizetheenterprisemicrodirectory') }}</el-link>
  86. </el-form-item>
  87. <el-form-item style="float:right;" v-if="user.dingdingUserid != null && permissions.structureImport">
  88. <el-link type="primary" :underline="false" @click="syncWithCorpDingding">{{ $t('synchronizetheaddressbook') }}</el-link>
  89. </el-form-item>
  90. <!-- <el-form-item style="float:right;" v-if="user.dingdingUserid == null && permissions.structureImport">
  91. <el-link type="primary" :underline="false" href="./upload/人员导入模板.xlsx" download="人员导入模板.xlsx">模板下载</el-link>
  92. </el-form-item> -->
  93. <!-- <el-form-item v-if="depData != null && depData.id != -1 && depData.id != 0" style="float:right;border: 0.5px solid #20a0ff;height: 27px;margin-top: 6px;">
  94. </el-form-item> -->
  95. <!-- <el-form-item style="float:right;">
  96. <el-link type="danger" v-if="depData != null && depData.id != -1 && depData.id != 0" :underline="false" @click="deleteDep(null)">删除部门</el-link>
  97. </el-form-item>
  98. <el-form-item style="float:right;">
  99. <el-link type="primary" v-if="depData != null && depData.id != -1 && depData.id != 0" :underline="false" @click="createDepartment(-2)">新增子部门</el-link>
  100. </el-form-item> -->
  101. <el-form-item style="float:right;">
  102. <span style="color: #666666">{{ $t('jiao-se') }}</span>
  103. <el-select v-model="roleId" :placeholder="$t('defaultText.pleaseChoose')" @change="getUser()" style="width: 120px" clearable size="small">
  104. <!-- <el-option
  105. v-for="item in rolesa"
  106. :key="item.value"
  107. :label="item.label"
  108. :value="item.value">
  109. </el-option> -->
  110. <el-option v-for="item in acquireRoleList" :key="item.id" :label="item.rolename" :value="item.id"></el-option>
  111. </el-select>
  112. </el-form-item>
  113. <el-form-item style="float:right;">
  114. <span style="color: #666666">{{ $t('state.states') }}</span>
  115. <el-select v-model="status" :placeholder="$t('defaultText.pleaseChoose')" @change="getUser()" style="width: 120px" size="small">
  116. <el-option
  117. v-for="item in states"
  118. :key="item.value"
  119. :label="item.label"
  120. :value="item.value">
  121. </el-option>
  122. </el-select>
  123. </el-form-item>
  124. <el-form-item style="float:right;">
  125. <div style="width: 200px;display: inline-block;margin-top: 4px">
  126. <el-input v-model="keyword" class="input-with-select" :placeholder="$t('nameoftheperson')" clearable="true" size="small">
  127. <el-button slot="append" @click="searchList" icon="el-icon-search"></el-button>
  128. </el-input>
  129. </div>
  130. </el-form-item>
  131. <el-form-item style="float:right;" v-if="depData != null && depData.id != '-1'">
  132. <el-checkbox v-model="onlyDirect" @change="getUser()">{{ $t('directstaff') }}</el-checkbox>
  133. </el-form-item>
  134. </el-form>
  135. </el-col>
  136. <!--列表-->
  137. <el-table ref="handleSelectTable" :data="list" highlight-current-row v-loading="listLoading" :height="tableHeight" style="width: 100%;" @selection-change="handleSelectionZzjg">
  138. <el-table-column type="selection" width="50"></el-table-column>
  139. <el-table-column type="index" width="50">
  140. <template slot-scope="scope" >
  141. {{scope.$index+1+(page-1)*size}}
  142. </template>
  143. </el-table-column>
  144. <el-table-column prop="name" :label="$t('lable.name')" ></el-table-column>
  145. <el-table-column prop="jobNumber" :label="$t('Worknumber')" ></el-table-column>
  146. <el-table-column prop="phone" :label="$t('shou-ji')" width="120"></el-table-column>
  147. <el-table-column prop="departmentName" :label="$t('lable.department')" width="220"></el-table-column>
  148. <el-table-column :label="$t('jiao-se')" width="100">
  149. <template slot-scope="scope">{{scope.row.roleName}}</template>
  150. </el-table-column>
  151. <el-table-column prop="monthCost" :label="$t('monthcost')" v-if="permissions.structurePersonnel">
  152. <template slot-scope="scope">{{user.timeType.isSecretSalary==0?(scope.row.monthCost==null?0:scope.row.monthCost):'*'}} {{ $t('yuan') }}</template>
  153. </el-table-column>
  154. <el-table-column prop="cost" :label="$t('hourlywage')" v-if="permissions.structurePersonnel" width="120">
  155. <template slot-scope="scope">{{user.timeType.isSecretSalary==0?(scope.row.cost==null?0:scope.row.cost):'*'}} {{ $t('yuan') }}
  156. <el-link v-if="user.timeType.isSecretSalary==0" @click.native="showSalaryList(scope.row)"><i class="iconfont firerock-iconrecord"></i></el-link>
  157. </template>
  158. </el-table-column>
  159. <el-table-column :label="$t('state.states')" width="100">
  160. <template slot-scope="scope">
  161. <span>{{scope.row.isActive==0 ? $t('ting-yong')+'(' + scope.row.inactiveDate + ')' : $t('zai-zhi')}}</span>
  162. </template>
  163. </el-table-column>
  164. <el-table-column :label="$t('creationtime')" width="150" prop="createTime">
  165. </el-table-column>
  166. <el-table-column :label="$t('operation')" width="300" fixed="right">
  167. <template slot-scope="scope">
  168. <el-button size="mini" type="default" v-if="scope.row.roleName == $t('role.superAdministrator') && user.id == scope.row.id" @click="transferRole(scope.row)">{{ $t('transfer') }}</el-button>
  169. <el-button size="mini" type="default" v-if="scope.row.roleName != $t('role.superAdministrator')" @click="resetPwd(scope.row)">{{ $t('reset') }}</el-button>
  170. <el-button size="mini" type="primary" v-if="scope.row.roleName != $t('role.superAdministrator')" @click="openInsertDialog(scope.row)">{{ $t('bian-ji') }}</el-button>
  171. <el-button size="mini" type="primary" v-if="scope.row.roleName == $t('role.superAdministrator')" @click="openInsertDialog1(scope.row)">{{ $t('bian-ji') }}</el-button>
  172. <!-- <el-button size="mini" type="danger" v-if="scope.row.roleName != $t('role.superAdministrator')" @click="deleteUser(scope.row)">删除</el-button> -->
  173. <el-button size="mini" type="default" v-if="scope.row.roleName != $t('role.superAdministrator') && scope.row.isActive==1" @click="showDeactiveDialog(scope.row)">{{ $t('ting-yong') }}</el-button>
  174. <el-button size="mini" type="success" v-if="scope.row.roleName != $t('role.superAdministrator') && scope.row.isActive==0" @click="setActive(scope.row, 1)">{{ $t('enable') }}</el-button>
  175. </template>
  176. </el-table-column>
  177. </el-table>
  178. <!--工具条-->
  179. <el-col :span="24" class="toolbar">
  180. <!-- 123 -->
  181. <el-button size="small" @click="handleSelectionZzjgbtn1">{{ $t('btn.cancel') }}</el-button>
  182. <!-- <el-cascader v-model="handleSelectionZzjgwillchange" size="small" placeholder="请选择部门" style="width: 13%;margin-left: 1%;margin-right: 1%;font-size:12px"
  183. :options="option" :props="{ checkStrictly: false,expandTrigger: 'hover' }" :show-all-levels="false" clearable></el-cascader>
  184. <el-button size="small" type="primary" @click="handleSelectionZzjgbtn2">修改</el-button> -->
  185. <el-button size="small" type="primary" @click="handleSelectionZzjgbtn3">{{ $t('modifyingDepartments') }}</el-button>
  186. <el-button size="small" type="primary" @click="handJue">{{ $t('modifyingRoles') }}</el-button>
  187. <el-pagination
  188. @size-change="handleSizeChange"
  189. @current-change="handleCurrentChange"
  190. :page-sizes="[20 , 50 , 80 , 100]"
  191. :page-size="size"
  192. :current-page="page"
  193. layout="total, sizes, prev, pager, next"
  194. :total="total"
  195. style="float:right;"
  196. ></el-pagination>
  197. </el-col>
  198. </el-col>
  199. </div>
  200. <!-- 批量修改弹出框 -->
  201. <el-dialog :title="$t('changes')" :visible.sync="handleSelectionZzjgshow" v-if="handleSelectionZzjgshow" width="30%">
  202. <el-form model="" label-width="20%">
  203. <el-form-item :label="$t('setupdepartment')">
  204. <!-- <el-cascader v-model="handleSelectionZzjgwillchange" placeholder="请选择部门" style="width: 60%;"
  205. :options="option" :props="{ checkStrictly: false,expandTrigger: 'hover' }" :show-all-levels="false" clearable></el-cascader> -->
  206. <el-cascader v-model="handleSelectionZzjgwillchange" :placeholder="$t('qing-xuan-ze-bu-men')" style="width: 100%;"
  207. :options="option" :props="{ checkStrictly: true,expandTrigger: 'hover' }" :show-all-levels="false" clearable></el-cascader>
  208. </el-form-item>
  209. </el-form>
  210. <div slot="footer" class="dialog-footer">
  211. <el-button @click="handleSelectionZzjgshow = false">{{ $t('btn.cancel') }}</el-button>
  212. <el-button type="primary" @click="handleSelectionZzjgbtn2">{{ $t('btn.determine') }}</el-button>
  213. </div>
  214. </el-dialog>
  215. <!-- 批量修改角色弹出框 -->
  216. <el-dialog :title="$t('changes')" :visible.sync="handljues" v-if="handljues" width="30%">
  217. <el-form model="" label-width="20%">
  218. <el-form-item :label="$t('settherole')">
  219. <el-select v-model="xiuRoleId" :placeholder="$t('defaultText.pleaseChoose')" style="width: 100%">
  220. <el-option v-for="(item, index) in acquireRoleLists" :key="index" :label="item.rolename" :value="item.id"></el-option>
  221. </el-select>
  222. </el-form-item>
  223. </el-form>
  224. <div slot="footer" class="dialog-footer">
  225. <el-button @click="handljues = false">{{ $t('btn.cancel') }}</el-button>
  226. <el-button type="primary" @click="handTrue">{{ $t('btn.determine') }}</el-button>
  227. </div>
  228. </el-dialog>
  229. <!-- 新增部门 -->
  230. <el-dialog :title="depTitle" :visible.sync="departmentVisible" width="500px" >
  231. <el-form ref="depForm" :model="depForm" :rules="depRules" label-width="100px">
  232. <el-form-item :label="$t('departmentname')" prop="name">
  233. <el-input v-model="depForm.name" :placeholder="$t('peaseenterthe')" clearable style="width: 100%"></el-input>
  234. </el-form-item>
  235. <!-- 主要负责人 -->
  236. <el-form-item :label="$t('Principalpersoninharge')" prop="managerId">
  237. <el-select v-model="depForm.managerId" filterable clearable :placeholder="$t('defaultText.pleaseChoose')" style="width: 100%">
  238. <el-option v-for="item in users" :key="item.id" :label="item.name" :value="item.id"></el-option>
  239. </el-select>
  240. </el-form-item>
  241. <!-- 其他负责人 -->
  242. <el-form-item :label="$t('responsiblepersons')" prop="managerId">
  243. <el-select v-model="depForm.otherManagerIds" filterable clearable multiple style="width: 100%" :placeholder="$t('defaultText.pleaseChoose')" >
  244. <el-option v-for="item in users" :key="item.id" :label="item.name" :value="item.id"></el-option>
  245. </el-select>
  246. </el-form-item>
  247. <!-- 直属领导 -->
  248. <el-form-item :label="$t('leadership')" prop="reportAuditUserid" v-if="user.timeType.needDeptAudit">
  249. <el-select v-model="depForm.reportAuditUserid" filterable clearable :placeholder="$t('defaultText.pleaseChoose')" style="width: 100%">
  250. <el-option v-for="item in users" :key="item.id" :label="item.name" :value="item.id"></el-option>
  251. </el-select>
  252. </el-form-item>
  253. </el-form>
  254. <span slot="footer" class="dialog-footer">
  255. <el-button @click="departmentVisible = false">{{ $t('btn.cancel') }}</el-button>
  256. <el-button type="primary" @click="submitDepartment" >{{ $t('btn.submit') }}</el-button>
  257. </span>
  258. </el-dialog>
  259. <!-- 新增/编辑人员的Dialog -->
  260. <el-dialog :title="title" :visible.sync="dialogVisible" width="550px" >
  261. <el-form ref="form12" :model="insertForm" :rules="rules" label-width="80px">
  262. <el-form-item :label="$t('lable.name')" prop="name">
  263. <el-input v-model="insertForm.name" :placeholder="$t('peaseenterthe')" clearable></el-input>
  264. </el-form-item>
  265. <el-form-item :label="$t('phone')" prop="phone">
  266. <el-input v-model="insertForm.phone" :placeholder="$t('peaseenterthe')" clearable></el-input>
  267. </el-form-item>
  268. <el-form-item :label="$t('Worknumber')" prop="jobNumber">
  269. <el-input v-model="insertForm.jobNumber" :placeholder="$t('peaseenterthe')" clearable></el-input>
  270. </el-form-item>
  271. <el-form-item :label="$t('payway')" prop="salaryType" v-if="permissions.structurePersonnel&&user.timeType.isSecretSalary==0">
  272. <el-radio-group v-model="insertForm.salaryType" @change="onSalaryTypeChange">
  273. <el-radio :label="0" >{{ $t('fixedmonthlycost') }}</el-radio>
  274. <el-radio :label="1">{{ $t('hourlywages') }}</el-radio>
  275. </el-radio-group>
  276. </el-form-item>
  277. <el-form-item :label="$t('monthcost')" prop="monthCost" v-if="insertForm.salaryType == 0 && permissions.structurePersonnel&&user.timeType.isSecretSalary==0">
  278. <el-input v-model="insertForm.monthCost" id="mc" @input="oninput" :placeholder="$t('yuechengben')" clearable @keyup.native="restrictNumber('mc')"></el-input>
  279. <span style="color:orange;font-size:12px;">{{ $t('yuegongzuoo') }}{{timeType.monthDays}}{{ $t('time.day') }},{{$t('meitian')}}{{timeType.allday}}{{ $t('xiaoshi') }}</span>
  280. <el-link :underline="false" style="color:blue;font-size:12px;margin-left:7px;" href="#/timetype">{{ $t('modifyworkinghours') }}</el-link>
  281. </el-form-item>
  282. <el-form-item :label="$t('hourlywage')" prop="cost" v-if="permissions.structurePersonnel&&user.timeType.isSecretSalary==0">
  283. <el-input v-model="insertForm.cost" :disabled="insertForm.salaryType == 0" id="cc" style="width:120px;" @keyup.native="restrictNumber4('cc')"
  284. :placeholder="$t('yuechengbenxiaoshi')" clearable></el-input>
  285. <span style="margin-left:25px;">{{ $t('effectivedate') }}</span>
  286. <el-date-picker v-model="insertForm.costApplyDate" value-format="yyyy-MM-dd"></el-date-picker>
  287. </el-form-item>
  288. <el-form-item :label="$t('lable.department')" prop="departmentId">
  289. <!-- <el-cascader v-model="insertForm.departmentId" placeholder="请选择部门" style="width: 100%"
  290. :options="option" :props="{ checkStrictly: false,expandTrigger: 'hover' }" :show-all-levels="false" clearable></el-cascader> -->
  291. <el-cascader v-model="insertForm.departmentId" :placeholder="$t('qing-xuan-ze-bu-men')" style="width: 100%"
  292. :options="option" :props="{ checkStrictly: true,expandTrigger: 'hover' }" :show-all-levels="false" clearable></el-cascader>
  293. </el-form-item>
  294. <el-form-item :label="$t('immediatesuperior')">
  295. <el-select v-model="insertForm.superiorId" :placeholder="$t('defaultText.pleaseChoose')" style="width: 100%" filterable clearable>
  296. <el-option v-for="item in users" :label="item.name" :value="item.id" :key="item.id" :disabled="item.id == insertForm.id">
  297. <span style="float: left">{{item.name}}</span>
  298. <span style="float: right; color: #8492a6; font-size: 13px">{{item.departmentName}}</span>
  299. </el-option>
  300. </el-select>
  301. </el-form-item>
  302. <el-form-item :label="$t('jiao-se')" prop="roleId">
  303. <el-select v-model="insertForm.roleId" :placeholder="$t('defaultText.pleaseChoose')" style="width: 100%">
  304. <el-option v-for="item in acquireRoleList" :label="item.rolename" :value="item.id" :key="item.name">
  305. <span style="float: left">{{item.rolename}}</span>
  306. <span style="float: right; color: #8492a6; font-size: 13px">{{item.roleDescribe}}</span>
  307. </el-option>
  308. </el-select>
  309. </el-form-item>
  310. <el-form-item :label="item.name" v-for="item,index in userCustomConfig" :key="item.id">
  311. <el-select v-if="item.type == 0" v-model="insertForm[suoying[index]]" :placeholder="$t('defaultText.pleaseChoose')" clearable style="width: 100%">
  312. <el-option v-for="option in item.itemList" :label="option.name" :value="option.name" :key="option.id">
  313. </el-option>
  314. </el-select>
  315. <el-input v-else v-model="insertForm[suoying[index]]" :placeholder="$t('peaseenterthe')" clearable></el-input>
  316. </el-form-item>
  317. <el-form-item :label="$t('entrytime')" prop="phone">
  318. <el-date-picker v-model="insertForm.inductionDate" value-format="yyyy-MM-dd"></el-date-picker>
  319. </el-form-item>
  320. <el-form-item :label="$t('postrank')" prop="phone">
  321. <el-input v-model="insertForm.position" :placeholder="$t('joblevel')" clearable></el-input>
  322. </el-form-item>
  323. <div class="zhaunye"><p>{{ $t('professionalcertificate') }}</p><p><el-link type="primary" @click="addCertificateList()">{{ $t('addprofessionalcertificate') }}</el-link><el-link v-if="permissions.structureCertificate" type="primary" @click="managementDiolog = true" style="margin-left: 20px">{{ $t('professionalCertificate inManagement') }}</el-link></p></div>
  324. <div class="certificateList">
  325. <div class="moreList">
  326. <div class="moreLiList" v-for="(item,index) in insertForm.certJson" :key="index">
  327. <div style="margin-right: 10px;width: 160px;">
  328. <el-select v-model="item.certId" :placeholder="$t('defaultText.pleaseChoose')" size="mini" @change="changeManagement(index)">
  329. <el-option v-for="item in managementTableData" :key="item.id" :label="item.name" :value="item.id"> </el-option>
  330. </el-select>
  331. </div>
  332. <div><span>{{ $t('certificate') }}</span><el-date-picker size="mini" v-model="item.certDate" type="date" value-format="yyyy-MM-dd" :placeholder="$t('certificatedate')" style="width: 180px"></el-date-picker></div>
  333. <div style="color: red;margin-left: 15px;cursor:pointer;" @click="deteFrames(index)"><i class="el-icon-delete"></i></div>
  334. </div>
  335. </div>
  336. </div>
  337. </el-form>
  338. <span slot="footer" class="dialog-footer">
  339. <el-button type="danger" @click="deleteUser(insertForm)" style="float:left;">{{ $t('btn.delete') }}</el-button>
  340. <el-button @click="dialogVisible=false">{{ $t('btn.cancel') }}</el-button>
  341. <el-button type="primary" @click="submitInsert('insertForm')" :loading="submitLoading">{{ $t('btn.submit') }}</el-button>
  342. </span>
  343. </el-dialog>
  344. <!-- 编辑超级管理员的Dialog -->
  345. <el-dialog :title="$t('editorialstaff')" :visible.sync="dialogVisible1" width="550px" >
  346. <el-form ref="form1" :model="insertForm" :rules="rules" label-width="80px">
  347. <el-form-item :label="$t('lable.name')" prop="name">
  348. <el-input v-model="insertForm.name" :placeholder="$t('peaseenterthe')" clearable></el-input>
  349. </el-form-item>
  350. <el-form-item :label="$t('phone')" prop="phone">
  351. <el-input v-model="insertForm.phone" :placeholder="$t('peaseenterthe')" clearable></el-input>
  352. </el-form-item>
  353. <el-form-item :label="$t('Worknumber')" prop="jobNumber">
  354. <el-input v-model="insertForm.jobNumber" :placeholder="$t('peaseenterthe')" clearable></el-input>
  355. </el-form-item>
  356. <el-form-item :label="$t('payway')" prop="salaryType" v-if="permissions.structurePersonnel">
  357. <el-radio-group v-model="insertForm.salaryType" @change="onSalaryTypeChange">
  358. <el-radio :label="0" >{{ $t('fixedmonthlycost') }}</el-radio>
  359. <el-radio :label="1">{{ $t('hourlywages') }}</el-radio>
  360. </el-radio-group>
  361. </el-form-item>
  362. <el-form-item :label="$t('monthcost')" prop="monthCost" v-if="insertForm.salaryType == 0 && permissions.structurePersonnel" >
  363. <el-input v-model="insertForm.monthCost" id="monthCost" @input="oninput" @keyup.native="restrictNumber('monthCost')" :placeholder="$t('yuechengben')" clearable></el-input>
  364. <span style="color:orange;font-size:12px;">{{ $t('yuegongzuoo') }}{{timeType.monthDays}}{{ $t('time.day') }},{{$t('meitian')}}{{timeType.allday}}{{ $t('xiaoshi') }}</span>
  365. <el-link :underline="false" style="color:blue;font-size:12px;margin-left:7px;" href="#/timetype">{{ $t('modifyworkinghours') }}</el-link>
  366. </el-form-item>
  367. <el-form-item :label="$t('hourlywage')" prop="cost" v-if="permissions.structurePersonnel">
  368. <el-input v-model="insertForm.cost" id="cost" :disabled="insertForm.salaryType == 0" @keyup.native="restrictNumber4('cost')" style="width:120px;"
  369. :placeholder="$t('yuechengbenxiaoshi')" clearable></el-input>
  370. <span style="margin-left:25px;">{{ $t('effectivedate') }}</span>
  371. <el-date-picker v-model="insertForm.costApplyDate" value-format="yyyy-MM-dd"></el-date-picker>
  372. </el-form-item>
  373. <el-form-item :label="$t('lable.department')" prop="departmentId">
  374. <el-cascader v-model="insertForm.departmentId"
  375. :placeholder="$t('qing-xuan-ze-bu-men')"
  376. style="width: 100%"
  377. :options="option"
  378. :props="{ checkStrictly: true,expandTrigger: 'hover' }" :show-all-levels="false"
  379. clearable></el-cascader>
  380. </el-form-item>
  381. <el-form-item :label="$t('immediatesuperior')">
  382. <el-select v-model="insertForm.superiorId" :placeholder="$t('defaultText.pleaseChoose')" style="width: 100%" filterable clearable>
  383. <el-option v-for="item in users" :label="item.name" :value="item.id" :key="item.id" :disabled="item.id == insertForm.id">
  384. <span style="float: left">{{item.name}}</span>
  385. <span style="float: right; color: #8492a6; font-size: 13px">{{item.departmentName}}</span>
  386. </el-option>
  387. </el-select>
  388. </el-form-item>
  389. </el-form>
  390. <span slot="footer" class="dialog-footer">
  391. <el-button @click="dialogVisible1=false">{{ $t('btn.cancel') }}</el-button>
  392. <el-button type="primary" @click="submitInsert1" :loading="submitLoading">{{ $t('btn.submit') }}</el-button>
  393. </span>
  394. </el-dialog>
  395. <el-dialog :title="$t('historicalpersonnelcost')" :visible.sync="userSalaryListDialog" width="550px" >
  396. <el-table :data="userSalaryList" highlight-current-row v-loading="listLoading" height="300px" style="width: 100%;">
  397. <el-table-column prop="userName" :label="$t('lable.name')" ></el-table-column>
  398. <el-table-column prop="indate" :label="$t('updatetime')" width="150px">
  399. </el-table-column>
  400. <el-table-column prop="salaryType" :label="$t('payway')" >
  401. <template slot-scope="scope" >
  402. {{scope.row.salaryType==0?$t('monthlysalary'):$t('hourlywages')}}
  403. </template>
  404. </el-table-column>
  405. <el-table-column prop="monthCost" :label="$t('monthlysalarys')" >
  406. <template slot-scope="scope" >
  407. {{scope.row.monthCost}} {{ $t('yuan') }}
  408. </template>
  409. </el-table-column>
  410. <el-table-column prop="cost" :label="$t('hourlywage')" >
  411. <template slot-scope="scope" >
  412. {{scope.row.cost}} {{ $t('yuan') }}
  413. </template>
  414. </el-table-column>
  415. </el-table>
  416. </el-dialog>
  417. <!--导出人员 -->
  418. <el-dialog :title="$t('exportingpeople')" :visible.sync="exportDialogVisible" width="550px" >
  419. <el-form label-width="100px">
  420. <el-form-item :label="$t('export.export')" >
  421. <el-radio-group v-model="containInvalid" >
  422. <el-radio :label="1" >{{ $t('lable.allStaff') }}</el-radio>
  423. <el-radio :label="0" >{{ $t('serviceonly') }}</el-radio>
  424. </el-radio-group>
  425. </el-form-item>
  426. </el-form>
  427. <span slot="footer" class="dialog-footer">
  428. <el-button type="primary" @click="exportUsers">{{ $t('export.export') }}</el-button>
  429. </span>
  430. </el-dialog>
  431. <!-- 转让超级管理员权限 -->
  432. <el-dialog :title="$t('permissiontotransfer')" :visible.sync="transferDialog" width="550px" >
  433. <el-form label-width="200px">
  434. <el-form-item :label="$t('administratorroleto')" >
  435. <el-select v-model="toUserId" style="width:300px" filterable clearable>
  436. <el-option v-for="item in allActiveUsers" :key="item.id" :value="item.id" :label="item.name">
  437. </el-option>
  438. </el-select>
  439. </el-form-item>
  440. <el-form-item :label="$t('transferoftheirrole')" >
  441. <el-select v-model="myRoleId" style="width:300px">
  442. <el-option v-for="item in acquireRoleList" :label="item.rolename" :value="item.id" :key="item.name">
  443. <span style="float: left">{{item.rolename}}</span>
  444. <span style="float: right; color: #8492a6; font-size: 13px">{{item.roleDescribe}}</span>
  445. </el-option>
  446. </el-select>
  447. </el-form-item>
  448. </el-form>
  449. <span slot="footer" class="dialog-footer">
  450. <el-button type="default" @click="transferDialog = false">{{ $t('btn.cancel') }}</el-button>
  451. <el-button type="primary" @click="showConfirmDialog">{{ $t('btn.determine') }}</el-button>
  452. </span>
  453. </el-dialog>
  454. <!--停用时选择日期 -->
  455. <el-dialog :title="$t('terminationstaff')" :visible.sync="deactiveDialog" width="550px" >
  456. <el-form label-width="200px">
  457. <el-form-item :label="$t('employeedeparture')" >
  458. <el-date-picker type="date" v-model="deactiveDate" value-format="yyyy-MM-dd" format="yyyy-MM-dd" :placeholder="$t('defaultText.pleaseChoose')" />
  459. </el-form-item>
  460. </el-form>
  461. <span slot="footer" class="dialog-footer">
  462. <el-button type="default" @click="deactiveDialog = false">{{ $t('btn.cancel') }}</el-button>
  463. <el-button type="primary" @click="confirmDeactive">{{ $t('btn.determine') }}</el-button>
  464. </span>
  465. </el-dialog>
  466. <!-- 管理专业证书 -->
  467. <el-dialog :title="$t('professionalCertificate inManagement')" :visible.sync="managementDiolog" width="500px" :before-close="handleClose">
  468. <div>
  469. <el-table :data="managementTableData" style="width: 100%" height="400">
  470. <el-table-column prop="name" :label="$t('names')" width="280"></el-table-column>
  471. <el-table-column :label="$t('operation')" width="180">
  472. <template slot-scope="scope">
  473. <div>
  474. <el-button type="primary" size="small" @click="editorManagementForm(scope.row)">{{ $t('bian-ji') }}</el-button>
  475. <el-button type="danger" size="small" @click="deteManagementForm(scope.row)">{{ $t('btn.delete') }}</el-button>
  476. </div>
  477. </template>
  478. </el-table-column>
  479. </el-table>
  480. </div>
  481. <span slot="footer" class="dialog-footer">
  482. <el-button @click="managementDiolog = false">{{ $t('Shutdown') }}</el-button>
  483. <el-button type="primary" @click="addManagementDiologs()">{{ $t('add') }}</el-button>
  484. </span>
  485. </el-dialog>
  486. <!-- 新增项目管理专业 -->
  487. <el-dialog :title="$t('addededitedmanagement')" :visible.sync="addManagementDiolog" width="500px" :before-close="handleClose">
  488. <div>
  489. <el-form :model="managementForm" :rules="managementFormRou" ref="managementForm" label-width="150px" class="demo-ruleForm">
  490. <el-form-item :label="$t('professionalCertificateName')" prop="name">
  491. <el-input v-model="managementForm.name" :placeholder="$t('peaseenterthe')"></el-input>
  492. </el-form-item>
  493. </el-form>
  494. </div>
  495. <span slot="footer" class="dialog-footer">
  496. <el-button @click="addManagementDiolog = false">{{ $t('btn.cancel') }}</el-button>
  497. <el-button type="primary" @click="addManagementForm('managementForm')">{{ $t('btn.submit') }}</el-button>
  498. </span>
  499. </el-dialog>
  500. <!-- 自定义配置项 -->
  501. <el-dialog :title="$t('managecustomconfigurationitems')" show-header="false" v-if="customConfigDialog" :visible.sync="customConfigDialog" :close-on-click-modal="false" customClass="customWidth" width="650px" top="20px">
  502. <div style="margin-left:30px;">
  503. <p v-for="item,index in customConfigList" :key="index">
  504. <el-input size="medium" v-model="item.name" :placeholder="$t('enteranameforacustomconfigurationitem')" style="width:200px;margin-right:20px" maxlength="8"></el-input>
  505. <el-radio size="medium" :disabled="!item.name" v-model="item.type" :label="0" style="margin-right:10px;margin-left:10px">{{ $t('dropdown') }}</el-radio>
  506. <el-radio size="medium" :disabled="!item.name" v-model="item.type" :label="1">{{ $t('input') }}</el-radio>
  507. <span style="display:inline-block;">
  508. <el-button v-if="cusItemTypes[index] == 0" type="primary" size="small" @click="getConfigItemBtn(item)">{{ $t('configurationoptions') }}</el-button>
  509. <span v-if="!item.id && item.name && item.type == 0" style="color:#999;font-size:13px">{{ $t('canconfiguretheoptions') }}</span>
  510. </span>
  511. <el-button style="margin-left:20px" type="danger" size="small" v-if="item.id" @click="customConfigDelete(item,index)">{{ $t('btn.delete') }}</el-button>
  512. </p>
  513. </div>
  514. <div slot="footer" class="dialog-footer">
  515. <el-button type="primary" @click="customConfigDialog = false" >{{ $t('Shutdown') }}</el-button>
  516. <!-- <el-button type="primary" @click="customConfigListAdd" :disabled="customConfigList.length >= 5">新增</el-button> -->
  517. <el-button type="primary" @click="customConfigListSave" :loading="saveBtnLoading">{{ $t('save') }}</el-button>
  518. </div>
  519. <!-- 为下拉时的选项配置 -->
  520. <el-dialog :title="$t('configurationoptions')" v-if="configItemDialog" :visible.sync="configItemDialog" :close-on-click-modal="false" customClass="customWidth" width="500px" append-to-body>
  521. <el-table :data="configItemList" height="400px" style="width:100%" key="configItemTable">
  522. <el-table-column prop="id" width="60" :label="$t('headerTop.serialNumber')">
  523. <template slot-scope="scope" >
  524. {{scope.$index + 1}}
  525. </template>
  526. </el-table-column>
  527. <el-table-column prop="name" :label="$t('names')" ></el-table-column>
  528. <el-table-column :label="$t('operation')" width="150">
  529. <template slot-scope="scope" >
  530. <el-button size="small" type="primary" @click="configItemAorM(scope.row)">{{ $t('bian-ji') }}</el-button>
  531. <el-button size="small" type="danger" @click="configItemDelete(scope.row)">{{ $t('btn.delete') }}</el-button>
  532. </template>
  533. </el-table-column>
  534. </el-table>
  535. <div slot="footer" class="dialog-footer">
  536. <el-button type="primary" @click="configItemDialog = false" >{{ $t('Shutdown') }}</el-button>
  537. <el-button type="primary" @click="configItemAorM" >{{ $t('newConfigurationOptions') }}</el-button>
  538. </div>
  539. <el-dialog :title="$t('addededitedconfigurationoptions')" v-if="configItemAorMDialog" :visible.sync="configItemAorMDialog" :close-on-click-modal="false" customClass="customWidth" width="500px" append-to-body>
  540. <span>{{ $t('names') }}</span>
  541. <el-input size="medium" v-model="AorMitem.name" :placeholder="$t('enteranameforacustomconfigurationitem')" style="width:200px;margin-right:20px" maxlength="8"></el-input>
  542. <div slot="footer" class="dialog-footer">
  543. <el-button type="primary" @click="configItemAorMDialog = false" >{{ $t('btn.cancel') }}</el-button>
  544. <el-button type="primary" @click="configItemAorMSure" >{{ $t('btn.submit') }}</el-button>
  545. </div>
  546. </el-dialog>
  547. </el-dialog>
  548. </el-dialog>
  549. <!-- 批量导入 -->
  550. <el-dialog :title="$t('batchimportofpersonnel')" v-if="importDialog" :visible.sync="importDialog" customClass="customWidth" width="500px">
  551. <p>1. {{ $t('other.download') }}
  552. <el-link type="primary" style="margin-left:5px;" :underline="false" href="./upload/人员导入模板.xlsx" :download="$t('personnelimporttemplate')+'.xlsx'">{{$t('personnelimporttemplate')}}.xlsx</el-link>
  553. </p>
  554. <p>2. {{ $t('exceltemplateanduploadit') }}。</p>
  555. <p style="display: flex;justify-content: center;padding-bottom:1em;">
  556. <el-upload ref="upload" action="#" :limit="1" :http-request="importUser" :show-file-list="false">
  557. <el-button type="primary" :underline="false" :loading="importingData">{{ $t('other.startImporting') }}</el-button>
  558. </el-upload>
  559. </p>
  560. </el-dialog>
  561. <el-dialog :title="$t('synchronizetheenterprisewechataddressbook')" v-if="showSyncCWDialog" :visible.sync="showSyncCWDialog" customClass="customWidth" width="500px">
  562. <p>{{ $t('oneWeix') }}
  563. <el-popover placement="top" width="1200" trigger="hover">
  564. <div class="imgFlex">
  565. <div><img src="../../assets/image/Step1.jpg" style="width: 380px"/> <p><b>{{ $t('firststep') }}</b></p> </div>
  566. <div class="imgBor"> <p></p> <img src="../../assets/image/Step2.jpg" style="width: 380px"/> <p><b>{{ $t('secondstep') }}</b></p></div>
  567. <div><img src="../../assets/image/Step3.jpg" style="width: 380px"/> <p><b>{{ $t('thirdstep') }}</b></p></div>
  568. </div>
  569. <i class="el-icon-question" slot="reference" />
  570. </el-popover>
  571. </p>
  572. <p>
  573. <el-input v-model="contactSecret" style="width:380px;" :disabled="!editSecret"/><el-button @click="editSecret?saveContactSecret():editSecret=true;" >{{editSecret?'保存':'修改'}}</el-button>
  574. </p>
  575. <p v-if="contactServer == null">
  576. {{ $t('twoWei') }}
  577. </p>
  578. <p v-if="contactServer == null" style="text-align:center;">
  579. <img
  580. style="width: 120px; height: 120px"
  581. src="../../assets/image/code.jpg" />
  582. </p>
  583. <p style="display: flex;justify-content: center;padding-bottom:1em;">
  584. <el-button type="primary" :underline="false" :loading="importingData" :disabled="!canSync" @click="startCorpWxImport">{{ $t('startsynchronization') }}</el-button>
  585. </p>
  586. </el-dialog>
  587. <el-dialog :title="$t('correlationresults')" v-if="syncMembByCardTimeResultGialog" :visible.sync="syncMembByCardTimeResultGialog" customClass="customWidth" width="500px">
  588. <p style="padding-bottom:30px;">
  589. {{syncMembByCardTimeMsg}}
  590. </p>
  591. </el-dialog>
  592. </div>
  593. </div>
  594. </template>
  595. <script>
  596. // 左右滑動
  597. import dragMixin from "@/common/js/tensile.js";
  598. import util from "../../common/js/util";
  599. let that
  600. export default {
  601. name: "Home",
  602. components: {},
  603. mixins: [dragMixin],
  604. created() {
  605. let height = window.innerHeight;
  606. this.tableHeight = height - 195;
  607. const that = this;
  608. window.onresize = function temp() {
  609. that.tableHeight = window.innerHeight - 195;
  610. };
  611. this.initDrag([
  612. {
  613. type: "LR",
  614. domClass: {
  615. // 中间分割线的名字
  616. resize: "line-line",
  617. // 左侧盒子的名字
  618. left: "box-left",
  619. // 右侧盒子的名字
  620. right: "box-right",
  621. // 父级的名字
  622. box: "box-father",
  623. },
  624. otherInfo: {
  625. // 限制左边栏最低宽度
  626. leftWidth: 120,
  627. },
  628. },
  629. {
  630. type: "LR",
  631. domClass: {
  632. // 中间分割线的名字
  633. resize: "line-second",
  634. // 左侧盒子的名字
  635. left: "left-laowang",
  636. // 右侧盒子的名字
  637. right: "box-second-father",
  638. // 父级的名字
  639. box: "grand",
  640. },
  641. otherInfo: {
  642. // 限制左边栏最低宽度
  643. leftWidth: 120,
  644. },
  645. },
  646. ]);
  647. },
  648. data() {
  649. return {
  650. tixtass: '变化',
  651. syncMembByCardTimeResultGialog:false,
  652. syncMembByCardTimeMsg:null,
  653. editSecret: false,
  654. canSync: false,
  655. corpid: null,
  656. contactSecret: null,
  657. contactServer: null,
  658. showSyncCWDialog: false,
  659. permissions: JSON.parse(sessionStorage.getItem("permissions")),
  660. handleSelectionZzjgshow: false,
  661. handljues: false,
  662. submitLoading: false,
  663. deactiveUser: null,
  664. deactiveDate: null,
  665. deactiveDialog: false,
  666. toUserId: null,
  667. myRoleId: null,
  668. allActiveUsers: [],
  669. transferDialog: false,
  670. containInvalid: 1,
  671. exportDialogVisible: false,
  672. roleArray: [
  673. this.$t('role.ordinaryEmployees'),
  674. this.$t('role.superAdministrator'),
  675. this.$t('role.systemAdministrator'),
  676. this.$t('role.companyTop'),
  677. this.$t('role.financialAdministrator'),
  678. this.$t('role.projectManager'),
  679. this.$t('role.companyLeadership'),
  680. ],
  681. roleDescArray: [
  682. { label: this.$t('role.ordinaryEmployees'), value: 0, desc: this.$t('eportandarticipate') },
  683. {
  684. label: this.$t('role.systemAdministrator'),
  685. value: 2,
  686. desc: this.$t('systemadministrators'),
  687. },
  688. // {label:"公司高层",value:3, desc:"查阅项目信息,人员工时情况"},
  689. {
  690. label: this.$t('role.financialAdministrator'),
  691. value: 4,
  692. desc: this.$t('financial'),
  693. },
  694. { label: this.$t('role.projectManager'), value: 5, desc: this.$t('createandmanageprojects') },
  695. {
  696. label: this.$t('role.companyLeadership'),
  697. value: 6,
  698. desc: this.$t('viewdailyreports'),
  699. },
  700. ],
  701. userSalaryList: [],
  702. userSalaryListDialog: false,
  703. value: {},
  704. user: JSON.parse(sessionStorage.getItem("user")),
  705. users: [],
  706. tableHeight: 0,
  707. listLoading: false,
  708. total: 0,
  709. page: 1,
  710. size: 20,
  711. list: [],
  712. data: [
  713. {
  714. id: -1,
  715. label: this.$t('lable.allStaff'),
  716. },
  717. {
  718. id: 0,
  719. label: this.$t('lable.unassigned'),
  720. },
  721. ],
  722. option: [],
  723. depData: {
  724. id: -1,
  725. label: this.$t('lable.allStaff'),
  726. },
  727. defaultProps: {
  728. children: "children",
  729. label: "label",
  730. },
  731. dialogVisible: false,
  732. title: "",
  733. insertForm: {
  734. id: null,
  735. name: null,
  736. phone: null,
  737. // role: null,
  738. roleId: null,
  739. monthCost: null,
  740. cost: null,
  741. departmentId: null,
  742. salaryType: 0,
  743. costApplyDate: util.formatDate.format(new Date(), "yyyy-MM-dd"),
  744. inductionDate: util.formatDate.format(new Date(), "yyyy-MM-dd"),
  745. position: "",
  746. certJson: [],
  747. plateMap: {},
  748. },
  749. rules: {
  750. name: [{ required: true, message: this.$t('defaultText.PleaseEnterYourName'), trigger: "blur" }],
  751. // phone: [{ required: true, message: "请输入电话", trigger: "blur" }],
  752. // role: [{ required: true, message: "请选择角色", trigger: "blur" }],
  753. roleId: [{ required: true, message: this.$t('pleaseselectroles'), trigger: "blur" }],
  754. cost: [{ required: true, message: this.$t('pleaseinputcost'), trigger: "blur" }],
  755. monthCost: [
  756. { required: true, message: this.$t('monthlycost'), trigger: "blur" },
  757. ],
  758. },
  759. managementFormRou: {
  760. name: [{ required: true, message: this.$t('pleaseenterprofessionalcertificate'), trigger: "blur" }],
  761. },
  762. dialogVisible1: false,
  763. departmentVisible: false,
  764. depTitle: "",
  765. depForm: {
  766. id: null,
  767. name: null,
  768. parentId: null,
  769. managerId: null,
  770. },
  771. depRules: {
  772. name: [{ required: true, message: this.$t('pleaseenterthedepartmentname'), trigger: "blur" }],
  773. },
  774. timeType: {},
  775. keyword: "",
  776. rolesa: [
  777. {
  778. value: "",
  779. label: this.$t('all'),
  780. },
  781. {
  782. value: "6",
  783. label: this.$t('role.companyLeadership'),
  784. },
  785. {
  786. value: "2",
  787. label: this.$t('role.systemAdministrator'),
  788. },
  789. {
  790. value: "4",
  791. label: this.$t('role.financialAdministrator'),
  792. },
  793. {
  794. value: "5",
  795. label: this.$t('role.projectManager'),
  796. },
  797. {
  798. value: "0",
  799. label: this.$t('role.ordinaryEmployees'),
  800. },
  801. ],
  802. states: [
  803. {
  804. value: "",
  805. label: this.$t('all'),
  806. },
  807. {
  808. value: "1",
  809. label: this.$t('zai-zhi'),
  810. },
  811. {
  812. value: "0",
  813. label: this.$t('ting-yong'),
  814. },
  815. ],
  816. status: "1",
  817. role: "",
  818. jDarr: [],
  819. handleSelectionZzjgDate: [],
  820. handleSelectionZzjgwillchange: null,
  821. acquireRoleList: [], // 角色列表
  822. acquireRoleLists: [], // 没有超级管理员
  823. roleId: "",
  824. xiuRoleId: "",
  825. managementDiolog: false,
  826. addManagementDiolog: false,
  827. managementForm: {
  828. name: "",
  829. },
  830. managementTableData: [],
  831. certificate: "",
  832. addUserId: "",
  833. userCustomConfig: [],
  834. customConfigDialog: false,
  835. importDialog: false,
  836. importingData: false,
  837. customConfigList: [],
  838. cusItemTypes: [],
  839. configItemList: [],
  840. configItemId: null,
  841. configItemDialog: false,
  842. configItemAorMDialog: false,
  843. AorMitem: {
  844. name: null,
  845. userCustomId: null,
  846. id: null,
  847. },
  848. tableLoading: false,
  849. suoying: ["plate1", "plate2", "plate3", "plate4", "plate5"],
  850. insertFormPlates: [],
  851. saveBtnLoading: false,
  852. onlyDirect: false,
  853. };
  854. },
  855. filters: {
  856. acquireRoleName(value) {
  857. for (var i in that.acquireRoleList) {
  858. if (that.acquireRoleList[i].id == value) {
  859. return that.acquireRoleList[i].rolename;
  860. }
  861. }
  862. },
  863. },
  864. beforeCreate: function () {
  865. that = this;
  866. },
  867. methods: {
  868. syncMembByCardTime() {
  869. this.syncMembByCardTimeResultGialog = true;
  870. this.syncMembByCardTimeMsg = this.$t('synchronizingtheassociation');
  871. this.http.post("/wxcorp/syncMembByCardTime",
  872. {
  873. companyId: this.user.companyId,
  874. },
  875. (res) => {
  876. if (res.code == "ok") {
  877. this.syncMembByCardTimeMsg = res.data;
  878. this.getUser();
  879. //人员同步成功,再去同步获取本月的人员
  880. this.getCurMonthDayData();
  881. } else {
  882. this.syncMembByCardTimeMsg = res.msg;
  883. }
  884. },
  885. (err) => {
  886. this.syncMembByCardTimeMsg = err;
  887. }
  888. );
  889. },
  890. getCurMonthDayData() {
  891. this.http.post("/wxcorp/getCurMonthDayData",
  892. {
  893. companyId: this.user.companyId,
  894. },
  895. (res) => {
  896. if (res.code == "ok") {
  897. } else {
  898. }
  899. },
  900. (err) => {
  901. }
  902. );
  903. },
  904. saveContactSecret() {
  905. if (!this.contactSecret) {
  906. this.$message({
  907. message: this.$t('booksecret'),
  908. type: "error",
  909. });
  910. return;
  911. }
  912. this.http.post(
  913. "/wx-corp-info/saveContactSecret",
  914. {
  915. corpid: this.corpid,
  916. contactSecret: this.contactSecret,
  917. },
  918. (res) => {
  919. if (res.code == "ok") {
  920. this.$message({
  921. message: this.$t('savesuccess'),
  922. type: "success",
  923. });
  924. this.canSync = true;
  925. } else {
  926. this.$message({
  927. message: res.msg,
  928. type: "error",
  929. });
  930. }
  931. },
  932. (err) => {
  933. this.tableLoading = false;
  934. this.$message({
  935. message: err,
  936. type: "error",
  937. });
  938. }
  939. );
  940. },
  941. startCorpWxImport() {
  942. this.importingData = true;
  943. this.http.post(
  944. "/wxcorp/getCorpMembs",
  945. {
  946. corpId: this.corpid,
  947. },
  948. (res) => {
  949. this.importingData = false;
  950. if (res.code == "ok") {
  951. this.showSyncCWDialog = false;
  952. this.$message({
  953. message: this.$t('synchronoussuccesss'),
  954. type: "success",
  955. });
  956. this.getDepartment();
  957. this.getUser();
  958. this.getUsers();
  959. } else {
  960. this.$message({
  961. message: res.msg,
  962. type: "error",
  963. });
  964. }
  965. },
  966. (err) => {
  967. this.tableLoading = false;
  968. this.$message({
  969. message: err,
  970. type: "error",
  971. });
  972. }
  973. );
  974. },
  975. //从企业微信同步通讯录
  976. syncWithCorpWx() {
  977. this.showSyncCWDialog = true;
  978. this.editSecret = false;
  979. this.http.post(
  980. "/wx-corp-info/get",
  981. {
  982. companyId: this.user.companyId,
  983. },
  984. (res) => {
  985. if (res.code == "ok") {
  986. this.contactSecret = res.data.contactSecret;
  987. this.contactServer = res.data.contactServer;
  988. if (this.contactSecret && this.contactServer) {
  989. this.canSync = true;
  990. } else {
  991. this.editSecret = true;
  992. }
  993. this.corpid = res.data.corpid;
  994. } else {
  995. this.$message({
  996. message: res.msg,
  997. type: "error",
  998. });
  999. }
  1000. },
  1001. (err) => {
  1002. this.tableLoading = false;
  1003. this.$message({
  1004. message: err,
  1005. type: "error",
  1006. });
  1007. }
  1008. );
  1009. },
  1010. // 从钉钉同步通讯录
  1011. syncWithCorpDingding() {
  1012. this.$confirm(
  1013. this.$t('areyousuretosynchronize '),
  1014. this.$t('other.prompts'),
  1015. {
  1016. confirmButtonText: this.$t('btn.determine'),
  1017. cancelButtonText: this.$t('btn.cancel'),
  1018. type: "warning",
  1019. }
  1020. )
  1021. .then(() => {
  1022. this.listLoading = true;
  1023. this.http.post(
  1024. "/company/syncCorpMembs",
  1025. {},
  1026. (res) => {
  1027. this.listLoading = false;
  1028. if (res.code == "ok") {
  1029. this.$message({
  1030. message: res.data,
  1031. type: "success",
  1032. });
  1033. this.getDepartment();
  1034. this.getUser();
  1035. this.getUsers();
  1036. } else {
  1037. this.$message({
  1038. message: res.msg,
  1039. type: "error",
  1040. });
  1041. }
  1042. },
  1043. (err) => {
  1044. this.listLoading = false;
  1045. this.$message({
  1046. message: err,
  1047. type: "error",
  1048. });
  1049. }
  1050. );
  1051. })
  1052. .catch(() => {
  1053. this.$message({
  1054. message: this.$t('operationcancelled'),
  1055. type: "info",
  1056. });
  1057. });
  1058. },
  1059. test() {
  1060. this.getCustomConfigList();
  1061. },
  1062. // 自定义配置项
  1063. customConfigShow() {
  1064. this.getCustomConfigList();
  1065. this.customConfigDialog = true;
  1066. },
  1067. getConfigItemBtn(item) {
  1068. this.configItemDialog = true;
  1069. this.AorMitem.userCustomId = item.id;
  1070. this.getConfigItem();
  1071. },
  1072. getConfigItem() {
  1073. // 获取配置下拉数据
  1074. this.http.post(
  1075. "/sub-user-custom/list",
  1076. {
  1077. userCustomId: this.AorMitem.userCustomId,
  1078. },
  1079. (res) => {
  1080. if (res.code == "ok") {
  1081. this.configItemList = res.data;
  1082. } else {
  1083. this.$message({
  1084. message: res.msg,
  1085. type: "error",
  1086. });
  1087. }
  1088. },
  1089. (err) => {
  1090. this.tableLoading = false;
  1091. this.$message({
  1092. message: err,
  1093. type: "error",
  1094. });
  1095. }
  1096. );
  1097. },
  1098. getCustomConfigList() {
  1099. // 获取自定义配置
  1100. this.http.post(
  1101. "/user-custom/list",
  1102. {},
  1103. (res) => {
  1104. if (res.code == "ok") {
  1105. let lists = JSON.parse(JSON.stringify(res.data));
  1106. this.userCustomConfig = JSON.parse(JSON.stringify(res.data));
  1107. // let lists = res.data
  1108. // this.customConfigList = res.data
  1109. this.customConfigList = [
  1110. { name: "", id: null, type: 1, companyId: null },
  1111. { name: "", id: null, type: 1, companyId: null },
  1112. { name: "", id: null, type: 1, companyId: null },
  1113. { name: "", id: null, type: 1, companyId: null },
  1114. { name: "", id: null, type: 1, companyId: null },
  1115. ];
  1116. for (let i in lists) {
  1117. this.$set(this.customConfigList[i], "name", lists[i].name);
  1118. this.$set(this.customConfigList[i], "id", lists[i].id);
  1119. this.$set(this.customConfigList[i], "type", lists[i].type);
  1120. this.$set(
  1121. this.customConfigList[i],
  1122. "companyId",
  1123. lists[i].companyId
  1124. );
  1125. }
  1126. // console.log('customConfigList',this.customConfigList);
  1127. this.cusItemTypes = [];
  1128. for (let j in this.customConfigList) {
  1129. if (
  1130. this.customConfigList[j].type == null ||
  1131. this.customConfigList[j].type == 0
  1132. ) {
  1133. this.customConfigList[j].type = 0;
  1134. this.cusItemTypes[j] = 0;
  1135. } else {
  1136. this.cusItemTypes[j] = 1;
  1137. }
  1138. }
  1139. } else {
  1140. this.$message({
  1141. message: res.msg,
  1142. type: "error",
  1143. });
  1144. }
  1145. },
  1146. (err) => {
  1147. this.$message({
  1148. message: err,
  1149. type: "error",
  1150. });
  1151. }
  1152. );
  1153. },
  1154. customConfigListSave() {
  1155. // 保存/修改自定义配置
  1156. // let jsonStr = ''
  1157. // for(let i in this.customConfigList){
  1158. // if(this.customConfigList[i].name){
  1159. // jsonStr += JSON.stringify(this.customConfigList[i]) + ','
  1160. // }
  1161. // }
  1162. // jsonStr = jsonStr.substring(0,jsonStr.length - 1)
  1163. // let jsonStr = []
  1164. this.saveBtnLoading = true;
  1165. let parameter = this.customConfigList.filter(
  1166. (item) => item.name.trim() != ""
  1167. );
  1168. this.http.post(
  1169. "/user-custom/addOrMod",
  1170. {
  1171. json: JSON.stringify(parameter),
  1172. },
  1173. (res) => {
  1174. if (res.code == "ok") {
  1175. this.getCustomConfigList();
  1176. this.saveBtnLoading = false;
  1177. this.$message({
  1178. message: this.$t('savesuccess'),
  1179. type: "success",
  1180. });
  1181. } else {
  1182. this.saveBtnLoading = false;
  1183. this.$message({
  1184. message: res.msg,
  1185. type: "error",
  1186. });
  1187. }
  1188. },
  1189. (err) => {
  1190. this.saveBtnLoading = false;
  1191. this.$message({
  1192. message: err,
  1193. type: "error",
  1194. });
  1195. }
  1196. );
  1197. },
  1198. customConfigDelete(item, index) {
  1199. if (item.id) {
  1200. this.http.post(
  1201. "/user-custom/delete",
  1202. {
  1203. id: item.id,
  1204. },
  1205. (res) => {
  1206. if (res.code == "ok") {
  1207. this.getCustomConfigList();
  1208. this.$message({
  1209. message: this.$t('message.successfullyDeleted'),
  1210. type: "success",
  1211. });
  1212. } else {
  1213. this.$message({
  1214. message: res.msg,
  1215. type: "error",
  1216. });
  1217. }
  1218. },
  1219. (err) => {
  1220. this.$message({
  1221. message: err,
  1222. type: "error",
  1223. });
  1224. }
  1225. );
  1226. } else {
  1227. this.customConfigList.splice(index, 1);
  1228. }
  1229. },
  1230. configItemAorM(item) {
  1231. this.configItemAorMDialog = true;
  1232. if (item) {
  1233. this.AorMitem.name = item.name;
  1234. this.AorMitem.id = item.id;
  1235. } else {
  1236. this.AorMitem.name = null;
  1237. this.AorMitem.id = null;
  1238. }
  1239. },
  1240. configItemAorMSure() {
  1241. // 新增/修改配置下拉选项
  1242. if (!this.AorMitem.name) {
  1243. this.$message({
  1244. message: this.$t('namecannotbeempty'),
  1245. type: "error",
  1246. });
  1247. return;
  1248. }
  1249. this.http.post(
  1250. "/sub-user-custom/addOrMod",
  1251. this.AorMitem,
  1252. (res) => {
  1253. if (res.code == "ok") {
  1254. this.configItemAorMDialog = false;
  1255. this.getConfigItem();
  1256. this.$message({
  1257. message: this.$t('message.submittedSuccessfully'),
  1258. type: "success",
  1259. });
  1260. } else {
  1261. this.$message({
  1262. message: res.msg,
  1263. type: "error",
  1264. });
  1265. }
  1266. },
  1267. (err) => {
  1268. this.$message({
  1269. message: err,
  1270. type: "error",
  1271. });
  1272. }
  1273. );
  1274. },
  1275. configItemDelete(item) {
  1276. // 删除配置下拉选项
  1277. this.http.post(
  1278. "/sub-user-custom/delete",
  1279. {
  1280. id: item.id,
  1281. },
  1282. (res) => {
  1283. if (res.code == "ok") {
  1284. this.getConfigItem();
  1285. this.$message({
  1286. message: this.$t('message.successfullyDeleted'),
  1287. type: "success",
  1288. });
  1289. } else {
  1290. this.$message({
  1291. message: res.msg,
  1292. type: "error",
  1293. });
  1294. }
  1295. },
  1296. (err) => {
  1297. this.$message({
  1298. message: err,
  1299. type: "error",
  1300. });
  1301. }
  1302. );
  1303. },
  1304. // 获取添加人员时的自定义配置信息
  1305. getUserCustomConfig(e) {
  1306. this.http.post(
  1307. "/user-custom/list",
  1308. {},
  1309. (res) => {
  1310. if (res.code == "ok") {
  1311. this.userCustomConfig = JSON.parse(JSON.stringify(res.data));
  1312. for (let i in this.userCustomConfig) {
  1313. if (this.userCustomConfig[i].type == 0) {
  1314. this.http.post(
  1315. "/sub-user-custom/list",
  1316. {
  1317. userCustomId: this.userCustomConfig[i].id,
  1318. },
  1319. (res) => {
  1320. if (res.code == "ok") {
  1321. // this.userCustomConfig[i].itemList = res.data
  1322. this.$set(this.userCustomConfig[i], "itemList", res.data);
  1323. } else {
  1324. this.$message({
  1325. message: res.msg,
  1326. type: "error",
  1327. });
  1328. }
  1329. },
  1330. (err) => {
  1331. this.$message({
  1332. message: err,
  1333. type: "error",
  1334. });
  1335. }
  1336. );
  1337. }
  1338. }
  1339. this.$nextTick(() => {
  1340. // let opt = this.users[0].plateMap[this.userCustomConfig[0].name]
  1341. // console.log('userCustomConfig',this.userCustomConfig);
  1342. // console.log('insertForm',this.insertForm);
  1343. });
  1344. } else {
  1345. this.$message({
  1346. message: res.msg,
  1347. type: "error",
  1348. });
  1349. }
  1350. },
  1351. (err) => {
  1352. this.$message({
  1353. message: err,
  1354. type: "error",
  1355. });
  1356. }
  1357. );
  1358. },
  1359. // customConfigListAdd(){
  1360. // this.customConfigList.push({
  1361. // name: '',
  1362. // type: 1
  1363. // })
  1364. // },
  1365. // 批量修改部门
  1366. handleSelectionZzjg(e) {
  1367. // if (e.length == 0) {
  1368. // this.handleSelectionZzjgshow = false
  1369. // }else{
  1370. // this.handleSelectionZzjgshow = true
  1371. // }
  1372. this.handleSelectionZzjgDate = e;
  1373. },
  1374. handleSelectionZzjgbtn1() {
  1375. this.handleSelectionZzjgshow = false;
  1376. this.$refs.handleSelectTable.clearSelection();
  1377. this.handleSelectionZzjgwillchange = null;
  1378. },
  1379. handleSelectionZzjgbtn2() {
  1380. if (this.handleSelectionZzjgwillchange == null) {
  1381. this.$message(this.$t('qing-xuan-ze-bu-men'));
  1382. return;
  1383. }
  1384. //接口调用样例代码如下
  1385. var ids = [];
  1386. for (
  1387. let index = 0;
  1388. index < this.handleSelectionZzjgDate.length;
  1389. index++
  1390. ) {
  1391. ids.push(this.handleSelectionZzjgDate[index].id);
  1392. }
  1393. var changeId =
  1394. this.handleSelectionZzjgwillchange[
  1395. this.handleSelectionZzjgwillchange.length - 1
  1396. ];
  1397. this.http.post(
  1398. "/user/batchUpdateDept",
  1399. {
  1400. userIds: JSON.stringify(ids),
  1401. deptId: changeId,
  1402. },
  1403. (res) => {
  1404. if (res.code == "ok") {
  1405. this.$message({
  1406. message: this.$t('message.modifyTheSuccess'),
  1407. type: "success",
  1408. });
  1409. this.getUser();
  1410. } else {
  1411. this.$message({
  1412. message: res.msg,
  1413. type: "error",
  1414. });
  1415. }
  1416. },
  1417. (error) => {
  1418. this.$message({
  1419. message: error,
  1420. type: "error",
  1421. });
  1422. }
  1423. );
  1424. // for (let index = 0; index < this.handleSelectionZzjgDate.length; index++) {
  1425. // this.handleSelectionZzjgDate[index].departmentId = this.handleSelectionZzjgwillchange[this.handleSelectionZzjgwillchange.length - 1]
  1426. // if (this.handleSelectionZzjgDate[index].role == 1) {
  1427. // this.submitInsert1(this.handleSelectionZzjgDate[index],1)
  1428. // }else{
  1429. // this.submitInsert(this.handleSelectionZzjgDate[index],1)
  1430. // }
  1431. // }
  1432. // this.handleSelectionZzjgwillchange = null
  1433. this.handleSelectionZzjgshow = false;
  1434. },
  1435. handleSelectionZzjgbtn3() {
  1436. if (this.handleSelectionZzjgDate.length == 0) {
  1437. this.$message(this.$t('pleaseselectpersonnel'));
  1438. return;
  1439. }
  1440. this.handleSelectionZzjgshow = true;
  1441. },
  1442. handJue() {
  1443. if (this.handleSelectionZzjgDate.length == 0) {
  1444. this.$message(this.$t('pleaseselectpersonnel'));
  1445. return;
  1446. }
  1447. for (var i in this.acquireRoleList) {
  1448. if (this.acquireRoleList[i].isDefault == 1) {
  1449. this.xiuRoleId = this.acquireRoleList[i].id;
  1450. }
  1451. }
  1452. this.handljues = true;
  1453. // console.log('触发了')
  1454. },
  1455. handTrue() {
  1456. var arr = [];
  1457. for (var i in this.handleSelectionZzjgDate) {
  1458. arr.push(this.handleSelectionZzjgDate[i].id);
  1459. }
  1460. this.http.post(
  1461. "/user/batchUpdateRole",
  1462. {
  1463. userIds: JSON.stringify(arr),
  1464. roleId: this.xiuRoleId,
  1465. },
  1466. (res) => {
  1467. if (res.code == "ok") {
  1468. this.$message({
  1469. message: this.$t('operationissuccessful'),
  1470. type: "success",
  1471. });
  1472. this.handljues = false;
  1473. this.getUser();
  1474. } else {
  1475. this.$message({
  1476. message: res.msg,
  1477. type: "error",
  1478. });
  1479. }
  1480. },
  1481. (error) => {
  1482. this.$message({
  1483. message: error,
  1484. type: "error",
  1485. });
  1486. }
  1487. );
  1488. },
  1489. deleteUser(targetUser) {
  1490. this.$confirm(this.$t('deletthisemployee'), this.$t('other.prompts'), {
  1491. //type: 'warning'
  1492. }).then(() => {
  1493. this.http.post(
  1494. "/user/deleteUser",
  1495. {
  1496. userId: targetUser.id,
  1497. },
  1498. (res) => {
  1499. if (res.code == "ok") {
  1500. this.$message({
  1501. message: this.$t('message.successfullyDeleted'),
  1502. type: "success",
  1503. });
  1504. this.dialogVisible = false;
  1505. this.getUser();
  1506. } else {
  1507. this.$message({
  1508. message: res.msg,
  1509. type: "error",
  1510. });
  1511. this.dialogVisible = false;
  1512. }
  1513. },
  1514. (error) => {
  1515. this.$message({
  1516. message: error,
  1517. type: "error",
  1518. });
  1519. this.dialogVisible = false;
  1520. }
  1521. );
  1522. });
  1523. },
  1524. chufa(data, b, c, e) {
  1525. if (this.depData == null || data.id != this.depData.id) {
  1526. // this.depData = data.id
  1527. this.depData = data;
  1528. this.page = 1;
  1529. this.getUser();
  1530. }
  1531. },
  1532. jieDian(a, b, c) {
  1533. var ids = a.id;
  1534. var arrs = this.jDarr;
  1535. arrs.push(ids);
  1536. this.jDarr = arrs;
  1537. },
  1538. shutDown(a, b, c) {
  1539. var ids = a.id;
  1540. var arrs = [];
  1541. for (var i in this.jDarr) {
  1542. if (this.jDarr[i] != ids) {
  1543. arrs.push(this.jDarr[i]);
  1544. }
  1545. }
  1546. this.jDarr = arrs;
  1547. },
  1548. mouseleave(data, $event) {
  1549. $event.currentTarget.firstElementChild.nextElementSibling.setAttribute(
  1550. "class",
  1551. "node none poAub"
  1552. );
  1553. },
  1554. mouseover(data, $event) {
  1555. $event.currentTarget.lastChild.setAttribute("class", "node block poAub");
  1556. },
  1557. confirmDeactive() {
  1558. this.http.post(
  1559. "/user/deactiveUser",
  1560. {
  1561. id: this.deactiveUser.id,
  1562. inactiveDate: this.deactiveDate,
  1563. },
  1564. (res) => {
  1565. if (res.code == "ok") {
  1566. this.deactiveDialog = false;
  1567. this.$message({
  1568. message: this.$t('stopsuccess'),
  1569. type: "success",
  1570. });
  1571. // this.getUsers();
  1572. this.getUser();
  1573. } else {
  1574. this.$message({
  1575. message: res.msg,
  1576. type: "error",
  1577. });
  1578. }
  1579. },
  1580. (error) => {
  1581. this.$message({
  1582. message: error,
  1583. type: "error",
  1584. });
  1585. }
  1586. );
  1587. },
  1588. showDeactiveDialog(item) {
  1589. this.deactiveDialog = true;
  1590. this.deactiveUser = item;
  1591. },
  1592. restrictNumber(targetId) {
  1593. let inpu = document.getElementById(targetId);
  1594. inpu.value = inpu.value.replace(/[^\d.]/g, ""); //仅保留数字和"."
  1595. inpu.value = inpu.value.replace(/\.{2,}/g, "."); //两个连续的"."仅保留第一个"."
  1596. inpu.value = inpu.value
  1597. .replace(".", "$#*")
  1598. .replace(/\./g, "")
  1599. .replace("$#*", "."); //去除其他"."
  1600. inpu.value = inpu.value.replace(/^(\d+)\.(\d\d).*$/, "$1.$2"); //限制只能输入两个小数
  1601. if (inpu.value.indexOf(".") < 0 && inpu.value != "") {
  1602. //首位是0的话去掉
  1603. inpu.value = parseFloat(inpu.value);
  1604. }
  1605. },
  1606. restrictNumber4(targetId) {
  1607. let inpu = document.getElementById(targetId);
  1608. inpu.value = inpu.value.replace(/[^\d.]/g, ""); //仅保留数字和"."
  1609. inpu.value = inpu.value.replace(/\.{2,}/g, "."); //两个连续的"."仅保留第一个"."
  1610. inpu.value = inpu.value
  1611. .replace(".", "$#*")
  1612. .replace(/\./g, "")
  1613. .replace("$#*", "."); //去除其他"."
  1614. inpu.value = inpu.value.replace(/^(\d+)\.(\d\d\d\d).*$/, "$1.$2"); //限制只能输入两个小数
  1615. if (inpu.value.indexOf(".") < 0 && inpu.value != "") {
  1616. //首位是0的话去掉
  1617. inpu.value = parseFloat(inpu.value);
  1618. }
  1619. },
  1620. showConfirmDialog() {
  1621. if (this.toUserId == null || this.toUserId == "") {
  1622. this.$message({
  1623. message: this.$t('wanttotransfer'),
  1624. type: "error",
  1625. });
  1626. return;
  1627. }
  1628. if (!this.myRoleId) {
  1629. this.$message({
  1630. message: this.$t('pleaseselectaftertransfer'),
  1631. type: "error",
  1632. });
  1633. return;
  1634. }
  1635. this.$confirm(
  1636. this.$t('superadministratorrole'),
  1637. this.$t('other.prompts'),
  1638. {
  1639. //type: 'warning'
  1640. }
  1641. ).then(() => {
  1642. this.http.post(
  1643. "/user/changeSysManager",
  1644. {
  1645. toUserId: this.toUserId,
  1646. myRoleId: this.myRoleId,
  1647. },
  1648. (res) => {
  1649. if (res.code == "ok") {
  1650. sessionStorage.removeItem("user");
  1651. this.$router.push("/login");
  1652. } else {
  1653. this.$message({
  1654. message: res.msg,
  1655. type: "error",
  1656. });
  1657. }
  1658. },
  1659. (error) => {
  1660. this.$message({
  1661. message: error,
  1662. type: "error",
  1663. });
  1664. }
  1665. );
  1666. });
  1667. },
  1668. transferRole() {
  1669. this.transferDialog = true;
  1670. this.http.post(
  1671. this.port.manage.list,
  1672. {
  1673. departmentId: -1,
  1674. pageIndex: 1,
  1675. // pageSize: 99999,
  1676. pageSize: -1,
  1677. },
  1678. (res) => {
  1679. if (res.code == "ok") {
  1680. this.allActiveUsers = res.data.records.filter(
  1681. (u) => u.isActive == 1 && u.id != this.user.id
  1682. );
  1683. } else {
  1684. this.$message({
  1685. message: res.msg,
  1686. type: "error",
  1687. });
  1688. }
  1689. },
  1690. (error) => {
  1691. this.$message({
  1692. message: error,
  1693. type: "error",
  1694. });
  1695. }
  1696. );
  1697. },
  1698. showExportDialog() {
  1699. this.exportDialogVisible = true;
  1700. },
  1701. exportUsers() {
  1702. this.http.post(
  1703. "/user/exportUsers",
  1704. {
  1705. containInvalid: this.containInvalid,
  1706. },
  1707. (res) => {
  1708. if (res.code == "ok") {
  1709. this.exportDialogVisible = false;
  1710. var aTag = document.createElement("a");
  1711. aTag.download = this.$t('listofallemployees') + ".xls";
  1712. aTag.href = res.data;
  1713. aTag.click();
  1714. } else {
  1715. this.$message({
  1716. message: res.msg,
  1717. type: "error",
  1718. });
  1719. }
  1720. },
  1721. (error) => {
  1722. this.$message({
  1723. message: error,
  1724. type: "error",
  1725. });
  1726. }
  1727. );
  1728. },
  1729. showSalaryList(item) {
  1730. this.userSalaryListDialog = true;
  1731. this.userSalaryList = [];
  1732. this.http.post(
  1733. "/user/getUserSalaryList",
  1734. {
  1735. id: item.id,
  1736. },
  1737. (res) => {
  1738. if (res.code == "ok") {
  1739. this.userSalaryList = res.data;
  1740. } else {
  1741. this.$message({
  1742. message: res.msg,
  1743. type: "error",
  1744. });
  1745. }
  1746. },
  1747. (error) => {
  1748. this.$message({
  1749. message: error,
  1750. type: "error",
  1751. });
  1752. }
  1753. );
  1754. },
  1755. getUsers() {
  1756. this.http.post(
  1757. // this.port.manage.list,
  1758. '/user/getSimpleActiveUserList',
  1759. {},
  1760. (res) => {
  1761. if (res.code == "ok") {
  1762. // this.users = res.data.records;
  1763. this.users = res.data;
  1764. } else {
  1765. this.$message({
  1766. message: res.msg,
  1767. type: "error",
  1768. });
  1769. }
  1770. },
  1771. (error) => {
  1772. this.$message({
  1773. message: error,
  1774. type: "error",
  1775. });
  1776. }
  1777. );
  1778. },
  1779. onSalaryTypeChange(value) {
  1780. if (value == 1) {
  1781. this.insertForm.monthCost = null;
  1782. }
  1783. },
  1784. //选中部门
  1785. choseDept(value) {
  1786. // console.log(value);
  1787. },
  1788. //月成本输入变化
  1789. oninput(e) {
  1790. this.insertForm.cost = (
  1791. this.insertForm.monthCost /
  1792. this.timeType.monthDays /
  1793. this.timeType.allday
  1794. ).toFixed(4);
  1795. },
  1796. // 获取本公司的工作时间设置
  1797. getCompanyTimeSetting() {
  1798. this.http.post(
  1799. "/time-type/getCompanyTimeSetting",
  1800. {
  1801. companyId: this.user.companyId,
  1802. },
  1803. (res) => {
  1804. if (res.code == "ok") {
  1805. this.timeType = res.data;
  1806. } else {
  1807. this.$message({
  1808. message: res.msg,
  1809. type: "error",
  1810. });
  1811. }
  1812. },
  1813. (error) => {
  1814. this.listLoading = false;
  1815. this.$message({
  1816. message: error,
  1817. type: "error",
  1818. });
  1819. }
  1820. );
  1821. },
  1822. importUserC() {
  1823. this.importDialog = true;
  1824. },
  1825. // 批量导入人员
  1826. importUser(item) {
  1827. //首先判断文件类型
  1828. let str = item.file.name.split(".");
  1829. let format = str[str.length - 1];
  1830. if (format != "xls" && format != "xlsx") {
  1831. this.$message({
  1832. message: this.$t('other.PleaseselecttheXLSorXLSXfile'),
  1833. type: "error",
  1834. });
  1835. } else {
  1836. this.listLoading = true;
  1837. let formData = new FormData();
  1838. formData.append("file", item.file);
  1839. this.importingData = true;
  1840. this.http.uploadFile(
  1841. this.port.manage.import,
  1842. formData,
  1843. (res) => {
  1844. this.importingData = false;
  1845. this.$refs.upload.clearFiles();
  1846. this.listLoading = false;
  1847. if (res.code == "ok") {
  1848. this.$message({
  1849. message: this.$t('other.importSuccess'),
  1850. type: "success",
  1851. });
  1852. //重新读取列表
  1853. this.getUser();
  1854. } else {
  1855. this.$message({
  1856. message: res.msg,
  1857. type: "error",
  1858. });
  1859. }
  1860. },
  1861. (error) => {
  1862. this.importingData = false;
  1863. this.$refs.upload.clearFiles();
  1864. this.listLoading = false;
  1865. this.$message({
  1866. message: error,
  1867. type: "error",
  1868. });
  1869. }
  1870. );
  1871. }
  1872. },
  1873. //分页
  1874. handleCurrentChange(val) {
  1875. this.page = val;
  1876. this.getUser(1);
  1877. },
  1878. handleSizeChange(val) {
  1879. this.size = val;
  1880. this.getUser(1);
  1881. },
  1882. //获取所有员工的列表
  1883. getUser(e) {
  1884. if (e != 1) {
  1885. this.page = 1;
  1886. }
  1887. // console.log(12345)
  1888. this.listLoading = true;
  1889. this.http.post(
  1890. this.port.manage.list,
  1891. {
  1892. departmentId: this.depData.id,
  1893. pageIndex: this.page,
  1894. pageSize: this.size,
  1895. keyword: this.keyword,
  1896. status: this.status,
  1897. // role: this.role
  1898. roleId: this.roleId,
  1899. onlyDirect: this.onlyDirect ? "1" : "0",
  1900. },
  1901. (res) => {
  1902. this.listLoading = false;
  1903. if (res.code == "ok") {
  1904. this.list = res.data.records;
  1905. this.total = res.data.total;
  1906. } else {
  1907. this.$message({
  1908. message: res.msg,
  1909. type: "error",
  1910. });
  1911. }
  1912. },
  1913. (error) => {
  1914. this.listLoading = false;
  1915. this.$message({
  1916. message: error,
  1917. type: "error",
  1918. });
  1919. }
  1920. );
  1921. },
  1922. resetPwd(user) {
  1923. this.$confirm(this.$t('wanttoor') + user.name + this.$t('resetyourpassword'), this.$t('saresetyourpassword'), {
  1924. confirmButtonText: this.$t('btn.determine'),
  1925. cancelButtonText: this.$t('btn.cancel'),
  1926. type: "warning",
  1927. })
  1928. .then(() => {
  1929. this.http.post(
  1930. "/user/resetPwd",
  1931. { userId: user.id },
  1932. (res) => {
  1933. if (res.code == "ok") {
  1934. this.$message({
  1935. message: this.$t('linglingling'),
  1936. type: "success",
  1937. });
  1938. } else {
  1939. this.$message({
  1940. message: res.msg,
  1941. type: "error",
  1942. });
  1943. }
  1944. },
  1945. (error) => {
  1946. this.listLoading = false;
  1947. this.$message({
  1948. message: error,
  1949. type: "error",
  1950. });
  1951. }
  1952. );
  1953. })
  1954. .catch(() => {});
  1955. },
  1956. // 新增、编辑人员
  1957. openInsertDialog(row) {
  1958. if (row != null) {
  1959. var list = JSON.parse(JSON.stringify(row)),
  1960. arr = [],
  1961. array = [];
  1962. if (list.departmentCascade != "0" && list.departmentCascade != null) {
  1963. if (list.departmentCascade.indexOf(",") > -1) {
  1964. arr = list.departmentCascade.split(",");
  1965. } else {
  1966. arr = [].concat(list.departmentCascade);
  1967. }
  1968. }
  1969. for (var i in arr) {
  1970. array.push(parseInt(arr[i]));
  1971. }
  1972. // console.log(list, '数据')
  1973. // this.insertForm = {
  1974. // id: list.id,
  1975. // name: list.name,
  1976. // phone: list.phone,
  1977. // // role: list.role,
  1978. // roleId: list.roleId,
  1979. // monthCost:list.monthCost,
  1980. // cost: list.cost,
  1981. // departmentId: array.reverse(),
  1982. // salaryType: list.salaryType,
  1983. // costApplyDate: list.costApplyDate,
  1984. // position: list.position
  1985. // };
  1986. this.addUserId = list.id;
  1987. this.http.post(
  1988. "/user/getUserInfo",
  1989. {
  1990. userId: list.id,
  1991. },
  1992. (res) => {
  1993. if (res.code == "ok") {
  1994. this.insertForm = {
  1995. id: res.data.id,
  1996. name: res.data.name,
  1997. phone: res.data.phone,
  1998. roleId: res.data.roleId,
  1999. monthCost: res.data.monthCost,
  2000. cost: res.data.cost,
  2001. departmentId: array.reverse(),
  2002. salaryType: res.data.salaryType,
  2003. costApplyDate: res.data.costApplyDate,
  2004. // inductionDate: res.data.inductionDate,
  2005. position: res.data.position,
  2006. certJson: res.data.certList,
  2007. plateMap: {},
  2008. superiorId: res.data.superiorId,
  2009. plate1: res.data.plate1,
  2010. plate2: res.data.plate2,
  2011. plate3: res.data.plate3,
  2012. plate4: res.data.plate4,
  2013. plate5: res.data.plate5,
  2014. jobNumber: res.data.jobNumber
  2015. };
  2016. this.$set(this.insertForm, 'inductionDate', res.data.inductionDate)
  2017. this.getUserCustomConfig(1);
  2018. } else {
  2019. this.$message({
  2020. message: res.msg,
  2021. type: "error",
  2022. });
  2023. }
  2024. },
  2025. (error) => {
  2026. this.listLoading = false;
  2027. this.$message({
  2028. message: error,
  2029. type: "error",
  2030. });
  2031. }
  2032. );
  2033. this.title = this.$t('editorialstaff');
  2034. } else {
  2035. this.addUserId = "";
  2036. this.insertForm = {
  2037. id: null,
  2038. name: null,
  2039. phone: null,
  2040. // role: null,
  2041. roleId: null,
  2042. monthCost: null,
  2043. cost: null,
  2044. departmentId: null,
  2045. salaryType: 0,
  2046. costApplyDate: util.formatDate.format(new Date(), "yyyy-MM-dd"),
  2047. inductionDate: util.formatDate.format(new Date(), "yyyy-MM-dd"),
  2048. position: "",
  2049. certJson: [],
  2050. plateMap: {},
  2051. plate1: null,
  2052. plate2: null,
  2053. plate3: null,
  2054. plate4: null,
  2055. plate5: null,
  2056. jobNumber:null,
  2057. };
  2058. this.title = this.$t('addorialstaff');
  2059. this.getUserCustomConfig();
  2060. // this.insertForm.plateMap['定义测试文本'] = '测试文本'
  2061. // console.log('insertForm',this.insertForm);
  2062. }
  2063. this.dialogVisible = true;
  2064. console.log(this.insertForm);
  2065. },
  2066. submitInsert() {
  2067. var form = {};
  2068. var ssR = this.upRepeat(this.insertForm.certJson);
  2069. var trs = true;
  2070. this.$refs.form12.validate((valid) => {
  2071. if (valid) {
  2072. this.submitLoading = true;
  2073. if (ssR) {
  2074. this.$message({
  2075. message: this.$t('repeat'),
  2076. type: "error",
  2077. });
  2078. this.submitLoading = false;
  2079. return false;
  2080. }
  2081. for (var s in this.insertForm.certJson) {
  2082. if (
  2083. !this.insertForm.certJson[s].certDate ||
  2084. !this.insertForm.certJson[s].certId
  2085. ) {
  2086. trs = false;
  2087. }
  2088. }
  2089. if (!trs) {
  2090. this.$message({
  2091. message: this.$t('certificateisincomplete'),
  2092. type: "error",
  2093. });
  2094. this.submitLoading = false;
  2095. return false;
  2096. }
  2097. form = {
  2098. name: this.insertForm.name,
  2099. phone: this.insertForm.phone,
  2100. // role: this.insertForm.role,
  2101. roleId: this.insertForm.roleId,
  2102. monthCost: this.insertForm.monthCost,
  2103. cost: this.insertForm.cost,
  2104. salaryType: this.insertForm.salaryType,
  2105. position: this.insertForm.position,
  2106. certJson: JSON.stringify(this.insertForm.certJson),
  2107. // certJson: this.insertForm.certJson
  2108. inductionDate: this.insertForm.inductionDate,
  2109. plate1: this.insertForm.plate1,
  2110. plate2: this.insertForm.plate2,
  2111. plate3: this.insertForm.plate3,
  2112. plate4: this.insertForm.plate4,
  2113. plate5: this.insertForm.plate5,
  2114. jobNumber: this.insertForm.jobNumber,
  2115. };
  2116. // for(let i=0;i<5;i++) {
  2117. // if(this.insertFormPlates[i]){
  2118. // form[this.suoying[i]] = this.insertFormPlates[i]
  2119. // }
  2120. // }
  2121. // console.log(form, 'form')
  2122. if (this.insertForm.id != null) {
  2123. form.id = this.insertForm.id;
  2124. }
  2125. if (this.insertForm.superiorId) {
  2126. form.superiorId = this.insertForm.superiorId;
  2127. }
  2128. if (this.insertForm.costApplyDate != null) {
  2129. form.costApplyDate = this.insertForm.costApplyDate;
  2130. }
  2131. if (this.insertForm.departmentId != null) {
  2132. form.departmentId =
  2133. this.insertForm.departmentId[
  2134. this.insertForm.departmentId.length - 1
  2135. ];
  2136. }
  2137. if (!ssR && trs) {
  2138. this.http.post(
  2139. this.port.manage.insert,
  2140. form,
  2141. (res) => {
  2142. this.submitLoading = false;
  2143. if (res.code == "ok") {
  2144. this.$message({
  2145. message:
  2146. this.insertForm.id != null ? this.$t('xiu-gai') : this.$t('create') + this.$t('other.successful'),
  2147. type: "success",
  2148. });
  2149. this.dialogVisible = false;
  2150. this.getUser();
  2151. this.getUsers();
  2152. } else {
  2153. this.$message({
  2154. message: res.msg,
  2155. type: "error",
  2156. });
  2157. }
  2158. },
  2159. (error) => {
  2160. this.listLoading = false;
  2161. this.$message({
  2162. message: error,
  2163. type: "error",
  2164. });
  2165. }
  2166. );
  2167. }
  2168. }
  2169. });
  2170. // console.log(form, '提交的数据')
  2171. // return
  2172. // console.log(ssR, trs)
  2173. },
  2174. // 切换角色
  2175. switchRole(index) {
  2176. this.listLoading = true;
  2177. this.http.post(
  2178. this.port.manage.permission,
  2179. { id: this.list[index].id },
  2180. (res) => {
  2181. this.listLoading = false;
  2182. if (res.code == "ok") {
  2183. this.$message({
  2184. message: this.$t('switchingroles'),
  2185. type: "success",
  2186. });
  2187. //重新读取列表
  2188. this.getUser();
  2189. } else {
  2190. this.$message({
  2191. message: res.msg,
  2192. type: "error",
  2193. });
  2194. }
  2195. },
  2196. (error) => {
  2197. this.listLoading = false;
  2198. this.$message({
  2199. message: error,
  2200. type: "error",
  2201. });
  2202. }
  2203. );
  2204. },
  2205. // 删除用户
  2206. setActive(item, isActive) {
  2207. var txt = isActive == 1 ? this.$t('enable') : this.$t('ting-yong');
  2208. this.$confirm(this.$t('sureyouwantto') + txt + " " + item.name + this.$t('ma'), this.$t('zhang-hao') + txt, {
  2209. confirmButtonText: this.$t('btn.determine'),
  2210. cancelButtonText: this.$t('btn.cancel'),
  2211. type: "warning",
  2212. })
  2213. .then(() => {
  2214. this.listLoading = true;
  2215. this.http.post(
  2216. "/user/setActive",
  2217. { id: item.id, isActive: isActive },
  2218. (res) => {
  2219. this.listLoading = false;
  2220. if (res.code == "ok") {
  2221. this.$message({
  2222. message: txt + this.$t('other.successful'),
  2223. type: "success",
  2224. });
  2225. //重新读取列表
  2226. this.getUser();
  2227. } else {
  2228. this.$message({
  2229. message: res.msg,
  2230. type: "error",
  2231. });
  2232. }
  2233. },
  2234. (error) => {
  2235. this.listLoading = false;
  2236. this.$message({
  2237. message: error,
  2238. type: "error",
  2239. });
  2240. }
  2241. );
  2242. })
  2243. .catch(() => {});
  2244. },
  2245. // 修改老板的成本
  2246. openInsertDialog1(row) {
  2247. var list1 = JSON.parse(JSON.stringify(row)),
  2248. arr1 = [],
  2249. array1 = [];
  2250. if (list1.departmentCascade != "0" && list1.departmentCascade != null) {
  2251. if (list1.departmentCascade.indexOf(",") > -1) {
  2252. arr1 = list1.departmentCascade.split(",");
  2253. } else {
  2254. arr1 = [].concat(list1.departmentCascade);
  2255. }
  2256. }
  2257. for (var i in arr1) {
  2258. array1.push(parseInt(arr1[i]));
  2259. }
  2260. this.http.post(
  2261. "/user/getUserInfo",
  2262. {
  2263. userId: list1.id,
  2264. },
  2265. (res) => {
  2266. if (res.code == "ok") {
  2267. this.insertForm = {
  2268. id: res.data.id,
  2269. name: res.data.name,
  2270. phone: res.data.phone,
  2271. roleId: res.data.roleId,
  2272. monthCost: res.data.monthCost,
  2273. cost: res.data.cost,
  2274. departmentId: array1.reverse(),
  2275. salaryType: res.data.salaryType,
  2276. costApplyDate: res.data.costApplyDate,
  2277. inductionDate: res.data.inductionDate,
  2278. position: res.data.position,
  2279. certJson: res.data.certList,
  2280. plateMap: {},
  2281. superiorId: res.data.superiorId,
  2282. jobNumber: res.data.jobNumber,
  2283. };
  2284. } else {
  2285. this.$message({
  2286. message: res.msg,
  2287. type: "error",
  2288. });
  2289. }
  2290. },
  2291. (error) => {
  2292. this.listLoading = false;
  2293. this.$message({
  2294. message: error,
  2295. type: "error",
  2296. });
  2297. }
  2298. );
  2299. // console.log(list1)
  2300. // this.insertForm = {
  2301. // id: list1.id,
  2302. // name: list1.name,
  2303. // phone: list1.phone,
  2304. // roleId: list1.roleId,
  2305. // monthCost:list1.monthCost,
  2306. // cost: list1.cost,
  2307. // departmentId: array1.reverse(),
  2308. // salaryType: list1.salaryType,
  2309. // name: list1.name,
  2310. // position: list1.position,
  2311. // certJson: list1.certJson
  2312. // };
  2313. this.dialogVisible1 = true;
  2314. },
  2315. submitInsert1() {
  2316. var form = {};
  2317. this.$refs.form1.validate((valid) => {
  2318. if (valid) {
  2319. this.submitLoading = true;
  2320. form = {
  2321. id: this.insertForm.id,
  2322. name: this.insertForm.name,
  2323. phone: this.insertForm.phone,
  2324. roleId: this.insertForm.roleId,
  2325. monthCost: this.insertForm.monthCost,
  2326. cost: this.insertForm.cost,
  2327. position: this.insertForm.position,
  2328. certJson: this.insertForm.certJson,
  2329. inductionDate: this.insertForm.inductionDate,
  2330. jobNumber: this.insertForm.jobNumber,
  2331. };
  2332. if (this.insertForm.departmentId != null) {
  2333. form.departmentId =
  2334. this.insertForm.departmentId[
  2335. this.insertForm.departmentId.length - 1
  2336. ];
  2337. }
  2338. if (this.insertForm.costApplyDate != null) {
  2339. form.costApplyDate = this.insertForm.costApplyDate;
  2340. }
  2341. if (this.insertForm.superiorId) {
  2342. form.superiorId = this.insertForm.superiorId;
  2343. }
  2344. this.http.post(
  2345. this.port.manage.insert,
  2346. form,
  2347. (res) => {
  2348. this.submitLoading = false;
  2349. if (res.code == "ok") {
  2350. this.$message({
  2351. message: this.$t('message.modifyTheSuccess'),
  2352. type: "success",
  2353. });
  2354. this.dialogVisible1 = false;
  2355. //重新读取列表
  2356. this.getUser();
  2357. this.getUsers();
  2358. } else {
  2359. this.$message({
  2360. message: res.msg,
  2361. type: "error",
  2362. });
  2363. }
  2364. },
  2365. (error) => {
  2366. this.listLoading = false;
  2367. this.$message({
  2368. message: error,
  2369. type: "error",
  2370. });
  2371. }
  2372. );
  2373. }
  2374. });
  2375. },
  2376. // 获取部门列表
  2377. getDepartment() {
  2378. this.http.post(
  2379. this.port.manage.depList,
  2380. {},
  2381. (res) => {
  2382. if (res.code == "ok") {
  2383. var list = res.data,
  2384. list1 = JSON.parse(JSON.stringify(res.data));
  2385. list.splice(0, 0, {
  2386. id: -1,
  2387. label: this.$t('lable.allStaff'),
  2388. });
  2389. list.push({
  2390. id: 0,
  2391. label: this.$t('lable.unassigned'),
  2392. });
  2393. this.data = list;
  2394. console.log(list, "部门数据")
  2395. this.option = this.changeArr(list1);
  2396. } else {
  2397. this.$message({
  2398. message: res.msg,
  2399. type: "error",
  2400. });
  2401. }
  2402. },
  2403. (error) => {
  2404. this.$message({
  2405. message: error,
  2406. type: "error",
  2407. });
  2408. }
  2409. );
  2410. },
  2411. // 修改数组
  2412. changeArr(arr) {
  2413. for (var i = 0; i < arr.length; i++) {
  2414. if (arr[i].id != -1 && arr[i].id != 0) {
  2415. if (arr[i].children != null && arr[i].children.length > 0) {
  2416. arr[i].children = this.changeArr(arr[i].children);
  2417. }
  2418. arr[i].id && (arr[i].value = arr[i].id);
  2419. delete arr[i].id;
  2420. }
  2421. }
  2422. for (var i in arr) {
  2423. if (arr[i].id == -1 || arr[i].id == 0) {
  2424. arr.splice(i, 1);
  2425. }
  2426. }
  2427. return arr;
  2428. },
  2429. // 部门列表点击
  2430. handleNodeClick(data) {
  2431. if (this.depData == null || data.id != this.depData.id) {
  2432. this.depData = data;
  2433. this.page = 1;
  2434. this.getUser();
  2435. }
  2436. },
  2437. // 新增、修改部门
  2438. createDepartment(i) {
  2439. console.log(i, '看看')
  2440. setTimeout(() => {
  2441. var that = this;
  2442. if (i == -2) {
  2443. //创建子部门
  2444. that.depForm = {
  2445. id: null,
  2446. name: null,
  2447. parentId: null,
  2448. managerId: null,
  2449. };
  2450. if (that.depData.id != -1 && that.depData.id != 0) {
  2451. that.depForm.parentId = that.depData.id;
  2452. }
  2453. that.depTitle = this.$t('subdepartment');
  2454. } else if (i == -1) {
  2455. //创建一级部门
  2456. that.depForm = {
  2457. id: null,
  2458. name: null,
  2459. parentId: null,
  2460. managerId: null,
  2461. };
  2462. that.depTitle = this.$t('addsubdepartment');
  2463. } else {
  2464. console.log(that.depData, '看看值')
  2465. if (that.depData.managerId == "null") {
  2466. that.depData.managerId = "";
  2467. }
  2468. if (that.depData.reportAuditUserid == "null") {
  2469. that.depData.reportAuditUserid = "";
  2470. }
  2471. that.depForm = {
  2472. id: that.depData.id,
  2473. name: that.depData.label,
  2474. parentId: that.depData.parentId,
  2475. managerId: that.depData.managerId,
  2476. reportAuditUserid: that.depData.reportAuditUserid,
  2477. }
  2478. if(that.depData.otherManagerIds) {
  2479. if(Array.isArray(that.depData.otherManagerIds)) {
  2480. this.$set(that.depForm, 'otherManagerIds', that.depData.otherManagerIds)
  2481. } else {
  2482. this.$set(that.depForm, 'otherManagerIds', that.depData.otherManagerIds.split(','))
  2483. }
  2484. } else {
  2485. this.$set(that.depForm, 'otherManagerIds', [])
  2486. }
  2487. // console.log('点击编辑的时候', that.depData)
  2488. // if(that.depData.reportAuditUserid != null && that.depData.reportAuditUserid != "null" && that.depData.reportAuditUserid.length > 0) {
  2489. // that.depForm.reportAuditUserid = that.depData.reportAuditUserid
  2490. // }
  2491. that.depTitle = this.$t('editorialdepartment');
  2492. }
  2493. that.departmentVisible = true;
  2494. });
  2495. // if(i == -2) {//创建子部门
  2496. // this.depForm = {
  2497. // id: null,
  2498. // name: null,
  2499. // parentId: null,
  2500. // managerId: null,
  2501. // }
  2502. // if(this.depData.id != -1 && this.depData.id != 0) {
  2503. // this.depForm.parentId = this.depData.id;
  2504. // }
  2505. // this.depTitle = "新增子部门";
  2506. // } else if(i == -1) {//创建一级部门
  2507. // this.depForm = {
  2508. // id: null,
  2509. // name: null,
  2510. // parentId: null,
  2511. // managerId: null,
  2512. // }
  2513. // this.depTitle = "新增部门";
  2514. // } else {
  2515. // if(this.depData.managerId == "null") {
  2516. // this.depData.managerId = ''
  2517. // }
  2518. // if(this.depData.reportAuditUserid == "null") {
  2519. // this.depData.reportAuditUserid = ''
  2520. // }
  2521. // this.depForm = {
  2522. // id: this.depData.id,
  2523. // name: this.depData.label,
  2524. // parentId: this.depData.parentId,
  2525. // managerId: this.depData.managerId,
  2526. // reportAuditUserid: this.depData.reportAuditUserid
  2527. // }
  2528. // // if(this.depData.reportAuditUserid != null && this.depData.reportAuditUserid != "null" && this.depData.reportAuditUserid.length > 0) {
  2529. // // this.depForm.reportAuditUserid = this.depData.reportAuditUserid
  2530. // // }
  2531. // this.depTitle = "编辑部门";
  2532. // }
  2533. // this.departmentVisible = true;
  2534. },
  2535. submitDepartment() {
  2536. this.$refs.depForm.validate((valid) => {
  2537. if (valid) {
  2538. var form = {
  2539. name: this.depForm.name,
  2540. };
  2541. if (this.depForm.id != null) {
  2542. form.id = this.depForm.id;
  2543. }
  2544. if (this.depForm.parentId != null) {
  2545. form.parentId = this.depForm.parentId;
  2546. }
  2547. if (this.depForm.managerId) {
  2548. form.managerId = this.depForm.managerId;
  2549. }
  2550. // console.log(this.depForm)
  2551. if (this.depForm.reportAuditUserid && this.user.timeType.needDeptAudit) {
  2552. form.reportAuditUserid = this.depForm.reportAuditUserid;
  2553. }
  2554. // 其他负责人
  2555. if(this.depForm.otherManagerIds) {
  2556. form.otherManagerIds = this.depForm.otherManagerIds.toString();
  2557. }
  2558. this.http.post(
  2559. this.depForm.id == null
  2560. ? this.port.manage.add
  2561. : this.port.manage.edit,
  2562. form,
  2563. (res) => {
  2564. if (res.code == "ok") {
  2565. this.$message({
  2566. message: this.depForm.id == null ? this.$t('newsuccess') : this.$t('message.modifyTheSuccess'),
  2567. type: "success",
  2568. });
  2569. this.departmentVisible = false;
  2570. if (this.depForm.id != null) {
  2571. this.depData.label = form.name;
  2572. this.depData.managerId = form.managerId;
  2573. this.depData.otherManagerIds = form.otherManagerIds;
  2574. }
  2575. this.getDepartment();
  2576. } else {
  2577. this.$message({
  2578. message: res.msg,
  2579. type: "error",
  2580. });
  2581. }
  2582. },
  2583. (error) => {
  2584. this.listLoading = false;
  2585. this.$message({
  2586. message: error,
  2587. type: "error",
  2588. });
  2589. }
  2590. );
  2591. }
  2592. });
  2593. },
  2594. // 删除部门
  2595. deleteDep() {
  2596. var that = this;
  2597. setTimeout(() => {
  2598. that
  2599. .$confirm(this.$t('deletethedepartment') + that.depData.label + this.$t('ma'), this.$t('deletethedepartmentdsa'), {
  2600. confirmButtonText: this.$t('btn.determine'),
  2601. cancelButtonText: this.$t('btn.cancel'),
  2602. type: "warning",
  2603. })
  2604. .then(() => {
  2605. that.listLoading = true;
  2606. that.http.post(
  2607. that.port.manage.del,
  2608. { id: that.depData.id },
  2609. (res) => {
  2610. that.listLoading = false;
  2611. if (res.code == "ok") {
  2612. that.$message({
  2613. message: this.$t('message.successfullyDeleted'),
  2614. type: "success",
  2615. });
  2616. that.depData = {
  2617. id: -1,
  2618. label: this.$t('lable.allStaff'),
  2619. };
  2620. that.getDepartment();
  2621. that.getUser();
  2622. } else {
  2623. that.$message({
  2624. message: res.msg,
  2625. type: "error",
  2626. });
  2627. }
  2628. },
  2629. (error) => {
  2630. that.listLoading = false;
  2631. that.$message({
  2632. message: error,
  2633. type: "error",
  2634. });
  2635. }
  2636. );
  2637. })
  2638. .catch(() => {});
  2639. }, 100);
  2640. // this.$confirm( "确定要删除部门" + this.depData.label + "吗?", "删除部门", {
  2641. // confirmButtonText: "确定",
  2642. // cancelButtonText: "取消",
  2643. // type: "warning"
  2644. // })
  2645. // .then(() => {
  2646. // this.listLoading = true;
  2647. // this.http.post( this.port.manage.del, { id: this.depData.id },
  2648. // res => {
  2649. // this.listLoading = false;
  2650. // if (res.code == "ok") {
  2651. // this.$message({
  2652. // message: "删除成功",
  2653. // type: "success"
  2654. // });
  2655. // this.depData = {
  2656. // id: -1,
  2657. // label: '全部人员',
  2658. // }
  2659. // this.getDepartment();
  2660. // this.getUser();
  2661. // } else {
  2662. // this.$message({
  2663. // message: res.msg,
  2664. // type: "error"
  2665. // });
  2666. // }
  2667. // },
  2668. // error => {
  2669. // this.listLoading = false;
  2670. // this.$message({
  2671. // message: error,
  2672. // type: "error"
  2673. // });
  2674. // });
  2675. // })
  2676. // .catch(() => {});
  2677. },
  2678. // 关键搜索
  2679. searchList() {
  2680. // console.log(this.keyword)
  2681. this.listLoading = true;
  2682. this.http.post(
  2683. this.port.manage.list,
  2684. {
  2685. departmentId: this.depData.id,
  2686. pageIndex: this.page,
  2687. pageSize: this.size,
  2688. keyword: this.keyword,
  2689. status: this.status
  2690. },
  2691. (res) => {
  2692. this.listLoading = false;
  2693. if (res.code == "ok") {
  2694. this.list = res.data.records;
  2695. this.total = res.data.total;
  2696. } else {
  2697. this.$message({
  2698. message: res.msg,
  2699. type: "error",
  2700. });
  2701. }
  2702. },
  2703. (error) => {
  2704. this.listLoading = false;
  2705. this.$message({
  2706. message: error,
  2707. type: "error",
  2708. });
  2709. }
  2710. );
  2711. },
  2712. // 获取角色
  2713. acquireRole() {
  2714. // this.http.post('/permission/getFrontRoleList', {
  2715. this.http.post(
  2716. "/permission/getFrontRoleList",
  2717. {
  2718. companyId: this.user.companyId,
  2719. },
  2720. (res) => {
  2721. if (res.code == "ok") {
  2722. // console.log(res.data, '获取角色')
  2723. this.acquireRoleList = res.data;
  2724. var arr = [];
  2725. for (var i in res.data) {
  2726. if (res.data[i].rolename != this.$t('role.systemAdministrator')) {
  2727. arr.push(res.data[i]);
  2728. }
  2729. }
  2730. this.acquireRoleLists = arr;
  2731. } else {
  2732. this.$message({
  2733. message: res.msg,
  2734. type: "error",
  2735. });
  2736. }
  2737. },
  2738. (error) => {
  2739. this.$message({
  2740. message: error,
  2741. type: "error",
  2742. });
  2743. }
  2744. );
  2745. },
  2746. // 获取专业分类
  2747. getProfessional() {
  2748. this.http.post(
  2749. "/company-cert/list",
  2750. {},
  2751. (res) => {
  2752. if (res.code == "ok") {
  2753. this.managementTableData = res.data;
  2754. } else {
  2755. this.$message({
  2756. message: res.msg,
  2757. type: "error",
  2758. });
  2759. }
  2760. },
  2761. (error) => {
  2762. this.$message({
  2763. message: error,
  2764. type: "error",
  2765. });
  2766. }
  2767. );
  2768. },
  2769. addManagementDiologs() {
  2770. this.managementForm = { name: "" };
  2771. this.addManagementDiolog = true;
  2772. },
  2773. // 新增/编辑人员专业费雷
  2774. addManagementForm(formName) {
  2775. this.$refs[formName].validate((valid) => {
  2776. if (valid) {
  2777. this.http.post(
  2778. "/company-cert/addOrMod",
  2779. this.managementForm,
  2780. (res) => {
  2781. if (res.code == "ok") {
  2782. this.$message({
  2783. message: this.$t('operationissuccessful'),
  2784. type: "success",
  2785. });
  2786. this.getProfessional();
  2787. this.addManagementDiolog = false;
  2788. } else {
  2789. this.$message({
  2790. message: res.msg,
  2791. type: "error",
  2792. });
  2793. }
  2794. },
  2795. (error) => {
  2796. this.$message({
  2797. message: error,
  2798. type: "error",
  2799. });
  2800. }
  2801. );
  2802. } else {
  2803. // console.log('error submit!!');
  2804. return false;
  2805. }
  2806. });
  2807. },
  2808. // 编辑
  2809. editorManagementForm(item) {
  2810. this.managementForm = item;
  2811. this.addManagementDiolog = true;
  2812. },
  2813. // 删除专业
  2814. deteManagementForm(item) {
  2815. this.$confirm(
  2816. this.$t('operationmaycausedatalossAreyousuredeletethedata'),
  2817. this.$t('deletionofprofessionalcertificate'),
  2818. {
  2819. confirmButtonText: this.$t('btn.determine'),
  2820. cancelButtonText: this.$t('btn.cancel'),
  2821. type: "warning",
  2822. }
  2823. )
  2824. .then(() => {
  2825. this.http.post(
  2826. "/company-cert/delete",
  2827. {
  2828. id: item.id,
  2829. },
  2830. (res) => {
  2831. if (res.code == "ok") {
  2832. this.$message({
  2833. message: this.$t('operationissuccessful'),
  2834. type: "success",
  2835. });
  2836. this.getProfessional();
  2837. } else {
  2838. this.$message({
  2839. message: res.msg,
  2840. type: "error",
  2841. });
  2842. }
  2843. },
  2844. (error) => {
  2845. this.$message({
  2846. message: error,
  2847. type: "error",
  2848. });
  2849. }
  2850. );
  2851. })
  2852. .catch(() => {
  2853. this.$message({
  2854. type: "info",
  2855. message: this.$t('thedeletionhasbeencancelled'),
  2856. });
  2857. });
  2858. },
  2859. // 点击添加更多帧数
  2860. addCertificateList() {
  2861. var obj = {};
  2862. obj.certId = "";
  2863. obj.certName = "";
  2864. obj.certDate = "";
  2865. obj.id = "";
  2866. obj.userId = this.addUserId;
  2867. this.insertForm.certJson.push(obj);
  2868. },
  2869. // 选择专业帧数
  2870. changeManagement(is) {
  2871. var id = this.insertForm.certJson[is].certId;
  2872. for (var i in this.managementTableData) {
  2873. if (this.managementTableData[i].id == id) {
  2874. this.insertForm.certJson[is].certName =
  2875. this.managementTableData[i].name;
  2876. }
  2877. }
  2878. },
  2879. // 查重复
  2880. upRepeat(arr) {
  2881. var obj = {};
  2882. for (var i in arr) {
  2883. if (obj[arr[i].certName]) {
  2884. return true;
  2885. }
  2886. obj[arr[i].certName] = true;
  2887. }
  2888. return false;
  2889. },
  2890. // 删除帧数
  2891. deteFrames(i) {
  2892. this.insertForm.certJson.splice(i, 1);
  2893. },
  2894. getStaffCountMax() {
  2895. this.http.post(
  2896. "/company/getStaffCountMax",
  2897. {companyId:this.user.companyId},
  2898. (res) => {
  2899. if (res.code == "ok") {
  2900. this.user.company.staffCountMax = res.data;
  2901. }
  2902. },
  2903. (error) => {
  2904. this.$message({
  2905. message: error,
  2906. type: "error",
  2907. });
  2908. }
  2909. );
  2910. },
  2911. // 获取企业微信的参数
  2912. agentConfig() {
  2913. var curUrl = location.href.split("#")[0];
  2914. this.http.post("/wxcorp/getCorpWXConfig", {url: curUrl, token: this.user.id}, (res) => {
  2915. if (res.code == "ok") {
  2916. this.tixtass = "config,进入"
  2917. wx.config({
  2918. beta: true,
  2919. debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
  2920. appId: res.data.appid, // 必填,公众号的唯一标识
  2921. timestamp: res.data.timestamp, // 必填,生成签名的时间戳
  2922. nonceStr: res.data.noncestr, // 必填,生成签名的随机串
  2923. signature: res.data.sign, // 必填,签名,见附录1
  2924. jsApiList: ['chooseImage','previewImage','uploadImage','downloadImage','previewFile','getLocation','agentConfig']
  2925. });
  2926. var that = this;
  2927. wx.ready(function(){
  2928. // config信息验证后会执行ready方法,所有接口调用都必须在config接口获得结果之后,config是一个客户端的异步操作,所以如果需要在页面加载时就调用相关接口,则须把相关接口放在ready函数中调用来确保正确执行。对于用户触发时才调用的接口,则可以直接调用,不需要放在ready函数中。
  2929. // if (that.user.companyId == 7) {
  2930. // that.$toast('wx init success==7 ');
  2931. // that.getLocation();
  2932. // }
  2933. that.getagentConfigs()
  2934. });
  2935. }
  2936. }, (error) => {
  2937. console.log(error, '哦耶')
  2938. })
  2939. },
  2940. getagentConfigs() {
  2941. this.tixtass = "进了"
  2942. var curUrl = location.href.split("#")[0];
  2943. let urls = curUrl + '&debug=1'
  2944. this.http.post("/wxcorp/getCorpWXAgentConfig", {url: urls, token: this.user.id}, (res) => {
  2945. if (res.code == "ok") {
  2946. this.tixtass = "处理"
  2947. console.log()
  2948. wx.agentConfig({
  2949. corpid: res.data.corpid, // 必填,企业微信的corpid,必须与当前登录的企业一致
  2950. agentid: res.data.agentid, // 必填,企业微信的应用id (e.g. 1000247)
  2951. timestamp: res.data.timestamp, // 必填,生成签名的时间戳
  2952. nonceStr: res.data.nonceStr, // 必填,生成签名的随机串
  2953. signature: res.data.signature, // 必填,签名,见附录-JS-SDK使用权限签名算法
  2954. jsApiList: ['selectExternalContact'], //必填,传入需要使用的接口名称
  2955. success: function (result) {
  2956. console.log(result, '请求微信成功')
  2957. this.tixtass = '注入'
  2958. // wx.agentConfig成功回调后,WWOpenData 才会注入到 window 对象上面
  2959. window.WWOpenData.bind(document.querySelector('ww-open-data'))
  2960. },
  2961. fail: function (res) {
  2962. this.tixtass = "错误了"
  2963. console.log('查看错误信息', res)
  2964. if (res.errMsg.indexOf('function not exist') > -1) {
  2965. alert('版本过低请升级')
  2966. }
  2967. },
  2968. })
  2969. }
  2970. }, (error) => {
  2971. console.log('查看错误信息' + res)
  2972. this.tixtass = "失败"
  2973. if (error.errMsg.indexOf('function not exist') > -1) {
  2974. alert('版本过低请升级')
  2975. }
  2976. })
  2977. }
  2978. },
  2979. mounted() {
  2980. this.deactiveDate = util.formatDate.format(new Date(), "yyyy-MM-dd");
  2981. this.getDepartment();
  2982. this.getUser();
  2983. this.getCompanyTimeSetting();
  2984. this.getUsers();
  2985. this.acquireRole();
  2986. this.getProfessional();
  2987. this.getStaffCountMax();
  2988. // 获取企业微信的参数
  2989. if(this.user.companyId == '1081' || this.user.companyId == '7') {
  2990. this.agentConfig()
  2991. }
  2992. },
  2993. };
  2994. </script>
  2995. <style scoped>
  2996. .line {
  2997. width: 30px;
  2998. /* height: 500px; */
  2999. background: #f2f2f2;
  3000. cursor: w-resize;
  3001. }
  3002. .box-father {
  3003. border: 8px solid #000;
  3004. }
  3005. .line-second {
  3006. width: 10px;
  3007. /* background: red; */
  3008. }
  3009. .flex {
  3010. display: flex;
  3011. width: 100%;
  3012. }
  3013. .box-left {
  3014. flex: 0 0 400px;
  3015. /* height: 600px; */
  3016. /* background: blue; */
  3017. }
  3018. .box-right {
  3019. /* height: 600px; */
  3020. /* background: green; */
  3021. flex: 1;
  3022. }
  3023. .box-postion {
  3024. width: 200px;
  3025. /* height: 400px; */
  3026. background: #ccc;
  3027. }
  3028. </style>
  3029. <style lang="scss" scoped>
  3030. .imgFlex {
  3031. display: flex;
  3032. align-items: center;
  3033. }
  3034. .imgFlex p {
  3035. width: 100%;
  3036. text-align: center;
  3037. }
  3038. .imgFlex div {
  3039. padding: 10px;
  3040. display: flex;
  3041. align-content: space-between;
  3042. flex-wrap: wrap;
  3043. height: 600px;
  3044. }
  3045. .imgBor {
  3046. border-right: 1px solid #666;
  3047. border-left: 1px solid #666;
  3048. }
  3049. .custom-tree-node {
  3050. flex: 1;
  3051. display: flex;
  3052. align-items: center;
  3053. justify-content: space-between;
  3054. font-size: 14px;
  3055. padding-right: 8px;
  3056. }
  3057. .left {
  3058. border-right: 1px solid #f2f2f2;
  3059. overflow: hidden;
  3060. .department {
  3061. background:#f2f2f2;
  3062. line-height: 60px;
  3063. color:#666;
  3064. padding:0 10px;
  3065. height:60px;
  3066. font-size: 15px;
  3067. div {
  3068. float: right;
  3069. color: #20a0ff;
  3070. font-size: 14px;
  3071. cursor: pointer;
  3072. }
  3073. }
  3074. .tree {
  3075. overflow: auto;
  3076. }
  3077. }
  3078. .nowTime {
  3079. height: 40px;
  3080. line-height: 40px;
  3081. font-size: 16px;
  3082. color: #20a0ff;
  3083. margin-left: 10px;
  3084. cursor: pointer;
  3085. i {
  3086. margin-right: 10px;
  3087. }
  3088. }
  3089. .none {
  3090. display: none;
  3091. }
  3092. .block {
  3093. display: block;
  3094. }
  3095. </style>
  3096. <style lang="scss">
  3097. .tree {
  3098. .el-tree-node__label {
  3099. overflow-x: hidden;
  3100. white-space: nowrap;
  3101. text-overflow: ellipsis;
  3102. }
  3103. }
  3104. .el-divider--horizontal {
  3105. margin: 0px;
  3106. background:#f3f3f3;
  3107. }
  3108. //全局的作用范围
  3109. .el-tree-node__content {
  3110. height:36px;
  3111. }
  3112. .zhaunye {
  3113. display: flex;
  3114. justify-content: space-between;
  3115. padding: 0 5px 0 10px;
  3116. }
  3117. .certificateList {
  3118. width: 98%;
  3119. box-sizing: border-box;
  3120. margin: 0 10px 0 10px;
  3121. border: 1px solid rgb(194, 194, 194);
  3122. min-height: 200px;
  3123. max-height: 200px;
  3124. overflow: auto;
  3125. padding: 10px;
  3126. }
  3127. .moreAl {
  3128. display: flex;
  3129. width: 100%;
  3130. justify-content: center;
  3131. }
  3132. .moreLiList {
  3133. display: flex;
  3134. margin-bottom: 10px;
  3135. }
  3136. .moreLiList div {
  3137. line-height: 30px;
  3138. }
  3139. .moreLiList span {
  3140. display: inline-block;
  3141. margin-right: 15px;
  3142. }
  3143. .poAub {
  3144. position: absolute;
  3145. right: 10px;
  3146. }
  3147. </style>