list.vue 90 KB

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