list.vue 97 KB

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