list.vue 77 KB

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