index.vue 106 KB

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