list.vue 129 KB

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