浏览代码

Merge branch 'feature/master' into feature/develop

rainwer 7 月之前
父节点
当前提交
14cdc0fffe

+ 3 - 1
package.json

@@ -17,7 +17,9 @@
   },
   "dependencies": {
     "@element-plus/icons-vue": "^2.0.10",
-    "@vue-office/pdf": "^2.0.2",
+    "@vue-office/docx": "^1.6.3",
+    "@vue-office/excel": "^1.7.14",
+    "@vue-office/pdf": "^2.0.10",
     "@vueuse/core": "9.5.0",
     "@wangeditor/editor": "^5.1.1",
     "@wangeditor/editor-for-vue": "^5.1.12",

+ 49 - 0
src/api/business/fileUpload.js

@@ -0,0 +1,49 @@
+import request from '@/utils/request'
+
+// 查询文件库列表
+export function listFile(query) {
+  request.defaults.baseURL = '/ezhizao-yzbh-production'
+  return request({
+    url: '/business/upload/list',
+    method: 'get',
+    params: query
+  })
+}
+
+// 查询文件库详细
+export function getFile(id) {
+  request.defaults.baseURL = '/ezhizao-yzbh-production'
+  return request({
+    url: '/business/upload/' + id,
+    method: 'get'
+  })
+}
+
+// 新增文件库
+export function addFileInfos(data) {
+  request.defaults.baseURL = '/ezhizao-yzbh-production'
+  return request({
+    url: '/business/upload/save',
+    method: 'post',
+    data: data
+  })
+}
+
+// 修改文件库
+export function updateFile(data) {
+  request.defaults.baseURL = '/ezhizao-yzbh-production'
+  return request({
+    url: '/business/upload',
+    method: 'put',
+    data: data
+  })
+}
+
+// 删除文件库
+export function delFile(id) {
+  request.defaults.baseURL = '/ezhizao-yzbh-production'
+  return request({
+    url: '/business/upload/' + id,
+    method: 'delete'
+  })
+}

+ 15 - 0
src/api/tool/file.js

@@ -61,3 +61,18 @@ export function uploadFile(file) {
     }
   })
 }
+
+// 文件下载
+export function downloadFile(query) {
+  request.defaults.baseURL = '/ezhizao-yzbh-sys'
+  return request({
+    url: `/common/downloadNoDelete`,
+    method: 'get',
+    params: query,
+    responseType: 'blob'
+    // headers: {
+    //   'Content-Type': 'multipart/form-data',
+    //   'repeatSubmit': false,
+    // }
+  })
+}

+ 9 - 0
src/views/business/crm/order/form.vue

@@ -718,6 +718,15 @@
               </el-form-item>
             </el-col>
             <br />
+
+            <el-col :span="20">
+              <el-form-item label="更新内容" prop="updateRemark">
+                <el-input v-if="editStatus" v-model="form.updateRemark" show-word-limit maxlength="250"
+                          style="width: 100%; margin: 0; padding: 0" placeholder="请输入更新内容" type="textarea" :rows="4" />
+                <span v-else>{{ form.updateRemark }}</span>
+              </el-form-item>
+            </el-col>
+            <br />
             <el-col :span="24">
               <div class="details-head" style="font-size: 12px">
                 <div class="title">

+ 1 - 1
src/views/business/entrust/workOrder/currentMonth/index.vue

@@ -5,7 +5,7 @@
       <el-button type="primary" size="small" icon="Plus" :disabled="multiple" @click="setEntrustHandle"
         v-hasPermi="['business:entrust:workOrder:current:edit']">设置委托</el-button>
       <el-button type="danger" size="small" icon="delete" :disabled="cancel" @click="delEntrustHandle"
-        v-hasPermi="['business:entrust:workOrder:current:edit']">取消委托</el-button>
+        v-hasPermi="['business:entrust:workOrder:current:edit']">取消当月委托</el-button>
       <!-- <el-button type="success" size="small" icon="Refresh" @click="transEntrustHandler"
         v-hasPermi="['business:entrust:workOrder:current:trans']">委托流转11</el-button> -->
       <el-dropdown trigger="click">

+ 2 - 1
src/views/business/production/archiveTicket/form.vue

@@ -192,7 +192,7 @@
     uploadFile(formData).then((res) => {
       if (res.code === 200) {
         const file = {};
-        file.fileName = res.newFileName;
+        file.fileName = res.originalFilename;
         file.url = res.url;
         file.originalFileName = res.originalFilename;
         file.fileUrl = res.fileName;
@@ -270,6 +270,7 @@
         proxy.$modal.msgError("票据类型不能为空");
         return;
       }
+      files.value[i].fileName= files.value[i].fileName
     }
     const file = {
       companyId: form.value.companyId,

+ 334 - 0
src/views/business/production/receiveResource/form.vue

@@ -0,0 +1,334 @@
+<template>
+  <el-dialog v-model="visible" :width="width" append-to-body draggable show-close :close-on-click-modal="false">
+    <template #header>
+      <div class="dialog-title-container">
+        <span class="title-label" style="color: #fff">
+          <el-icon>
+            <Document />
+          </el-icon>
+          文件</span>
+      </div>
+    </template>
+    <div class="form-btns-container">
+      <el-button type="primary" size="small" icon="Finished" @click="handleSave">
+        保存</el-button>
+    </div>
+    <div v-loading="loading">
+      <div style="padding: 8px 24px 16px 24px">
+        <el-form size="small" label-width="80px" :model="form" :rules="formRules" ref="uploadForm">
+          <el-row :gutter="30">
+            <el-col :span="12">
+              <el-form-item label="附件类型" prop="type">
+                <el-select v-model="form.type" style="width: 100%">
+                  <el-option v-for="item in fileTypes" :key="item.value" :label="item.label"
+                    :value="item.value" />
+                </el-select>
+              </el-form-item>
+            </el-col>
+            <el-col :span="12">
+              <el-form-item label="企业名称" prop="companyId">
+                <el-select v-model="form.companyId" style="width: 100%" @focus="focusCompanySelect">
+                  <el-option v-for="item in companyList" :key="item.id" :label="item.name"
+                    :value="item.id" />
+                </el-select>
+              </el-form-item>
+            </el-col>
+            <el-col :span="24">
+              <el-form-item label="选择附件" prop="files">
+                <el-upload v-if="visible" action="#" :http-request="upload" :before-upload="handleBeforeUpload" :with-credentials="true"
+                  :before-remove="removeFile" v-model:file-list="fileList"
+                  :show-file-list="true" multiple :limit="5" drag style="width: 100%;">
+                  <!-- <el-button size="small" type="primary" icon="Upload">上传文件</el-button> -->
+                  <el-icon class="el-icon--upload"><upload-filled /></el-icon>
+                  <div class="el-upload__text">
+                    上传文件
+                  </div>
+                  <template #tip>
+                    <div class="el-upload__tip">
+                      单次最多上传5个文件
+                    </div>
+                  </template>
+                </el-upload>
+              </el-form-item>
+            </el-col>
+          </el-row>
+        </el-form>
+      </div>
+    </div>
+    <el-dialog v-model="visibleCompany" width="660px" append-to-body draggable show-close :close-on-click-modal="false">
+      <template #header>
+        <div class="dialog-title-container">
+          <span class="title-label" style="color: #fff">
+            <el-icon>
+              <Document />
+            </el-icon>
+            企业</span>
+        </div>
+      </template>
+      <!-- <div class="form-btns-container">
+        <el-button type="primary" size="small" icon="Finished" @click="handleSave">
+          保存</el-button>
+      </div> -->
+      <div v-loading="loadingCompany">
+        <el-form class="list-search-container" :model="queryParams" ref="queryRef" :inline="true" label-width="68px">
+          <el-form-item label="客户名称:">
+            <el-input v-model.trim="queryParams.name" size="small" type="text" placeholder="客户名称" :clearable="true"
+              style="width: 130px" />
+          </el-form-item>
+          <el-form-item>
+          <el-button type="primary" icon="Search" @click="handleQuery" size="small">搜索</el-button>
+        </el-form-item>
+        </el-form>
+        <el-table :data="list" style="width: 100%">
+          <el-table-column prop="name" label="名称" />
+          <el-table-column fixed="right" label="操作" width="120">
+            <template #default="scope">
+              <el-button link type="primary" size="small" @click="handleSelect(scope.row)">
+                选择
+              </el-button>
+            </template>
+          </el-table-column>
+        </el-table>
+        <!-- 分页 -->
+        <pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum"
+          v-model:limit="queryParams.pageSize" @pagination="getCompanyList" />
+      </div>
+    </el-dialog>
+  </el-dialog>
+</template>
+<script setup>
+  import { reactive } from "vue";
+  import { UploadFilled } from '@element-plus/icons-vue'
+
+  import {
+    addFileInfos,
+  } from "@/api/business/fileUpload";
+  import { uploadFile } from "@/api/tool/file";
+  import { listCompany } from "@/api/business/crm/company";
+  const { proxy } = getCurrentInstance();
+  const loading = ref(false);
+  const props = defineProps({
+    getList: {
+      type: Function,
+      default: () => { },
+    },
+    width: {
+      type: String,
+      default: "800px",
+    },
+    fileTypes: {
+      type: Array,
+      default: () => []
+    }
+  });
+  const { getList, width, fileTypes } = toRefs(props);
+  const srcList = ref([]);
+  const visibleCompany = ref(false);
+  const loadingCompany = ref(false);
+    /** 查询对象 */
+  const queryParams = ref({
+    pageNum: 1,
+    pageSize: 20,
+    orderByColumn: "create_time",
+    // principal: tenant.versionId !== '4' && !flag.value ? useUserStore().user.userId : null,
+    name: ''
+  });
+  const companyList = ref([])
+  const data = reactive({
+    visible: false,
+    list: [],
+    total: 0,
+    query: {
+      name: "",
+      total: 0,
+      pageSize: 15,
+      pageNum: 1,
+    },
+    // files: [],
+    months: [],
+    form: {
+      files: []
+    },
+    selection: [],
+    baseUrl: import.meta.env.VITE_APP_BASE_API,
+    options: {},
+    formRules: {
+      type: [
+        { required: true, message: '请选择附件类型', trigger: 'change' }
+      ],
+      companyId: [
+        { required: true, message: '请选择公司', trigger: 'change' }
+      ],
+      files: [
+        { required: true, message: '请上传文件', validator: validateFiles }
+      ],
+    },
+    fileMap: {},
+    fileList: []
+  });
+  const {
+    visible,
+    list,
+    query,
+    selection,
+    baseUrl,
+    options,
+    total,
+    // files,
+    form,
+    months,
+    formRules,
+    fileMap,
+    fileList
+  } = toRefs(data);
+
+  function validateFiles(rule, value, callback) {
+    console.log(value, 'validateFiles')
+    console.log(form.value.files, 'form.value.files')
+    if (!form.value.files || form.value.files.length == 0) {
+      callback(new Error('请上传文件'))
+    } else {
+      callback()
+    }
+  } 
+
+  function handleSelect(row) {
+    form.value.companyId = row.id
+    companyList.value.push(row)
+    visibleCompany.value = false
+  }
+
+  function open(arg) {
+    visible.value = true;
+    form.value = {
+      files: []
+    }
+    fileMap.value = {}
+    fileList.value = []
+    getCompanyList()
+  }
+    /** 查询company列表 */
+  function getCompanyList() {
+    loadingCompany.value = true;
+    listCompany(queryParams.value).then((response) => {
+      list.value = response.rows.map((l) => ({ ...l }));
+      // prev.value = proxy.deepClone(response.rows);
+      total.value = response.total;
+      loadingCompany.value = false;
+    });
+  }
+  /** 搜索按钮操作 */
+  function handleQuery() {
+    queryParams.value.pageNum = 1;
+    getCompanyList();
+  }
+  /**
+   * 对话框关闭 事件
+   */
+  function close() {
+    visible.value = false;
+  }
+  function handleImageView(fileUrl) {
+    window.open(`${baseUrl.value}${fileUrl}`);
+  }
+  /**
+   * 加载数据
+   */
+  const loadData = async () => {
+    // getCompanyList()
+    const res = await listFiles(form.value);
+    // files.value = res.data.files;
+    months.value = res.data.months;
+    form.value.isFinished = res.data.finished.isFinished;
+    srcList.value = files.value.map((v) => baseUrl.value + v.fileUrl);
+    loading.value = false;
+ 
+  };
+  /**
+   * 列表checkbox列选择 事件
+   */
+  function handleSelectionChange(selection) {
+    selection.value = selection;
+  }
+  /**
+   * 搜索 事件
+   */
+  function handleSearch() {
+    loadData();
+  }
+  function openFile(attach) {
+    window.open(`${baseUrl.value}/${attach.fileUrl}`, attach.fileName);
+  }
+
+  function upload(param) {
+    const formData = new FormData();
+    formData.append("file", param.file);
+    uploadFile(formData).then((res) => {
+      if (res.code === 200) {
+        const file = {};
+        file.fileName = res.originalFilename;
+        file.url = res.url;
+        file.originalFileName = res.originalFilename;
+        file.fileUrl = res.fileName;
+        // files.value.push(file);
+        // srcList.value = files.value.map((v) => baseUrl.value + v.fileUrl);
+        form.value.files.push(file)
+        fileMap.value[param.file.uid] = file.fileUrl
+        console.log(fileMap.value)
+      }
+    });
+  }
+
+  function handleBeforeUpload(file) {
+    if(file.size > 15 * 1024 * 1024) {
+      proxy.$modal.msgError("文件大小不能超过15M");
+      return false;
+    }
+    return true;
+  }
+
+  function removeFile(file) {
+    const fileUrl = fileMap.value[file.uid]
+    form.value.files = form.value.files.filter(f => f.fileUrl != fileUrl)
+    // fileMap.value.value.delete(file.uid)
+    delete fileMap[file.uid]
+    return true
+  }
+
+  function deleteHandle(index) {
+    proxy.$modal
+      .confirm("确定删除?")
+      .then(() => {
+        files.value.splice(index, 1);
+        srcList.value = files.value.map((v) => baseUrl.value + v.fileUrl);
+      })
+      .catch(() => {
+        proxy.$modal.msg("已取消删除");
+      });
+  }
+
+  function handleSave() {
+    console.log('handleSave', form.value.files)
+    proxy.$refs["uploadForm"].validate((valid) => {
+      if (valid) {
+        const file = {
+          companyId: form.value.companyId,
+          type: form.value.type,
+          files: form.value.files,
+        };
+        addFileInfos(file).then((res) => {
+          getList.value();
+          close();
+        });
+      }
+    });
+    
+  }
+  function focusCompanySelect() {
+    visibleCompany.value = true
+  }
+
+  defineExpose({
+    open,
+  });
+</script>

+ 382 - 0
src/views/business/production/receiveResource/index.vue

@@ -0,0 +1,382 @@
+<template>
+  <div class="page-container list-container">
+    <!-- 功能按钮区 -->
+    <div class="list-btns-container">
+    </div>
+    <!-- 搜索区 -->
+    <el-form class="list-search-container" :model="queryParams" ref="queryRef" :inline="true" label-width="68px">
+      <el-form-item label="附件名称:">
+        <el-input v-model.trim="queryParams.fileName" size="small" type="text" placeholder="附件名称" :clearable="true"
+          style="width: 130px" />
+      </el-form-item>
+      <el-form-item label="企业名称:">
+        <el-input v-model.trim="queryParams.companyName" size="small" type="text" placeholder="企业名称" :clearable="true"
+          style="width: 130px" />
+      </el-form-item>
+      <el-form-item label="附件类型:">
+        <el-select v-model="queryParams.type" clearable>
+                  <el-option v-for="item in fileTypes" :key="item.value" :label="item.label"
+                    :value="item.value" />
+                </el-select>
+      </el-form-item>
+      <el-form-item label="附件状态:">
+        <el-select v-model="queryParams.deleted" clearable>
+          <el-option label="正常" :value="0" />
+          <el-option label="作废" :value="1" />
+        </el-select>
+      </el-form-item>
+      <!-- <el-form-item v-if="tenant.versionId !== '4'" label="是否自己负责:" v-hasPermi="['business:upload:person']">
+        <el-switch v-model="oneself" @change="handleOneself" />
+      </el-form-item> -->
+      <el-form-item label="上传人:" prop="userName">
+        <el-input size="small" v-model="queryParams.userName" placeholder="请输入上传人" clearable style="width: 130px"
+          @keyup.enter="handleQuery" />
+      </el-form-item>
+
+      <el-form-item prop="dateFilter" label="上传时间:">
+        <el-date-picker size="small" v-model="queryParams.dateFilterFinish" type="daterange" clearable
+          format="YYYY - MM - DD " value-format="YYYY-MM-DD" range-separator="至" start-placeholder="业务日期"
+          end-placeholder="业务日期" style="width: 70%;"></el-date-picker>
+      </el-form-item>
+      <el-form-item>
+        <el-button type="primary" icon="Search" @click="handleQuery" size="small">搜索</el-button>
+        <el-button type="primary" icon="Upload" @click="uploadHandle" size="small" v-hasPermi="['business:upload:add']">上传</el-button>
+        <el-button type="danger" icon="Delete" @click="handleDelete" size="small" v-hasPermi="['business:upload:del']">作废</el-button>
+      </el-form-item>
+    </el-form>
+    <!-- <div v-if="flag && flag2 && tenant.versionId !== '4'">
+      <el-tabs v-model="activeName" class="demo-tabs" @tab-click="handleClick">
+        <el-tab-pane label="全部" name="first">
+
+        </el-tab-pane>
+        <el-tab-pane label="我的" name="second">
+
+        </el-tab-pane>
+      </el-tabs>
+    </div> -->
+
+    <!-- 列表区 -->
+    <el-table v-loading="loading" :data="list" size="small" border height="100%"
+      @selection-change="handleSelectionChange">
+      <el-table-column type="selection" width="55" align="center" />
+      <el-table-column label="附件名称" prop="fileName" min-width="110" align="left" />
+      <el-table-column label="客户名称" align="center" prop="companyName">
+        <template #default="scope">
+          <div style="display: flex; align-items: center; ">
+            <template v-if="scope.row.customerLabelName ">
+              <el-tooltip :content="scope.row.customerLabelName" placement="top">
+                <el-icon :size="15">
+                  <CollectionTag />
+                </el-icon>
+              </el-tooltip>
+              <span style="padding-left:5px;">{{ scope.row.companyName }}</span>
+            </template>
+            <template v-else>
+              <div style="width: 20px; height: 15px;"></div>
+              <span>{{ scope.row.companyName }}</span>
+            </template>
+          </div>
+        </template>
+      </el-table-column>
+      <el-table-column label="来源" align="center" prop="accountName" min-width="100"
+        v-if="tenant.versionId === '4'" />
+      <el-table-column label="附件类型" align="center" prop="type" width="120">
+        <template #default="scope">
+            {{ fileTypes.find(f => f.value == scope.row.type).label }}
+        </template>
+      </el-table-column>
+      <el-table-column label="上传人" align="center" prop="userName" width="120" />
+      <el-table-column label="上传时间" align="center" prop="createTime" width="180" />
+      <el-table-column label="文件状态" align="center" prop="deleted" width="80">
+        <template #default="scope">
+          <template v-if="scope.row.deleted">
+            <el-tag type="danger">作废</el-tag>
+          </template>
+          <template v-else>
+            <el-tag type="success">正常</el-tag>
+          </template>
+        </template>
+      </el-table-column>
+      <el-table-column label="操作" width="130" align="center" class-name="small-padding fixed-width">
+        <template #default="scope">
+          <el-button link size="small" type="primary" circle
+            @click="viewHandle(scope.row)">查看</el-button>
+          <el-button size="small" link type="primary" circle
+            @click="downloadHandle(scope.row)">下载</el-button>
+        </template>
+      </el-table-column>
+    </el-table>
+    <!-- 分页 -->
+    <pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum"
+      v-model:limit="queryParams.pageSize" @pagination="getList" />
+    <el-image-viewer v-if="showViewer" :url-list="currentFileList" @close="closeImages" :initial-index="showIndex" />
+    <form-dialog ref="formDialogRef" :getList="getList" :fileTypes="fileTypes" />
+    <view-dialog ref="viewDialogRef" :getList="getList" />
+  </div>
+</template>
+
+<script setup name="ResouceUpload">
+  import { listLableNoPage } from "@/api/business/lable"
+  import { listFile, delFile } from "@/api/business/fileUpload";
+  import { uploadFile, downloadFile } from "@/api/tool/file";
+  import useUserStore from "@/store/modules/user";
+  import { ref } from "vue";
+  import formDialog from "./form.vue";
+  import viewDialog from "./view.vue";
+  const { proxy } = getCurrentInstance();
+  /** 字典数组区 */
+  /** 查询 对象 */
+  const tenant = useUserStore().tenant
+  const list = ref([]);
+  const loading = ref(true);
+  const ids = ref([]);
+  const single = ref(true);
+  const multiple = ref(true);
+  const oneself = ref(false);
+  const total = ref(0);
+  const baseUrl = ref(import.meta.env.VITE_APP_BASE_API);
+  const showViewer = ref(false);
+  const currentFileList = ref([]);
+  const showIndex = ref(0);
+
+  const permissions = useUserStore().permissions;
+
+  const currentMonth = ref(
+    proxy.moment().subtract(1, "month").format("YYYY-MM-01")
+  );
+  const fileTypes = ref([
+    {value: 1, label: '票据'},
+    {value: 2, label: '银行'},
+    {value: 3, label: '社保及公积金'},
+    {value: 4, label: '库存表'},
+  ])
+  const formOpen = ref(false);
+  const formDialogRef = ref(null);
+  const viewDialogRef = ref(null);
+  const flag = ref(checkPermission(['business:upload:person']))
+  const flag2 = ref(checkPermission(['business:upload:myself']))
+  const activeName = flag.value ? ref('first') : ref('second');
+  const options = ref([]);
+  const form = ref({
+    id: null,
+    companyName: "",
+    companyId: null,
+    remark: "",
+    type: 1,
+    files: [],
+  });
+
+  const emptyForm = {
+    id: null,
+    companyName: "",
+    companyId: null,
+    type: 1,
+    remark: "",
+    files: [],
+  };
+
+  /** 查询对象 */
+  const queryParams = ref({
+    pageNum: 1,
+    pageSize: 20,
+    orderByColumn: "create_time",
+    year: proxy.moment().subtract(1, "month").format("yyyy"),
+    month: proxy.moment().subtract(1, "month").format("MM"),
+    principal: tenant.versionId !== '4' && !flag.value ? useUserStore().user.userId : null,
+    tenantVersionId: tenant.versionId
+  });
+
+  /***********************  方法区  ****************************/
+  onActivated(() => {
+    // 你的逻辑
+    getList();
+  });
+  /** 查询company列表 */
+  function getList() {
+    loading.value = true;
+    listFile(queryParams.value).then((response) => {
+      list.value = response.rows.map((l) => ({ ...l }));
+      // prev.value = proxy.deepClone(response.rows);
+      total.value = response.total;
+      loading.value = false;
+    });
+  }
+
+  /** 是否为自己负责 */
+  function handleOneself() {
+    if (oneself.value) {
+      queryParams.value.principal = useUserStore().user.userId;
+    } else {
+      queryParams.value.principal = null;
+    }
+    getList();
+  }
+
+  /** 搜索按钮操作 */
+  function handleQuery() {
+    queryParams.value.pageNum = 1;
+    getList();
+  }
+  function checkPermission(templatePermission) {
+    const all_permission = "*:*:*";
+    const permissions = useUserStore().permissions;
+    const hasPermissions = permissions.some((permission) => {
+      return (
+        all_permission === permission || templatePermission.includes(permission)
+      );
+    });
+    return hasPermissions;
+  }
+  /** 重置按钮操作 */
+  function resetQuery() {
+    queryParams.value = {
+      pageNum: 1,
+      pageSize: 20,
+      year: proxy.moment().format("YYYY"),
+      month: proxy.moment().format("MM"),
+      orderByColumn: "create_time",
+      tenantVersionId: tenant.versionId
+    };
+    if (activeName.value != null && activeName.value === 'second') {
+      queryParams.value.principal = useUserStore().user.userId;
+    }
+    handleQuery();
+  }
+
+  // 多选框选中数据
+  function handleSelectionChange(selection) {
+    ids.value = selection.map((item) => item.id);
+    single.value = selection.length != 1;
+    multiple.value = !selection.length;
+  }
+  function getOption() {
+    listLableNoPage().then(res => {
+      options.value = res.data
+    })
+  }
+  /** 新增按钮操作 */
+  function handleAdd() {
+    // proxy.$refs.DepositRef.open();
+    formOpen.value = true;
+  }
+
+  function formCancel() {
+    formOpen.value = false;
+    reset();
+  }
+
+  function reset() {
+    form.value = proxy.deepClone(emptyForm);
+  }
+
+  /** 删除按钮操作 */
+  function handleDelete(row) {
+    const _ids = row.id || ids.value;
+    proxy.$modal
+      .confirm("是否确认删除选中的数据项?")
+      .then(function () {
+        return delFile(_ids);
+      })
+      .then(() => {
+        getList();
+        proxy.$modal.msgSuccess("删除成功!");
+      })
+      .catch(() => { });
+  }
+
+  function upload(param) {
+    const formData = new FormData();
+    formData.append("file", param.file);
+    uploadFile(formData).then((res) => {
+      if (res.code === 200) {
+        const file = {};
+        file.fileName = res.newFileName;
+        file.url = res.url;
+        file.originalFileName = res.originalFilename;
+        file.fileUrl = res.fileName;
+        file.masterId = form.value.id;
+        file.masterTableName = "biz_deduction";
+        form.value.files.push(file);
+      }
+    });
+  }
+
+  function showFileList(row) {
+    currentFileList.value = row.files.map((l) => `${baseUrl.value}${l.fileUrl}`);
+    showViewer.value = true;
+  }
+
+  function closeImages() {
+    showViewer.value = false;
+  }
+
+
+  function getForm(id) {
+    getDeposit(id).then((res) => {
+      form.value = res.data;
+      if (form.value == null) {
+        reset();
+      }
+    });
+  }
+
+  function handleDelFile(index) {
+    form.value.files.splice(index, 1);
+  }
+
+  function showFeedbackDialog(row) {
+    const value = proxy.deepClone(row);
+    value.status = 4;
+    proxy.$refs.feedbackDialogRef.open(value);
+  }
+
+  function verifyDeduction(value) {
+    saveDeduction(value).then((res) => {
+      getList();
+    });
+  }
+
+  function currentMonthChange(arg) {
+    const year = proxy.moment(arg).format("YYYY");
+    const month = proxy.moment(arg).format("MM");
+    queryParams.value.year = year;
+    queryParams.value.month = month;
+    handleQuery();
+  }
+
+  function disabledDateHandler(date) {
+    if (date <= proxy.moment().subtract(1, "month")) {
+      return false;
+    } else {
+      return true;
+    }
+  }
+
+  function uploadHandle(row) {
+    formDialogRef.value.open();
+  }
+  function viewHandle(row) {
+    const fileExtension = row.fileName.match(/\.([^.]+)$/)[1];
+    if(!['xlsx', 'xls', 'doc', 'docx', 'txt', 'pdf', 'jpg', 'png'].includes(fileExtension)) {
+      proxy.$modal.msgError(`该文件格式不支持预览!`);
+      return false
+    }
+    viewDialogRef.value.open(row);
+  }
+  function downloadHandle(row) {
+    downloadFile({fileName: row.fileUrl, delete: false})
+      .then((blob) => {
+        const link = document.createElement('a');
+        link.href = URL.createObjectURL(blob);
+        // 下载文件的名称及文件类型后缀
+        link.download = row.fileName;
+        document.body.appendChild(link);
+        link.click();
+        //在资源下载完成后 清除 占用的缓存资源
+        window.URL.revokeObjectURL(link.href);
+        document.body.removeChild(link);
+      });
+  }
+  getList();
+  getOption();
+</script>

+ 84 - 0
src/views/business/production/receiveResource/view.vue

@@ -0,0 +1,84 @@
+<template>
+  <el-dialog v-model="visible" :width="width" append-to-body show-close :close-on-click-modal="false">
+    <template #header>
+      <div class="dialog-title-container">
+        <span class="title-label" style="color: #fff; display: flex; flex-direction: row; justify-content: flex-start; align-items: center; line-height: 26px;"> <el-icon> <Document /> </el-icon>预览</span>
+      </div>
+    </template>
+    <div>
+      <div style="padding: 8px 24px 16px 24px">
+        <vue-office-excel v-if="['xlsx', 'xls'].includes(fileExtension)" :src="`${baseUrl}${form.fileUrl}`" style="width: 100%; min-height: 800px;"></vue-office-excel>
+        <vue-office-docx v-else-if="['doc', 'docx'].includes(fileExtension)" :src="`${baseUrl}${form.fileUrl}`" style="width: 100%; min-height: 800px;"></vue-office-docx>
+        <vue-office-pdf v-else-if="['pdf'].includes(fileExtension)" :src="`${baseUrl}${form.fileUrl}`" style="width: 100%; min-height: 800px;"></vue-office-pdf>
+        <iframe v-else-if="['txt',].includes(fileExtension)" :src="`${baseUrl}${form.fileUrl}`" style="width: 100%; min-height: 800px;"></iframe>
+        <el-image v-else-if="['jpg', 'png'].includes(fileExtension)" style="width: 100%; min-height: 800px" :src="`${baseUrl}${form.fileUrl}`" 
+        :zoom-rate="1.2"
+        :max-scale="7"
+        :min-scale="0.2"
+        :preview-src-list="[`${baseUrl}${form.fileUrl}`]"/>
+      </div>
+    </div>
+  </el-dialog>
+</template>
+<script setup>
+  import { reactive } from "vue";
+  import VueOfficeDocx from '@vue-office/docx';
+  import '@vue-office/docx/lib/index.css'; 
+  import VueOfficeExcel from '@vue-office/excel';
+  import '@vue-office/excel/lib/index.css'; 
+  import VueOfficePdf from '@vue-office/pdf';
+  import '@vue-office/pdf/lib/index.js'; 
+  const { proxy } = getCurrentInstance();
+
+  const props = defineProps({
+    getList: {
+      type: Function,
+      default: () => { },
+    },
+    width: {
+      type: String,
+      default: "1200px",
+    },
+  });
+
+  const fileExtension = ref('')
+  // import api from '@/api/biz/fileStorage'
+  const data = reactive({
+    visible: false,
+    list: [],
+    total: 0,
+    query: {
+      name: "",
+      total: 0,
+      pageSize: 15,
+      pageNum: 1,
+    },
+    files: [],
+    months: [],
+    form: {},
+    selection: [],
+    baseUrl: import.meta.env.VITE_APP_BASE_API,
+    options: {},
+  });
+  const {
+    visible,
+    baseUrl,
+    form,
+  } = toRefs(data);
+  function open(arg) {
+    visible.value = true;
+    form.value = arg;
+    // loading.value = true
+    fileExtension.value = arg.fileName.match(/\.([^.]+)$/)[1];
+  }
+  /**
+   * 对话框关闭 事件
+   */
+  function close() {
+    visible.value = false;
+  }
+ 
+  defineExpose({
+    open,
+  });
+</script>