index.vue 121 KB

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