| | |
| | | <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-form-item label="项目名称" prop="projectName"> |
| | | <el-input |
| | | v-model="queryParams.projectName" |
| | | placeholder="请输入工程名称" |
| | | placeholder="项目名称搜索" |
| | | clearable |
| | | @keyup.enter.native="handleQuery" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item label="主项目" prop="projectInfoId"> |
| | | <el-row> |
| | | <el-select v-model="queryParams.projectInfoId" filterable clearable style="width: 100%" placeholder="请选择主项目"> |
| | | <el-option |
| | | v-for="item in projectList" |
| | | :key="'pp1' + item.id" |
| | | :label="item.projectName" |
| | | :value="item.id"> |
| | | </el-option> |
| | | </el-select> |
| | | </el-row> |
| | | </el-form-item> |
| | | <!-- <el-form-item label="主项目" prop="projectInfoId">--> |
| | | <!-- <el-row>--> |
| | | <!-- <el-select v-model="queryParams.projectInfoId" filterable clearable style="width: 100%" placeholder="请选择主项目">--> |
| | | <!-- <el-option--> |
| | | <!-- v-for="item in projectList"--> |
| | | <!-- :key="'pp1' + item.id"--> |
| | | <!-- :label="item.projectName"--> |
| | | <!-- :value="item.id">--> |
| | | <!-- </el-option>--> |
| | | <!-- </el-select>--> |
| | | <!-- </el-row>--> |
| | | <!-- </el-form-item>--> |
| | | <el-form-item label="项目推进类型" label-width="120px" prop="projectType"> |
| | | <el-select v-model="queryParams.projectType" placeholder="请选择项目推进类型" clearable> |
| | | <el-option |
| | |
| | | </el-form-item> |
| | | </el-form> |
| | | |
| | | <el-row :gutter="10" class="mb8"> |
| | | <el-col :span="1.5"> |
| | | <el-button |
| | | type="primary" |
| | | plain |
| | | icon="el-icon-plus" |
| | | size="mini" |
| | | @click="handleAdd" |
| | | v-hasPermi="['code:engineering: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="['code:engineering: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="['code:engineering: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="['code:engineering:export']" |
| | | >导出</el-button> |
| | | </el-col> |
| | | <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> |
| | | </el-row> |
| | | <!-- <el-row :gutter="10" class="mb8">--> |
| | | <!-- <el-col :span="1.5">--> |
| | | <!-- <el-button--> |
| | | <!-- type="primary"--> |
| | | <!-- plain--> |
| | | <!-- icon="el-icon-plus"--> |
| | | <!-- size="mini"--> |
| | | <!-- @click="handleAdd"--> |
| | | <!-- v-hasPermi="['code:engineering: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="['code:engineering:edit']"–>--> |
| | | <!--<!– >修改</el-button>–>--> |
| | | <!--<!– </el-col>–>--> |
| | | <!--<!– <el-col :span="1.5">–>--> |
| | | <!--<!– <el-button–>--> |
| | | <!--<!– type="danger"–>--> |
| | | <!--<!– plain–>--> |
| | | <!--<!– icon="el-icon-delete"–>--> |
| | | <!--<!– size="mini"–>--> |
| | | <!--<!– :disabled="multiple"–>--> |
| | | <!--<!– @click="deleteByIds"–>--> |
| | | <!--<!– v-hasPermi="['code:engineering: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="['code:engineering:export']"–>--> |
| | | <!--<!– >导出</el-button>–>--> |
| | | <!--<!– </el-col>–>--> |
| | | <!-- <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>--> |
| | | <!-- </el-row>--> |
| | | |
| | | <el-table v-loading="loading" :data="engineeringList" @selection-change="handleSelectionChange"> |
| | | <el-table-column type="selection" width="55" align="center" /> |
| | | <el-table-column label="工程名称" align="center" prop="projectName" /> |
| | | <el-table-column label="主项目名称" align="center" prop="projectInfoName" /> |
| | | <el-table |
| | | ref="elTable" |
| | | v-loading="loading" |
| | | style="margin-top: 20px" |
| | | :data="engineeringList" |
| | | height="100%" |
| | | sortable="custom" |
| | | row-key="id" |
| | | border |
| | | default-expand-all |
| | | :tree-props="{children: 'children', hasChildren: 'hasChildren'}" |
| | | :show-overflow-tooltip="true"> |
| | | <el-table-column label="项目名称" min-width="250" :show-overflow-tooltip="true" prop="projectName" /> |
| | | <el-table-column label="项目推进类型" align="center" prop="projectType"> |
| | | <template slot-scope="scope"> |
| | | <dict-tag :options="dict.type.sys_project_type" :value="scope.row.projectType"/> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="投资额" align="center" prop="investmentAmount" /> |
| | | <el-table-column label="主管部门" align="center" prop="competentDepartmentName"> |
| | | </el-table-column> |
| | | <el-table-column label="业主单位" align="center" prop="projectOwnerUnitName"> |
| | | </el-table-column> |
| | | <el-table-column label="年份" align="center" prop="year"> |
| | | <template slot-scope="scope"> |
| | | {{ scope.row.year ? scope.row.year + '年' : '' }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="投资额(万)" align="center" prop="investmentAmount" /> |
| | | <el-table-column label="开工状态" align="center" prop="status"> |
| | | <template slot-scope="scope"> |
| | | <dict-tag :options="dict.type.sys_project_status" :value="scope.row.status"/> |
| | |
| | | <el-button |
| | | size="mini" |
| | | type="text" |
| | | icon="el-icon-plus" |
| | | style="margin-right: 10px" |
| | | @click="handleAdd(scope.row)" |
| | | >添加子工程</el-button> |
| | | <el-button |
| | | size="mini" |
| | | type="text" |
| | | icon="el-icon-edit" |
| | | v-if="!isProject(scope.row.id)" |
| | | @click="handleUpdate(scope.row)" |
| | | v-hasPermi="['code:engineering:edit']" |
| | | >修改</el-button> |
| | | <el-button |
| | | size="mini" |
| | | type="text" |
| | | icon="el-icon-delete" |
| | | @click="handleDelete(scope.row)" |
| | | v-hasPermi="['code:engineering:remove']" |
| | | v-if="!isProject(scope.row.id)" |
| | | @click="deleteById(scope.row)" |
| | | >删除</el-button> |
| | | </template> |
| | | </el-table-column> |
| | |
| | | <el-form ref="form" :model="form" :rules="rules" label-width="80px"> |
| | | <el-form-item label="工程名称" prop="projectName"> |
| | | <el-input v-model="form.projectName" placeholder="请输入工程名称" /> |
| | | </el-form-item> |
| | | <el-form-item label="主项目" prop="projectInfoId"> |
| | | <el-row> |
| | | <el-select v-model="form.projectInfoId" filterable style="width: 100%" placeholder="请选择主项目"> |
| | | <el-option |
| | | v-for="item in projectList" |
| | | :key="'pp' + item.id" |
| | | :label="item.projectName" |
| | | :value="item.id"> |
| | | </el-option> |
| | | </el-select> |
| | | </el-row> |
| | | </el-form-item> |
| | | <el-row :gutter="20"> |
| | | <el-col :span="12"> |
| | |
| | | ></el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="主管部门" prop="department"> |
| | | <treeselect v-model="form.department" @input="getCompetentDepartmentInfo" noChildrenText="无匹配数据" :options="approvalList" :normalizer="normalizer" placeholder="请选择主管部门"> |
| | | </treeselect> |
| | | </el-form-item> |
| | | <el-form-item label="业主单位" prop="unit"> |
| | | <treeselect v-model="form.unit" @input="getProjectOwnerUnit" noChildrenText="无匹配数据" :options="selectOptions" :normalizer="normalizer" placeholder="选择单位" /> |
| | | </el-form-item> |
| | | <el-form-item label="年份" prop="year"> |
| | | <el-date-picker v-model="form.year " |
| | | placeholder="选择时间" |
| | | style="width: 100%" |
| | | type="year" |
| | | value-format="yyyy" |
| | | :picker-options="pickerOptions"/> |
| | | </el-form-item> |
| | | </el-form> |
| | | <div slot="footer" class="dialog-footer"> |
| | | <el-button type="primary" @click="submitForm">确 定</el-button> |
| | |
| | | </template> |
| | | |
| | | <script> |
| | | import { getProjectEngineerings, getProjectEngineeringById, deleteProjectEngineeringByIds, editProjectEngineering, addProjectEngineering } from "@/api/projectEngineering/projectEngineering"; |
| | | import { getProjectEngineerings, getProjectEngineeringById, deleteProjectEngineeringByIds, deleteProjectEngineeringById, editProjectEngineering, addProjectEngineering } from "@/api/projectEngineering/projectEngineering"; |
| | | import {list} from "@/api/projectEngineering/projectInfo"; |
| | | import Treeselect from '@riophae/vue-treeselect' |
| | | import "@riophae/vue-treeselect/dist/vue-treeselect.css"; |
| | | |
| | | import {approvalList,listDept} from "@/api/system/dept"; |
| | | import {getProjectProcess} from "@/api/projectProcess/projectProcess"; |
| | | |
| | | |
| | | export default { |
| | | name: "Engineering", |
| | | components: { Treeselect }, |
| | | dicts: ['sys_project_type', 'sys_project_status'], |
| | | data() { |
| | | return { |
| | |
| | | title: "", |
| | | // 是否显示弹出层 |
| | | open: false, |
| | | //主管部门 |
| | | approvalList: [], |
| | | //业主单位 |
| | | selectOptions: [], |
| | | // 查询参数 |
| | | queryParams: { |
| | | currentPage: 1, |
| | |
| | | projectType: null, |
| | | status: null, |
| | | }, |
| | | addId:null, |
| | | // 表单参数 |
| | | form: {}, |
| | | // 表单校验 |
| | |
| | | investmentAmount: [{required: true, message: '请输入投资额', trigger: 'change'}], |
| | | projectType: [{required: true, message: '请选择流程推进类型', trigger: 'change'}], |
| | | status: [{required: true, message: '请选择开工状态', trigger: 'change'}], |
| | | department: [{required: true, message: '请选择主管部门', trigger: 'change'}], |
| | | unit: [{required: true, message: '请选择项目业主单位', trigger: 'change'}], |
| | | year: [{required: true, message: '请选择计划开工时间', trigger: 'change'}], |
| | | parent: [{required: false, message: '请选择父工程', trigger: 'change'}], |
| | | } |
| | | }; |
| | | }, |
| | |
| | | this.getList(); |
| | | this.getProjectList(); |
| | | }, |
| | | mounted() { |
| | | //初始化主管部门下拉框 |
| | | this.getApprovalList(); |
| | | //单位 |
| | | this.getDeptList(); |
| | | }, |
| | | methods: { |
| | | pickerOptions: { |
| | | // 这里可以添加更多的picker选项,但为简化示例,只展示禁用其他日期的逻辑 |
| | | // 关键设置:显示年份选择器 |
| | | pickers: ['year'] |
| | | }, |
| | | isProject(id) { |
| | | const numericPattern = /^\d+(\.\d+)?$/; |
| | | return numericPattern.test(id) |
| | | }, |
| | | getProjectOwnerUnit(unitId) { |
| | | console.log(unitId) |
| | | // if (deptId) { |
| | | // this.projectForm.unit = deptId |
| | | // } else { |
| | | // this.projectForm.unit = '' |
| | | // } |
| | | }, |
| | | getCompetentDepartmentInfo(deptId) { |
| | | console.log(deptId) |
| | | // if (deptId) { |
| | | // if (this.projectForm.department != deptId) { |
| | | // this.projectForm.competentDepartmentPerson = "" |
| | | // this.projectForm.competentDepartmentPhone = "" |
| | | // } |
| | | // this.projectForm.department = deptId |
| | | // this.getCompetentDepartmentPeople(deptId) |
| | | // } else { |
| | | // this.projectForm.department = '' |
| | | // this.deptPersonList = []; |
| | | // } |
| | | }, |
| | | getDeptList(){ |
| | | listDept().then(response => { |
| | | console.log(response.data) |
| | | this.selectOptions = this.handleTree(response.data, "deptId"); |
| | | this.selectOptions.push({deptId: '', deptName: '无', children: []}) |
| | | }); |
| | | }, |
| | | getApprovalList() { |
| | | approvalList().then(res => { |
| | | this.approvalList = this.handleTree(res.data, "deptId"); |
| | | this.approvalList.push({deptId: '', deptName: '无', children: []}) |
| | | console.log(this.approvalList) |
| | | }); |
| | | }, |
| | | /** 转换部门数据结构 */ |
| | | normalizer(node) { |
| | | if (node.children && !node.children.length) { |
| | | delete node.children; |
| | | } |
| | | return { |
| | | id: node.deptId, |
| | | label: node.deptName, |
| | | children: node.children |
| | | }; |
| | | }, |
| | | getProjectList() { |
| | | list().then(res => { |
| | | this.projectList = res.data |
| | |
| | | /** 查询工程库列表 */ |
| | | getList() { |
| | | this.loading = true; |
| | | getProjectEngineerings(this.queryParams).then(res => { |
| | | this.engineeringList = res.data; |
| | | this.total = res.total; |
| | | |
| | | getProjectProcess(this.queryParams).then(response => { |
| | | this.engineeringList = response.data; |
| | | this.total = response.total; |
| | | this.loading = false; |
| | | }); |
| | | }, |
| | |
| | | status: null, |
| | | gmtCreate: null, |
| | | gmtUpdate: null, |
| | | deleted: null |
| | | deleted: null, |
| | | department:null, |
| | | unit:null, |
| | | year:null, |
| | | parent:null, |
| | | }; |
| | | this.addId = null; |
| | | this.resetForm("form"); |
| | | }, |
| | | |
| | | /** 搜索按钮操作 */ |
| | | handleQuery() { |
| | | this.queryParams.pageNum = 1; |
| | |
| | | this.single = selection.length!==1 |
| | | this.multiple = !selection.length |
| | | }, |
| | | /** 新增按钮操作 */ |
| | | handleAdd() { |
| | | handleAdd(row){ |
| | | this.reset(); |
| | | this.open = true; |
| | | this.title = "添加工程"; |
| | | if (this.isProject(row.id)) { |
| | | this.form.projectInfoId = row.id |
| | | this.form.parent = '0' |
| | | } else { |
| | | this.form.projectInfoId = row.projectInfoId |
| | | this.form.parent = row.id |
| | | } |
| | | |
| | | }, |
| | | /** 修改按钮操作 */ |
| | | handleUpdate(row) { |
| | |
| | | submitForm() { |
| | | this.$refs["form"].validate(valid => { |
| | | if (valid) { |
| | | if (this.form.id != null) { |
| | | editProjectEngineering(this.form).then(response => { |
| | | this.$modal.msgSuccess("修改成功"); |
| | | if (! this.form.id){ |
| | | addProjectEngineering(this.form).then(response => { |
| | | this.$modal.msgSuccess("新增成功"); |
| | | this.open = false; |
| | | this.getList(); |
| | | }); |
| | | } else { |
| | | addProjectEngineering(this.form).then(response => { |
| | | this.$modal.msgSuccess("新增成功"); |
| | | editProjectEngineering(this.form).then(response => { |
| | | this.$modal.msgSuccess("修改成功"); |
| | | this.open = false; |
| | | this.getList(); |
| | | }); |
| | |
| | | } |
| | | }); |
| | | }, |
| | | deleteById(row) { |
| | | this.$modal.confirm('是否确认删除选中工程?').then(function() { |
| | | return deleteProjectEngineeringById(row.id); |
| | | }).then(() => { |
| | | this.getList(); |
| | | this.$modal.msgSuccess("删除成功"); |
| | | }).catch(() => {}); |
| | | }, |
| | | /** 删除按钮操作 */ |
| | | handleDelete(row) { |
| | | const ids = row.id || this.ids; |
| | | this.$modal.confirm('是否确认删除工程库编号为"' + ids + '"的数据项?').then(function() { |
| | | deleteByIds() { |
| | | const ids = this.ids; |
| | | this.$modal.confirm('是否确认删除选中工程?').then(function() { |
| | | return deleteProjectEngineeringByIds(ids); |
| | | }).then(() => { |
| | | this.getList(); |