研发图纸文件管理系统-前端项目
he wei
2025-03-13 b9286feac19a914f5646a1218a80156db027ed81
U 软件已上传的源码包 共享给未上传的
3个文件已修改
382 ■■■■ 已修改文件
src/pages/resourceManage/software/apis.js 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/resourceManage/software/list.vue 354 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/user/apis.js 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/resourceManage/software/apis.js
@@ -136,6 +136,18 @@
    }
  })
}
/**
 * 按软件负责人查询 他的未上传源码的所有软件 记录
 */
export const getFileNameByOwner = (owner) => {
  return axios({
    method: "GET",
    url: "softcode/getFileNameByOwnerWithCode",
    params: {
      owner
    }
  })
}
/**
 * 源码包上传
@@ -152,3 +164,17 @@
    data
  })
}
/**
 * 共享源码包
 */
export const connectCode = (num, fileNames) => {
  return axios({
    method: "POST",
    url: "softcode/setCodeByFileNmaes",
    data: {
      num,
      fileNames
    }
  })
}
src/pages/resourceManage/software/list.vue
@@ -3,9 +3,19 @@
    <div class="inner" ref="wraper">
      <a-spin class="" :spinning="spinning" tip="拼命加载中...">
        <a-card>
          <advance-table ref="table" class="doc-center-table" :data-source="dataSource" :columns="columns" title=""
            :row-key="(record, index) => index" @search="onSearch" @refresh="onRefresh" @reset="onReset"
            :format-conditions="true" :scroll="{ x: 2020, y }" :pagination="{
          <advance-table
            ref="table"
            class="doc-center-table"
            :data-source="dataSource"
            :columns="columns"
            title=""
            :row-key="(record, index) => index"
            @search="onSearch"
            @refresh="onRefresh"
            @reset="onReset"
            :format-conditions="true"
            :scroll="{ x: 2020, y }"
            :pagination="{
                                current: pageCurr,
                                pageSize: pageSize,
                                total: total,
@@ -17,45 +27,100 @@
                                  `第 ${range[0]}-${range[1]} 条,总计 ${total} 条`,
                                onChange: onPageChange,
                                onShowSizeChange: onSizeChange,
                              }" :rowClassName="rowClassFn">
                                }"
            :rowClassName="rowClassFn"
          >
            <template slot="dataIndex" slot-scope="{ index }">
              {{ index + 1 }}
            </template>
            <template slot="title">
              <a-space>
                <span class="title">软件中心</span>
                <a-button v-if="canUploadSoftware" type="primary" @click="showUpload">上传软件</a-button>
                <a-button
                  v-if="canUploadSoftware"
                  type="primary"
                  @click="showUpload"
                  >上传软件</a-button
                >
              </a-space>
            </template>
            <template slot="tags" slot-scope="tags">
              <a-tag :color="tags.record.codeFlag ? 'green' : 'red'">{{ tags.text }}</a-tag>
              <a-tag
                :color="tags.record.codeFlag ? 'green' : 'red'"
                >{{ tags.text }}</a-tag
              >
            </template>
            <template slot="action" slot-scope="{ record }">
              <a-popover title="" trigger="hover">
                <div class="" slot="content" style="width: 450px">
                  <a-table size="small" :scroll="{ y: 300 }" bordered :columns="prodsColumns" :data-source="record.links"
                    :pagination="false" :expandRowByClick="true" :row-key="(record1, index) => index">
                  <a-table
                    size="small"
                    :scroll="{ y: 300 }"
                    bordered
                    :columns="prodsColumns"
                    :data-source="record.links"
                    :pagination="false"
                    :expandRowByClick="true"
                    :row-key="(record1, index) => index"
                  >
                  </a-table>
                </div>
                <a>适用机型</a>
              </a-popover>
              <template v-if="canDownloadSoftware">
                <a-divider type="vertical"></a-divider>
                <a :disabled="!!record.soft.lockFlag && !isTester" @click="download(record)">下载</a>
                <a
                  :disabled="!!record.soft.lockFlag && !isTester"
                  @click="download(record)"
                  >下载</a
                >
                <a-divider type="vertical"></a-divider>
              </template>
              <a-popover title="" trigger="hover">
                <a-space class="btn-grp" direction="vertical" slot="content">
                  <a-button v-if="canUploadSoftware" :disabled="!!record.soft.lockFlag" type="primary"
                    @click="updateDesc(record)">更新说明</a-button>
                  <a-button v-if="record.soft.lockFlag !== -1 ? canLock : isTester" type="primary"
                    @click="lock(record)">{{ record.soft.lockFlag ? "解锁" : "锁定" }}</a-button>
                  <a-button v-if="canUploadSoftware" type="primary" @click="handleEmailShow(record)">邮件通知</a-button>
                  <a-button type="primary" :disabled="!isTester" @click="handleConfirmDelete(record)">删除</a-button>
                  <template v-if="isCoder">
                    <a-button type="primary" v-if="record.codeFlag" @click="downloadSource(record)">下载源码</a-button>
                    <a-button type="primary" @click="uploadSourceClick(record)">上传源码</a-button>
                  </template>
                  <a-button
                    v-if="canUploadSoftware"
                    :disabled="!!record.soft.lockFlag"
                    type="primary"
                    @click="updateDesc(record)"
                    >更新说明</a-button
                  >
                  <a-button
                    v-if="record.soft.lockFlag !== -1 ? canLock : isTester"
                    type="primary"
                    @click="lock(record)"
                    >{{ record.soft.lockFlag ? "解锁" : "锁定" }}</a-button
                  >
                  <a-button
                    v-if="canUploadSoftware"
                    type="primary"
                    @click="handleEmailShow(record)"
                    >邮件通知</a-button
                  >
                  <a-button
                    type="primary"
                    :disabled="!isTester"
                    @click="handleConfirmDelete(record)"
                    >删除</a-button
                  >
                  <a-button
                    type="primary"
                    v-if="isCoderDown && record.codeFlag"
                    @click="downloadSource(record)"
                    >下载源码</a-button
                  >
                  <a-button
                    type="primary"
                    v-if="isCoderUp && record.soft.owner == user.name && record.codeFlag"
                    @click="connectSource(record)"
                    >共享源码</a-button
                  >
                  <a-button
                    type="primary"
                    v-if="isCoderUp && record.soft.owner == user.name"
                    @click="uploadSourceClick(record)"
                    >上传源码</a-button
                  >
                </a-space>
                <a>更多</a>
              </a-popover>
@@ -65,22 +130,39 @@
      </a-spin>
    </div>
    <!-- 上传软件 -->
    <a-modal :visible="uploadShow" :footer="null" :width="760" :title="onlyXls ? '更新发布说明' : '上传软件'" :destroyOnClose="true"
      :maskClosable="false" @cancel="uploadCancel">
    <a-modal
      :visible="uploadShow"
      :footer="null"
      :width="760"
      :title="onlyXls ? '更新发布说明' : '上传软件'"
      :destroyOnClose="true"
      :maskClosable="false"
      @cancel="uploadCancel"
    >
      <div class="">
        <template v-if="!onlyXls">
          <a-row type="flex" class="row">
            <a-col flex="6em" class="label">更新时间</a-col>
            <a-col :flex="1">
              <a-date-picker format="YYYY-MM-DD HH:mm:ss" valueFormat="YYYY-MM-DD HH:mm:ss" :allowClear="false"
                :disabled-date="disabledDate" :show-time="{ defaultValue: moment('00:00:00', 'HH:mm:ss') }"
                v-model="versionTime" />
              <a-date-picker
                format="YYYY-MM-DD HH:mm:ss"
                valueFormat="YYYY-MM-DD HH:mm:ss"
                :allowClear="false"
                :disabled-date="disabledDate"
                :show-time="{ defaultValue: moment('00:00:00', 'HH:mm:ss') }"
                v-model="versionTime"
              />
            </a-col>
          </a-row>
          <a-row type="flex" class="row">
            <a-col flex="6em" class="label">软件包</a-col>
            <a-col :flex="1">
              <a-upload class="upload" :before-upload="beforeUpload" @change="uploadChange" accept=".zip,.rar">
              <a-upload
                class="upload"
                :before-upload="beforeUpload"
                @change="uploadChange"
                accept=".zip,.rar"
              >
                <a-button type="primary">选择软件</a-button>
              </a-upload>
            </a-col>
@@ -89,7 +171,12 @@
        <a-row type="flex" class="row">
          <a-col flex="6em" class="label">软件说明</a-col>
          <a-col :flex="1">
            <a-upload class="upload" :before-upload="beforeUpload" @change="uploadChange1" accept=".xls,.xlsx">
            <a-upload
              class="upload"
              :before-upload="beforeUpload"
              @change="uploadChange1"
              accept=".xls,.xlsx"
            >
              <a-button type="primary">说明文件</a-button>
            </a-upload>
          </a-col>
@@ -107,34 +194,81 @@
        </div>
      </div>
    </a-modal>
    <pop :visible.sync="popVisible" :x="popPosition.x" :y="popPosition.y" :info="popInfo" :position="popPosition.dir">
    <pop
      :visible.sync="popVisible"
      :x="popPosition.x"
      :y="popPosition.y"
      :info="popInfo"
      :position="popPosition.dir"
    >
    </pop>
    <!-- 操作原因 -->
    <a-modal :visible="reasonVisible" :width="460" title="操作原因" :destroyOnClose="true" :maskClosable="false"
      @cancel="reasonCancel" @ok="reasonOk">
    <a-modal
      :visible="reasonVisible"
      :width="460"
      title="操作原因"
      :destroyOnClose="true"
      :maskClosable="false"
      @cancel="reasonCancel"
      @ok="reasonOk"
    >
      <a-form-model-item ref="name" label="操作原因">
        <a-input type="textarea" v-model="reason" placeHolder="请输入操作原因" />
        <a-input
          type="textarea"
          v-model="reason"
          placeHolder="请输入操作原因"
        />
      </a-form-model-item>
    </a-modal>
  
    <!-- 上传软件 -->
    <a-modal :visible="emailShow" :footer="null" :width="760" title="邮件发送" :destroyOnClose="true" :maskClosable="false"
      @cancel="emailCancel">
      <email-card :visible.sync="emailShow" :users="userList" :title="emailInfo.title" :content="emailInfo.content"
        v-if="emailShow"></email-card>
    <a-modal
      :visible="emailShow"
      :footer="null"
      :width="760"
      title="邮件发送"
      :destroyOnClose="true"
      :maskClosable="false"
      @cancel="emailCancel"
    >
      <email-card
        :visible.sync="emailShow"
        :users="userList"
        :title="emailInfo.title"
        :content="emailInfo.content"
        v-if="emailShow"
      ></email-card>
    </a-modal>
  
    <!-- 上传源码包 -->
    <a-modal :visible="uploadSourceShow" :footer="null" :width="760" title="上传软件源码包" :destroyOnClose="true"
      :maskClosable="false" @cancel="uploadSourceCancel">
    <a-modal
      :visible="uploadSourceShow"
      :footer="null"
      :width="760"
      title="上传软件源码包"
      :destroyOnClose="true"
      :maskClosable="false"
      @cancel="uploadSourceCancel"
    >
      <div class="">
        <template>
          <a-row type="flex" class="row">
            <a-col flex="6em" class="label">对应软件</a-col>
            <a-col :flex="1">
              <a-select mode="multiple" placeholder="请选择对应的软件" show-search v-model="names" style="width: 36em;">
                <a-select-option v-for="(item, idx) in otherSoftList" :key="'soft_' + idx" :value="item.fileName">
                  {{ item.fileName }} <span class="version">({{ item.version }})</span>
              <a-select
                mode="multiple"
                placeholder="请选择对应的软件"
                show-search
                v-model="names"
                style="width: 36em;"
              >
                <a-select-option
                  v-for="(item, idx) in otherSoftList"
                  :key="'soft_' + idx"
                  :value="item.fileName"
                >
                  {{ item.fileName }}
                  <span class="version">({{ item.version }})</span>
                </a-select-option>
              </a-select>
            </a-col>
@@ -142,7 +276,12 @@
          <a-row type="flex" class="row">
            <a-col flex="6em" class="label">软件源码包</a-col>
            <a-col :flex="1">
              <a-upload class="upload" :before-upload="beforeUpload" @change="sourceUploadChange" accept=".zip,.rar">
              <a-upload
                class="upload"
                :before-upload="beforeUpload"
                @change="sourceUploadChange"
                accept=".zip,.rar"
              >
                <a-button type="primary">选择软件</a-button>
              </a-upload>
            </a-col>
@@ -152,6 +291,48 @@
        <div class="modal-footer">
          <a-button type="danger" @click="uploadSourceCancel"> 取消 </a-button>
          <a-button type="primary" @click="uploadSource"> 提交 </a-button>
        </div>
      </div>
    </a-modal>
    <!-- 共享源码包 -->
    <a-modal
      :visible="connectSourceShow"
      :footer="null"
      :width="760"
      title="共享软件源码包"
      :destroyOnClose="true"
      :maskClosable="false"
      @cancel="connectSourceCancel"
    >
      <div class="">
        <template>
          <a-row type="flex" class="row">
            <a-col flex="10em" class="label">要共享该源码的软件</a-col>
            <a-col :flex="1">
              <a-select
                mode="multiple"
                placeholder="请选择对应的软件"
                show-search
                v-model="fileNames"
                style="width: 36em;"
              >
                <a-select-option
                  v-for="(item, idx) in otherSoftList"
                  :key="'soft_' + idx"
                  :value="item.fileName"
                >
                  {{ item.fileName }}
                  <span class="version">({{ item.version }})</span>
                </a-select-option>
              </a-select>
            </a-col>
          </a-row>
        </template>
        <div class="modal-footer">
          <a-button type="danger" @click="connectSourceCancel"> 取消 </a-button>
          <a-button type="primary" @click="connectSourceSubmit"> 提交 </a-button>
        </div>
      </div>
    </a-modal>
@@ -181,6 +362,8 @@
        downLoadCode,
        getFileNameByCreateTime,
        uploadCode,
  connectCode,
  getFileNameByOwner,
    } from "./apis";
    import { mapGetters } from "vuex";
    import EmailCard from "../../components/emailCard";
@@ -197,8 +380,12 @@
        name: "",
        data() {
            return {
      connectSourceShow: false,
      fileNames: [],
                mailList: [],
                tester: [],
            coderDown: [],
            coderUp: [],
                versionTime: moment().format("YYYY-MM-DD HH:mm:ss"),
                reasonVisible: false,
                reason: "",
@@ -474,6 +661,7 @@
                        data = res.data2.list.map((v) => {
                            let soft = v.softwares[0];
                            return {
              ...v,
                                id: soft.id,
                                fileName: v.fileName,
                                codeFlag: v.codeFlag,
@@ -836,6 +1024,35 @@
                    .catch((err) => {
                        console.log(err);
                    });
            // 上传源码人员列表
            getRoleUser(3)
                .then((res) => {
                    let { code, data, data2 } = res.data;
                    let list = [];
                    if (code && data) {
                        // console.log(data);
                        list = data2.map((v) => v.name);
                    }
                    this.coderUp = list;
                })
                .catch((err) => {
                    console.log(err);
                });
            // 下载源码人员列表
            getRoleUser(2)
                .then((res) => {
                    let { code, data, data2 } = res.data;
                    let list = [];
                    if (code && data) {
                        // console.log(data);
                        list = data2.map((v) => v.name);
                    }
                    this.coderDown = list;
                })
                .catch((err) => {
                    console.log(err);
                });
            },
            handleConfirmDelete(obj) {
                Modal.confirm({
@@ -948,12 +1165,58 @@
                });
            },
            async uploadSourceClick(obj) {
                console.log('obj', obj, '=============');
            // console.log('obj', obj, '=============');
                this.currentObj = obj;
                let date = obj.soft.createTime.split(' ')[0];
                await this.getOtherSoft(date);
                this.names = [obj.fileName];
                this.uploadSourceShow = true;
        },
    // 共享源码
    async connectSource(record) {
      let loading = this.$layer.loading();
      this.currentObj = record;
      this.fileNames = [];
      await this.getSoftwareList(record.soft.owner);
      this.$layer.close(loading);
      this.connectSourceShow = true;
    },
    // 根据负责人 查询软件列表 未上传源码
    async getSoftwareList(name) {
      let _res = await getFileNameByOwner(name);
      let res = _res.data;
      let list = [];
      if (res.code && res.data) {
        list = res.data2;
      }
      this.otherSoftList = list;
    },
    connectSourceCancel() {
      this.connectSourceShow = false;
    },
    connectSourceSubmit() {
      let num = this.currentObj.codeNum;
      let fileNames = this.fileNames;
      if (!fileNames.length) {
        this.$message.error('请选择要共享源码包的软件');
        return false;
      }
      let loading = this.$layer.loading();
      connectCode(num, fileNames).then((res) => {
        let { code, data } = res.data;
        this.$layer.close(loading);
        if (code && data) {
          this.$message.success('操作成功');
          this.connectSourceShow = false;
        } else {
          this.$message.error('操作失败');
        }
      })
      .catch((err) => {
        this.$layer.close(loading);
        console.log(err);
      });
            },
            uploadSourceCancel() {
                this.uploadSourceShow = false;
@@ -1008,8 +1271,11 @@
            isTester() {
                return this.tester.some((v) => v == this.user.name);
            },
            isCoder() {
                return '李文涛' == this.user.name;
        isCoderUp() {
            return this.coderUp.some((v) => v == this.user.name);
        },
        isCoderDown() {
            return this.coderDown.some((v) => v == this.user.name);
            }
        },
        mounted() {
@@ -1043,6 +1309,7 @@
}
.modal-footer {
  margin-top: 16px;
  text-align: right;
  button+button {
@@ -1105,6 +1372,7 @@
/deep/.locked.locked.locked:hover>td {
  background: #fcd583;
}
.version {
  color: #090;
  display: inline-block;
src/pages/user/apis.js
@@ -128,7 +128,7 @@
  });
};
/**
 * 查询角色用户列表  权限类型0:测试,1下载
 * 查询角色用户列表  权限类型0:测试, 1下载  2:源码下载  3:源码上传
 * @param {*} roleType
 * @returns
 */