projectApproval.vue 67 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367
  1. <template>
  2. <section>
  3. <!--工具条 top-->
  4. <el-col :span="24" class="toolbar" style="padding-bottom: 0px;">
  5. <el-form :inline="true">
  6. <el-form-item >
  7. <!-- <div style="display: flex;align-items: center;height: 40px;"> -->
  8. <div v-if="true" style="display: flex;align-items: center;height: 40px;">
  9. <el-input v-model="keyword" class="input-with-select" :placeholder="searchField == '1' ? $t('peaseenterthe') : $t('peaseenterthe')" clearable="true" size="small">
  10. <el-select v-model="searchField" style="width:120px;" slot="prepend" :placeholder="$t('defaultText.pleaseChoose')">
  11. <el-option :label="$t('headerTop.projectName')" value=1 ></el-option>
  12. <el-option :label="$t('Itemno')" value=2 ></el-option>
  13. </el-select>
  14. <el-button slot="append" @click="searchList" icon="el-icon-search"></el-button>
  15. </el-input>
  16. </div>
  17. </el-form-item>
  18. <!-- 分类筛选 -->
  19. <el-form-item >
  20. <span style="margin-left:5px;margin-right:5px;color:#606266;">{{ $t('fen-lei') }}</span>
  21. <el-select v-model="statusClf" style="width:140px;" :placeholder="$t('defaultText.pleaseChoose')" clearable @change="searchClfList" size="small">
  22. <el-option v-for="item in baseClfList" :key="item.id" :label="item.name" :value="item.id" ></el-option>
  23. </el-select>
  24. </el-form-item>
  25. <el-form-item style="float:right;">
  26. <el-link type="primary" :underline="false" @click="handleAdd(-1,null)">{{'新增'}}</el-link>
  27. <el-link type="primary" v-if="permissions.projectApprovalEdit||permissions.projectApprocalImport" style="margin-right:10px;" :underline="false" @click="importDialog=true">{{'导入'}}</el-link>
  28. <el-link type="primary" v-if="permissions.projectApprovalEdit||permissions.projectApprocalExport" style="margin-right:10px;" :underline="false" @click="exportData()">{{'导出'}}</el-link>
  29. </el-form-item>
  30. </el-form>
  31. </el-col>
  32. <div style="display: flex;width: 100%;">
  33. <div class="classification">
  34. <div>
  35. <p :class="idx == 0 ? 'on' : ''" @click="switchs(0)" v-if="permissions.projectApprovalEdit">{{'全部项目'}}</p>
  36. <p :class="idx == 1 ? 'on' : ''" @click="switchs(1)">{{'我发起的'}}</p>
  37. <!-- <p :class="idx == 2 ? 'on' : ''" @click="switchs(2)">{{'我审核的'}}</p> -->
  38. </div>
  39. </div>
  40. <div style="max-width: 94%;min-width: 90%">
  41. <el-table ref="projectlistOfWudulist" border @cell-mouse-enter="hoverCall" @cell-mouse-leave="handCall" :cell-class-name="tableCellClassName" :data="list" highlight-current-row v-loading="listLoading" :height="tableHeight" style="width: 100%;" @selection-change="checkedWudulist">
  42. <el-table-column type="selection" width="60" :selectable="isSelectable">
  43. </el-table-column>
  44. <el-table-column prop="projectCode" :label="$t('Itemno')" width="150"></el-table-column>
  45. <el-table-column prop="projectName" :label="$t('headerTop.projectName')" min-width="250" sortable="custom">
  46. <template slot-scope="scope">
  47. <div>
  48. <el-button type="text" v-if="scope.row.isPublic==0" @click="showProjectApprovalDeatil(scope.row)">{{scope.row.projectName}}</el-button>
  49. <span v-else>{{scope.row.projectName}}</span>
  50. </div>
  51. </template>
  52. </el-table-column>
  53. <el-table-column prop="categoryName" :label="$t('projectclassification')" width="140"></el-table-column>
  54. <el-table-column prop="isPublic" :label="'项目类型'" width="140">
  55. <template slot-scope="scope">{{scope.row.isPublic==0?"正式项目":"非项目"}}</template>
  56. </el-table-column>
  57. <el-table-column prop="inchargerName" :label="$t('projectmanager')" min-width="150">
  58. <template slot-scope="scope">
  59. <el-link type="primary" :underline="false" @click="showUser(scope.row.inchargerId)">
  60. <span v-if="user.userNameNeedTranslate != 1">
  61. {{scope.row.inchargerName}}
  62. </span>
  63. <span v-if="user.userNameNeedTranslate == 1">
  64. <ww-open-data type='userName' :openid='scope.row.inchargerName'></ww-open-data>
  65. </span>
  66. </el-link>
  67. </template>
  68. </el-table-column>
  69. <!-- 级别 -->
  70. <el-table-column :prop="user.timeType.projectLevelState == 1 ? 'levelName' : 'level'" :label="$t('ji-bie')" min-width="190" v-if="user.company.packageProject == 1">
  71. <template slot-scope="scope">
  72. <span v-if="user.timeType.projectLevelState == 1">{{scope.row.levelName}}</span>
  73. <span v-else>{{importanceListLable[scope.row.level - 1]}}</span>
  74. </template>
  75. </el-table-column>
  76. <el-table-column prop="status" :label="'审核状态'" min-width="100" >
  77. <template slot-scope="scope">
  78. {{scope.row.status == null?"-":approvalStatusStr[scope.row.status-1]}}
  79. </template>
  80. </el-table-column>
  81. <el-table-column :label="$t('operation')" :width="300" align="left" fixed="right">
  82. <template slot-scope="scope">
  83. <el-button size="mini" type="primary" v-if="(permissions.projectApprovalEdit||permissions.projectApprovalCheck)&&scope.row.status!=1" @click="handleAdd(scope.$index, scope.row)">{{'编辑'}}</el-button>
  84. <!-- <el-button size="mini" v-if="(permissions.projectApprovalEdit||permissions.projectApprovalCheck) && scope.row.status==0" @click="check(scope.row,1)">{{'通过'}}</el-button>
  85. <el-button size="mini" v-if="(permissions.projectApprovalEdit||permissions.projectApprovalCheck) && scope.row.status==0" @click="check(scope.row,2)">{{'驳回'}}</el-button> -->
  86. <el-button size="mini" v-if="(permissions.projectApprovalEdit ||permissions.projectApprovalCheck) && scope.row.status==1" @click="check(scope.row,3)">{{'撤销'}}</el-button>
  87. </template>
  88. </el-table-column>
  89. </el-table>
  90. <!--工具条 footer-->
  91. <el-col :span="24" class="toolbar">
  92. <el-pagination :key="projectListPageComponentKey"
  93. @size-change="handleSizeChange"
  94. @current-change="handleCurrentChange"
  95. :page-sizes="[20 , 50 , 80 , 100]"
  96. :page-size="size"
  97. :current-page.sync="page"
  98. layout="total, sizes, prev, pager, next"
  99. :total="total"
  100. style="float:right;"
  101. ></el-pagination>
  102. </el-col>
  103. <!--新增界面-->
  104. <el-dialog :title="title" v-if="addFormVisible" :visible.sync="addFormVisible" :close-on-click-modal="false" customClass="customWidth" width="960px" :top="'6vh'">
  105. <div style="height: 72vh;overflow-y: auto;overflow-x: hidden;">
  106. <el-form ref="form1" :model="addForm" :rules="rules" label-width="120px">
  107. <el-form-item :label="$t('Itemno')" :class="title == $t('newproject')" v-if="user.companyId!=936">
  108. <!-- <el-input v-model="addForm.code" :disabled="!permissions.projectManagement && addForm.creatorId != user.id" placeholder="请输入项目编号" clearable></el-input> -->
  109. <el-input v-model="addForm.code" :placeholder="$t('peaseenterthe')" clearable :disabled="canOnlyModParticipator || (!permissions.projectManagement && addForm.creatorId != user.id && !permissions.projectCodeAndName)" maxlength="50" show-word-limit="true"></el-input>
  110. </el-form-item>
  111. <el-form-item :label="$t('headerTop.projectName')" prop="name">
  112. <!-- <el-input v-model="addForm.name" :disabled="!permissions.projectManagement && addForm.creatorId != user.id" placeholder="请输入项目名称" clearable></el-input> -->
  113. <el-input v-model="addForm.name" :placeholder="$t('peaseenterthe')" clearable :disabled="canOnlyModParticipator || (!permissions.projectManagement && addForm.creatorId != user.id && !permissions.projectCodeAndName) || isShowProjectName" maxlength="255" show-word-limit="true"></el-input>
  114. </el-form-item>
  115. <el-form-item :label="$t('projectclassification')" v-if="user.timeType.mainProjectState != '1'">
  116. <!-- <el-select v-model="addForm.category" style="width:32%;" clearable :disabled="!permissions.projectManagement && addForm.creatorId != user.id"> -->
  117. <el-select v-model="addForm.category" style="width:32%;" clearable filterable :disabled="canOnlyModParticipator">
  118. <el-option v-for="(item) in baseClfList" :key="item.id" :value="item.id" :label="item.name"></el-option>
  119. </el-select>
  120. </el-form-item>
  121. <el-form-item :label="$t('projecttype')" :class="title == $t('newproject') && user.companyId == 936 ? 'wpgCssClass' : ''" prop="isPublic">
  122. <el-select v-model="addForm.isPublic" style="width:32%;" @change="selectPublic" :disabled="canOnlyModParticipator">
  123. <el-option :value="0" :label="$t('zheng-shi-xiang-mu')"></el-option>
  124. <el-option :value="1" :label="$t('fei-xiang-mu')"></el-option>
  125. </el-select>
  126. </el-form-item>
  127. <el-form-item :label="$t('other.projectDescription')" prop="projectDesc">
  128. <!-- <el-input v-model="addForm.projectDesc" :disabled="!permissions.projectManagement && addForm.creatorId != user.id" placeholder="请输入项目描述" clearable maxlength="4000"></el-input> -->
  129. <el-input v-model="addForm.projectDesc" :placeholder="$t('peaseenterthe')" clearable maxlength="4000" :disabled="canOnlyModParticipator" show-word-limit></el-input>
  130. </el-form-item>
  131. <el-form-item :label="$t('Allparticipants')" v-show="addForm.isPublic == 0" :class="title == $t('newproject') && user.companyId == 936 ? 'wpgCssClass' : ''">
  132. <el-tooltip placement="top" effect="light" v-if="user.userNameNeedTranslate != 1">
  133. <div slot="content" style="width:780px">{{addForm.userNames}}</div>
  134. <el-input @focus="showChooseMembTree" v-model="addForm.userNames"></el-input>
  135. </el-tooltip>
  136. <el-tooltip placement="top" effect="light" v-if="user.userNameNeedTranslate == 1">
  137. <div slot="content" style="width:780px">
  138. <span v-for="(item, index) in addFormUserNames" :key="index">
  139. <!-- {{item}} -->
  140. <ww-open-data type='userName' :openid='item'></ww-open-data>
  141. <span v-if="index < addFormUserNames.length - 1">,</span>
  142. </span>
  143. </div>
  144. <div @click="showChooseMembTree" style="width: 800px;overflow:hidden;white-space:nowrap;height:40px;border: 1px solid #DCDFE6;border-radius: 4px;box-sizing: border-box;padding: 0 10px">
  145. <span v-for="(item, index) in addFormUserNames" :key="index">
  146. <!-- {{item}} -->
  147. <ww-open-data type='userName' :openid='item'></ww-open-data>
  148. <span v-if="index < addFormUserNames.length - 1">,</span>
  149. </span>
  150. </div>
  151. </el-tooltip>
  152. </el-form-item>
  153. <el-form-item :label="$t('projectmanager')" :class="title == $t('newproject') && user.companyId == 936 ? 'wpgCssClass' : ''" v-if="user.company.nonProjectSimple == 0 || (user.company.nonProjectSimple == 1 && addForm.isPublic == 0)">
  154. <el-select v-if="user.userNameNeedTranslate != 1" v-model="addForm.inchargerId" filterable :placeholder="$t('defaultText.pleaseChoose')" style="width:32%;" :disabled="canOnlyModParticipator || projectManagerEdit">
  155. <el-option v-for="item in participator" :key="item.id" :label="item.name" :value="item.id">
  156. <span style="float: left">{{ item.name }}</span>
  157. </el-option>
  158. </el-select>
  159. <selectCat v-if="user.userNameNeedTranslate == 1" :size="'medium'" :subject="participator" :subjectId="addForm.inchargerId" :distinction="'3'" @selectCal="selectCal" :disabled="canOnlyModParticipator || projectManagerEdit || isShowProjectName"></selectCat>
  160. </el-form-item>
  161. <el-form-item :label="$t('newspaperauditor')">
  162. <el-select v-if="user.userNameNeedTranslate != '1'" @change="$forceUpdate()" v-model="addForm.auditUserIds" :disabled="!(permissions.projectManagement|| user.id == addForm.inchargerId || user.id == addForm.creatorId)" filterable :placeholder="$t('defaultistheprojectleader')" style="width:100%;" :multiple="user.timeType.reportAuditType != 6" >
  163. <el-option v-for="item in participator" :key="item.id" :label="item.name" :value="item.id"></el-option>
  164. </el-select>
  165. <selectCat v-if="user.userNameNeedTranslate == '1'" :size="'medium'" :tile="true" :widthStr="'800'" :disabled="!(permissions.projectManagement|| user.id == addForm.inchargerId || user.id == addForm.creatorId)" :subjectId="addForm.auditUserIds" :subject="participator" :clearable="false" :distinction="'10'" :multiSelect="user.timeType.reportAuditType != 6" @selectCal="selectCal"></selectCat>
  166. </el-form-item>
  167. <!--专业项目协作版本功能 -->
  168. <el-form-item :label="$t('ji-bie')" :class="title == $t('newproject') && user.companyId == 936 ? 'wpgCssClass' : ''" v-if="user.company.packageProject==1 && (user.company.nonProjectSimple == 0 || (user.company.nonProjectSimple == 1 && addForm.isPublic == 0))">
  169. <el-select v-model="addForm.level" :placeholder="$t('defaultText.pleaseChoose')" style="width:32%;" v-if="user.timeType.projectLevelState == 1" :disabled="canOnlyModParticipator || isShowProjectName">
  170. <el-option v-for="item in levelList" :key="item.id" :label="item.projectLevelName" :value="item.id"></el-option>
  171. </el-select>
  172. <el-select v-model="addForm.level" :placeholder="this.$t('defaultText.pleaseChoose')" style="width:32%;" :disabled="canOnlyModParticipator" v-else>
  173. <el-option v-for="item in importanceList" :key="item.id" :label="item.label" :value="item.id"></el-option>
  174. </el-select>
  175. </el-form-item>
  176. <!-- 增加合同金额字段 -->
  177. <el-form-item :label="$t('contractamount')" v-if="user.company.packageProject==1 && (user.company.nonProjectSimple == 0 || (user.company.nonProjectSimple == 1 && addForm.isPublic == 0))">
  178. <el-input id="contractAmount" v-model="addForm.contractAmount" :disabled="canOnlyModParticipator" style="width:32%;" @input="contractAmountChange(addForm.contractAmount)" :placeholder="$t('zheng-shu')" clearable @keyup.native="restrictNumber('contractAmount')"></el-input><span style="margin-left:10px;position:absolute;">{{ $t('yuan') }}</span>
  179. <template v-if="title == $t('modifytheproject') && contractAmountReasonShow">
  180. <span style="margin-left:63px;margin-right:10px;">{{ $t('modifythereason') }}</span>
  181. <el-input v-model="addForm.changeContractReason" style="width:33%" clearable :placeholder="$t('contractamountasd')"></el-input>
  182. </template>
  183. </el-form-item>
  184. <el-form-item :label="$t('ommencementDate')" prop="planStartDate" v-if="(user.company.nonProjectSimple == 0 || (user.company.nonProjectSimple == 1 && addForm.isPublic == 0))">
  185. <el-date-picker v-model="addForm.planStartDate" :disabled="canOnlyModParticipator"
  186. :editable="false" style="width:32%;"
  187. format="yyyy-MM-dd"
  188. value-format="yyyy-MM-dd"
  189. :clearable="false" type="date"
  190. :placeholder="$t('optiondate')"></el-date-picker>
  191. <span style="margin-left:63px;margin-right:10px;" >{{ $t('ji-hua-jie-shu-ri-qi') }}</span>
  192. <el-date-picker v-model="addForm.planEndDate" style="width:33%;"
  193. :editable="false" :disabled="canOnlyModParticipator"
  194. format="yyyy-MM-dd"
  195. value-format="yyyy-MM-dd"
  196. :clearable="false" type="date"
  197. :placeholder="$t('optiondate')"></el-date-picker>
  198. </el-form-item>
  199. <!-- 项目基线 -->
  200. <div style="margin: 10px 0 30px 0;min-height:200px;" v-if="user.company.packageProject == 1 && !canOnlyModParticipator && (user.company.nonProjectSimple == 0 || (user.company.nonProjectSimple == 1 && addForm.isPublic == 0))">
  201. <el-tabs v-model="activeName" @tab-click="handleClick">
  202. <el-tab-pane :label="$t('costbaseline')" name="baseCostPanel" >
  203. <div style="padding-top:10px;">
  204. <!--新版 -->
  205. <span class="rg_span" v-for="(item, index) in projectBaseCostData" :key="item.id">
  206. <span style="width:120px;display: inline-block;" v-if="user.company.packageProject==1">{{item.baseName}}</span>
  207. <el-input :id="'baseCost'+index" @input="addUpfun()" v-model="item.baseAmount" style="width:200px; margin-bottom: 20px"
  208. :placeholder="$t('zheng-shu')" clearable @keyup.native="restrictNumber('baseCost'+index)"></el-input><span style="margin-left:10px;">{{ $t('yuan') }}</span>
  209. </span>
  210. <!-- 合计 -->
  211. <div style="margin-top: 10px;float:right;">
  212. <span style="margin-right:50px;margin-right:10px;" v-if="user.company.packageProject==1">{{ $t('other.totals') }}</span>
  213. <span v-if="addForm.budget <= 0 || addForm.budget == undefined">0</span>
  214. <span v-else>{{addForm.budget | numberToCurrency}}</span>
  215. <span style="margin-right:50px;margin-left:10px;">{{ $t('yuan') }}</span>
  216. </div>
  217. </div>
  218. </el-tab-pane>
  219. </el-tabs>
  220. </div>
  221. <el-divider></el-divider>
  222. <!-- <template>
  223. <div><span>{{'审核人'}}</span></div>
  224. <div>
  225. <div v-for="(item, index) in pointList" :key="index" >
  226. 第{{index+1}}审核人:
  227. <el-select v-if="user.userNameNeedTranslate != 1" :disabled="item.status!=0" v-model="item.userId" style="width:140px;" :placeholder="$t('defaultText.pleaseChoose')" clearable @change="manageSelect" size="small" filterable popper-class="managePopperClass">
  228. <el-option v-for="item in participator" :key="item.id" :label="item.name" :value="item.id">
  229. <span style="float: left">{{ item.name }}</span>
  230. </el-option>
  231. </el-select>
  232. <selectCat v-if="user.userNameNeedTranslate == 1" :size="'medium'" :subject="participator" :subjectId="item.userId" :distinction="'12'" @selectCal="selectCal" :disabled="canOnlyModParticipator || projectManagerEdit || isShowProjectName"></selectCat>
  233. <i class="el-icon-circle-plus-outline" @click="addInput(index)" v-if="index==pointList.length-1"></i>
  234. <i class="el-icon-remove-outline" v-if="pointList.length>1 && item.status==0" @click="deleteInput(index)"></i>
  235. <span>{{item.status==0?'待审核':item.status==1?"已审核":"已驳回"}}</span>
  236. </div>
  237. </div>
  238. </template> -->
  239. </el-form>
  240. </div>
  241. <div slot="footer" class="dialog-footer;">
  242. <el-button @click.native="deletePro(1, addForm)" v-if="(permissions.projectApprovalEdit) && addForm.id" style="float:left">{{ $t('btn.delete') }}</el-button>
  243. <el-button @click.native="addFormVisible = false">{{ $t('btn.cancel') }}</el-button>
  244. <el-button type="primary" @click="submitInsert" :loading="addLoading">{{ $t('btn.submit') }}</el-button>
  245. </div>
  246. </el-dialog>
  247. <!-- 按部门选择人员 -->
  248. <el-dialog :title="$t('selectingParticipants')" :visible.sync="chooseParticipVisible" :close-on-click-modal="false" customClass="customWidth" width="500px">
  249. <!-- <el-input style="width:100%" v-model="filterName" placeholder="请输入姓名搜索" @change="findUserInTree"></el-input> -->
  250. <div v-if="user.userNameNeedTranslate == '1'">
  251. <el-input placeholder="请输入内容" v-model.trim="filterText" class="input-with-select">
  252. <el-button slot="append" icon="el-icon-search" @click="echartDepartment()"></el-button>
  253. </el-input>
  254. </div>
  255. <div class="tree" style="height:400px">
  256. <el-scrollbar style="height:100%">
  257. <el-input
  258. :placeholder="$t('keywordfiltering')"
  259. v-model="filterText" v-if="user.userNameNeedTranslate != '1'">
  260. </el-input>
  261. <el-tree :data="deptMembData" :key="searchPersonnelFlgnum" show-checkbox :default-expand-all="searchPersonnelFlg" :props="defaultProps" node-key="id"
  262. ref="chooseMembTree" @check-change="onTreeItemChange" :default-checked-keys="addForm.userId"
  263. highlight-current :filter-node-method="filterNode">
  264. <span class="custom-tree-node" slot-scope="{ node, data }">
  265. <span v-if="user.userNameNeedTranslate == '1'">
  266. <span v-if="node.data.children">
  267. <ww-open-data type='departmentName' :openid='node.label'></ww-open-data>
  268. </span>
  269. <span v-else>
  270. <ww-open-data type='userName' :openid='node.label'></ww-open-data>
  271. </span>
  272. </span>
  273. <span v-if="user.userNameNeedTranslate != '1'">
  274. {{ node.label }}
  275. </span>
  276. <!-- {{ node.label }} -->
  277. </span>
  278. </el-tree>
  279. </el-scrollbar>
  280. </div>
  281. <div>{{ $t('btn.choose') }}&nbsp;{{chosenMembCount}}&nbsp;{{ $t('other.people') }}</div>
  282. <div slot="footer" class="dialog-footer">
  283. <el-button @click="chooseParticipVisible = false" >{{ $t('btn.cancel') }}</el-button>
  284. <el-button type="primary" @click="chooseParticip()" >{{ $t('btn.determine') }}</el-button>
  285. </div>
  286. </el-dialog>
  287. <!--用户详细信息弹出框-->
  288. <el-dialog :title="$t('Checkthedetails')" v-if="userDetailVisible" :visible.sync="userDetailVisible" :close-on-click-modal="false" customClass="customWidth" width="400px">
  289. <div class="line"><span>{{ $t('lable.name') +":"}}</span>
  290. <span v-if="user.userNameNeedTranslate != 1">{{userDetail.name}}</span>
  291. <span v-if="user.userNameNeedTranslate == 1"><ww-open-data type='userName' :openid='userDetail.name'></ww-open-data></span>
  292. </div>
  293. <div class="line"><span>{{ $t('Worknumber') +":"}}</span><span>{{userDetail.jobNumber}}</span></div>
  294. <div class="line"><span>{{ $t('lable.phone') +":"}}</span><span>{{userDetail.phone}}</span></div>
  295. <div class="line"><span>{{ $t('jiao-se') +":"}}</span><span>{{userDetail.roleName}}</span></div>
  296. <div class="line"><span>{{ $t('lable.department') +":"}}</span>
  297. <span v-if="user.userNameNeedTranslate != 1">{{userDetail.departmentName}}</span>
  298. <span v-if="user.userNameNeedTranslate == 1"><ww-open-data type='departmentName' :openid='userDetail.departmentName'></ww-open-data></span>
  299. </div>
  300. <div slot="footer" class="dialog-footer">
  301. <el-button type="primary" @click="userDetailVisible = false" >{{ $t('btn.determine') }}</el-button>
  302. </div>
  303. </el-dialog>
  304. <!--查看立项-->
  305. <el-dialog :title="$t('Checkthedetails')" v-if="projectApprovalDetailVisible" :visible.sync="projectApprovalDetailVisible" :close-on-click-modal="false" customClass="customWidth" width="400px">
  306. <div class="line"><span>{{'项目编号:'}}</span><span>{{projectApprocalDetail.projectCode}}</span></div>
  307. <div class="line"><span>{{'项目名称:'}}</span><span>{{projectApprocalDetail.projectName}}</span></div>
  308. <div class="line"><span>{{'项目分类:'}}</span><span>{{projectApprocalDetail.categoryName}}</span></div>
  309. <div class="line"><span>{{'项目类型:'}}</span><span>{{projectApprocalDetail.isPublic==0?"正式项目":"非项目"}}</span></div>
  310. <div class="line"><span>{{'项目描述:'}}</span><span>{{projectApprocalDetail.projectDesc}}</span></div>
  311. <div class="line"><span>{{'全部参与人:'}}</span>
  312. <span v-if="user.userNameNeedTranslate != 1">{{projectApprocalDetail.participationApprovalList.map(v=>v.userName).join(",")}}</span>
  313. <span v-if="user.userNameNeedTranslate == 1"><ww-open-data type='userName' :openid='projectApprocalDetail.participationApprovalList?projectApprocalDetail.participationApprovalList.map(v=>v.userName).join(","):""'></ww-open-data></span>
  314. </div>
  315. <div class="line"><span>{{'项目经理:'}}</span>
  316. <span v-if="user.userNameNeedTranslate != 1">{{projectApprocalDetail.inchargerName}}</span>
  317. <span v-if="user.userNameNeedTranslate == 1"><ww-open-data type='userName' :openid='projectApprocalDetail.inchargerName'></ww-open-data></span>
  318. </div>
  319. <div class="line"><span>{{'日报审核人:'}}</span>
  320. <span v-if="user.userNameNeedTranslate != 1">{{projectApprocalDetail.projectApprovalAuditorList.map(v=>v.auditorName).join(",")}}</span>
  321. <span v-if="user.userNameNeedTranslate == 1"><ww-open-data type='userName' :openid='projectApprocalDetail.projectApprovalAuditorList?projectApprocalDetail.projectApprovalAuditorList.map(v=>v.auditorName).join(","):""'></ww-open-data></span>
  322. </div>
  323. <div class="line"><span>{{'级别:'}}</span><span>{{importanceListLable[projectApprocalDetail.level-1]}}</span></div>
  324. <div class="line"><span>{{'合同金额:'}}</span><span>{{projectApprocalDetail.contractAmount}}</span></div>
  325. <el-divider></el-divider>
  326. <div class="line">
  327. <span>成本基线</span>
  328. </div>
  329. <div class="line">
  330. <span>{{'计划开始日期:'}}</span><span>{{projectApprocalDetail.planStartDate}}</span>
  331. <span>{{'计划结束日期:'}}</span><span>{{projectApprocalDetail.planEndDate}}</span>
  332. </div>
  333. <div class="line" v-for="(item,index) in projectApprocalDetail.projectApprovalBasecostList">
  334. <span>{{item.baseName+":"}}</span><span>{{item.baseAmount}}</span>
  335. </div>
  336. <div slot="footer" class="dialog-footer">
  337. <el-button type="primary" @click="projectApprovalDetailVisible = false" >{{'关闭'}}</el-button>
  338. </div>
  339. </el-dialog>
  340. <el-dialog :title="$t('other.Batchimportofworkinghours')" v-if="importDialog" :visible.sync="importDialog" customClass="customWidth" width="500px">
  341. <p>1. {{$t('other.download')}}
  342. <el-link type="primary" style="margin-left:5px;" :underline="false" :href="'./upload/立项导入模板.xlsx'" :download="'立项导入模板.xlsx'">{{'立项导入模板.xlsx'}}</el-link>
  343. </p>
  344. <p>2. {{$t('other.projectsAndPeopleInThetemplate')}}。</p>
  345. <p style="display: flex;justify-content: center;">
  346. <el-upload ref="upload" action="#" :limit="1" :http-request="batchImportData" :show-file-list="false">
  347. <el-button type="primary" :underline="false" :loading="importingData">{{$t("other.startImporting")}}</el-button>
  348. </el-upload>
  349. </p>
  350. </el-dialog>
  351. </div>
  352. </div>
  353. </section>
  354. </template>
  355. <script>
  356. import selectCat from "@/components/select.vue"
  357. export default {
  358. name: '',
  359. components: {
  360. selectCat
  361. },
  362. props: { },
  363. data() {
  364. return {
  365. keyword:"",
  366. searchField:"1",
  367. user: JSON.parse(sessionStorage.getItem("user")),
  368. total: 0,
  369. page: 1,
  370. size: localStorage.getItem("projectPageSize")==null?20:parseInt(localStorage.getItem("projectPageSize")),
  371. listLoading:false,
  372. approvalStatusStr:["待审核","已通过","已驳回"],
  373. importanceList:[{id:1,label:this.$t('zheng-chang')},{id:2,label:this.$t('jin-ji')},{id:3,label:this.$t('zhong-yao')},{id:4,label:this.$t('zhong-yao-qie-jin-ji')}],
  374. importanceListLable:[this.$t('zheng-chang'), this.$t('jin-ji'), this.$t('zhong-yao'), this.$t('zhong-yao-qie-jin-ji'), this.$t('di-feng-xian'), this.$t('zhong-feng-xian'), this.$t('gao-feng-xian')],
  375. addFormVisible:false,
  376. baseCostItemList:[],
  377. permissions: JSON.parse(sessionStorage.getItem("permissions")),
  378. addForm: {
  379. name: '',
  380. userId: [],
  381. level:1,
  382. bu:'',
  383. id: '',
  384. code: '',
  385. projectDesc: '',
  386. alarmType: 0
  387. },
  388. projectBaseCostData:[],
  389. activeName:"baseCostPanel",
  390. baseClfList:[],
  391. addFormUserNames: [],
  392. deptMembData: [
  393. {
  394. id: 0,
  395. label: this.$t('lable.unassigned'),
  396. }
  397. ],
  398. allMembData:[],
  399. participator:[],
  400. chosenListBackup: [],
  401. chooseParticipVisible:false,
  402. rules: {
  403. name: [{ required: true, message: this.$t('pleaseentername'), trigger: "blur" }],
  404. code: [{ required: true, message: this.$t('qing-shu-ru-bian-hao'), trigger: "blur" }],
  405. projectStageName: [{ required: true, message: this.$t('pleaseentername'), trigger: "blur" }],
  406. projectLevelName: [{ required: true, message: this.$t('pleaseentername'), trigger: "blur" }],
  407. deptId: [{ required: true, message: '请选择所属部门', trigger: "blur" }]
  408. },
  409. chosenMembCount:0,
  410. dataDetail:{},
  411. userDetailVisible:false,
  412. userDetail:{},
  413. pointList:[{
  414. userId:"",
  415. seq:1,
  416. status:0
  417. }],
  418. idx: 1,
  419. tableHeight: 0,
  420. projectApprovalDetailVisible:false,
  421. projectApprocalDetail:{},
  422. importDialog:false,
  423. }
  424. },
  425. computed: {},
  426. watch: {},
  427. created () {
  428. let height = window.innerHeight;
  429. this.tableHeight = height - 195;
  430. const that = this;
  431. window.onresize = function temp() {
  432. that.tableHeight = window.innerHeight - 195;
  433. };
  434. },
  435. mounted () {
  436. this.getList();
  437. this.getProjectBaseConfigList();
  438. this.getClfConfigList();
  439. this.getDepartment();
  440. this.getUsers();
  441. },
  442. methods: {
  443. isSelectable(row,index){
  444. if(row.creatorId == this.user.id || row.inchargerId == this.user.id || this.permissions.projectApprovalEdit){
  445. return true
  446. }else{
  447. return false
  448. }
  449. },
  450. submitInsert() {
  451. this.$refs.form1.validate(valid => {
  452. if (valid) {
  453. this.addLoading = true;
  454. let targetData = {};
  455. targetData.projectName= this.addForm.name
  456. if(this.addForm.projectDesc != null) {
  457. targetData.projectDesc=this.addForm.projectDesc
  458. }
  459. if(this.addForm.id != null) {
  460. targetData.id=this.addForm.id
  461. }
  462. if(this.addForm.isPublic != null) {
  463. targetData.isPublic=this.addForm.isPublic
  464. }
  465. if(this.addForm.userId.length != 0 && this.addForm.isPublic == 0) {
  466. let userArray=[]
  467. for(let i in this.addForm.userId){
  468. userArray.push({
  469. "userId":this.addForm.userId[i]
  470. })
  471. }
  472. targetData.participationApprovalList=userArray
  473. }
  474. if(this.addForm.inchargerId != null) {
  475. targetData.inchargerId=this.addForm.inchargerId
  476. }
  477. if(this.addForm.code != null) {
  478. targetData.projectCode=this.addForm.code
  479. }
  480. if(this.addForm.planStartDate != null) {
  481. targetData.planStartDate=this.addForm.planStartDate
  482. }
  483. if(this.addForm.planEndDate != null) {
  484. targetData.planEndDate=this.addForm.planEndDate
  485. }
  486. if(this.addForm.level != null) {
  487. targetData.level=this.addForm.level
  488. }
  489. if(this.addForm.contractAmount != null) {
  490. targetData.contractAmount=this.addForm.contractAmount
  491. }
  492. if (this.projectBaseCostData != null) {
  493. targetData.projectApprovalBasecostList=this.projectBaseCostData
  494. //计算总预算成本
  495. if (this.addForm.budget == null) {
  496. this.addForm.budget = 0;
  497. }
  498. targetData.budget=this.addForm.budget
  499. }
  500. if (this.addForm.contractAmount) {
  501. targetData.contractAmount=this.addForm.contractAmount
  502. } else {
  503. targetData.contractAmount=0
  504. }
  505. if (this.user.timeType.outputValueStatus == 1){
  506. targetData.outputValue=this.addForm.outputValue ? this.addForm.outputValue : 0
  507. }
  508. //日报审核人
  509. if (this.addForm.auditUserIds) {
  510. targetData.auditUserIds=this.addForm.auditUserIds
  511. }
  512. if(this.addForm.auditUserIds&&this.addForm.auditUserIds.length != 0) {
  513. let userArray=[]
  514. for(let i in this.addForm.auditUserIds){
  515. userArray.push({
  516. "auditorId":this.addForm.auditUserIds[i]
  517. })
  518. }
  519. targetData.projectApprovalAuditorList=userArray
  520. }
  521. if(this.addForm.category != null) {
  522. targetData.category=this.addForm.category
  523. }
  524. if(this.addForm.status != null) {
  525. targetData.status=this.addForm.status
  526. }
  527. //审核人
  528. if (this.pointList) {
  529. targetData.projectApprovalCheckList=this.pointList
  530. }
  531. this.http.JSONPost("/project-approval/editProjectApproval",targetData,
  532. res => {
  533. this.addLoading = false;
  534. if (res.code == "ok") {
  535. this.$message({
  536. message: (this.addForm.id!=null?this.$t('xiu-gai'):this.$t('create'))+this.$t('other.successful'),
  537. type: "success"
  538. });
  539. this.addFormVisible = false;
  540. this.getList();
  541. if (this.user.company.packageEngineering == 1) {
  542. this.saveProjectProfessions(res.data);
  543. }
  544. } else {
  545. this.$message({
  546. message: res.msg,
  547. type: "error"
  548. });
  549. }
  550. },
  551. error => {
  552. this.addLoading = false;
  553. this.$message({
  554. message: error,
  555. type: "error"
  556. });
  557. });
  558. }
  559. });
  560. },
  561. // 获取分类条目
  562. getClfConfigList() {
  563. this.http.get('/project-category/list',
  564. res => {
  565. if (res.code == "ok") {
  566. this.baseClfList = res.data;
  567. // console.log("获取分类条目",res.data);
  568. this.$forceUpdate();
  569. } else {
  570. this.$message({
  571. message: res.msg,
  572. type: "error"
  573. });
  574. }
  575. },
  576. error => {
  577. this.$message({
  578. message: error,
  579. type: "error"
  580. });
  581. }
  582. );
  583. },
  584. //分页
  585. handleCurrentChange(val) {
  586. this.page = val;
  587. this.getList();
  588. },
  589. handleSizeChange(val) {
  590. this.size = val;
  591. localStorage.projectPageSize = this.size;
  592. this.page = 1
  593. this.getList();
  594. },
  595. getProjectBaseConfigList() {
  596. this.http.post('/project-basecost-setting/list',{},
  597. res => {
  598. if (res.code == "ok") {
  599. this.baseCostItemList = res.data;
  600. this.$forceUpdate();
  601. } else {
  602. this.$message({
  603. message: res.msg,
  604. type: "error"
  605. });
  606. }
  607. },
  608. error => {
  609. this.$message({
  610. message: error,
  611. type: "error"
  612. });
  613. }
  614. );
  615. },
  616. //显示新增界面
  617. handleAdd(i, item) {
  618. if(i == -1) {
  619. this.title = this.$t('newproject');
  620. this.addForm = {
  621. name: '',
  622. isPublic:0,
  623. userId: [],
  624. userNames:'',
  625. code:'',
  626. inchargerId:null,
  627. level: this.user.timeType.projectLevelState == 1 ? (this.levelList.length > 0 ? this.levelList[0].id : null) : 1,
  628. customerId:null,
  629. notifyUserNames:'',
  630. chosenLeaders:[],
  631. category:null,
  632. creatorId: this.user.id,
  633. projectMainId: '',
  634. outputValue: '',
  635. bu: [],
  636. manDay:0,
  637. fromOutside: 0,
  638. status:0
  639. }
  640. this.projectBaseCostData = [];
  641. this.auseList = [];
  642. for (var m=0;m<this.baseCostItemList.length; m++) {
  643. this.projectBaseCostData.push({baseId: this.baseCostItemList[m].id, baseName:this.baseCostItemList[m].name, baseAmount:0});
  644. }
  645. this.pointList=[{
  646. "userId":"",
  647. "status":0
  648. }]
  649. } else {
  650. this.http.post('/project-approval/getDetail', {id: item.id},
  651. res => {
  652. let theData=[];
  653. if (res.code == "ok") {
  654. theData=res.data
  655. }
  656. var list = item.participationApprovalList;
  657. if (item.isPublic == 1) {
  658. list = this.users;
  659. }
  660. var arr=[]
  661. var names=""
  662. let namesLiss = [] // 企业微信用到的参与者
  663. for(var j in list) {
  664. arr.push(list[j].id)
  665. names += list[j].name+',';
  666. namesLiss.push(list[j].name)
  667. }
  668. if (names.length > 0) {
  669. names = names.substring(0, names.length -1);
  670. }
  671. this.addFormUserNames = namesLiss
  672. var auditorArr=[]
  673. if(theData.participationApprovalList){
  674. for(let i in theData.participationApprovalList){
  675. arr.push(theData.participationApprovalList[i].userId);
  676. names+=theData.participationApprovalList[i].userName+",";
  677. }
  678. }
  679. if(theData.projectApprovalAuditorList){
  680. for(let i in theData.projectApprovalAuditorList){
  681. auditorArr.push(theData.projectApprovalAuditorList[i].auditorId)
  682. }
  683. }
  684. if (names.length > 0) {
  685. names = names.substring(0, names.length -1);
  686. }
  687. this.addForm = {
  688. id: item.id,
  689. name: item.projectName,
  690. userId: arr,
  691. auditUserIds:auditorArr,
  692. userNames:names,
  693. isPublic: item.isPublic,
  694. code:item.projectCode,
  695. inchargerId: item.inchargerId,
  696. level: item.level,
  697. planStartDate: item.planStartDate,
  698. planEndDate: item.planEndDate,
  699. budget: item.budget,
  700. baseMan: item.baseMan,
  701. contractAmount: item.contractAmount,
  702. baseFee: item.baseFee,
  703. baseRisk1: item.baseRisk1,
  704. baseRisk2: item.baseRisk2,
  705. baseOutsourcing: item.baseOutsourcing,
  706. customerId:item.customerId==0?null:item.customerId,
  707. category:item.category,
  708. projectDesc: item.projectDesc,
  709. creatorId: item.creatorId,
  710. outputValue: item.outputValue,
  711. status: item.status,
  712. }
  713. this.participator=theData.participationApprovalList
  714. this.changeParticipator();
  715. this.getProjectBaseData(item.id);
  716. console.log("===========",this.projectBaseCostData)
  717. this.getProjectCheckerData(item.id);
  718. });
  719. }
  720. this.addFormVisible = true;
  721. },
  722. //获取项目列表
  723. getList() {
  724. localStorage.projectPageIndex = this.page;
  725. this.listLoading = true;
  726. let parameter = {
  727. pageIndex: this.page,
  728. pageSize: this.size,
  729. keyword:this.keyword,
  730. searchField: this.searchField,
  731. category:this.statusClf,
  732. status: this.status,
  733. viewId:this.idx
  734. }
  735. this.http.post("/project-approval/listByPage", parameter,
  736. res => {
  737. this.listLoading = false;
  738. if (res.code == "ok") {
  739. var list = res.data.records;
  740. this.list = list;
  741. this.total = res.data.total;
  742. } else {
  743. this.$message({
  744. message: res.msg,
  745. type: "error"
  746. });
  747. }
  748. },
  749. error => {
  750. this.listLoading = false;
  751. this.$message({
  752. message: error,
  753. type: "error"
  754. });
  755. });
  756. },
  757. // 项目基线合计
  758. addUpfun() {
  759. var total = 0;
  760. for (var i=0;i<this.projectBaseCostData.length; i++) {
  761. if (this.projectBaseCostData[i].baseAmount) {
  762. total += parseFloat(this.projectBaseCostData[i].baseAmount);
  763. }
  764. }
  765. this.addForm.budget = total;
  766. },
  767. restrictNumber(targetId) {
  768. let inpu = document.getElementById(targetId);
  769. inpu.value = inpu.value.replace(/[^\d.]/g, ""); //仅保留数字和"."
  770. inpu.value = inpu.value.replace(/\.{2,}/g, "."); //两个连续的"."仅保留第一个"."
  771. inpu.value = inpu.value.replace(".", "$#*").replace(/\./g,'').replace('$#*','.');//去除其他"."
  772. inpu.value = inpu.value.replace(/^(\d+)\.(\d\d).*$/, '$1.$2');;//限制只能输入两个小数
  773. if (inpu.value.indexOf(".") < 0 && inpu.value != "") { //首位是0的话去掉
  774. inpu.value = parseFloat(inpu.value);
  775. }
  776. },
  777. showChooseLeaderTree() {
  778. this.chosenMembCount = this.chosenLeaders.length;
  779. this.chooseLeaderVisible = true;
  780. },
  781. onLeaderTreeItemChange() {
  782. var chosenList = this.$refs.chooseLeaderTree.getCheckedNodes();
  783. var list = chosenList.filter(item=>item.isUser == 1);
  784. this.chosenMembCount = list.length;
  785. },
  786. showChooseMembTree() {
  787. this.deptMembData = JSON.parse(JSON.stringify(this.allMembData))
  788. this.chosenMembCount = this.participator.length;
  789. this.chooseParticipVisible = true;
  790. this.filterText = ''
  791. this.wxFilterText = ''
  792. if(this.user.userNameNeedTranslate == 1) {
  793. this.getDepartment()
  794. }
  795. let that = this
  796. setTimeout(()=>{
  797. that.chosenListBackup = that.$refs.chooseMembTree.getCheckedNodes();
  798. }, 500)
  799. },
  800. onTreeItemChange() {
  801. var chosenList = this.$refs.chooseMembTree.getCheckedNodes();
  802. var list = chosenList.filter(item=>item.isUser == 1);
  803. this.chosenMembCount = list.length;
  804. },
  805. findUserInTree() {
  806. if (this.filterName == '') {
  807. this.deptMembData = this.allMembData;
  808. } else {
  809. var list = this.findRecursively(this.filterName, this.allMembData);
  810. this.deptMembData = list;
  811. }
  812. },
  813. findRecursively(username, list) {
  814. var filterList = [];
  815. for (var i=0;i<list.length; i++) {
  816. if (list[i].isUser == 1) {
  817. if (list[i].label.indexOf(username) >= 0) {
  818. //匹配上了
  819. filterList.push(list[i]);
  820. }
  821. } else if (list[i].children != null && list[i].children.length > 0) {
  822. var subList = this.findRecursively(username, list[i].children);
  823. if (subList.length > 0) {
  824. subList.forEach(s=>filterList.push(s));
  825. }
  826. }
  827. }
  828. return filterList;
  829. },
  830. //确定选择参与人
  831. chooseParticip() {
  832. this.chooseParticipVisible = false;
  833. var chosenList = this.$refs.chooseMembTree.getCheckedNodes();
  834. if(this.searchPersonnelFlg) {
  835. chosenList = [...chosenList, ...this.chosenListBackup]
  836. }
  837. this.chosenMembList = chosenList.filter(item=>item.isUser == 1);
  838. this.addForm.userNames = '';
  839. this.addFormUserNames = []
  840. this.addForm.userId = [];
  841. this.participator = [];
  842. for (var i=0;i<this.chosenMembList.length; i++) {
  843. this.addForm.userId.push(this.chosenMembList[i].id);
  844. this.addForm.userNames += this.chosenMembList[i].label+',';
  845. this.addFormUserNames.push(this.chosenMembList[i].label)
  846. var item = {id:this.chosenMembList[i].id, name:this.chosenMembList[i].label};
  847. this.participator.push(item);
  848. }
  849. if (this.addForm.userNames.length > 0) {
  850. this.addForm.userNames = this.addForm.userNames.substring(0, this.addForm.userNames.length-1);
  851. }
  852. },
  853. // 获取部门列表
  854. getDepartment() {
  855. this.http.post("/department/listAllMemb", {},
  856. res => {
  857. if (res.code == "ok") {
  858. var list = res.data;
  859. //设置员工到部门下面
  860. this.setUserToDept(list);
  861. this.deptMembData = list;
  862. console.log(this.deptMembData, '看看数据')
  863. //用于筛选过滤
  864. this.allMembData = JSON.parse(JSON.stringify(this.deptMembData));
  865. } else {
  866. this.$message({
  867. message: res.msg,
  868. type: "error"
  869. });
  870. }
  871. },
  872. error => {
  873. this.$message({
  874. message: error,
  875. type: "error"
  876. });
  877. });
  878. },
  879. onTreeItemChange() {
  880. var chosenList = this.$refs.chooseMembTree.getCheckedNodes();
  881. var list = chosenList.filter(item=>item.isUser == 1);
  882. this.chosenMembCount = list.length;
  883. },
  884. findUserInTree() {
  885. if (this.filterName == '') {
  886. this.deptMembData = this.allMembData;
  887. } else {
  888. var list = this.findRecursively(this.filterName, this.allMembData);
  889. this.deptMembData = list;
  890. }
  891. },
  892. addPersonCheck(){
  893. var chosenList = this.$refs.chooseMembTree2.getCheckedNodes();
  894. var list = chosenList.filter(item=>item.isUser == 1);
  895. this.chosenMembCount = list.length;
  896. // console.log(list);
  897. },
  898. addPersonSure(){
  899. this.addGroupPersonPdialog = false
  900. let chosenList = this.$refs.chooseMembTree2.getCheckedNodes();
  901. let list = chosenList.filter(item=>item.isUser == 1);
  902. let listIDs = []
  903. let listNames = ''
  904. let listNamesList = []
  905. for(let i=0;i<list.length;i++){
  906. listIDs.push(list[i].id)
  907. listNames += list[i].label + ','
  908. listNamesList.push(list[i].label)
  909. }
  910. this.addGroupPersonData.person = listIDs
  911. this.addGroupPersonData.personNames = listNames
  912. this.addGroupPersonDataPersonNames = listNamesList
  913. console.log('触发', this.addGroupPersonDataPersonNames)
  914. },
  915. // 企业微信搜索
  916. echartDepartment() {
  917. console.log('我点击了搜索')
  918. if(this.filterText != '') {
  919. this.http.post("/user/getEmployeeList", {
  920. keyword: this.filterText,
  921. cursor: '',
  922. departmentId: -1,
  923. pageIndex: 1,
  924. pageSize: 1000
  925. },
  926. res => {
  927. if (res.code == "ok") {
  928. this.filterNodePersonnel = res.data.records.map(item => item.name)
  929. this.$refs.chooseMembTree.filter(this.filterText);
  930. } else {
  931. this.$message({
  932. message: res.msg,
  933. type: "error"
  934. });
  935. }
  936. },
  937. error => {
  938. this.$message({
  939. message: error,
  940. type: "error"
  941. });
  942. });
  943. } else {
  944. this.searchPersonnelFlgnum = +this.searchPersonnelFlgnum +1
  945. this.searchPersonnelFlg = false
  946. this.getDepartment()
  947. }
  948. },
  949. setUserToDept(list) {
  950. for (var i in list) {
  951. if (list[i].children != null) {
  952. this.setUserToDept(list[i].children);
  953. }
  954. if (list[i].userList != null) {
  955. if (list[i].children == null) {
  956. list[i].children = [];
  957. }
  958. list[i].userList.forEach(element => {
  959. var obj = {id: element.id, label:element.name, parentId:element.departmentId, isUser:1};
  960. list[i].children.push(obj);
  961. });
  962. }
  963. }
  964. },
  965. formDataToObject(formData) {
  966. const object = {};
  967. for (const [key, value] of formData.entries()) {
  968. if (key in object) {
  969. object[key] = [].concat(object[key], value);
  970. } else {
  971. object[key] = value;
  972. }
  973. }
  974. return object;
  975. },
  976. searchList() {
  977. this.page = 1;
  978. this.getList();
  979. },
  980. // 分类筛选
  981. searchClfList(){
  982. this.page = 1;
  983. this.getList();
  984. },
  985. getUsers() {
  986. // this.http.post(this.port.manage.list, {
  987. // departmentId: -1,
  988. // pageIndex: 1,
  989. // // pageSize: 99999
  990. // pageSize: -1
  991. // },
  992. this.http.post('/user/getSimpleActiveUserList', {},
  993. res => {
  994. if (res.code == "ok") {
  995. this.users = res.data;
  996. } else {
  997. this.$message({
  998. message: res.msg,
  999. type: "error"
  1000. });
  1001. }
  1002. },
  1003. error => {
  1004. this.$message({
  1005. message: error,
  1006. type: "error"
  1007. });
  1008. });
  1009. },
  1010. // 自定义组件事件
  1011. selectCal(obj) {
  1012. if(obj.distinction == '1') {
  1013. this.inchagerId = obj.id
  1014. this.manageSelect()
  1015. } else if(obj.distinction == '2') {
  1016. this.participationId = obj.id
  1017. this.participationSelect()
  1018. } else if(obj.distinction == '3') {
  1019. this.addForm.inchargerId = obj.id
  1020. // console.log(this.participator)
  1021. this.participator = JSON.parse(JSON.stringify(this.participator))
  1022. } else if(obj.distinction =='4') {
  1023. this.projectProfessionList[obj.other].inchargerId = obj.id
  1024. } else if(obj.distinction =='5') {
  1025. this.paramInchargerId = obj.id
  1026. }else if(obj.distinction =='6') {
  1027. this.hasSetGroupInchargerId = obj.id
  1028. } else if(obj.distinction == '10') {
  1029. let userList = obj.arrUserList
  1030. let arr = []
  1031. for(var i in userList) {
  1032. arr.push(userList[i].id)
  1033. }
  1034. this.participator = JSON.parse(JSON.stringify(this.participator))
  1035. this.addForm.auditUserIds = arr
  1036. } else if(obj.distinction == '11') {
  1037. let userList = obj.id
  1038. console.log(obj)
  1039. this.curProfessionRow.membList[obj.other].membId = userList
  1040. } else if(obj.distinction == '12') {
  1041. this.pointList.push({
  1042. "userId":obj.id,
  1043. "status":0
  1044. })
  1045. this.pointList=this.pointList.filter(i=>i.userId!="")
  1046. }
  1047. },
  1048. getProjectBaseData(projectId) {
  1049. this.http.post('/project-approval-basecost/get',{projectId: projectId},
  1050. res => {
  1051. if (res.code == "ok") {
  1052. if(res.data.length>0){
  1053. this.projectBaseCostData = res.data;
  1054. }else{
  1055. this.projectBaseCostData = [];
  1056. for (var m=0;m<this.baseCostItemList.length; m++) {
  1057. this.projectBaseCostData.push({baseId: this.baseCostItemList[m].id, baseName:this.baseCostItemList[m].name, baseAmount:0});
  1058. }
  1059. }
  1060. } else {
  1061. this.$message({
  1062. message: res.msg,
  1063. type: "error"
  1064. });
  1065. }
  1066. },
  1067. error => {
  1068. this.listLoading = false;
  1069. this.$message({
  1070. message: error,
  1071. type: "error"
  1072. });
  1073. }
  1074. );
  1075. },
  1076. getProjectCheckerData(projectId) {
  1077. this.http.post('//project-approval-check/get',{projectId: projectId},
  1078. res => {
  1079. if (res.code == "ok") {
  1080. if(res.data.length>0){
  1081. this.pointList = res.data;
  1082. }else{
  1083. this.pointList=[{
  1084. "userId":"",
  1085. "status":0
  1086. }]
  1087. }
  1088. } else {
  1089. this.$message({
  1090. message: res.msg,
  1091. type: "error"
  1092. });
  1093. }
  1094. },
  1095. error => {
  1096. this.listLoading = false;
  1097. this.$message({
  1098. message: error,
  1099. type: "error"
  1100. });
  1101. }
  1102. );
  1103. },
  1104. selectPublic() {
  1105. if (this.addForm.isPublic == 1) {
  1106. this.participator = this.users;
  1107. } else {
  1108. this.participator = [];
  1109. }
  1110. },
  1111. //选择参与人
  1112. changeParticipator() {
  1113. //检查是否在参与人中,如果没有需要加入到参与人中
  1114. // console.log('addform',this.addForm.userId,this.users);
  1115. this.participator = [];
  1116. this.addForm.userId.forEach(u=>{
  1117. var list = this.users.filter(au=>au.id == u);
  1118. if (list.length > 0) {
  1119. var findUser = list[0];
  1120. this.participator.push(findUser);
  1121. } else {
  1122. console.log('未找到用户: '+u);
  1123. }
  1124. })
  1125. },
  1126. //显示用户详情
  1127. showUser(userId) {
  1128. this.userDetailVisible = true;
  1129. this.http.post(this.port.manage.userDetail, {
  1130. userId: userId
  1131. },
  1132. res => {
  1133. if (res.code == "ok") {
  1134. this.userDetail = res.data;
  1135. } else {
  1136. this.$message({
  1137. message: res.msg,
  1138. type: "error"
  1139. });
  1140. }
  1141. },
  1142. error => {
  1143. this.$message({
  1144. message: error,
  1145. type: "error"
  1146. });
  1147. });
  1148. },
  1149. addInput(index){
  1150. this.pointList.push({
  1151. userId:"",
  1152. seq:index+2,
  1153. status:0
  1154. })
  1155. },
  1156. deleteInput(index){
  1157. this.pointList.splice(index,1)
  1158. // if(this.pointList.length<=0){
  1159. // this.pointList.push({
  1160. // checkerId:""
  1161. // })
  1162. // }
  1163. },
  1164. // 切换当前选项的索引
  1165. switchs(e) {
  1166. this.idx = e
  1167. this.page = 1
  1168. // console.log(this.searchField)
  1169. this.getList()
  1170. },
  1171. deletePro(i, item) {
  1172. this.$confirm('确定要删除立项[' + item.name +'吗]','删除立项', {
  1173. confirmButtonText: this.$t('btn.determine'),
  1174. cancelButtonText: this.$t('btn.cancel'),
  1175. type: "warning"
  1176. })
  1177. .then(() => {
  1178. this.listLoading = true;
  1179. this.http.post('/project-approval/delete',{
  1180. id: item.id
  1181. },
  1182. res => {
  1183. this.listLoading = false;
  1184. if (res.code == "ok") {
  1185. this.$message({
  1186. message: this.$t('message.successfullyDeleted'),
  1187. type: "success"
  1188. });
  1189. this.addFormVisible=false
  1190. this.getList();
  1191. } else {
  1192. this.$message({
  1193. message: res.msg,
  1194. type: "error"
  1195. });
  1196. }
  1197. },
  1198. error => {
  1199. this.listLoading = false;
  1200. this.$message({
  1201. message: error,
  1202. type: "error"
  1203. });
  1204. }
  1205. );
  1206. })
  1207. .catch(() => {});
  1208. },
  1209. check(item,checkType,revokeType){
  1210. this.listLoading = true;
  1211. this.http.post('/project-approval/check',{
  1212. id:item.id ,
  1213. checkType:checkType,
  1214. revokeType:revokeType
  1215. },
  1216. res => {
  1217. this.listLoading = false;
  1218. if (res.code == "ok") {
  1219. this.$message({
  1220. message: "操作成功",
  1221. type: "success"
  1222. });
  1223. this.addFormVisible=false
  1224. this.getList();
  1225. } else {
  1226. this.$message({
  1227. message: res.msg,
  1228. type: "error"
  1229. });
  1230. }
  1231. },
  1232. error => {
  1233. this.listLoading = false;
  1234. this.$message({
  1235. message: error,
  1236. type: "error"
  1237. });
  1238. }
  1239. );
  1240. },
  1241. showProjectApprovalDeatil(item){
  1242. this.projectApprovalDetailVisible=true
  1243. this.http.post('/project-approval/getDetail', {id: item.id},
  1244. res => {
  1245. if (res.code == "ok") {
  1246. this.projectApprocalDetail=res.data
  1247. }
  1248. });
  1249. },
  1250. batchImportData(item) {
  1251. //首先判断文件类型
  1252. let str = item.file.name.split(".");
  1253. let format = str[str.length - 1];
  1254. if (format != "xls" && format != "xlsx") {
  1255. this.$message({
  1256. message: this.$t('other.PleaseselecttheXLSorXLSXfile'),
  1257. type: "error"
  1258. });
  1259. } else {
  1260. this.importingData = true;
  1261. let formData = new FormData();
  1262. formData.append("multipartFile", item.file);
  1263. formData.append("companyId", this.user.companyId)
  1264. this.http.uploadFile('/project-approval/importData', formData,
  1265. res => {
  1266. this.$refs.upload.clearFiles();
  1267. this.importingData = false;
  1268. if (res.code == "ok") {
  1269. //换成弹出框,以免有人等了半天回来啥也没看到
  1270. this.importResultMsg = "成功导入"+res.data+'立项数据'+(res.msg?res.msg:"");;
  1271. this.getList();
  1272. this.importDialog = false;
  1273. } else {
  1274. this.importResultMsg = this.$t('export.Importfailure')+":"+res.msg;
  1275. }
  1276. },
  1277. error => {
  1278. this.$refs.upload.clearFiles();
  1279. this.importingData = false;
  1280. this.$message({
  1281. message: error,
  1282. type: "error"
  1283. });
  1284. });
  1285. }
  1286. },
  1287. exportData(){
  1288. let parameter = {
  1289. keyword:this.keyword,
  1290. searchField: this.searchField,
  1291. category:this.statusClf,
  1292. status: this.status,
  1293. viewId:this.idx
  1294. }
  1295. this.http.post("/project-approval/exportData", parameter,
  1296. res => {
  1297. if (res.code == "ok") {
  1298. const a = document.createElement("a"); // 创建a标签
  1299. a.setAttribute("download", "立项导出.xlsx"); // download属性
  1300. a.setAttribute("href", res.data); // href链接
  1301. a.click(); // 自执行点击事件
  1302. a.remove();
  1303. } else {
  1304. this.$message({
  1305. message: res.msg,
  1306. type: "error"
  1307. });
  1308. }
  1309. },
  1310. error => {
  1311. this.$message({
  1312. message: error,
  1313. type: "error"
  1314. });
  1315. });
  1316. },
  1317. },
  1318. }
  1319. </script>
  1320. <style scoped>
  1321. .toolbar_formitem_n1{
  1322. margin-right: 0 !important;
  1323. }
  1324. .rg_span{
  1325. display: inline-block;
  1326. }
  1327. .classification {
  1328. width: 120px;
  1329. border-right: 1px solid #f2f2f2;
  1330. display: flex;
  1331. flex-wrap: wrap;
  1332. padding-top: 20px;
  1333. }
  1334. .classification p{
  1335. width: 120px;
  1336. text-align: center;
  1337. line-height: 50px;
  1338. margin: 0;
  1339. cursor: pointer;
  1340. }
  1341. .classification p:hover {
  1342. background: #dddddd;
  1343. }
  1344. .on {
  1345. color: #409EFF;
  1346. }
  1347. </style>