list.vue 163 KB

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