index.vue 117 KB

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