schangxiang@126.com
2025-05-21 a3a2b238a2626ef8744e7a135f9ca2e2fbb5184c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
import { defineComponent, useSlots } from 'vue'
import BaseDialog from '@/components/BaseDialog/index.vue'
import { useSelectDialog } from './hook'
import styles from './WorkSectionDialog.module.scss'
import Search from '@/components/Search/Search'
import BaseTable from '@/components/Table/Table'
import { _t } from '@/libs/Language/Language'
export default defineComponent({
  name: 'WorkSectionDialog',
  props: {
    modelValue: {
      type: Boolean,
      default: false,
    },
    title: {
      type: String,
      default: '',
    },
    data: {
      type: Array,
      default: () => [],
    },
    params: {
      type: Object,
      default: () => ({}),
    },
    columns: {
      type: Array,
      default: () => [],
    },
    dataTransformer: {
      type: Function,
    },
    pageSize: {
      type: Number,
      default: 50,
    },
    zIndex: {
      type: Number,
    },
    isHidePagination: {
      type: Boolean,
      default: false,
    },
    radio: {
      type: Boolean,
      default: false,
    },
  },
  emits: ['update:modelValue', 'close', 'confirm'],
  setup(props, ctx) {
    const {
      onClose,
      onConfirm,
      onCheck,
      onOpen,
      onSearch,
      visible,
      innerValue,
      tableRef,
      dataSource,
      columns,
      selections,
    } = useSelectDialog(props, ctx)
    const slots = useSlots()
    ctx.expose({
      onSearch,
    })
    return () => {
      const params = {}
      Object.keys(props.params).forEach((key) => {
        params[key] = props.params[key] || ''
      })
      return (
        <BaseDialog
          destroy-on-close
          class={styles.drawer}
          style="background: #fff"
          width="664px"
          height={props.isHidePagination ? '590px' : '480px'}
          title={props.title ? props.title : _t('工序选择')}
          v-model={visible.value}
          onClose={onClose}
          onConfirm={onConfirm}
          onOpen={onOpen}
          append-to-body
        >
          <div class={styles.container}>
            <div class={styles.tools}>
              <span class={styles.name}>{_t('查询')}</span>
              <Search v-model={innerValue.value} onConfirm={onSearch} />
              {slots.header?.()}
            </div>
            <div class={styles.mainTable}>
              <BaseTable
                params={{
                  Filter: innerValue.value,
                  includeDetails: true,
                  ...params,
                }}
                selections={selections.value}
                pageSize={props.pageSize}
                isHidePagination={props.isHidePagination}
                ref={tableRef}
                radio={props.radio}
                url="/api/v1/messuite/query/worksection"
                style="margin-top:10px"
                v-model:dataSource={dataSource.value}
                columns={props.columns.length ? props.columns : columns.value}
                dataTransformer={props.dataTransformer}
                isChecked={true}
                onCheck={onCheck}
              />
            </div>
          </div>
        </BaseDialog>
      )
    }
  },
})