approveNode.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280
  1. <template>
  2. <div class="approve-node-wrap node-wrap">
  3. <div class="node-content">
  4. <div class="head">
  5. <span class="icon"></span>
  6. <span class="name">{{$t('SystemManage.ReportApprove.reviewer')}}</span>
  7. <span class="icon-btn" @click="removeNode"><i class="el-icon-close"></i></span>
  8. </div>
  9. <div class="content" @click="showDrawer">
  10. <ul class="approver-list" v-if="flowNode.approvers.length">
  11. <li class="list-item" v-for="(item,index) in flowNode.approvers" :key="item.NodeIdKey">
  12. {{item.NodeName}}{{index===flowNode.approvers.length-1?'':'、'}}
  13. </li>
  14. </ul>
  15. <span v-else style="color:#0052D9;display: flex;align-items: center;">
  16. <img src="~@/assets/img/approve_m/select.png">
  17. {{$t('SystemManage.ReportApprove.placeholder03')}}
  18. </span>
  19. </div>
  20. </div>
  21. <AddNode :node="flowNode" v-on="$listeners"/>
  22. <el-drawer
  23. direction="rtl"
  24. :visible.sync="drawerShow"
  25. :withHeader="true"
  26. :modal-append-to-body="false"
  27. >
  28. <div class="approve-drawer-wrap">
  29. <div class="header">
  30. <p>{{$t('SystemManage.ReportApprove.approver_set')}}</p>
  31. <span class="close-icon" @click="drawerShow=false" style="cursor: pointer;"><i class="el-icon-close"></i></span>
  32. </div>
  33. <div class="drawer-content">
  34. <div class="block">
  35. <p>{{$t('SystemManage.ReportApprove.select_appriver')}}</p>
  36. <div class="choose-box">
  37. <el-radio v-model="block1" :label="1">{{$t('SystemManage.ReportApprove.designate_personnel')}}</el-radio>
  38. <el-button @click="chooseDialogShow=true" type="primary">
  39. <i class="el-icon-circle-plus-outline" style="margin-right: 5px;"></i>
  40. {{$t('SystemManage.ReportApprove.select_user')}}
  41. </el-button>
  42. </div>
  43. <draggable
  44. v-model="choosedList"
  45. animation="300"
  46. tag="ul"
  47. class="approve-list">
  48. <li class="list-item" v-for="item in choosedList" :key="item.NodeIdKey">
  49. <span class="name">{{item.NodeName}}</span>
  50. <span class="icon-btn">
  51. <i class="el-icon-close" @click.stop="removeChoosedItem(item)"></i>
  52. </span>
  53. </li>
  54. </draggable>
  55. </div>
  56. <div class="line"></div>
  57. <div class="block" style="margin-top:30px;">
  58. <p>{{$t('SystemManage.ReportApprove.mutl_person')}}</p>
  59. <el-radio-group v-model="approveType">
  60. <!-- <el-radio :label="1">
  61. {{$t('SystemManage.ReportApprove.approval_type01')}}
  62. <el-tooltip effect="dark" placement="top" :content="$t('SystemManage.ReportApprove.des01')" >
  63. <span class="hint-text">
  64. <i class="el-icon-info"></i>
  65. </span>
  66. </el-tooltip>
  67. </el-radio> -->
  68. <el-radio :label="2">
  69. {{$t('SystemManage.ReportApprove.approval_type02')}}
  70. <el-tooltip effect="dark" placement="top" :content="$t('SystemManage.ReportApprove.des02')" >
  71. <span class="hint-text">
  72. <i class="el-icon-info"></i>
  73. </span>
  74. </el-tooltip>
  75. </el-radio>
  76. <el-radio :label="3">
  77. {{$t('SystemManage.ReportApprove.approval_type03')}}
  78. <el-tooltip effect="dark" placement="top" :content="$t('SystemManage.ReportApprove.des03')" >
  79. <span class="hint-text">
  80. <i class="el-icon-info"></i>
  81. </span>
  82. </el-tooltip>
  83. </el-radio>
  84. </el-radio-group>
  85. </div>
  86. </div>
  87. <div class="drawer-btn">
  88. <el-button type="primary" plain @click="drawerShow=false">{{$t('Dialog.cancel_btn')}}</el-button>
  89. <el-button type="primary" @click="editApproveNode">{{$t('Dialog.confirm_btn')}}</el-button>
  90. </div>
  91. </div>
  92. </el-drawer>
  93. <!-- 选择人员弹窗 -->
  94. <el-dialog
  95. :title="$t('SystemManage.ReportApprove.select_user')"
  96. width="600px"
  97. :visible.sync="chooseDialogShow"
  98. :modal-append-to-body="false"
  99. :append-to-body="false"
  100. @close="chooseDialogShow=false"
  101. >
  102. <div class="dialog-wrap">
  103. <TreeTransfer
  104. ref="tree-trans"
  105. :defaultList="choosedList"
  106. :chooseDialogShow="chooseDialogShow"
  107. />
  108. </div>
  109. <div class="dialog-btn">
  110. <el-button type="primary" plain @click="chooseDialogShow=false">{{$t('Dialog.cancel_btn')}}</el-button>
  111. <el-button type="primary" @click="getChoosedList">{{$t('Dialog.confirm_btn')}}</el-button>
  112. </div>
  113. </el-dialog>
  114. </div>
  115. </template>
  116. <script>
  117. import TreeTransfer from '../treeTransfer';
  118. import draggable from 'vuedraggable';
  119. import AddNode from './addNode';
  120. export default {
  121. props:{
  122. flowNode:{
  123. type:Object,
  124. default:{}
  125. }
  126. },
  127. data() {
  128. return {
  129. drawerShow: false,
  130. block1: 1,
  131. approveType: 3,
  132. chooseDialogShow: false,
  133. choosedList:[]
  134. };
  135. },
  136. watch:{
  137. drawerShow(val){
  138. if(val){
  139. this.choosedList = _.cloneDeep(this.flowNode.approvers||[])
  140. this.approveType = this.flowNode.ApproveType
  141. }
  142. }
  143. },
  144. methods: {
  145. removeNode() {
  146. this.$emit('removeNode', this.flowNode);
  147. },
  148. showDrawer() {
  149. this.drawerShow = true;
  150. },
  151. getChoosedList(){
  152. if(!this.$refs["tree-trans"].choosedList.length){
  153. this.$message.warning(this.$t('SystemManage.ReportApprove.warning_msg01'))
  154. return
  155. }
  156. this.choosedList = _.cloneDeep(this.$refs["tree-trans"].choosedList)||[]
  157. this.chooseDialogShow = false
  158. },
  159. removeChoosedItem(item){
  160. const index = this.choosedList.findIndex(i=>i.NodeIdKey===item.NodeIdKey)
  161. index!==-1&&this.choosedList.splice(index,1)
  162. },
  163. editApproveNode(){
  164. const node = _.cloneDeep(this.flowNode)
  165. node.approvers = _.cloneDeep(this.choosedList)
  166. node.ApproveType = this.approveType
  167. this.$emit('editNode',node)
  168. this.drawerShow = false
  169. },
  170. },
  171. components: { TreeTransfer, draggable, AddNode }
  172. };
  173. </script>
  174. <style lang="scss">
  175. .approve-node-wrap{
  176. .el-drawer__body{
  177. overflow: hidden;
  178. }
  179. #el-drawer__title{ //drawer弹出时会自动聚焦第一个元素,设置无内容的title清除聚焦状态
  180. height:0px;
  181. margin:0px;
  182. padding:0px;
  183. }
  184. .dialog-btn{
  185. margin-top:60px;
  186. padding-bottom: 40px;
  187. text-align: center;
  188. }
  189. }
  190. </style>
  191. <style scoped lang="scss">
  192. .approve-node-wrap{
  193. .head{
  194. background-color: #0052D9;
  195. .icon{
  196. background-image: url('~@/assets/img/approve_m/approve.png');
  197. }
  198. .icon-btn{
  199. font-size: 20px;
  200. }
  201. }
  202. .content{
  203. .approver-list{
  204. color:#0052D9;
  205. display: flex;
  206. align-items: center;
  207. flex-wrap: wrap;
  208. }
  209. }
  210. .approve-drawer-wrap{
  211. height: 100%;
  212. display: flex;
  213. flex-direction: column;
  214. overflow: hidden;
  215. .header{
  216. display: flex;
  217. align-items: center;
  218. justify-content: space-between;
  219. /* font-weight: bold; */
  220. font-size: 18px;
  221. height:35px;
  222. padding:20px;
  223. border-bottom: 1px solid #C8CDD9;
  224. }
  225. .drawer-content{
  226. flex:1;
  227. overflow-y: auto;
  228. box-sizing: border-box;
  229. padding:30px;
  230. .block{
  231. min-height: 340px;
  232. .choose-box{
  233. margin-top: 20px;
  234. display: flex;
  235. justify-content: space-between;
  236. align-items: center;
  237. }
  238. }
  239. .line{
  240. margin:0 -30px;
  241. height: 1px;
  242. background-color:#C8CDD9;
  243. }
  244. .approve-list{
  245. margin-top: 10px;
  246. display: flex;
  247. flex-wrap: wrap;
  248. gap:10px;
  249. .list-item{
  250. cursor: move;
  251. padding:8px;
  252. border-radius: 4px;
  253. border:1px solid #C8CDD9;
  254. .icon-btn{
  255. cursor: pointer;
  256. }
  257. }
  258. }
  259. .el-radio-group{
  260. margin-top: 20px;
  261. .el-radio{
  262. display: block;
  263. margin-bottom: 10px;
  264. .hint-text{
  265. color:#C0C4CC;
  266. }
  267. }
  268. }
  269. }
  270. .drawer-btn{
  271. text-align: center;
  272. margin:10px;
  273. }
  274. }
  275. }
  276. </style>