396 lines
11 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<div class="panoramaPlan">
<div class="header-box">
<div class="search-item">
<div class="search-label">
<!-- 标段名称 -->
{{ $t("message.projectInfo.sectionName") + ":" }}
</div>
<el-input
v-model="projectfName"
:placeholder="$t('message.projectInfo.placeholder')"
class=""
></el-input>
</div>
<el-button type="primary" @click="loadData">
<!-- 查询 -->
{{ $t("message.projectInfo.query") }}
</el-button>
<el-button type="primary" @click="addForm">
{{ $t("message.projectInfo.add") }}
<!-- 新增 -->
</el-button>
</div>
<div class="table-box">
<el-table class="tables" :data="tableData">
<!-- 标段名称 -->
<el-table-column
prop="projectfName"
:label="$t('message.projectInfo.sectionName')"
></el-table-column>
<!-- 版本类型 -->
<el-table-column
prop="versionType"
:label="$t('message.projectInfo.versionType')"
></el-table-column>
<!-- 版本 -->
<el-table-column
prop="planVersion"
:label="$t('message.projectInfo.version')"
></el-table-column>
<!-- 项目身份证 -->
<el-table-column
prop="pbnum"
:label="$t('message.projectInfo.projectIDNumber')"
></el-table-column>
<!-- 项目分期身份证 -->
<el-table-column
prop="opnum"
:label="$t('message.projectInfo.projectByStagesIDNumber')"
></el-table-column>
<!-- 是否失效 -->
<el-table-column
prop="isDeleted"
:label="$t('message.projectInfo.isLoseEfficacy')"
>
<template slot-scope="scope">
{{
scope.row.isDeleted == 0
? $t("message.projectInfo.valid")
: $t("message.projectInfo.invalid")
}}
</template>
</el-table-column>
<!-- 操作 -->
<el-table-column
:label="$t('message.projectInfo.operation')"
width="250"
align="center"
>
<template slot-scope="scope">
<el-button
type="text"
icon="el-icon-edit-outline"
@click="editData(scope.row)"
>
<!-- 编辑 -->
{{ $t("message.projectInfo.edit") }}
</el-button>
<el-button
class="delete-btn"
type="text"
icon="el-icon-delete"
@click="deleteData(scope.row)"
>
<!-- 删除 -->
{{ $t("message.projectInfo.delete") }}
</el-button>
</template>
</el-table-column>
</el-table>
</div>
<!-- 新增弹窗 -->
<el-dialog
class="dialog"
:title="dialogTitle"
:modal-append-to-body="false"
:visible.sync="dialogVisible"
@close="closeDialog"
destroy-on-close
width="50%"
>
<div class="dialog-content">
<vue-scroll>
<el-form
ref="form"
:model="dialogdata"
:rules="rules"
label-width="130px"
size="medium"
class="dialogFormBox"
>
<el-form-item
:label="$t('message.projectInfo.sectionName')"
prop="projectfName"
required
>
<el-input
v-model="dialogdata.projectfName"
:placeholder="$t('message.projectInfo.placeholder')"
></el-input>
</el-form-item>
<!-- 版本类型 -->
<el-form-item
:label="$t('message.projectInfo.versionType')"
prop="versionType"
required
>
<el-input
v-model="dialogdata.versionType"
:placeholder="$t('message.projectInfo.placeholder')"
></el-input>
</el-form-item>
<!-- 版本 -->
<el-form-item
:label="$t('message.projectInfo.version')"
prop="planVersion"
required
>
<el-input
v-model="dialogdata.planVersion"
:placeholder="$t('message.projectInfo.placeholder')"
></el-input>
</el-form-item>
<!-- 项目身份证 -->
<el-form-item
:label="$t('message.projectInfo.projectIDNumber')"
prop="pbnum"
required
>
<el-input
v-model="dialogdata.pbnum"
:placeholder="$t('message.projectInfo.placeholder')"
></el-input>
</el-form-item>
<!-- 项目分期身份证 -->
<el-form-item
:label="$t('message.projectInfo.projectByStagesIDNumber')"
prop="opnum"
required
>
<el-input
v-model="dialogdata.opnum"
:placeholder="$t('message.projectInfo.placeholder')"
></el-input>
</el-form-item>
<!-- 是否失效 -->
<el-form-item
:label="$t('message.projectInfo.isLoseEfficacy')"
prop="isDeleted"
required
>
<!-- 请选择 -->
<el-select
v-model="dialogdata.isDeleted"
:placeholder="$t('message.projectInfo.pleaseChoose')"
>
<el-option label="有效" value="0"></el-option>
<el-option label="失效" value="1"></el-option>
</el-select>
</el-form-item>
</el-form>
</vue-scroll>
</div>
<div class="dialog-btn">
<el-button type="primary" @click="submitForm">
<!-- 确定 -->
{{ $t("message.energyManage.material.confirm") }}
</el-button>
<el-button @click="dialogVisible = false">
<!-- 取消 -->
{{ $t("message.energyManage.material.cancel") }}
</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import {
selectProgressPlanBidSectionListApi,
addProgressPlanBidSectionListApi,
editProgressPlanBidSectionListApi,
delProgressPlanBidSectionListApi,
} from "@/assets/js/api/dataBoard.js";
import moment from "moment";
export default {
data() {
return {
projectSn: "",
formType: 1, //1.新增 2.编辑
dialogVisible: false,
dialogTitle: "添加标段",
projectfName: "", //标段名称
tableData: [],
dialogdata: {
isDeleted: "",
opnum: "", //项目分期身份证
pbnum: "", //项目身份证
planVersion: "", // 版本
projectSn: "", // 项目SN
projectfId: "", // 项目分期ID
projectfName: "", // 项目分期名称
versionType: "", // 版本类型
},
rules: {
opnum: [{ required: true, message: "必填" }],
pbnum: [{ required: true, message: "必填" }],
projectfName: [{ required: true, message: "必填" }],
versionType: [{ required: true, message: "必填" }],
planVersion: [{ required: true, message: "必填" }],
projectSn: [{ required: true, message: "必填" }],
projectfId: [{ required: true, message: "必填" }],
isDeleted: [{ required: true, message: "必填" }],
},
};
},
created() {
this.projectSn = this.$store.state.projectSn;
this.getList();
},
methods: {
getList() {
selectProgressPlanBidSectionListApi({
projectSn: this.projectSn,
}).then((res) => {
this.tableData = res.result;
console.log(res.result); //projectfName
});
},
loadData() {},
// 新增
addForm() {
this.dialogVisible = true;
this.dialogTitle = "添加标段";
this.formType = 1;
},
// 编辑
editData(val){
this.dialogdata = JSON.parse(JSON.stringify(val));
this.dialogVisible = true;
this.dialogTitle = "编辑标段";
this.formType = 2;
},
// 删除
deleteData(val) {
this.$confirm("此操作将永久删除该文件, 是否继续?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(() => {
delProgressPlanBidSectionListApi({ id: val.id }).then((res) => {
if (res.code == 200) {
this.$message({
type: "success",
message: "删除成功!",
});
this.getList();
}
});
})
.catch(() => {
this.$message({
type: "info",
message: "已取消删除",
});
});
},
// 关闭弹窗事件
closeDialog() {
this.dialogVisible = false;
this.dialogdata = {
isDeleted: "",
opnum: "", //项目分期身份证
pbnum: "", //项目身份证
planVersion: "", // 版本
projectSn: "", // 项目SN
projectfId: "", // 项目分期ID
projectfName: "", // 项目分期名称
versionType: "", // 版本类型
};
},
submitForm() {
this.$refs["form"].validate((valid) => {
console.log(valid);
if (valid) {
let data = this.dialogdata;
data.projectSn = this.projectSn;
console.log(data);
if (this.formType == 1) {
// 新增
addProgressPlanBidSectionListApi(data).then((res) => {
console.log(res);
if (res.code == 200) {
this.$message.success(
this.$t("message.projectInfo.addSuccess") + "!"
);
this.closeDialog();
this.getList();
}
});
} else if (this.formType == 2) {
editProgressPlanBidSectionListApi(data).then((res) => {
console.log(res);
if (res.code == 200) {
this.$message.success(
this.$t("message.projectInfo.editSuccess") + "!"
);
this.closeDialog();
this.getList();
}
});
}
}
});
},
},
};
</script>
<style lang="less" scoped>
.panoramaPlan {
width: 100%;
height: 100%;
background: #fff;
padding: 20px;
box-sizing: border-box;
.header-box {
margin-bottom: 20px;
padding-left: 10px;
.search-item {
display: inline-flex;
align-items: center;
white-space: nowrap;
margin-right: 20px;
/deep/.el-input {
width: 200px;
}
}
}
.delete-btn {
color: #f56c6c;
}
.dialogFormBox {
width: 100%;
padding: 0 30px;
box-sizing: border-box;
/deep/.el-form-item {
display: inline-block;
width: 50%;
.el-select {
width: 260px !important;
}
.el-date-picker {
width: 260px !important;
}
.el-cascader {
width: 260px !important;
}
.el-input {
width: 260px !important;
}
}
}
.dialog-content {
/*height: 360px;*/
margin-bottom: 60px;
}
.dialog-btn {
display: flex;
justify-content: space-around;
align-items: center;
}
}
</style>