index.vue 112 KB

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