send.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. <template>
  2. <div class="node-wrap">
  3. <div class="node-wrap-box">
  4. <div class="title" style="background: var(--el-color-primary)">
  5. <el-icon class="icon"><promotion /></el-icon>
  6. <span v-show="!isEditTitle" class="title_label" @click="editTitle('box_nodeTitle')"
  7. >{{ nodeConfig.nodeName }}<el-icon class="edit-icon"><edit /></el-icon
  8. ></span>
  9. <el-input
  10. v-show="isEditTitle"
  11. ref="box_nodeTitle"
  12. v-model="nodeConfig.nodeName"
  13. clearable
  14. size="small"
  15. @blur="saveTitle"
  16. @keyup.enter="saveTitle"
  17. ></el-input>
  18. <el-icon class="close" @click.stop="delNode()"><close /></el-icon>
  19. </div>
  20. <div class="content" @click="show">
  21. <span v-if="toText(nodeConfig)">{{ toText(nodeConfig) }}</span>
  22. <span v-else class="placeholder">请选择人员</span>
  23. </div>
  24. </div>
  25. <add-node v-model="nodeConfig.childNode"></add-node>
  26. <el-drawer v-model="drawer" title="抄送人设置" destroy-on-close append-to-body :size="500" class="aDrawer">
  27. <template #header>
  28. <div class="node-wrap-drawer__title">
  29. <label v-show="!isEditTitle" @click="editTitle('nodeTitle')"
  30. >{{ form.nodeName }}<el-icon class="node-wrap-drawer__title-edit"><edit /></el-icon
  31. ></label>
  32. <el-input v-show="isEditTitle" ref="nodeTitle" v-model="form.nodeName" clearable @blur="saveTitle" @keyup.enter="saveTitle"></el-input>
  33. </div>
  34. </template>
  35. <el-container>
  36. <el-main>
  37. <el-form label-position="top">
  38. <el-form-item label="选择要抄送的人员">
  39. <el-button type="primary" icon="plus" round @click="selectHandle(1, form.nodeUserList)">选择人员</el-button>
  40. <div class="tags-list">
  41. <el-tag v-for="(user, index) in form.nodeUserList" :key="user.id" closable @close="delUser(index)">{{ user.name }}</el-tag>
  42. </div>
  43. </el-form-item>
  44. <el-form-item label="">
  45. <el-checkbox v-model="form.allowSelection" label="允许发起人自选抄送人"></el-checkbox>
  46. </el-form-item>
  47. </el-form>
  48. </el-main>
  49. <el-footer>
  50. <el-button type="primary" @click="save">保存</el-button>
  51. <el-button @click="drawer = false">取消</el-button>
  52. </el-footer>
  53. </el-container>
  54. </el-drawer>
  55. </div>
  56. </template>
  57. <script>
  58. import addNode from './addNode'
  59. export default {
  60. components: {
  61. addNode
  62. },
  63. inject: ['select'],
  64. props: {
  65. modelValue: { type: Object, default: () => {} }
  66. },
  67. data() {
  68. return {
  69. nodeConfig: {},
  70. drawer: false,
  71. isEditTitle: false,
  72. form: {}
  73. }
  74. },
  75. watch: {
  76. modelValue() {
  77. this.nodeConfig = this.modelValue
  78. }
  79. },
  80. mounted() {
  81. this.nodeConfig = this.modelValue
  82. },
  83. methods: {
  84. show() {
  85. this.form = {}
  86. this.form = JSON.parse(JSON.stringify(this.nodeConfig))
  87. this.drawer = true
  88. },
  89. editTitle(refName) {
  90. this.isEditTitle = true
  91. this.$nextTick(() => {
  92. if (this.$refs[refName]) {
  93. this.$refs[refName].focus()
  94. }
  95. })
  96. },
  97. saveTitle() {
  98. this.isEditTitle = false
  99. },
  100. save() {
  101. this.$emit('update:modelValue', this.form)
  102. this.drawer = false
  103. },
  104. delNode() {
  105. this.$emit('update:modelValue', this.nodeConfig.childNode)
  106. },
  107. delUser(index) {
  108. this.form.nodeUserList.splice(index, 1)
  109. },
  110. selectHandle(type, data) {
  111. this.select(type, data)
  112. },
  113. toText(nodeConfig) {
  114. if (nodeConfig.nodeUserList && nodeConfig.nodeUserList.length > 0) {
  115. const users = nodeConfig.nodeUserList.map(item => item.name).join('、')
  116. return users
  117. } else {
  118. if (nodeConfig.allowSelection) {
  119. return '发起人自选'
  120. } else {
  121. return false
  122. }
  123. }
  124. }
  125. }
  126. }
  127. </script>
  128. <style></style>