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