<template>
|
<div class="main">
|
<div class="main_header" style="flex-direction: row-reverse;">
|
<!-- <div class="header_item">
|
<span class="header_label">类型:</span>
|
<el-select v-model="search.dictType" placeholder="请选择类型" clearable>
|
<el-option
|
v-for="item in optionsType"
|
:key="item.value"
|
:label="item.label"
|
:value="item.value">
|
</el-option>
|
</el-select>
|
</div> -->
|
<div class="header_item" style="margin-right:0px">
|
<!-- <el-button :size="size" v-if="showButton('search')" @click="searchButtonInfo(true)">查询</el-button> -->
|
<el-button class="search_btn" icon="el-icon-plus" v-if="showButton('insert')" @click="insertProp">新增</el-button>
|
</div>
|
</div>
|
<div class="main_content">
|
<el-table
|
v-loading="loading"
|
:data="dataList"
|
height="100%">
|
<el-table-column align="center" label="序号" width="60">
|
<template #default="scope">
|
<span>{{(pageNum - 1) * pageSize + scope.$index + 1}}</span>
|
</template>
|
</el-table-column>
|
<el-table-column prop="proName" label="项目名称" align="center" ></el-table-column>
|
<el-table-column label="尺寸" align="center" show-overflow-tooltip>
|
<template #default="{row}">
|
<div>{{showInfo(row.proSizes)}}</div>
|
</template>
|
</el-table-column>
|
<el-table-column label="配筋" align="center" show-overflow-tooltip>
|
<template #default="{row}">
|
<div>{{showInfo(row.proHas)}}</div>
|
</template>
|
</el-table-column>
|
<el-table-column label="转向" align="center" show-overflow-tooltip>
|
<template #default="{row}">
|
<div>{{showInfo(row.proTurns)}}</div>
|
</template>
|
</el-table-column>
|
<el-table-column label="注浆孔" align="center" show-overflow-tooltip>
|
<template #default="{row}">
|
<div>{{showInfo(row.proGroutings)}}</div>
|
</template>
|
</el-table-column>
|
<el-table-column label="块号" align="center" show-overflow-tooltip>
|
<template #default="{row}">
|
<div>{{showInfo(row.proBloks)}}</div>
|
</template>
|
</el-table-column>
|
<el-table-column prop="startDate" label="开始日期" align="center" show-overflow-tooltip></el-table-column>
|
<el-table-column prop="proTime" label="工期(月)" align="center"></el-table-column>
|
<el-table-column prop="planOutput" label="总需求(环)" align="center"></el-table-column>
|
<el-table-column label="操作" align="center">
|
<template #default="{ row }">
|
<el-button class="table_btn" size="mini" v-if="showButton('stop')" @click="deleteInfo(row)">停用</el-button>
|
<el-button class="delete_btn" size="mini" v-if="showButton('update')" @click="updateProp(row)">修改</el-button>
|
</template>
|
</el-table-column>
|
</el-table>
|
</div>
|
<div class="main_footer">
|
<el-pagination
|
background
|
@current-change="changePageNum"
|
@size-change="changePageSize"
|
:current-page="pageNum"
|
:page-sizes="[10, 20, 50, 100]"
|
:page-size="pageSize"
|
layout="total, sizes, prev, pager, next, jumper"
|
:total="total">
|
</el-pagination>
|
</div>
|
<el-dialog
|
class="prop_dialog"
|
:title="asyncTitle ? '新增项目' : '修改项目'"
|
:close-on-click-modal="false"
|
:visible.sync="asyncVisible"
|
width="35%">
|
<el-form ref="ruleForm" :model="ruleForm" :rules="rules" label-width="auto" class="rule_form">
|
<el-form-item label="项目名称:" prop="proName">
|
<el-input v-model="ruleForm.proName" :size="size" clearable placeholder="请输入项目名称"></el-input>
|
</el-form-item>
|
<el-form-item label="项目简介:" prop="proDesc">
|
<el-input v-model="ruleForm.proDesc" :size="size" type="textarea" :rows="3" clearable placeholder="请输入内容"></el-input>
|
</el-form-item>
|
<el-form-item label="尺寸(m):" prop="sizes">
|
<el-select v-model="ruleForm.sizes" placeholder="请选择尺寸" multiple>
|
<el-option
|
v-for="item in optionsSize"
|
:key="item.dictId"
|
:label="item.dictName"
|
:value="item.dictId">
|
</el-option>
|
</el-select>
|
</el-form-item>
|
<el-form-item label="配筋:" prop="hass">
|
<el-select v-model="ruleForm.hass" placeholder="请选择配筋" multiple>
|
<el-option
|
v-for="item in optionsHass"
|
:key="item.dictId"
|
:label="item.dictName"
|
:value="item.dictId">
|
</el-option>
|
</el-select>
|
</el-form-item>
|
<el-form-item label="转向:" prop="turns">
|
<el-select v-model="ruleForm.turns" placeholder="请选择转向" multiple>
|
<el-option
|
v-for="item in optionsTurn"
|
:key="item.dictId"
|
:label="item.dictName"
|
:value="item.dictId">
|
</el-option>
|
</el-select>
|
</el-form-item>
|
<el-form-item label="注浆孔:" prop="groutings">
|
<el-select v-model="ruleForm.groutings" placeholder="请选择注浆孔" multiple>
|
<el-option
|
v-for="item in optionsGrout"
|
:key="item.dictId"
|
:label="item.dictName"
|
:value="item.dictId">
|
</el-option>
|
</el-select>
|
</el-form-item>
|
<el-form-item label="块号:" prop="bloks">
|
<el-select v-model="ruleForm.bloks" placeholder="请选择块号" multiple>
|
<el-option
|
v-for="item in optionsBlocks"
|
:key="item.dictId"
|
:label="item.dictName"
|
:value="item.dictId">
|
</el-option>
|
</el-select>
|
</el-form-item>
|
<el-form-item label="开始日期:" prop="startDate">
|
<el-date-picker
|
v-model="ruleForm.startDate"
|
type="date"
|
style="width:100%"
|
value-format="yyyy-MM-dd"
|
placeholder="请选择开始日期">
|
</el-date-picker>
|
</el-form-item>
|
<el-form-item label="工期(月):" prop="proTime">
|
<el-input v-model="ruleForm.proTime" :size="size" type="number" clearable placeholder="请输入工期"></el-input>
|
</el-form-item>
|
<el-form-item label="总需求(环):" prop="planOutput">
|
<el-input v-model="ruleForm.planOutput" :size="size" type="number" clearable placeholder="请输入总需求"></el-input>
|
</el-form-item>
|
</el-form>
|
<div slot="footer">
|
<el-button @click="asyncVisible = false">取 消</el-button>
|
<el-button class="submit_btn" @click="asyncTitle ? submitInsert() : submitUpdate()">提 交</el-button>
|
</div>
|
</el-dialog>
|
</div>
|
</template>
|
|
<script>
|
import { buttonPinia } from '../../pinia/index';
|
import { throttle, changeSize } from '../../plugins/public'; // 导入节流、动态切换组件尺寸方法
|
export default {
|
data() {
|
return {
|
size: changeSize(), // 组件尺寸
|
pageNum: 1,
|
pageSize: 10,
|
search:{},//查询条件
|
total: 0,
|
loading: false,
|
dataList: [], //项目管理信息列表
|
asyncTitle: true, // 对话框title 新增:true 修改:false
|
asyncVisible: false, // 添加 修改对话框
|
ruleForm: {
|
}, // 按钮表单
|
rules: {
|
proName: [{
|
required: true,
|
message: '请输入项目名称',
|
trigger: 'blur'
|
}],
|
proDesc: [{
|
required: true,
|
message: '请输入项目简介',
|
trigger: 'blur'
|
}],
|
sizes: [{
|
required: true,
|
message: '请选择尺寸',
|
trigger: 'blur'
|
}],
|
hass: [{
|
required: true,
|
message: '请选择配筋',
|
trigger: 'blur'
|
}],
|
turns: [{
|
required: true,
|
message: '请选择转向',
|
trigger: 'blur'
|
}],
|
groutings: [{
|
required: true,
|
message: '请选择注浆孔',
|
trigger: 'blur'
|
}],
|
bloks: [{
|
required: true,
|
message: '请选择块号',
|
trigger: 'blur'
|
}],
|
},
|
optionsSize:[],//尺寸下拉框
|
optionsHass:[],//配筋下拉框
|
optionsTurn:[],//转向下拉框
|
optionsGrout:[],//注浆孔下拉框
|
optionsBlocks:[],//块号下拉框
|
}
|
},
|
watch: {
|
asyncVisible(bol) {
|
if(!bol) {
|
this.ruleForm = {};
|
this.$refs['ruleForm'].resetFields();
|
}
|
}
|
},
|
mounted() {
|
const that = this;
|
// 根据窗口大小动态修改组件尺寸
|
window.onresize = () => {
|
that.size = changeSize();
|
}
|
that.searchButtonInfo(true);
|
that.getAllTypes()//获取尺寸配筋等信息
|
},
|
methods: {
|
//table上展示尺寸等信息
|
showInfo(val){
|
let str=''
|
let str1 = ''
|
if(val.length===1){
|
str = val[0].dictName
|
}else{
|
val.forEach(item=>{
|
str+=item.dictName+','
|
})
|
str1 = str.lastIndexOf(',')
|
str = str.substring(0,str1)
|
}
|
return str
|
},
|
//获取尺寸配筋转向等信息
|
getAllTypes(){
|
let params = {
|
pageNum: 1,
|
pageSize: 100000000
|
}
|
this.$api.Dictionary.searchDictionary(params).then(res=>{
|
if(res.statusMsg === 'ok'){
|
this.optionsSize = res.data.list.filter(item =>item.dictType === '1')
|
this.optionsHass = res.data.list.filter(item =>item.dictType === '2')
|
this.optionsTurn = res.data.list.filter(item =>item.dictType === '3')
|
this.optionsGrout = res.data.list.filter(item =>item.dictType === '4')
|
this.optionsBlocks = res.data.list.filter(item =>item.dictType === '5')
|
}else{
|
this.$message.warning(res.statusMsg)
|
}
|
})
|
},
|
// 查询按钮列表信息
|
searchButtonInfo(bol) {
|
if(bol) {
|
this.pageNum = 1;
|
}
|
let params = Object.assign({},this.search,{
|
pageNum: this.pageNum,
|
pageSize: this.pageSize
|
})
|
this.loading = true;
|
this.$api.Engineer.searchProjects(params).then((res) => {
|
if(res.statusMsg === 'ok') {
|
this.total = res.data.total;
|
this.dataList = res.data.list;
|
}
|
this.loading = false;
|
})
|
},
|
// 新增按钮信息
|
insertProp() {
|
this.asyncTitle = true;
|
this.asyncVisible = true;
|
},
|
// 修改按钮信息
|
updateProp(row) {
|
this.asyncTitle = false;
|
this.asyncVisible = true;
|
this.$api.Engineer.detailsProjects({proId: row.proId}).then(res=>{
|
if(res.statusMsg === 'ok'){
|
this.ruleForm = res.data
|
let sizeArr = []
|
let hassArr = []
|
let turnArr = []
|
let groutArr = []
|
let blockArr = []
|
res.data.proSizes.forEach(item=>{
|
sizeArr.push(item.sizes)
|
})
|
res.data.proHas.forEach(item=>{
|
hassArr.push(item.hasSteel)
|
})
|
res.data.proTurns.forEach(item=>{
|
turnArr.push(item.turn)
|
})
|
res.data.proGroutings.forEach(item=>{
|
groutArr.push(item.groutingHoles)
|
})
|
res.data.proBloks.forEach(item=>{
|
blockArr.push(item.blockNum)
|
})
|
this.$set(this.ruleForm,'sizes',sizeArr)
|
this.$set(this.ruleForm,'hass',hassArr)
|
this.$set(this.ruleForm,'turns',turnArr)
|
this.$set(this.ruleForm,'groutings',groutArr)
|
this.$set(this.ruleForm,'bloks',blockArr)
|
}else{
|
this.$message.warning(res.statusMsg)
|
}
|
})
|
},
|
// 删除按钮信息
|
deleteInfo(row) {
|
this.$confirm("该操作将删除该信息,是否继续删除?", "提示", {
|
confirmButtonText: "确定",
|
cancelButtonText: "取消",
|
type: "warning"
|
})
|
.then(() => {
|
this.$api.Engineer.deleteProjects({proId: row.proId})
|
.then(res => {
|
if(res.statusMsg === 'ok') {
|
this.searchButtonInfo(true);
|
this.$message.success("删除成功!");
|
} else {
|
this.$message.warning(res.statusMsg);
|
}
|
})
|
})
|
.catch(() => {
|
this.$message.warning("您已取消");
|
})
|
},
|
// 提交添加按钮信息
|
submitInsert: throttle(function() {
|
this.$refs.ruleForm.validate((valid) => {
|
if(valid) {
|
const params = Object.assign({}, this.ruleForm);
|
this.$api.Engineer.insertProjects(params).then((res) => {
|
if(res.statusMsg === 'ok') {
|
this.asyncVisible = false;
|
this.searchButtonInfo(true);
|
this.$message.success('添加成功!');
|
} else {
|
this.$message.warning(res.statusMsg);
|
}
|
})
|
}
|
})
|
}, 3000),
|
// 提交修改按钮信息
|
submitUpdate: throttle(function() {
|
this.$refs.ruleForm.validate((valid) => {
|
if(valid) {
|
const params = Object.assign({}, this.ruleForm);
|
this.$api.Engineer.updateProjects(params).then((res) => {
|
if(res.statusMsg === 'ok') {
|
this.asyncVisible = false;
|
this.searchButtonInfo(true);
|
this.$message.success('添加成功!');
|
} else {
|
this.$message.warning(res.statusMsg);
|
}
|
})
|
}
|
})
|
}, 3000),
|
// 判断按钮权限信息
|
showButton(str) {
|
const pinia = buttonPinia();
|
return pinia.$state.buttonInfo.includes(str);
|
},
|
// 切换页数
|
changePageNum(page) {
|
this.pageNum = page;
|
this.searchButtonInfo();
|
},
|
// 切换每页条数
|
changePageSize(size) {
|
this.pageSize = size;
|
this.searchButtonInfo();
|
}
|
}
|
}
|
</script>
|
|
<style lang="sass" scoped>
|
@import '../../style/layout-main.scss';
|
</style>
|