index.vue 108 KB

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