You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

637 lines
17 KiB

<template>
<!-- 1.1.1.1.3.2. 分包合同-->
<div class="app-container">
<el-form
:model="queryParams"
ref="queryForm"
:inline="true"
v-show="showSearch"
>
<el-form-item
label="分包合同名称"
prop="subcontractName"
label-width="96px"
>
<el-input
clearable
size="small"
v-model="queryParams.data.subcontractName"
placeholder="选择分包合同名称"
><el-button
type="primary"
slot="append"
icon="el-icon-search"
size="small"
@click="handleQuery"
></el-button>
</el-input>
</el-form-item>
<el-form-item label="分包类型" prop="subcontractingType">
<el-select
v-model="queryParams.data.subcontractingType"
placeholder="请选择分包类型"
clearable
size="small"
>
<el-option label="请选择字典生成" value="" />
</el-select>
</el-form-item>
<el-form-item>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
>重置</el-button
>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['build:subcontracts:add']"
>新增</el-button
>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['build:subcontracts:edit']"
>修改</el-button
>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['build:subcontracts:remove']"
>删除</el-button
>
</el-col>
<right-toolbar
:showSearch.sync="showSearch"
@queryTable="getList"
></right-toolbar>
</el-row>
<el-table
v-loading="loading"
:data="subcontractsList"
@selection-change="handleSelectionChange"
>
<el-table-column type="selection" width="55" align="center" fixed />
<el-table-column
label="序号"
type="index"
width="50"
align="center"
fixed
/>
<el-table-column
label="分包约定"
align="center"
prop="subcontractingAgreement"
min-width="120"
/>
<el-table-column
label="分包合同名称"
align="center"
prop="subcontractName"
min-width="120"
/>
<el-table-column
label="分包类型"
align="center"
prop="subcontractingType"
min-width="120"
/>
<el-table-column
1 year ago
label="分包金额(万元)"
align="center"
prop="subcontractingAmount"
min-width="120"
/>
<el-table-column
label="承包公司"
align="center"
prop="contractingCompany"
min-width="120"
/>
<el-table-column
label="分包时间"
align="center"
prop="subcontractingTime"
min-width="120"
>
<template slot-scope="scope">
<span>{{
parseTime(scope.row.subcontractingTime, "{y}-{m}-{d}")
}}</span>
</template>
</el-table-column>
<el-table-column
label="工作内容"
align="center"
prop="work"
min-width="120"
/>
<el-table-column
label="工作内容详情"
align="center"
prop="jobDetails"
min-width="120"
/>
<el-table-column
label="操作"
align="center"
class-name="small-padding fixed-width"
min-width="180"
fixed="right"
>
<template slot-scope="scope">
1 year ago
<el-button
size="mini"
type="text"
icon="el-icon-view"
@click="viewInfo(scope.row)"
>查看</el-button
>
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['build:subcontracts:edit']"
>修改</el-button
>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['build:subcontracts:remove']"
>删除</el-button
>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total > 0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改分包合同对话框 -->
1 year ago
<el-dialog
:title="title"
:visible.sync="open"
width="1200px"
append-to-body
>
<el-row>
<el-form ref="form" :model="form" :rules="rules" label-width="110px">
<el-col :span="24">
1 year ago
<el-form-item label="分包约定" prop="subcontractingAgreement">
<el-input
v-model="form.subcontractingAgreement"
placeholder="请输入分包约定"
/>
</el-form-item>
</el-col>
<el-col :span="24">
1 year ago
<el-form-item label="分包合同名称" prop="subcontractName">
<el-input
v-model="form.subcontractName"
placeholder="请输入分包合同名称"
/>
</el-form-item>
</el-col>
<el-col :span="24">
1 year ago
<el-form-item label="分包类型" prop="subcontractingType">
<el-select
v-model="form.subcontractingType"
placeholder="请选择分包类型"
style="width: 100%"
>
<el-option label="请选择字典生成" value="" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="24">
1 year ago
<el-form-item label="分包金额" prop="subcontractingAmount">
<el-input
v-model="form.subcontractingAmount"
placeholder="请输入分包金额"
>
<template slot="append">万元</template>
</el-input>
</el-form-item>
</el-col>
<el-col :span="24">
1 year ago
<el-form-item label="承包公司" prop="contractingCompany">
<el-input
v-model="form.contractingCompany"
placeholder="请输入承包公司"
/>
</el-form-item>
</el-col>
<el-col :span="24">
1 year ago
<el-form-item label="分包时间" prop="subcontractingTime">
<!-- <el-input
v-model="form.subcontractingTime"
placeholder="请输入分包时间"
/> -->
1 year ago
<el-date-picker
clearable
size="small"
style="width: 100%"
v-model="form.subcontractingTime"
type="date"
value-format="yyyy-MM-dd"
placeholder="请输入分包时间"
>
</el-date-picker>
</el-form-item>
</el-col>
<el-col :span="24">
1 year ago
<el-form-item label="工作内容" prop="work">
<el-input v-model="form.work" placeholder="请输入工作内容" />
</el-form-item>
</el-col>
<el-col :span="24">
1 year ago
<el-form-item label="工作内容详情" prop="jobDetails">
<el-input
v-model="form.jobDetails"
placeholder="请输入工作内容详情"
/>
</el-form-item>
</el-col>
</el-form>
</el-row>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
1 year ago
<!--查看 -->
<el-dialog
:title="viewTitle"
:visible.sync="viewOpen"
width="1200px"
append-to-body
@close="closeView"
>
<!-- 分包合同信息 -->
<div class="infoTitle">分包合同信息</div>
<div class="draLine"></div>
<div class="content">
<el-descriptions
class="margin-top"
:column="1"
1 year ago
border
:labelStyle="{
'text-align': 'left',
width: '180px',
height: '50px',
}"
:contentStyle="{ minWidth: '350px' }"
1 year ago
>
<el-descriptions-item>
<template slot="label"> 分包约定 </template>
{{ this.subMsg.subcontractingAgreement }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label"> 分包合同名称 </template>
{{ this.subMsg.subcontractName }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label"> 分包类型 </template>
{{ this.subMsg.subcontractingType }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label"> 分包金额 </template>
{{ this.subMsg.subcontractingAmount + " 万元" }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label"> 承包公司 </template>
{{ this.subMsg.contractingCompany }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label"> 分包时间 </template>
{{ this.subMsg.subcontractingTime }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label"> 工作内容详情 </template>
{{ this.subMsg.work }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label"> 工作内容 </template>
{{ this.subMsg.jobDetails }}
</el-descriptions-item>
</el-descriptions>
</div>
</el-dialog>
</div>
</template>
<script>
import {
listSubcontracts,
getSubcontracts,
delSubcontracts,
addSubcontracts,
updateSubcontracts,
exportSubcontracts,
} from "@/api/build/subcontracts";
export default {
name: "Subcontracts",
props: ["contractNumber"],
data() {
return {
// 遮罩层
loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 分包合同表格数据
subcontractsList: [],
// 弹出层标题
title: "",
1 year ago
viewTitle: "",
// 是否显示弹出层
open: false,
1 year ago
viewOpen: false,
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
ids: null,
data: {
subcontractingAgreement: null,
subcontractName: null,
subcontractingType: null,
subcontractingAmount: null,
contractingCompany: null,
subcontractingTime: null,
work: null,
jobDetails: null,
contractNumber: null,
createUid: null,
createTime: null,
updateUid: null,
updateTime: null,
owerDept: null,
},
// 排序方式
params: {
// 按哪个字段排序
orderBy: "create_time",
// desc降序,升序asc
sort: "desc",
},
},
// 表单参数
form: {},
// 表单校验
rules: {},
1 year ago
subMsg: {},
};
},
created() {
this.getList();
// console.log("contractNumber", this.contractNumber);
},
// 父组件 利用axios请求得到的值 传送到子组件,要监听,否则初始渲染时为空
watch: {
contractNumber: function (n, o) {
this.contractNumber = n;
// console.log("contractNumber", this.contractNumber);
this.getList();
},
},
methods: {
/** 查询分包合同列表 */
getList() {
if (this.$route.query.baseDataId) {
this.queryParams.data.contractNumber = this.contractNumber;
}
this.loading = true;
listSubcontracts(this.queryParams).then((response) => {
this.subcontractsList = response.records;
this.total = response.total;
this.loading = false;
});
},
// 取消按钮
cancel() {
this.open = false;
this.reset();
},
// 表单重置
reset() {
this.form = {
id: null,
subcontractingAgreement: null,
subcontractName: null,
subcontractingType: null,
subcontractingAmount: null,
contractingCompany: null,
subcontractingTime: null,
work: null,
jobDetails: null,
contractNumber: null,
createUid: null,
createTime: null,
updateUid: null,
updateTime: null,
owerDept: null,
};
this.resetForm("form");
},
// 查询表单重置
resetQueryForm() {
this.queryParams = {
pageNum: 1,
pageSize: 10,
data: {
id: null,
subcontractingAgreement: null,
subcontractName: null,
subcontractingType: null,
subcontractingAmount: null,
contractingCompany: null,
subcontractingTime: null,
work: null,
jobDetails: null,
contractNumber: null,
createUid: null,
createTime: null,
updateUid: null,
updateTime: null,
owerDept: null,
},
// 排序方式
params: {
// 按哪个字段排序
orderBy: "create_time",
// desc降序,升序asc
sort: "desc",
},
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetQueryForm();
this.handleQuery();
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map((item) => item.id);
this.single = selection.length !== 1;
this.multiple = !selection.length;
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加分包合同";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id || this.ids;
getSubcontracts(id).then((response) => {
this.form = response.data;
this.open = true;
this.title = "修改分包合同";
});
},
1 year ago
// 查看信息
viewInfo(row) {
this.viewTitle = row.subcontractName;
this.subMsg = row;
console.log("subMsg", row);
this.viewOpen = true;
},
// 关闭弹窗
closeView() {
this.proMsg = {};
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate((valid) => {
if (valid) {
if (this.form.id != null) {
updateSubcontracts(this.form).then((response) => {
if (response.code === 200) {
this.msgSuccess("修改成功");
this.open = false;
this.getList();
}
});
} else {
this.form.contractNumber = this.contractNumber;
addSubcontracts(this.form).then((response) => {
if (response.code === 200) {
this.msgSuccess("新增成功");
this.open = false;
this.getList();
}
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
if (ids) {
this.$confirm("是否删除选中的数据?", "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(function () {
return delSubcontracts(ids);
})
.then(() => {
this.getList();
this.msgSuccess("删除成功");
})
.catch(function () {});
} else {
this.$message.warning("请选择要删除的数据!!");
}
},
},
};
</script>
1 year ago
<style scoped lang="scss">
::v-deep {
.el-dialog {
// margin-top: 2vh !important;
height: 700px;
1 year ago
overflow-y: auto;
.content {
display: flex;
flex-direction: column;
align-items: center;
.margin-top {
width: 95%;
border-left: 1px solid #f0f0f0;
border-right: 1px solid #f0f0f0;
}
}
}
.el-dialog__title {
font-weight: 700;
font-size: 28px;
// font-size: 24px;
// line-height: 32px;
}
.draLine {
width: 100%;
border: 2px solid #000;
margin: 10px 0 20px 0;
}
.infoTitle {
color: #000;
font-size: 20px;
font-weight: 700;
}
}
</style>