研发图纸文件管理系统-前端项目
whychdw
2025-02-18 27991319224bf659a93eda75934d0ab945e075e1
src/pages/resourceManage/software/list.vue
@@ -28,6 +28,7 @@
              onChange: onPageChange,
              onShowSizeChange: onSizeChange,
            }"
            :rowClassName="rowClassFn"
          >
            <template slot="dataIndex" slot-scope="{ index }">
              {{ index + 1 }}
@@ -62,7 +63,9 @@
              </a-popover>
              <template v-if="canDownloadSoftware">
                <a-divider type="vertical"></a-divider>
                <a :disabled="!!record.soft.lockFlag" @click="download(record)"
                <a
                  :disabled="!!record.soft.lockFlag && !isTester"
                  @click="download(record)"
                  >下载</a
                >
                <a-divider type="vertical"></a-divider>
@@ -87,6 +90,12 @@
                    type="primary"
                    @click="handleEmailShow(record)"
                    >邮件通知</a-button
                  >
                  <a-button
                    type="primary"
                    :disabled="!isTester"
                    @click="handleConfirmDelete(record)"
                    >删除</a-button
                  >
                </a-space>
                <a>更多</a>
@@ -218,6 +227,8 @@
import moment from "moment";
import { getUserList } from "../../permission/apis";
import { message, Modal } from "ant-design-vue";
import {
  getList,
  downLoadSoftware,
@@ -225,6 +236,7 @@
  productSoftwareSubmit,
  applyModel,
  updateSoftwareLock,
  deleteSoftwareApi,
} from "./apis";
import { mapGetters } from "vuex";
import EmailCard from "../../components/emailCard";
@@ -233,15 +245,16 @@
  sendMail,
} from "../../components/emailCard/apis";
import { getRoleUser } from "@/pages/user/apis";
// TODO
const tester = ["李桂华"];
// const tester = ["李桂华"];
export default {
  name: "",
  data() {
    return {
      mailList: [],
      tester,
      tester: [],
      versionTime: moment().format("YYYY-MM-DD HH:mm:ss"),
      reasonVisible: false,
      reason: "",
@@ -287,6 +300,7 @@
          searchAble: true,
          noSearch: true,
          search: {
            default: 0,
            selectOptions: [
              {
                title: "全部",
@@ -316,6 +330,13 @@
          customCell: this.customCell,
        },
        {
          title: "上传日期",
          dataIndex: "soft.createTime",
          align: "center",
          noSearch: true,
          customCell: this.customCell,
        },
        {
          title: "类型",
          dataIndex: "soft.type",
          align: "center",
@@ -327,7 +348,7 @@
          title: "版本",
          dataIndex: "soft.version",
          align: "center",
          noSearch: true,
          searchAble: true,
          customCell: this.customCell,
        },
        {
@@ -415,13 +436,20 @@
  },
  methods: {
    moment,
    rowClassFn(record) {
      let classList = [];
      if (record.soft.lockFlag == -1) {
        classList.push("locked");
      }
      return classList;
    },
    disabledDate(current) {
      // Can not select days before today and today
      return current > moment().endOf("day");
    },
    onSearch(conditions, searchOptions) {
      console.log(conditions);
      console.log(searchOptions, "options");
      // console.log(conditions);
      // console.log(searchOptions, "options");
      this.pageCurr = 1;
      this.conditions = conditions;
      this.searchData();
@@ -441,7 +469,7 @@
      this.searchData();
    },
    onReset(conditions) {
      console.log(conditions, "reset");
      // console.log(conditions, "reset");
      this.conditions = conditions;
      this.searchData();
    },
@@ -464,6 +492,9 @@
            break;
          case "soft.boardNumber":
            params["boardNumber"] = conditions[v];
            break;
          case "soft.version":
            params["version"] = conditions[v];
            break;
          default:
            params[v] = conditions[v];
@@ -663,7 +694,7 @@
        });
    },
    cellMouseenter(e, obj) {
      console.log("enter", e, obj);
      // console.log("enter", e, obj);
      const wraper = this.$refs.wraper;
      const { clientHeight, clientWidth } = wraper;
      const { target, clientX, clientY } = e;
@@ -823,6 +854,44 @@
          });
      });
    },
    getRoleUser() {
      getRoleUser(0)
        .then((res) => {
          let { code, data, data2 } = res.data;
          let list = [];
          if (code && data) {
            // console.log(data);
            list = data2.map((v) => v.name);
          }
          this.tester = list;
        })
        .catch((err) => {
          console.log(err);
        });
    },
    handleConfirmDelete(obj) {
      Modal.confirm({
        content: () => "删除当前软件,删除后无法恢复,请注意!!!",
        onOk: async () => {
          try {
            const res = await deleteSoftwareApi(
              obj.soft.fileName,
              obj.soft.version
            );
            const rs = res.data;
            if (rs.code === 1 && rs.data) {
              this.$message.success("删除成功。");
            } else {
              this.$message.error("删除失败!!!");
            }
            this.searchData();
          } catch (e) {
            this.$message.error("删除失败,请联系开发人员!!!");
            console.log(e);
          }
        },
      });
    },
  },
  watch: {
    update(n) {
@@ -875,6 +944,7 @@
    },
  },
  mounted() {
    this.getRoleUser();
    this.searchData();
    this.searchAllUserList();
    window.addEventListener("resize", this.resize);
@@ -944,4 +1014,11 @@
.btn-grp button {
  width: 6.4em;
}
/deep/.locked > td {
  background: #fec54b;
}
/deep/.locked.locked.locked.ant-table-row-hover > td,
/deep/.locked.locked.locked:hover > td {
  background: #fcd583;
}
</style>