addNode.vue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233
  1. <template>
  2. <div class="add-node-btn-box">
  3. <div class="add-node-btn">
  4. <el-popover placement="right-start" v-model="visible" width="auto" v-if="!props.operateShow">
  5. <div class="add-node-popover-body">
  6. <a class="add-node-popover-item approver" @click="addType(1)">
  7. <div class="item-wrapper">
  8. <span class="iconfont"></span>
  9. </div>
  10. <p>审批人</p>
  11. </a>
  12. <a class="add-node-popover-item notifier" @click="addType(4)">
  13. <div class="item-wrapper">
  14. <span class="iconfont"></span>
  15. </div>
  16. <p>抄送人</p>
  17. </a>
  18. <a class="add-node-popover-item condition" @click="addType(2)">
  19. <div class="item-wrapper">
  20. <span class="iconfont"></span>
  21. </div>
  22. <p>条件分支</p>
  23. </a>
  24. </div>
  25. <template #reference>
  26. <button class="btn" type="button">
  27. <span class="iconfont"></span>
  28. </button>
  29. </template>
  30. </el-popover>
  31. </div>
  32. </div>
  33. </template>
  34. <script lang="ts" setup>
  35. import { ref } from 'vue'
  36. const props = defineProps({
  37. childNodeP: {
  38. type: Object,
  39. default: () => ({})
  40. },
  41. operateShow: {
  42. type: Boolean,
  43. default: false
  44. }
  45. })
  46. const emits = defineEmits(['update:childNodeP'])
  47. const visible = ref(false)
  48. const addType = (type: any) => {
  49. visible.value = false
  50. if (type != 2) {
  51. let data
  52. if (type == 1) {
  53. data = {
  54. nodeName: '',
  55. error: true,
  56. nodeType: 1,
  57. settype: 1,
  58. selectMode: 1,
  59. directorLevel: 1,
  60. approvalType: 'or',
  61. examineMode: 1,
  62. noHanderAction: 1,
  63. childNode: props.childNodeP,
  64. subjects: []
  65. }
  66. } else if (type == 4) {
  67. data = {
  68. nodeName: '抄送人',
  69. nodeType: 4,
  70. ccSelfSelectFlag: 1,
  71. copyTo: [],
  72. childNode: props.childNodeP,
  73. subjects: []
  74. }
  75. }
  76. emits('update:childNodeP', data)
  77. } else {
  78. emits('update:childNodeP', {
  79. nodeName: '路由',
  80. nodeType: 2,
  81. childNode: null,
  82. conditionNodes: [
  83. {
  84. nodeName: '条件1',
  85. error: true,
  86. nodeType: 3,
  87. priorityLevel: 1,
  88. condGroup: {
  89. type: 'and',
  90. items: []
  91. },
  92. subjects: [],
  93. childNode: props.childNodeP
  94. },
  95. {
  96. nodeName: '条件2',
  97. nodeType: 3,
  98. priorityLevel: 2,
  99. condGroup: {
  100. type: 'default',
  101. items: []
  102. },
  103. subjects: [],
  104. childNode: null
  105. }
  106. ]
  107. })
  108. }
  109. }
  110. </script>
  111. <style scoped lang="scss">
  112. .add-node-btn-box {
  113. width: 240px;
  114. display: -webkit-inline-box;
  115. display: -ms-inline-flexbox;
  116. display: inline-flex;
  117. -ms-flex-negative: 0;
  118. flex-shrink: 0;
  119. -webkit-box-flex: 1;
  120. -ms-flex-positive: 1;
  121. position: relative;
  122. &:before {
  123. content: '';
  124. position: absolute;
  125. top: 0;
  126. left: 0;
  127. right: 0;
  128. bottom: 0;
  129. z-index: -1;
  130. margin: auto;
  131. width: 2px;
  132. height: 100%;
  133. background-color: #cacaca;
  134. }
  135. .add-node-btn {
  136. user-select: none;
  137. width: 240px;
  138. padding: 20px 0 32px;
  139. display: flex;
  140. -webkit-box-pack: center;
  141. justify-content: center;
  142. flex-shrink: 0;
  143. -webkit-box-flex: 1;
  144. flex-grow: 1;
  145. .btn {
  146. outline: none;
  147. box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.1);
  148. width: 30px;
  149. height: 30px;
  150. background: #3296fa;
  151. border-radius: 50%;
  152. position: relative;
  153. border: none;
  154. line-height: 30px;
  155. -webkit-transition: all 0.3s cubic-bezier(0.645, 0.045, 0.355, 1);
  156. transition: all 0.3s cubic-bezier(0.645, 0.045, 0.355, 1);
  157. .iconfont {
  158. color: #fff;
  159. font-size: 16px;
  160. }
  161. &:hover {
  162. transform: scale(1.3);
  163. box-shadow: 0 13px 27px 0 rgba(0, 0, 0, 0.1);
  164. }
  165. &:active {
  166. transform: none;
  167. background: #1e83e9;
  168. box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.1);
  169. }
  170. }
  171. }
  172. }
  173. </style>
  174. <style lang="scss">
  175. .add-node-popover-body {
  176. display: flex;
  177. .add-node-popover-item {
  178. margin-right: 10px;
  179. cursor: pointer;
  180. text-align: center;
  181. flex: 1;
  182. color: #191f25 !important;
  183. .item-wrapper {
  184. user-select: none;
  185. display: inline-block;
  186. width: 80px;
  187. height: 80px;
  188. margin-bottom: 5px;
  189. background: #fff;
  190. border: 1px solid #e2e2e2;
  191. border-radius: 50%;
  192. transition: all 0.3s cubic-bezier(0.645, 0.045, 0.355, 1);
  193. .iconfont {
  194. font-size: 35px;
  195. line-height: 80px;
  196. }
  197. }
  198. &.approver {
  199. .item-wrapper {
  200. color: #ff943e;
  201. }
  202. }
  203. &.notifier {
  204. .item-wrapper {
  205. color: #3296fa;
  206. }
  207. }
  208. &.condition {
  209. .item-wrapper {
  210. color: #15bc83;
  211. }
  212. }
  213. &:hover {
  214. .item-wrapper {
  215. background: #3296fa;
  216. box-shadow: 0 10px 20px 0 rgba(50, 150, 250, 0.4);
  217. }
  218. .iconfont {
  219. color: #fff;
  220. }
  221. }
  222. &:active {
  223. .item-wrapper {
  224. box-shadow: none;
  225. background: #eaeaea;
  226. }
  227. .iconfont {
  228. color: inherit;
  229. }
  230. }
  231. }
  232. }
  233. </style>