DomainDialog.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. <template>
  2. <SubDialog
  3. :modelValue="modelValue"
  4. @update:modelValue="$emit('update:modelValue', $event)"
  5. title="域"
  6. width="600"
  7. height="500px"
  8. @confirm="handleConfirm"
  9. @cancel="handleCancel"
  10. >
  11. <div>
  12. <el-row style="margin-bottom: 10px;" :gutter="20">
  13. <el-col v-for="(item,index) in domainbtnbox1" :key="index" :span="8">
  14. <el-button style="width: 100%;">{{ item }}</el-button>
  15. </el-col>
  16. </el-row>
  17. <el-row style="margin-bottom: 10px;" :gutter="20">
  18. <el-col v-for="(item,index) in domainbtnbox2" :key="index" :span="8">
  19. <el-button style="width: 100%;">{{ item }}</el-button>
  20. </el-col>
  21. </el-row>
  22. </div>
  23. <div class="classtable tabledomain">
  24. <el-table
  25. :data="tableDatadomain"
  26. style="width: 100%; height: 230px"
  27. border="true"
  28. :header-cell-class-name="headerCellClassName"
  29. >
  30. <el-table-column prop="rowname" label="域名称" />
  31. <el-table-column
  32. v-for="(item, index) in tabledomainColumns"
  33. :key="index"
  34. :prop="item.prop"
  35. :label="item.label"
  36. >
  37. <template #default="{ row }">
  38. <el-input v-model="row[item.prop]" />
  39. </template>
  40. </el-table-column>
  41. </el-table>
  42. </div>
  43. </SubDialog>
  44. </template>
  45. <script setup>
  46. import { ref, defineProps, defineEmits } from 'vue'
  47. import SubDialog from './SubDialog.vue'
  48. const props = defineProps({
  49. modelValue: Boolean,
  50. initialData: {
  51. type: Array,
  52. default: () => []
  53. }
  54. })
  55. const emit = defineEmits(['update:modelValue', 'confirm', 'cancel'])
  56. // 按钮数据
  57. let domainbtnbox1 = ref(['显示全部','隐藏全部','倒转互换'])
  58. let domainbtnbox2 = ref(['显示','隐藏','表面绘制'])
  59. // 表格数据
  60. let tableDatadomain = ref([
  61. {rowname:"Z1", state:'1', type:'2', area:'3'},
  62. {rowname:"Z2", state:'1', type:'2', area:'3'},
  63. {rowname:"Z3", state:'1', type:'2', area:'3'},
  64. {rowname:"Z4", state:'1', type:'2', area:'3'},
  65. {rowname:"Z1", state:'1', type:'2', area:'3'},
  66. {rowname:"Z2", state:'1', type:'2', area:'3'},
  67. {rowname:"Z3", state:'1', type:'2', area:'3'},
  68. {rowname:"Z4", state:'1', type:'2', area:'3'},
  69. ])
  70. // 表格列配置
  71. let tabledomainColumns = ref([
  72. {label:"状态", prop:'state'},
  73. {label:"绘制类型", prop:'type'},
  74. {label:"平面范围", prop:'area'},
  75. ])
  76. // 表头样式
  77. const headerCellClassName = ({ column }) => {
  78. // console.log('列:',column.property)
  79. if (column.property === 'state') {
  80. console.log('yanse',column.property)
  81. return 'header-blue';
  82. } else if (column.property === 'type') {
  83. return 'header-green';
  84. } else if (column.property === 'area') {
  85. return 'header-yellow';
  86. }
  87. return '';
  88. };
  89. // 确认操作
  90. const handleConfirm = () => {
  91. emit('confirm', tableDatadomain.value)
  92. emit('update:modelValue', false)
  93. }
  94. // 取消操作
  95. const handleCancel = () => {
  96. emit('cancel')
  97. emit('update:modelValue', false)
  98. }
  99. </script>
  100. <style scoped>
  101. .classtable.tabledomain {
  102. margin-top: 20px;
  103. }
  104. /* 表头样式 */
  105. :deep(.header-cell) {
  106. background-color: #f5f7fa;
  107. font-weight: bold;
  108. }
  109. </style>