schangxiang@126.com
2025-05-07 cace264ad9d86a7831099810b079da1141957add
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
121
122
123
124
125
126
127
128
129
import { defineComponent } from 'vue'
import BaseDialog from '@/components/BaseDialog/index.vue'
import { useSelectDialog } from './hook'
import styles from './LabelDialog.module.scss'
import Search from '@/components/Search/Search'
import BaseTable from '@/components/Table/Table'
import { _t } from '@/libs/Language/Language'
import Text from '../Text/Text'
export default defineComponent({
  name: 'LabelDialog',
  props: {
    modelValue: {
      type: Boolean,
      default: false,
    },
    title: {
      type: String,
      default: '',
    },
    data: {
      type: Array,
      default: () => [],
    },
    printerName: {
      type: String,
    },
    radio: {
      type: Boolean,
      default: false,
    },
  },
  emits: ['update:modelValue', 'close', 'confirm'],
  setup(props, ctx) {
    const {
      onClose,
      onConfirm,
      onCheck,
      onOpen,
      onSearch,
      printName,
      printVisible,
      url,
      visible,
      innerValue,
      tableRef,
      dataSource,
      columns,
      selections,
      onPreview,
    } = useSelectDialog(props, ctx)
    return () => (
      <BaseDialog
        destroy-on-close
        class={styles.drawer}
        style="background: #fff"
        width="664px"
        height="578px"
        title={_t('标签管理')}
        v-model={visible.value}
        onClose={onClose}
        onConfirm={onConfirm}
        onOpen={onOpen}
      >
        <div class={styles.container}>
          <BaseDialog
            title={printName.value}
            v-model={printVisible.value}
            width="664px"
            height="500px"
            onClose={() => (printVisible.value = false)}
            onConfirm={() => (printVisible.value = false)}
          >
            <el-image
              style="width: 100%;"
              src={url.value}
              zoom-rate={1.2}
              max-scale={7}
              min-scale={0.2}
              preview-src-list={[url.value]}
              fit="cover"
            />
          </BaseDialog>
          <div class={styles.tools}>
            <span class={styles.name}>{_t('查询')}</span>
            <Search v-model={innerValue.value} onConfirm={onSearch} />
          </div>
          <div class={styles.mainTable}>
            <BaseTable
              params={{
                // Filter: innerValue.value,
                printerName: props.printerName,
              }}
              selections={selections.value}
              pageSize={50}
              ref={tableRef}
              url="/api/v1/labelmanagement/label/template"
              style="margin-top:10px"
              v-model:dataSource={dataSource.value}
              columns={columns.value}
              isChecked={true}
              isHidePagination={true}
              id="templateName"
              onCheck={onCheck}
              radio={props.radio}
              v-slots={{
                templateName: ({ row }) => {
                  return (
                    <div class={styles.box}>
                      <Text tip={row.templateName} truncated={true}>
                        {row.templateName}
                      </Text>
                      <el-button
                        type="primary"
                        link
                        onClick={() => onPreview(row)}
                      >
                        {_t('预览')}
                      </el-button>
                    </div>
                  )
                },
              }}
            />
          </div>
        </div>
      </BaseDialog>
    )
  },
})