index.vue 104 KB

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