list.vue 105 KB

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