干燥机配套车间生产管理系统/云平台服务端
baoshiwei
2023-03-10 1fb197352b6a263646e4ccd3ed1c7854ede031dd
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
<template>
  <div>
    <template v-if="hasFile" v-for="(file, fileKey) of [innerFile || {}]" :key="fileKey">
      <div style="position: relative">
        <a-tooltip v-if="file.status === 'uploading'" :title="`上传中(${Math.floor(file.percent)}%)`">
          <LoadingOutlined />
          <span style="margin-left: 5px">上传中…</span>
        </a-tooltip>
 
        <a-tooltip v-else-if="file.status === 'done'" :title="file.name">
          <Icon icon="ant-design:paper-clip" />
          <span style="margin-left: 5px">{{ ellipsisFileName }}</span>
        </a-tooltip>
 
        <a-tooltip v-else :title="file.message || '上传失败'">
          <Icon icon="ant-design:exclamation-circle" style="color: red" />
          <span style="margin-left: 5px">{{ ellipsisFileName }}</span>
        </a-tooltip>
 
        <Dropdown :trigger="['click']" placement="bottomRight" style="margin-left: 10px">
          <a-tooltip title="操作">
            <Icon v-if="file.status !== 'uploading'" icon="ant-design:setting" style="cursor: pointer" />
          </a-tooltip>
          <template #overlay>
            <a-menu>
              <a-menu-item v-if="originColumn.allowDownload !== false" @click="handleClickDownloadFile">
                <span><Icon icon="ant-design:download" />&nbsp;下载</span>
              </a-menu-item>
              <a-menu-item v-if="originColumn.allowRemove !== false" @click="handleClickDeleteFile">
                <span><Icon icon="ant-design:delete" />&nbsp;删除</span>
              </a-menu-item>
              <a-menu-item @click="handleMoreOperation">
                <span><Icon icon="ant-design:bars" />&nbsp;更多</span>
              </a-menu-item>
            </a-menu>
          </template>
        </Dropdown>
      </div>
    </template>
 
    <a-upload
      v-show="!hasFile"
      name="file"
      :data="{ isup: 1 }"
      :multiple="false"
      :action="uploadAction"
      :headers="uploadHeaders"
      :showUploadList="false"
      v-bind="cellProps"
      @change="handleChangeUpload"
    >
      <a-button preIcon="ant-design:upload">{{ originColumn.btnText || '点击上传' }}</a-button>
    </a-upload>
    <JUploadModal :value="modalValue" @register="registerModel" @change="onModalChange" />
  </div>
</template>
 
<script lang="ts">
  import { defineComponent } from 'vue';
  import { UploadTypeEnum } from '/@/components/Form/src/jeecg/components/JUpload';
  import { JVxeComponent } from '/@/components/jeecg/JVxeTable/types';
  import { useJVxeCompProps } from '/@/components/jeecg/JVxeTable/hooks';
  import { useFileCell, enhanced, components } from '../hooks/useFileCell';
 
  export default defineComponent({
    name: 'JVxeFileCell',
    components: components,
    props: useJVxeCompProps(),
    setup(props: JVxeComponent.Props) {
      return useFileCell(props, UploadTypeEnum.file);
    },
    // 【组件增强】注释详见:JVxeComponent.Enhanced
    enhanced: enhanced,
  });
</script>
 
<style scoped lang="less"></style>