|
@@ -158,22 +158,23 @@
|
|
|
class="el-icon-delete elIcon"
|
|
|
title="删除"
|
|
|
></i>
|
|
|
- <!-- <i
|
|
|
+ <i
|
|
|
v-if="scope.row.nowRunState != '10'"
|
|
|
@click="downRow(scope.row)"
|
|
|
class="el-icon-download elIcon"
|
|
|
title="下载"
|
|
|
- ></i> -->
|
|
|
+ ></i>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</tableList>
|
|
|
|
|
|
<el-dialog
|
|
|
- title="编辑"
|
|
|
+ title="下载"
|
|
|
:visible.sync="dialogVisible"
|
|
|
width="690px"
|
|
|
:close-on-click-modal="false"
|
|
|
:close-on-press-escape="false"
|
|
|
+ :before-close="cancelDown"
|
|
|
>
|
|
|
<div class="checkboxPanel">
|
|
|
<el-checkbox-group v-model="downType">
|
|
@@ -182,10 +183,8 @@
|
|
|
</el-checkbox-group>
|
|
|
</div>
|
|
|
<span slot="footer">
|
|
|
- <el-button type="primary" @click="dialogVisible = false"
|
|
|
- >确 定</el-button
|
|
|
- >
|
|
|
- <el-button @click="dialogVisible = false">取 消</el-button>
|
|
|
+ <el-button type="primary" @click="confirmDown">确 定</el-button>
|
|
|
+ <el-button @click="cancelDown">取 消</el-button>
|
|
|
</span>
|
|
|
</el-dialog>
|
|
|
</div>
|
|
@@ -270,6 +269,7 @@ export default {
|
|
|
checkedArr: [],
|
|
|
downType: [],
|
|
|
dialogVisible: false,
|
|
|
+ curRow: {}, // 当前row
|
|
|
};
|
|
|
},
|
|
|
methods: {
|
|
@@ -426,10 +426,66 @@ export default {
|
|
|
viewRow(id) {
|
|
|
this.$router.push({ path: "/projectInfo", query: { id } });
|
|
|
},
|
|
|
- addMarkDia() {},
|
|
|
downRow(row) {
|
|
|
+ this.curRow = row;
|
|
|
this.dialogVisible = true;
|
|
|
},
|
|
|
+ confirmDown() {
|
|
|
+ let url = "";
|
|
|
+ let fileName = this.curRow.projectName;
|
|
|
+
|
|
|
+ if (this.downType.length === 0) {
|
|
|
+ this.$message.info("请先选择下载类型");
|
|
|
+ return;
|
|
|
+ } else if (this.downType.length === 1) {
|
|
|
+ if (this.downType[0] === "工作报告") {
|
|
|
+ url = this.$api.workManagement.exportProjectReportById;
|
|
|
+ fileName += ".pdf";
|
|
|
+ } else {
|
|
|
+ url = this.$api.workManagement.exportProjectTaskFileById;
|
|
|
+ fileName += ".zip";
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ url =
|
|
|
+ this.$api.workManagement.exportProjectReportAndTaskFileById;
|
|
|
+ fileName += ".zip";
|
|
|
+ }
|
|
|
+
|
|
|
+ let id = this.curRow.id;
|
|
|
+ this.curRow = {};
|
|
|
+
|
|
|
+ this.$axios({
|
|
|
+ method: "post",
|
|
|
+ url,
|
|
|
+ responseType: "blob",
|
|
|
+ data: {
|
|
|
+ id,
|
|
|
+ },
|
|
|
+ }).then((res) => {
|
|
|
+ let blob = new Blob([res]);
|
|
|
+ if ("download" in document.createElement("a")) {
|
|
|
+ // 非IE下载
|
|
|
+ let emlink = document.createElement("a");
|
|
|
+ emlink.download = fileName;
|
|
|
+ emlink.style.display = "none";
|
|
|
+ emlink.href = URL.createObjectURL(blob);
|
|
|
+ document.body.appendChild(emlink);
|
|
|
+ emlink.click();
|
|
|
+ URL.revokeObjectURL(emlink.href);
|
|
|
+ document.body.removeChild(emlink);
|
|
|
+ } else {
|
|
|
+ // IE下载
|
|
|
+ navigator.msSaveBlob(blob, fileName);
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ this.downType = [];
|
|
|
+ this.dialogVisible = false;
|
|
|
+ },
|
|
|
+ cancelDown() {
|
|
|
+ this.downType = [];
|
|
|
+ this.dialogVisible = false;
|
|
|
+ },
|
|
|
},
|
|
|
|
|
|
async mounted() {
|