ny
昨天 282fbc6488f4e8ceb5fda759f963ee88fbf7b999
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
<script lang="ts" setup>
import { reactive } from 'vue';
 
import { BasicModal, useModalInner } from '@jnpf/ui/modal';
 
import { getPrintDevByIds } from '#/api/system/printDev';
 
interface State {
  printListOptions: any[];
}
 
const emit = defineEmits(['register', 'change']);
const state = reactive<State>({
  printListOptions: [],
});
const [registerModal, { closeModal, changeLoading }] = useModalInner(init);
 
function init(ids) {
  changeLoading(true);
  getPrintDevByIds({ ids }).then((res) => {
    state.printListOptions = res.data;
    changeLoading(false);
  });
}
function handleSelect(_val, item) {
  emit('change', item.id);
  closeModal();
}
</script>
<template>
  <BasicModal v-bind="$attrs" @register="registerModal" title="请选择打印模板" :footer="null" width="400px" :min-height="250" class="template-list">
    <div class="template-item" v-for="item in state.printListOptions" :key="item.id" @click="handleSelect($event, item)">
      {{ item.fullName }}
    </div>
  </BasicModal>
</template>
<style lang="scss" scoped>
.template-list {
  width: 100%;
  height: 100%;
 
  .template-item {
    width: 100%;
    height: 40px;
    padding: 0 20px;
    margin-bottom: 10px;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 40px;
    word-break: break-all;
    white-space: nowrap;
    cursor: pointer;
    background: #eff9ff;
    border-radius: 4px;
  }
}
</style>