CollaborativeUser.vue 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. <template>
  2. <Dialog draggable custom-show title="协同用户" type="sm" hide-footer @close="handleClose">
  3. <div class="common-table">
  4. <div class="table-header">
  5. <!-- <div class="td">-->
  6. <!-- <el-checkbox v-model="allChecked" @change="allCheckedChange" />-->
  7. <!-- </div>-->
  8. <div class="td">协同用户</div>
  9. <div class="td">单位</div>
  10. <div class="td">操作</div>
  11. </div>
  12. <div v-for="(item, index) in dataList" :key="index" class="tr">
  13. <!-- <div class="td">-->
  14. <!-- <el-checkbox v-model="item.checked" />-->
  15. <!-- </div>-->
  16. <div class="td">{{ item.nick_name }}</div>
  17. <div class="td">{{ item.dept_name }}</div>
  18. <div class="td">
  19. <div v-if="!!item.ws_flag" class="btn1" @click="handleCloseUser(item.id)">关闭协同</div>
  20. <div v-else class="btn1" @click="handleStartUser(item.id)">开启协同</div>
  21. </div>
  22. </div>
  23. </div>
  24. </Dialog>
  25. </template>
  26. <script lang="ts" setup name="ImportLayer">
  27. import { endCollaboration, getPatternUserList, startCollaboration } from '@/api/globalMap/onlinePlotting';
  28. import { showSuccessMsg } from '@/utils/notification';
  29. const props = defineProps({
  30. modelValue: Boolean,
  31. patternId: String
  32. });
  33. const emits = defineEmits(['update:modelValue']);
  34. let allChecked = ref(false);
  35. let dataList = ref([]);
  36. const allCheckedChange = () => {
  37. dataList.value.forEach((item) => {
  38. item.checked = allChecked.value;
  39. });
  40. };
  41. const getList = () => {
  42. getPatternUserList({ pattern_id: props.patternId }).then((res) => {
  43. dataList.value = res.data;
  44. });
  45. };
  46. const handleCloseUser = (id) => {
  47. endCollaboration({
  48. pattern_id: props.patternId,
  49. user_id: id
  50. }).then(() => {
  51. showSuccessMsg('关闭成功');
  52. getList();
  53. });
  54. };
  55. const handleStartUser = (id) => {
  56. startCollaboration({
  57. pattern_id: props.patternId,
  58. user_id: id
  59. }).then(() => {
  60. getList();
  61. });
  62. };
  63. const handleClose = () => {
  64. emits('update:modelValue', false);
  65. };
  66. onMounted(() => {
  67. getList();
  68. });
  69. </script>
  70. <style lang="scss" scoped>
  71. .btn1 {
  72. color: #5983df;
  73. cursor: pointer;
  74. }
  75. </style>