list.vue 133 KB

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