gaoluyang
8 天以前 60af97808e44b3a483145199f79a0828469db122
src/views/basicData/supplierManage/index.vue
@@ -35,6 +35,7 @@
        :isSelection="true"
        @selection-change="handleSelectionChange"
        :tableLoading="tableLoading"
            @pagination="pagination"
      ></PIMTable>
    </div>
    <el-dialog
@@ -191,6 +192,7 @@
        :disabled="upload.isUploading"
        :on-progress="handleFileUploadProgress"
        :on-success="handleFileSuccess"
        :on-error="handleFileError"
        :auto-upload="false"
        drag
      >
@@ -220,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";
@@ -243,6 +245,11 @@
    width: 250,
  },
  {
    label: "纳税人识别号",
    prop: "taxpayerIdentificationNum",
    width: 230,
  },
  {
    label: "公司地址",
    prop: "companyAddress",
    width: 220,
@@ -250,14 +257,17 @@
  {
    label: "联系方式",
    prop: "companyPhone",
    width:150
  },
  {
    label: "开户行",
    prop: "bankAccountName",
    width: 220,
  },
  {
    label: "账号",
    prop: "bankAccountNum",
    width: 220,
  },
  {
    label: "联系人",
@@ -266,6 +276,7 @@
  {
    label: "联系电话",
    prop: "contactUserPhone",
    width: 150,
  },
  {
    label: "维护人",
@@ -275,11 +286,13 @@
  {
    label: "维护时间",
    prop: "maintainTime",
    width:100
  },
  {
    dataType: "action",
    label: "操作",
    align: "center",
      fixed: 'right',
    operation: [
      {
        name: "编辑",
@@ -287,6 +300,9 @@
        clickFun: (row) => {
          openForm("edit", row);
        },
            disabled: (row) => {
               return row.maintainUserName !== userStore.nickName
            }
      },
    ],
  },
@@ -297,7 +313,7 @@
const tableLoading = ref(false);
const page = reactive({
  current: 1,
  size: 10,
  size: 100,
  total: 0,
});
@@ -350,6 +366,7 @@
};
/** 提交上传文件 */
function submitFileForm() {
  upload.isUploading = true;
  proxy.$refs["uploadRef"].submit();
}
const getList = () => {
@@ -367,6 +384,8 @@
  title: "",
  // 是否禁用上传
  isUploading: false,
  // 是否更新已经存在的用户数据
  updateSupport: 1,
  // 设置上传的请求头部
  headers: { Authorization: "Bearer " + getToken() },
  // 上传的地址
@@ -377,6 +396,36 @@
  upload.title = "供应商导入";
  upload.open = true;
}
/** 下载模板 */
function importTemplate() {
  proxy.download("/system/supplier/downloadTemplate", {}, "供应商导入模板.xlsx");
}
/**文件上传中处理 */
const handleFileUploadProgress = (event, file, fileList) => {
  upload.isUploading = true;
};
/** 文件上传成功处理 */
const handleFileSuccess = (response, file, fileList) => {
  upload.isUploading = false;
  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) => {
  selectedRows.value = selection;
@@ -448,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("请选择数据");