沈丘营商办后台前端项目
王恒
5 天以前 cd95b584fe7da1ea63476871eabf512213a31e69
src/views/system/manage/index.vue
@@ -29,21 +29,21 @@
        <el-button type="primary" plain icon="Plus" @click="handleAdd()" v-hasPermi="['system:dept:add']">新增</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button type="info" plain icon="Upload" @click="handleImport"
        <el-button type="warning" plain icon="Upload" @click="handleImport"
          v-hasPermi="['system:user:import']">导入</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button type="primary" plain icon="Download" @click="downLoadCode">导出</el-button>
        <el-button type="success" plain icon="Download" @click="downLoadCode">导出</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button type="primary" plain icon="Download" @click="downLoadCode">发起综合查一次</el-button>
        <el-button type="primary" plain icon="View" @click="downLoadCode">发起综合查一次</el-button>
      </el-col>
    </el-row>
    <!-- @selection-change="handleSelectionChange" -->
    <el-table v-if="refreshTable" v-loading="loading" :data="deptList" row-key="companyId"
      :default-expand-all="isExpandAll" :tree-props="{ children: 'children', hasChildren: 'hasChildren' }"
      @selection-change="handleSelectionChange">
      <el-table-column type="selection" width="55" align="center" />
      :default-expand-all="isExpandAll" :tree-props="{ children: 'children', hasChildren: 'hasChildren' }">
      <!-- <el-table-column type="selection" width="55" align="center" /> -->
      <el-table-column prop="planNo" label="序号" width="55">
        <template #default="scope">{{ scope.$index + 1 }}</template>
      </el-table-column>
@@ -59,7 +59,7 @@
      <el-table-column prop="planFrequency" label="计划频次" width="180"></el-table-column>
      <el-table-column prop="planMonth" label="计划月份" width="180"></el-table-column>
      <el-table-column prop="planStatus" label="状态" width="180"></el-table-column>
      <el-table-column label="操作" align="center" fixed="right" class-name="small-padding fixed-width" width="240">
      <el-table-column label="操作" align="center" fixed="right" class-name="small-padding fixed-width" width="180">
        <template #default="scope">
          <el-link type="info" @click="handleView(scope.row)">查看</el-link>
          <el-divider direction="vertical" />
@@ -232,11 +232,12 @@
<script setup name="Dept">
import { getToken } from "@/utils/auth";
import { listCompany, addCompany, updStatus, delCompany, updateCompany, getCompany } from "@/api/system/company/company";
import { listManage, addManage, getManage, updateManage, delManage } from "@/api/system/manage";
import { listManage, addManage, getManage, updateManage, delManage, exportTemplate, exportManage } from "@/api/system/manage";
import { computed } from "vue";
import useSettingsStore from "@/store/modules/settings";
import { download } from '@/utils/request'; // 下载文件
// import { download } from '@/utils/request'; // 下载文件
import { download as downloadHttp } from '@/utils/request'
const { proxy } = getCurrentInstance();
const { sys_normal_disable } = proxy.useDict("sys_normal_disable");
const deptList = ref([]);
@@ -287,9 +288,22 @@
  // 设置上传的请求头部
  headers: { Authorization: "Bearer " + getToken() },
  // 上传的地址
  url: import.meta.env.VITE_APP_BASE_API + "/system/user/importData",
  url: import.meta.env.VITE_APP_BASE_API + "/system/manage/importData",
});
/**文件上传中处理 */
const handleFileUploadProgress = (event, file, fileList) => {
  upload.isUploading = true;
};
/** 文件上传成功处理 */
const handleFileSuccess = (response, file, fileList) => {
  upload.open = false;
  upload.isUploading = false;
  proxy.$refs["uploadRef"].handleRemove(file);
  proxy.$alert("<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" + response.msg + "</div>", "导入结果", {
    dangerouslyUseHTMLString: true,
  });
  getList();
};
const { queryParams, form, rules } = toRefs(data);
/** 查询计划列表 */
function getList() {
@@ -332,6 +346,10 @@
/** 重置按钮操作 */
function resetQuery() {
  queryRef.value.resetFields();
  queryParams.value = {
    planNo: '', // 计划编号
    planName: '', // 计划名称
  }
  handleQuery();
}
function getDetails(id) {
@@ -409,29 +427,30 @@
/** 下载模板操作 */
function importTemplate() {
  proxy.download("system/manage/exportTemplate", {}, `plan_template_${new Date().getTime()}.xlsx`);
}
// 修改企业信息
function changeCompanyNews(row, event) {
  if (loading.value) {
    return
  }
  updStatus(row).then(val => {
    proxy.$modal.msgSuccess("修改成功");
    getList();
  exportTemplate().then(val => {
    downloadHttp('/tool/file/download', {
      fileName: val.msg,
      delete: true
    }, "计划信息模板.xlsx")
  })
}
let valueArr = []
// let valueArr = []
function downLoadCode() {
  download('/system/manage/export', {
    ids: valueArr.join()
  }, `plan_${new Date().getTime()}.xlsx`)
  exportManage().then(val => {
    downloadHttp('/tool/file/download', {
      fileName: val.msg,
      delete: true
    }, "计划信息.xlsx")
  })
}
function handleSelectionChange(e) {
  valueArr = e.map(item => item.id)
}
// function handleSelectionChange(e) {
//   valueArr = e.map(item => item.id)
// }
getList();
function selectableFun(e) {
  console.log(e)