addBillBaseModal.vue 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. <template>
  2. <hc-new-dialog is-table widths="1200px" :show="isShow" title="添加分解清单" @save="modalSave" @close="modalClose">
  3. <hc-table
  4. :column="tableColumn" :datas="tableData" :loading="tableLoading"
  5. is-new is-check :check-style="{ width: 29 }" :index-style="{ width: 60 }"
  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. { key: 'key4', name: '合同数量' },
  44. { key: 'key5', name: '合同变更后数量' },
  45. { key: 'key6', name: '施工图变更后数量' },
  46. { key: 'key7', name: '分解剩余量' },
  47. ]
  48. const tableData = ref([
  49. { key1: '1111' },
  50. ])
  51. //表格选择
  52. const tableCheckChange = (checks) => {
  53. console.log(checks)
  54. }
  55. const modalSave = () => {
  56. emit('finish')
  57. modalClose()
  58. }
  59. const modalClose = () => {
  60. isShow.value = false
  61. emit('close')
  62. }
  63. </script>
  64. <style scoped lang="scss">
  65. </style>