index.vue 109 KB

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