list.vue 99 KB

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