Commit acb68ab5 authored by 王晓旭's avatar 王晓旭

修改功能

parent 8017fd3c
......@@ -58,8 +58,37 @@
<el-button type="primary" @click="active = 0">上一步</el-button>
<el-button type="primary" @click="updateSiteConform" :loading="loading">下一步</el-button>
</div>
<!-- 第三步 -->
<!-- 第三步 -->
<div v-show="active == 2">
<div style="height: 500px; overflow: auto; margin-bottom:20px">
<div class="layout-table">
<div class="table-body">
<el-table
size='small'
ref="steptable"
:data="tableData.data"
@selection-change="handleSelectionChange"
>
<el-table-column
v-for='column in config.columns'
:key='column.prop'
:type="column.type"
:prop="column.prop"
:label="column.label"
:width="column.width"
:formatter='column.formatter'
:selectable="handleSelectableMethod"
>
</el-table-column>
</el-table>
</div>
</div>
</div>
<el-button type="primary" @click="batchDistribute">下一步</el-button>
</div>
<!-- 第四步 -->
<div v-show="active == 3">
<div class="label">完成</div>
<div class="line"></div>
<div class="wancheng">
......@@ -72,7 +101,7 @@
</div>
<div class="line"></div>
<el-button type="primary" @click="gotoMh">门户网站</el-button>
<el-button type="primary" @click="gotoSet">项目部署管理</el-button>
<!-- <el-button type="primary" @click="gotoSet">项目部署管理</el-button> -->
</div>
</div>
......@@ -81,7 +110,13 @@
<script>
import tree from "@/assets/mixins/tree";
import axios from "axios";
import {
formatter
} from "@/assets/utils/table";
// import table from "@/assets/mixins/table";
export default {
// mixins: [table,tree],
mixins: [tree],
data() {
return {
......@@ -107,15 +142,43 @@ export default {
tabList: [
"1、项目文件包导入",
"2、创建站点",
"3、完成"
"3、部署",
"4、完成"
],
loading: false,
fileList: [],
// timer: "",
config: {
columns: [
{
type: "selection",
align: "center",
reserveSelection: true,
width: 60,
props:"gouxuan"
},
{type: "index", prop: "xuhao",label: "序号",width: 50},
{label: "所属站点", prop: "siteName",width: 120},
{label: "项目产品名称", prop: "name"},
{label: "项目产品编码", prop: "projectCode"},
{label: "项目类型", prop: "projectType",formatter: this.formatter},
{label: "项目状态", prop: "projectStatus",formatter: this.formatterStatus},
{label: "备注",width: 200, prop: "remark"}
],
},
source: axios.CancelToken.source(),
tableData: {
// 表格数据
loading: true, // ajax请求状态
dict: {},
result: [],
pageInfo: {},
},
loadingTimer: null,
selection: [], // 表格内置的多选
nowTabdataStatus:1
}
},
created() {
this.objInstall()
},
methods: {
objInstall() {
//检测是否初始安装
......@@ -149,6 +212,120 @@ export default {
this.$message.error(error.message);
});
},
// 以下第三部分
// 默认拉取数据
async getData() {
this.tableData.loading = true;
this.$post('/setup/project/list', {}, {
cancelToken: this.source.token,
})
.then(({ data }) => {
this.tableData = Object.assign({}, this.tableData, data)
this.nowTabdataStatus = 1
})
.catch((error) => {
if (error.message == "自动取消ajax操作") return;
this.$message.error(error.message);
})
.then((data) => {
clearTimeout(this.loadingTimer);
this.loadingTimer = setTimeout(() => {
this.tableData.loading = false;
}, 300);
});
},
syncProjectStatus() {
this.$post("/setup/project/projectStatusUpdate", { })
.then((res) => {
if (res.code == 1) {
this.getData()
}
})
},
formatterStatus(row, column, val) {
const content = formatter(this.tableData, column, val);
if (content) {
if (val == "0") {
return (
<el-tag type={"warning"} size="mini">
{content}
</el-tag>
);
} else if (val == "1") {
return (
<el-tag type={"danger"} size="mini">
{content}
</el-tag>
);
} else if (val == "2") {
return (
<el-tag type={"success"} size="mini">
{content}
</el-tag>
);
} else {
return <el-tag size="mini">{content}</el-tag>;
}
} else {
return val;
}
},
// 格式化单元格数据
formatter(row, column, val) {
const content = formatter(this.tableData, column, val);
return content ? (
<el-tag type={"info"} size="mini">
{content}
</el-tag>
) : val ? (
val
) : (
"--"
);
},
// 多选表格行
handleSelectionChange(val) {
this.selection = val.map((i) => i.id);
},
handleSelectableMethod(row, index) {
if(row.projectStatus==1){
return true;
}else{
if(this.nowTabdataStatus){
this.$refs.steptable.toggleRowSelection(row,true)
if(index==this.tableData.data.length-1){
this.nowTabdataStatus = 0
}
}
return false;
}
},
batchDistribute(){
let setlist = this.tableData.data.filter((item)=>{
return item.projectStatus != 1
}).map((item)=>{
return item.id
})
let arr = this.selection.filter((item)=>{
return setlist.indexOf(item) === -1
})
this.$post("/setup/project/batchDistribute", {
idList: arr,
},{isLoading:true})
.then((res) => {
if (res.code == 1) {
this.$message.success("批量部署成功!");
this.active = 3
}
})
.catch((error) => {
this.$message.error(error.message);
});
},
// 以下第四部分
gotoMh() {
window.location.href = process.env.VUE_APP_PORTAL_URL
},
......@@ -175,6 +352,7 @@ export default {
this.loading = false;
if (res.code == 1) {
this.active = 2
this.getData();
}
})
.catch((error) => {
......@@ -213,7 +391,6 @@ export default {
},
/** 文件上传成功处理 */
handleFileSuccess(response, file, fileList) {
console.log(response);
this.upload.open = false;
this.upload.isUploading = false;
this.$refs.nowupload.clearFiles();
......@@ -234,7 +411,18 @@ export default {
this.$alert(response.msg, "导入结果", { dangerouslyUseHTMLString: true });
}
},
}
},
created() {
// this.objInstall()
// this.changePath()
},
mounted() {
this.timer = setInterval(this.syncProjectStatus, 1000*60);
this.getData();
},
}
</script>
......@@ -244,6 +432,10 @@ export default {
}
// 第三部分
/deep/ .table-body{
margin-left:0 !important;
}
// 第四部分
.wancheng {
margin-bottom: 350px;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment