dialog.vue 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  1. <template>
  2. <div>
  3. <van-action-sheet class="bigsheetbox" @closed="closedHandler" v-model="show" safe-area-inset-bottom position="bottom" title="选择演练库">
  4. <van-row>
  5. <van-col span="24">
  6. <div class="line"></div>
  7. </van-col>
  8. </van-row>
  9. <van-row>
  10. <van-col span="24">
  11. <van-search v-model="searchVal" placeholder="请输入搜索关键词" @input="onSearch" @cancel="onCancel" />
  12. </van-col>
  13. </van-row>
  14. <van-row class="rowclss">
  15. <van-col span="24">
  16. <van-collapse v-model="activeNames" @change="checkedHandler" accordion>
  17. <van-checkbox-group v-model="result" @change="changeCheckBox">
  18. <van-collapse-item
  19. :ref="item.id"
  20. :name="item.id"
  21. v-for="item in peopleListCpoy"
  22. :key="item.id"
  23. :title="item.drillProjects"
  24. >
  25. <!-- :title="item.defaultCause" -->
  26. <template #right-icon>
  27. <van-checkbox :name="item.id" ref="checkboxes" class="checkboxList" />
  28. </template>
  29. <div class="lddq">
  30. {{ item.defaultCause }}
  31. </div>
  32. </van-collapse-item>
  33. </van-checkbox-group>
  34. </van-collapse>
  35. </van-col>
  36. </van-row>
  37. <van-row class="bottomdiv">
  38. <van-col span="24">
  39. <van-button class="btns" size="large" type="info" @click="submitHandler">确定</van-button>
  40. </van-col>
  41. </van-row>
  42. </van-action-sheet>
  43. </div>
  44. </template>
  45. <script>
  46. import { deptTreeList } from '@/api/toConsult.js'
  47. import { drillDictionaryList } from '@/api/drillTask.js'
  48. import OrgTree from '@/components/orgTree'
  49. import { list } from '@/api/protection'
  50. export default {
  51. name: 'SocAppIndex',
  52. components: {
  53. OrgTree
  54. },
  55. props: {
  56. userList: {
  57. type: Array,
  58. default: () => {
  59. return []
  60. }
  61. },
  62. dictValue: {},
  63. organizationId: {
  64. //机构ID
  65. type: String,
  66. default: JSON.parse(window.sessionStorage.getItem('SET_USER_ORGID')) + ''
  67. },
  68. inpitLabel: {
  69. type: String,
  70. default: '参演人员'
  71. },
  72. fieldNames: {
  73. //树行配置映射项
  74. type: Object,
  75. default: () => {
  76. return {
  77. text: 'name',
  78. value: 'id',
  79. children: 'children'
  80. }
  81. }
  82. }
  83. },
  84. data() {
  85. return {
  86. activeNames: [],
  87. orgId: this.organizationId || '',
  88. show: false,
  89. value1: '',
  90. showcascader: false,
  91. cascaderValue: '',
  92. loading: false,
  93. options: [], //机构列表
  94. result: [], //人员ID集合
  95. searchVal: '', //搜索值
  96. peopleList: [], //人员列表
  97. peopleListCpoy: [], //人员列表2
  98. orgName: '' //机构名称
  99. }
  100. },
  101. created() {},
  102. mounted() {},
  103. methods: {
  104. // 弹框关闭动画
  105. closedHandler() {
  106. this.searchVal = ''
  107. },
  108. //复选框发生变化
  109. changeCheckBox(list) {
  110. if (list && list.length > 1) {
  111. this.result = [list[list.length - 1]]
  112. }
  113. },
  114. init() {
  115. this.show = true
  116. this.getpeople()
  117. },
  118. onLoad() {},
  119. getpeople() {
  120. drillDictionaryList({ orgId: this.orgId, dictValue: this.dictValue }).then(res => {
  121. let { code, data, msg } = res
  122. if (code == 200) {
  123. console.log(res)
  124. this.peopleList = data
  125. this.peopleListCpoy = JSON.parse(JSON.stringify(this.peopleList))
  126. this.peopleListCpoy.forEach(item => {
  127. this.$set(item, 'checked', false)
  128. })
  129. }
  130. })
  131. },
  132. onSearch(val) {
  133. this.peopleListCpoy = this.peopleList.filter(item => {
  134. if (item.defaultCause.indexOf(val) != -1) {
  135. return item
  136. }
  137. })
  138. },
  139. onCancel() {
  140. this.searchVal = ''
  141. this.peopleListCpoy = this.peopleList
  142. },
  143. submitHandler() {
  144. let list = []
  145. this.peopleListCpoy.filter(item => {
  146. this.result.forEach(r => {
  147. if (r == item.id) {
  148. list.push(item)
  149. }
  150. })
  151. })
  152. this.show = false
  153. // 抛出已选择人员信息
  154. this.$emit('checkList', list)
  155. },
  156. checkedHandler(id) {
  157. this.result.push(id)
  158. }
  159. }
  160. }
  161. </script>
  162. <style lang="scss" scoped>
  163. .checkboxList {
  164. z-index: 999;
  165. }
  166. .van-action-sheet {
  167. min-height: 90%;
  168. }
  169. .btns {
  170. width: 100%;
  171. height: 90px;
  172. }
  173. .bottomdiv {
  174. width: 100%;
  175. bottom: 0%;
  176. position: absolute;
  177. margin-top: 20px;
  178. z-index: 2000;
  179. }
  180. .bigsheetbox {
  181. height: calc(100vh - 100px);
  182. }
  183. .line {
  184. width: 100%;
  185. height: 3px;
  186. background-color: #1989fa;
  187. }
  188. .rowclss {
  189. margin-bottom: 100px;
  190. }
  191. .lddq {
  192. text-align: justify;
  193. white-space: pre-wrap;
  194. // text-align: left;
  195. }
  196. </style>