list.vue 99 KB

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