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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
| import Dialog from '@/components/BaseDialog/index.vue'
| const BaseDialog: any = Dialog
| import { defineComponent, SetupContext } from 'vue'
| import styles from './BarcodeGenerateDialog.module.scss'
| import { useRelationGenerate } from '@/hooks/Dialog'
| import Text from '@/components/Text/Text'
| import BaseTable from '@/components/Table/Table'
|
| import Search from '@/components/Search/Search'
| import DyForm from '@/components/DyForm/DyForm'
| import { _t } from '@/libs/Language/Language'
| import dayjs from 'dayjs'
|
| export default defineComponent({
| name: '关联条码生成规则',
| props: {
| // 控制弹窗显示隐藏
| modelValue: {
| type: [Object, Number, String],
| default: () => ({}),
| },
| visible: {
| type: Boolean,
| default: null,
| },
| title: {
| type: String,
| default: _t('关联条码生成规则'),
| },
| mode: {
| type: String,
| default: 'select',
| },
| type: {
| type: String,
| default: 'select',
| },
| ruleType: {
| type: String,
| default: 'barcodegeneration',
| },
| },
| emits: ['update:modelValue', 'update:visible', 'close', 'confirm'],
| setup(props, ctx: SetupContext) {
| const {
| visible,
| data,
| modelValue,
| search,
| tableRef,
| columns,
| url,
| formData,
| barcodeVisible,
| formRef,
| onBarcodeConfirm,
| onClose,
| onConfirm,
| onSelect,
| onRowClick,
| onSearch,
| } = useRelationGenerate(props, ctx)
| return () => {
| const { description } = modelValue.value
| return (
| <div class={styles.relationDialog}>
| {props.type === 'select' ? (
| <el-input
| modelValue={formData.value.input}
| {...ctx.attrs}
| class={styles.selectVariable}
| placeholder={_t('请选择')}
| suffix-icon={
| <el-button
| link
| type="primary"
| size="small"
| style="margin-right: 10px;"
| onClick={onSelect}
| >
| {_t('选择')}
| </el-button>
| }
| ></el-input>
| ) : null}
| {props.mode === 'select' &&
| (description ? (
| <span class={styles.selected} onClick={onSelect}>
| {description}
| </span>
| ) : (
| <span onClick={onSelect} class={styles.select}>
| {_t('请选择')}
| </span>
| ))}
| <BaseDialog
| width="400px"
| destroy-on-close
| append-to-body={true}
| v-model={visible.value}
| title={_t(props.title)}
| onClose={onClose}
| onConfirm={onConfirm}
| >
| <div class={styles.table}>
| <DyForm
| v-model:formData={formData.value}
| ref={formRef}
| formItemProps={[
| {
| prop: 'barcode',
| label: _t('生成规则'),
| placeholder: _t('请选择'),
| el: 'input',
| suffixIcon: (
| <el-button
| link
| type="primary"
| size="small"
| style="margin-right: 10px;"
| onClick={() => (barcodeVisible.value = true)}
| >
| {_t('选择')}
| </el-button>
| ),
| rules: [
| {
| message: '请选择生成规则',
| required: true,
| trigger: 'change',
| },
| ],
| },
| {
| prop: 'dataVariable',
| label: _t('下发变量'),
| el: 'variable',
| placeholder: _t('请选择'),
| type: 'select',
| },
| ]}
| />
| </div>
| </BaseDialog>
| <BaseDialog
| width="954px"
| height="536px"
| destroy-on-close
| append-to-body={true}
| v-model={barcodeVisible.value}
| title={_t(props.title)}
| onClose={() => (barcodeVisible.value = false)}
| onConfirm={onBarcodeConfirm}
| >
| <div class={styles.header}>
| <label class={styles.key}>{_t('条码名称')}</label>
| <Search v-model={search.value} onConfirm={onSearch} />
| </div>
| <div class={styles.table}>
| <BaseTable
| ref={tableRef}
| url={url.value}
| columns={columns.value}
| size="mini"
| v-model:dataSource={data.value}
| isHidePagination={true}
| pageSize={999}
| isVScroll
| onRowClick={onRowClick}
| v-slots={{
| lastModificationTime: ({ row }: any) => (
| <Text
| tip={dayjs(row.lastModificationTime).format(
| 'YYYY-MM-DD HH:MM:ss'
| )}
| >
| {dayjs(row.lastModificationTime).format(
| 'YYYY-MM-DD HH:MM:ss'
| )}
| </Text>
| ),
| }}
| />
| </div>
| </BaseDialog>
| </div>
| )
| }
| },
| })
|
|