periodModal.vue 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. <template>
  2. <hc-new-dialog is-table widths="800px" :show="isShow" title="计量期选择" @save="modalSave" @close="modalClose">
  3. <hc-table
  4. :column="tableColumn" :datas="tableData" :loading="tableLoading"
  5. is-new :index-style="{ width: 60 }" is-check :check-style="{ width: 29 }"
  6. @selection-change="tableCheckChange"
  7. />
  8. </hc-new-dialog>
  9. </template>
  10. <script setup>
  11. import { ref, watch } from 'vue'
  12. const props = defineProps({
  13. ids: {
  14. type: [String, Number],
  15. default: '',
  16. },
  17. })
  18. //事件
  19. const emit = defineEmits(['finish', 'close'])
  20. //双向绑定
  21. // eslint-disable-next-line no-undef
  22. const isShow = defineModel('modelValue', {
  23. default: false,
  24. })
  25. //监听
  26. watch(() => [
  27. props.ids,
  28. ], ([ids]) => {
  29. console.log('ids', ids)
  30. }, { immediate: true })
  31. //监听
  32. watch(isShow, (val) => {
  33. if (val) {
  34. console.log('处理数据')
  35. }
  36. })
  37. //表格数据
  38. const tableLoading = ref(false)
  39. const tableColumn = [
  40. { key: 'key1', name: '计量期' },
  41. { key: 'key2', name: '开始日期' },
  42. { key: 'key3', name: '结束日期' },
  43. ]
  44. const tableData = ref([
  45. { key1: '1111' },
  46. ])
  47. //表格选择
  48. const tableCheckChange = (checks) => {
  49. console.log(checks)
  50. }
  51. const modalSave = () => {
  52. emit('finish')
  53. modalClose()
  54. }
  55. const modalClose = () => {
  56. isShow.value = false
  57. emit('close')
  58. }
  59. </script>
  60. <style scoped lang="scss">
  61. </style>