YanZhuProject/yanzhu-ui/src/views/base/projectApplyDetail.vue

167 lines
7.6 KiB
Vue

<template>
<div class="project-apply-detail app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" >
<el-form-item label="公司名称" prop="compId">
<el-select v-model="queryParams.compId" placeholder="请选择公司" clearable @change="compChange">
<el-option v-for="it in compList" :key="it.deptId" :label="it.deptName"
:value="it.deptId" />
</el-select>
</el-form-item>
<el-form-item label="段队" prop="subDeptId">
<el-select v-model="queryParams.subDeptId" placeholder="请选择段队" clearable @change="subDeptChange">
<el-option v-for="it in subDeptList" :key="it.deptId" :label="it.deptName"
:value="it.deptId" />
</el-select>
</el-form-item>
<el-form-item label="项目" prop="subDeptId">
<el-select v-model="queryParams.prjId" placeholder="请选择项目" clearable @change="prjChange">
<el-option v-for="it in prjList" :key="it.deptId" :label="it.deptName"
:value="it.deptId" />
</el-select>
</el-form-item>
<el-form-item label="临建项目" prop="tmpPrjId">
<el-select v-model="queryParams.tmpPrjId" placeholder="请选择临建项目" clearable @change="handleQuery">
<el-option v-for="it in tmpPrjList" :key="it.id" :label="it.name"
:value="it.id" />
</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-table v-loading="loading" :data="detailList" row-key="id">
<el-table-column prop="typeName" label="项目名称" width="200"></el-table-column>
<el-table-column prop="superTypeKey" label="临建项目名称" width="200"></el-table-column>
<el-table-column prop="superTypeName" label="物资类别" width="200"></el-table-column>
<el-table-column prop="assetsName" label="物资名称"></el-table-column>
<el-table-column prop="assetsVersion" label="物资型号"></el-table-column>
<el-table-column prop="pushType" label="计划分类">
<template slot-scope="scope">{{ scope.row.pushType!=3?'计划内':'计划外'}}</template>
</el-table-column>
<el-table-column prop="assetsUnit" label="计量单位"></el-table-column>
<el-table-column prop="number" label="计划数量"></el-table-column>
<el-table-column prop="checkedTotalValue" label="实际采购数量"></el-table-column>
<el-table-column prop="assetsId" label="状态">
<template slot-scope="scope">{{ scope.row.assetsId==1?'审批中':scope.row.assetsId==10?'待验收':'验收完成'}}</template>
</el-table-column>
<el-table-column label="申请日期" align="center" prop="createTime" width="200">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime) }}</span>
</template>
</el-table-column>
<el-table-column label="验收日期" align="center" prop="updateTime" width="200">
<template slot-scope="scope">
<span>{{scope.row.assetsId==100? parseTime(scope.row.updateTime):'' }}</span>
</template>
</el-table-column>
</el-table>
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
@pagination="getList" />
</div>
</template>
<script>
import { listDept } from "@/api/system/dept";
import { listProjectInfo } from "@/api/project/projectInfo";
import { detailProjectList } from "@/api/project/projectApply";
export default {
name: 'YanzhuUiProjectApplyDetail',
data() {
return {
detailList:[],
queryParams: {
pageNum: 1,
pageSize: 10,
compId:'',
subDeptId:'',
prjId:'',
tmpPrjId:'',
deptId:'',
},
loading:false,
allDepts:[{deptId:'',deptName:'所有'}],
compList:[{deptId:'',deptName:'所有'}],
subDeptList:[{deptId:'',deptName:'所有'}],
prjList:[{deptId:'',deptName:'所有'}],
tmpPrjList:[{id:'',name:'所有'}],
total: 0,
};
},
mounted() {
let deptId=this.$store.state.user.info.parDeptId;
this.queryParams.deptId=deptId;
listDept({deptId:deptId}).then(d=>{
this.allDepts=d.data||[];
let tmps=this.allDepts.filter(d=>d.level==1);
this.compList=[{deptId:'',deptName:'所有'},...tmps];
});
this.getList();
},
methods: {
compChange(){
let tmps=this.queryParams.compId?this.allDepts.filter(d=>d.level==2 && (","+d.ancestors+",").indexOf(","+this.queryParams.compId+",")>=0):[];
this.subDeptList=[{deptId:'',deptName:'所有'},...tmps];
this.queryParams.subDeptId=""
this.queryParams.prjId="";
this.queryParams.tmpPrjId="";
this.prjList=[{deptId:'',deptName:'所有'}]
this.tmpPrjList=[{id:'',name:'所有'}]
},
subDeptChange(){
let tmps=this.queryParams.subDeptId?this.allDepts.filter(d=>d.level==300 && (","+d.ancestors+",").indexOf(","+this.queryParams.subDeptId+",")>=0):[];
this.prjList=[{deptId:'',deptName:'所有'},...tmps];
this.queryParams.prjId="";
this.queryParams.tmpPrjId="";
this.tmpPrjList=[{id:'',name:'所有'}]
},
prjChange(){
if(!this.queryParams.prjId){
this.tmpPrjList=[{id:'',name:'所有'}];
this.queryParams.tmpPrjId="";
return;
}
listProjectInfo({deptId:this.queryParams.prjId, pageNum: 1,
pageSize: 100,}).then(d=>{
let tmps=d.rows||[];
this.tmpPrjList=[{id:'',name:'所有'},...tmps];
this.queryParams.tmpPrjId="";
});
},
getList(){
let query={
pageNum: this.queryParams.pageNum,
pageSize: this.queryParams.pageSize,
};
if(this.queryParams.tmpPrjId){
query.projectId=this.queryParams.tmpPrjId
}else if(this.queryParams.prjId){
query.parProjectId=this.queryParams.prjId;
}else if(this.queryParams.subDeptId){
query.deptId=this.queryParams.subDeptId;
}else if(this.queryParams.compId){
query.deptId=this.queryParams.compId;
}else{
query.deptId=this.queryParams.deptId;
}
detailProjectList(query).then(d=>{
this.total=d.total;
this.detailList=d.rows||[];
});
},
handleQuery(){
this.queryParams.pageNum=1;
this.getList()
},
resetQuery(){
this.queryParams.pageNum=1;
this.queryParams.compId="";
this.compList=[{deptId:'',deptName:'所有'}];
this.compChange();
}
},
};
</script>