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="390" align="left">
  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 && 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" placeholder="请输入项目编号" clearable></el-input>
  181. </el-form-item>
  182. <el-form-item label="项目分类">
  183. <el-select v-model="addForm.category" clearable>
  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" 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">
  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="负责人" >
  221. <el-select v-model="addForm.inchargerId" :disabled="(addForm.userId.length==0 || permissions.projectManagement) && addForm.isPublic == 0" filterable placeholder="请选择负责人" style="width:32%;" >
  222. <el-option v-for="item in participator" :key="item.id" :label="item.name" :value="item.id"></el-option>
  223. </el-select>
  224. </el-form-item>
  225. <el-form-item label="日报审核人" >
  226. <el-select v-model="addForm.auditUserIds" multiple="true" :disabled=" !(permissions.projectManagement|| user.id == addForm.inchargerId || user.id == addForm.creatorId)" filterable placeholder="默认为项目负责人" style="width:100%;" >
  227. <el-option v-for="item in participator" :key="item.id" :label="item.name" :value="item.id"></el-option>
  228. </el-select>
  229. </el-form-item>
  230. <!--专业项目协作版本功能 -->
  231. <el-form-item label="级别" v-if="user.company.packageProject==1">
  232. <el-select v-model="addForm.level" placeholder="请选择级别" style="width:32%;" >
  233. <el-option v-for="item in importanceList" :key="item.id" :label="item.label" :value="item.id"></el-option>
  234. </el-select>
  235. <!-- 增加合同金额字段 -->
  236. <span style="margin-left:63px;margin-right:10px;" v-if="user.company.packageProject==1">合同金额</span>
  237. <el-input id="contractAmount" v-model="addForm.contractAmount" style="width:33%;"
  238. placeholder="整数" clearable @keyup.native="restrictNumber('contractAmount')" ></el-input><span style="margin-left:10px;">元</span>
  239. <!-- 增加合同金额字段 -->
  240. </el-form-item>
  241. <el-form-item label="开始日期" prop="planStartDate" >
  242. <el-date-picker v-model="addForm.planStartDate"
  243. :editable="false" style="width:32%;"
  244. format="yyyy-MM-dd"
  245. value-format="yyyy-MM-dd"
  246. :clearable="false" type="date"
  247. placeholder="选择日期"></el-date-picker>
  248. <span style="margin-left:63px;margin-right:10px;" >截止日期</span>
  249. <el-date-picker v-model="addForm.planEndDate" style="width:33%;"
  250. :editable="false"
  251. format="yyyy-MM-dd"
  252. value-format="yyyy-MM-dd"
  253. :clearable="false" type="date"
  254. placeholder="选择日期"></el-date-picker>
  255. </el-form-item>
  256. <!--非建筑工程专业版设置 -->
  257. <!-- <el-form-item label="日报审核权限" v-if="user.company.packageProject==1 && user.company.packageEngineering == 0">
  258. <el-radio-group v-model="addForm.taskGpIncharge" >
  259. <el-radio :label="0">由项目负责人审核</el-radio>
  260. <el-radio :label="1">由各任务分组负责人审核</el-radio>
  261. </el-radio-group>
  262. </el-form-item> -->
  263. <!-- 项目基线 -->
  264. <div style="margin: 10px 0 30px 0;min-height:200px;" v-if="user.company.packageProject == 1">
  265. <el-tabs v-model="activeName" @tab-click="handleClick">
  266. <el-tab-pane label="成本基线" name="baseCostPanel" >
  267. <div style="padding-top:10px;">
  268. <!--新版 -->
  269. <span class="rg_span" v-for="(item, index) in projectBaseCostData" :key="item.id">
  270. <span style="width:120px;display: inline-block;" v-if="user.company.packageProject==1">{{item.baseName}}</span>
  271. <el-input :id="'baseCost'+index" @input="addUpfun()" v-model="item.baseAmount" style="width:200px; margin-bottom: 20px"
  272. placeholder="整数" clearable @keyup.native="restrictNumber('baseCost'+index)"></el-input><span style="margin-left:10px;">元</span>
  273. </span>
  274. <!-- 合计 -->
  275. <div style="margin-top: 10px;float:right;">
  276. <span style="margin-right:50px;margin-right:10px;" v-if="user.company.packageProject==1">合计</span>
  277. <span v-if="addForm.budget <= 0 || addForm.budget == undefined">0</span>
  278. <span v-else>{{addForm.budget | numberToCurrency}}</span>
  279. <span style="margin-right:50px;margin-left:10px;">元</span>
  280. </div>
  281. </div>
  282. </el-tab-pane>
  283. <el-tab-pane label="工程专业" name="engineeringProfession" v-if="user.company.packageEngineering == 1">
  284. <div style="padding-top:10px;">
  285. <el-table :data="projectProfessionList" size="small" :key="Math.random()">
  286. <el-table-column prop="professionId" width="200">
  287. <template slot-scope="scope">
  288. <el-select v-model="scope.row.professionId" >
  289. <el-option v-for="item in professionList" :key="item.id" :label="item.name" :value="item.id"/>
  290. </el-select>
  291. </template>
  292. <template slot="header" >
  293. <span style="font-size:14px;font-weight:normal;">专业名称</span>
  294. </template>
  295. </el-table-column>
  296. <el-table-column prop="percentage" width="120" label="占比(%)">
  297. <template slot-scope="scope">
  298. <div><el-input type="number" v-model="scope.row.percentage"></el-input></div>
  299. </template>
  300. </el-table-column>
  301. <el-table-column prop="membNames" label="相关人员及占比">
  302. <template slot-scope="scope">
  303. <span style="margin:0 5px;" v-for="item in scope.row.membList" :key="item.membId">{{item.membName}}({{item.percentage}}%)</span>
  304. <el-link @click="showEditPpMembs(scope.row)">{{(scope.row.membList == null || scope.row.membList.length == 0)?'设置专业参与人员':'设置'}}</el-link>
  305. </template>
  306. </el-table-column>
  307. <el-table-column prop="inchargerName" width="120" label="负责人">
  308. <template slot-scope="scope">
  309. <el-select v-model="scope.row.inchargerId" >
  310. <el-option v-for="item in participator" :key="item.id" :label="item.name" :value="item.id">
  311. </el-option>
  312. </el-select>
  313. </template>
  314. </el-table-column>
  315. <el-table-column width="80">
  316. <template slot-scope="scope">
  317. <el-button icon="el-icon-delete" size="mini" style="margin-left:10px;" @click.stop.native="deleteItem(scope.$index)"></el-button>
  318. </template>
  319. <template slot="header" >
  320. <el-link type="primary" :underline="false" @click="addItem">添加</el-link>
  321. </template>
  322. </el-table-column>
  323. </el-table>
  324. </div>
  325. </el-tab-pane>
  326. <el-tab-pane label="相关领导" name="leaders" >
  327. <div style="padding-top:10px;">
  328. <el-input @focus="showChooseLeaderTree" v-model="addForm.notifyUserNames" placeholder="请选择需要接收审核通知的相关领导"></el-input>
  329. </div>
  330. </el-tab-pane>
  331. </el-tabs>
  332. </div>
  333. </el-form>
  334. <div slot="footer" class="dialog-footer;">
  335. <el-button @click.native="addFormVisible = false">取消</el-button>
  336. <el-button type="primary" @click="submitInsert" :loading="addLoading">提交</el-button>
  337. </div>
  338. </el-dialog>
  339. <!--用户详细信息弹出框-->
  340. <el-dialog title="查看详情" v-if="userDetailVisible" :visible.sync="userDetailVisible" :close-on-click-modal="false" customClass="customWidth" width="400px">
  341. <div class="line"><span>姓名</span><span>{{userDetail.name}}</span></div>
  342. <div class="line"><span>手机号码</span><span>{{userDetail.phone}}</span></div>
  343. <div class="line"><span>角色</span><span>{{roleArray[userDetail.role]}}</span></div>
  344. <div class="line"><span>部门</span><span>{{userDetail.departmentName}}</span></div>
  345. <div slot="footer" class="dialog-footer">
  346. <el-button type="primary" @click="userDetailVisible = false" >确定</el-button>
  347. </div>
  348. </el-dialog>
  349. <!-- 子项目列表 -->
  350. <el-dialog title="子项目列表" show-header="false" v-if="subProjectVisible" :visible.sync="subProjectVisible" :close-on-click-modal="false" customClass="customWidth" width="500px">
  351. <el-table :data="subProjectList" highlight-current-row height="400" style="width: 100%;">
  352. <!-- <el-table-column type="index" width="60" label="序号">
  353. <template slot-scope="scope" >
  354. {{scope.$index+1+(page-1)*size}}
  355. </template>
  356. </el-table-column> -->
  357. <el-table-column width="120" label="子项目编号" prop="code"></el-table-column>
  358. <el-table-column prop="name" label="名称" ></el-table-column>
  359. <el-table-column label="操作" width="150">
  360. <template slot-scope="scope" >
  361. <el-button size="small" type="primary" @click="addNewSubProject(scope.row)">编辑</el-button>
  362. <el-button size="small" type="danger" @click="deleteSubPro(scope.row)">删除</el-button>
  363. </template>
  364. </el-table-column>
  365. </el-table>
  366. <div slot="footer" class="dialog-footer">
  367. <el-button type="primary" @click="subProjectVisible = false" >关闭</el-button>
  368. <el-button type="primary" @click="addNewSubProject()" >新增子项目</el-button>
  369. </div>
  370. </el-dialog>
  371. <!-- 新增子项目弹出框 -->
  372. <el-dialog title="新增/修改子项目" v-if="addSubProject" :visible.sync="addSubProject" :close-on-click-modal="false" customClass="customWidth" width="500px">
  373. <el-form ref="form2" :model="temaddForm" :rules="rules" label-width="100px">
  374. <el-form-item label="项目编号" prop="code">
  375. <el-input v-model="temaddForm.code" placeholder="请输入项目编号" clearable></el-input>
  376. </el-form-item>
  377. <el-form-item label="项目名称" prop="name">
  378. <el-input v-model="temaddForm.name" placeholder="请输入项目名称" clearable></el-input>
  379. </el-form-item>
  380. </el-form>
  381. <div slot="footer" class="dialog-footer">
  382. <el-button @click.native="addSubProject = false">取消</el-button>
  383. <el-button type="primary" @click="submitInsertSubProject" :loading="addLoading">提交</el-button>
  384. </div>
  385. </el-dialog>
  386. <!-- 项目基线成本项配置弹出框 -->
  387. <el-dialog title="项目基线成本项管理" show-header="false" v-if="showBaseConfig" :visible.sync="showBaseConfig" :close-on-click-modal="false" customClass="customWidth" width="500px">
  388. <el-table :data="baseCostItemList" highlight-current-row height="400" style="width: 100%;">
  389. <el-table-column type="index" width="60" label="序号">
  390. <template slot-scope="scope" >
  391. {{scope.$index+1+(page-1)*size}}
  392. </template>
  393. </el-table-column>
  394. <el-table-column prop="name" label="名称" ></el-table-column>
  395. <el-table-column label="操作" width="150">
  396. <template slot-scope="scope" >
  397. <el-button size="small" type="primary" @click="addNewBaseItem(scope.row)">编辑</el-button>
  398. <el-button size="small" type="danger" @click="deleteBaseItem(scope.row)">删除</el-button>
  399. </template>
  400. </el-table-column>
  401. </el-table>
  402. <div slot="footer" class="dialog-footer">
  403. <el-button type="primary" @click="showBaseConfig = false" >关闭</el-button>
  404. <el-button type="primary" @click="addNewBaseItem()" >新增成本项</el-button>
  405. </div>
  406. </el-dialog>
  407. <!-- 分类条目配置 -->
  408. <el-dialog title="项目分类条目管理" show-header="false" v-if="showClfDialog" :visible.sync="showClfDialog" :close-on-click-modal="false" customClass="customWidth" width="500px">
  409. <el-table :data="baseClfList" highlight-current-row height="400" style="width: 100%;">
  410. <el-table-column type="index" width="60" label="序号">
  411. <template slot-scope="scope" >
  412. {{scope.$index+1+(page-1)*size}}
  413. </template>
  414. </el-table-column>
  415. <el-table-column prop="name" label="名称" ></el-table-column>
  416. <el-table-column label="操作" width="150">
  417. <template slot-scope="scope" >
  418. <el-button size="small" type="primary" @click="addNewClf(scope.row)">编辑</el-button>
  419. <el-button size="small" type="danger" @click="deleteClf(scope.row)">删除</el-button>
  420. </template>
  421. </el-table-column>
  422. </el-table>
  423. <div slot="footer" class="dialog-footer">
  424. <el-button type="primary" @click="showClfDialog = false" >关闭</el-button>
  425. <el-button type="primary" @click="addNewClf()" >新增分类项</el-button>
  426. </div>
  427. </el-dialog>
  428. <!-- 新增/编辑 分类条目 -->
  429. <el-dialog title="新增/修改分类条目" v-if="addClfDialog" :visible.sync="addClfDialog" :close-on-click-modal="false" customClass="customWidth" width="500px">
  430. <el-form ref="form2" :model="addClf" :rules="rules" label-width="100px">
  431. <el-form-item label="分类名称" prop="name">
  432. <el-input v-model="addClf.name" placeholder="请输入名称" clearable></el-input>
  433. </el-form-item>
  434. </el-form>
  435. <div slot="footer" class="dialog-footer">
  436. <el-button @click.native="addClfDialog = false">取消</el-button>
  437. <el-button type="primary" @click="submitClf" :loading="addLoading">提交</el-button>
  438. </div>
  439. </el-dialog>
  440. <el-dialog title="新增/修改成本项" v-if="addBaseItemDialog" :visible.sync="addBaseItemDialog" :close-on-click-modal="false" customClass="customWidth" width="500px">
  441. <el-form ref="form2" :model="addForm" :rules="rules" label-width="100px">
  442. <el-form-item label="成本项名称" prop="name">
  443. <el-input v-model="addForm.name" placeholder="请输入名称" clearable></el-input>
  444. </el-form-item>
  445. </el-form>
  446. <div slot="footer" class="dialog-footer">
  447. <el-button @click.native="addBaseItemDialog = false">取消</el-button>
  448. <el-button type="primary" @click="submitInsertBaseItem" :loading="addLoading">提交</el-button>
  449. </div>
  450. </el-dialog>
  451. <!-- 按部门选择人员 -->
  452. <el-dialog title="选择参与人员" v-if="chooseParticipVisible" :visible.sync="chooseParticipVisible" :close-on-click-modal="false" customClass="customWidth" width="500px">
  453. <!-- <el-input style="width:100%" v-model="filterName" placeholder="请输入姓名搜索" @change="findUserInTree"></el-input> -->
  454. <div class="tree" style="height:400px">
  455. <el-scrollbar style="height:100%">
  456. <el-input
  457. placeholder="输入关键字进行过滤"
  458. v-model="filterText">
  459. </el-input>
  460. <el-tree :data="deptMembData" show-checkbox :props="defaultProps" node-key="id"
  461. ref="chooseMembTree" @check-change="onTreeItemChange" :default-checked-keys="addForm.userId"
  462. highlight-current :filter-node-method="filterNode" default-expand-all></el-tree>
  463. </el-scrollbar>
  464. </div>
  465. <div>已选中&nbsp;{{chosenMembCount}}&nbsp;人</div>
  466. <div slot="footer" class="dialog-footer">
  467. <el-button @click="chooseParticipVisible = false" >取消</el-button>
  468. <el-button type="primary" @click="chooseParticip()" >确定</el-button>
  469. </div>
  470. </el-dialog>
  471. <!-- 按部门选择相关领导 -->
  472. <el-dialog title="选择相关领导" v-if="chooseLeaderVisible" :visible.sync="chooseLeaderVisible" :close-on-click-modal="false" customClass="customWidth" width="500px">
  473. <!-- <el-input style="width:100%" v-model="filterName" placeholder="请输入姓名搜索" @change="findUserInTree"></el-input> -->
  474. <div class="tree" style="height:400px">
  475. <el-scrollbar style="height:100%">
  476. <el-tree :data="deptMembData" show-checkbox :props="defaultProps" node-key="id"
  477. ref="chooseLeaderTree" @check-change="onLeaderTreeItemChange" :default-checked-keys="addForm.notifyUserIds"
  478. highlight-current ></el-tree>
  479. </el-scrollbar>
  480. </div>
  481. <div>已选中&nbsp;{{chosenMembCount}}&nbsp;人</div>
  482. <div slot="footer" class="dialog-footer">
  483. <el-button @click="chooseLeaderVisible = false" >取消</el-button>
  484. <el-button type="primary" @click="chooseLeader()" >确定</el-button>
  485. </div>
  486. </el-dialog>
  487. <!-- 项目专业人员的设置 -->
  488. <el-dialog title="设置项目专业人员" v-if="editPpMembDialog" :visible.sync="editPpMembDialog" :close-on-click-modal="false" customClass="customWidth" width="600px">
  489. <el-table :data="curProfessionRow.membList" height="400">
  490. <el-table-column prop="name" label="专业人员">
  491. <template slot-scope="scope">
  492. <el-select v-model="scope.row.membId" filterable placeholder="请选择专业参与人" style="width:100%;" >
  493. <el-option v-for="item in participator" :key="item.id" :label="item.name" :value="item.id">
  494. </el-option>
  495. </el-select>
  496. </template>
  497. </el-table-column>
  498. <el-table-column prop="percentage" width="120" label="占比(%)">
  499. <template slot-scope="scope">
  500. <el-input type="number" v-model="scope.row.percentage"></el-input>
  501. </template>
  502. </el-table-column>
  503. <el-table-column width="80">
  504. <template slot-scope="scope">
  505. <el-button icon="el-icon-delete" size="mini" style="margin-left:10px;" @click.stop.native="deleteMembItem(scope.$index)"></el-button>
  506. </template>
  507. <template slot="header" >
  508. <el-link @click="addMembItem">添加</el-link>
  509. </template>
  510. </el-table-column>
  511. </el-table>
  512. <div slot="footer" class="dialog-footer">
  513. <el-button @click="editPpMembDialog = false" >取消</el-button>
  514. <el-button type="primary" @click="addPpMemb" >确定</el-button>
  515. </div>
  516. </el-dialog>
  517. <!-- <el-dialog title="提示" v-if="deleteReconfirmDialog" :visible.sync="deleteReconfirmDialog" :close-on-click-modal="false" customClass="customWidth" width="500px">
  518. <p>{{deleteAlertMsg}}</p>
  519. <div slot="footer" class="dialog-footer">
  520. <el-button @click="deleteReconfirmDialog = false" >取消</el-button>
  521. <el-button type="primary" @click="forceDeletePro" >确认并删除</el-button>
  522. </div>
  523. </el-dialog> -->
  524. </section>
  525. </template>
  526. <style scoped>
  527. .input-with-select .el-input-group__prepend {
  528. background-color: #fff;
  529. }
  530. .line {
  531. padding:10px;
  532. }
  533. .line span{
  534. font-size:15px;
  535. }
  536. .line span:nth-child(even){
  537. float:right;
  538. }
  539. .kans {
  540. width: 230px;
  541. overflow:hidden;
  542. white-space:nowrap;
  543. text-overflow: ellipsis;
  544. }
  545. a {
  546. text-decoration: none;
  547. }
  548. .router-link-active {
  549. text-decoration: none;
  550. }
  551. </style>
  552. <script>
  553. import util from "../../common/js/util";
  554. import projectgantt from "./project_gantt.vue"
  555. export default {
  556. components:{projectgantt},
  557. data() {
  558. return {
  559. isganttshow: false,
  560. deleteAlertMsg: null,
  561. chosenLeaders:[],
  562. chooseLeaderVisible:false,
  563. projectProfessionItem:null,
  564. curProfessionRow:null,
  565. editPpMembDialog:false,
  566. professionList:[],
  567. projectProfessionList:[],
  568. activeName:"baseCostPanel",
  569. chosenMembCount:0,
  570. chosenMembList:[],//选中的人员
  571. allMembData:[],
  572. deptMembData: [
  573. {
  574. id: 0,
  575. label: '未分配',
  576. }
  577. ],
  578. option: [],
  579. depData: {
  580. id: -1,
  581. label: '全部人员',
  582. },
  583. defaultProps: {
  584. children: 'children',
  585. label: 'label'
  586. },
  587. filterName:null,
  588. chooseParticipVisible: false,
  589. projectBaseCostData:[],
  590. addBaseItemDialog:false,
  591. showBaseConfig:false,
  592. customerList:[],
  593. roleArray:["普通员工","超级管理员", "系统管理员", "公司高层","财务管理员", "项目管理员"],
  594. status:null,
  595. statusTxt:["-","进行中","已完成","已撤销"],
  596. importanceList:[{id:1,label:'正常'},{id:2,label:'紧急'},{id:3,label:'重要'},{id:4,label:'重要且紧急'}],
  597. searchField:null,
  598. keyword:null,
  599. user: JSON.parse(sessionStorage.getItem("user")),
  600. permissions: JSON.parse(sessionStorage.getItem("permissions")),
  601. userDetailVisible: false,
  602. userDetail:{},
  603. date: new Date(),
  604. users: [],
  605. participator:[],
  606. tableHeight: 0,
  607. listLoading: false,
  608. total: 0,
  609. page: 1,
  610. size: 20,
  611. list: [],
  612. subProjectVisible: false,
  613. subProjectList: [],//子项目列表
  614. currentProject:{},
  615. addSubProject: false,
  616. addFormVisible: false,
  617. addLoading: false,
  618. addUp: 0, // 合计
  619. title: "",
  620. addForm: {
  621. name: '',
  622. userId: [],
  623. level:1,
  624. taskGpIncharge: 0,
  625. id: '',
  626. code: ''
  627. },
  628. temaddForm: {},
  629. rules: {
  630. name: [{ required: true, message: "请输入名称", trigger: "blur" }]
  631. },
  632. ause: [],
  633. auseList: [],
  634. yonghuUser: [],
  635. filterText: '',
  636. showClfDialog: false,
  637. addClfDialog:false,
  638. addClf:{name:'',id:''},
  639. statusClf:null,
  640. permissionsObj: {},
  641. };
  642. },
  643. // 过滤器
  644. filters: {
  645. numberToCurrency(value) {
  646. if (!value) return '0.00'
  647. // 将数值截取,保留两位小数
  648. value = value.toFixed(2)
  649. // 获取整数部分
  650. const intPart = Math.trunc(value)
  651. // 整数部分处理,增加,
  652. const intPartFormat = intPart.toString().replace(/(\d)(?=(?:\d{3})+$)/g, '$1,')
  653. // 预定义小数部分
  654. let floatPart = '.00'
  655. // 将数值截取为小数部分和整数部分
  656. const valueArray = value.toString().split('.')
  657. if (valueArray.length === 2) { // 有小数部分
  658. floatPart = valueArray[1].toString() // 取得小数部分
  659. return intPartFormat + '.' + floatPart
  660. }
  661. return intPartFormat + floatPart
  662. },
  663. },
  664. watch: {
  665. filterText(val) {
  666. this.$refs.chooseMembTree.filter(val);
  667. }
  668. },
  669. methods: {
  670. filterNode(value, data) {
  671. if (!value) return true;
  672. return data.label.indexOf(value) !== -1;
  673. },
  674. //重启项目
  675. restartPro(row) {
  676. this.http.post('/project/start',{id: row.id},
  677. res => {
  678. if (res.code == "ok") {
  679. this.$message({
  680. message: '重启成功',
  681. type: "success"
  682. });
  683. row.status = 1;
  684. } else {
  685. this.$message({
  686. message: res.msg,
  687. type: "error"
  688. });
  689. }
  690. },
  691. error => {
  692. this.$message({
  693. message: error,
  694. type: "error"
  695. });
  696. });
  697. },
  698. //撤销项目
  699. cancelPro(row) {
  700. this.http.post('/project/cancel',{id: row.id},
  701. res => {
  702. if (res.code == "ok") {
  703. this.$message({
  704. message: '撤销成功',
  705. type: "success"
  706. });
  707. row.status = 3;
  708. } else {
  709. this.$message({
  710. message: res.msg,
  711. type: "error"
  712. });
  713. }
  714. },
  715. error => {
  716. this.$message({
  717. message: error,
  718. type: "error"
  719. });
  720. });
  721. },
  722. //完成项目
  723. finishPro(row) {
  724. this.http.post('/project/finish',{id: row.id},
  725. res => {
  726. if (res.code == "ok") {
  727. this.$message({
  728. message: '项目完成',
  729. type: "success"
  730. });
  731. row.status = 2;
  732. } else {
  733. this.$message({
  734. message: res.msg,
  735. type: "error"
  736. });
  737. }
  738. },
  739. error => {
  740. this.$message({
  741. message: error,
  742. type: "error"
  743. });
  744. });
  745. },
  746. exportProjectData() {
  747. //导出项目
  748. this.http.post('/project/exportData',{},
  749. res => {
  750. if (res.code == "ok") {
  751. var filePath = res.data;
  752. const a = document.createElement('a'); // 创建a标签
  753. a.setAttribute('download', '项目导出.xls');// download属性
  754. a.setAttribute('href', filePath);// href链接
  755. a.click(); //自执行点击事件
  756. a.remove();
  757. }
  758. },
  759. error => {
  760. this.$message({
  761. message: error,
  762. type: "error"
  763. });
  764. }
  765. );
  766. },
  767. userssHu() {
  768. this.http.post('/time-type/getCompanyTimeSetting',{
  769. companyId: this.user.companyId
  770. },
  771. res => {
  772. if (res.code == "ok") {
  773. this.yonghuUser = res.data
  774. console.log(this.yonghuUser)
  775. }
  776. },
  777. error => {
  778. this.$message({
  779. message: error,
  780. type: "error"
  781. });
  782. }
  783. );
  784. },
  785. yanjiuzx() {
  786. this.http.post('/report-extra-degree/getAll ',{},
  787. res => {
  788. if (res.code == "ok") {
  789. console.log(res, '过来的数据')
  790. this.ause = res.data
  791. } else {
  792. this.$message({
  793. message: res.msg,
  794. type: "error"
  795. });
  796. }
  797. },
  798. error => {
  799. this.$message({
  800. message: error,
  801. type: "error"
  802. });
  803. }
  804. );
  805. },
  806. selectPublic() {
  807. if (this.addForm.isPublic == 1) {
  808. this.participator = this.users;
  809. } else {
  810. this.participator = [];
  811. }
  812. },
  813. addPpMemb() {
  814. //检查合计比例是否到达100%
  815. let p = 0;
  816. let hasNoMemb = false;
  817. this.curProfessionRow.membList.forEach(m=>{
  818. p += parseInt(m.percentage);
  819. //检查人员是否选择
  820. if (m.membId == null) {
  821. hasNoMemb = true;
  822. }
  823. });
  824. if (hasNoMemb) {
  825. this.$message({
  826. message: '专业人员不能为空',
  827. type: "error"
  828. });
  829. return;
  830. }
  831. //检查人员不能重复
  832. let hasDuplicate = false;
  833. this.curProfessionRow.membList.forEach(m=>{
  834. if (this.curProfessionRow.membList.filter(innerM=>innerM.membId == m.membId).length>1) {
  835. hasDuplicate = true;
  836. }
  837. });
  838. if (hasDuplicate) {
  839. this.$message({
  840. message: '专业人员不能重复',
  841. type: "error"
  842. });
  843. return;
  844. }
  845. if (p != 100) {
  846. this.$message({
  847. message: '占比合计必须是100%',
  848. type: "error"
  849. });
  850. return;
  851. }
  852. this.editPpMembDialog = false;
  853. this.curProfessionRow.membList.forEach(m=>{
  854. m.membName = this.participator.filter(p=>p.id == m.membId)[0].name;
  855. });
  856. this.projectProfessionItem.membList = JSON.parse(JSON.stringify(this.curProfessionRow.membList));
  857. },
  858. //删除专业人员
  859. deleteMembItem(index) {
  860. this.curProfessionRow.membList.splice(index,1);
  861. },
  862. //添加专业人员
  863. addMembItem() {
  864. if (this.curProfessionRow.membList == null) {
  865. this.curProfessionRow.membList = [{membId:null, percentage:100}];
  866. } else {
  867. let p = 0;
  868. this.curProfessionRow.membList.forEach(m=>{
  869. p += parseInt(m.percentage);
  870. });
  871. this.curProfessionRow.membList.push({membId:null, percentage:100-p});
  872. }
  873. this.$forceUpdate();
  874. },
  875. showEditPpMembs(row) {
  876. this.projectProfessionItem = row;
  877. this.curProfessionRow = JSON.parse(JSON.stringify(row));
  878. if (this.curProfessionRow.membList == null || this.curProfessionRow.membList.length == 0) {
  879. this.curProfessionRow.membList = [{membId:null, percentage:100}];
  880. }
  881. this.editPpMembDialog = true;
  882. },
  883. getProjectNotifyUserList(projectId) {
  884. this.http.post("/project-notify-user/get", {projectId: projectId},
  885. res => {
  886. if (res.code == "ok") {
  887. var chosenLeaderIds = [];
  888. var chosenLeaderNames = '';
  889. var leaderList = res.data;
  890. this.chosenLeaders = leaderList;
  891. for(var j in leaderList) {
  892. chosenLeaderIds.push(leaderList[j].userId)
  893. chosenLeaderNames += leaderList[j].userName+',';
  894. }
  895. if (chosenLeaderNames.length > 0) {
  896. chosenLeaderNames = chosenLeaderNames.substring(0, chosenLeaderNames.length -1);
  897. }
  898. this.addForm.notifyUserIds = chosenLeaderIds;
  899. this.addForm.notifyUserNames = chosenLeaderNames;
  900. } else {
  901. this.$message({
  902. message: res.msg,
  903. type: "error"
  904. });
  905. }
  906. },
  907. error => {
  908. this.$message({
  909. message: error,
  910. type: "error"
  911. });
  912. });
  913. },
  914. getProjectProfessions(projectId) {
  915. this.http.post("/project-profession/get", {projectId: projectId},
  916. res => {
  917. if (res.code == "ok") {
  918. this.projectProfessionList = res.data;
  919. } else {
  920. this.$message({
  921. message: res.msg,
  922. type: "error"
  923. });
  924. }
  925. },
  926. error => {
  927. this.$message({
  928. message: error,
  929. type: "error"
  930. });
  931. });
  932. },
  933. checkProjectProfession() {
  934. //检查合计比例是否到达100%
  935. let p = 0;
  936. let hasNoMemb = false;
  937. let hasNoProfession = false;
  938. let hasNoMembList = false;
  939. this.projectProfessionList.forEach(m=>{
  940. p += parseInt(m.percentage);
  941. //检查人员是否选择
  942. if (m.inchargerId == null) {
  943. hasNoMemb = true;
  944. }
  945. if (m.professionId == null) {
  946. hasNoProfession = true;
  947. }
  948. if (m.membList == null) {
  949. hasNoMembList = true;
  950. }
  951. });
  952. if (hasNoProfession) {
  953. this.$message({
  954. message: '专业不能为空',
  955. type: "error"
  956. });
  957. return false;
  958. }
  959. if (hasNoMembList) {
  960. this.$message({
  961. message: '专业相关人员不能为空',
  962. type: "error"
  963. });
  964. return false;
  965. }
  966. if (hasNoMemb) {
  967. this.$message({
  968. message: '专业负责人不能为空',
  969. type: "error"
  970. });
  971. return false;
  972. }
  973. //检查专业不能重复
  974. let hasDuplicate = false;
  975. this.projectProfessionList.forEach(m=>{
  976. if (this.projectProfessionList.filter(innerM=>innerM.professionId == m.professionId).length>1) {
  977. hasDuplicate = true;
  978. }
  979. });
  980. if (hasDuplicate) {
  981. this.$message({
  982. message: '专业不能重复',
  983. type: "error"
  984. });
  985. return false;
  986. }
  987. if (this.projectProfessionList.length > 0 && p != 100) {
  988. this.$message({
  989. message: '专业占比合计必须是100%',
  990. type: "error"
  991. });
  992. return false;
  993. }
  994. return true;
  995. },
  996. //保存项目专业
  997. saveProjectProfessions(projectId) {
  998. var list = this.projectProfessionList.filter(p=>p.professionId != null);
  999. list.forEach(p=>p.inchargerName = this.participator.filter(m=>m.id == p.inchargerId)[0].name);
  1000. list.forEach(p=>p.professionName = this.professionList.filter(m=>m.id == p.professionId)[0].name);
  1001. this.http.post("/project-profession/modify", {projectId: projectId, json: JSON.stringify(list)},
  1002. res => {
  1003. if (res.code == "ok") {
  1004. return false;
  1005. } else {
  1006. this.$message({
  1007. message: res.msg,
  1008. type: "error"
  1009. });
  1010. }
  1011. },
  1012. error => {
  1013. this.$message({
  1014. message: error,
  1015. type: "error"
  1016. });
  1017. });
  1018. },
  1019. //删除项目专业
  1020. deleteItem(index) {
  1021. this.projectProfessionList.splice(index,1);
  1022. },
  1023. //添加项目专业
  1024. addItem() {
  1025. let p = 0;
  1026. this.projectProfessionList.forEach(m=>{
  1027. p += parseInt(m.percentage);
  1028. });
  1029. this.projectProfessionList.push( { professionId:null, inchargerId:null,membIds:[], percentage: 100-p});
  1030. },
  1031. getProfessionList() {
  1032. this.http.post("/profession/getAll", {},
  1033. res => {
  1034. if (res.code == "ok") {
  1035. var list = res.data;
  1036. this.professionList = list;
  1037. } else {
  1038. this.$message({
  1039. message: res.msg,
  1040. type: "error"
  1041. });
  1042. }
  1043. },
  1044. error => {
  1045. this.$message({
  1046. message: error,
  1047. type: "error"
  1048. });
  1049. });
  1050. },
  1051. restrictNumber(targetId) {
  1052. let inpu = document.getElementById(targetId);
  1053. inpu.value = inpu.value.replace(/[^\d.]/g, ""); //仅保留数字和"."
  1054. inpu.value = inpu.value.replace(/\.{2,}/g, "."); //两个连续的"."仅保留第一个"."
  1055. inpu.value = inpu.value.replace(".", "$#*").replace(/\./g,'').replace('$#*','.');//去除其他"."
  1056. inpu.value = inpu.value.replace(/^(\d+)\.(\d\d).*$/, '$1.$2');;//限制只能输入两个小数
  1057. if (inpu.value.indexOf(".") < 0 && inpu.value != "") { //首位是0的话去掉
  1058. inpu.value = parseFloat(inpu.value);
  1059. }
  1060. },
  1061. showChooseLeaderTree() {
  1062. this.chosenMembCount = this.chosenLeaders.length;
  1063. this.chooseLeaderVisible = true;
  1064. },
  1065. onLeaderTreeItemChange() {
  1066. var chosenList = this.$refs.chooseLeaderTree.getCheckedNodes();
  1067. var list = chosenList.filter(item=>item.isUser == 1);
  1068. this.chosenMembCount = list.length;
  1069. },
  1070. showChooseMembTree() {
  1071. this.chosenMembCount = this.participator.length;
  1072. this.chooseParticipVisible = true;
  1073. },
  1074. onTreeItemChange() {
  1075. var chosenList = this.$refs.chooseMembTree.getCheckedNodes();
  1076. var list = chosenList.filter(item=>item.isUser == 1);
  1077. this.chosenMembCount = list.length;
  1078. },
  1079. findUserInTree() {
  1080. if (this.filterName == '') {
  1081. this.deptMembData = this.allMembData;
  1082. } else {
  1083. var list = this.findRecursively(this.filterName, this.allMembData);
  1084. this.deptMembData = list;
  1085. }
  1086. },
  1087. findRecursively(username, list) {
  1088. var filterList = [];
  1089. for (var i=0;i<list.length; i++) {
  1090. if (list[i].isUser == 1) {
  1091. if (list[i].label.indexOf(username) >= 0) {
  1092. //匹配上了
  1093. filterList.push(list[i]);
  1094. }
  1095. } else if (list[i].children != null && list[i].children.length > 0) {
  1096. var subList = this.findRecursively(username, list[i].children);
  1097. if (subList.length > 0) {
  1098. subList.forEach(s=>filterList.push(s));
  1099. }
  1100. }
  1101. }
  1102. return filterList;
  1103. },
  1104. //确定选择参与人
  1105. chooseParticip() {
  1106. this.chooseParticipVisible = false;
  1107. var chosenList = this.$refs.chooseMembTree.getCheckedNodes();
  1108. this.chosenMembList = chosenList.filter(item=>item.isUser == 1);
  1109. this.addForm.userNames = '';
  1110. this.addForm.userId = [];
  1111. this.participator = [];
  1112. for (var i=0;i<this.chosenMembList.length; i++) {
  1113. this.addForm.userId.push(this.chosenMembList[i].id);
  1114. this.addForm.userNames += this.chosenMembList[i].label+',';
  1115. var item = {id:this.chosenMembList[i].id, name:this.chosenMembList[i].label};
  1116. this.participator.push(item);
  1117. }
  1118. if (this.addForm.userNames.length > 0) {
  1119. this.addForm.userNames = this.addForm.userNames.substring(0, this.addForm.userNames.length-1);
  1120. }
  1121. },
  1122. //选中相关领导
  1123. chooseLeader() {
  1124. this.chooseLeaderVisible = false;
  1125. var chosenList = this.$refs.chooseLeaderTree.getCheckedNodes();
  1126. var chosenMembList = chosenList.filter(item=>item.isUser == 1);
  1127. this.addForm.notifyUserNames = '';
  1128. this.addForm.notifyUserIds = [];
  1129. this.chosenLeaders = [];
  1130. for (var i=0;i<chosenMembList.length; i++) {
  1131. this.addForm.notifyUserIds.push(chosenMembList[i].id);
  1132. this.addForm.notifyUserNames += chosenMembList[i].label+',';
  1133. var item = {userId:chosenMembList[i].id, userName:chosenMembList[i].label};
  1134. this.chosenLeaders.push(item);
  1135. }
  1136. if (this.addForm.notifyUserNames.length > 0) {
  1137. this.addForm.notifyUserNames = this.addForm.notifyUserNames.substring(0, this.addForm.notifyUserNames.length-1);
  1138. }
  1139. },
  1140. // 获取部门列表
  1141. getDepartment() {
  1142. this.http.post("/department/listAllMemb", {},
  1143. res => {
  1144. if (res.code == "ok") {
  1145. var list = res.data;
  1146. //设置员工到部门下面
  1147. this.setUserToDept(list);
  1148. this.deptMembData = list;
  1149. //用于筛选过滤
  1150. this.allMembData = JSON.parse(JSON.stringify(this.deptMembData));
  1151. } else {
  1152. this.$message({
  1153. message: res.msg,
  1154. type: "error"
  1155. });
  1156. }
  1157. },
  1158. error => {
  1159. this.$message({
  1160. message: error,
  1161. type: "error"
  1162. });
  1163. });
  1164. },
  1165. setUserToDept(list) {
  1166. for (var i in list) {
  1167. if (list[i].children != null) {
  1168. this.setUserToDept(list[i].children);
  1169. }
  1170. if (list[i].userList != null) {
  1171. if (list[i].children == null) {
  1172. list[i].children = [];
  1173. }
  1174. list[i].userList.forEach(element => {
  1175. var obj = {id: element.id, label:element.name, parentId:element.departmentId, isUser:1};
  1176. list[i].children.push(obj);
  1177. });
  1178. }
  1179. }
  1180. },
  1181. // 获取分类条目
  1182. getClfConfigList() {
  1183. this.http.get('/project-category/list',
  1184. res => {
  1185. if (res.code == "ok") {
  1186. this.baseClfList = res.data;
  1187. console.log("获取分类条目",res.data);
  1188. this.$forceUpdate();
  1189. } else {
  1190. this.$message({
  1191. message: res.msg,
  1192. type: "error"
  1193. });
  1194. }
  1195. },
  1196. error => {
  1197. this.$message({
  1198. message: error,
  1199. type: "error"
  1200. });
  1201. }
  1202. );
  1203. },
  1204. // 新增/编辑 分类条目
  1205. addNewClf(row) {
  1206. this.addClfDialog = true;
  1207. if (row == null) {
  1208. this.addClf = {}
  1209. } else {
  1210. this.addClf = row;
  1211. }
  1212. },
  1213. // 提交
  1214. submitClf() {
  1215. this.http.post('/project-category/addOrMod',this.addClf,
  1216. res => {
  1217. if (res.code == "ok") {
  1218. this.addClfDialog = false;
  1219. this.baseClfList = res.data;
  1220. // this.$forceUpdate();
  1221. console.log(res.data);
  1222. } else {
  1223. this.$message({
  1224. message: res.msg,
  1225. type: "error"
  1226. });
  1227. }
  1228. },
  1229. error => {
  1230. this.$message({
  1231. message: error,
  1232. type: "error"
  1233. });
  1234. }
  1235. );
  1236. },
  1237. // 删除
  1238. deleteClf(row) {
  1239. this.$confirm("该操作可能造成已有数据丢失,确定要删除吗?","删除分类条目", {
  1240. confirmButtonText: "确定",
  1241. cancelButtonText: "取消",
  1242. type: "warning"
  1243. })
  1244. .then(() => {
  1245. this.listLoading = true;
  1246. this.http.post('/project-category/delete',{
  1247. id: row.id
  1248. },
  1249. res => {
  1250. this.listLoading = false;
  1251. if (res.code == "ok") {
  1252. this.$message({
  1253. message: "删除成功",
  1254. type: "success"
  1255. });
  1256. this.getClfConfigList();
  1257. } else {
  1258. this.$message({
  1259. message: res.msg,
  1260. type: "error"
  1261. });
  1262. }
  1263. },
  1264. error => {
  1265. this.listLoading = false;
  1266. this.$message({
  1267. message: error,
  1268. type: "error"
  1269. });
  1270. }
  1271. );
  1272. })
  1273. .catch(() => {});
  1274. },
  1275. // 分类筛选
  1276. searchClfList(){
  1277. this.page = 1;
  1278. this.getList();
  1279. },
  1280. getProjectBaseConfigList() {
  1281. this.http.post('/project-basecost-setting/list',{},
  1282. res => {
  1283. if (res.code == "ok") {
  1284. this.baseCostItemList = res.data;
  1285. this.$forceUpdate();
  1286. } else {
  1287. this.$message({
  1288. message: res.msg,
  1289. type: "error"
  1290. });
  1291. }
  1292. },
  1293. error => {
  1294. this.$message({
  1295. message: error,
  1296. type: "error"
  1297. });
  1298. }
  1299. );
  1300. },
  1301. deleteBaseItem(row) {
  1302. this.$confirm("该操作可能造成已有数据丢失,确定要删除吗?","删除成本基线项", {
  1303. confirmButtonText: "确定",
  1304. cancelButtonText: "取消",
  1305. type: "warning"
  1306. })
  1307. .then(() => {
  1308. this.listLoading = true;
  1309. this.http.post('/project-basecost-setting/delete',{
  1310. id: row.id
  1311. },
  1312. res => {
  1313. this.listLoading = false;
  1314. if (res.code == "ok") {
  1315. this.$message({
  1316. message: "删除成功",
  1317. type: "success"
  1318. });
  1319. this.getProjectBaseConfigList();
  1320. } else {
  1321. this.$message({
  1322. message: res.msg,
  1323. type: "error"
  1324. });
  1325. }
  1326. },
  1327. error => {
  1328. this.listLoading = false;
  1329. this.$message({
  1330. message: error,
  1331. type: "error"
  1332. });
  1333. }
  1334. );
  1335. })
  1336. .catch(() => {});
  1337. },
  1338. submitInsertBaseItem() {
  1339. this.http.post('/project-basecost-setting/addOrMod',this.addForm,
  1340. res => {
  1341. if (res.code == "ok") {
  1342. this.addBaseItemDialog = false;
  1343. this.baseCostItemList = res.data;
  1344. this.$forceUpdate();
  1345. } else {
  1346. this.$message({
  1347. message: res.msg,
  1348. type: "error"
  1349. });
  1350. }
  1351. },
  1352. error => {
  1353. this.$message({
  1354. message: error,
  1355. type: "error"
  1356. });
  1357. }
  1358. );
  1359. },
  1360. showBaseCostItemDialog() {
  1361. this.showBaseConfig = true;
  1362. },
  1363. addNewBaseItem(row) {
  1364. this.addBaseItemDialog = true;
  1365. if (row == null) {
  1366. this.addForm = {}
  1367. } else {
  1368. this.addForm = row;
  1369. }
  1370. },
  1371. //获取客户列表
  1372. getCustomerList() {
  1373. this.http.post('/customer-info/getAll', {
  1374. },
  1375. res => {
  1376. if (res.code == "ok") {
  1377. this.customerList = res.data;
  1378. } else {
  1379. this.$message({
  1380. message: res.msg,
  1381. type: "error"
  1382. });
  1383. }
  1384. },
  1385. error => {
  1386. this.$message({
  1387. message: error,
  1388. type: "error"
  1389. });
  1390. });
  1391. },
  1392. importProject(item) {
  1393. //首先判断文件类型
  1394. let str = item.file.name.split(".");
  1395. let format = str[str.length - 1];
  1396. if (format != "xls" && format != "xlsx") {
  1397. this.$message({
  1398. message: "请选择.xls或.xlsx文件",
  1399. type: "error"
  1400. });
  1401. } else {
  1402. this.listLoading = true;
  1403. let formData = new FormData();
  1404. formData.append("file", item.file);
  1405. formData.append("userId", this.user.id);
  1406. this.http.uploadFile('/project/importData', formData,
  1407. res => {
  1408. this.$refs.upload.clearFiles();
  1409. this.listLoading = false;
  1410. if (res.code == "ok") {
  1411. this.$message({
  1412. message: "导入成功",
  1413. type: "success"
  1414. });
  1415. this.getList();
  1416. } else {
  1417. this.$message({
  1418. message: res.msg,
  1419. type: "error"
  1420. });
  1421. }
  1422. },
  1423. error => {
  1424. this.$refs.upload.clearFiles();
  1425. this.listLoading = false;
  1426. this.$message({
  1427. message: error,
  1428. type: "error"
  1429. });
  1430. });
  1431. }
  1432. },
  1433. number(){
  1434. //     this.addForm.budget = this.addForm.budget.replace(/[^\.\d]/g,'');
  1435. // this.addForm.budget = this.addForm.budget.replace('.','');
  1436. },
  1437. deleteSubPro(subProject) {
  1438. this.$confirm("确定要删除子项目" + subProject.name + "吗?","删除子项目", {
  1439. confirmButtonText: "确定",
  1440. cancelButtonText: "取消",
  1441. type: "warning"
  1442. })
  1443. .then(() => {
  1444. this.listLoading = true;
  1445. this.http.post('/sub-project/deleteProject',{
  1446. id: subProject.id
  1447. },
  1448. res => {
  1449. this.listLoading = false;
  1450. if (res.code == "ok") {
  1451. this.$message({
  1452. message: "删除成功",
  1453. type: "success"
  1454. });
  1455. this.subProject(this.currentProject);
  1456. } else {
  1457. this.$message({
  1458. message: res.msg,
  1459. type: "error"
  1460. });
  1461. }
  1462. },
  1463. error => {
  1464. this.listLoading = false;
  1465. this.$message({
  1466. message: error,
  1467. type: "error"
  1468. });
  1469. }
  1470. );
  1471. })
  1472. .catch(() => {});
  1473. },
  1474. searchList() {
  1475. this.page = 1;
  1476. this.getList();
  1477. },
  1478. addNewSubProject(subProject) {
  1479. if (subProject == null) {
  1480. this.temaddForm = {projectId: this.currentProject.id, level:1}
  1481. } else {
  1482. this.temaddForm = JSON.parse(JSON.stringify(subProject));
  1483. }
  1484. this.addSubProject = true;
  1485. },
  1486. //显示子项目
  1487. subProject(item) {
  1488. this.subProjectVisible = true;
  1489. this.currentProject = item;
  1490. this.http.post('/sub-project/list', {
  1491. projectId: item.id
  1492. },
  1493. res => {
  1494. if (res.code == "ok") {
  1495. this.subProjectList = res.data;
  1496. } else {
  1497. this.$message({
  1498. message: res.msg,
  1499. type: "error"
  1500. });
  1501. }
  1502. },
  1503. error => {
  1504. this.$message({
  1505. message: error,
  1506. type: "error"
  1507. });
  1508. });
  1509. },
  1510. //显示用户详情
  1511. showUser(userId) {
  1512. this.userDetailVisible = true;
  1513. this.http.post(this.port.manage.userDetail, {
  1514. userId: userId
  1515. },
  1516. res => {
  1517. if (res.code == "ok") {
  1518. this.userDetail = res.data;
  1519. } else {
  1520. this.$message({
  1521. message: res.msg,
  1522. type: "error"
  1523. });
  1524. }
  1525. },
  1526. error => {
  1527. this.$message({
  1528. message: error,
  1529. type: "error"
  1530. });
  1531. });
  1532. },
  1533. //选择参与人
  1534. changeParticipator() {
  1535. //检查是否在参与人中,如果没有需要加入到参与人中
  1536. this.participator = [];
  1537. this.addForm.userId.forEach(u=>{
  1538. var list = this.users.filter(au=>au.id == u);
  1539. if (list.length > 0) {
  1540. var findUser = list[0];
  1541. this.participator.push(findUser);
  1542. } else {
  1543. console.log('未找到用户: '+u);
  1544. }
  1545. })
  1546. },
  1547. getUsers() {
  1548. this.http.post(this.port.manage.list, {
  1549. departmentId: -1,
  1550. pageIndex: 1,
  1551. pageSize: 99999
  1552. },
  1553. res => {
  1554. if (res.code == "ok") {
  1555. this.users = res.data.records;
  1556. } else {
  1557. this.$message({
  1558. message: res.msg,
  1559. type: "error"
  1560. });
  1561. }
  1562. },
  1563. error => {
  1564. this.$message({
  1565. message: error,
  1566. type: "error"
  1567. });
  1568. });
  1569. },
  1570. //分页
  1571. handleCurrentChange(val) {
  1572. this.page = val;
  1573. this.getList();
  1574. },
  1575. handleSizeChange(val) {
  1576. this.size = val;
  1577. this.getList();
  1578. },
  1579. //获取项目列表
  1580. getList() {
  1581. this.listLoading = true;
  1582. this.http.post(this.port.project.listPage, {
  1583. pageIndex: this.page,
  1584. pageSize: this.size,
  1585. keyword:this.keyword,
  1586. searchField: this.searchField,
  1587. status: this.status,
  1588. category: this.statusClf
  1589. //
  1590. },
  1591. res => {
  1592. this.listLoading = false;
  1593. if (res.code == "ok") {
  1594. var list = res.data.records;
  1595. for(var i in list) {
  1596. var participator = list[i].participator , str = "";
  1597. for(var j in participator) {
  1598. if(j == participator.length-1) {
  1599. str += participator[j].name
  1600. } else {
  1601. str += participator[j].name + ','
  1602. }
  1603. }
  1604. list[i].userNames = str;
  1605. }
  1606. this.list = list;
  1607. this.total = res.data.total;
  1608. console.log("列表",res.data);
  1609. } else {
  1610. this.$message({
  1611. message: res.msg,
  1612. type: "error"
  1613. });
  1614. }
  1615. },
  1616. error => {
  1617. this.listLoading = false;
  1618. this.$message({
  1619. message: error,
  1620. type: "error"
  1621. });
  1622. });
  1623. },
  1624. //显示新增界面
  1625. handleAdd(i, item) {
  1626. if(i == -1) {
  1627. this.title = "新增项目";
  1628. this.addForm = {
  1629. name: '',
  1630. isPublic:0,
  1631. userId: [],
  1632. userNames:'',
  1633. code:'',
  1634. inchargerId:null,
  1635. level:1,
  1636. customerId:null,
  1637. notifyUserNames:'',
  1638. chosenLeaders:[],
  1639. taskGpIncharge: 0,
  1640. category:null
  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>