index.vue 129 KB

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