gaoluyang
8 天以前 a78e352b672fd6b634c24e0d9cf184f56b846f6a
src/views/basicData/supplierManage/index.vue
@@ -192,6 +192,7 @@
        :disabled="upload.isUploading"
        :on-progress="handleFileUploadProgress"
        :on-success="handleFileSuccess"
        :on-error="handleFileError"
        :auto-upload="false"
        drag
      >
@@ -200,13 +201,13 @@
        <template #tip>
          <div class="el-upload__tip text-center">
            <span>仅允许导入xls、xlsx格式文件。</span>
            <!-- <el-link
            <el-link
              type="primary"
              :underline="false"
              style="font-size: 12px; vertical-align: baseline"
              @click="importTemplate"
              >下载模板</el-link
            > -->
            >
          </div>
        </template>
      </el-upload>
@@ -221,7 +222,7 @@
</template>
<script setup>
import { ref } from "vue";
import { onMounted, ref } from "vue";
import { Search } from "@element-plus/icons-vue";
import { delSupplier } from "@/api/basicData/supplierManageFile.js";
import { ElMessageBox } from "element-plus";
@@ -242,6 +243,11 @@
    label: "供应商名称",
    prop: "supplierName",
    width: 250,
  },
  {
    label: "纳税人识别号",
    prop: "taxpayerIdentificationNum",
    width: 230,
  },
  {
    label: "公司地址",
@@ -286,6 +292,7 @@
    dataType: "action",
    label: "操作",
    align: "center",
      fixed: 'right',
    operation: [
      {
        name: "编辑",
@@ -293,6 +300,9 @@
        clickFun: (row) => {
          openForm("edit", row);
        },
            disabled: (row) => {
               return row.maintainUserName !== userStore.nickName
            }
      },
    ],
  },
@@ -356,7 +366,7 @@
};
/** 提交上传文件 */
function submitFileForm() {
  console.log(upload.url + '?updateSupport=' + upload.updateSupport)
  upload.isUploading = true;
  proxy.$refs["uploadRef"].submit();
}
const getList = () => {
@@ -386,6 +396,10 @@
  upload.title = "供应商导入";
  upload.open = true;
}
/** 下载模板 */
function importTemplate() {
  proxy.download("/system/supplier/downloadTemplate", {}, "供应商导入模板.xlsx");
}
/**文件上传中处理 */
const handleFileUploadProgress = (event, file, fileList) => {
@@ -394,10 +408,23 @@
/** 文件上传成功处理 */
const handleFileSuccess = (response, file, fileList) => {
  upload.open = false;
  upload.isUploading = false;
  proxy.$refs["uploadRef"].handleRemove(file);
  getList();
  if(response.code === 200){
    proxy.$modal.msgSuccess("文件上传成功");
    upload.open = false;
    proxy.$refs["uploadRef"].clearFiles();
    getList();
  }else if(response.code === 500){
    proxy.$modal.msgError(response.msg);
  }else{
    proxy.$modal.msgWarning(response.msg);
  }
};
/** 文件上传失败处理 */
const handleFileError = (error, file, fileList) => {
  upload.isUploading = false;
  proxy.$modal.msgError("文件上传失败");
};
// 表格选择数据
const handleSelectionChange = (selection) => {
@@ -470,6 +497,12 @@
const handleDelete = () => {
  let ids = [];
  if (selectedRows.value.length > 0) {
      // 检查是否有他人维护的数据
      const unauthorizedData = selectedRows.value.filter(item => item.maintainUserName !== userStore.nickName);
      if (unauthorizedData.length > 0) {
         proxy.$modal.msgWarning("不可删除他人维护的数据");
         return;
      }
    ids = selectedRows.value.map((item) => item.id);
  } else {
    proxy.$modal.msgWarning("请选择数据");