jhprjv2/ruoyi-ui/src/views/project/projectCommittee/index.vue

254 lines
9.0 KiB
Vue

<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="项目名称" prop="projectName">
<el-input v-model="queryParams.projectName" placeholder="请输入项目名称" clearable @keyup.enter.native="handleQuery" />
</el-form-item>
<el-form-item label="期名" prop="committeeName">
<el-input v-model="queryParams.committeeName" placeholder="请输入期名" clearable @keyup.enter.native="handleQuery" />
</el-form-item>
<el-form-item label="成本名称" prop="costName">
<el-input v-model="queryParams.costName" placeholder="请输入成本名称" clearable @keyup.enter.native="handleQuery" />
</el-form-item>
<el-form-item label="分类" prop="workingType">
<el-select v-model="queryParams.workingType" placeholder="分类" clearable>
<el-option v-for="dict in dict.type.project_working_type" :key="dict.value" :label="dict.label"
:value="dict.value" />
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8" v-if="1 == 2">
<el-col :span="1.5">
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd"
v-hasPermi="['project:projectCommittee:add']">新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="success" plain icon="el-icon-edit" size="mini" :disabled="single" @click="handleUpdate"
v-hasPermi="['project:projectCommittee:edit']">修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="danger" plain icon="el-icon-delete" size="mini" :disabled="multiple" @click="handleDelete"
v-hasPermi="['project:projectCommittee:remove']">删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport"
v-hasPermi="['project:projectCommittee:export']">导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="projectCommitteeList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" v-if="1 == 2" />
<el-table-column label="期名" align="center" prop="committeeName" />
<el-table-column label="申请时间" align="center" prop="applicationDate">
<template slot-scope="scope">
<el-date-picker style="width:140px;"
v-model="scope.row.applicationDate" @change="doUpdateApplicationDate(scope.row)"
type="date"
placeholder="申请时间">
</el-date-picker>
</template>
</el-table-column>
<el-table-column label="项目" align="center" prop="projectName" />
<el-table-column label="分类" align="center" prop="typeName" />
<el-table-column label="成本名称" align="center" prop="costName" />
<el-table-column label="金额(万元)" align="center" prop="money" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" v-if="1 == 2">
<template slot-scope="scope">
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
v-hasPermi="['project:projectCommittee:edit']">修改</el-button>
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
v-hasPermi="['project:projectCommittee: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" />
<!-- 添加或修改工委会管理对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="项目ID" prop="projectId">
<el-input v-model="form.projectId" placeholder="请输入项目ID" />
</el-form-item>
<el-form-item label="成本名称" prop="costName">
<el-input v-model="form.costName" placeholder="请输入成本名称" />
</el-form-item>
<el-form-item label="金额(万元)" prop="money">
<el-input v-model="form.money" placeholder="请输入金额(万元)" />
</el-form-item>
<el-form-item label="${comment}" prop="remark">
<el-input v-model="form.remark" placeholder="请输入${comment}" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm">确 定</el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { listProjectCommittee, getProjectCommittee, delProjectCommittee, addProjectCommittee, updateProjectCommittee } from "@/api/project/projectCommittee";
export default {
dicts: ['project_working_type'],
name: "ProjectCommittee",
data() {
return {
// 遮罩层
loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 工委会管理表格数据
projectCommitteeList: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
projectName: null,
committeeName: null,
workingType: null,
costName: null,
money: null,
},
// 表单参数
form: {},
// 表单校验
rules: {
}
};
},
created() {
this.getList();
},
methods: {
/** 查询工委会管理列表 */
getList() {
this.loading = true;
listProjectCommittee(this.queryParams).then(response => {
this.projectCommitteeList = response.rows;
this.total = response.total;
this.loading = false;
});
},
doUpdateApplicationDate(row){
updateProjectCommittee(row).then(d=>{
if(d.code==200){
this.$modal.msgSuccess("修改成功");
}
});
},
// 取消按钮
cancel() {
this.open = false;
this.reset();
},
// 表单重置
reset() {
this.form = {
id: null,
projectId: null,
workingType: null,
costName: null,
money: null,
remark: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
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
getProjectCommittee(id).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改工委会管理";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != null) {
updateProjectCommittee(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addProjectCommittee(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$modal.confirm('是否确认删除工委会管理编号为"' + ids + '"的数据项?').then(function () {
return delProjectCommittee(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => { });
},
/** 导出按钮操作 */
handleExport() {
this.download('project/projectCommittee/export', {
...this.queryParams
}, `projectCommittee_${new Date().getTime()}.xlsx`)
}
}
};
</script>