list.vue 134 KB

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