list.vue 163 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481
  1. <template>
  2. <section>
  3. <!--工具条-->
  4. <el-col :span="24" class="toolbar" style="padding-bottom: 0px;">
  5. <el-form :inline="true">
  6. <el-form-item label="项目列表" class="toolbar_formitem_n1">
  7. </el-form-item>
  8. <el-form-item >
  9. <!-- <div style="display: flex;align-items: center;height: 40px;"> -->
  10. <div style="display: flex;align-items: center;height: 40px;">
  11. <el-input v-model="keyword" class="input-with-select" :placeholder="searchField == '1' ? '请输入项目名称关键字' : '请输入项目编号关键字'" clearable="true" size="small">
  12. <el-select v-model="searchField" style="width:120px;" slot="prepend" placeholder="请选择">
  13. <el-option label="项目名称" value=1 ></el-option>
  14. <el-option label="项目编号" value=2></el-option>
  15. </el-select>
  16. <el-button slot="append" @click="searchList" icon="el-icon-search"></el-button>
  17. </el-input>
  18. </div>
  19. </el-form-item>
  20. <el-form-item >
  21. <span style="margin-left:5px;margin-right:5px;color:#606266;">状态</span>
  22. <el-select v-model="status" style="width:110px;" placeholder="请选择" @change="searchList" size="small">
  23. <el-option label="全部" value=0 ></el-option>
  24. <el-option label="进行中" value=1 ></el-option>
  25. <el-option label="已完成" value=2 ></el-option>
  26. <el-option label="已撤销" value=3 ></el-option>
  27. <el-option label="已暂停" value=4 ></el-option>
  28. </el-select>
  29. </el-form-item>
  30. <!-- 主项目筛选 -->
  31. <el-form-item v-if="user.timeType.mainProjectState == '1'">
  32. <span style="margin-left:5px;margin-right:5px;color:#606266;">主项目</span>
  33. <el-select v-model="projectMainId" style="width:110px;" placeholder="请选择" clearable @change="searchClfList" size="small">
  34. <el-option v-for="item in mainProjectList" :key="item.id" :label="item.name" :value="item.id" ></el-option>
  35. </el-select>
  36. </el-form-item>
  37. <!-- 分类筛选 -->
  38. <el-form-item >
  39. <span style="margin-left:5px;margin-right:5px;color:#606266;">分类</span>
  40. <el-select v-model="statusClf" style="width:110px;" placeholder="请选择" clearable @change="searchClfList" size="small">
  41. <el-option v-for="item in baseClfList" :key="item.id" :label="item.name" :value="item.id" ></el-option>
  42. </el-select>
  43. </el-form-item>
  44. <!-- 分类条目 -->
  45. <!-- <el-form-item style="float:right;" v-if="permissions.projectClassification">
  46. <el-link type="primary" :underline="false" @click="showClfDialog = true">分类管理</el-link>
  47. </el-form-item>
  48. <el-form-item style="float:right;" v-if="user.company.packageProject == 1 && permissions.projectCostOfItems">
  49. <el-link type="primary" :underline="false" @click="showBaseCostItemDialog">基线成本项</el-link>
  50. </el-form-item>
  51. <el-form-item style="float:right;" v-if="permissions.projectExport">
  52. <el-link type="primary" style="margin-left:5px;" :underline="false" @click="exportProjectData" download="项目导出.xlsx">导出项目</el-link>
  53. </el-form-item>
  54. <el-form-item style="float:right;" v-if="permissions.projectImport">
  55. <el-link type="primary" style="margin-left:5px;" :underline="false" href="./upload/项目导入模板.xlsx" download="项目导入模板.xlsx">模板下载</el-link>
  56. </el-form-item>
  57. <el-form-item style="float:right;" v-if="permissions.projectImport">
  58. <el-upload ref="upload" style="margin-left:5px;" action="#" :limit="1" :http-request="importProject" :show-file-list="false">
  59. <el-link type="primary" :underline="false" >导入项目</el-link>
  60. </el-upload>
  61. </el-form-item> -->
  62. <el-form-item style="float:right;" v-if="permissions.projectImport || permissions.projectExport || permissions.projectClassification || (user.company.packageProject == 1 && permissions.projectCostOfItems)">
  63. <el-dropdown>
  64. <el-link type="primary" :underline="false">查看更多<i class="el-icon-arrow-down el-icon--right"></i></el-link>
  65. <el-dropdown-menu slot="dropdown">
  66. <el-dropdown-item v-if="permissions.projectImport">
  67. <el-upload ref="upload" action="#" :limit="1" :http-request="importProject" :show-file-list="false">
  68. <el-link type="primary" :underline="false" >导入项目</el-link>
  69. </el-upload>
  70. </el-dropdown-item>
  71. <el-dropdown-item v-if="permissions.projectImport">
  72. <el-link type="primary" :underline="false" @click="downloadmb" v-if="user.company.packageCustomer == 1 || user.company.packageProvider == 1 || user.timeType.mainProjectState == 1 || user.companyId == '936'">模板下载</el-link>
  73. <el-link type="primary" :underline="false" href="./upload/项目导入模板.xlsx" download="项目导入模板.xlsx" v-else>模板下载</el-link>
  74. </el-dropdown-item>
  75. <el-dropdown-item v-if="permissions.projectExport">
  76. <el-link type="primary" :underline="false" @click="exportProjectData" download="项目导出.xlsx">导出项目</el-link>
  77. </el-dropdown-item>
  78. <el-dropdown-item v-if="user.company.packageProject == 1 && permissions.projectCostOfItems">
  79. <el-link type="primary" :underline="false" @click="showBaseCostItemDialog">基线成本项</el-link>
  80. </el-dropdown-item>
  81. <el-dropdown-item v-if="permissions.projectClassification">
  82. <el-link type="primary" :underline="false" @click="showClfDialog = true">分类管理</el-link>
  83. </el-dropdown-item>
  84. <!-- <el-dropdown-item v-if="user.timeType.mainProjectState == 1 && !permissions.projectClassification"> -->
  85. <el-dropdown-item v-if="user.timeType.mainProjectState == 1">
  86. <el-link type="primary" :underline="false" @click="mainProjectDialog = true">主项目管理</el-link>
  87. </el-dropdown-item>
  88. <el-dropdown-item v-if="permissions.projectPhase && user.company.packageProject == 1">
  89. <el-link type="primary" :underline="false" @click="phaseProjectDialog = true">项目阶段管理</el-link>
  90. </el-dropdown-item>
  91. <el-dropdown-item v-if="user.timeType.projectLevelState == 1">
  92. <el-link type="primary" :underline="false" @click="projectLevelDialog = true">项目级别管理</el-link>
  93. </el-dropdown-item>
  94. </el-dropdown-menu>
  95. </el-dropdown>
  96. </el-form-item>
  97. <!-- <el-form-item style="float:right;" v-if="user.role == 1||user.role == 2||user.role == 5"> -->
  98. <el-form-item style="float:right;" v-if="permissions.projectNew">
  99. <el-link type="primary" :underline="false" @click="handleAdd(-1,null)">新增项目</el-link>
  100. </el-form-item>
  101. <el-form-item style="float:right;" v-if="permissions.projectResources">
  102. <!-- <router-link to="/projectGantt"> -->
  103. <el-link type="primary" :underline="false" @click="isganttshow = true">资源分配</el-link>
  104. <!-- </router-link> -->
  105. <el-dialog v-if="isganttshow" :visible.sync="isganttshow" width="90vw" top="3vh" style="height:96%" class="ganttdialog">
  106. <projectgantt></projectgantt>
  107. </el-dialog>
  108. </el-form-item>
  109. </el-form>
  110. </el-col>
  111. <!--列表-->
  112. <el-table ref="projectlistOfWudulist" @cell-mouse-enter="hoverCall" @cell-mouse-leave="handCall" @cell-click="clickCell" :cell-class-name="tableCellClassName" :data="list" highlight-current-row v-loading="listLoading" :height="tableHeight" style="width: 100%;" @selection-change="checkedWudulist" @sort-change="tableSort">
  113. <el-table-column type="selection" width="60" :selectable="isSelectable">
  114. <!-- creator 项目创建人 incharger 项目负责人 -->
  115. </el-table-column>
  116. <!-- <el-table-column type="index" width="60" v-else>
  117. <template slot-scope="scope" >
  118. {{scope.$index+1+(page-1)*size}}
  119. </template>
  120. </el-table-column> -->
  121. <el-table-column prop="projectCode" label="项目编号" sortable="custom" width="150"></el-table-column>
  122. <el-table-column prop="contractCode" label="合同编号" width="200" v-if="user.companyId == '936'">
  123. <template slot-scope="scope">
  124. <!-- <div v-if="scope.row.projectSeparate">
  125. {{scope.row.projectSeparate.contractCode}}
  126. </div> -->
  127. <div v-if="scope.row.projectSeparate">
  128. <div v-if="scope.row.projectSeparate.contractCode">
  129. <el-popover placement="top" width="400" trigger="hover" v-if="scope.row.projectSeparate.contractCode.length > 15">
  130. <div>
  131. <span>{{scope.row.projectSeparate.contractCode}}</span>
  132. </div>
  133. <div slot="reference" class="kans">
  134. <span>{{scope.row.projectSeparate.contractCode}}...</span>
  135. </div>
  136. </el-popover>
  137. <div v-else>
  138. <span>{{scope.row.projectSeparate.contractCode}}</span>
  139. </div>
  140. </div>
  141. </div>
  142. </template>
  143. </el-table-column>
  144. <el-table-column prop="categoryName" label="项目分类" sortable="custom" width="120"></el-table-column>
  145. <el-table-column prop="projectName" label="项目名称" width="250" sortable="custom">
  146. <template slot-scope="scope">
  147. <el-popover placement="top" width="400" trigger="hover" v-if="scope.row.projectName.length > 15">
  148. <div>
  149. <el-link type="primary" v-if="user.company.packageProject==1" :underline="false" :href="'#/projectInside/'+scope.row.id">{{scope.row.projectName}}</el-link>
  150. <span v-if="user.company.packageProject==0" >{{scope.row.projectName}}</span>
  151. </div>
  152. <div slot="reference" class="kans">
  153. <el-link type="primary" v-if="user.company.packageProject==1" :underline="false" :href="'#/projectInside/'+scope.row.id">{{scope.row.projectName.substring(0,15)}}...</el-link>
  154. <span v-if="user.company.packageProject==0" >{{scope.row.projectName.substring(0,15)}}...</span>
  155. </div>
  156. </el-popover>
  157. <div v-else>
  158. <el-link type="primary" v-if="user.company.packageProject==1" :underline="false" :href="'#/projectInside/'+scope.row.id">{{scope.row.projectName}}</el-link>
  159. <span v-if="user.company.packageProject==0" >{{scope.row.projectName}}</span>
  160. </div>
  161. </template>
  162. </el-table-column>
  163. <el-table-column prop="projectMainName" label="主项目" sortable="custom" min-width="250" v-if="user.timeType.mainProjectState == '1'">
  164. </el-table-column>
  165. <el-table-column prop="inchargerName" label="项目经理" sortable="custom" min-width="150">
  166. <template slot-scope="scope">
  167. <el-link type="primary" :underline="false" @click="showUser(scope.row.inchargerId)">{{scope.row.inchargerName}}</el-link>
  168. </template>
  169. </el-table-column>
  170. <!-- 项目阶段 -->
  171. <!-- 换位置之前看下项目阶段发起的请求 -->
  172. <el-table-column prop="currentStage" label="项目阶段" sortable="custom" min-width="150" width="220" v-if="user.company.packageProject == 1 && permissions.projectPhase">
  173. <template slot-scope="scope">
  174. <span style="display: inline-block; width: 150px">
  175. <el-select v-model="phaseProjectValie" v-if="scope.row.index + ',' + scope.column.index == currentCell" :ref="scope.row.index + ',' + scope.column.index" filterable placeholder="请选择项目阶段" size="mini" @blur="hideSelect" @change="selectChange">
  176. <el-option v-for="(item, index) in phaseList" :key="index" :label="item.projectStageName" :value="item.id"> </el-option>
  177. </el-select>
  178. <el-link v-else type="primary" :underline="false">{{scope.row.currentStageId == null ? '暂无' : scope.row.currentStageName}}</el-link>
  179. </span>
  180. <el-link v-if="(permissions.projectManagement || user.id==scope.row.inchargerId || user.id==scope.row.creatorId) && scope.row.index + ',' + scope.column.index != currentCell && rowid == scope.row.id" type="primary" :underline="false"><i class="el-icon-edit"></i></el-link>
  181. </template>
  182. </el-table-column>
  183. <el-table-column prop="participator" label="参与者" :min-width="user.company.packageCustomer != 1 ? '100' : '300'" sortable v-if="user.company.packageProject==0">
  184. <template slot-scope="scope">
  185. <!-- <v-for v-for="par in scope.row.participator" :key="par.id" >
  186. <el-link style="margin-right:10px;" type="primary" @click="showUser(par.id)">{{par.name}}</el-link>
  187. </v-for> -->
  188. <div v-if="scope.row.participator.length > 5">
  189. <el-popover placement="top" width="500" trigger="hover" v-if="scope.row.participator.length > 0">
  190. <span v-for="par in scope.row.participator" :key="par.id">
  191. <el-link style="margin-right:10px;" :underline="false" type="primary" @click="showUser(par.id)">{{par.name}}</el-link>
  192. </span>
  193. <div slot="reference" class="addss">
  194. <span v-for="par in scope.row.participator" :key="par.id">
  195. <el-link style="margin-right:10px;" :underline="false" type="primary" @click="showUser(par.id)">{{par.name}}</el-link>
  196. </span>
  197. </div>
  198. </el-popover>
  199. </div>
  200. <div v-else>
  201. <span v-for="par in scope.row.participator" :key="par.id" >
  202. <el-link style="margin-right:10px;" type="primary" :underline="false" @click="showUser(par.id)">{{par.name}}</el-link>
  203. </span>
  204. </div>
  205. </template>
  206. </el-table-column>
  207. <!-- 客户管理 -->
  208. <el-table-column prop="customerName" label="客户" min-width="190" v-if="user.company.packageCustomer == 1" sortable="custom">
  209. <template slot-scope="scope">
  210. <el-popover placement="top" width="250" trigger="hover" v-if="scope.row.customerName&&scope.row.customerName.length > 12">
  211. <div slot="reference" class="kans">
  212. <span >{{scope.row.customerName.substring(0,12)}}...</span>
  213. </div>
  214. <span >{{scope.row.customerName}}</span>
  215. </el-popover>
  216. <div v-else>
  217. <span >{{scope.row.customerName}}</span>
  218. </div>
  219. </template>
  220. </el-table-column>
  221. <!-- 级别 -->
  222. <el-table-column :prop="user.timeType.projectLevelState == 1 ? 'levelName' : 'level'" label="级别" min-width="190" v-if="user.company.packageProject == 1">
  223. <template slot-scope="scope">
  224. <span v-if="user.timeType.projectLevelState == 1">{{scope.row.levelName}}</span>
  225. <span v-else>{{importanceListLable[scope.row.level - 1]}}</span>
  226. </template>
  227. </el-table-column>
  228. <!-- 供应商 -->
  229. <!-- <el-table-column prop="providerNames" label="供应商" min-width="190" v-if="user.company.packageProvider">
  230. </el-table-column> -->
  231. <!-- <div v-if="user.company.packageProvider"> -->
  232. <template>
  233. <div v-for="(item, index) in listHeader" :key="index">
  234. <el-table-column prop="providerNames" :label="item" min-width="190" v-if="user.company.packageProvider">
  235. <template slot-scope="scope">
  236. <div>
  237. {{item | mobans(scope.row.providerInfoList)}}
  238. </div>
  239. </template>
  240. </el-table-column>
  241. </div>
  242. </template>
  243. <el-table-column prop="status" label="状态" min-width="100" sortable="custom">
  244. <template slot-scope="scope">
  245. {{scope.row.status == null?"-":statusTxt[scope.row.status]}}
  246. </template>
  247. </el-table-column>
  248. <!--专业项目协作-->
  249. <el-table-column prop="planStartDate" label="开始日期" min-width="96" >
  250. </el-table-column>
  251. <el-table-column prop="planEndDate" label="截止日期" min-width="96" >
  252. </el-table-column>
  253. <el-table-column prop="progress" label="完成度" min-width="100" v-if="user.company.packageProject == 1">
  254. <template slot-scope="scope">
  255. {{scope.row.progress==null?"-":scope.row.progress}}%
  256. </template>
  257. </el-table-column>
  258. <el-table-column label="操作" :width="showColumnWidth" align="left" fixed="right" v-if="showColumnWidth != '0' || permissions.projectManagement">
  259. <template slot-scope="scope">
  260. <el-button v-if="(permissions.projectManagement || user.id==scope.row.creatorId) && user.timeType.mainProjectState != '1'" size="mini" @click="subProject(scope.row)">子项目</el-button>
  261. <el-button size="mini" v-if="permissions.projectManagement || user.id==scope.row.inchargerId || user.id==scope.row.creatorId" type="primary" @click="handleAdd(scope.$index, scope.row)">编辑</el-button>
  262. <!-- <el-button v-if="permissions.projectManagement || user.id==scope.row.creatorId" size="mini" @click="deletePro(scope.$index, scope.row)">删除</el-button> -->
  263. <el-dropdown class="customdropdown" split-button size="mini" @click="finishPro(scope.row)" v-if="(permissions.projectManagement || user.id==scope.row.creatorId || user.id==scope.row.inchargerId) && scope.row.status == 1" placement="bottom-start">
  264. 完成
  265. <el-dropdown-menu slot="dropdown" class="customdropdown_menu">
  266. <el-button size="mini" @click="cancelPro(scope.row)" class="customdropdown_menu_btn">撤销</el-button><br>
  267. <el-button size="mini" @click="suspendPro(scope.row)" class="customdropdown_menu_btn">暂停</el-button><br>
  268. </el-dropdown-menu>
  269. </el-dropdown>
  270. <el-button v-if="(permissions.projectManagement || user.id==scope.row.inchargerId || user.id==scope.row.creatorId) && scope.row.status >= 2" size="mini" @click="restartPro(scope.row)">重启</el-button>
  271. </template>
  272. </el-table-column>
  273. </el-table>
  274. <!--工具条-->
  275. <el-col :span="24" class="toolbar">
  276. <el-button size="small" @click="batchSetWudulistBtn1" v-if="(user.timeType.customDegreeActive || user.company.packageProject) && (showColumnWidth != '0' || permissions.projectManagement)">取消</el-button>
  277. <template v-if="user.timeType.customDegreeActive && (showColumnWidth != '0' || permissions.projectManagement)">
  278. <el-button size="small" type="primary" @click="batchSetWudulistBtn2(true)">批量设置{{user.timeType.customDegreeName}}</el-button>
  279. <el-button size="small" type="primary" @click="batchSetWudulistBtn2(false)">批量添加{{user.timeType.customDegreeName}}</el-button>
  280. </template>
  281. <template v-if="user.company.packageProject && (showColumnWidth != '0' || permissions.projectManagement)">
  282. <el-button size="small" type="primary" @click="addGroupPerson()" :loading="addGroupPersonBtnLoading">批量添加分组参与人</el-button>
  283. <el-button size="small" type="primary" @click="addProPreson()">批量添加项目参与人</el-button>
  284. </template>
  285. <el-pagination
  286. @size-change="handleSizeChange"
  287. @current-change="handleCurrentChange"
  288. :page-sizes="[20 , 50 , 80 , 100]"
  289. :page-size="size"
  290. layout="total, sizes, prev, pager, next"
  291. :total="total"
  292. style="float:right;"
  293. ></el-pagination>
  294. </el-col>
  295. <!--新增界面-->
  296. <el-dialog :title="title" v-if="addFormVisible" :visible.sync="addFormVisible" :close-on-click-modal="false" customClass="customWidth" width="960px">
  297. <el-form ref="form1" :model="addForm" :rules="rules" label-width="120px">
  298. <el-form-item label="项目编号" >
  299. <el-input v-model="addForm.code" :disabled="!permissions.projectManagement && addForm.creatorId != user.id" placeholder="请输入项目编号" clearable></el-input>
  300. </el-form-item>
  301. <el-form-item label="主项目" v-if="user.timeType.mainProjectState == '1'">
  302. <el-select v-model="addForm.projectMainId" clearable :disabled="!permissions.projectManagement && addForm.creatorId != user.id" @change="projectManagementChange">
  303. <el-option v-for="(item) in mainProjectList" :key="item.id" :value="item.id" :label="item.name + '\u3000' + item.code">
  304. <span style="float: left; color: #8492a6; font-size: 13px;">{{ item.code }}</span>
  305. <span style="float: right;margin-left: 20px">{{ item.name }}</span>
  306. </el-option>
  307. </el-select>
  308. </el-form-item>
  309. <el-form-item label="项目分类" v-if="user.timeType.mainProjectState != '1'">
  310. <el-select v-model="addForm.category" style="width:32%;" clearable :disabled="!permissions.projectManagement && addForm.creatorId != user.id">
  311. <el-option v-for="(item) in baseClfList" :key="item.id" :value="item.id" :label="item.name"></el-option>
  312. </el-select>
  313. </el-form-item>
  314. <el-form-item label="项目名称" prop="name">
  315. <el-input v-model="addForm.name" :disabled="!permissions.projectManagement && addForm.creatorId != user.id" placeholder="请输入项目名称" clearable></el-input>
  316. </el-form-item>
  317. <el-form-item label="项目描述" prop="projectDesc">
  318. <el-input v-model="addForm.projectDesc" :disabled="!permissions.projectManagement && addForm.creatorId != user.id" placeholder="请输入项目描述" clearable maxlength="4000"></el-input>
  319. </el-form-item>
  320. <el-form-item label="项目类型" prop="isPublic">
  321. <el-select v-model="addForm.isPublic" style="width:32%;" @change="selectPublic" :disabled="!permissions.projectManagement && addForm.creatorId != user.id">
  322. <el-option :value="0" label="普通项目"></el-option>
  323. <el-option :value="1" label="公共项目"></el-option>
  324. </el-select>
  325. <el-tooltip effect="dark" content="普通项目只对参与人员开放,公共项目对所有成员开放" placement="top-start">
  326. <i class="el-icon-question"></i>
  327. </el-tooltip>
  328. <div v-if="user.company.packageCustomer == 1" style="display: inline-block;width: 50%">
  329. <span style="margin-left:63px;margin-right:10px;" >客户</span>
  330. <el-select v-model="addForm.customerId" clearable="true" filterable placeholder="请选择客户" style="width:70%;" >
  331. <el-option v-for="item in customerList" :key="item.id" :label="item.customerName" :value="item.id"></el-option>
  332. </el-select>
  333. </div>
  334. </el-form-item>
  335. <!-- 供应商 -->
  336. <!-- <el-form-item label="供应商" v-if="user.company.packageProvider">
  337. <el-select v-model="addForm.supplierId" multiple collapse-tags style="width:32%;" placeholder="请选择供应商">
  338. <el-option v-for="item in supplierList" :key="item.id" :label="item.providerName" :value="item.id">
  339. </el-option>
  340. </el-select>
  341. </el-form-item> -->
  342. <el-form-item label="供应商" v-if="user.company.packageProvider">
  343. <el-select v-model="addForm.supplierId" multiple placeholder="请选择" filterable="true" style="width: 100%">
  344. <span v-for="(item, index) in supplierList" :key="index">
  345. <el-option :label="item.providerName" :value="item.id"></el-option>
  346. </span>
  347. </el-select>
  348. </el-form-item>
  349. <el-form-item :label="yonghuUser.customDegreeName" v-if="yonghuUser.customDegreeActive == 1">
  350. <el-select v-model="auseList" multiple placeholder="请选择" filterable="true" style="width: 100%">
  351. <span v-for="(item, index) in ause" :key="index">
  352. <el-option :label="item.name" :value="item.id"></el-option>
  353. </span>
  354. </el-select>
  355. </el-form-item>
  356. <!-- <el-form-item label="客户" v-if="user.company.packageCustomer == 1">
  357. <el-select v-model="addForm.customerId" clearable="true" filterable placeholder="请选择客户" style="width:100%;" >
  358. <el-option v-for="item in customerList" :key="item.id" :label="item.customerName" :value="item.id"></el-option>
  359. </el-select>
  360. </el-form-item> -->
  361. <el-form-item label="全部参与者" v-show="addForm.isPublic == 0">
  362. <el-tooltip placement="top" effect="light">
  363. <div slot="content" style="width:780px">{{addForm.userNames}}</div>
  364. <el-input @focus="showChooseMembTree" v-model="addForm.userNames"></el-input>
  365. </el-tooltip>
  366. </el-form-item>
  367. <el-form-item label="项目经理" ><el-select v-model="addForm.inchargerId" :disabled="(addForm.userId.length==0 && addForm.isPublic == 0) || (!permissions.projectManagement && user.id != addForm.creatorId)" filterable placeholder="请选择项目经理" style="width:32%;" >
  368. <el-option v-for="item in participator" :key="item.id" :label="item.name" :value="item.id"></el-option>
  369. </el-select>
  370. </el-form-item>
  371. <el-form-item label="日报审核人" v-show="user.timeType.reportAuditType==0">
  372. <el-select v-model="addForm.auditUserIds" multiple="true" :disabled=" !(permissions.projectManagement|| user.id == addForm.inchargerId || user.id == addForm.creatorId)" filterable placeholder="默认为项目负责人" style="width:100%;" >
  373. <el-option v-for="item in participator" :key="item.id" :label="item.name" :value="item.id"></el-option>
  374. </el-select>
  375. </el-form-item>
  376. <!--专业项目协作版本功能 -->
  377. <el-form-item label="级别" v-if="user.company.packageProject==1">
  378. <el-select v-model="addForm.level" placeholder="请选择级别" style="width:32%;" v-if="user.timeType.projectLevelState == 1">
  379. <el-option v-for="item in levelList" :key="item.id" :label="item.projectLevelName" :value="item.id"></el-option>
  380. </el-select>
  381. <el-select v-model="addForm.level" placeholder="请选择级别" style="width:32%;" v-else>
  382. <el-option v-for="item in importanceList" :key="item.id" :label="item.label" :value="item.id"></el-option>
  383. </el-select>
  384. <!-- 增加合同金额字段 -->
  385. <span style="margin-left:63px;margin-right:10px;" v-if="user.company.packageProject==1">合同金额</span>
  386. <el-input id="contractAmount" v-model="addForm.contractAmount" style="width:33%;"
  387. placeholder="整数" clearable @keyup.native="restrictNumber('contractAmount')" :disabled="title == '新增项目' ? false : true"></el-input><span style="margin-left:10px;">元</span>
  388. <!-- 增加合同金额字段 -->
  389. </el-form-item>
  390. <el-form-item label="开始日期" prop="planStartDate" >
  391. <el-date-picker v-model="addForm.planStartDate"
  392. :editable="false" style="width:32%;"
  393. format="yyyy-MM-dd"
  394. value-format="yyyy-MM-dd"
  395. :clearable="false" type="date"
  396. placeholder="选择日期"></el-date-picker>
  397. <span style="margin-left:63px;margin-right:10px;" >截止日期</span>
  398. <el-date-picker v-model="addForm.planEndDate" style="width:33%;"
  399. :editable="false"
  400. format="yyyy-MM-dd"
  401. value-format="yyyy-MM-dd"
  402. :clearable="false" type="date"
  403. placeholder="选择日期"></el-date-picker>
  404. </el-form-item>
  405. <!-- 单个公司的固定字段 -->
  406. <div v-if="user.companyId == '936'">
  407. <el-form-item label="合同编号" >
  408. <el-input v-model="addForm.contractCode" maxlength="50" show-word-limit placeholder="请输入合同编号" clearable></el-input>
  409. </el-form-item>
  410. <el-form-item label="质保开始时间">
  411. <el-date-picker v-model="addForm.warrantyStartDate"
  412. :editable="false" style="width:32%;"
  413. format="yyyy-MM-dd"
  414. value-format="yyyy-MM-dd"
  415. :clearable="false" type="date"
  416. placeholder="选择日期"></el-date-picker>
  417. <span style="margin-left:63px;margin-right:10px;" >质保截止时间</span>
  418. <el-date-picker v-model="addForm.warrantyEndDate" style="width:33%;"
  419. :editable="false"
  420. format="yyyy-MM-dd"
  421. value-format="yyyy-MM-dd"
  422. :clearable="false" type="date"
  423. placeholder="选择日期"></el-date-picker>
  424. </el-form-item>
  425. <el-form-item label="自主项目类别" >
  426. <el-input v-model="addForm.projectCategorySub" placeholder="请输入自主项目类别" clearable></el-input>
  427. </el-form-item>
  428. <el-form-item label="所属大区" >
  429. <el-input v-model="addForm.region" placeholder="请输入 所属大区" clearable></el-input>
  430. </el-form-item>
  431. <el-form-item label="所属BU" >
  432. <el-input v-model="addForm.bu" placeholder="所属BU" clearable></el-input>
  433. </el-form-item>
  434. </div>
  435. <!-- 项目基线 -->
  436. <div style="margin: 10px 0 30px 0;min-height:200px;" v-if="user.company.packageProject == 1">
  437. <el-tabs v-model="activeName" @tab-click="handleClick">
  438. <el-tab-pane label="成本基线" name="baseCostPanel" >
  439. <div style="padding-top:10px;">
  440. <!--新版 -->
  441. <span class="rg_span" v-for="(item, index) in projectBaseCostData" :key="item.id">
  442. <span style="width:120px;display: inline-block;" v-if="user.company.packageProject==1">{{item.baseName}}</span>
  443. <el-input :id="'baseCost'+index" @input="addUpfun()" v-model="item.baseAmount" style="width:200px; margin-bottom: 20px"
  444. placeholder="整数" clearable @keyup.native="restrictNumber('baseCost'+index)"></el-input><span style="margin-left:10px;">元</span>
  445. </span>
  446. <!-- 合计 -->
  447. <div style="margin-top: 10px;float:right;">
  448. <span style="margin-right:50px;margin-right:10px;" v-if="user.company.packageProject==1">合计</span>
  449. <span v-if="addForm.budget <= 0 || addForm.budget == undefined">0</span>
  450. <span v-else>{{addForm.budget | numberToCurrency}}</span>
  451. <span style="margin-right:50px;margin-left:10px;">元</span>
  452. </div>
  453. </div>
  454. </el-tab-pane>
  455. <el-tab-pane label="工程专业" name="engineeringProfession" v-if="user.company.packageEngineering == 1">
  456. <div style="padding-top:10px;">
  457. <el-table :data="projectProfessionList" size="small" :key="Math.random()">
  458. <el-table-column prop="professionId" width="200">
  459. <template slot-scope="scope">
  460. <el-select v-model="scope.row.professionId" >
  461. <el-option v-for="item in professionList" :key="item.id" :label="item.name" :value="item.id"/>
  462. </el-select>
  463. </template>
  464. <template slot="header" >
  465. <span style="font-size:14px;font-weight:normal;">专业名称</span>
  466. </template>
  467. </el-table-column>
  468. <el-table-column prop="percentage" width="120" label="占比(%)">
  469. <template slot-scope="scope">
  470. <div><el-input type="number" v-model="scope.row.percentage"></el-input></div>
  471. </template>
  472. </el-table-column>
  473. <el-table-column prop="membNames" label="相关人员及占比">
  474. <template slot-scope="scope">
  475. <span style="margin:0 5px;" v-for="item in scope.row.membList" :key="item.membId">{{item.membName}}({{item.percentage}}%)</span>
  476. <el-link @click="showEditPpMembs(scope.row)">{{(scope.row.membList == null || scope.row.membList.length == 0)?'设置专业参与人员':'设置'}}</el-link>
  477. </template>
  478. </el-table-column>
  479. <el-table-column prop="inchargerName" width="120" label="负责人">
  480. <template slot-scope="scope">
  481. <el-select v-model="scope.row.inchargerId" >
  482. <el-option v-for="item in participator" :key="item.id" :label="item.name" :value="item.id">
  483. </el-option>
  484. </el-select>
  485. </template>
  486. </el-table-column>
  487. <el-table-column width="80">
  488. <template slot-scope="scope">
  489. <el-button icon="el-icon-delete" size="mini" style="margin-left:10px;" @click.stop.native="deleteItem(scope.$index)"></el-button>
  490. </template>
  491. <template slot="header" >
  492. <el-link type="primary" :underline="false" @click="addItem">添加</el-link>
  493. </template>
  494. </el-table-column>
  495. </el-table>
  496. </div>
  497. </el-tab-pane>
  498. <el-tab-pane label="相关领导" name="leaders" >
  499. <div style="padding-top:10px;">
  500. <el-input @focus="showChooseLeaderTree" v-model="addForm.notifyUserNames" placeholder="请选择需要接收审核通知的相关领导"></el-input>
  501. </div>
  502. </el-tab-pane>
  503. </el-tabs>
  504. </div>
  505. </el-form>
  506. <div slot="footer" class="dialog-footer;">
  507. <el-button @click.native="deletePro(1, addForm)" v-if="(permissions.projectManagement || user.id==deleteVif) && addForm.id" style="float:left">删除</el-button>
  508. <el-button @click.native="addFormVisible = false">取消</el-button>
  509. <el-button type="primary" @click="submitInsert" :loading="addLoading">提交</el-button>
  510. </div>
  511. </el-dialog>
  512. <!--用户详细信息弹出框-->
  513. <el-dialog title="查看详情" v-if="userDetailVisible" :visible.sync="userDetailVisible" :close-on-click-modal="false" customClass="customWidth" width="400px">
  514. <div class="line"><span>姓名</span><span>{{userDetail.name}}</span></div>
  515. <div class="line"><span>手机号码</span><span>{{userDetail.phone}}</span></div>
  516. <div class="line"><span>角色</span><span>{{roleArray[userDetail.role]}}</span></div>
  517. <div class="line"><span>部门</span><span>{{userDetail.departmentName}}</span></div>
  518. <div slot="footer" class="dialog-footer">
  519. <el-button type="primary" @click="userDetailVisible = false" >确定</el-button>
  520. </div>
  521. </el-dialog>
  522. <!-- 子项目列表 -->
  523. <el-dialog title="子项目列表" show-header="false" v-if="subProjectVisible" :visible.sync="subProjectVisible" :close-on-click-modal="false" customClass="customWidth" width="500px">
  524. <el-table :data="subProjectList" highlight-current-row height="400" style="width: 100%;">
  525. <!-- <el-table-column type="index" width="60" label="序号">
  526. <template slot-scope="scope" >
  527. {{scope.$index+1+(page-1)*size}}
  528. </template>
  529. </el-table-column> -->
  530. <el-table-column width="120" label="子项目编号" prop="code"></el-table-column>
  531. <el-table-column prop="name" label="名称" ></el-table-column>
  532. <el-table-column label="操作" width="150">
  533. <template slot-scope="scope" >
  534. <el-button size="small" type="primary" @click="addNewSubProject(scope.row)">编辑</el-button>
  535. <el-button size="small" type="danger" @click="deleteSubPro(scope.row)">删除</el-button>
  536. </template>
  537. </el-table-column>
  538. </el-table>
  539. <div slot="footer" class="dialog-footer">
  540. <el-button type="primary" @click="subProjectVisible = false" >关闭</el-button>
  541. <el-button type="primary" @click="addNewSubProject()" >新增子项目</el-button>
  542. </div>
  543. </el-dialog>
  544. <!-- 新增子项目弹出框 -->
  545. <el-dialog title="新增/修改子项目" v-if="addSubProject" :visible.sync="addSubProject" :close-on-click-modal="false" customClass="customWidth" width="500px">
  546. <el-form ref="form2" :model="temaddForm" :rules="rules" label-width="100px">
  547. <!-- <el-form-item label="项目编号" prop="code"> -->
  548. <el-form-item label="项目编号">
  549. <el-input v-model="temaddForm.code" placeholder="请输入项目编号" clearable></el-input>
  550. </el-form-item>
  551. <el-form-item label="项目名称" prop="name">
  552. <el-input v-model="temaddForm.name" placeholder="请输入项目名称" clearable></el-input>
  553. </el-form-item>
  554. </el-form>
  555. <div slot="footer" class="dialog-footer">
  556. <el-button @click.native="addSubProject = false">取消</el-button>
  557. <el-button type="primary" @click="submitInsertSubProject" :loading="addLoading">提交</el-button>
  558. </div>
  559. </el-dialog>
  560. <!-- 项目基线成本项配置弹出框 -->
  561. <el-dialog title="项目基线成本项管理" show-header="false" v-if="showBaseConfig" :visible.sync="showBaseConfig" :close-on-click-modal="false" customClass="customWidth" width="600px">
  562. <el-table :data="baseCostItemList" highlight-current-row height="400" style="width: 100%;">
  563. <el-table-column type="index" width="60" label="序号">
  564. <template slot-scope="scope" >
  565. {{scope.$index+1+(page-1)*size}}
  566. </template>
  567. </el-table-column>
  568. <el-table-column prop="name" label="名称" ></el-table-column>
  569. <el-table-column prop="alarmType" label="预警">
  570. <template slot-scope="scope">
  571. <span>{{scope.row.alarmType ? "工时成本预警" : "无预警"}}</span>
  572. </template>
  573. </el-table-column>
  574. <el-table-column label="操作" width="150">
  575. <template slot-scope="scope" >
  576. <el-button size="small" type="primary" @click="addNewBaseItem(scope.row)">编辑</el-button>
  577. <el-button size="small" type="danger" @click="deleteBaseItem(scope.row)">删除</el-button>
  578. </template>
  579. </el-table-column>
  580. </el-table>
  581. <div slot="footer" class="dialog-footer">
  582. <el-button type="primary" @click="showBaseConfig = false" >关闭</el-button>
  583. <el-button type="primary" @click="addNewBaseItem()" >新增成本项</el-button>
  584. </div>
  585. </el-dialog>
  586. <!-- 分类条目配置 -->
  587. <el-dialog title="项目分类条目管理" show-header="false" v-if="showClfDialog" :visible.sync="showClfDialog" :close-on-click-modal="false" customClass="customWidth" width="500px">
  588. <el-table :data="baseClfList" highlight-current-row height="400" style="width: 100%;">
  589. <el-table-column type="index" width="60" label="序号">
  590. <template slot-scope="scope" >
  591. {{scope.$index+1+(page-1)*size}}
  592. </template>
  593. </el-table-column>
  594. <el-table-column prop="name" label="名称" ></el-table-column>
  595. <el-table-column label="操作" width="150">
  596. <template slot-scope="scope" >
  597. <el-button size="small" type="primary" @click="addNewClf(scope.row)">编辑</el-button>
  598. <el-button size="small" type="danger" @click="deleteClf(scope.row)">删除</el-button>
  599. </template>
  600. </el-table-column>
  601. </el-table>
  602. <div slot="footer" class="dialog-footer">
  603. <el-button type="primary" @click="showClfDialog = false" >关闭</el-button>
  604. <el-button type="primary" @click="addNewClf()" >新增分类项</el-button>
  605. </div>
  606. </el-dialog>
  607. <!-- 主项目配置 -->
  608. <el-dialog title="主项目管理" show-header="false" v-if="mainProjectDialog" :visible.sync="mainProjectDialog" :close-on-click-modal="false" customClass="customWidth" width="800px">
  609. <el-table :data="mainProjectList" highlight-current-row height="400" style="width: 100%;">
  610. <el-table-column type="index" width="60" label="序号">
  611. <template slot-scope="scope" >
  612. {{scope.$index+1+(page-1)*size}}
  613. </template>
  614. </el-table-column>
  615. <el-table-column prop="code" label="编号" ></el-table-column>
  616. <el-table-column prop="name" label="名称" ></el-table-column>
  617. <el-table-column prop="categoryName" label="分类名称" ></el-table-column>
  618. <el-table-column label="操作" width="150">
  619. <template slot-scope="scope" >
  620. <el-button size="small" type="primary" @click="addManPro(scope.row)">编辑</el-button>
  621. <el-button size="small" type="danger" @click="deleteManPro(scope.row)">删除</el-button>
  622. </template>
  623. </el-table-column>
  624. </el-table>
  625. <div slot="footer" class="dialog-footer">
  626. <el-button type="primary" @click="mainProjectDialog = false" >关闭</el-button>
  627. <el-button type="primary" @click="addManPro()" >新增主项目</el-button>
  628. </div>
  629. </el-dialog>
  630. <!-- 项目阶段配置 -->
  631. <el-dialog title="项目阶段管理" show-header="false" v-if="phaseProjectDialog" :visible.sync="phaseProjectDialog" :close-on-click-modal="false" customClass="customWidth" width="600px">
  632. <el-table :data="phaseList" highlight-current-row height="400" style="width: 100%;">
  633. <el-table-column type="index" width="60" label="序号">
  634. <template slot-scope="scope" >
  635. {{scope.$index+1+(page-1)*size}}
  636. </template>
  637. </el-table-column>
  638. <el-table-column prop="projectStageName" label="阶段名称" ></el-table-column>
  639. <el-table-column label="操作" width="150">
  640. <template slot-scope="scope" >
  641. <el-button size="small" type="primary" @click="addPanthPro(scope.row)">编辑</el-button>
  642. <el-button size="small" type="danger" @click="deletePanthPro(scope.row)">删除</el-button>
  643. </template>
  644. </el-table-column>
  645. </el-table>
  646. <div slot="footer" class="dialog-footer">
  647. <el-button type="primary" @click="phaseProjectDialog = false" >关闭</el-button>
  648. <el-button type="primary" @click="addPanthPro()" >新增项目阶段</el-button>
  649. </div>
  650. </el-dialog>
  651. <!-- 项目级别管理 -->
  652. <el-dialog title="项目级别管理" show-header="false" v-if="projectLevelDialog" :visible.sync="projectLevelDialog" :close-on-click-modal="false" customClass="customWidth" width="600px">
  653. <el-table :data="levelList" highlight-current-row height="400" style="width: 100%;" >
  654. <el-table-column type="index" width="60" label="序号">
  655. <template slot-scope="scope" >
  656. {{scope.$index+1+(page-1)*size}}
  657. </template>
  658. </el-table-column>
  659. <el-table-column prop="projectLevelName" label="级别名称" ></el-table-column>
  660. <el-table-column label="操作" width="150">
  661. <template slot-scope="scope" >
  662. <el-button size="small" type="primary" @click="addProjectLevel(scope.row)">编辑</el-button>
  663. <el-button size="small" type="danger" @click="deleteProjectLevel(scope.row)">删除</el-button>
  664. </template>
  665. </el-table-column>
  666. </el-table>
  667. <div slot="footer" class="dialog-footer">
  668. <el-button type="primary" @click="projectLevelDialog = false" >关闭</el-button>
  669. <el-button type="primary" @click="addProjectLevel()" >新增项目级别</el-button>
  670. </div>
  671. </el-dialog>
  672. <!-- 新增/编辑项目级别 -->
  673. <el-dialog title="新增/修改项目级别" v-if="addProjectLevelDialog" :visible.sync="addProjectLevelDialog" :close-on-click-modal="false" customClass="customWidth" width="500px">
  674. <el-form ref="form2" :model="addLevelForm" :rules="rules" label-width="120px">
  675. <el-form-item label="项目级别名称" prop="projectLevelName">
  676. <el-input v-model="addLevelForm.projectLevelName" placeholder="请输入名称" clearable></el-input>
  677. </el-form-item>
  678. </el-form>
  679. <div slot="footer" class="dialog-footer">
  680. <el-button @click="addProjectLevelDialog = false">取消</el-button>
  681. <el-button type="primary" @click="submitLevelPro" :loading="addLoading">提交</el-button>
  682. </div>
  683. </el-dialog>
  684. <!-- 新增/编辑 分类条目 -->
  685. <el-dialog title="新增/修改分类条目" v-if="addClfDialog" :visible.sync="addClfDialog" :close-on-click-modal="false" customClass="customWidth" width="500px">
  686. <el-form ref="form2" :model="addClf" :rules="rules" label-width="100px">
  687. <el-form-item label="主项目名称" prop="name">
  688. <el-input v-model="addClf.name" placeholder="请输入主项目名称" clearable></el-input>
  689. </el-form-item>
  690. </el-form>
  691. <div slot="footer" class="dialog-footer">
  692. <el-button @click.native="addClfDialog = false">取消</el-button>
  693. <el-button type="primary" @click="submitClf" :loading="addLoading">提交</el-button>
  694. </div>
  695. </el-dialog>
  696. <!-- 新增/编辑主项目 -->
  697. <el-dialog title="新增/修改主项目" v-if="addFlgmainProjectDialog" :visible.sync="addFlgmainProjectDialog" :close-on-click-modal="false" customClass="customWidth" width="500px">
  698. <el-form ref="form2" :model="addMainForm" :rules="rules" label-width="100px">
  699. <!-- <el-form-item label="主项目编号" prop="code"> -->
  700. <el-form-item label="主项目编号">
  701. <el-input v-model="addMainForm.code" placeholder="请输入编号" clearable></el-input>
  702. </el-form-item>
  703. <el-form-item label="主项目名称" prop="name">
  704. <el-input v-model="addMainForm.name" placeholder="请输入名称" clearable></el-input>
  705. </el-form-item>
  706. <el-form-item label="项目分类">
  707. <el-select v-model="addMainForm.categoryId" placeholder="请选择分类" clearable >
  708. <el-option v-for="item in baseClfList" :key="item.id" :label="item.name" :value="item.id"></el-option>
  709. </el-select>
  710. </el-form-item>
  711. </el-form>
  712. <div slot="footer" class="dialog-footer">
  713. <el-button @click.native="addFlgmainProjectDialog = false">取消</el-button>
  714. <el-button type="primary" @click="submitManPro" :loading="addLoading">提交</el-button>
  715. </div>
  716. </el-dialog>
  717. <!-- 新增/编辑项目阶段 -->
  718. <el-dialog title="新增/修改项目阶段" v-if="addFlgPanthProjectDialog" :visible.sync="addFlgPanthProjectDialog" :close-on-click-modal="false" customClass="customWidth" width="500px">
  719. <el-form ref="form2" :model="addPanthForm" :rules="rules" label-width="120px">
  720. <el-form-item label="项目阶段名称" prop="name">
  721. <el-input v-model="addPanthForm.projectStageName" placeholder="请输入名称" clearable></el-input>
  722. </el-form-item>
  723. </el-form>
  724. <div slot="footer" class="dialog-footer">
  725. <el-button @click.native="addFlgPanthProjectDialog = false">取消</el-button>
  726. <el-button type="primary" @click="submitPanthPro" :loading="addLoading">提交</el-button>
  727. </div>
  728. </el-dialog>
  729. <el-dialog title="新增/修改成本项" v-if="addBaseItemDialog" :visible.sync="addBaseItemDialog" :close-on-click-modal="false" customClass="customWidth" width="500px">
  730. <el-form ref="form2" :model="addForm" :rules="rules" label-width="100px">
  731. <el-form-item label="成本项名称" prop="name">
  732. <el-input v-model="addForm.name" placeholder="请输入名称" clearable></el-input>
  733. </el-form-item>
  734. <el-form-item label="预警" prop="alarmType">
  735. <el-radio v-model="addForm.alarmType" :label="0">无预警</el-radio>
  736. <el-radio v-model="addForm.alarmType" :label="1">工时成本预警</el-radio>
  737. </el-form-item>
  738. </el-form>
  739. <div slot="footer" class="dialog-footer">
  740. <el-button @click.native="addBaseItemDialog = false">取消</el-button>
  741. <el-button type="primary" @click="submitInsertBaseItem" :loading="addLoading">提交</el-button>
  742. </div>
  743. </el-dialog>
  744. <!-- 按部门选择人员 -->
  745. <el-dialog title="选择参与人员" v-if="chooseParticipVisible" :visible.sync="chooseParticipVisible" :close-on-click-modal="false" customClass="customWidth" width="500px">
  746. <!-- <el-input style="width:100%" v-model="filterName" placeholder="请输入姓名搜索" @change="findUserInTree"></el-input> -->
  747. <div class="tree" style="height:400px">
  748. <el-scrollbar style="height:100%">
  749. <el-input
  750. placeholder="输入关键字进行过滤"
  751. v-model="filterText">
  752. </el-input>
  753. <el-tree :data="deptMembData" show-checkbox :props="defaultProps" node-key="id"
  754. ref="chooseMembTree" @check-change="onTreeItemChange" :default-checked-keys="addForm.userId"
  755. highlight-current :filter-node-method="filterNode"></el-tree>
  756. </el-scrollbar>
  757. </div>
  758. <div>已选中&nbsp;{{chosenMembCount}}&nbsp;人</div>
  759. <div slot="footer" class="dialog-footer">
  760. <el-button @click="chooseParticipVisible = false" >取消</el-button>
  761. <el-button type="primary" @click="chooseParticip()" >确定</el-button>
  762. </div>
  763. </el-dialog>
  764. <!-- 按部门选择相关领导 -->
  765. <el-dialog title="选择相关领导" v-if="chooseLeaderVisible" :visible.sync="chooseLeaderVisible" :close-on-click-modal="false" customClass="customWidth" width="500px">
  766. <!-- <el-input style="width:100%" v-model="filterName" placeholder="请输入姓名搜索" @change="findUserInTree"></el-input> -->
  767. <div class="tree" style="height:400px">
  768. <el-scrollbar style="height:100%">
  769. <el-tree :data="deptMembData" show-checkbox :props="defaultProps" node-key="id"
  770. ref="chooseLeaderTree" @check-change="onLeaderTreeItemChange" :default-checked-keys="addForm.notifyUserIds"
  771. highlight-current ></el-tree>
  772. </el-scrollbar>
  773. </div>
  774. <div>已选中&nbsp;{{chosenMembCount}}&nbsp;人</div>
  775. <div slot="footer" class="dialog-footer">
  776. <el-button @click="chooseLeaderVisible = false" >取消</el-button>
  777. <el-button type="primary" @click="chooseLeader()" >确定</el-button>
  778. </div>
  779. </el-dialog>
  780. <!-- 项目专业人员的设置 -->
  781. <el-dialog title="设置项目专业人员" v-if="editPpMembDialog" :visible.sync="editPpMembDialog" :close-on-click-modal="false" customClass="customWidth" width="600px">
  782. <el-table :data="curProfessionRow.membList" height="400">
  783. <el-table-column prop="name" label="专业人员">
  784. <template slot-scope="scope">
  785. <el-select v-model="scope.row.membId" filterable placeholder="请选择专业参与人" style="width:100%;" >
  786. <el-option v-for="item in participator" :key="item.id" :label="item.name" :value="item.id">
  787. </el-option>
  788. </el-select>
  789. </template>
  790. </el-table-column>
  791. <el-table-column prop="percentage" width="120" label="占比(%)">
  792. <template slot-scope="scope">
  793. <el-input type="number" v-model="scope.row.percentage"></el-input>
  794. </template>
  795. </el-table-column>
  796. <el-table-column width="80">
  797. <template slot-scope="scope">
  798. <el-button icon="el-icon-delete" size="mini" style="margin-left:10px;" @click.stop.native="deleteMembItem(scope.$index)"></el-button>
  799. </template>
  800. <template slot="header" >
  801. <el-link @click="addMembItem">添加</el-link>
  802. </template>
  803. </el-table-column>
  804. </el-table>
  805. <div slot="footer" class="dialog-footer">
  806. <el-button @click="editPpMembDialog = false" >取消</el-button>
  807. <el-button type="primary" @click="addPpMemb" >确定</el-button>
  808. </div>
  809. </el-dialog>
  810. <!-- 批量修改自定义维度 -->
  811. <el-dialog :title="checkoradd ? '批量修改' : '批量添加'" :visible.sync="checkedWuduDialog" v-if="checkedWuduDialog" width="40%">
  812. <el-form model="" label-width="20%">
  813. <el-form-item :label="'设置' + user.timeType.customDegreeName">
  814. <el-select v-model="checkedWuduArr" value-key="id" :placeholder="'请选择' + user.timeType.customDegreeName" multiple style="width: 100%">
  815. <el-option v-for="item in ause" :key="item.id" :label="item.name" :value="item"></el-option>
  816. </el-select>
  817. </el-form-item>
  818. </el-form>
  819. <div slot="footer" class="dialog-footer">
  820. <el-button @click="checkedWuduDialog = false">取消</el-button>
  821. <el-button type="primary" @click="batchSetWudulistBtn3" v-if="checkoradd">确定</el-button>
  822. <el-button type="primary" @click="batchSetWudulistBtn4" v-if="!checkoradd">确定</el-button>
  823. </div>
  824. </el-dialog>
  825. <!-- 批量添加参与人 -->
  826. <el-dialog :title="isAddGroupPerson ? '批量添加分组参与人' : '批量添加项目参与人'" v-if="addGroupPersonDialog" :visible.sync="addGroupPersonDialog" width="40%">
  827. <el-form label-width="20%">
  828. <el-form-item label="选择人员">
  829. <el-tooltip placement="top" effect="light">
  830. <div slot="content" style="width:450px">{{addGroupPersonData.personNames}}</div>
  831. <el-input @focus="addGroupPersonP" v-model="addGroupPersonData.personNames"></el-input>
  832. </el-tooltip>
  833. </el-form-item>
  834. <el-form-item label="选择分组" v-if="isAddGroupPerson">
  835. <el-select v-model="addGroupPersonData.group" multiple placeholder="请选择分组" style="width:100%">
  836. <el-option v-for="item in addGroupList"
  837. :key="item.groupIds"
  838. :label="item.name"
  839. :value="item.groupIds"></el-option>
  840. </el-select>
  841. </el-form-item>
  842. </el-form>
  843. <div slot="footer" class="dialog-footer">
  844. <el-button @click="addGroupPersonDialog = false" >取消</el-button>
  845. <el-button type="primary" @click="addGroupPersonSure()" v-if="isAddGroupPerson">确定</el-button>
  846. <el-button type="primary" @click="addProPersonSure()" v-else>确定</el-button>
  847. </div>
  848. <el-dialog append-to-body title="选择人员" v-if="addGroupPersonPdialog" :visible.sync="addGroupPersonPdialog" width="40%">
  849. <div class="tree" style="height:300px">
  850. <el-scrollbar style="height:100%">
  851. <el-input
  852. placeholder="输入关键字进行过滤"
  853. v-model="filterText2">
  854. </el-input>
  855. <el-tree :data="deptMembData" show-checkbox :props="defaultProps" node-key="id"
  856. ref="chooseMembTree2" @check-change="addPersonCheck"
  857. highlight-current :filter-node-method="filterNode" :default-checked-keys="addGroupPersonData.person"></el-tree>
  858. </el-scrollbar>
  859. </div>
  860. <div>已选中&nbsp;{{chosenMembCount}}&nbsp;人</div>
  861. <div slot="footer" class="dialog-footer">
  862. <el-button @click="addGroupPersonPdialog = false" >取消</el-button>
  863. <el-button type="primary" @click="addPersonSure()" >确定</el-button>
  864. </div>
  865. </el-dialog>
  866. </el-dialog>
  867. <el-dialog append-to-body title="项目导入结果" v-if="showImportResult" :visible.sync="showImportResult" width="40%">
  868. <div >
  869. {{importResultMsg}}
  870. </div>
  871. </el-dialog>
  872. </section>
  873. </template>
  874. <style scoped>
  875. .input-with-select .el-input-group__prepend {
  876. background-color: #fff;
  877. }
  878. .line {
  879. padding:10px;
  880. }
  881. .line span{
  882. font-size:15px;
  883. }
  884. .line span:nth-child(even){
  885. float:right;
  886. }
  887. .kans {
  888. width: 230px;
  889. overflow:hidden;
  890. white-space:nowrap;
  891. text-overflow: ellipsis;
  892. }
  893. a {
  894. text-decoration: none;
  895. }
  896. .router-link-active {
  897. text-decoration: none;
  898. }
  899. </style>
  900. <script>
  901. import util from "../../common/js/util";
  902. import projectgantt from "./project_gantt.vue"
  903. export default {
  904. components:{projectgantt},
  905. data() {
  906. return {
  907. addFlgmainProjectDialog: false,
  908. addFlgPanthProjectDialog: false,
  909. addProjectLevelDialog: false,
  910. mainProjectList: [],
  911. mainProjectDialog: false,
  912. projectLevelDialog: false,
  913. showImportResult: false,
  914. importResultMsg:null,
  915. isganttshow: false,
  916. deleteAlertMsg: null,
  917. chosenLeaders:[],
  918. chooseLeaderVisible:false,
  919. projectProfessionItem:null,
  920. curProfessionRow:null,
  921. editPpMembDialog:false,
  922. professionList:[],
  923. projectProfessionList:[],
  924. activeName:"baseCostPanel",
  925. chosenMembCount:0,
  926. chosenMembList:[],//选中的人员
  927. allMembData:[],
  928. deptMembData: [
  929. {
  930. id: 0,
  931. label: '未分配',
  932. }
  933. ],
  934. option: [],
  935. depData: {
  936. id: -1,
  937. label: '全部人员',
  938. },
  939. defaultProps: {
  940. children: 'children',
  941. label: 'label'
  942. },
  943. filterName:null,
  944. chooseParticipVisible: false,
  945. projectBaseCostData:[],
  946. addBaseItemDialog:false,
  947. showBaseConfig:false,
  948. customerList:[],
  949. roleArray:["普通员工","超级管理员", "系统管理员", "公司高层","财务管理员", "项目管理员"],
  950. status:"1",
  951. statusTxt:["-","进行中","已完成","已撤销","已暂停"],
  952. importanceList:[{id:1,label:'正常'},{id:2,label:'紧急'},{id:3,label:'重要'},{id:4,label:'重要且紧急'}],
  953. importanceListLable:['正常', '紧急', '重要', '重要且紧急', '低风险', '中风险', '高风险'],
  954. searchField:'1',
  955. keyword:null,
  956. user: JSON.parse(sessionStorage.getItem("user")),
  957. permissions: JSON.parse(sessionStorage.getItem("permissions")),
  958. userDetailVisible: false,
  959. userDetail:{},
  960. date: new Date(),
  961. users: [],
  962. participator:[],
  963. tableHeight: 0,
  964. listLoading: false,
  965. total: 0,
  966. page: 1,
  967. size: localStorage.getItem("projectPageSize")==null?20:parseInt(localStorage.getItem("projectPageSize")),
  968. list: [],
  969. subProjectVisible: false,
  970. subProjectList: [],//子项目列表
  971. currentProject:{},
  972. addSubProject: false,
  973. addFormVisible: false,
  974. addLoading: false,
  975. addUp: 0, // 合计
  976. title: "",
  977. addForm: {
  978. name: '',
  979. userId: [],
  980. level:1,
  981. id: '',
  982. code: '',
  983. projectDesc: '',
  984. alarmType: 0
  985. },
  986. temaddForm: {},
  987. rules: {
  988. name: [{ required: true, message: "请输入名称", trigger: "blur" }],
  989. code: [{ required: true, message: "请输入编号", trigger: "blur" }],
  990. projectStageName: [{ required: true, message: "请输入名称", trigger: "blur" }],
  991. projectLevelName: [{ required: true, message: "请输入名称", trigger: "blur" }],
  992. },
  993. ause: [],
  994. auseList: [],
  995. yonghuUser: [],
  996. filterText: '',
  997. filterText2: '',
  998. showClfDialog: false,
  999. addClfDialog:false,
  1000. addClf:{name:'',id:''},
  1001. addMainForm:{
  1002. name:'',
  1003. id:'',
  1004. code: '',
  1005. categoryId: ''
  1006. },
  1007. addPanthForm: {
  1008. id: '',
  1009. projectStageName: ''
  1010. },
  1011. addLevelForm: {
  1012. id: '',
  1013. projectStageName: ''
  1014. },
  1015. statusClf:null,
  1016. permissionsObj: {},
  1017. checkedProjectArr: [],
  1018. checkedWuduDialog: false,
  1019. checkedWuduArr: [],
  1020. checkoradd: true,
  1021. addGroupPersonBtnLoading: false,
  1022. addGroupPersonDialog: false,
  1023. addGroupList: [],
  1024. addGroupPersonData: {
  1025. group: [],
  1026. person: null,
  1027. personNames: ''
  1028. },
  1029. addGroupPersonPdialog: false,
  1030. showColumnWidth: '300',
  1031. deleteVif: null,
  1032. isAddGroupPerson: true,
  1033. projectMainId: '',
  1034. supplierList: '',
  1035. sortProp: '',
  1036. sortOrder: null,
  1037. currentCell: null, // 当前单击的是哪一个单元格
  1038. phaseList: [],
  1039. phaseProjectId: '', // 阶段项目id
  1040. phaseProjectValie: null, // 阶段项目值
  1041. listHeader: [], // 列表表头
  1042. rowid: '',
  1043. phaseProjectDialog: false, // 项目阶段
  1044. levelList: [], // 项目级别
  1045. };
  1046. },
  1047. // 过滤器
  1048. filters: {
  1049. numberToCurrency(value) {
  1050. if (!value) return '0.00'
  1051. // 将数值截取,保留两位小数
  1052. value = value.toFixed(2)
  1053. // 获取整数部分
  1054. const intPart = Math.trunc(value)
  1055. // 整数部分处理,增加,
  1056. const intPartFormat = intPart.toString().replace(/(\d)(?=(?:\d{3})+$)/g, '$1,')
  1057. // 预定义小数部分
  1058. let floatPart = '.00'
  1059. // 将数值截取为小数部分和整数部分
  1060. const valueArray = value.toString().split('.')
  1061. if (valueArray.length === 2) { // 有小数部分
  1062. floatPart = valueArray[1].toString() // 取得小数部分
  1063. return intPartFormat + '.' + floatPart
  1064. }
  1065. return intPartFormat + floatPart
  1066. },
  1067. mobans(value, valueList) {
  1068. for(var i in valueList) {
  1069. if(valueList[i].providerCateGoryName == value) {
  1070. return valueList[i].providerInfoName
  1071. }
  1072. }
  1073. },
  1074. },
  1075. watch: {
  1076. filterText(val) {
  1077. this.$refs.chooseMembTree.filter(val);
  1078. },
  1079. filterText2(val) {
  1080. this.$refs.chooseMembTree2.filter(val);
  1081. }
  1082. },
  1083. methods: {
  1084. hoverCall(row) {
  1085. this.rowid=row.id
  1086. },
  1087. handCall() {
  1088. this.rowid = ''
  1089. },
  1090. // 获取阶段
  1091. obtainPhase(item) {
  1092. this.http.post('/project-stage/list', {},
  1093. res => {
  1094. if (res.code == "ok") {
  1095. // this.phaseList = res.data
  1096. this.$set(this, 'phaseList', res.data)
  1097. } else {
  1098. this.$message({
  1099. message: res.msg,
  1100. type: "error"
  1101. });
  1102. }
  1103. },
  1104. error => {
  1105. this.$message({
  1106. message: error,
  1107. type: "error"
  1108. });
  1109. });
  1110. },
  1111. // 获取级别
  1112. getProjectLevel(){
  1113. this.http.post('/project-level/list', {},
  1114. res => {
  1115. if (res.code == "ok") {
  1116. this.levelList = res.data
  1117. // this.$set(this, 'levelList', res.data)
  1118. } else {
  1119. this.$message({
  1120. message: res.msg,
  1121. type: "error"
  1122. });
  1123. }
  1124. },
  1125. error => {
  1126. this.$message({
  1127. message: error,
  1128. type: "error"
  1129. });
  1130. });
  1131. },
  1132. addProjectLevel(row){
  1133. this.addProjectLevelDialog = true
  1134. if(!row) {
  1135. this.addLevelForm = {
  1136. projectLevelName: '',
  1137. id: ''
  1138. // companyId:''
  1139. }
  1140. } else {
  1141. this.addLevelForm = {
  1142. id: row.id,
  1143. projectLevelName: row.projectLevelName
  1144. // companyId: row.companyId
  1145. }
  1146. }
  1147. },
  1148. deleteProjectLevel(row) {
  1149. this.$confirm("该操作可能造成已有数据丢失,确定要删除吗?","删除项目级别", {
  1150. confirmButtonText: "确定",
  1151. cancelButtonText: "取消",
  1152. type: "warning"
  1153. })
  1154. .then(() => {
  1155. this.listLoading = true;
  1156. this.http.post('/project-level/delete',{
  1157. id: row.id
  1158. },
  1159. res => {
  1160. this.listLoading = false;
  1161. if (res.code == "ok") {
  1162. this.$message({
  1163. message: "删除成功",
  1164. type: "success"
  1165. });
  1166. this.getProjectLevel();
  1167. } else {
  1168. this.$message({
  1169. message: res.msg,
  1170. type: "error"
  1171. });
  1172. }
  1173. },
  1174. error => {
  1175. this.listLoading = false;
  1176. this.$message({
  1177. message: error,
  1178. type: "error"
  1179. });
  1180. }
  1181. );
  1182. })
  1183. .catch(() => {});
  1184. },
  1185. submitLevelPro(){
  1186. this.http.post('/project-level/addOrMod',this.addLevelForm,
  1187. res => {
  1188. if (res.code == "ok") {
  1189. this.addProjectLevelDialog = false;
  1190. this.getProjectLevel()
  1191. } else {
  1192. this.$message({
  1193. message: res.msg,
  1194. type: "error"
  1195. });
  1196. }
  1197. },
  1198. error => {
  1199. this.$message({
  1200. message: error,
  1201. type: "error"
  1202. });
  1203. }
  1204. );
  1205. },
  1206. // 表格点击
  1207. tableCellClassName({row, column, rowIndex, columnIndex}) {
  1208. row.index=rowIndex;
  1209. column.index=columnIndex;
  1210. },
  1211. clickCell(row,column) {
  1212. // console.log('can can need',row,column)
  1213. if(this.permissions.projectManagement || this.user.id==row.inchargerId || this.user.id==row.creatorId) {
  1214. this.phaseProjectValie = row.currentStageId ? row.currentStageId : ''
  1215. this.currentCell = row.index + ',' + column.index;
  1216. // if(column.label == '项目阶段') {
  1217. this.phaseProjectId = row.id
  1218. // this.obtainPhase(row)
  1219. // }
  1220. setTimeout(() => {
  1221. // 获得焦点
  1222. this.$refs[row.index + ',' + column.index].focus();
  1223. })
  1224. }
  1225. },
  1226. selectChange() {
  1227. let currentStageName = ''
  1228. for(var i in this.phaseList) {
  1229. if(this.phaseList[i].id == this.phaseProjectValie) {
  1230. currentStageName = this.phaseList[i].projectStageName
  1231. }
  1232. }
  1233. this.http.post('/project/changeCurrentStage', {
  1234. projectId: this.phaseProjectId,
  1235. currentStageId: this.phaseProjectValie,
  1236. currentStageName: currentStageName
  1237. },
  1238. res => {
  1239. if (res.code == "ok") {
  1240. this.getList()
  1241. } else {
  1242. this.$message({
  1243. message: res.msg,
  1244. type: "error"
  1245. });
  1246. }
  1247. },
  1248. error => {
  1249. this.$message({
  1250. message: error,
  1251. type: "error"
  1252. });
  1253. });
  1254. },
  1255. hideSelect() {
  1256. var that = this
  1257. setTimeout(() => {
  1258. that.currentCell = null
  1259. }, 500)
  1260. },
  1261. // 点击主项目事件
  1262. projectManagementChange() {
  1263. let categoryId = ''
  1264. for(var i in this.mainProjectList) {
  1265. if(this.mainProjectList[i].id == this.addForm.projectMainId) {
  1266. categoryId = this.mainProjectList[i].categoryId
  1267. }
  1268. }
  1269. categoryId == '' ? '' : this.addForm.category = categoryId
  1270. console.log(this.addForm)
  1271. },
  1272. tableSort({column, prop, order}){
  1273. if(prop == 'inchargerName' || prop == 'customerName' || prop == 'projectCode' || prop == 'categoryName' || prop == 'projectName' || prop == 'status' || prop == 'currentStage'){
  1274. this.sortOrder = order
  1275. this.sortProp = prop
  1276. this.getList()
  1277. }
  1278. },
  1279. //获取项目列表
  1280. getSupplierList() {
  1281. this.http.post('/provider-info/list', {
  1282. pageIndex: 1,
  1283. // pageSize: 999,
  1284. pageSize: -1,
  1285. keyword: ''
  1286. },
  1287. res => {
  1288. if (res.code == "ok") {
  1289. this.supplierList = res.data.records;
  1290. } else {
  1291. this.$message({
  1292. message: res.msg,
  1293. type: "error"
  1294. });
  1295. }
  1296. },
  1297. error => {
  1298. this.$message({
  1299. message: error,
  1300. type: "error"
  1301. });
  1302. });
  1303. },
  1304. addManPro(row) {
  1305. this.addFlgmainProjectDialog = true
  1306. if(!row) {
  1307. this.addMainForm = {
  1308. name: '',
  1309. id: '',
  1310. code: '',
  1311. categoryId: ''
  1312. }
  1313. } else {
  1314. this.addMainForm = {
  1315. id: row.id,
  1316. code: row.code,
  1317. name: row.name,
  1318. categoryId: row.categoryId,
  1319. }
  1320. }
  1321. },
  1322. addPanthPro(row) {
  1323. this.addFlgPanthProjectDialog = true
  1324. if(!row) {
  1325. this.addPanthForm = {
  1326. projectStageName: '',
  1327. id: '',
  1328. companyId:''
  1329. }
  1330. } else {
  1331. this.addPanthForm = {
  1332. id: row.id,
  1333. projectStageName: row.projectStageName,
  1334. companyId: row.companyId
  1335. }
  1336. }
  1337. },
  1338. // 获取主项目
  1339. getMainProject() {
  1340. this.http.post('/project-main/list',{},res => {
  1341. if(res.code == 'ok'){
  1342. this.mainProjectList = res.data
  1343. }else {
  1344. this.$message({
  1345. message: res.msg,
  1346. type: 'error'
  1347. })
  1348. }
  1349. },err => {
  1350. this.$message({
  1351. message: err,
  1352. type: 'error'
  1353. })
  1354. })
  1355. },
  1356. // 批量修改自定义维度
  1357. checkedWudulist(e){
  1358. console.log(e);
  1359. this.checkedProjectArr = e
  1360. },
  1361. batchSetWudulistBtn1(){
  1362. this.$refs.projectlistOfWudulist.clearSelection()
  1363. this.checkedWuduArr = [],
  1364. this.addGroupPersonData = {
  1365. group: null,
  1366. person: null,
  1367. personNames: ''
  1368. }
  1369. },
  1370. batchSetWudulistBtn2(e){
  1371. if(this.checkedProjectArr.length == 0){
  1372. this.$message('请选择项目')
  1373. return
  1374. }
  1375. this.checkoradd = e
  1376. this.checkedWuduDialog = true
  1377. },
  1378. batchSetWudulistBtn3(){
  1379. if(this.checkedWuduArr.length == 0){
  1380. this.$message('请选择' + this.user.timeType.customDegreeName)
  1381. return
  1382. }
  1383. let projectIds = []
  1384. for(let i=0; i<this.checkedProjectArr.length; i++){
  1385. projectIds.push(this.checkedProjectArr[i].id)
  1386. }
  1387. let degreeIds = []
  1388. let degreeNames = []
  1389. for(let s=0; s<this.checkedWuduArr.length; s++){
  1390. degreeIds.push(this.checkedWuduArr[s].id)
  1391. degreeNames.push(this.checkedWuduArr[s].name)
  1392. }
  1393. this.http.post('/project/saveBatchAccoDegrees',{
  1394. ids: JSON.stringify(projectIds),
  1395. associateDegrees: degreeIds.toString(),
  1396. associateDegreeNames: degreeNames.toString()
  1397. },res => {
  1398. if(res.code == 'ok'){
  1399. this.checkedWuduDialog = false
  1400. this.batchSetWudulistBtn1()
  1401. this.$message({
  1402. message: '设置成功',
  1403. type: 'success'
  1404. })
  1405. this.getList()
  1406. }else {
  1407. this.$message({
  1408. message: res.msg,
  1409. type: 'error'
  1410. })
  1411. }
  1412. },err => {
  1413. this.$message({
  1414. message: err,
  1415. type: 'error'
  1416. })
  1417. })
  1418. },
  1419. batchSetWudulistBtn4(){
  1420. if(this.checkedWuduArr.length == 0){
  1421. this.$message('请选择' + this.user.timeType.customDegreeName)
  1422. return
  1423. }
  1424. let projectIds = []
  1425. for(let i=0; i<this.checkedProjectArr.length; i++){
  1426. projectIds.push(this.checkedProjectArr[i].id)
  1427. }
  1428. let degreeIds = []
  1429. let degreeNames = []
  1430. for(let s=0; s<this.checkedWuduArr.length; s++){
  1431. degreeIds.push(this.checkedWuduArr[s].id)
  1432. degreeNames.push(this.checkedWuduArr[s].name)
  1433. }
  1434. this.http.post('/project/addBatchAccoDegrees',{
  1435. ids: JSON.stringify(projectIds),
  1436. associateDegrees: degreeIds.toString(),
  1437. associateDegreeNames: degreeNames.toString()
  1438. },res => {
  1439. if(res.code == 'ok'){
  1440. this.checkedWuduDialog = false
  1441. this.batchSetWudulistBtn1()
  1442. this.$message({
  1443. message: '添加成功',
  1444. type: 'success'
  1445. })
  1446. this.getList()
  1447. }else {
  1448. this.$message({
  1449. message: res.msg,
  1450. type: 'error'
  1451. })
  1452. }
  1453. },err => {
  1454. this.$message({
  1455. message: err,
  1456. type: 'error'
  1457. })
  1458. })
  1459. },
  1460. isSelectable(row,index){
  1461. if(row.creatorId == this.user.id || row.inchargerId == this.user.id || this.permissions.projectManagement){
  1462. return true
  1463. }else{
  1464. return false
  1465. }
  1466. },
  1467. test(row){
  1468. console.log(row);
  1469. },
  1470. // 批量添加分组参与人员
  1471. addGroupPerson(){
  1472. let proArr = []
  1473. if(this.checkedProjectArr.length == 0){
  1474. this.$message('请选择项目')
  1475. return
  1476. }
  1477. this.addGroupPersonBtnLoading = true
  1478. for(let i=0;i<this.checkedProjectArr.length;i++){
  1479. proArr.push(this.checkedProjectArr[i].id)
  1480. }
  1481. this.http.post('/project/getProjectsGroups',{
  1482. projectIdArray: JSON.stringify(proArr)
  1483. },res => {
  1484. if(res.code == 'ok'){
  1485. console.log('分组',res.data);
  1486. this.addGroupList = res.data
  1487. this.addGroupPersonBtnLoading = false
  1488. this.addGroupPersonDialog = true
  1489. }else {
  1490. this.$message({
  1491. message: res.msg,
  1492. type: 'error'
  1493. })
  1494. }
  1495. },err => {
  1496. this.$message({
  1497. message: err,
  1498. type: 'error'
  1499. })
  1500. })
  1501. },
  1502. addGroupPersonP(){
  1503. this.filterText2 = ''
  1504. this.addGroupPersonPdialog = true
  1505. },
  1506. addPersonCheck(){
  1507. var chosenList = this.$refs.chooseMembTree2.getCheckedNodes();
  1508. var list = chosenList.filter(item=>item.isUser == 1);
  1509. this.chosenMembCount = list.length;
  1510. console.log(list);
  1511. },
  1512. addPersonSure(){
  1513. this.addGroupPersonPdialog = false
  1514. let chosenList = this.$refs.chooseMembTree2.getCheckedNodes();
  1515. let list = chosenList.filter(item=>item.isUser == 1);
  1516. let listIDs = []
  1517. let listNames = ''
  1518. for(let i=0;i<list.length;i++){
  1519. listIDs.push(list[i].id)
  1520. listNames += list[i].label + ','
  1521. }
  1522. this.addGroupPersonData.person = listIDs
  1523. this.addGroupPersonData.personNames = listNames
  1524. },
  1525. addGroupPersonSure(){
  1526. if(this.addGroupPersonData.group.length == 0 || this.addGroupPersonData.person == null){
  1527. this.$message({
  1528. message: '请选择人员/分组',
  1529. type: 'warning'
  1530. })
  1531. return
  1532. }
  1533. let groupList = []
  1534. for(let i=0;i<this.addGroupPersonData.group.length;i++){
  1535. groupList = [...groupList,...this.addGroupPersonData.group[i]]
  1536. }
  1537. this.http.post('/project/batchAddMembToGroup',{
  1538. membIdArray: JSON.stringify(this.addGroupPersonData.person),
  1539. groupIds: JSON.stringify(groupList)
  1540. },res => {
  1541. if(res.code == 'ok'){
  1542. this.addGroupPersonDialog = false,
  1543. this.batchSetWudulistBtn1()
  1544. this.$message({
  1545. message: '添加成功',
  1546. type: 'success'
  1547. })
  1548. this.getList()
  1549. }else {
  1550. this.$message({
  1551. message: res.msg,
  1552. type: 'error'
  1553. })
  1554. }
  1555. },err => {
  1556. this.$message({
  1557. message: err,
  1558. type: 'error'
  1559. })
  1560. })
  1561. },
  1562. batchDelete(){
  1563. if(this.checkedProjectArr.length == 0){
  1564. this.$message('请选择项目')
  1565. return
  1566. }
  1567. let proArr = []
  1568. for(let i=0;i<this.checkedProjectArr.length;i++){
  1569. proArr.push(this.checkedProjectArr[i].id)
  1570. // proArr += this.checkedProjectArr[i].id + ','
  1571. }
  1572. // proArr = proArr.substring(0,proArr.length - 1)
  1573. this.http.post('/project/batchDeleteProject',{
  1574. projectIdArray: JSON.stringify(proArr)
  1575. },res => {
  1576. if(res.code == 'ok'){
  1577. this.$message({
  1578. message: '删除成功',
  1579. type: 'success'
  1580. })
  1581. this.getList()
  1582. }else {
  1583. this.$message({
  1584. message: res.msg,
  1585. type: 'error'
  1586. })
  1587. }
  1588. },err => {
  1589. this.$message({
  1590. message: err,
  1591. type: 'error'
  1592. })
  1593. })
  1594. },
  1595. // 批量添加项目参与人
  1596. addProPreson(){
  1597. if(this.checkedProjectArr.length == 0){
  1598. this.$message('请选择项目')
  1599. return
  1600. }
  1601. this.addGroupPersonDialog = true
  1602. this.isAddGroupPerson = false
  1603. },
  1604. addProPersonSure(){
  1605. if(this.addGroupPersonData.person == null){
  1606. this.$message({
  1607. message: '请选择人员',
  1608. type: 'warning'
  1609. })
  1610. return
  1611. }
  1612. let proArr = []
  1613. for(let i=0;i<this.checkedProjectArr.length;i++){
  1614. proArr.push(this.checkedProjectArr[i].id)
  1615. // proArr += this.checkedProjectArr[i].id + ','
  1616. }
  1617. // proArr = proArr.substring(0,proArr.length - 1)
  1618. this.http.post('/project/batchSetParticipation',{
  1619. userIds: JSON.stringify(this.addGroupPersonData.person),
  1620. projectIdArray: JSON.stringify(proArr)
  1621. },res => {
  1622. if(res.code == 'ok'){
  1623. this.addGroupPersonDialog = false,
  1624. this.batchSetWudulistBtn1()
  1625. this.$message({
  1626. message: '添加成功',
  1627. type: 'success'
  1628. })
  1629. this.getList()
  1630. }else {
  1631. this.$message({
  1632. message: res.msg,
  1633. type: 'error'
  1634. })
  1635. }
  1636. },err => {
  1637. this.$message({
  1638. message: err,
  1639. type: 'error'
  1640. })
  1641. })
  1642. },
  1643. filterNode(value, data) {
  1644. if (!value) return true;
  1645. return data.label.indexOf(value) !== -1;
  1646. },
  1647. //重启项目
  1648. restartPro(row) {
  1649. this.http.post('/project/start',{id: row.id},
  1650. res => {
  1651. if (res.code == "ok") {
  1652. this.$message({
  1653. message: '重启成功',
  1654. type: "success"
  1655. });
  1656. row.status = 1;
  1657. } else {
  1658. this.$message({
  1659. message: res.msg,
  1660. type: "error"
  1661. });
  1662. }
  1663. },
  1664. error => {
  1665. this.$message({
  1666. message: error,
  1667. type: "error"
  1668. });
  1669. });
  1670. },
  1671. //撤销项目
  1672. cancelPro(row) {
  1673. this.http.post('/project/cancel',{id: row.id},
  1674. res => {
  1675. if (res.code == "ok") {
  1676. this.$message({
  1677. message: '撤销成功',
  1678. type: "success"
  1679. });
  1680. row.status = 3;
  1681. } else {
  1682. this.$message({
  1683. message: res.msg,
  1684. type: "error"
  1685. });
  1686. }
  1687. },
  1688. error => {
  1689. this.$message({
  1690. message: error,
  1691. type: "error"
  1692. });
  1693. });
  1694. },
  1695. // 暂停项目
  1696. suspendPro(row) {
  1697. this.http.post('/project/suspend',{id: row.id},
  1698. res => {
  1699. if (res.code == "ok") {
  1700. this.$message({
  1701. message: '暂停成功',
  1702. type: "success"
  1703. });
  1704. row.status = 4;
  1705. } else {
  1706. this.$message({
  1707. message: res.msg,
  1708. type: "error"
  1709. });
  1710. }
  1711. },
  1712. error => {
  1713. this.$message({
  1714. message: error,
  1715. type: "error"
  1716. });
  1717. });
  1718. },
  1719. //完成项目
  1720. finishPro(row) {
  1721. this.http.post('/project/finish',{id: row.id},
  1722. res => {
  1723. if (res.code == "ok") {
  1724. this.$message({
  1725. message: '项目完成',
  1726. type: "success"
  1727. });
  1728. row.status = 2;
  1729. } else {
  1730. this.$message({
  1731. message: res.msg,
  1732. type: "error"
  1733. });
  1734. }
  1735. },
  1736. error => {
  1737. this.$message({
  1738. message: error,
  1739. type: "error"
  1740. });
  1741. });
  1742. },
  1743. exportProjectData() {
  1744. //导出项目
  1745. this.http.post('/project/exportData',{},
  1746. res => {
  1747. if (res.code == "ok") {
  1748. var filePath = res.data;
  1749. const a = document.createElement('a'); // 创建a标签
  1750. a.setAttribute('download', '项目导出.xls');// download属性
  1751. a.setAttribute('href', filePath);// href链接
  1752. a.click(); //自执行点击事件
  1753. a.remove();
  1754. }
  1755. },
  1756. error => {
  1757. this.$message({
  1758. message: error,
  1759. type: "error"
  1760. });
  1761. }
  1762. );
  1763. },
  1764. userssHu() {
  1765. this.http.post('/time-type/getCompanyTimeSetting',{
  1766. companyId: this.user.companyId
  1767. },
  1768. res => {
  1769. if (res.code == "ok") {
  1770. this.yonghuUser = res.data
  1771. console.log(this.yonghuUser)
  1772. }
  1773. },
  1774. error => {
  1775. this.$message({
  1776. message: error,
  1777. type: "error"
  1778. });
  1779. }
  1780. );
  1781. },
  1782. yanjiuzx() {
  1783. this.http.post('/report-extra-degree/getAll ',{},
  1784. res => {
  1785. if (res.code == "ok") {
  1786. console.log(res, '过来的数据')
  1787. this.ause = res.data
  1788. } else {
  1789. this.$message({
  1790. message: res.msg,
  1791. type: "error"
  1792. });
  1793. }
  1794. },
  1795. error => {
  1796. this.$message({
  1797. message: error,
  1798. type: "error"
  1799. });
  1800. }
  1801. );
  1802. },
  1803. selectPublic() {
  1804. if (this.addForm.isPublic == 1) {
  1805. this.participator = this.users;
  1806. } else {
  1807. this.participator = [];
  1808. }
  1809. },
  1810. addPpMemb() {
  1811. //检查合计比例是否到达100%
  1812. let p = 0;
  1813. let hasNoMemb = false;
  1814. this.curProfessionRow.membList.forEach(m=>{
  1815. p += parseInt(m.percentage);
  1816. //检查人员是否选择
  1817. if (m.membId == null) {
  1818. hasNoMemb = true;
  1819. }
  1820. });
  1821. if (hasNoMemb) {
  1822. this.$message({
  1823. message: '专业人员不能为空',
  1824. type: "error"
  1825. });
  1826. return;
  1827. }
  1828. //检查人员不能重复
  1829. let hasDuplicate = false;
  1830. this.curProfessionRow.membList.forEach(m=>{
  1831. if (this.curProfessionRow.membList.filter(innerM=>innerM.membId == m.membId).length>1) {
  1832. hasDuplicate = true;
  1833. }
  1834. });
  1835. if (hasDuplicate) {
  1836. this.$message({
  1837. message: '专业人员不能重复',
  1838. type: "error"
  1839. });
  1840. return;
  1841. }
  1842. if (p != 100) {
  1843. this.$message({
  1844. message: '占比合计必须是100%',
  1845. type: "error"
  1846. });
  1847. return;
  1848. }
  1849. this.editPpMembDialog = false;
  1850. this.curProfessionRow.membList.forEach(m=>{
  1851. m.membName = this.participator.filter(p=>p.id == m.membId)[0].name;
  1852. });
  1853. this.projectProfessionItem.membList = JSON.parse(JSON.stringify(this.curProfessionRow.membList));
  1854. },
  1855. //删除专业人员
  1856. deleteMembItem(index) {
  1857. this.curProfessionRow.membList.splice(index,1);
  1858. },
  1859. //添加专业人员
  1860. addMembItem() {
  1861. if (this.curProfessionRow.membList == null) {
  1862. this.curProfessionRow.membList = [{membId:null, percentage:100}];
  1863. } else {
  1864. let p = 0;
  1865. this.curProfessionRow.membList.forEach(m=>{
  1866. p += parseInt(m.percentage);
  1867. });
  1868. this.curProfessionRow.membList.push({membId:null, percentage:100-p});
  1869. }
  1870. this.$forceUpdate();
  1871. },
  1872. showEditPpMembs(row) {
  1873. this.projectProfessionItem = row;
  1874. this.curProfessionRow = JSON.parse(JSON.stringify(row));
  1875. if (this.curProfessionRow.membList == null || this.curProfessionRow.membList.length == 0) {
  1876. this.curProfessionRow.membList = [{membId:null, percentage:100}];
  1877. }
  1878. this.editPpMembDialog = true;
  1879. },
  1880. getProjectNotifyUserList(projectId) {
  1881. this.http.post("/project-notify-user/get", {projectId: projectId},
  1882. res => {
  1883. if (res.code == "ok") {
  1884. var chosenLeaderIds = [];
  1885. var chosenLeaderNames = '';
  1886. var leaderList = res.data;
  1887. this.chosenLeaders = leaderList;
  1888. for(var j in leaderList) {
  1889. chosenLeaderIds.push(leaderList[j].userId)
  1890. chosenLeaderNames += leaderList[j].userName+',';
  1891. }
  1892. if (chosenLeaderNames.length > 0) {
  1893. chosenLeaderNames = chosenLeaderNames.substring(0, chosenLeaderNames.length -1);
  1894. }
  1895. this.addForm.notifyUserIds = chosenLeaderIds;
  1896. this.addForm.notifyUserNames = chosenLeaderNames;
  1897. } else {
  1898. this.$message({
  1899. message: res.msg,
  1900. type: "error"
  1901. });
  1902. }
  1903. },
  1904. error => {
  1905. this.$message({
  1906. message: error,
  1907. type: "error"
  1908. });
  1909. });
  1910. },
  1911. getProjectProfessions(projectId) {
  1912. this.http.post("/project-profession/get", {projectId: projectId},
  1913. res => {
  1914. if (res.code == "ok") {
  1915. this.projectProfessionList = res.data;
  1916. } else {
  1917. this.$message({
  1918. message: res.msg,
  1919. type: "error"
  1920. });
  1921. }
  1922. },
  1923. error => {
  1924. this.$message({
  1925. message: error,
  1926. type: "error"
  1927. });
  1928. });
  1929. },
  1930. checkProjectProfession() {
  1931. //检查合计比例是否到达100%
  1932. let p = 0;
  1933. let hasNoMemb = false;
  1934. let hasNoProfession = false;
  1935. let hasNoMembList = false;
  1936. this.projectProfessionList.forEach(m=>{
  1937. p += parseInt(m.percentage);
  1938. //检查人员是否选择
  1939. if (m.inchargerId == null) {
  1940. hasNoMemb = true;
  1941. }
  1942. if (m.professionId == null) {
  1943. hasNoProfession = true;
  1944. }
  1945. if (m.membList == null) {
  1946. hasNoMembList = true;
  1947. }
  1948. });
  1949. if (hasNoProfession) {
  1950. this.$message({
  1951. message: '专业不能为空',
  1952. type: "error"
  1953. });
  1954. return false;
  1955. }
  1956. if (hasNoMembList) {
  1957. this.$message({
  1958. message: '专业相关人员不能为空',
  1959. type: "error"
  1960. });
  1961. return false;
  1962. }
  1963. if (hasNoMemb) {
  1964. this.$message({
  1965. message: '专业负责人不能为空',
  1966. type: "error"
  1967. });
  1968. return false;
  1969. }
  1970. //检查专业不能重复
  1971. let hasDuplicate = false;
  1972. this.projectProfessionList.forEach(m=>{
  1973. if (this.projectProfessionList.filter(innerM=>innerM.professionId == m.professionId).length>1) {
  1974. hasDuplicate = true;
  1975. }
  1976. });
  1977. if (hasDuplicate) {
  1978. this.$message({
  1979. message: '专业不能重复',
  1980. type: "error"
  1981. });
  1982. return false;
  1983. }
  1984. if (this.projectProfessionList.length > 0 && p != 100) {
  1985. this.$message({
  1986. message: '专业占比合计必须是100%',
  1987. type: "error"
  1988. });
  1989. return false;
  1990. }
  1991. return true;
  1992. },
  1993. //保存项目专业
  1994. saveProjectProfessions(projectId) {
  1995. var list = this.projectProfessionList.filter(p=>p.professionId != null);
  1996. list.forEach(p=>p.inchargerName = this.participator.filter(m=>m.id == p.inchargerId)[0].name);
  1997. list.forEach(p=>p.professionName = this.professionList.filter(m=>m.id == p.professionId)[0].name);
  1998. this.http.post("/project-profession/modify", {projectId: projectId, json: JSON.stringify(list)},
  1999. res => {
  2000. if (res.code == "ok") {
  2001. return false;
  2002. } else {
  2003. this.$message({
  2004. message: res.msg,
  2005. type: "error"
  2006. });
  2007. }
  2008. },
  2009. error => {
  2010. this.$message({
  2011. message: error,
  2012. type: "error"
  2013. });
  2014. });
  2015. },
  2016. //删除项目专业
  2017. deleteItem(index) {
  2018. this.projectProfessionList.splice(index,1);
  2019. },
  2020. //添加项目专业
  2021. addItem() {
  2022. let p = 0;
  2023. this.projectProfessionList.forEach(m=>{
  2024. p += parseInt(m.percentage);
  2025. });
  2026. this.projectProfessionList.push( { professionId:null, inchargerId:null,membIds:[], percentage: 100-p});
  2027. },
  2028. getProfessionList() {
  2029. this.http.post("/profession/getAll", {},
  2030. res => {
  2031. if (res.code == "ok") {
  2032. var list = res.data;
  2033. this.professionList = list;
  2034. } else {
  2035. this.$message({
  2036. message: res.msg,
  2037. type: "error"
  2038. });
  2039. }
  2040. },
  2041. error => {
  2042. this.$message({
  2043. message: error,
  2044. type: "error"
  2045. });
  2046. });
  2047. },
  2048. restrictNumber(targetId) {
  2049. let inpu = document.getElementById(targetId);
  2050. inpu.value = inpu.value.replace(/[^\d.]/g, ""); //仅保留数字和"."
  2051. inpu.value = inpu.value.replace(/\.{2,}/g, "."); //两个连续的"."仅保留第一个"."
  2052. inpu.value = inpu.value.replace(".", "$#*").replace(/\./g,'').replace('$#*','.');//去除其他"."
  2053. inpu.value = inpu.value.replace(/^(\d+)\.(\d\d).*$/, '$1.$2');;//限制只能输入两个小数
  2054. if (inpu.value.indexOf(".") < 0 && inpu.value != "") { //首位是0的话去掉
  2055. inpu.value = parseFloat(inpu.value);
  2056. }
  2057. },
  2058. showChooseLeaderTree() {
  2059. this.chosenMembCount = this.chosenLeaders.length;
  2060. this.chooseLeaderVisible = true;
  2061. },
  2062. onLeaderTreeItemChange() {
  2063. var chosenList = this.$refs.chooseLeaderTree.getCheckedNodes();
  2064. var list = chosenList.filter(item=>item.isUser == 1);
  2065. this.chosenMembCount = list.length;
  2066. },
  2067. showChooseMembTree() {
  2068. this.chosenMembCount = this.participator.length;
  2069. this.chooseParticipVisible = true;
  2070. this.filterText = ''
  2071. },
  2072. onTreeItemChange() {
  2073. var chosenList = this.$refs.chooseMembTree.getCheckedNodes();
  2074. var list = chosenList.filter(item=>item.isUser == 1);
  2075. this.chosenMembCount = list.length;
  2076. },
  2077. findUserInTree() {
  2078. if (this.filterName == '') {
  2079. this.deptMembData = this.allMembData;
  2080. } else {
  2081. var list = this.findRecursively(this.filterName, this.allMembData);
  2082. this.deptMembData = list;
  2083. }
  2084. },
  2085. findRecursively(username, list) {
  2086. var filterList = [];
  2087. for (var i=0;i<list.length; i++) {
  2088. if (list[i].isUser == 1) {
  2089. if (list[i].label.indexOf(username) >= 0) {
  2090. //匹配上了
  2091. filterList.push(list[i]);
  2092. }
  2093. } else if (list[i].children != null && list[i].children.length > 0) {
  2094. var subList = this.findRecursively(username, list[i].children);
  2095. if (subList.length > 0) {
  2096. subList.forEach(s=>filterList.push(s));
  2097. }
  2098. }
  2099. }
  2100. return filterList;
  2101. },
  2102. //确定选择参与人
  2103. chooseParticip() {
  2104. this.chooseParticipVisible = false;
  2105. var chosenList = this.$refs.chooseMembTree.getCheckedNodes();
  2106. this.chosenMembList = chosenList.filter(item=>item.isUser == 1);
  2107. this.addForm.userNames = '';
  2108. this.addForm.userId = [];
  2109. this.participator = [];
  2110. for (var i=0;i<this.chosenMembList.length; i++) {
  2111. this.addForm.userId.push(this.chosenMembList[i].id);
  2112. this.addForm.userNames += this.chosenMembList[i].label+',';
  2113. var item = {id:this.chosenMembList[i].id, name:this.chosenMembList[i].label};
  2114. this.participator.push(item);
  2115. }
  2116. if (this.addForm.userNames.length > 0) {
  2117. this.addForm.userNames = this.addForm.userNames.substring(0, this.addForm.userNames.length-1);
  2118. }
  2119. },
  2120. //选中相关领导
  2121. chooseLeader() {
  2122. this.chooseLeaderVisible = false;
  2123. var chosenList = this.$refs.chooseLeaderTree.getCheckedNodes();
  2124. var chosenMembList = chosenList.filter(item=>item.isUser == 1);
  2125. this.addForm.notifyUserNames = '';
  2126. this.addForm.notifyUserIds = [];
  2127. this.chosenLeaders = [];
  2128. for (var i=0;i<chosenMembList.length; i++) {
  2129. this.addForm.notifyUserIds.push(chosenMembList[i].id);
  2130. this.addForm.notifyUserNames += chosenMembList[i].label+',';
  2131. var item = {userId:chosenMembList[i].id, userName:chosenMembList[i].label};
  2132. this.chosenLeaders.push(item);
  2133. }
  2134. if (this.addForm.notifyUserNames.length > 0) {
  2135. this.addForm.notifyUserNames = this.addForm.notifyUserNames.substring(0, this.addForm.notifyUserNames.length-1);
  2136. }
  2137. },
  2138. // 获取部门列表
  2139. getDepartment() {
  2140. this.http.post("/department/listAllMemb", {},
  2141. res => {
  2142. if (res.code == "ok") {
  2143. var list = res.data;
  2144. //设置员工到部门下面
  2145. this.setUserToDept(list);
  2146. this.deptMembData = list;
  2147. //用于筛选过滤
  2148. this.allMembData = JSON.parse(JSON.stringify(this.deptMembData));
  2149. } else {
  2150. this.$message({
  2151. message: res.msg,
  2152. type: "error"
  2153. });
  2154. }
  2155. },
  2156. error => {
  2157. this.$message({
  2158. message: error,
  2159. type: "error"
  2160. });
  2161. });
  2162. },
  2163. setUserToDept(list) {
  2164. for (var i in list) {
  2165. if (list[i].children != null) {
  2166. this.setUserToDept(list[i].children);
  2167. }
  2168. if (list[i].userList != null) {
  2169. if (list[i].children == null) {
  2170. list[i].children = [];
  2171. }
  2172. list[i].userList.forEach(element => {
  2173. var obj = {id: element.id, label:element.name, parentId:element.departmentId, isUser:1};
  2174. list[i].children.push(obj);
  2175. });
  2176. }
  2177. }
  2178. },
  2179. // 获取分类条目
  2180. getClfConfigList() {
  2181. this.http.get('/project-category/list',
  2182. res => {
  2183. if (res.code == "ok") {
  2184. this.baseClfList = res.data;
  2185. console.log("获取分类条目",res.data);
  2186. this.$forceUpdate();
  2187. } else {
  2188. this.$message({
  2189. message: res.msg,
  2190. type: "error"
  2191. });
  2192. }
  2193. },
  2194. error => {
  2195. this.$message({
  2196. message: error,
  2197. type: "error"
  2198. });
  2199. }
  2200. );
  2201. },
  2202. // 新增/编辑 分类条目
  2203. addNewClf(row) {
  2204. this.addClfDialog = true;
  2205. if (row == null) {
  2206. this.addClf = {}
  2207. } else {
  2208. this.addClf = row;
  2209. }
  2210. },
  2211. // 提交
  2212. submitClf() {
  2213. this.http.post('/project-category/addOrMod',this.addClf,
  2214. res => {
  2215. if (res.code == "ok") {
  2216. this.addClfDialog = false;
  2217. this.baseClfList = res.data;
  2218. // this.$forceUpdate();
  2219. // console.log(res.data);
  2220. } else {
  2221. this.$message({
  2222. message: res.msg,
  2223. type: "error"
  2224. });
  2225. }
  2226. },
  2227. error => {
  2228. this.$message({
  2229. message: error,
  2230. type: "error"
  2231. });
  2232. }
  2233. );
  2234. },
  2235. // 提交
  2236. submitManPro() {
  2237. this.http.post('/project-main/addOrMod',this.addMainForm,
  2238. res => {
  2239. if (res.code == "ok") {
  2240. this.addFlgmainProjectDialog = false;
  2241. this.getMainProject()
  2242. } else {
  2243. this.$message({
  2244. message: res.msg,
  2245. type: "error"
  2246. });
  2247. }
  2248. },
  2249. error => {
  2250. this.$message({
  2251. message: error,
  2252. type: "error"
  2253. });
  2254. }
  2255. );
  2256. },
  2257. // 提交项目阶段
  2258. submitPanthPro() {
  2259. this.http.post('/project-stage/addOrMod',this.addPanthForm,
  2260. res => {
  2261. if (res.code == "ok") {
  2262. this.addFlgPanthProjectDialog = false;
  2263. this.obtainPhase()
  2264. } else {
  2265. this.$message({
  2266. message: res.msg,
  2267. type: "error"
  2268. });
  2269. }
  2270. },
  2271. error => {
  2272. this.$message({
  2273. message: error,
  2274. type: "error"
  2275. });
  2276. }
  2277. );
  2278. },
  2279. // 删除
  2280. deleteClf(row) {
  2281. this.$confirm("该操作可能造成已有数据丢失,确定要删除吗?","删除分类条目", {
  2282. confirmButtonText: "确定",
  2283. cancelButtonText: "取消",
  2284. type: "warning"
  2285. })
  2286. .then(() => {
  2287. this.listLoading = true;
  2288. this.http.post('/project-category/delete',{
  2289. id: row.id
  2290. },
  2291. res => {
  2292. this.listLoading = false;
  2293. if (res.code == "ok") {
  2294. this.$message({
  2295. message: "删除成功",
  2296. type: "success"
  2297. });
  2298. this.getClfConfigList();
  2299. } else {
  2300. this.$message({
  2301. message: res.msg,
  2302. type: "error"
  2303. });
  2304. }
  2305. },
  2306. error => {
  2307. this.listLoading = false;
  2308. this.$message({
  2309. message: error,
  2310. type: "error"
  2311. });
  2312. }
  2313. );
  2314. })
  2315. .catch(() => {});
  2316. },
  2317. // 删除主项目
  2318. deleteManPro(row) {
  2319. this.$confirm("该操作可能造成已有数据丢失,确定要删除吗?","删除主项目", {
  2320. confirmButtonText: "确定",
  2321. cancelButtonText: "取消",
  2322. type: "warning"
  2323. })
  2324. .then(() => {
  2325. this.listLoading = true;
  2326. this.http.post('/project-main/delete',{
  2327. id: row.id
  2328. },
  2329. res => {
  2330. this.listLoading = false;
  2331. if (res.code == "ok") {
  2332. this.$message({
  2333. message: "删除成功",
  2334. type: "success"
  2335. });
  2336. this.getMainProject();
  2337. } else {
  2338. this.$message({
  2339. message: res.msg,
  2340. type: "error"
  2341. });
  2342. }
  2343. },
  2344. error => {
  2345. this.listLoading = false;
  2346. this.$message({
  2347. message: error,
  2348. type: "error"
  2349. });
  2350. }
  2351. );
  2352. })
  2353. .catch(() => {});
  2354. },
  2355. // 删除项目阶段
  2356. deletePanthPro(row) {
  2357. this.$confirm("该操作可能造成已有数据丢失,确定要删除吗?","删除项目阶段", {
  2358. confirmButtonText: "确定",
  2359. cancelButtonText: "取消",
  2360. type: "warning"
  2361. })
  2362. .then(() => {
  2363. this.listLoading = true;
  2364. this.http.post('/project-stage/delete ',{
  2365. id: row.id
  2366. },
  2367. res => {
  2368. this.listLoading = false;
  2369. if (res.code == "ok") {
  2370. this.$message({
  2371. message: "删除成功",
  2372. type: "success"
  2373. });
  2374. this.obtainPhase();
  2375. } else {
  2376. this.$message({
  2377. message: res.msg,
  2378. type: "error"
  2379. });
  2380. }
  2381. },
  2382. error => {
  2383. this.listLoading = false;
  2384. this.$message({
  2385. message: error,
  2386. type: "error"
  2387. });
  2388. }
  2389. );
  2390. })
  2391. .catch(() => {});
  2392. },
  2393. // 分类筛选
  2394. searchClfList(){
  2395. this.page = 1;
  2396. this.getList();
  2397. },
  2398. getProjectBaseConfigList() {
  2399. this.http.post('/project-basecost-setting/list',{},
  2400. res => {
  2401. if (res.code == "ok") {
  2402. this.baseCostItemList = res.data;
  2403. this.$forceUpdate();
  2404. } else {
  2405. this.$message({
  2406. message: res.msg,
  2407. type: "error"
  2408. });
  2409. }
  2410. },
  2411. error => {
  2412. this.$message({
  2413. message: error,
  2414. type: "error"
  2415. });
  2416. }
  2417. );
  2418. },
  2419. deleteBaseItem(row) {
  2420. this.$confirm("该操作可能造成已有数据丢失,确定要删除吗?","删除成本基线项", {
  2421. confirmButtonText: "确定",
  2422. cancelButtonText: "取消",
  2423. type: "warning"
  2424. })
  2425. .then(() => {
  2426. this.listLoading = true;
  2427. this.http.post('/project-basecost-setting/delete',{
  2428. id: row.id
  2429. },
  2430. res => {
  2431. this.listLoading = false;
  2432. if (res.code == "ok") {
  2433. this.$message({
  2434. message: "删除成功",
  2435. type: "success"
  2436. });
  2437. this.getProjectBaseConfigList();
  2438. } else {
  2439. this.$message({
  2440. message: res.msg,
  2441. type: "error"
  2442. });
  2443. }
  2444. },
  2445. error => {
  2446. this.listLoading = false;
  2447. this.$message({
  2448. message: error,
  2449. type: "error"
  2450. });
  2451. }
  2452. );
  2453. })
  2454. .catch(() => {});
  2455. },
  2456. submitInsertBaseItem() {
  2457. this.http.post('/project-basecost-setting/addOrMod',this.addForm,
  2458. res => {
  2459. if (res.code == "ok") {
  2460. this.addBaseItemDialog = false;
  2461. this.baseCostItemList = res.data;
  2462. this.$forceUpdate();
  2463. } else {
  2464. this.$message({
  2465. message: res.msg,
  2466. type: "error"
  2467. });
  2468. }
  2469. },
  2470. error => {
  2471. this.$message({
  2472. message: error,
  2473. type: "error"
  2474. });
  2475. }
  2476. );
  2477. },
  2478. showBaseCostItemDialog() {
  2479. this.showBaseConfig = true;
  2480. },
  2481. addNewBaseItem(row) {
  2482. this.addBaseItemDialog = true;
  2483. if (row == null) {
  2484. this.addForm = {alarmType: 0}
  2485. } else {
  2486. this.addForm = row;
  2487. }
  2488. },
  2489. //获取客户列表
  2490. getCustomerList() {
  2491. this.http.post('/customer-info/getAll', {
  2492. },
  2493. res => {
  2494. if (res.code == "ok") {
  2495. this.customerList = res.data;
  2496. } else {
  2497. this.$message({
  2498. message: res.msg,
  2499. type: "error"
  2500. });
  2501. }
  2502. },
  2503. error => {
  2504. this.$message({
  2505. message: error,
  2506. type: "error"
  2507. });
  2508. });
  2509. },
  2510. importProject(item) {
  2511. //首先判断文件类型
  2512. let str = item.file.name.split(".");
  2513. let format = str[str.length - 1];
  2514. if (format != "xls" && format != "xlsx") {
  2515. this.$message({
  2516. message: "请选择.xls或.xlsx文件",
  2517. type: "error"
  2518. });
  2519. } else {
  2520. this.listLoading = true;
  2521. let formData = new FormData();
  2522. formData.append("file", item.file);
  2523. formData.append("userId", this.user.id);
  2524. this.http.uploadFile('/project/importData', formData,
  2525. res => {
  2526. this.$refs.upload.clearFiles();
  2527. this.listLoading = false;
  2528. if (res.code == "ok") {
  2529. // this.$message({
  2530. // message: res.data,
  2531. // type: "success"
  2532. // },5000);
  2533. //弹窗显示
  2534. this.showImportResult = true;
  2535. this.importResultMsg = res.data;
  2536. this.getList();
  2537. } else {
  2538. this.$message({
  2539. message: res.msg,
  2540. type: "error"
  2541. });
  2542. }
  2543. },
  2544. error => {
  2545. this.$refs.upload.clearFiles();
  2546. this.listLoading = false;
  2547. this.$message({
  2548. message: error,
  2549. type: "error"
  2550. });
  2551. });
  2552. }
  2553. },
  2554. number(){
  2555. //     this.addForm.budget = this.addForm.budget.replace(/[^\.\d]/g,'');
  2556. // this.addForm.budget = this.addForm.budget.replace('.','');
  2557. },
  2558. deleteSubPro(subProject) {
  2559. this.$confirm("确定要删除子项目" + subProject.name + "吗?","删除子项目", {
  2560. confirmButtonText: "确定",
  2561. cancelButtonText: "取消",
  2562. type: "warning"
  2563. })
  2564. .then(() => {
  2565. this.listLoading = true;
  2566. this.http.post('/sub-project/deleteProject',{
  2567. id: subProject.id
  2568. },
  2569. res => {
  2570. this.listLoading = false;
  2571. if (res.code == "ok") {
  2572. this.$message({
  2573. message: "删除成功",
  2574. type: "success"
  2575. });
  2576. this.subProject(this.currentProject);
  2577. } else {
  2578. this.$message({
  2579. message: res.msg,
  2580. type: "error"
  2581. });
  2582. }
  2583. },
  2584. error => {
  2585. this.listLoading = false;
  2586. this.$message({
  2587. message: error,
  2588. type: "error"
  2589. });
  2590. }
  2591. );
  2592. })
  2593. .catch(() => {});
  2594. },
  2595. searchList() {
  2596. this.page = 1;
  2597. this.getList();
  2598. },
  2599. addNewSubProject(subProject) {
  2600. if (subProject == null) {
  2601. this.temaddForm = {projectId: this.currentProject.id, level:1}
  2602. } else {
  2603. this.temaddForm = JSON.parse(JSON.stringify(subProject));
  2604. }
  2605. this.addSubProject = true;
  2606. },
  2607. //显示子项目
  2608. subProject(item) {
  2609. this.subProjectVisible = true;
  2610. this.currentProject = item;
  2611. this.http.post('/sub-project/list', {
  2612. projectId: item.id
  2613. },
  2614. res => {
  2615. if (res.code == "ok") {
  2616. this.subProjectList = res.data;
  2617. } else {
  2618. this.$message({
  2619. message: res.msg,
  2620. type: "error"
  2621. });
  2622. }
  2623. },
  2624. error => {
  2625. this.$message({
  2626. message: error,
  2627. type: "error"
  2628. });
  2629. });
  2630. },
  2631. //显示用户详情
  2632. showUser(userId) {
  2633. this.userDetailVisible = true;
  2634. this.http.post(this.port.manage.userDetail, {
  2635. userId: userId
  2636. },
  2637. res => {
  2638. if (res.code == "ok") {
  2639. this.userDetail = res.data;
  2640. } else {
  2641. this.$message({
  2642. message: res.msg,
  2643. type: "error"
  2644. });
  2645. }
  2646. },
  2647. error => {
  2648. this.$message({
  2649. message: error,
  2650. type: "error"
  2651. });
  2652. });
  2653. },
  2654. //选择参与人
  2655. changeParticipator() {
  2656. //检查是否在参与人中,如果没有需要加入到参与人中
  2657. this.participator = [];
  2658. this.addForm.userId.forEach(u=>{
  2659. var list = this.users.filter(au=>au.id == u);
  2660. if (list.length > 0) {
  2661. var findUser = list[0];
  2662. this.participator.push(findUser);
  2663. } else {
  2664. console.log('未找到用户: '+u);
  2665. }
  2666. })
  2667. },
  2668. getUsers() {
  2669. // this.http.post(this.port.manage.list, {
  2670. // departmentId: -1,
  2671. // pageIndex: 1,
  2672. // // pageSize: 99999
  2673. // pageSize: -1
  2674. // },
  2675. this.http.post('/user/getSimpleActiveUserList', {},
  2676. res => {
  2677. if (res.code == "ok") {
  2678. this.users = res.data;
  2679. } else {
  2680. this.$message({
  2681. message: res.msg,
  2682. type: "error"
  2683. });
  2684. }
  2685. },
  2686. error => {
  2687. this.$message({
  2688. message: error,
  2689. type: "error"
  2690. });
  2691. });
  2692. },
  2693. //分页
  2694. handleCurrentChange(val) {
  2695. this.page = val;
  2696. this.getList();
  2697. },
  2698. handleSizeChange(val) {
  2699. this.size = val;
  2700. localStorage.projectPageSize = this.size;
  2701. this.getList();
  2702. },
  2703. //获取项目列表
  2704. getList() {
  2705. this.listLoading = true;
  2706. let parameter = {
  2707. pageIndex: this.page,
  2708. pageSize: this.size,
  2709. keyword:this.keyword,
  2710. searchField: this.searchField,
  2711. status: this.status,
  2712. category: this.statusClf,
  2713. projectMainId: this.projectMainId
  2714. }
  2715. if(this.sortOrder){
  2716. if(this.sortProp == 'inchargerName'){
  2717. parameter.sortProp = "incharger_id"
  2718. }else if(this.sortProp == 'customerName'){
  2719. parameter.sortProp = "customer_id"
  2720. }else if(this.sortProp == 'projectCode'){
  2721. parameter.sortProp = 'project_code'
  2722. }else if(this.sortProp == 'categoryName'){
  2723. parameter.sortProp = 'category'
  2724. }else if(this.sortProp == 'projectName'){
  2725. parameter.sortProp = 'project_name'
  2726. }else if(this.sortProp == 'status'){
  2727. parameter.sortProp = 'status'
  2728. }else if(this.sortProp == 'currentStage'){
  2729. parameter.sortProp = 'current_stage_name'
  2730. }
  2731. if(this.sortOrder == 'descending'){
  2732. parameter.sortOrder = 0
  2733. }else if(this.sortOrder == 'ascending'){
  2734. parameter.sortOrder = 1
  2735. }
  2736. }
  2737. this.http.post(this.port.project.listPage, parameter,
  2738. res => {
  2739. this.listLoading = false;
  2740. if (res.code == "ok") {
  2741. var list = res.data.records;
  2742. for(var i in list) {
  2743. var participator = list[i].participator , str = "";
  2744. for(var j in participator) {
  2745. if(j == participator.length-1) {
  2746. str += participator[j].name
  2747. } else {
  2748. str += participator[j].name + ','
  2749. }
  2750. }
  2751. list[i].userNames = str;
  2752. }
  2753. this.showColumnWidth = this.showColumn(list)
  2754. this.list = list;
  2755. this.total = res.data.total;
  2756. this.$nextTick(()=>{
  2757. this.$refs.projectlistOfWudulist.doLayout();
  2758. })
  2759. this.listHeader = res.data.nameList
  2760. } else {
  2761. this.$message({
  2762. message: res.msg,
  2763. type: "error"
  2764. });
  2765. }
  2766. },
  2767. error => {
  2768. this.listLoading = false;
  2769. this.$message({
  2770. message: error,
  2771. type: "error"
  2772. });
  2773. });
  2774. },
  2775. showColumn(list){
  2776. if(!this.permissions.projectManagement){
  2777. let creat = false
  2778. let incha = false
  2779. for(let i in list){
  2780. if(this.user.id == list[i].creatorId){
  2781. creat = true
  2782. }
  2783. if(this.user.id == list[i].inchargerId){
  2784. incha = true
  2785. }
  2786. }
  2787. if(creat){
  2788. return '300'
  2789. }else {
  2790. if(incha){
  2791. return '210'
  2792. }else {
  2793. return '0'
  2794. }
  2795. }
  2796. }else {
  2797. return '300'
  2798. }
  2799. },
  2800. //显示新增界面
  2801. handleAdd(i, item) {
  2802. if(i == -1) {
  2803. this.title = "新增项目";
  2804. this.addForm = {
  2805. name: '',
  2806. isPublic:0,
  2807. userId: [],
  2808. userNames:'',
  2809. code:'',
  2810. inchargerId:null,
  2811. level:1,
  2812. customerId:null,
  2813. notifyUserNames:'',
  2814. chosenLeaders:[],
  2815. category:null,
  2816. creatorId: this.user.id,
  2817. projectMainId: ''
  2818. }
  2819. if(this.user.companyId == '936') {
  2820. this.$set(this.addForm, 'contractCode', '')
  2821. this.$set(this.addForm, 'warrantyStartDate', '')
  2822. this.$set(this.addForm, 'warrantyEndDate', '')
  2823. this.$set(this.addForm, 'projectCategorySub', '')
  2824. this.$set(this.addForm, 'region', '')
  2825. this.$set(this.addForm, 'bu', '')
  2826. }
  2827. this.projectBaseCostData = [];
  2828. this.auseList = [];
  2829. for (var m=0;m<this.baseCostItemList.length; m++) {
  2830. this.projectBaseCostData.push({baseId: this.baseCostItemList[m].id, baseName:this.baseCostItemList[m].name, baseAmount:0});
  2831. }
  2832. } else {
  2833. this.title = "修改项目";
  2834. var list = item.participator;
  2835. if (item.isPublic == 1) {
  2836. list = this.users;
  2837. }
  2838. var arr = [];
  2839. var names = '';
  2840. for(var j in list) {
  2841. arr.push(list[j].id)
  2842. names += list[j].name+',';
  2843. }
  2844. if (names.length > 0) {
  2845. names = names.substring(0, names.length -1);
  2846. }
  2847. this.addForm = {
  2848. id: item.id,
  2849. name: item.projectName,
  2850. isPublic: item.isPublic,
  2851. userId: arr,
  2852. userNames:names,
  2853. code:item.projectCode,
  2854. inchargerId: item.inchargerId,
  2855. level: item.level,
  2856. planStartDate: item.planStartDate,
  2857. planEndDate: item.planEndDate,
  2858. budget: item.budget,
  2859. baseMan: item.baseMan,
  2860. contractAmount: item.contractAmount,
  2861. baseFee: item.baseFee,
  2862. baseRisk1: item.baseRisk1,
  2863. baseRisk2: item.baseRisk2,
  2864. baseOutsourcing: item.baseOutsourcing,
  2865. customerId:item.customerId==0?null:item.customerId,
  2866. category:item.category,
  2867. projectDesc: item.projectDesc,
  2868. projectMainId: item.projectMainId,
  2869. creatorId: item.creatorId
  2870. }
  2871. // 判断公司id是否等于936
  2872. if(this.user.companyId == '936') {
  2873. if(item.projectSeparate) {
  2874. this.$set(this.addForm, 'contractCode', item.projectSeparate.contractCode)
  2875. this.$set(this.addForm, 'warrantyStartDate', item.projectSeparate.warrantyStartDate)
  2876. this.$set(this.addForm, 'warrantyEndDate', item.projectSeparate.warrantyEndDate)
  2877. this.$set(this.addForm, 'projectCategorySub', item.projectSeparate.projectCategorySub)
  2878. this.$set(this.addForm, 'region', item.projectSeparate.region)
  2879. this.$set(this.addForm, 'bu', item.projectSeparate.bu)
  2880. } else {
  2881. this.$set(this.addForm, 'contractCode', '')
  2882. this.$set(this.addForm, 'warrantyStartDate', '')
  2883. this.$set(this.addForm, 'warrantyEndDate', '')
  2884. this.$set(this.addForm, 'projectCategorySub', '')
  2885. this.$set(this.addForm, 'region', '')
  2886. this.$set(this.addForm, 'bu', '')
  2887. }
  2888. }
  2889. // 判断是否有供应商
  2890. if(this.user.company.packageProvider) {
  2891. // this.addForm.supplierId = item.providerIds.split(',')
  2892. if(item.providerIds) {
  2893. let arr = []
  2894. let zhhi = item.providerIds.split(',')
  2895. for(let i in zhhi) {
  2896. arr.push(+zhhi[i] + 0)
  2897. }
  2898. this.$set(this.addForm, 'supplierId', arr)
  2899. console.log( this.addForm.supplierId)
  2900. } else {
  2901. this.$set(this.addForm, 'supplierId', [])
  2902. }
  2903. }
  2904. // 判断是否有供应商结尾
  2905. this.deleteVif = item.creatorId
  2906. console.log("handleadd",this.deleteVif,this.addForm.id)
  2907. if(item.associateDegrees != null && item.associateDegrees != 'null' && item.associateDegrees != '') {
  2908. var spli = item.associateDegrees.split(',')
  2909. var sl = []
  2910. for(var i in spli) {
  2911. var num = +spli[i] + 0
  2912. sl.push(num)
  2913. }
  2914. this.auseList = sl
  2915. // console.log(this.auseList)
  2916. } else {
  2917. this.auseList = []
  2918. }
  2919. // var spli = item.associateDegrees.split(',')
  2920. // var sl = []
  2921. // for(var i in spli) {
  2922. // var num = +spli[i] + 0
  2923. // sl.push(num)
  2924. // }
  2925. // this.auseList = sl
  2926. // console.log(this.auseList)
  2927. this.changeParticipator();
  2928. this.getProjectBaseData(item.id);
  2929. if (this.user.company.packageEngineering == 1) {
  2930. this.getProjectProfessions(item.id);
  2931. }
  2932. //获取项目的相关领导
  2933. this.getProjectNotifyUserList(item.id);
  2934. this.getProjectAutorList(item.id);
  2935. }
  2936. this.addFormVisible = true;
  2937. if (this.user.company.packageEngineering == 1) {
  2938. if (this.professionList.length == 0) {
  2939. this.getProfessionList();
  2940. }
  2941. }
  2942. },
  2943. //获取项目审核人
  2944. getProjectAutorList(projectId) {
  2945. this.http.post('/project-auditor/getList',{projectId: projectId},
  2946. res => {
  2947. if (res.code == "ok") {
  2948. this.addForm.auditUserIds = res.data.map(function(item) {
  2949. return item.auditorId;
  2950. });
  2951. } else {
  2952. this.$message({
  2953. message: res.msg,
  2954. type: "error"
  2955. });
  2956. }
  2957. },
  2958. error => {
  2959. this.listLoading = false;
  2960. this.$message({
  2961. message: error,
  2962. type: "error"
  2963. });
  2964. }
  2965. );
  2966. },
  2967. getProjectBaseData(projectId) {
  2968. this.http.post('/project-basecost/get',{projectId: projectId},
  2969. res => {
  2970. if (res.code == "ok") {
  2971. this.projectBaseCostData = res.data;
  2972. } else {
  2973. this.$message({
  2974. message: res.msg,
  2975. type: "error"
  2976. });
  2977. }
  2978. },
  2979. error => {
  2980. this.listLoading = false;
  2981. this.$message({
  2982. message: error,
  2983. type: "error"
  2984. });
  2985. }
  2986. );
  2987. },
  2988. //提交子项目创建修改请求
  2989. submitInsertSubProject () {
  2990. this.$refs.form2.validate(valid => {
  2991. if (valid) {
  2992. this.http.post('/sub-project/saveOrUpdate',this.temaddForm,
  2993. res => {
  2994. if (res.code == "ok") {
  2995. this.$message({
  2996. message: "操作成功",
  2997. type: "success"
  2998. });
  2999. this.subProject(this.currentProject);
  3000. this.addSubProject = false;
  3001. } else {
  3002. this.$message({
  3003. message: res.msg,
  3004. type: "error"
  3005. });
  3006. }
  3007. },
  3008. error => {
  3009. this.listLoading = false;
  3010. this.$message({
  3011. message: error,
  3012. type: "error"
  3013. });
  3014. }
  3015. );
  3016. }
  3017. });
  3018. },
  3019. // 项目基线合计
  3020. addUpfun() {
  3021. var total = 0;
  3022. for (var i=0;i<this.projectBaseCostData.length; i++) {
  3023. total += parseFloat(this.projectBaseCostData[i].baseAmount);
  3024. }
  3025. this.addForm.budget = total;
  3026. // var a = '0'
  3027. // var q = '0'
  3028. // var w = '0'
  3029. // var e = '0'
  3030. // var r = '0'
  3031. // // this.addForm.baseMan === undefined || this.addForm.baseMan === NaN ? this.addForm.baseMa = '0' : this.addForm.baseMan
  3032. // if (this.addForm.baseMan == undefined || this.addForm.baseMan == NaN) {
  3033. // a = 0
  3034. // } else {
  3035. // a = this.addForm.baseMan
  3036. // }
  3037. // if (this.addForm.baseFee !== undefined) q = this.addForm.baseFee
  3038. // if (this.addForm.baseOutsourcing !== undefined) w = this.addForm.baseOutsourcing
  3039. // if (this.addForm.baseRisk1 !== undefined) e = this.addForm.baseRisk1
  3040. // if (this.addForm.baseRisk2 !== undefined) r = this.addForm.baseRisk2
  3041. // this.addForm.budget = +a + +q + +w + +e + +r
  3042. },
  3043. submitInsert() {
  3044. this.$refs.form1.validate(valid => {
  3045. if (valid) {
  3046. if (this.user.company.packageEngineering == 1) {
  3047. if (!this.checkProjectProfession()) {//检查不通过,直接返回
  3048. return;
  3049. }
  3050. }
  3051. this.addLoading = true;
  3052. let formData = new FormData();
  3053. formData.append("name", this.addForm.name);
  3054. if(this.addForm.projectDesc != null) {
  3055. formData.append("projectDesc", this.addForm.projectDesc);
  3056. }
  3057. if(this.addForm.id != null) {
  3058. formData.append("id", this.addForm.id);
  3059. }
  3060. if(this.addForm.isPublic != null) {
  3061. formData.append("isPublic", this.addForm.isPublic);
  3062. }
  3063. if(this.addForm.userId.length != 0 && this.addForm.isPublic == 0) {
  3064. for(var j in this.addForm.userId) {
  3065. formData.append("userId", this.addForm.userId[j]);
  3066. }
  3067. }
  3068. if(this.addForm.inchargerId != null) {
  3069. formData.append("inchargerId", this.addForm.inchargerId);
  3070. }
  3071. if(this.addForm.code != null) {
  3072. formData.append("code", this.addForm.code);
  3073. }
  3074. if(this.addForm.planStartDate != null) {
  3075. formData.append("planStartDate", this.addForm.planStartDate);
  3076. }
  3077. if(this.addForm.planEndDate != null) {
  3078. formData.append("planEndDate", this.addForm.planEndDate);
  3079. }
  3080. if(this.addForm.level != null) {
  3081. formData.append("level", this.addForm.level);
  3082. }
  3083. if(this.addForm.contractAmount != null) {
  3084. formData.append("contractAmount", this.addForm.contractAmount);
  3085. }
  3086. if (this.projectBaseCostData != null) {
  3087. formData.append("projectBaseCostData", JSON.stringify(this.projectBaseCostData));
  3088. //计算总预算成本
  3089. if (this.addForm.budget == null) {
  3090. this.addForm.budget = 0;
  3091. }
  3092. formData.append("budget", this.addForm.budget);
  3093. }
  3094. if (this.addForm.customerId == null) {
  3095. formData.append("customerId", 0);
  3096. } else {
  3097. formData.append("customerId", this.addForm.customerId);
  3098. }
  3099. if (this.chosenLeaders != null && this.chosenLeaders.length > 0) {
  3100. formData.append("chosenLeaders", JSON.stringify(this.chosenLeaders));
  3101. }
  3102. var listId = []
  3103. var listName = []
  3104. for(var i in this.auseList) {
  3105. for(var j in this.ause) {
  3106. if(this.auseList[i] == this.ause[j].id) {
  3107. listId.push(this.ause[j].id);
  3108. listName.push(this.ause[j].name);
  3109. break;
  3110. }
  3111. }
  3112. }
  3113. listId.toString()
  3114. listName.toString()
  3115. formData.append("associateDegrees", listId)
  3116. formData.append("associateDegreeNames", listName)
  3117. //日报审核人
  3118. formData.append("auditUserIds", JSON.stringify(this.addForm.auditUserIds));
  3119. if(this.addForm.category != null) {
  3120. formData.append("category", this.addForm.category);
  3121. }
  3122. if(this.user.timeType.mainProjectState == '1' && this.addForm.projectMainId) {
  3123. formData.append("projectMainId", this.addForm.projectMainId);
  3124. }
  3125. // 提交供应商
  3126. // 线判断是否有供应商
  3127. if(this.user.company.packageProvider) {
  3128. let suppStrName = []
  3129. for(let is in this.addForm.supplierId) {
  3130. for(let js in this.supplierList) {
  3131. if(this.addForm.supplierId[is] == this.supplierList[js].id) {
  3132. suppStrName.push(this.supplierList[js].providerName)
  3133. }
  3134. }
  3135. }
  3136. formData.append("providerNames", suppStrName.toString());
  3137. formData.append("providerIds", this.addForm.supplierId.toString());
  3138. }
  3139. // 判断公司id是否等于 936
  3140. if(this.user.companyId == '936') {
  3141. formData.append("contractCode", this.addForm.contractCode ? this.addForm.contractCode : '');
  3142. formData.append("warrantyStartDate", this.addForm.warrantyStartDate ? this.addForm.warrantyStartDate : '');
  3143. formData.append("warrantyEndDate", this.addForm.warrantyEndDate ? this.addForm.warrantyEndDate : '');
  3144. formData.append("projectCategorySub", this.addForm.projectCategorySub ? this.addForm.projectCategorySub : '');
  3145. formData.append("region", this.addForm.region ? this.addForm.region : '');
  3146. formData.append("bu", this.addForm.bu ? this.addForm.bu : '');
  3147. }
  3148. // formData.append("associateDegreeNames", listName)
  3149. // console.log("addform",this.addForm);
  3150. // return
  3151. this.http.uploadFile(this.port.project.add,formData,
  3152. res => {
  3153. this.addLoading = false;
  3154. if (res.code == "ok") {
  3155. this.$message({
  3156. message: (this.addForm.id!=null?'修改':'创建')+"成功",
  3157. type: "success"
  3158. });
  3159. this.addFormVisible = false;
  3160. this.getList();
  3161. if (this.user.company.packageEngineering == 1) {
  3162. this.saveProjectProfessions(res.data);
  3163. }
  3164. } else {
  3165. this.$message({
  3166. message: res.msg,
  3167. type: "error"
  3168. });
  3169. }
  3170. },
  3171. error => {
  3172. this.addLoading = false;
  3173. this.$message({
  3174. message: error,
  3175. type: "error"
  3176. });
  3177. });
  3178. }
  3179. });
  3180. },
  3181. // 删除
  3182. deletePro(i, item) {
  3183. this.$confirm("确定要删除项目[" + item.name + "]吗?","删除项目", {
  3184. confirmButtonText: "确定",
  3185. cancelButtonText: "取消",
  3186. type: "warning"
  3187. })
  3188. .then(() => {
  3189. this.listLoading = true;
  3190. this.http.post(this.port.project.delete,{
  3191. id: item.id
  3192. },
  3193. res => {
  3194. this.listLoading = false;
  3195. if (res.code == "ok") {
  3196. this.$message({
  3197. message: "删除成功",
  3198. type: "success"
  3199. });
  3200. this.getList();
  3201. this.addFormVisible = false
  3202. } else if (res.code == 'reconfirm') {
  3203. this.deleteAlertMsg = res.msg;
  3204. this.forceDeletePro(item.id);
  3205. } else {
  3206. this.$message({
  3207. message: res.msg,
  3208. type: "error"
  3209. });
  3210. }
  3211. },
  3212. error => {
  3213. this.listLoading = false;
  3214. this.$message({
  3215. message: error,
  3216. type: "error"
  3217. });
  3218. }
  3219. );
  3220. })
  3221. .catch(() => {});
  3222. },
  3223. // 模板下载
  3224. downloadmb(){
  3225. this.http.post('/project/getTemplate',{
  3226. companyId: this.user.companyId
  3227. },res => {
  3228. if(res.code == 'ok'){
  3229. var filePath = res.data;
  3230. const a = document.createElement('a'); // 创建a标签
  3231. var fileName = filePath.split('/')[2];
  3232. a.setAttribute('download', fileName);// download属性
  3233. a.setAttribute('href', filePath);// href链接
  3234. a.click(); //自执行点击事件
  3235. a.remove();
  3236. }else{
  3237. this.$message({
  3238. message: res.msg,
  3239. type: 'error'
  3240. })
  3241. }
  3242. },err => {
  3243. this.$message({
  3244. message: err,
  3245. type: 'error'
  3246. })
  3247. })
  3248. },
  3249. //强制删除项目
  3250. forceDeletePro(deleteProId) {
  3251. this.$confirm(this.deleteAlertMsg,"删除项目", {
  3252. confirmButtonText: "确定",
  3253. cancelButtonText: "取消",
  3254. type: "warning"
  3255. })
  3256. .then(() => {
  3257. this.listLoading = true;
  3258. this.http.post(this.port.project.delete,{
  3259. id: deleteProId ,force:1
  3260. },
  3261. res => {
  3262. this.listLoading = false;
  3263. if (res.code == "ok") {
  3264. this.$message({
  3265. message: "删除成功",
  3266. type: "success"
  3267. });
  3268. this.getList();
  3269. this.addFormVisible = false;
  3270. } else {
  3271. this.$message({
  3272. message: res.msg,
  3273. type: "error"
  3274. });
  3275. }
  3276. },
  3277. error => {
  3278. this.listLoading = false;
  3279. this.$message({
  3280. message: error,
  3281. type: "error"
  3282. });
  3283. }
  3284. );
  3285. })
  3286. .catch(() => {});
  3287. },
  3288. detail(i) {
  3289. this.$router.push("/list/" + this.list[i].id + "/" + this.list[i].projectName);
  3290. }
  3291. },
  3292. created() {
  3293. let height = window.innerHeight;
  3294. this.tableHeight = height - 195;
  3295. const that = this;
  3296. window.onresize = function temp() {
  3297. that.tableHeight = window.innerHeight - 195;
  3298. };
  3299. },
  3300. mounted() {
  3301. this.userssHu()
  3302. this.getDepartment();
  3303. this.getList();
  3304. this.getUsers();
  3305. this.getCustomerList();
  3306. this.getProjectBaseConfigList();
  3307. this.getClfConfigList()
  3308. this.yanjiuzx()
  3309. // 判断是否有供应商字段
  3310. if(this.user.company.packageProvider == 1){
  3311. this.getSupplierList()
  3312. // this.getPhase()
  3313. }
  3314. if(this.user.company.packageProject == 1) {
  3315. this.obtainPhase()
  3316. }
  3317. // this.getSupplierList()
  3318. if(this.user.timeType.mainProjectState == 1){
  3319. this.getMainProject()
  3320. }
  3321. if(this.user.timeType.projectLevelState == 1){
  3322. this.getProjectLevel()
  3323. }
  3324. // 判断释放为专业版
  3325. if(this.user.company.packageProject == 1) {
  3326. this.importanceList = [{id:1,label:'正常'},{id:5,label:'低风险'},{id:6,label:'中风险'},{id:7,label:'高风险'},{id:2,label:'紧急'},{id:3,label:'重要'},{id:4,label:'重要且紧急'}]
  3327. } else {
  3328. this.importanceList = [{id:1,label:'正常'},{id:2,label:'紧急'},{id:3,label:'重要'},{id:4,label:'重要且紧急'}]
  3329. }
  3330. }
  3331. };
  3332. </script>
  3333. <style lang="scss" scoped>
  3334. .rg_span{
  3335. display: inline-block;
  3336. }
  3337. .rg_span span {
  3338. text-align: right;
  3339. box-sizing: border-box;
  3340. padding-right: 10px;
  3341. }
  3342. .el-dialog__title {
  3343. display: inline-table;
  3344. margin-top: 20px;
  3345. }
  3346. .addss {
  3347. width: 100%;
  3348. overflow: hidden;
  3349. white-space: nowrap;
  3350. text-overflow: ellipsis;
  3351. }
  3352. // 111
  3353. </style>
  3354. <style>
  3355. .el-dropdown-link {
  3356. color: #409EFF;
  3357. }
  3358. .customdropdown{
  3359. margin-left: 10px;
  3360. }
  3361. .customdropdown .el-dropdown__caret-button{
  3362. height: 27px;
  3363. }
  3364. .customdropdown .el-button--mini:nth-child(1){
  3365. height: 27px;
  3366. }
  3367. .customdropdown_menu{
  3368. padding: 0;
  3369. }
  3370. .customdropdown_menu_btn{
  3371. border-color: transparent;
  3372. }
  3373. .ganttdialog .el-dialog__body{
  3374. height: 550px;
  3375. }
  3376. .toolbar_formitem_n1{
  3377. margin-right: 0 !important;
  3378. }
  3379. </style>