index.vue 109 KB

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