dialog.vue 4.6 KB

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