Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.
 
 
 
 

1558 wiersze
66 KiB

  1. <!--
  2. * @Description: 分配工作组件
  3. * @version: V1.0
  4. * @Author: xzx
  5. * @Date: 2019-11-14 13:55:16
  6. * @LastEditors : xzx
  7. * @LastEditTime : 2020-01-07 19:56:20
  8. -->
  9. <template>
  10. <div>
  11. <!-- 底部弹框 -->
  12. <div class="bottomdialog" v-show="isBottomNewProj" style="height: 60px;">
  13. <!-- <div style="margin-top: 10px;" class="yiyun_dialog_left yiyun_zhedie" @click="showContinueNewProj">
  14. <span class="yiyun_zhankaibtn">
  15. <i class="Cicon text_gray icon font_family icon-icon_zhankai" title="展开面板"></i>
  16. </span>
  17. </div> -->
  18. <div style="margin-top: 10px;" class="yiyun_dialog_left yiyun_zhedie" @click="offDialog">
  19. 关闭
  20. </div>
  21. <div class="yiyun_dialog_center">
  22. <div class="bottomdialogbox_list_head newProject_next_taggle1 line_H60">
  23. <div class="yiyun_col-6 fl">
  24. <h3>继续-新建项目</h3>
  25. </div>
  26. </div>
  27. </div>
  28. <!-- <div class="yiyun_dialog_right yiyundialog_close" style="margin-top: 15px;" @click="offDialog">
  29. 关闭
  30. </div> -->
  31. </div>
  32. <!-- 新建项目弹框 -->
  33. <div class="bottomdialog">
  34. <div class="yiyun_dialog_left yiyun_zhedie">
  35. <span @click="offDialog">关闭</span>
  36. <!-- <span class="yiyun_zhediebtn">
  37. <i
  38. class="Cicon text_gray icon font_family icon-icon_shouqi"
  39. @click="showzhankai"
  40. title="折叠面板"
  41. v-show="isShowThreePage != true"
  42. ></i>
  43. </span> -->
  44. </div>
  45. <div class="yiyun_dialog_center">
  46. <!-- 头部信息 -->
  47. <span class="backshangyicheng prev_to_2" @click="toSecondPage" v-show="isShowThreePage == true && isShowManager"><i class="yiyun_icon icon_topnav_backicon"></i></span>
  48. <span class="backshangyicheng prev_to_2" @click="toFirstPage" v-show="isShowSecondPage == true"><i class="yiyun_icon icon_topnav_backicon"></i></span>
  49. <span class="backshangyicheng prev_to_2" @click="backFirstPage" v-show="isShowPrjDesc == true"><i class="yiyun_icon icon_topnav_backicon"></i></span>
  50. <div class="bottomdialogbox_list_head newProject_next_taggle1">
  51. <div class="EC_col_16">
  52. <h3 v-show="isShowFirstPage" :title="curProjCreatePeop">
  53. {{ curProjCreatePeop }}
  54. </h3>
  55. <h3 v-show="isShowPrjDesc == true">项目概况</h3>
  56. <h3 v-show="isShowThreePage == true">指派职员</h3>
  57. <h3 v-show="isShowSecondPage == true">指派工作负责人</h3>
  58. </div>
  59. <div class="EC_col_8">
  60. <div class="fr mt-26">
  61. <el-button type="primary" round class="fr width_120" @click="toThreePage" v-show="isShowSecondPage == true">分配职员</el-button>
  62. <el-button type="primary" round class="fr width_120" @click="backFirstPage" v-show="isShowThreePage == true">完成或跳过</el-button>
  63. <el-button type="primary" round class="fr width_120" @click="submitAndClose" v-show="isShowFirstPage == true">完成</el-button>
  64. </div>
  65. </div>
  66. <div class="clear"></div>
  67. <div class="yiyun_Tbline"></div>
  68. </div>
  69. </div>
  70. <div class="yiyun_dialog_right yiyundialog_close">
  71. <!-- <span @click="offDialog">关闭</span> -->
  72. </div>
  73. <div class="clear"></div>
  74. <div class="linescoll" v-show="isShowdivid2"></div>
  75. <div class="dialogcontentbody" id="bottomDiaBody2">
  76. <div class="dialogcontentbodyrow" id="bottomDiaChild2">
  77. <div class="centerWarpDia" >
  78. <div v-show="isShowFirstPage" class="PaincenterBox">
  79. <!-- first pane -->
  80. <!-- 线下内容区 -->
  81. <div class="xiezuobox">
  82. <!-- <div class="maxlongBtn" v-on:click="goShowPrjDesc">
  83. 查看项目概况
  84. <i class="icon font_family icon-icon_fanhui rightIcon"></i>
  85. </div> -->
  86. <div class="clear"></div>
  87. <!-- 分配业主工作 -->
  88. <div class="line_from">
  89. <!-- 项目管理权限 start -->
  90. <div class="fuzeren" v-if="isProjManager">
  91. <div><span class="label_text">项目管理权限</span> </div>
  92. <div class="mt-10">
  93. <div class="fl firstPeople">
  94. <!-- 默认添加 -->
  95. <div >
  96. <div class="avtarface" :title="currUser.cnName">
  97. <img :src="currUser.userInfo.headImgUrl | resolveAvator"/>
  98. </div>
  99. <span class="Text_tiny tinyText_wirte">{{currUser.cnName}}</span>
  100. </div>
  101. </div>
  102. <!-- 竖线 -->
  103. <div class="fl vhLine mlr-20"></div>
  104. <!-- 添加职员 -->
  105. <div class="fl addBtn_new" title="添加项目负责人" @click="addProjManager()">
  106. <i class="el-icon-plus middleaddEC"></i>
  107. </div>
  108. <div class="fl chengyuanbox">
  109. <ul class="ECworkerList">
  110. <li v-for="(user, index) in listManagerUser" :key="index">
  111. <div v-if="index < 14 || showAll ">
  112. <div class="avtarface" :title="user.cnName">
  113. <!-- <img src="" v-lazy="headSrc+user.headImgUrl" /> -->
  114. <img :src="user.headImgUrl | resolveAvator" />
  115. </div>
  116. <span class="Text_tiny tinyText_wirte">{{user.cnName}}</span>
  117. </div>
  118. </li>
  119. </ul>
  120. </div>
  121. </div>
  122. </div>
  123. <!-- 项目管理权限 end -->
  124. <div>
  125. <div class="tianjiaxiezuorenBox" v-for="(folder, folderIndex) in listNewFolder" :key="folderIndex">
  126. <div v-if="tempIndex!=folderIndex||folderIndex==0" class="self_newitem">
  127. <h5 class="fl label_text">
  128. <i class="el-icon-caret-right hand" v-show="opentree" @click="openECtree"></i>
  129. <i class="el-icon-caret-bottom hand" v-show="!opentree" @click="closeECtree"></i>
  130. {{ folderIndex + 1 }} <span>.</span>
  131. {{ folder.folderName }}
  132. </h5>
  133. <div class="selfoptiongroup">
  134. <el-button v-if="folder.default == false" v-on:click="eidtTitle(folderIndex)">编辑</el-button>
  135. </div>
  136. </div>
  137. <div v-if="showTitle == 2&&tempIndex==folderIndex" class="self_newitem">
  138. <input v-model="folder.folderName" :class="
  139. folder.default == false
  140. ? 'bianji_input self_Inputwork'
  141. : 'fl label_text_moren'
  142. " :disabled="folder.default" />
  143. <div class="selfoptiongroup">
  144. <el-button type="primary" v-if="folder.default == false" v-on:click="saveTitle">保存</el-button>
  145. <el-button v-if="folder.default == false" v-on:click="deleTitle(folderIndex)">删除</el-button>
  146. </div>
  147. </div>
  148. <div>
  149. <div class="fl firstPeople">
  150. <!-- 默认添加 -->
  151. <div v-if="folder.manageUser == ''">
  152. <div class="avtarface" @click="aloneAddUserForFolder(folder)">
  153. <!-- <i class="large_huangguan icon font_family icon-icon_huangguan-jihuo"></i> -->
  154. <i class="large_huangguan el-icon-plus"></i>
  155. </div>
  156. <span class="Text_tiny tinyText_wirte">工作负责人</span>
  157. </div>
  158. <li v-for="(user, index) in folder.manageUser" :key="index">
  159. <div>
  160. <div class="avtarface" title="编辑">
  161. <!-- <img src="" v-lazy="headSrc + user.headImgUrl" @click="aloneAddUserForFolder(folder)" /> -->
  162. <img :src="user.headImgUrl | resolveAvator" @click="aloneAddUserForFolder(folder)" />
  163. </div>
  164. <span class="Text_tiny tinyText_wirte">{{
  165. user.cnName
  166. }}</span>
  167. </div>
  168. </li>
  169. </div>
  170. <!-- 竖线 -->
  171. <div class="fl vhLine mlr-20"></div>
  172. <!-- 添加职员 -->
  173. <div class="fl addBtn_new" title="添加职员" @click="aloneAddUserOnlyStaff(folder)" v-if="folder.manageUser != ''">
  174. <i class="el-icon-plus middleaddEC"></i>
  175. </div>
  176. <div class="fl chengyuanbox">
  177. <ul class="ECworkerList">
  178. <li v-for="(user, index) in listUserComputed(
  179. folder.listUser
  180. )" :key="index">
  181. <div v-if="index < 14 || showAll">
  182. <div class="avtarface" title="编辑">
  183. <!-- <img src="" v-lazy="headSrc + user.headImgUrl" /> -->
  184. <img :src="user.headImgUrl | resolveAvator" />
  185. </div>
  186. <span class="Text_tiny tinyText_wirte">{{
  187. user.cnName
  188. }}</span>
  189. </div>
  190. <div class v-if="index == 14 && !showAll" @click="showAllClick">
  191. <span class="zhangkai_down"></span>
  192. <span class="Text_tiny tinyText_wirte">展开全部</span>
  193. </div>
  194. <div v-if="
  195. showAll &&
  196. index == folder.listUser.length - 1 &&
  197. index > 14
  198. " @click="showAll = false" class="newweizhi">
  199. <span class="zhangkai_up"></span>
  200. <span class="Text_tiny tinyText_wirte">收起职员</span>
  201. </div>
  202. </li>
  203. </ul>
  204. </div>
  205. <div class="clear"></div>
  206. </div>
  207. <div class="tianjiaxiezuorenBox" v-for="(folderChild, childIndex) in folder.listChildren" :key="childIndex" v-show="nodeLeaves">
  208. <div v-if="tempIndex!=childIndex||childIndex==0" class="self_newitem">
  209. <h5 class="fl label_text">
  210. {{ childIndex + 1 }}.{{ folderChild.folderName }}
  211. </h5>
  212. <div class="selfoptiongroup">
  213. <el-button v-if="folderChild.default == false" v-on:click="eidtTitle(childIndex)">编辑</el-button>
  214. </div>
  215. </div>
  216. <div v-if="showTitle == 2&&tempIndex==folderIndex" class="self_newitem">
  217. <input v-model="folderChild.folderName" :class="
  218. folderChild.default == false
  219. ? 'bianji_input self_Inputwork'
  220. : 'fl label_text_moren'
  221. " :disabled="folderChild.default" />
  222. <div class="selfoptiongroup">
  223. <el-button type="primary" v-if="folderChild.default == false" v-on:click="saveTitle">保存</el-button>
  224. <el-button v-if="folderChild.default == false" v-on:click="deleTitle(folderIndex)">删除</el-button>
  225. </div>
  226. </div>
  227. <div>
  228. <div class="fl firstPeople">
  229. <!-- 默认添加 -->
  230. <div v-if="folderChild.manageUser == ''">
  231. <div class="avtarface" @click="aloneAddUserForFolder(folderChild)">
  232. <i class="large_huangguan el-icon-plus"></i>
  233. </div>
  234. <span class="Text_tiny tinyText_wirte">工作负责人</span>
  235. </div>
  236. <li v-for="(user, index) in folderChild.manageUser" :key="index">
  237. <div>
  238. <div class="avtarface" title="编辑">
  239. <!-- <img src="" v-lazy="headSrc + user.headImgUrl" @click="aloneAddUserForFolder(folderChild)" /> -->
  240. <img :src="user.headImgUrl | resolveAvator" @click="aloneAddUserForFolder(folderChild)" />
  241. </div>
  242. <span class="Text_tiny tinyText_wirte">{{
  243. user.cnName
  244. }}</span>
  245. </div>
  246. </li>
  247. </div>
  248. <!-- 竖线 -->
  249. <div class="fl vhLine mlr-20"></div>
  250. <!-- 添加职员 -->
  251. <div class="fl addBtn_new" title="添加职员" @click="aloneAddUserOnlyStaff(folderChild)">
  252. <i class="el-icon-plus middleaddEC"></i>
  253. </div>
  254. <div class="fl chengyuanbox">
  255. <ul class="ECworkerList">
  256. <li v-for="(user, index) in listUserComputed(
  257. folderChild.listUser
  258. )" :key="index">
  259. <div v-if="index < 14 || showAll">
  260. <div class="avtarface" title="编辑">
  261. <img :src=" user.headImgUrl | resolveAvator" />
  262. </div>
  263. <span class="Text_tiny tinyText_wirte">{{
  264. user.cnName
  265. }}</span>
  266. </div>
  267. <div class v-if="index == 14 && !showAll" @click="showAllClick">
  268. <span class="zhangkai_down"></span>
  269. <span class="Text_tiny tinyText_wirte">展开全部</span>
  270. </div>
  271. <div v-if="
  272. showAll &&
  273. index ==
  274. folderChild.listUser.length - 1 &&
  275. index > 14
  276. " @click="showAll = false" class="newweizhi">
  277. <span class="zhangkai_up"></span>
  278. <span class="Text_tiny tinyText_wirte">收起职员</span>
  279. </div>
  280. </li>
  281. </ul>
  282. </div>
  283. <div class="clear"></div>
  284. </div>
  285. </div>
  286. </div>
  287. </div>
  288. <div v-show="listNewFolder.length>0">
  289. <span class="fl label_text">自定义工作</span>
  290. <span class="fr mt-10" @click="addProjFolderWork()"><i class="yiyunPlusmini"></i></span>
  291. </div>
  292. </div>
  293. </div>
  294. </div>
  295. <!-- 分配工作--项目概况 -->
  296. <div v-show="isShowPrjDesc" class="PaincenterBox">
  297. <!-- 表单 横线输入框表单-->
  298. <el-form ref="" v-model="nowProject" class="line_from" label-width="100px" label-position="left">
  299. <div class="yiyun_col-6 fl">
  300. <div class="bianju_item_fr">
  301. <el-form-item label="项目负责:">
  302. <span>{{ nowProject.cnName }}</span>
  303. </el-form-item>
  304. </div>
  305. </div>
  306. <div class="yiyun_col-6 fl">
  307. <div class="bianju_item_fr">
  308. <el-form-item label="创建时间:">
  309. <span>{{ nowProject.strCreateTime }}</span>
  310. </el-form-item>
  311. </div>
  312. </div>
  313. <div class="yiyun_col-12 fl" v-for="prop in listProjProp" :key="prop.propertyID">
  314. <div class="yiyunlargeItem">
  315. <el-form-item :label="prop.propName + ':'">
  316. <span>{{ prop.propValue }}</span>
  317. </el-form-item>
  318. </div>
  319. </div>
  320. </el-form>
  321. </div>
  322. <!-- 选择负责人 -->
  323. <div v-show="isShowSecondPage" class="PaincenterBox">
  324. <div class="xiezuobox">
  325. <!-- 左侧折叠面板 -->
  326. <div class="yiyun_col-6 bg_text_wirte mt-8">
  327. <div class="row_painfl">
  328. <!-- 折叠面板 -->
  329. <el-collapse accordion v-model="activeName">
  330. <!-- 添加协作群与工作 -->
  331. <el-collapse-item name="1" class="nomidline">
  332. <template slot="title">
  333. <span class="fr mr_20">
  334. <el-checkbox class="checkBoxCol" v-model="ischeckAll" @change="handleCheckTopAll">全选</el-checkbox>
  335. </span>
  336. <span>从部门中选择职员</span>
  337. </template>
  338. <el-collapse accordion v-for="(dept, group_index) in listDept" v-show="dept.listUser.length>0" :key="group_index">
  339. <!-- 二级折叠面板 -->
  340. <el-collapse-item>
  341. <template slot="title">
  342. <span class="fr mr_20">
  343. <el-checkbox class="checkBoxCol" v-model="dept.selected" :key="group_index" @change="handleCheckItemAll(group_index,$event)">全选</el-checkbox>
  344. </span>
  345. <span>{{ dept.deptName }} </span>
  346. </template>
  347. <!-- <div class="user_info_item" v-for="(user, index) in listUserManager(
  348. dept.listUser
  349. )" :label="user" :key="index"> -->
  350. <div class="user_info_item" v-for="(user, index) in dept.listUser" :label="user" :key="index">
  351. <el-checkbox class="checkBoxCol" v-model="user.selected" @change="
  352. handleCheckedOnlyOne(
  353. group_index,
  354. user,
  355. $event
  356. )
  357. " :disabled="disabled">
  358. <div class="checkboxlabelitem">
  359. <!-- <img v-lazy="headSrc + user.headImgUrl" alt="" class="user_info_faceImg" /> -->
  360. <img :src="user.headImgUrl | resolveAvator" alt="" class="user_info_faceImg" />
  361. <span class="user_info_name">{{
  362. user.cnName
  363. }}</span>
  364. <el-popover placement="bottom-start" width="180" trigger="hover">
  365. <ul class="popover_ul popover_ul">
  366. <li>
  367. <a href="javascript:;">{{
  368. user.companyName
  369. }}</a>
  370. </li>
  371. <li>
  372. <a href="javascript:;">{{
  373. user.phone
  374. }}</a>
  375. </li>
  376. <li>
  377. <a href="javascript:;">所在项目{{ user.projCount }}个</a>
  378. </li>
  379. </ul>
  380. <span class="user_info_job" slot="reference">{{user.position }}</span>
  381. </el-popover>
  382. <span class="user_info_role">{{
  383. user.roleName
  384. }}</span>
  385. </div>
  386. </el-checkbox>
  387. </div>
  388. </el-collapse-item>
  389. </el-collapse>
  390. </el-collapse-item>
  391. </el-collapse>
  392. </div>
  393. </div>
  394. <div class="shuxian"></div>
  395. <!-- 右侧折叠面板 -->
  396. <div class="yiyun_col-6">
  397. <h4 class="rightXiezuoren">已选职员</h4>
  398. <div class="row_painfr">
  399. <div class="yiyun_line"></div>
  400. <span>工作负责人</span>
  401. <div class="yiyun_line"></div>
  402. <!-- 项目负责人选择前 isSlectPal -->
  403. <div class="main_workerBox" v-if="listManagerComputed(selectedUser).length == 0">
  404. <i class="icon font_family icon-icon_huangguan-weijihuo largehuangguan"></i>
  405. <div class="rentou_alrge"></div>
  406. </div>
  407. <!-- 项目负责人选择后 -->
  408. <div v-if="listManagerComputed(selectedUser).length != 0">
  409. <!-- <div class="user_info_item mainpeople_H" v-for="(user, index) in listManagerComputed(
  410. selectedUser
  411. )" :key="index"> -->
  412. <div class="user_info_item mainpeople_H" v-for="(user, index) in selectedUser" :key="index">
  413. <i class="icon font_family icon-icon_huangguan-jihuo middlehuangguan fl" title="负责人"></i>
  414. <!-- <img v-lazy="headSrc + user.headImgUrl" alt="" class="user_info_faceImg" /> -->
  415. <img :src="user.headImgUrl | resolveAvator" alt="" class="user_info_faceImg" />
  416. <span class="user_info_name">{{ user.cnName }}</span>
  417. <el-popover placement="bottom-start" width="180" trigger="hover">
  418. <ul class="popover_ul popover_ul">
  419. <li>
  420. <a href="javascript:;">{{ user.roleName }}</a>
  421. </li>
  422. <li>
  423. <a href="javascript:;">{{ user.phone }}</a>
  424. </li>
  425. <li>
  426. <a href="javascript:;">所在项目{{ user.projCount }}个</a>
  427. </li>
  428. </ul>
  429. <span class="user_info_job" slot="reference">{{
  430. user.position
  431. }}</span>
  432. </el-popover>
  433. <span class="user_info_role">
  434. <i class="el-icon-close largeclose" @click="removeManageUser(user)" title="移除负责人"></i>
  435. </span>
  436. </div>
  437. </div>
  438. <p class="diaTip">
  439. 工作负责人有且仅有一人,其将对:{{
  440. currWorkName
  441. }},进行职员指派。
  442. </p>
  443. </div>
  444. <div v-if="isShowStaffList">
  445. <div class="row_painfr" v-for="dept in listDeptComputed" :key="dept.deptID" >
  446. <div class="yiyun_line"></div>
  447. <div v-for="deptID in listDeptUserNoZero(selectedUser)" :key="deptID">
  448. <div v-if="deptID == dept.id">
  449. <div class="yiyun_line"></div>
  450. <span>{{dept.deptName}}</span>
  451. </div>
  452. </div>
  453. <!-- <div class="renyuanbox" v-for="(user,index) in listUserComputed(selectedUser)" :key="index"> -->
  454. <div class="renyuanbox" v-for="(user,index) in selectedUser" :key="index">
  455. <div class="user_info_item" v-if="user.deptId == dept.id">
  456. <!-- <img v-lazy="headSrc+user.headImgUrl" alt="" class="user_info_faceImg"> -->
  457. <img v-lazy="user.headImgUrl | resolveAvator" alt="" class="user_info_faceImg">
  458. <span class="user_info_name">{{user.cnName}}</span>
  459. <el-popover placement="bottom-start" width="180" trigger="hover">
  460. <ul class="popover_ul popover_ul">
  461. <li><a href="javascript:;">{{user.roleName}}</a></li>
  462. <li><a href="javascript:;">{{user.phone}}</a></li>
  463. <li><a href="javascript:;">所在项目{{user.projCount}}个</a></li>
  464. </ul>
  465. <span class="user_info_job" slot="reference">{{user.position}}</span>
  466. </el-popover>
  467. <span class="user_info_role">
  468. <template>
  469. <el-select v-model="user.folderPerm" placeholder="设置角色" class="setroleselect">
  470. <el-option v-for="item in roles" allow-create :key="item.value" :label="item.label"
  471. :value="item.value">
  472. <span style="float: left;margin-right:30px;">{{ item.label }}</span>
  473. <span style="float: right; color: #8492a6; font-size: 13px">{{ item.description }}</span>
  474. </el-option>
  475. </el-select>
  476. </template>
  477. <i class="el-icon-close" @click="removeSelectUser(user)" title="移除协作人"></i>
  478. </span>
  479. </div>
  480. </div>
  481. </div>
  482. </div>
  483. </div>
  484. </div>
  485. </div>
  486. <!-- 选择员工 -->
  487. <div v-show="isShowThreePage" class="PaincenterBox">
  488. <div class="xiezuobox">
  489. <!-- 左侧折叠面板 -->
  490. <div class="yiyun_col-6 bg_text_wirte mt-8">
  491. <div class="row_painfl">
  492. <!-- 折叠面板 -->
  493. <el-collapse accordion v-model="activeName">
  494. <!-- 添加协作群与工作 -->
  495. <el-collapse-item name="1" class="nomidline">
  496. <template slot="title">
  497. <el-checkbox class=" checkxiezuoren" style="color:white" v-model="ischeckAll" @change="handleCheckTopAll">全选</el-checkbox>
  498. <span class="checkBoxCol">从部门中选择职员</span>
  499. </template>
  500. <el-collapse accordion v-for="(dept, group_index) in listDept" v-show="dept.listUser.length>0" :key="group_index">
  501. <!-- 二级折叠面板 -->
  502. <el-collapse-item>
  503. <template slot="title">
  504. <span class=" checkBoxCol">{{ dept.deptName }}
  505. </span>
  506. <el-checkbox class="checkxiezuoren" style="color:white" v-model="dept.selected" :key="group_index" @change="
  507. handleCheckItemAll(group_index, $event)
  508. ">全选</el-checkbox>
  509. </template>
  510. <!-- <div class="user_info_item" v-for="(user, index) in listUserStaff(
  511. dept.listUser
  512. )" :label="user" :key="index"> -->
  513. <div class="user_info_item" v-for="(user, index) in dept.listUser" :label="user" :key="index">
  514. <el-checkbox class="checkBoxCol" v-model="user.selected" @change="
  515. handleCheckedOne(group_index, user, $event)
  516. " :disabled="disabled">
  517. <div class="checkboxlabelitem">
  518. <!-- <img v-lazy="headSrc + user.headImgUrl" alt="" class="user_info_faceImg" /> -->
  519. <img :src="user.headImgUrl | resolveAvator" alt="" class="user_info_faceImg" />
  520. <span class="user_info_name">{{
  521. user.cnName
  522. }}</span>
  523. <el-popover placement="bottom-start" width="180" trigger="hover">
  524. <ul class="popover_ul popover_ul">
  525. <li>
  526. <a href="javascript:;">{{
  527. user.companyName
  528. }}</a>
  529. </li>
  530. <li>
  531. <a href="javascript:;">{{
  532. user.phone
  533. }}</a>
  534. </li>
  535. <li>
  536. <a href="javascript:;">所在项目{{ user.projCount }}个</a>
  537. </li>
  538. </ul>
  539. <span class="user_info_job" slot="reference">{{ user.position}}</span>
  540. </el-popover>
  541. <span class="user_info_role">{{
  542. user.roleName
  543. }}</span>
  544. </div>
  545. </el-checkbox>
  546. </div>
  547. </el-collapse-item>
  548. </el-collapse>
  549. </el-collapse-item>
  550. </el-collapse>
  551. </div>
  552. </div>
  553. <div class="shuxian"></div>
  554. <!-- 右侧折叠面板 -->
  555. <div class="yiyun_col-6">
  556. <h4 class="rightXiezuoren" v-if="isShowManager">已选职员</h4>
  557. <h4 class="rightXiezuoren" v-if="!isShowManager">已选项目负责人</h4>
  558. <div class="row_painfr" v-if="isShowManager">
  559. <div class="yiyun_line"></div>
  560. <span>工作负责人</span>
  561. <div class="yiyun_line"></div>
  562. <!-- 项目负责人选择前 -->
  563. <!-- <div class="main_workerBox" v-if="listManagerComputed(selectedUser).length == 0"> -->
  564. <div class="main_workerBox" v-if="selectedUser.length == 0">
  565. <i class="icon font_family icon-icon_huangguan-weijihuo largehuangguan"></i>
  566. <div class="rentou_alrge"></div>
  567. </div>
  568. <!-- 项目负责人选择后 -->
  569. <!-- <div v-if="listManagerComputed(selectedUser).length != 0"> -->
  570. <div v-if="selectedUser.length != 0">
  571. <!-- <div class="user_info_item mainpeople_H" v-for="(user, index) in listManagerComputed(
  572. selectedUser
  573. )" :key="index"> -->
  574. <div class="user_info_item mainpeople_H" v-for="(user, index) in selectedUser" :key="index">
  575. <i class="icon font_family icon-icon_huangguan-jihuo middlehuangguan fl" title="负责人"></i>
  576. <!-- <img v-lazy="headSrc + user.headImgUrl" alt="" class="user_info_faceImg" /> -->
  577. <img :src="user.headImgUrl | resolveAvator" alt="" class="user_info_faceImg" />
  578. <span class="user_info_name">{{ user.cnName }}</span>
  579. <el-popover placement="bottom-start" width="180" trigger="hover">
  580. <ul class="popover_ul popover_ul">
  581. <li>
  582. <a href="javascript:;">{{ user.roleName }}</a>
  583. </li>
  584. <li>
  585. <a href="javascript:;">{{ user.phone }}</a>
  586. </li>
  587. <li>
  588. <a href="javascript:;">所在项目{{ user.projCount }}个</a>
  589. </li>
  590. </ul>
  591. <span class="user_info_job" slot="reference">{{user.position}}</span>
  592. </el-popover>
  593. <span class="user_info_role" @click="removeManageUser(user)">修改</span>
  594. </div>
  595. </div>
  596. <p class="diaTip">
  597. 工作负责人有且仅有一人,其将对:{{
  598. currWorkName
  599. }},进行职员指派。
  600. </p>
  601. </div>
  602. <div v-if="isShowStaffList">
  603. <div class="row_painfr" v-for="dept in listDept" v-show="dept.listUser.length > 0" :key="dept.id">
  604. <div v-for="deptID in listDeptUserNoZero(selectedUser)" :key="deptID">
  605. <div v-if="deptID == dept.id">
  606. <div class="yiyun_line"></div>
  607. <span>{{ dept.deptName }}</span>
  608. </div>
  609. </div>
  610. <div class="renyuanbox" v-for="(user, index) in listUserComputed(selectedUser)" :key="index">
  611. <div class="user_info_item" v-if="user.deptId == dept.id">
  612. <!-- <img v-lazy="headSrc + user.headImgUrl" alt="" class="user_info_faceImg" /> -->
  613. <img :src="user.headImgUrl | resolveAvator" alt="" class="user_info_faceImg" />
  614. <span class="user_info_name">{{ user.cnName }}</span>
  615. <el-popover placement="bottom-start" width="180" trigger="hover">
  616. <ul class="popover_ul popover_ul">
  617. <li>
  618. <a href="javascript:;">{{ user.roleName }}</a>
  619. </li>
  620. <li>
  621. <a href="javascript:;">{{ user.phone }}</a>
  622. </li>
  623. <li>
  624. <a href="javascript:;">所在项目{{ user.projCount }}个</a>
  625. </li>
  626. </ul>
  627. <span class="user_info_job" slot="reference">{{
  628. user.position
  629. }}</span>
  630. </el-popover>
  631. <span class="user_info_role" v-if="isShowManager">
  632. <template>
  633. <el-select v-model="user.folderPerm" placeholder="设置角色" class="setroleselect">
  634. <el-option v-for="item in roles" allow-create :key="item.value" :label="item.label" :value="item.value">
  635. <span style="float: left;margin-right:30px;">{{ item.label }}</span>
  636. <!-- <span style="float: right; color: #8492a6; font-size: 13px">{{ item.description }}</span> -->
  637. </el-option>
  638. </el-select>
  639. </template>
  640. <i class="el-icon-close" @click="removeSelectUser(user)" title="移除协作人"></i>
  641. </span>
  642. <span class="user_info_role" v-if="!isShowManager">
  643. <template>
  644. <span style="float: left;margin-right:30px;">查看与编辑</span>
  645. </template>
  646. <i class="el-icon-close" @click="removeSelectUser(user)" title="移除项目负责人"></i>
  647. </span>
  648. </div>
  649. </div>
  650. </div>
  651. </div>
  652. </div>
  653. </div>
  654. </div>
  655. </div>
  656. </div>
  657. </div>
  658. </div>
  659. </div>
  660. </template>
  661. <script>
  662. import { getUserInfo, fetchAddressBook, getUserListByNode} from '@/services/user.js';
  663. export default {
  664. data() {
  665. return {
  666. imgSrc: process.env.API_HOST + "archives/cover?path=",
  667. headSrc: process.env.API_HOST + "archives/head?path=",
  668. cnName: "",
  669. selectedUser: [], // 当前文件夹的已选协作人
  670. selectedManageUser: [], // 当前文件夹的已选负责人
  671. showTitle: "1", //默认显示标题
  672. disabled: false, //添加合作人可点击
  673. checked: false,
  674. activeName: "1",
  675. showAll: false, //项目信息概况
  676. isBottomNewProj: false, //底部弹框
  677. nodeLeaves: false, //工作树叶子
  678. isShowStaffList: false, //显示项目负责人
  679. opentree: true, //工作树三角
  680. ischeckAll: false, //是否是全部选中
  681. nowProject: {},
  682. isShowPrjDesc: false, //分配项目--项目概况
  683. isSlectPal: true, //分配项目--项目概况
  684. roles: [
  685. {
  686. value: 1,
  687. label: "编辑和查看",
  688. description: ""
  689. },
  690. {
  691. value: 0,
  692. label: "仅查看",
  693. description: ""
  694. }],
  695. folderPerm: "1",
  696. // -----------------------------------------------
  697. isShowFirstPage: true,
  698. isShowSecondPage: false,
  699. isShowThreePage: false,
  700. InitData: [],
  701. listNewFolder: [],
  702. listProjProp: [],
  703. listDept: [],
  704. curProjCreatePeop: [],
  705. currWorkName: "",
  706. newProjFolderIndex:1,
  707. tempIndex:0,
  708. isShowdivid2:false,
  709. currSelectData:[],
  710. currUser:JSON.parse(sessionStorage.user),
  711. isShowManager:true,// 当前是否是设置项目负责人
  712. listManagerUser:[], //项目负责人
  713. isProjManager: false,
  714. currListDeptUserData:[]
  715. };
  716. },
  717. created:function(){
  718. this.loadProjManager();
  719. },
  720. mounted: function () {
  721. this._getUserInfo(sessionStorage.createUserID);
  722. this.getNowProject();
  723. this.getListProjProp();
  724. this.listFolderChildren();
  725. this.listDeptUsers();
  726. this.loadListManagerUser();
  727. this.cnName = JSON.parse(sessionStorage.user).cnName;
  728. // 监听滚动事件
  729. window.addEventListener('scroll',this.handleScroll,true);
  730. // 获取部门列表信息
  731. this.fetchPlainDeptUserList(this.$store.state.currentCompanyId).then(list => {
  732. this.listDept = list;
  733. this.listDept = [...this.listDept];
  734. console.log('1111111111111111111111111',this.listDept);
  735. // 对listDept进行过滤 不显示与当前用户相同的用户
  736. this.listDept.some(dept => {
  737. dept.listUser.some((user, index) => {
  738. if(this.$store.state.accountId === user.id) {
  739. dept.listUser.splice(index, 1);
  740. return true;
  741. }
  742. })
  743. })
  744. this.currListDeptUserData = [...this.listDept];
  745. }).catch(err => {
  746. console.log(err);
  747. })
  748. },
  749. computed: {
  750. /**
  751. * 过滤后的部门列表:去除没有用户数据的部门
  752. */
  753. listDeptComputed: function () {
  754. return this.listDept.filter(function (dept) {
  755. return dept.listUser.length > 0;
  756. });
  757. },
  758. /**
  759. * 过滤后的已选择负责人列表
  760. */
  761. listManagerComputed: function () {
  762. return function (listUsers) {
  763. return listUsers.filter(function(user) {
  764. return user.folderPerm == 2;
  765. });
  766. };
  767. },
  768. /**
  769. * 过滤后的已选择非负责人列表
  770. */
  771. listUserComputed: function () {
  772. return function (listUsers) {
  773. return listUsers.filter(function(user) {
  774. return user.folderPerm != 2;
  775. });
  776. };
  777. },
  778. /**
  779. * 过滤后的左侧负责人列表
  780. */
  781. listUserManager: function (listUsers) {
  782. return function (listUsers) {
  783. return listUsers.filter(function (user) {
  784. return user.folderPerm == 2 || user.folderPerm == 0;
  785. });
  786. };
  787. },
  788. /**
  789. * 过滤后的左侧员工列表(staff员工)
  790. */
  791. listUserStaff: function (listUsers) {
  792. var thisApp = this;
  793. return function (listUsers) {
  794. return listUsers.filter(function (user) {
  795. return user.folderPerm != 2;
  796. });
  797. };
  798. },
  799. /**
  800. * 当未选择人员时,部门不显示
  801. */
  802. listDeptUserNoZero: function (user) {
  803. return function (user) {
  804. let temp = [];
  805. for (let i = 0; i < user.length; i++) {
  806. if (user[i].folderPerm != 2) {
  807. temp.push(user[i].deptId);
  808. }
  809. }
  810. var x = new Set(temp);
  811. return [...x];
  812. };
  813. }
  814. },
  815. methods: {
  816. /**
  817. * 判断用户是否是项目负责人
  818. */
  819. loadProjManager: function () {
  820. var thisApp = this;
  821. this.$axios({
  822. method: "get",
  823. url: encodeURI(
  824. process.env.API_HOST +
  825. "projects/manager/" +
  826. sessionStorage.projId +
  827. "/" +
  828. sessionStorage.userId
  829. )
  830. })
  831. .then(response => {
  832. if (response.data != null && response.data != "") {
  833. thisApp.isProjManager = response.data.isProjManager;
  834. }
  835. })
  836. .catch(error => {
  837. console.log(error);
  838. });
  839. },
  840. /**
  841. * 检测bigbody滚动距离添加样式
  842. */
  843. handleScroll:function(){
  844. let scrollBody= document.getElementById("bottomDiaChild2");
  845. if(scrollBody.scrollTop&&scrollBody.scrollTop > 0){
  846. this.isShowdivid2 =true
  847. }else{
  848. this.isShowdivid2 =false
  849. }
  850. },
  851. /**
  852. * 初始底部弹框
  853. */
  854. isAllhide: function () {
  855. this.isShowPrjDesc = false;
  856. this.isShowThreePage = false; //分配工作人员面板
  857. this.isShowSecondPage = false; //分配负责人面板
  858. },
  859. /*
  860. * 关闭新建项目弹框
  861. */
  862. offDialog: function () {
  863. this.selectedUser = [];
  864. this.selectedManageUser = [];
  865. this.$emit("offDialog", this.$route.name);
  866. },
  867. /*
  868. *隐藏项目弹框,显示底部弹框
  869. */
  870. showzhankai: function () {
  871. this.isBottomNewProj = true;
  872. },
  873. /**
  874. * 项目窗口展现
  875. */
  876. showContinueNewProj: function () {
  877. this.isBottomNewProj = false;
  878. },
  879. /*
  880. *返回文件夹页面
  881. */
  882. backFirstPage: function () {
  883. // this.listDept=JSON.parse(JSON.stringify(this.currListDeptUserData));
  884. if(!this.isShowManager)
  885. {
  886. this.listManagerUser=[];
  887. this.selectedUser.forEach(user => {
  888. if( user.id != this.currUser.userInfo.id)
  889. {
  890. this.listManagerUser.push(user);
  891. }
  892. });
  893. }
  894. this.isAllhide();
  895. this.isShowManager=true;
  896. this.isShowFirstPage = true;
  897. },
  898. toFirstPage(){
  899. this.$confirm("退出职员选择将清空您的所有操作!确定返回吗?", "", {
  900. confirmButtonText: "退出",
  901. cancelButtonText: "取消",
  902. showClose:false,
  903. type: "warning"
  904. }).then(() => {
  905. for (var i = 0; i < this.listNewFolder.length; i++) {
  906. if( this.listNewFolder[i].folderID==this.currSelectData.folderID){
  907. this.listNewFolder[i] = this.currSelectData;
  908. }
  909. for (var j = 0; j < this.listNewFolder[i].listChildren.length; j++) {
  910. if( this.listNewFolder[i].listChildren[j].folderID==this.currSelectData.folderID){
  911. this.listNewFolder[i].listChildren[j] = this.currSelectData;
  912. }
  913. }
  914. }
  915. this.listDept=JSON.parse(JSON.stringify(this.currListDeptUserData));
  916. this.isAllhide();
  917. this.isShowFirstPage = true;
  918. this.isShowManager=true;
  919. });
  920. },
  921. /*
  922. *指派员工页面
  923. */
  924. toThreePage: function () {
  925. this.isShowSecondPage = false;
  926. this.isShowFirstPage = false;
  927. this.isShowThreePage = true;
  928. this.isShowStaffList = true;
  929. },
  930. toSecondPage: function () {
  931. this.isShowSecondPage = true;
  932. this.isShowFirstPage = false;
  933. this.isShowThreePage = false;
  934. this.isShowStaffList = false;
  935. },
  936. /*
  937. *分配完成并关闭窗体
  938. */
  939. submitAndClose: function () {
  940. this.createFolders();
  941. },
  942. /*
  943. *编辑自定义工作
  944. */
  945. eidtTitle: function (index) {
  946. // this.newProjData.listFolder;
  947. this.tempIndex=index;
  948. this.showTitle = 2;
  949. },
  950. /*
  951. *保存自定义工作
  952. */
  953. saveTitle: function (index) {
  954. this.tempIndex=0;
  955. this.showTitle = 1
  956. },
  957. /*
  958. *删除新建项目的自定义工作
  959. */
  960. deleTitle: function (index) {
  961. this.listNewFolder.splice(index, 1);
  962. },
  963. /**
  964. * 添加自定义工作-创建项目时
  965. */
  966. addProjFolderWork: function () {
  967. this.eidtTitle(this.listNewFolder.length);
  968. this.newfolder = {
  969. superID:this.listNewFolder[0].superID,
  970. folderName: '自定义工作' + this.newProjFolderIndex,
  971. default: false,
  972. deleted: 0,
  973. listUser: [],
  974. manageUser: [],
  975. listChildren:[],
  976. listNotice:[],
  977. listsShareFrom:[]
  978. }
  979. this.listNewFolder.push(this.newfolder); //新增工作
  980. this.newProjFolderIndex = this.newProjFolderIndex + 1;
  981. },
  982. /**
  983. * 设置负责人
  984. */
  985. setManagerUser: function (nowUser) {
  986. if (this.InitData.manageUser.length != 0) {
  987. this.InitData.manageUser[0].selected = false;
  988. // this.InitData.manageUser[0].roleName = "普通职员";
  989. for (var i = 0; i < this.selectedUser.length; i++) {
  990. if (
  991. this.selectedUser[i].userID == this.InitData.manageUser[0].userID
  992. ) {
  993. this.InitData.manageUser[0].folderPerm = 0;
  994. this.selectedUser.splice(i, 1);
  995. }
  996. }
  997. }
  998. var listManageUser = [];
  999. nowUser.folderPerm = 2;
  1000. listManageUser.push(nowUser);
  1001. this.selectedUser.forEach(user => {
  1002. if (user.folderPerm == 2 && user.userID != nowUser.userID) {
  1003. user.folderPerm = 1;
  1004. }
  1005. if (user.userID == nowUser.userID) {
  1006. user.folderPerm = 2;
  1007. }
  1008. });
  1009. this.InitData.manageUser = listManageUser;
  1010. },
  1011. /**
  1012. * 分配人员
  1013. */
  1014. aloneAddUserForFolder: function (data,index) {
  1015. this.currSelectData=data;
  1016. this.currWorkName = data.folderName;
  1017. if (data.listUser == null) {
  1018. data.listUser = [];
  1019. if (this.isShowSecondPage == true) {
  1020. this.isShowStaffList = false;
  1021. }
  1022. }
  1023. this.InitData = data;
  1024. this.setFolderPerm(data);
  1025. this.selectedUser = data.listUser;
  1026. this.selectedManageUser = data.manageUser;
  1027. this.isShowSecondPage = true;
  1028. this.isShowFirstPage = false;
  1029. },
  1030. /**
  1031. * 进入时,重置权限
  1032. */
  1033. setFolderPerm: function (data) {
  1034. this.listDept=JSON.parse(JSON.stringify(this.currListDeptUserData));
  1035. for (var j = 0; j < this.listDept.length; j++) {
  1036. for (var k = 0; k < this.listDept[j].listUser.length; k++) {
  1037. this.listDept[j].listUser[k]['selected'] = false;
  1038. for (var i = 0; i < data.listUser.length; i++) {
  1039. if (
  1040. // this.listDept[j].listUser[k].userID == data.listUser[i].userID
  1041. this.listDept[j].listUser[k].id == data.listUser[i].id
  1042. ) {
  1043. this.listDept[j].listUser[k].folderPerm =
  1044. data.listUser[i].folderPerm;
  1045. this.listDept[j].listUser[k]['selected'] = true;
  1046. }
  1047. if(!this.isShowManager)
  1048. {
  1049. // if(this.currUser.accountId == sessionStorage.userId && sessionStorage.accountId == this.listDept[j].listUser[k].userID )
  1050. if(this.currUser.accountId == sessionStorage.userId && sessionStorage.accountId == this.listDept[j].listUser[k].id)
  1051. {
  1052. this.listDept[j].listUser[k].selected = true;
  1053. }
  1054. }
  1055. }
  1056. this.getIsCheckSecondLevel(j);
  1057. }
  1058. }
  1059. this.getIsCheckAll();
  1060. },
  1061. /*
  1062. *添加职员按钮直接进入 指派职员页面
  1063. */
  1064. aloneAddUserOnlyStaff: function (data) {
  1065. this.isShowManager=true;
  1066. this.currWorkName = data.folderName;
  1067. if (data.listUser == null) {
  1068. data.listUser = [];
  1069. }
  1070. this.isShowStaffList = true;
  1071. this.InitData = data;
  1072. this.setFolderPerm(data);
  1073. this.selectedUser = data.listUser;
  1074. this.selectedManageUser = data.manageUser;
  1075. this.isShowThreePage = true;
  1076. this.isShowFirstPage = false;
  1077. },
  1078. /**
  1079. * 根据部门Id查找部门信息
  1080. */
  1081. plainTreeNodes(nodesList, userList, outputList = []) {
  1082. (nodesList || []).forEach(node => {
  1083. // node.id
  1084. const data = node.data;
  1085. data.listUser = userList.filter(user => user.deptId === node.id);
  1086. outputList.push(data);
  1087. if(node.children && node.children.length) {
  1088. this.plainTreeNodes(node.children, userList, outputList);
  1089. }
  1090. });
  1091. return outputList;
  1092. },
  1093. async fetchPlainDeptUserList(companyId) {
  1094. const [treeDeptList, { list: userList }] = await Promise.all([
  1095. fetchAddressBook(companyId),
  1096. getUserListByNode({ id: companyId, nodeType: 'company' }, 1, 10000)
  1097. ]);
  1098. const deptHeadList = treeDeptList[0].children || [];
  1099. const oList = this.plainTreeNodes(deptHeadList, userList);
  1100. return oList.filter(dept => dept.listUser && dept.listUser.length);
  1101. },
  1102. /*
  1103. * 设置项目负责人
  1104. */
  1105. addProjManager:function(){
  1106. this.isShowManager=false;
  1107. this.isShowStaffList = true;
  1108. var data={listUser:[]};
  1109. data.listUser=this.listManagerUser;
  1110. this.setFolderPerm(data);
  1111. this.selectedUser = data.listUser;
  1112. this.selectedManageUser = [];
  1113. this.isShowThreePage = true;
  1114. this.isShowFirstPage = false;
  1115. },
  1116. /*
  1117. *顶部全选
  1118. * e:点击触发的事件
  1119. */
  1120. handleCheckTopAll(e) {
  1121. //首级全选
  1122. for (var j = 0; j < this.listDept.length; j++) {
  1123. if (this.listDept[j].listUser.length > 0) {
  1124. // this.handleCheckItemAll(j, false); //清除已经被选中的状态
  1125. this.handleCheckItemAll(j, e);
  1126. }
  1127. }
  1128. },
  1129. /*
  1130. *二级条目全选
  1131. * index:当前点击的条目位置
  1132. * e:点击触发的事件
  1133. */
  1134. handleCheckItemAll(index, e) {
  1135. for (var i = 0; i < this.listDept[index].listUser.length; i++) {
  1136. if (e) {
  1137. this.handleCheckedOne(index, this.listDept[index].listUser[i], false);
  1138. this.handleCheckedOne(index, this.listDept[index].listUser[i], e);
  1139. } else {
  1140. this.handleCheckedOne(index, this.listDept[index].listUser[i], e);
  1141. }
  1142. }
  1143. },
  1144. /*
  1145. *子项单选
  1146. * topIndex:当前所选条目的上级
  1147. *index:当前所选条目
  1148. * e:点击触发的事件
  1149. */
  1150. handleCheckedOne(topIndex, user, e) {
  1151. if(!this.isShowManager)
  1152. {
  1153. // if(user.id == sessionStorage.userId)
  1154. // {
  1155. // this.$notify.info({
  1156. // title: "温馨提示",
  1157. // message: "不能移除自己哦",
  1158. // offset: 100,
  1159. // duration: 5000
  1160. // });
  1161. // user.selected=true;
  1162. // return;
  1163. // }
  1164. if(user.id== this.currUser.accountId)
  1165. {
  1166. this.$notify.info({
  1167. title: "温馨提示",
  1168. message: "项目负责人已存在哦",
  1169. offset: 100,
  1170. duration: 5000
  1171. });
  1172. user.selected=false;
  1173. return;
  1174. }
  1175. }
  1176. // 跳过负责人
  1177. if(user.folderPerm == 2)
  1178. {
  1179. return;
  1180. }
  1181. //三级change事件
  1182. if (e) {
  1183. this.checkDeptUserName(e, user); //将选中的人员返回给添加合作人页面
  1184. user.folderPerm = 1;
  1185. } else {
  1186. this.checkDeptUserName(e, user); //将选中的人员返回给添加合作人页面
  1187. user.folderPerm = 0;
  1188. }
  1189. this.getIsCheckSecondLevel(topIndex);
  1190. this.getIsCheckAll();
  1191. },
  1192. /*
  1193. *选择负责人
  1194. */
  1195. handleCheckedOnlyOne(topIndex, user, e) {
  1196. //三级change事件
  1197. if (e) {
  1198. //将选中的人员返回给添加合作人页面
  1199. this.checkDeptUserName(e, user);
  1200. this.setManagerUser(user);
  1201. this.isSlectPal = false;
  1202. } else {
  1203. //将选中的人员返回给添加合作人页面
  1204. this.checkDeptUserName(e, user);
  1205. this.InitData.manageUser =[];
  1206. this.isSlectPal = true;
  1207. }
  1208. this.getIsCheckSecondLevel(topIndex);
  1209. this.getIsCheckAll();
  1210. },
  1211. /**
  1212. * 当前二级选中状态修正
  1213. */
  1214. getIsCheckSecondLevel(topIndex) {
  1215. var checkCount = 0;
  1216. for (var i = 0; i < this.listDept[topIndex].listUser.length; i++) {
  1217. if (this.listDept[topIndex].listUser[i].selected == true) {
  1218. checkCount++;
  1219. } else {
  1220. checkCount--;
  1221. }
  1222. }
  1223. if (checkCount == this.listDept[topIndex].listUser.length) {
  1224. //三级级全勾选
  1225. this.listDept[topIndex].selected = true;
  1226. } else {
  1227. //三级级全不勾选
  1228. this.listDept[topIndex].selected = false;
  1229. }
  1230. },
  1231. /*
  1232. *当前首级全选状态修正
  1233. */
  1234. getIsCheckAll() {
  1235. var checkCount = 0;
  1236. var haveDataCount = 0;
  1237. for (var j = 0; j < this.listDept.length; j++) {
  1238. //全选checkbox状态
  1239. if (this.listDept[j].listUser.length > 0) {
  1240. haveDataCount++;
  1241. if (this.listDept[j].selected == true) {
  1242. checkCount++;
  1243. }
  1244. }
  1245. }
  1246. // 取消如果还没有获取到数据 两个都为0 一打开就是全选按钮被选中的情况
  1247. if ((checkCount == haveDataCount) && checkCount !== 0 && haveDataCount !== 0) {
  1248. this.ischeckAll = true;
  1249. } else {
  1250. this.ischeckAll = false;
  1251. }
  1252. },
  1253. /**
  1254. * 移除选中人员
  1255. */
  1256. removeSelectUser: function (item) {
  1257. if(item.userID == sessionStorage.userId)
  1258. {
  1259. this.$notify.info({
  1260. title: "温馨提示",
  1261. message: "不能移除自己哦",
  1262. offset: 100,
  1263. duration: 5000
  1264. });
  1265. return;
  1266. }
  1267. this.checkDeptUserName(false, item);
  1268. this.cancelCheck(item.userID);
  1269. },
  1270. /**
  1271. * 移除负责人
  1272. */
  1273. removeManageUser: function (user) {
  1274. user.folderPerm = 0;
  1275. // user.roleName = "查看编辑";
  1276. for (var k = 0; k < this.selectedUser.length; k++) {
  1277. if (this.selectedUser[k].userID == user.userID) {
  1278. this.selectedUser[k].folderPerm = 0;
  1279. this.selectedUser.splice(k, 1);
  1280. }
  1281. }
  1282. this.cancelCheck(user.userID);
  1283. this.toSecondPage();
  1284. },
  1285. /*
  1286. *取消选中
  1287. */
  1288. cancelCheck: function (userID) {
  1289. for (var i = 0; i < this.listDept.length; i++) {
  1290. for (var j = 0; j < this.listDept[i].listUser.length; j++) {
  1291. if (this.listDept[i].listUser[j].userID === userID) {
  1292. this.listDept[i].listUser[j].selected = false;
  1293. this.listDept[i].listUser[j].folderPerm = 0;
  1294. this.getIsCheckSecondLevel(i);
  1295. }
  1296. }
  1297. }
  1298. this.getIsCheckAll();
  1299. },
  1300. /**
  1301. * 对已选协作人添加和删除
  1302. */
  1303. checkDeptUserName: function (checked, item) {
  1304. item.selected = checked;
  1305. if (checked) {
  1306. item.folderPerm = 1; // 默认角色为:查看和编辑
  1307. var valueUser = JSON.parse(JSON.stringify(item));
  1308. this.selectedUser.push(valueUser);
  1309. } else {
  1310. for (var i = 0; i < this.selectedUser.length; i++) {
  1311. if (this.selectedUser[i].userID == item.userID) {
  1312. this.selectedUser.splice(i, 1);
  1313. }
  1314. }
  1315. }
  1316. if (this.selectedUser.length > 0 && this.isShowThreePage == true) {
  1317. this.isShowStaffList = true;
  1318. } else {
  1319. this.isShowStaffList = false;
  1320. }
  1321. },
  1322. /**
  1323. * 查看项目概况
  1324. */
  1325. goShowPrjDesc: function () {
  1326. this.isShowPrjDesc = true;
  1327. this.isShowFirstPage = false;
  1328. },
  1329. /**
  1330. * 查看全部
  1331. */
  1332. showAllClick: function () {
  1333. this.showAll = true;
  1334. },
  1335. /**
  1336. * 展开
  1337. */
  1338. openECtree: function (data) {
  1339. this.nodeLeaves = true;
  1340. this.opentree = false;
  1341. },
  1342. /**
  1343. * 收起
  1344. */
  1345. closeECtree: function (data) {
  1346. this.nodeLeaves = false;
  1347. this.opentree = true;
  1348. },
  1349. /**
  1350. * 获取listprojprop
  1351. */
  1352. getListProjProp: function () {
  1353. this.$axios({
  1354. method: "get",
  1355. url: encodeURI(
  1356. process.env.API_HOST +
  1357. "templates/templateproperty/" +
  1358. sessionStorage.templateID +
  1359. "/" +
  1360. sessionStorage.projId
  1361. )
  1362. })
  1363. .then(response => {
  1364. this.listProjProp = response.data.data;
  1365. })
  1366. .catch(error => {
  1367. console.log(error);
  1368. });
  1369. },
  1370. /**
  1371. * 获取当前项目信息
  1372. */
  1373. getNowProject() {
  1374. // var thisApp = this;
  1375. // this.$axios({
  1376. // method: "get",
  1377. // url: encodeURI(
  1378. // process.env.API_HOST + "projects/project/" + sessionStorage.projId
  1379. // )
  1380. // })
  1381. // .then(response => {
  1382. // thisApp.nowProject = response.data;
  1383. // })
  1384. // .catch(error => {
  1385. // console.log(error);
  1386. // });
  1387. // const projectInfoRes = await prjService.QueryProjectInfoByProjId(id);
  1388. // this.nowProject=projectInfoRes.Data;
  1389. },
  1390. /**
  1391. * 加载需要分配的文件夹
  1392. */
  1393. listFolderChildren: function () {
  1394. var thisApp = this;
  1395. this.$axios({
  1396. method: "get",
  1397. url: encodeURI(
  1398. process.env.API_HOST +
  1399. "folders/allot/children/" +
  1400. sessionStorage.userId +
  1401. "/" +
  1402. sessionStorage.projId
  1403. )
  1404. })
  1405. .then(response => {
  1406. for (var i = 0; i < response.data.length; i++) {
  1407. thisApp.listNewFolder.push(response.data[i]);
  1408. }
  1409. })
  1410. .catch(error => {
  1411. console.log(error);
  1412. });
  1413. },
  1414. /**
  1415. * 获取全部的Dept数据
  1416. */
  1417. listDeptUsers: function () {
  1418. var companyId = sessionStorage.companyId;
  1419. var thisApp = this;
  1420. this.$axios({
  1421. method: "get",
  1422. url: encodeURI(process.env.API_HOST + "sysinfo/deptusers/" + companyId)
  1423. })
  1424. .then(response => {
  1425. thisApp.listDept = response.data.data;
  1426. thisApp.currListDeptUserData=response.data.data;
  1427. })
  1428. .catch(error => {
  1429. console.log(error);
  1430. });
  1431. },
  1432. //获取用户个人信息
  1433. async _getUserInfo(userId) {
  1434. try {
  1435. let res = await getUserInfo(userId);
  1436. this.curProjCreatePeop =
  1437. res.cnName + " 指派了新工作,请完成工作指派";
  1438. if (sessionStorage.allocated == 1)
  1439. {
  1440. this.curProjCreatePeop = "项目管理";
  1441. }
  1442. if(res.roleName === "项目负责人") {
  1443. this.isProjManager = true;
  1444. }
  1445. } catch(err) {
  1446. console.log(err);
  1447. }
  1448. },
  1449. // getUserInfo: function (userId) {
  1450. // var thisApp = this;
  1451. // this.$axios({
  1452. // method: "get",
  1453. // url: encodeURI(process.env.API_HOST + "sysinfo/user/" + userId)
  1454. // })
  1455. // .then(response => {
  1456. // var data = response.data;
  1457. // thisApp.curProjCreatePeop =
  1458. // data.cnName + "指派了新工作,请完成工作指派";
  1459. // if (sessionStorage.allocated == 1)
  1460. // {
  1461. // thisApp.curProjCreatePeop = "项目管理";
  1462. // }
  1463. // })
  1464. // .catch(error => {
  1465. // console.log(error);
  1466. // });
  1467. // },
  1468. /**
  1469. * 分配工作完成
  1470. */
  1471. createFolders: function () {
  1472. var thisApp = this;
  1473. var sendMethod = "put";
  1474. var param = {
  1475. superFolderId: "",
  1476. userId: sessionStorage.userId,
  1477. projId: sessionStorage.projId,
  1478. listFolder: thisApp.listNewFolder,
  1479. listManageUser:thisApp.listManagerUser
  1480. };
  1481. this.$axios({
  1482. method: sendMethod,
  1483. url: encodeURI(process.env.API_HOST + "folders/set"),
  1484. data: param
  1485. })
  1486. .then(response => {
  1487. if (response.data.state == 1) {
  1488. thisApp.$notify({
  1489. title: "恭喜您",
  1490. message: response.data.message,
  1491. type: "success",
  1492. offset: 100,
  1493. duration: 2500
  1494. });
  1495. thisApp.offDialog();
  1496. } else {
  1497. thisApp.$notify.error({
  1498. title: "温馨提示",
  1499. message: response.data.message,
  1500. offset: 100,
  1501. duration: 5000
  1502. });
  1503. }
  1504. })
  1505. .catch(error => {
  1506. console.log(error);
  1507. });
  1508. },
  1509. /**
  1510. * 加载需要分配的文件夹
  1511. */
  1512. loadListManagerUser: function () {
  1513. var thisApp = this;
  1514. this.$axios({
  1515. method: "get",
  1516. url: encodeURI(
  1517. process.env.API_HOST +
  1518. "projects/manager/user/" +
  1519. sessionStorage.projId +"/"+sessionStorage.userId
  1520. )
  1521. })
  1522. .then(response => {
  1523. thisApp.listManagerUser=response.data.listManager;
  1524. thisApp.currUser=response.data.defaultManager;
  1525. })
  1526. .catch(error => {
  1527. console.log(error);
  1528. });
  1529. },
  1530. /**
  1531. * 设置与用户的positon 相对应的字段映射
  1532. */
  1533. },
  1534. beforeDestroy(){
  1535. // 销毁监听
  1536. window.removeEventListener('scroll', this.handleScroll,true)
  1537. }
  1538. };
  1539. </script>
  1540. <style scoped lang="scss">
  1541. ::v-deep .el-checkbox:last-of-type {
  1542. margin-right: 30px;
  1543. }
  1544. </style>