list.vue 98 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135
  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>
  10. <el-input style="float:left;" v-model="keyword" class="input-with-select" placeholder="请输入项目名称关键字" clearable="true">
  11. <el-select v-model="searchField" style="width:120px;" slot="prepend" placeholder="请选择">
  12. <el-option label="项目名称" value=1 ></el-option>
  13. <el-option label="项目编号" value=2></el-option>
  14. </el-select>
  15. <el-button slot="append" @click="searchList" icon="el-icon-search"></el-button>
  16. </el-input>
  17. </div>
  18. </el-form-item>
  19. <el-form-item >
  20. <span style="margin-left:5px;margin-right:5px;color:#606266;">状态</span>
  21. <el-select v-model="status" style="width:110px;" placeholder="请选择" @change="searchList">
  22. <el-option label="全部" value=0 ></el-option>
  23. <el-option label="进行中" value=1 ></el-option>
  24. <el-option label="已完成" value=2 ></el-option>
  25. <el-option label="已撤销" value=3 ></el-option>
  26. </el-select>
  27. </el-form-item>
  28. <!-- 分类筛选 -->
  29. <el-form-item >
  30. <span style="margin-left:5px;margin-right:5px;color:#606266;">分类</span>
  31. <el-select v-model="statusClf" style="width:110px;" placeholder="请选择" clearable @change="searchClfList">
  32. <el-option v-for="item in baseClfList" :key="item.id" :label="item.name" :value="item.id" ></el-option>
  33. </el-select>
  34. </el-form-item>
  35. <!-- 分类条目 -->
  36. <el-form-item style="float:right;" v-if="permissions.projectClassification">
  37. <el-link type="primary" :underline="false" @click="showClfDialog = true">分类管理</el-link>
  38. </el-form-item>
  39. <!-- 项目成本基线条目 -->
  40. <el-form-item style="float:right;" v-if="user.company.packageProject == 1 && permissions.projectCostOfItems">
  41. <el-link type="primary" :underline="false" @click="showBaseCostItemDialog">基线成本项</el-link>
  42. </el-form-item>
  43. <el-form-item style="float:right;" v-if="permissions.projectExport">
  44. <el-link type="primary" style="margin-left:5px;" :underline="false" @click="exportProjectData" download="项目导出.xlsx">导出项目</el-link>
  45. </el-form-item>
  46. <el-form-item style="float:right;" v-if="permissions.projectImport">
  47. <el-link type="primary" style="margin-left:5px;" :underline="false" href="./upload/项目导入模板.xlsx" download="项目导入模板.xlsx">模板下载</el-link>
  48. </el-form-item>
  49. <el-form-item style="float:right;" v-if="permissions.projectImport">
  50. <el-upload ref="upload" style="margin-left:5px;" action="#" :limit="1" :http-request="importProject" :show-file-list="false">
  51. <el-link type="primary" :underline="false" >导入项目</el-link>
  52. </el-upload>
  53. </el-form-item>
  54. <!-- <el-form-item style="float:right;" v-if="user.role == 1||user.role == 2||user.role == 5"> -->
  55. <el-form-item style="float:right;" v-if="permissions.projectNew">
  56. <el-link type="primary" :underline="false" @click="handleAdd(-1,null)">新增项目</el-link>
  57. </el-form-item>
  58. <el-form-item style="float:right;" v-if="permissions.projectResources">
  59. <!-- <router-link to="/projectGantt"> -->
  60. <el-link type="primary" :underline="false" @click="isganttshow = true">资源分配</el-link>
  61. <!-- </router-link> -->
  62. <el-dialog v-if="isganttshow" :visible.sync="isganttshow" width="1480px" top="3vh" style="height:96%" class="ganttdialog">
  63. <projectgantt></projectgantt>
  64. </el-dialog>
  65. </el-form-item>
  66. </el-form>
  67. </el-col>
  68. <!--列表-->
  69. <el-table :data="list" highlight-current-row v-loading="listLoading" :height="tableHeight" style="width: 100%;">
  70. <el-table-column type="index" width="60">
  71. <template slot-scope="scope" >
  72. {{scope.$index+1+(page-1)*size}}
  73. </template>
  74. </el-table-column>
  75. <el-table-column prop="projectCode" label="项目编号" sortable width="120"></el-table-column>
  76. <el-table-column prop="categoryName" label="项目分类" sortable width="120"></el-table-column>
  77. <el-table-column prop="projectName" label="项目名称" width="250" sortable>
  78. <template slot-scope="scope">
  79. <!-- <div class="kans">
  80. <el-link type="primary" v-if="user.company.packageProject==1" :href="'#/projectInside/'+scope.row.id">{{scope.row.projectName}}</el-link>
  81. <span v-if="user.company.packageProject==0" >{{scope.row.projectName}}</span>
  82. </div> -->
  83. <el-popover placement="top" width="400" trigger="hover" v-if="scope.row.projectName.length > 15">
  84. <div>
  85. <el-link type="primary" v-if="user.company.packageProject==1" :underline="false" :href="'#/projectInside/'+scope.row.id">{{scope.row.projectName}}</el-link>
  86. <span v-if="user.company.packageProject==0" >{{scope.row.projectName}}</span>
  87. </div>
  88. <div slot="reference" class="kans">
  89. <el-link type="primary" v-if="user.company.packageProject==1" :underline="false" :href="'#/projectInside/'+scope.row.id">{{scope.row.projectName}}</el-link>
  90. <span v-if="user.company.packageProject==0" >{{scope.row.projectName}}</span>
  91. </div>
  92. </el-popover>
  93. <div v-else>
  94. <el-link type="primary" v-if="user.company.packageProject==1" :underline="false" :href="'#/projectInside/'+scope.row.id">{{scope.row.projectName}}</el-link>
  95. <span v-if="user.company.packageProject==0" >{{scope.row.projectName}}</span>
  96. </div>
  97. </template>
  98. </el-table-column>
  99. <el-table-column prop="inchargerName" label="负责人" sortable width="150">
  100. <template slot-scope="scope">
  101. <el-link type="primary" :underline="false" @click="showUser(scope.row.inchargerId)">{{scope.row.inchargerName}}</el-link>
  102. </template>
  103. </el-table-column>
  104. <el-table-column prop="participator" label="参与者" :width="user.company.packageCustomer != 1 ? '' : '300'" sortable v-if="user.company.packageProject==0">
  105. <template slot-scope="scope">
  106. <!-- <v-for v-for="par in scope.row.participator" :key="par.id" >
  107. <el-link style="margin-right:10px;" type="primary" @click="showUser(par.id)">{{par.name}}</el-link>
  108. </v-for> -->
  109. <div v-if="scope.row.participator.length > 5">
  110. <el-popover placement="top" width="500" trigger="hover" v-if="scope.row.participator.length > 0">
  111. <span v-for="par in scope.row.participator" :key="par.id">
  112. <el-link style="margin-right:10px;" :underline="false" type="primary" @click="showUser(par.id)">{{par.name}}</el-link>
  113. </span>
  114. <div slot="reference" class="addss">
  115. <span v-for="par in scope.row.participator" :key="par.id">
  116. <el-link style="margin-right:10px;" :underline="false" type="primary" @click="showUser(par.id)">{{par.name}}</el-link>
  117. </span>
  118. </div>
  119. </el-popover>
  120. </div>
  121. <div v-else>
  122. <span v-for="par in scope.row.participator" :key="par.id" >
  123. <el-link style="margin-right:10px;" type="primary" :underline="false" @click="showUser(par.id)">{{par.name}}</el-link>
  124. </span>
  125. </div>
  126. </template>
  127. </el-table-column>
  128. <!-- 客户管理 -->
  129. <el-table-column prop="customerName" label="客户" v-if="user.company.packageCustomer == 1">
  130. </el-table-column>
  131. <el-table-column prop="status" label="状态" width="100" >
  132. <template slot-scope="scope">
  133. {{scope.row.status == null?"-":statusTxt[scope.row.status]}}
  134. </template>
  135. </el-table-column>
  136. <!--专业项目协作-->
  137. <el-table-column prop="planStartDate" label="开始日期" width="96" >
  138. </el-table-column>
  139. <el-table-column prop="planEndDate" label="截止日期" width="96" >
  140. </el-table-column>
  141. <el-table-column prop="progress" label="完成度" width="100" v-if="user.company.packageProject == 1">
  142. <template slot-scope="scope">
  143. {{scope.row.progress==null?"-":scope.row.progress}}%
  144. </template>
  145. </el-table-column>
  146. <el-table-column label="操作" width="320" align="center">
  147. <template slot-scope="scope">
  148. <el-button v-if="permissions.projectManagement || user.id==scope.row.creatorId" size="mini" @click="subProject(scope.row)">子项目</el-button>
  149. <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>
  150. <el-button v-if="permissions.projectManagement || user.id==scope.row.creatorId" size="mini" @click="deletePro(scope.$index, scope.row)">删除</el-button>
  151. <!-- 111 -->
  152. <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">
  153. 完成
  154. <el-dropdown-menu slot="dropdown" class="customdropdown_menu">
  155. <el-button size="mini" @click="cancelPro(scope.row)" class="customdropdown_menu_btn">撤销</el-button>
  156. </el-dropdown-menu>
  157. </el-dropdown>
  158. <!-- <el-button v-if="permissions.projectManagement && scope.row.status == 1" size="mini" @click="cancelPro(scope.row)">撤销</el-button>
  159. <el-button v-if="permissions.projectManagement && scope.row.status == 1" size="mini" @click="finishPro(scope.row)">完成</el-button> -->
  160. <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>
  161. </template>
  162. </el-table-column>
  163. </el-table>
  164. <!--工具条-->
  165. <el-col :span="24" class="toolbar">
  166. <el-pagination
  167. @size-change="handleSizeChange"
  168. @current-change="handleCurrentChange"
  169. :page-sizes="[20 , 50 , 80 , 100]"
  170. :page-size="20"
  171. layout="total, sizes, prev, pager, next"
  172. :total="total"
  173. style="float:right;"
  174. ></el-pagination>
  175. </el-col>
  176. <!--新增界面-->
  177. <el-dialog :title="title" v-if="addFormVisible" :visible.sync="addFormVisible" :close-on-click-modal="false" customClass="customWidth" width="960px">
  178. <el-form ref="form1" :model="addForm" :rules="rules" label-width="120px">
  179. <el-form-item label="项目编号" >
  180. <el-input v-model="addForm.code" :disabled="!permissions.projectManagement && addForm.creatorId != user.id" placeholder="请输入项目编号" clearable></el-input>
  181. </el-form-item>
  182. <el-form-item label="项目分类">
  183. <el-select v-model="addForm.category" clearable :disabled="!permissions.projectManagement && addForm.creatorId != user.id">
  184. <el-option v-for="(item) in baseClfList" :key="item.id" :value="item.id" :label="item.name"></el-option>
  185. </el-select>
  186. </el-form-item>
  187. <el-form-item label="项目名称" prop="name">
  188. <el-input v-model="addForm.name" :disabled="!permissions.projectManagement && addForm.creatorId != user.id" placeholder="请输入项目名称" clearable></el-input>
  189. </el-form-item>
  190. <el-form-item label="项目类型" prop="isPublic">
  191. <el-select v-model="addForm.isPublic" style="width:32%;" @change="selectPublic" :disabled="!permissions.projectManagement && addForm.creatorId != user.id">
  192. <el-option :value="0" label="普通项目"></el-option>
  193. <el-option :value="1" label="公共项目"></el-option>
  194. </el-select>
  195. <el-tooltip effect="dark" content="普通项目只对参与人员开放,公共项目对所有成员开放" placement="top-start">
  196. <i class="el-icon-question"></i>
  197. </el-tooltip>
  198. <div v-if="user.company.packageProject==1" style="display: inline-block;width: 50%">
  199. <span style="margin-left:63px;margin-right:10px;" v-if="user.company.packageCustomer == 1">客户</span>
  200. <el-select v-model="addForm.customerId" clearable="true" filterable placeholder="请选择客户" style="width:70%;" >
  201. <el-option v-for="item in customerList" :key="item.id" :label="item.customerName" :value="item.id"></el-option>
  202. </el-select>
  203. </div>
  204. </el-form-item>
  205. <el-form-item :label="yonghuUser.customDegreeName" v-if="yonghuUser.customDegreeActive == 1">
  206. <el-select v-model="auseList" multiple placeholder="请选择" filterable="true" style="width: 100%">
  207. <span v-for="(item, index) in ause" :key="index">
  208. <el-option :label="item.name" :value="item.id"></el-option>
  209. </span>
  210. </el-select>
  211. </el-form-item>
  212. <!-- <el-form-item label="客户" v-if="user.company.packageCustomer == 1">
  213. <el-select v-model="addForm.customerId" clearable="true" filterable placeholder="请选择客户" style="width:100%;" >
  214. <el-option v-for="item in customerList" :key="item.id" :label="item.customerName" :value="item.id"></el-option>
  215. </el-select>
  216. </el-form-item> -->
  217. <el-form-item label="全部参与者" v-show="addForm.isPublic == 0">
  218. <el-input @focus="showChooseMembTree" v-model="addForm.userNames"></el-input>
  219. </el-form-item>
  220. <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%;" >
  221. <el-option v-for="item in participator" :key="item.id" :label="item.name" :value="item.id"></el-option>
  222. </el-select>
  223. </el-form-item>
  224. <el-form-item label="日报审核人" >
  225. <el-select v-model="addForm.auditUserIds" multiple="true" :disabled=" !(permissions.projectManagement|| user.id == addForm.inchargerId || user.id == addForm.creatorId)" filterable placeholder="默认为项目负责人" style="width:100%;" >
  226. <el-option v-for="item in participator" :key="item.id" :label="item.name" :value="item.id"></el-option>
  227. </el-select>
  228. </el-form-item>
  229. <!--专业项目协作版本功能 -->
  230. <el-form-item label="级别" v-if="user.company.packageProject==1">
  231. <el-select v-model="addForm.level" placeholder="请选择级别" style="width:32%;" >
  232. <el-option v-for="item in importanceList" :key="item.id" :label="item.label" :value="item.id"></el-option>
  233. </el-select>
  234. <!-- 增加合同金额字段 -->
  235. <span style="margin-left:63px;margin-right:10px;" v-if="user.company.packageProject==1">合同金额</span>
  236. <el-input id="contractAmount" v-model="addForm.contractAmount" style="width:33%;"
  237. placeholder="整数" clearable @keyup.native="restrictNumber('contractAmount')" ></el-input><span style="margin-left:10px;">元</span>
  238. <!-- 增加合同金额字段 -->
  239. </el-form-item>
  240. <el-form-item label="开始日期" prop="planStartDate" >
  241. <el-date-picker v-model="addForm.planStartDate"
  242. :editable="false" style="width:32%;"
  243. format="yyyy-MM-dd"
  244. value-format="yyyy-MM-dd"
  245. :clearable="false" type="date"
  246. placeholder="选择日期"></el-date-picker>
  247. <span style="margin-left:63px;margin-right:10px;" >截止日期</span>
  248. <el-date-picker v-model="addForm.planEndDate" style="width:33%;"
  249. :editable="false"
  250. format="yyyy-MM-dd"
  251. value-format="yyyy-MM-dd"
  252. :clearable="false" type="date"
  253. placeholder="选择日期"></el-date-picker>
  254. </el-form-item>
  255. <!--非建筑工程专业版设置 -->
  256. <!-- <el-form-item label="日报审核权限" v-if="user.company.packageProject==1 && user.company.packageEngineering == 0">
  257. <el-radio-group v-model="addForm.taskGpIncharge" >
  258. <el-radio :label="0">由项目负责人审核</el-radio>
  259. <el-radio :label="1">由各任务分组负责人审核</el-radio>
  260. </el-radio-group>
  261. </el-form-item> -->
  262. <!-- 项目基线 -->
  263. <div style="margin: 10px 0 30px 0;min-height:200px;" v-if="user.company.packageProject == 1">
  264. <el-tabs v-model="activeName" @tab-click="handleClick">
  265. <el-tab-pane label="成本基线" name="baseCostPanel" >
  266. <div style="padding-top:10px;">
  267. <!--新版 -->
  268. <span class="rg_span" v-for="(item, index) in projectBaseCostData" :key="item.id">
  269. <span style="width:120px;display: inline-block;" v-if="user.company.packageProject==1">{{item.baseName}}</span>
  270. <el-input :id="'baseCost'+index" @input="addUpfun()" v-model="item.baseAmount" style="width:200px; margin-bottom: 20px"
  271. placeholder="整数" clearable @keyup.native="restrictNumber('baseCost'+index)"></el-input><span style="margin-left:10px;">元</span>
  272. </span>
  273. <!-- 合计 -->
  274. <div style="margin-top: 10px;float:right;">
  275. <span style="margin-right:50px;margin-right:10px;" v-if="user.company.packageProject==1">合计</span>
  276. <span v-if="addForm.budget <= 0 || addForm.budget == undefined">0</span>
  277. <span v-else>{{addForm.budget | numberToCurrency}}</span>
  278. <span style="margin-right:50px;margin-left:10px;">元</span>
  279. </div>
  280. </div>
  281. </el-tab-pane>
  282. <el-tab-pane label="工程专业" name="engineeringProfession" v-if="user.company.packageEngineering == 1">
  283. <div style="padding-top:10px;">
  284. <el-table :data="projectProfessionList" size="small" :key="Math.random()">
  285. <el-table-column prop="professionId" width="200">
  286. <template slot-scope="scope">
  287. <el-select v-model="scope.row.professionId" >
  288. <el-option v-for="item in professionList" :key="item.id" :label="item.name" :value="item.id"/>
  289. </el-select>
  290. </template>
  291. <template slot="header" >
  292. <span style="font-size:14px;font-weight:normal;">专业名称</span>
  293. </template>
  294. </el-table-column>
  295. <el-table-column prop="percentage" width="120" label="占比(%)">
  296. <template slot-scope="scope">
  297. <div><el-input type="number" v-model="scope.row.percentage"></el-input></div>
  298. </template>
  299. </el-table-column>
  300. <el-table-column prop="membNames" label="相关人员及占比">
  301. <template slot-scope="scope">
  302. <span style="margin:0 5px;" v-for="item in scope.row.membList" :key="item.membId">{{item.membName}}({{item.percentage}}%)</span>
  303. <el-link @click="showEditPpMembs(scope.row)">{{(scope.row.membList == null || scope.row.membList.length == 0)?'设置专业参与人员':'设置'}}</el-link>
  304. </template>
  305. </el-table-column>
  306. <el-table-column prop="inchargerName" width="120" label="负责人">
  307. <template slot-scope="scope">
  308. <el-select v-model="scope.row.inchargerId" >
  309. <el-option v-for="item in participator" :key="item.id" :label="item.name" :value="item.id">
  310. </el-option>
  311. </el-select>
  312. </template>
  313. </el-table-column>
  314. <el-table-column width="80">
  315. <template slot-scope="scope">
  316. <el-button icon="el-icon-delete" size="mini" style="margin-left:10px;" @click.stop.native="deleteItem(scope.$index)"></el-button>
  317. </template>
  318. <template slot="header" >
  319. <el-link type="primary" :underline="false" @click="addItem">添加</el-link>
  320. </template>
  321. </el-table-column>
  322. </el-table>
  323. </div>
  324. </el-tab-pane>
  325. <el-tab-pane label="相关领导" name="leaders" >
  326. <div style="padding-top:10px;">
  327. <el-input @focus="showChooseLeaderTree" v-model="addForm.notifyUserNames" placeholder="请选择需要接收审核通知的相关领导"></el-input>
  328. </div>
  329. </el-tab-pane>
  330. </el-tabs>
  331. </div>
  332. </el-form>
  333. <div slot="footer" class="dialog-footer;">
  334. <el-button @click.native="addFormVisible = false">取消</el-button>
  335. <el-button type="primary" @click="submitInsert" :loading="addLoading">提交</el-button>
  336. </div>
  337. </el-dialog>
  338. <!--用户详细信息弹出框-->
  339. <el-dialog title="查看详情" v-if="userDetailVisible" :visible.sync="userDetailVisible" :close-on-click-modal="false" customClass="customWidth" width="400px">
  340. <div class="line"><span>姓名</span><span>{{userDetail.name}}</span></div>
  341. <div class="line"><span>手机号码</span><span>{{userDetail.phone}}</span></div>
  342. <div class="line"><span>角色</span><span>{{roleArray[userDetail.role]}}</span></div>
  343. <div class="line"><span>部门</span><span>{{userDetail.departmentName}}</span></div>
  344. <div slot="footer" class="dialog-footer">
  345. <el-button type="primary" @click="userDetailVisible = false" >确定</el-button>
  346. </div>
  347. </el-dialog>
  348. <!-- 子项目列表 -->
  349. <el-dialog title="子项目列表" show-header="false" v-if="subProjectVisible" :visible.sync="subProjectVisible" :close-on-click-modal="false" customClass="customWidth" width="500px">
  350. <el-table :data="subProjectList" highlight-current-row height="400" style="width: 100%;">
  351. <!-- <el-table-column type="index" width="60" label="序号">
  352. <template slot-scope="scope" >
  353. {{scope.$index+1+(page-1)*size}}
  354. </template>
  355. </el-table-column> -->
  356. <el-table-column width="120" label="子项目编号" prop="code"></el-table-column>
  357. <el-table-column prop="name" label="名称" ></el-table-column>
  358. <el-table-column label="操作" width="150">
  359. <template slot-scope="scope" >
  360. <el-button size="small" type="primary" @click="addNewSubProject(scope.row)">编辑</el-button>
  361. <el-button size="small" type="danger" @click="deleteSubPro(scope.row)">删除</el-button>
  362. </template>
  363. </el-table-column>
  364. </el-table>
  365. <div slot="footer" class="dialog-footer">
  366. <el-button type="primary" @click="subProjectVisible = false" >关闭</el-button>
  367. <el-button type="primary" @click="addNewSubProject()" >新增子项目</el-button>
  368. </div>
  369. </el-dialog>
  370. <!-- 新增子项目弹出框 -->
  371. <el-dialog title="新增/修改子项目" v-if="addSubProject" :visible.sync="addSubProject" :close-on-click-modal="false" customClass="customWidth" width="500px">
  372. <el-form ref="form2" :model="temaddForm" :rules="rules" label-width="100px">
  373. <el-form-item label="项目编号" prop="code">
  374. <el-input v-model="temaddForm.code" placeholder="请输入项目编号" clearable></el-input>
  375. </el-form-item>
  376. <el-form-item label="项目名称" prop="name">
  377. <el-input v-model="temaddForm.name" placeholder="请输入项目名称" clearable></el-input>
  378. </el-form-item>
  379. </el-form>
  380. <div slot="footer" class="dialog-footer">
  381. <el-button @click.native="addSubProject = false">取消</el-button>
  382. <el-button type="primary" @click="submitInsertSubProject" :loading="addLoading">提交</el-button>
  383. </div>
  384. </el-dialog>
  385. <!-- 项目基线成本项配置弹出框 -->
  386. <el-dialog title="项目基线成本项管理" show-header="false" v-if="showBaseConfig" :visible.sync="showBaseConfig" :close-on-click-modal="false" customClass="customWidth" width="500px">
  387. <el-table :data="baseCostItemList" highlight-current-row height="400" style="width: 100%;">
  388. <el-table-column type="index" width="60" label="序号">
  389. <template slot-scope="scope" >
  390. {{scope.$index+1+(page-1)*size}}
  391. </template>
  392. </el-table-column>
  393. <el-table-column prop="name" label="名称" ></el-table-column>
  394. <el-table-column label="操作" width="150">
  395. <template slot-scope="scope" >
  396. <el-button size="small" type="primary" @click="addNewBaseItem(scope.row)">编辑</el-button>
  397. <el-button size="small" type="danger" @click="deleteBaseItem(scope.row)">删除</el-button>
  398. </template>
  399. </el-table-column>
  400. </el-table>
  401. <div slot="footer" class="dialog-footer">
  402. <el-button type="primary" @click="showBaseConfig = false" >关闭</el-button>
  403. <el-button type="primary" @click="addNewBaseItem()" >新增成本项</el-button>
  404. </div>
  405. </el-dialog>
  406. <!-- 分类条目配置 -->
  407. <el-dialog title="项目分类条目管理" show-header="false" v-if="showClfDialog" :visible.sync="showClfDialog" :close-on-click-modal="false" customClass="customWidth" width="500px">
  408. <el-table :data="baseClfList" highlight-current-row height="400" style="width: 100%;">
  409. <el-table-column type="index" width="60" label="序号">
  410. <template slot-scope="scope" >
  411. {{scope.$index+1+(page-1)*size}}
  412. </template>
  413. </el-table-column>
  414. <el-table-column prop="name" label="名称" ></el-table-column>
  415. <el-table-column label="操作" width="150">
  416. <template slot-scope="scope" >
  417. <el-button size="small" type="primary" @click="addNewClf(scope.row)">编辑</el-button>
  418. <el-button size="small" type="danger" @click="deleteClf(scope.row)">删除</el-button>
  419. </template>
  420. </el-table-column>
  421. </el-table>
  422. <div slot="footer" class="dialog-footer">
  423. <el-button type="primary" @click="showClfDialog = false" >关闭</el-button>
  424. <el-button type="primary" @click="addNewClf()" >新增分类项</el-button>
  425. </div>
  426. </el-dialog>
  427. <!-- 新增/编辑 分类条目 -->
  428. <el-dialog title="新增/修改分类条目" v-if="addClfDialog" :visible.sync="addClfDialog" :close-on-click-modal="false" customClass="customWidth" width="500px">
  429. <el-form ref="form2" :model="addClf" :rules="rules" label-width="100px">
  430. <el-form-item label="分类名称" prop="name">
  431. <el-input v-model="addClf.name" placeholder="请输入名称" clearable></el-input>
  432. </el-form-item>
  433. </el-form>
  434. <div slot="footer" class="dialog-footer">
  435. <el-button @click.native="addClfDialog = false">取消</el-button>
  436. <el-button type="primary" @click="submitClf" :loading="addLoading">提交</el-button>
  437. </div>
  438. </el-dialog>
  439. <el-dialog title="新增/修改成本项" v-if="addBaseItemDialog" :visible.sync="addBaseItemDialog" :close-on-click-modal="false" customClass="customWidth" width="500px">
  440. <el-form ref="form2" :model="addForm" :rules="rules" label-width="100px">
  441. <el-form-item label="成本项名称" prop="name">
  442. <el-input v-model="addForm.name" placeholder="请输入名称" clearable></el-input>
  443. </el-form-item>
  444. </el-form>
  445. <div slot="footer" class="dialog-footer">
  446. <el-button @click.native="addBaseItemDialog = false">取消</el-button>
  447. <el-button type="primary" @click="submitInsertBaseItem" :loading="addLoading">提交</el-button>
  448. </div>
  449. </el-dialog>
  450. <!-- 按部门选择人员 -->
  451. <el-dialog title="选择参与人员" v-if="chooseParticipVisible" :visible.sync="chooseParticipVisible" :close-on-click-modal="false" customClass="customWidth" width="500px">
  452. <!-- <el-input style="width:100%" v-model="filterName" placeholder="请输入姓名搜索" @change="findUserInTree"></el-input> -->
  453. <div class="tree" style="height:400px">
  454. <el-scrollbar style="height:100%">
  455. <el-input
  456. placeholder="输入关键字进行过滤"
  457. v-model="filterText">
  458. </el-input>
  459. <el-tree :data="deptMembData" show-checkbox :props="defaultProps" node-key="id"
  460. ref="chooseMembTree" @check-change="onTreeItemChange" :default-checked-keys="addForm.userId"
  461. highlight-current :filter-node-method="filterNode" default-expand-all></el-tree>
  462. </el-scrollbar>
  463. </div>
  464. <div>已选中&nbsp;{{chosenMembCount}}&nbsp;人</div>
  465. <div slot="footer" class="dialog-footer">
  466. <el-button @click="chooseParticipVisible = false" >取消</el-button>
  467. <el-button type="primary" @click="chooseParticip()" >确定</el-button>
  468. </div>
  469. </el-dialog>
  470. <!-- 按部门选择相关领导 -->
  471. <el-dialog title="选择相关领导" v-if="chooseLeaderVisible" :visible.sync="chooseLeaderVisible" :close-on-click-modal="false" customClass="customWidth" width="500px">
  472. <!-- <el-input style="width:100%" v-model="filterName" placeholder="请输入姓名搜索" @change="findUserInTree"></el-input> -->
  473. <div class="tree" style="height:400px">
  474. <el-scrollbar style="height:100%">
  475. <el-tree :data="deptMembData" show-checkbox :props="defaultProps" node-key="id"
  476. ref="chooseLeaderTree" @check-change="onLeaderTreeItemChange" :default-checked-keys="addForm.notifyUserIds"
  477. highlight-current ></el-tree>
  478. </el-scrollbar>
  479. </div>
  480. <div>已选中&nbsp;{{chosenMembCount}}&nbsp;人</div>
  481. <div slot="footer" class="dialog-footer">
  482. <el-button @click="chooseLeaderVisible = false" >取消</el-button>
  483. <el-button type="primary" @click="chooseLeader()" >确定</el-button>
  484. </div>
  485. </el-dialog>
  486. <!-- 项目专业人员的设置 -->
  487. <el-dialog title="设置项目专业人员" v-if="editPpMembDialog" :visible.sync="editPpMembDialog" :close-on-click-modal="false" customClass="customWidth" width="600px">
  488. <el-table :data="curProfessionRow.membList" height="400">
  489. <el-table-column prop="name" label="专业人员">
  490. <template slot-scope="scope">
  491. <el-select v-model="scope.row.membId" filterable placeholder="请选择专业参与人" style="width:100%;" >
  492. <el-option v-for="item in participator" :key="item.id" :label="item.name" :value="item.id">
  493. </el-option>
  494. </el-select>
  495. </template>
  496. </el-table-column>
  497. <el-table-column prop="percentage" width="120" label="占比(%)">
  498. <template slot-scope="scope">
  499. <el-input type="number" v-model="scope.row.percentage"></el-input>
  500. </template>
  501. </el-table-column>
  502. <el-table-column width="80">
  503. <template slot-scope="scope">
  504. <el-button icon="el-icon-delete" size="mini" style="margin-left:10px;" @click.stop.native="deleteMembItem(scope.$index)"></el-button>
  505. </template>
  506. <template slot="header" >
  507. <el-link @click="addMembItem">添加</el-link>
  508. </template>
  509. </el-table-column>
  510. </el-table>
  511. <div slot="footer" class="dialog-footer">
  512. <el-button @click="editPpMembDialog = false" >取消</el-button>
  513. <el-button type="primary" @click="addPpMemb" >确定</el-button>
  514. </div>
  515. </el-dialog>
  516. <!-- <el-dialog title="提示" v-if="deleteReconfirmDialog" :visible.sync="deleteReconfirmDialog" :close-on-click-modal="false" customClass="customWidth" width="500px">
  517. <p>{{deleteAlertMsg}}</p>
  518. <div slot="footer" class="dialog-footer">
  519. <el-button @click="deleteReconfirmDialog = false" >取消</el-button>
  520. <el-button type="primary" @click="forceDeletePro" >确认并删除</el-button>
  521. </div>
  522. </el-dialog> -->
  523. </section>
  524. </template>
  525. <style scoped>
  526. .input-with-select .el-input-group__prepend {
  527. background-color: #fff;
  528. }
  529. .line {
  530. padding:10px;
  531. }
  532. .line span{
  533. font-size:15px;
  534. }
  535. .line span:nth-child(even){
  536. float:right;
  537. }
  538. .kans {
  539. width: 230px;
  540. overflow:hidden;
  541. white-space:nowrap;
  542. text-overflow: ellipsis;
  543. }
  544. a {
  545. text-decoration: none;
  546. }
  547. .router-link-active {
  548. text-decoration: none;
  549. }
  550. </style>
  551. <script>
  552. import util from "../../common/js/util";
  553. import projectgantt from "./project_gantt.vue"
  554. export default {
  555. components:{projectgantt},
  556. data() {
  557. return {
  558. isganttshow: false,
  559. deleteAlertMsg: null,
  560. chosenLeaders:[],
  561. chooseLeaderVisible:false,
  562. projectProfessionItem:null,
  563. curProfessionRow:null,
  564. editPpMembDialog:false,
  565. professionList:[],
  566. projectProfessionList:[],
  567. activeName:"baseCostPanel",
  568. chosenMembCount:0,
  569. chosenMembList:[],//选中的人员
  570. allMembData:[],
  571. deptMembData: [
  572. {
  573. id: 0,
  574. label: '未分配',
  575. }
  576. ],
  577. option: [],
  578. depData: {
  579. id: -1,
  580. label: '全部人员',
  581. },
  582. defaultProps: {
  583. children: 'children',
  584. label: 'label'
  585. },
  586. filterName:null,
  587. chooseParticipVisible: false,
  588. projectBaseCostData:[],
  589. addBaseItemDialog:false,
  590. showBaseConfig:false,
  591. customerList:[],
  592. roleArray:["普通员工","超级管理员", "系统管理员", "公司高层","财务管理员", "项目管理员"],
  593. status:null,
  594. statusTxt:["-","进行中","已完成","已撤销"],
  595. importanceList:[{id:1,label:'正常'},{id:2,label:'紧急'},{id:3,label:'重要'},{id:4,label:'重要且紧急'}],
  596. searchField:null,
  597. keyword:null,
  598. user: JSON.parse(sessionStorage.getItem("user")),
  599. permissions: JSON.parse(sessionStorage.getItem("permissions")),
  600. userDetailVisible: false,
  601. userDetail:{},
  602. date: new Date(),
  603. users: [],
  604. participator:[],
  605. tableHeight: 0,
  606. listLoading: false,
  607. total: 0,
  608. page: 1,
  609. size: 20,
  610. list: [],
  611. subProjectVisible: false,
  612. subProjectList: [],//子项目列表
  613. currentProject:{},
  614. addSubProject: false,
  615. addFormVisible: false,
  616. addLoading: false,
  617. addUp: 0, // 合计
  618. title: "",
  619. addForm: {
  620. name: '',
  621. userId: [],
  622. level:1,
  623. taskGpIncharge: 0,
  624. id: '',
  625. code: ''
  626. },
  627. temaddForm: {},
  628. rules: {
  629. name: [{ required: true, message: "请输入名称", trigger: "blur" }]
  630. },
  631. ause: [],
  632. auseList: [],
  633. yonghuUser: [],
  634. filterText: '',
  635. showClfDialog: false,
  636. addClfDialog:false,
  637. addClf:{name:'',id:''},
  638. statusClf:null,
  639. permissionsObj: {},
  640. };
  641. },
  642. // 过滤器
  643. filters: {
  644. numberToCurrency(value) {
  645. if (!value) return '0.00'
  646. // 将数值截取,保留两位小数
  647. value = value.toFixed(2)
  648. // 获取整数部分
  649. const intPart = Math.trunc(value)
  650. // 整数部分处理,增加,
  651. const intPartFormat = intPart.toString().replace(/(\d)(?=(?:\d{3})+$)/g, '$1,')
  652. // 预定义小数部分
  653. let floatPart = '.00'
  654. // 将数值截取为小数部分和整数部分
  655. const valueArray = value.toString().split('.')
  656. if (valueArray.length === 2) { // 有小数部分
  657. floatPart = valueArray[1].toString() // 取得小数部分
  658. return intPartFormat + '.' + floatPart
  659. }
  660. return intPartFormat + floatPart
  661. },
  662. },
  663. watch: {
  664. filterText(val) {
  665. this.$refs.chooseMembTree.filter(val);
  666. }
  667. },
  668. methods: {
  669. filterNode(value, data) {
  670. if (!value) return true;
  671. return data.label.indexOf(value) !== -1;
  672. },
  673. //重启项目
  674. restartPro(row) {
  675. this.http.post('/project/start',{id: row.id},
  676. res => {
  677. if (res.code == "ok") {
  678. this.$message({
  679. message: '重启成功',
  680. type: "success"
  681. });
  682. row.status = 1;
  683. } else {
  684. this.$message({
  685. message: res.msg,
  686. type: "error"
  687. });
  688. }
  689. },
  690. error => {
  691. this.$message({
  692. message: error,
  693. type: "error"
  694. });
  695. });
  696. },
  697. //撤销项目
  698. cancelPro(row) {
  699. this.http.post('/project/cancel',{id: row.id},
  700. res => {
  701. if (res.code == "ok") {
  702. this.$message({
  703. message: '撤销成功',
  704. type: "success"
  705. });
  706. row.status = 3;
  707. } else {
  708. this.$message({
  709. message: res.msg,
  710. type: "error"
  711. });
  712. }
  713. },
  714. error => {
  715. this.$message({
  716. message: error,
  717. type: "error"
  718. });
  719. });
  720. },
  721. //完成项目
  722. finishPro(row) {
  723. this.http.post('/project/finish',{id: row.id},
  724. res => {
  725. if (res.code == "ok") {
  726. this.$message({
  727. message: '项目完成',
  728. type: "success"
  729. });
  730. row.status = 2;
  731. } else {
  732. this.$message({
  733. message: res.msg,
  734. type: "error"
  735. });
  736. }
  737. },
  738. error => {
  739. this.$message({
  740. message: error,
  741. type: "error"
  742. });
  743. });
  744. },
  745. exportProjectData() {
  746. //导出项目
  747. this.http.post('/project/exportData',{},
  748. res => {
  749. if (res.code == "ok") {
  750. var filePath = res.data;
  751. const a = document.createElement('a'); // 创建a标签
  752. a.setAttribute('download', '项目导出.xls');// download属性
  753. a.setAttribute('href', filePath);// href链接
  754. a.click(); //自执行点击事件
  755. a.remove();
  756. }
  757. },
  758. error => {
  759. this.$message({
  760. message: error,
  761. type: "error"
  762. });
  763. }
  764. );
  765. },
  766. userssHu() {
  767. this.http.post('/time-type/getCompanyTimeSetting',{
  768. companyId: this.user.companyId
  769. },
  770. res => {
  771. if (res.code == "ok") {
  772. this.yonghuUser = res.data
  773. console.log(this.yonghuUser)
  774. }
  775. },
  776. error => {
  777. this.$message({
  778. message: error,
  779. type: "error"
  780. });
  781. }
  782. );
  783. },
  784. yanjiuzx() {
  785. this.http.post('/report-extra-degree/getAll ',{},
  786. res => {
  787. if (res.code == "ok") {
  788. console.log(res, '过来的数据')
  789. this.ause = res.data
  790. } else {
  791. this.$message({
  792. message: res.msg,
  793. type: "error"
  794. });
  795. }
  796. },
  797. error => {
  798. this.$message({
  799. message: error,
  800. type: "error"
  801. });
  802. }
  803. );
  804. },
  805. selectPublic() {
  806. if (this.addForm.isPublic == 1) {
  807. this.participator = this.users;
  808. } else {
  809. this.participator = [];
  810. }
  811. },
  812. addPpMemb() {
  813. //检查合计比例是否到达100%
  814. let p = 0;
  815. let hasNoMemb = false;
  816. this.curProfessionRow.membList.forEach(m=>{
  817. p += parseInt(m.percentage);
  818. //检查人员是否选择
  819. if (m.membId == null) {
  820. hasNoMemb = true;
  821. }
  822. });
  823. if (hasNoMemb) {
  824. this.$message({
  825. message: '专业人员不能为空',
  826. type: "error"
  827. });
  828. return;
  829. }
  830. //检查人员不能重复
  831. let hasDuplicate = false;
  832. this.curProfessionRow.membList.forEach(m=>{
  833. if (this.curProfessionRow.membList.filter(innerM=>innerM.membId == m.membId).length>1) {
  834. hasDuplicate = true;
  835. }
  836. });
  837. if (hasDuplicate) {
  838. this.$message({
  839. message: '专业人员不能重复',
  840. type: "error"
  841. });
  842. return;
  843. }
  844. if (p != 100) {
  845. this.$message({
  846. message: '占比合计必须是100%',
  847. type: "error"
  848. });
  849. return;
  850. }
  851. this.editPpMembDialog = false;
  852. this.curProfessionRow.membList.forEach(m=>{
  853. m.membName = this.participator.filter(p=>p.id == m.membId)[0].name;
  854. });
  855. this.projectProfessionItem.membList = JSON.parse(JSON.stringify(this.curProfessionRow.membList));
  856. },
  857. //删除专业人员
  858. deleteMembItem(index) {
  859. this.curProfessionRow.membList.splice(index,1);
  860. },
  861. //添加专业人员
  862. addMembItem() {
  863. if (this.curProfessionRow.membList == null) {
  864. this.curProfessionRow.membList = [{membId:null, percentage:100}];
  865. } else {
  866. let p = 0;
  867. this.curProfessionRow.membList.forEach(m=>{
  868. p += parseInt(m.percentage);
  869. });
  870. this.curProfessionRow.membList.push({membId:null, percentage:100-p});
  871. }
  872. this.$forceUpdate();
  873. },
  874. showEditPpMembs(row) {
  875. this.projectProfessionItem = row;
  876. this.curProfessionRow = JSON.parse(JSON.stringify(row));
  877. if (this.curProfessionRow.membList == null || this.curProfessionRow.membList.length == 0) {
  878. this.curProfessionRow.membList = [{membId:null, percentage:100}];
  879. }
  880. this.editPpMembDialog = true;
  881. },
  882. getProjectNotifyUserList(projectId) {
  883. this.http.post("/project-notify-user/get", {projectId: projectId},
  884. res => {
  885. if (res.code == "ok") {
  886. var chosenLeaderIds = [];
  887. var chosenLeaderNames = '';
  888. var leaderList = res.data;
  889. this.chosenLeaders = leaderList;
  890. for(var j in leaderList) {
  891. chosenLeaderIds.push(leaderList[j].userId)
  892. chosenLeaderNames += leaderList[j].userName+',';
  893. }
  894. if (chosenLeaderNames.length > 0) {
  895. chosenLeaderNames = chosenLeaderNames.substring(0, chosenLeaderNames.length -1);
  896. }
  897. this.addForm.notifyUserIds = chosenLeaderIds;
  898. this.addForm.notifyUserNames = chosenLeaderNames;
  899. } else {
  900. this.$message({
  901. message: res.msg,
  902. type: "error"
  903. });
  904. }
  905. },
  906. error => {
  907. this.$message({
  908. message: error,
  909. type: "error"
  910. });
  911. });
  912. },
  913. getProjectProfessions(projectId) {
  914. this.http.post("/project-profession/get", {projectId: projectId},
  915. res => {
  916. if (res.code == "ok") {
  917. this.projectProfessionList = res.data;
  918. } else {
  919. this.$message({
  920. message: res.msg,
  921. type: "error"
  922. });
  923. }
  924. },
  925. error => {
  926. this.$message({
  927. message: error,
  928. type: "error"
  929. });
  930. });
  931. },
  932. checkProjectProfession() {
  933. //检查合计比例是否到达100%
  934. let p = 0;
  935. let hasNoMemb = false;
  936. let hasNoProfession = false;
  937. let hasNoMembList = false;
  938. this.projectProfessionList.forEach(m=>{
  939. p += parseInt(m.percentage);
  940. //检查人员是否选择
  941. if (m.inchargerId == null) {
  942. hasNoMemb = true;
  943. }
  944. if (m.professionId == null) {
  945. hasNoProfession = true;
  946. }
  947. if (m.membList == null) {
  948. hasNoMembList = true;
  949. }
  950. });
  951. if (hasNoProfession) {
  952. this.$message({
  953. message: '专业不能为空',
  954. type: "error"
  955. });
  956. return false;
  957. }
  958. if (hasNoMembList) {
  959. this.$message({
  960. message: '专业相关人员不能为空',
  961. type: "error"
  962. });
  963. return false;
  964. }
  965. if (hasNoMemb) {
  966. this.$message({
  967. message: '专业负责人不能为空',
  968. type: "error"
  969. });
  970. return false;
  971. }
  972. //检查专业不能重复
  973. let hasDuplicate = false;
  974. this.projectProfessionList.forEach(m=>{
  975. if (this.projectProfessionList.filter(innerM=>innerM.professionId == m.professionId).length>1) {
  976. hasDuplicate = true;
  977. }
  978. });
  979. if (hasDuplicate) {
  980. this.$message({
  981. message: '专业不能重复',
  982. type: "error"
  983. });
  984. return false;
  985. }
  986. if (this.projectProfessionList.length > 0 && p != 100) {
  987. this.$message({
  988. message: '专业占比合计必须是100%',
  989. type: "error"
  990. });
  991. return false;
  992. }
  993. return true;
  994. },
  995. //保存项目专业
  996. saveProjectProfessions(projectId) {
  997. var list = this.projectProfessionList.filter(p=>p.professionId != null);
  998. list.forEach(p=>p.inchargerName = this.participator.filter(m=>m.id == p.inchargerId)[0].name);
  999. list.forEach(p=>p.professionName = this.professionList.filter(m=>m.id == p.professionId)[0].name);
  1000. this.http.post("/project-profession/modify", {projectId: projectId, json: JSON.stringify(list)},
  1001. res => {
  1002. if (res.code == "ok") {
  1003. return false;
  1004. } else {
  1005. this.$message({
  1006. message: res.msg,
  1007. type: "error"
  1008. });
  1009. }
  1010. },
  1011. error => {
  1012. this.$message({
  1013. message: error,
  1014. type: "error"
  1015. });
  1016. });
  1017. },
  1018. //删除项目专业
  1019. deleteItem(index) {
  1020. this.projectProfessionList.splice(index,1);
  1021. },
  1022. //添加项目专业
  1023. addItem() {
  1024. let p = 0;
  1025. this.projectProfessionList.forEach(m=>{
  1026. p += parseInt(m.percentage);
  1027. });
  1028. this.projectProfessionList.push( { professionId:null, inchargerId:null,membIds:[], percentage: 100-p});
  1029. },
  1030. getProfessionList() {
  1031. this.http.post("/profession/getAll", {},
  1032. res => {
  1033. if (res.code == "ok") {
  1034. var list = res.data;
  1035. this.professionList = list;
  1036. } else {
  1037. this.$message({
  1038. message: res.msg,
  1039. type: "error"
  1040. });
  1041. }
  1042. },
  1043. error => {
  1044. this.$message({
  1045. message: error,
  1046. type: "error"
  1047. });
  1048. });
  1049. },
  1050. restrictNumber(targetId) {
  1051. let inpu = document.getElementById(targetId);
  1052. inpu.value = inpu.value.replace(/[^\d.]/g, ""); //仅保留数字和"."
  1053. inpu.value = inpu.value.replace(/\.{2,}/g, "."); //两个连续的"."仅保留第一个"."
  1054. inpu.value = inpu.value.replace(".", "$#*").replace(/\./g,'').replace('$#*','.');//去除其他"."
  1055. inpu.value = inpu.value.replace(/^(\d+)\.(\d\d).*$/, '$1.$2');;//限制只能输入两个小数
  1056. if (inpu.value.indexOf(".") < 0 && inpu.value != "") { //首位是0的话去掉
  1057. inpu.value = parseFloat(inpu.value);
  1058. }
  1059. },
  1060. showChooseLeaderTree() {
  1061. this.chosenMembCount = this.chosenLeaders.length;
  1062. this.chooseLeaderVisible = true;
  1063. },
  1064. onLeaderTreeItemChange() {
  1065. var chosenList = this.$refs.chooseLeaderTree.getCheckedNodes();
  1066. var list = chosenList.filter(item=>item.isUser == 1);
  1067. this.chosenMembCount = list.length;
  1068. },
  1069. showChooseMembTree() {
  1070. this.chosenMembCount = this.participator.length;
  1071. this.chooseParticipVisible = true;
  1072. },
  1073. onTreeItemChange() {
  1074. var chosenList = this.$refs.chooseMembTree.getCheckedNodes();
  1075. var list = chosenList.filter(item=>item.isUser == 1);
  1076. this.chosenMembCount = list.length;
  1077. },
  1078. findUserInTree() {
  1079. if (this.filterName == '') {
  1080. this.deptMembData = this.allMembData;
  1081. } else {
  1082. var list = this.findRecursively(this.filterName, this.allMembData);
  1083. this.deptMembData = list;
  1084. }
  1085. },
  1086. findRecursively(username, list) {
  1087. var filterList = [];
  1088. for (var i=0;i<list.length; i++) {
  1089. if (list[i].isUser == 1) {
  1090. if (list[i].label.indexOf(username) >= 0) {
  1091. //匹配上了
  1092. filterList.push(list[i]);
  1093. }
  1094. } else if (list[i].children != null && list[i].children.length > 0) {
  1095. var subList = this.findRecursively(username, list[i].children);
  1096. if (subList.length > 0) {
  1097. subList.forEach(s=>filterList.push(s));
  1098. }
  1099. }
  1100. }
  1101. return filterList;
  1102. },
  1103. //确定选择参与人
  1104. chooseParticip() {
  1105. this.chooseParticipVisible = false;
  1106. var chosenList = this.$refs.chooseMembTree.getCheckedNodes();
  1107. this.chosenMembList = chosenList.filter(item=>item.isUser == 1);
  1108. this.addForm.userNames = '';
  1109. this.addForm.userId = [];
  1110. this.participator = [];
  1111. for (var i=0;i<this.chosenMembList.length; i++) {
  1112. this.addForm.userId.push(this.chosenMembList[i].id);
  1113. this.addForm.userNames += this.chosenMembList[i].label+',';
  1114. var item = {id:this.chosenMembList[i].id, name:this.chosenMembList[i].label};
  1115. this.participator.push(item);
  1116. }
  1117. if (this.addForm.userNames.length > 0) {
  1118. this.addForm.userNames = this.addForm.userNames.substring(0, this.addForm.userNames.length-1);
  1119. }
  1120. },
  1121. //选中相关领导
  1122. chooseLeader() {
  1123. this.chooseLeaderVisible = false;
  1124. var chosenList = this.$refs.chooseLeaderTree.getCheckedNodes();
  1125. var chosenMembList = chosenList.filter(item=>item.isUser == 1);
  1126. this.addForm.notifyUserNames = '';
  1127. this.addForm.notifyUserIds = [];
  1128. this.chosenLeaders = [];
  1129. for (var i=0;i<chosenMembList.length; i++) {
  1130. this.addForm.notifyUserIds.push(chosenMembList[i].id);
  1131. this.addForm.notifyUserNames += chosenMembList[i].label+',';
  1132. var item = {userId:chosenMembList[i].id, userName:chosenMembList[i].label};
  1133. this.chosenLeaders.push(item);
  1134. }
  1135. if (this.addForm.notifyUserNames.length > 0) {
  1136. this.addForm.notifyUserNames = this.addForm.notifyUserNames.substring(0, this.addForm.notifyUserNames.length-1);
  1137. }
  1138. },
  1139. // 获取部门列表
  1140. getDepartment() {
  1141. this.http.post("/department/listAllMemb", {},
  1142. res => {
  1143. if (res.code == "ok") {
  1144. var list = res.data;
  1145. //设置员工到部门下面
  1146. this.setUserToDept(list);
  1147. this.deptMembData = list;
  1148. //用于筛选过滤
  1149. this.allMembData = JSON.parse(JSON.stringify(this.deptMembData));
  1150. } else {
  1151. this.$message({
  1152. message: res.msg,
  1153. type: "error"
  1154. });
  1155. }
  1156. },
  1157. error => {
  1158. this.$message({
  1159. message: error,
  1160. type: "error"
  1161. });
  1162. });
  1163. },
  1164. setUserToDept(list) {
  1165. for (var i in list) {
  1166. if (list[i].children != null) {
  1167. this.setUserToDept(list[i].children);
  1168. }
  1169. if (list[i].userList != null) {
  1170. if (list[i].children == null) {
  1171. list[i].children = [];
  1172. }
  1173. list[i].userList.forEach(element => {
  1174. var obj = {id: element.id, label:element.name, parentId:element.departmentId, isUser:1};
  1175. list[i].children.push(obj);
  1176. });
  1177. }
  1178. }
  1179. },
  1180. // 获取分类条目
  1181. getClfConfigList() {
  1182. this.http.get('/project-category/list',
  1183. res => {
  1184. if (res.code == "ok") {
  1185. this.baseClfList = res.data;
  1186. console.log("获取分类条目",res.data);
  1187. this.$forceUpdate();
  1188. } else {
  1189. this.$message({
  1190. message: res.msg,
  1191. type: "error"
  1192. });
  1193. }
  1194. },
  1195. error => {
  1196. this.$message({
  1197. message: error,
  1198. type: "error"
  1199. });
  1200. }
  1201. );
  1202. },
  1203. // 新增/编辑 分类条目
  1204. addNewClf(row) {
  1205. this.addClfDialog = true;
  1206. if (row == null) {
  1207. this.addClf = {}
  1208. } else {
  1209. this.addClf = row;
  1210. }
  1211. },
  1212. // 提交
  1213. submitClf() {
  1214. this.http.post('/project-category/addOrMod',this.addClf,
  1215. res => {
  1216. if (res.code == "ok") {
  1217. this.addClfDialog = false;
  1218. this.baseClfList = res.data;
  1219. // this.$forceUpdate();
  1220. console.log(res.data);
  1221. } else {
  1222. this.$message({
  1223. message: res.msg,
  1224. type: "error"
  1225. });
  1226. }
  1227. },
  1228. error => {
  1229. this.$message({
  1230. message: error,
  1231. type: "error"
  1232. });
  1233. }
  1234. );
  1235. },
  1236. // 删除
  1237. deleteClf(row) {
  1238. this.$confirm("该操作可能造成已有数据丢失,确定要删除吗?","删除分类条目", {
  1239. confirmButtonText: "确定",
  1240. cancelButtonText: "取消",
  1241. type: "warning"
  1242. })
  1243. .then(() => {
  1244. this.listLoading = true;
  1245. this.http.post('/project-category/delete',{
  1246. id: row.id
  1247. },
  1248. res => {
  1249. this.listLoading = false;
  1250. if (res.code == "ok") {
  1251. this.$message({
  1252. message: "删除成功",
  1253. type: "success"
  1254. });
  1255. this.getClfConfigList();
  1256. } else {
  1257. this.$message({
  1258. message: res.msg,
  1259. type: "error"
  1260. });
  1261. }
  1262. },
  1263. error => {
  1264. this.listLoading = false;
  1265. this.$message({
  1266. message: error,
  1267. type: "error"
  1268. });
  1269. }
  1270. );
  1271. })
  1272. .catch(() => {});
  1273. },
  1274. // 分类筛选
  1275. searchClfList(){
  1276. this.page = 1;
  1277. this.getList();
  1278. },
  1279. getProjectBaseConfigList() {
  1280. this.http.post('/project-basecost-setting/list',{},
  1281. res => {
  1282. if (res.code == "ok") {
  1283. this.baseCostItemList = res.data;
  1284. this.$forceUpdate();
  1285. } else {
  1286. this.$message({
  1287. message: res.msg,
  1288. type: "error"
  1289. });
  1290. }
  1291. },
  1292. error => {
  1293. this.$message({
  1294. message: error,
  1295. type: "error"
  1296. });
  1297. }
  1298. );
  1299. },
  1300. deleteBaseItem(row) {
  1301. this.$confirm("该操作可能造成已有数据丢失,确定要删除吗?","删除成本基线项", {
  1302. confirmButtonText: "确定",
  1303. cancelButtonText: "取消",
  1304. type: "warning"
  1305. })
  1306. .then(() => {
  1307. this.listLoading = true;
  1308. this.http.post('/project-basecost-setting/delete',{
  1309. id: row.id
  1310. },
  1311. res => {
  1312. this.listLoading = false;
  1313. if (res.code == "ok") {
  1314. this.$message({
  1315. message: "删除成功",
  1316. type: "success"
  1317. });
  1318. this.getProjectBaseConfigList();
  1319. } else {
  1320. this.$message({
  1321. message: res.msg,
  1322. type: "error"
  1323. });
  1324. }
  1325. },
  1326. error => {
  1327. this.listLoading = false;
  1328. this.$message({
  1329. message: error,
  1330. type: "error"
  1331. });
  1332. }
  1333. );
  1334. })
  1335. .catch(() => {});
  1336. },
  1337. submitInsertBaseItem() {
  1338. this.http.post('/project-basecost-setting/addOrMod',this.addForm,
  1339. res => {
  1340. if (res.code == "ok") {
  1341. this.addBaseItemDialog = false;
  1342. this.baseCostItemList = res.data;
  1343. this.$forceUpdate();
  1344. } else {
  1345. this.$message({
  1346. message: res.msg,
  1347. type: "error"
  1348. });
  1349. }
  1350. },
  1351. error => {
  1352. this.$message({
  1353. message: error,
  1354. type: "error"
  1355. });
  1356. }
  1357. );
  1358. },
  1359. showBaseCostItemDialog() {
  1360. this.showBaseConfig = true;
  1361. },
  1362. addNewBaseItem(row) {
  1363. this.addBaseItemDialog = true;
  1364. if (row == null) {
  1365. this.addForm = {}
  1366. } else {
  1367. this.addForm = row;
  1368. }
  1369. },
  1370. //获取客户列表
  1371. getCustomerList() {
  1372. this.http.post('/customer-info/getAll', {
  1373. },
  1374. res => {
  1375. if (res.code == "ok") {
  1376. this.customerList = res.data;
  1377. } else {
  1378. this.$message({
  1379. message: res.msg,
  1380. type: "error"
  1381. });
  1382. }
  1383. },
  1384. error => {
  1385. this.$message({
  1386. message: error,
  1387. type: "error"
  1388. });
  1389. });
  1390. },
  1391. importProject(item) {
  1392. //首先判断文件类型
  1393. let str = item.file.name.split(".");
  1394. let format = str[str.length - 1];
  1395. if (format != "xls" && format != "xlsx") {
  1396. this.$message({
  1397. message: "请选择.xls或.xlsx文件",
  1398. type: "error"
  1399. });
  1400. } else {
  1401. this.listLoading = true;
  1402. let formData = new FormData();
  1403. formData.append("file", item.file);
  1404. formData.append("userId", this.user.id);
  1405. this.http.uploadFile('/project/importData', formData,
  1406. res => {
  1407. this.$refs.upload.clearFiles();
  1408. this.listLoading = false;
  1409. if (res.code == "ok") {
  1410. this.$message({
  1411. message: "导入成功",
  1412. type: "success"
  1413. });
  1414. this.getList();
  1415. } else {
  1416. this.$message({
  1417. message: res.msg,
  1418. type: "error"
  1419. });
  1420. }
  1421. },
  1422. error => {
  1423. this.$refs.upload.clearFiles();
  1424. this.listLoading = false;
  1425. this.$message({
  1426. message: error,
  1427. type: "error"
  1428. });
  1429. });
  1430. }
  1431. },
  1432. number(){
  1433. //     this.addForm.budget = this.addForm.budget.replace(/[^\.\d]/g,'');
  1434. // this.addForm.budget = this.addForm.budget.replace('.','');
  1435. },
  1436. deleteSubPro(subProject) {
  1437. this.$confirm("确定要删除子项目" + subProject.name + "吗?","删除子项目", {
  1438. confirmButtonText: "确定",
  1439. cancelButtonText: "取消",
  1440. type: "warning"
  1441. })
  1442. .then(() => {
  1443. this.listLoading = true;
  1444. this.http.post('/sub-project/deleteProject',{
  1445. id: subProject.id
  1446. },
  1447. res => {
  1448. this.listLoading = false;
  1449. if (res.code == "ok") {
  1450. this.$message({
  1451. message: "删除成功",
  1452. type: "success"
  1453. });
  1454. this.subProject(this.currentProject);
  1455. } else {
  1456. this.$message({
  1457. message: res.msg,
  1458. type: "error"
  1459. });
  1460. }
  1461. },
  1462. error => {
  1463. this.listLoading = false;
  1464. this.$message({
  1465. message: error,
  1466. type: "error"
  1467. });
  1468. }
  1469. );
  1470. })
  1471. .catch(() => {});
  1472. },
  1473. searchList() {
  1474. this.page = 1;
  1475. this.getList();
  1476. },
  1477. addNewSubProject(subProject) {
  1478. if (subProject == null) {
  1479. this.temaddForm = {projectId: this.currentProject.id, level:1}
  1480. } else {
  1481. this.temaddForm = JSON.parse(JSON.stringify(subProject));
  1482. }
  1483. this.addSubProject = true;
  1484. },
  1485. //显示子项目
  1486. subProject(item) {
  1487. this.subProjectVisible = true;
  1488. this.currentProject = item;
  1489. this.http.post('/sub-project/list', {
  1490. projectId: item.id
  1491. },
  1492. res => {
  1493. if (res.code == "ok") {
  1494. this.subProjectList = res.data;
  1495. } else {
  1496. this.$message({
  1497. message: res.msg,
  1498. type: "error"
  1499. });
  1500. }
  1501. },
  1502. error => {
  1503. this.$message({
  1504. message: error,
  1505. type: "error"
  1506. });
  1507. });
  1508. },
  1509. //显示用户详情
  1510. showUser(userId) {
  1511. this.userDetailVisible = true;
  1512. this.http.post(this.port.manage.userDetail, {
  1513. userId: userId
  1514. },
  1515. res => {
  1516. if (res.code == "ok") {
  1517. this.userDetail = res.data;
  1518. } else {
  1519. this.$message({
  1520. message: res.msg,
  1521. type: "error"
  1522. });
  1523. }
  1524. },
  1525. error => {
  1526. this.$message({
  1527. message: error,
  1528. type: "error"
  1529. });
  1530. });
  1531. },
  1532. //选择参与人
  1533. changeParticipator() {
  1534. //检查是否在参与人中,如果没有需要加入到参与人中
  1535. this.participator = [];
  1536. this.addForm.userId.forEach(u=>{
  1537. var list = this.users.filter(au=>au.id == u);
  1538. if (list.length > 0) {
  1539. var findUser = list[0];
  1540. this.participator.push(findUser);
  1541. } else {
  1542. console.log('未找到用户: '+u);
  1543. }
  1544. })
  1545. },
  1546. getUsers() {
  1547. this.http.post(this.port.manage.list, {
  1548. departmentId: -1,
  1549. pageIndex: 1,
  1550. pageSize: 99999
  1551. },
  1552. res => {
  1553. if (res.code == "ok") {
  1554. this.users = res.data.records;
  1555. } else {
  1556. this.$message({
  1557. message: res.msg,
  1558. type: "error"
  1559. });
  1560. }
  1561. },
  1562. error => {
  1563. this.$message({
  1564. message: error,
  1565. type: "error"
  1566. });
  1567. });
  1568. },
  1569. //分页
  1570. handleCurrentChange(val) {
  1571. this.page = val;
  1572. this.getList();
  1573. },
  1574. handleSizeChange(val) {
  1575. this.size = val;
  1576. this.getList();
  1577. },
  1578. //获取项目列表
  1579. getList() {
  1580. this.listLoading = true;
  1581. this.http.post(this.port.project.listPage, {
  1582. pageIndex: this.page,
  1583. pageSize: this.size,
  1584. keyword:this.keyword,
  1585. searchField: this.searchField,
  1586. status: this.status,
  1587. category: this.statusClf
  1588. //
  1589. },
  1590. res => {
  1591. this.listLoading = false;
  1592. if (res.code == "ok") {
  1593. var list = res.data.records;
  1594. for(var i in list) {
  1595. var participator = list[i].participator , str = "";
  1596. for(var j in participator) {
  1597. if(j == participator.length-1) {
  1598. str += participator[j].name
  1599. } else {
  1600. str += participator[j].name + ','
  1601. }
  1602. }
  1603. list[i].userNames = str;
  1604. }
  1605. this.list = list;
  1606. this.total = res.data.total;
  1607. console.log("列表",res.data);
  1608. } else {
  1609. this.$message({
  1610. message: res.msg,
  1611. type: "error"
  1612. });
  1613. }
  1614. },
  1615. error => {
  1616. this.listLoading = false;
  1617. this.$message({
  1618. message: error,
  1619. type: "error"
  1620. });
  1621. });
  1622. },
  1623. //显示新增界面
  1624. handleAdd(i, item) {
  1625. if(i == -1) {
  1626. this.title = "新增项目";
  1627. this.addForm = {
  1628. name: '',
  1629. isPublic:0,
  1630. userId: [],
  1631. userNames:'',
  1632. code:'',
  1633. inchargerId:null,
  1634. level:1,
  1635. customerId:null,
  1636. notifyUserNames:'',
  1637. chosenLeaders:[],
  1638. taskGpIncharge: 0,
  1639. category:null,
  1640. creatorId: this.user.id
  1641. }
  1642. this.projectBaseCostData = [];
  1643. this.auseList = [];
  1644. for (var m=0;m<this.baseCostItemList.length; m++) {
  1645. this.projectBaseCostData.push({baseId: this.baseCostItemList[m].id, baseName:this.baseCostItemList[m].name, baseAmount:0});
  1646. }
  1647. } else {
  1648. this.title = "修改项目";
  1649. var list = item.participator;
  1650. if (item.isPublic == 1) {
  1651. list = this.users;
  1652. }
  1653. var arr = [];
  1654. var names = '';
  1655. for(var j in list) {
  1656. arr.push(list[j].id)
  1657. names += list[j].name+',';
  1658. }
  1659. if (names.length > 0) {
  1660. names = names.substring(0, names.length -1);
  1661. }
  1662. this.addForm = {
  1663. id: item.id,
  1664. name: item.projectName,
  1665. isPublic: item.isPublic,
  1666. userId: arr,
  1667. userNames:names,
  1668. code:item.projectCode,
  1669. inchargerId: item.inchargerId,
  1670. level: item.level,
  1671. planStartDate: item.planStartDate,
  1672. planEndDate: item.planEndDate,
  1673. budget: item.budget,
  1674. baseMan: item.baseMan,
  1675. contractAmount: item.contractAmount,
  1676. baseFee: item.baseFee,
  1677. baseRisk1: item.baseRisk1,
  1678. baseRisk2: item.baseRisk2,
  1679. baseOutsourcing: item.baseOutsourcing,
  1680. customerId:item.customerId==0?null:item.customerId,
  1681. taskGpIncharge: item.taskGpIncharge,
  1682. category:item.category
  1683. }
  1684. console.log("handleadd",item)
  1685. if(item.associateDegrees != null && item.associateDegrees != 'null' && item.associateDegrees != '') {
  1686. var spli = item.associateDegrees.split(',')
  1687. var sl = []
  1688. for(var i in spli) {
  1689. var num = +spli[i] + 0
  1690. sl.push(num)
  1691. }
  1692. this.auseList = sl
  1693. console.log(this.auseList)
  1694. } else {
  1695. this.auseList = []
  1696. }
  1697. // var spli = item.associateDegrees.split(',')
  1698. // var sl = []
  1699. // for(var i in spli) {
  1700. // var num = +spli[i] + 0
  1701. // sl.push(num)
  1702. // }
  1703. // this.auseList = sl
  1704. // console.log(this.auseList)
  1705. this.changeParticipator();
  1706. this.getProjectBaseData(item.id);
  1707. if (this.user.company.packageEngineering == 1) {
  1708. this.getProjectProfessions(item.id);
  1709. }
  1710. //获取项目的相关领导
  1711. this.getProjectNotifyUserList(item.id);
  1712. this.getProjectAutorList(item.id);
  1713. }
  1714. this.addFormVisible = true;
  1715. if (this.user.company.packageEngineering == 1) {
  1716. if (this.professionList.length == 0) {
  1717. this.getProfessionList();
  1718. }
  1719. }
  1720. },
  1721. //获取项目审核人
  1722. getProjectAutorList(projectId) {
  1723. this.http.post('/project-auditor/getList',{projectId: projectId},
  1724. res => {
  1725. if (res.code == "ok") {
  1726. this.addForm.auditUserIds = res.data.map(function(item) {
  1727. return item.auditorId;
  1728. });
  1729. } else {
  1730. this.$message({
  1731. message: res.msg,
  1732. type: "error"
  1733. });
  1734. }
  1735. },
  1736. error => {
  1737. this.listLoading = false;
  1738. this.$message({
  1739. message: error,
  1740. type: "error"
  1741. });
  1742. }
  1743. );
  1744. },
  1745. getProjectBaseData(projectId) {
  1746. this.http.post('/project-basecost/get',{projectId: projectId},
  1747. res => {
  1748. if (res.code == "ok") {
  1749. this.projectBaseCostData = res.data;
  1750. } else {
  1751. this.$message({
  1752. message: res.msg,
  1753. type: "error"
  1754. });
  1755. }
  1756. },
  1757. error => {
  1758. this.listLoading = false;
  1759. this.$message({
  1760. message: error,
  1761. type: "error"
  1762. });
  1763. }
  1764. );
  1765. },
  1766. //提交子项目创建修改请求
  1767. submitInsertSubProject () {
  1768. this.$refs.form2.validate(valid => {
  1769. if (valid) {
  1770. this.http.post('/sub-project/saveOrUpdate',this.temaddForm,
  1771. res => {
  1772. if (res.code == "ok") {
  1773. this.$message({
  1774. message: "操作成功",
  1775. type: "success"
  1776. });
  1777. this.subProject(this.currentProject);
  1778. this.addSubProject = false;
  1779. } else {
  1780. this.$message({
  1781. message: res.msg,
  1782. type: "error"
  1783. });
  1784. }
  1785. },
  1786. error => {
  1787. this.listLoading = false;
  1788. this.$message({
  1789. message: error,
  1790. type: "error"
  1791. });
  1792. }
  1793. );
  1794. }
  1795. });
  1796. },
  1797. // 项目基线合计
  1798. addUpfun() {
  1799. var total = 0;
  1800. for (var i=0;i<this.projectBaseCostData.length; i++) {
  1801. total += parseFloat(this.projectBaseCostData[i].baseAmount);
  1802. }
  1803. this.addForm.budget = total;
  1804. // var a = '0'
  1805. // var q = '0'
  1806. // var w = '0'
  1807. // var e = '0'
  1808. // var r = '0'
  1809. // // this.addForm.baseMan === undefined || this.addForm.baseMan === NaN ? this.addForm.baseMa = '0' : this.addForm.baseMan
  1810. // if (this.addForm.baseMan == undefined || this.addForm.baseMan == NaN) {
  1811. // a = 0
  1812. // } else {
  1813. // a = this.addForm.baseMan
  1814. // }
  1815. // if (this.addForm.baseFee !== undefined) q = this.addForm.baseFee
  1816. // if (this.addForm.baseOutsourcing !== undefined) w = this.addForm.baseOutsourcing
  1817. // if (this.addForm.baseRisk1 !== undefined) e = this.addForm.baseRisk1
  1818. // if (this.addForm.baseRisk2 !== undefined) r = this.addForm.baseRisk2
  1819. // this.addForm.budget = +a + +q + +w + +e + +r
  1820. },
  1821. submitInsert() {
  1822. this.$refs.form1.validate(valid => {
  1823. if (valid) {
  1824. if (this.user.company.packageEngineering == 1) {
  1825. if (!this.checkProjectProfession()) {//检查不通过,直接返回
  1826. return;
  1827. }
  1828. }
  1829. this.addLoading = true;
  1830. let formData = new FormData();
  1831. formData.append("name", this.addForm.name);
  1832. if(this.addForm.id != null) {
  1833. formData.append("id", this.addForm.id);
  1834. }
  1835. if(this.addForm.isPublic != null) {
  1836. formData.append("isPublic", this.addForm.isPublic);
  1837. }
  1838. if(this.addForm.userId.length != 0 && this.addForm.isPublic == 0) {
  1839. for(var j in this.addForm.userId) {
  1840. formData.append("userId", this.addForm.userId[j]);
  1841. }
  1842. }
  1843. if(this.addForm.inchargerId != null) {
  1844. formData.append("inchargerId", this.addForm.inchargerId);
  1845. }
  1846. if(this.addForm.code != null) {
  1847. formData.append("code", this.addForm.code);
  1848. }
  1849. if(this.addForm.planStartDate != null) {
  1850. formData.append("planStartDate", this.addForm.planStartDate);
  1851. }
  1852. if(this.addForm.planEndDate != null) {
  1853. formData.append("planEndDate", this.addForm.planEndDate);
  1854. }
  1855. if(this.addForm.level != null) {
  1856. formData.append("level", this.addForm.level);
  1857. }
  1858. if(this.addForm.contractAmount != null) {
  1859. formData.append("contractAmount", this.addForm.contractAmount);
  1860. }
  1861. if (this.projectBaseCostData != null) {
  1862. formData.append("projectBaseCostData", JSON.stringify(this.projectBaseCostData));
  1863. //计算总预算成本
  1864. if (this.addForm.budget == null) {
  1865. this.addForm.budget = 0;
  1866. }
  1867. formData.append("budget", this.addForm.budget);
  1868. }
  1869. if (this.addForm.customerId == null) {
  1870. formData.append("customerId", 0);
  1871. } else {
  1872. formData.append("customerId", this.addForm.customerId);
  1873. }
  1874. if (this.chosenLeaders != null && this.chosenLeaders.length > 0) {
  1875. formData.append("chosenLeaders", JSON.stringify(this.chosenLeaders));
  1876. }
  1877. var listId = []
  1878. var listName = []
  1879. for(var i in this.auseList) {
  1880. for(var j in this.ause) {
  1881. if(this.auseList[i] == this.ause[j].id) {
  1882. listId.push(this.ause[j].id);
  1883. listName.push(this.ause[j].name);
  1884. break;
  1885. }
  1886. }
  1887. }
  1888. listId.toString()
  1889. listName.toString()
  1890. formData.append("associateDegrees", listId)
  1891. formData.append("associateDegreeNames", listName)
  1892. formData.append("taskGpIncharge", this.addForm.taskGpIncharge)
  1893. //日报审核人
  1894. formData.append("auditUserIds", JSON.stringify(this.addForm.auditUserIds));
  1895. if(this.addForm.category != null) {
  1896. formData.append("category", this.addForm.category);
  1897. }
  1898. // formData.append("associateDegreeNames", listName)
  1899. // console.log("addform",formData);
  1900. // return
  1901. this.http.uploadFile(this.port.project.add,formData,
  1902. res => {
  1903. this.addLoading = false;
  1904. if (res.code == "ok") {
  1905. this.$message({
  1906. message: (this.addForm.id!=null?'修改':'创建')+"成功",
  1907. type: "success"
  1908. });
  1909. this.addFormVisible = false;
  1910. this.getList();
  1911. if (this.user.company.packageEngineering == 1) {
  1912. this.saveProjectProfessions(res.data);
  1913. }
  1914. } else {
  1915. this.$message({
  1916. message: res.msg,
  1917. type: "error"
  1918. });
  1919. }
  1920. },
  1921. error => {
  1922. this.addLoading = false;
  1923. this.$message({
  1924. message: error,
  1925. type: "error"
  1926. });
  1927. });
  1928. }
  1929. });
  1930. },
  1931. // 删除
  1932. deletePro(i, item) {
  1933. this.$confirm("确定要删除项目[" + item.projectName + "]吗?","删除项目", {
  1934. confirmButtonText: "确定",
  1935. cancelButtonText: "取消",
  1936. type: "warning"
  1937. })
  1938. .then(() => {
  1939. this.listLoading = true;
  1940. this.http.post(this.port.project.delete,{
  1941. id: item.id
  1942. },
  1943. res => {
  1944. this.listLoading = false;
  1945. if (res.code == "ok") {
  1946. this.$message({
  1947. message: "删除成功",
  1948. type: "success"
  1949. });
  1950. this.getList();
  1951. } else if (res.code == 'reconfirm') {
  1952. this.deleteAlertMsg = res.msg;
  1953. this.forceDeletePro(item.id);
  1954. } else {
  1955. this.$message({
  1956. message: res.msg,
  1957. type: "error"
  1958. });
  1959. }
  1960. },
  1961. error => {
  1962. this.listLoading = false;
  1963. this.$message({
  1964. message: error,
  1965. type: "error"
  1966. });
  1967. }
  1968. );
  1969. })
  1970. .catch(() => {});
  1971. },
  1972. //强制删除项目
  1973. forceDeletePro(deleteProId) {
  1974. this.$confirm(this.deleteAlertMsg,"删除项目", {
  1975. confirmButtonText: "确定",
  1976. cancelButtonText: "取消",
  1977. type: "warning"
  1978. })
  1979. .then(() => {
  1980. this.listLoading = true;
  1981. this.http.post(this.port.project.delete,{
  1982. id: deleteProId ,force:1
  1983. },
  1984. res => {
  1985. this.listLoading = false;
  1986. if (res.code == "ok") {
  1987. this.$message({
  1988. message: "删除成功",
  1989. type: "success"
  1990. });
  1991. this.getList();
  1992. } else {
  1993. this.$message({
  1994. message: res.msg,
  1995. type: "error"
  1996. });
  1997. }
  1998. },
  1999. error => {
  2000. this.listLoading = false;
  2001. this.$message({
  2002. message: error,
  2003. type: "error"
  2004. });
  2005. }
  2006. );
  2007. })
  2008. .catch(() => {});
  2009. },
  2010. detail(i) {
  2011. this.$router.push("/list/" + this.list[i].id + "/" + this.list[i].projectName);
  2012. }
  2013. },
  2014. created() {
  2015. let height = window.innerHeight;
  2016. this.tableHeight = height - 195;
  2017. const that = this;
  2018. window.onresize = function temp() {
  2019. that.tableHeight = window.innerHeight - 195;
  2020. };
  2021. },
  2022. mounted() {
  2023. this.userssHu()
  2024. this.getDepartment();
  2025. this.getList();
  2026. this.getUsers();
  2027. this.getCustomerList();
  2028. this.getProjectBaseConfigList();
  2029. this.getClfConfigList()
  2030. this.yanjiuzx()
  2031. }
  2032. };
  2033. </script>
  2034. <style lang="scss" scoped>
  2035. .rg_span{
  2036. display: inline-block;
  2037. }
  2038. .rg_span span {
  2039. text-align: right;
  2040. box-sizing: border-box;
  2041. padding-right: 10px;
  2042. }
  2043. .el-dialog__title {
  2044. display: inline-table;
  2045. margin-top: 20px;
  2046. }
  2047. .addss {
  2048. width: 100%;
  2049. overflow: hidden;
  2050. white-space: nowrap;
  2051. text-overflow: ellipsis;
  2052. }
  2053. // 111
  2054. </style>
  2055. <style>
  2056. .customdropdown .el-dropdown__caret-button{
  2057. height: 27px;
  2058. }
  2059. .customdropdown .el-button--mini:nth-child(1){
  2060. height: 27px;
  2061. }
  2062. .customdropdown_menu{
  2063. padding: 0;
  2064. }
  2065. .customdropdown_menu_btn{
  2066. border-color: transparent;
  2067. }
  2068. .ganttdialog .el-dialog__body{
  2069. height: 880px;
  2070. }
  2071. .toolbar_formitem_n1{
  2072. margin-right: 0 !important;
  2073. }
  2074. </style>