<template>
|
<div class="main">
|
<div class="main_header">
|
<div class="header_item">
|
<span class="header_label">项目名称:</span>
|
<el-select v-model="search.proId" placeholder="请选择项目名称" clearable filterable>
|
<el-option
|
v-for="item in optionsProject"
|
:key="item.proId"
|
:label="item.proName"
|
:value="item.proId">
|
</el-option>
|
</el-select>
|
</div>
|
<div class="header_item">
|
<span class="header_label">年份:</span>
|
<el-date-picker
|
v-model="search.planYear"
|
value-format="yyyy"
|
type="year"
|
placeholder="请选择年份">
|
</el-date-picker>
|
</div>
|
<div class="header_item">
|
<el-button icon="el-icon-search" 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">
|
<div style="overflow-y:auto;overflow-x:hidden;height:calc(100% - 5px)">
|
<div class="plan_main_card" v-for="(item,index) in dataList" :key="index">
|
<div class="plan_main_header">
|
<div class="plan_header_left">
|
<span class="plan_header_one">{{item.proName}}</span>
|
<span>{{item.planYear}}年</span>
|
<span>{{item.sizeName}}</span>
|
</div>
|
<div class="plan_header_right">
|
<el-button style="background-image:none;border:1px solid #38B2FA;border-radius:5px;padding:5px 10px;" :size="size" v-if="showButton('update')" class="table_btn" @click="updateProp(item)">修改</el-button>
|
<el-button style="background-image:none;border:1px solid #FD494B;background-color:#434F69;border-radius:5px;padding:5px 10px;" :size="size" class="delete_btn" v-if="showButton('delete')" @click="deleteInfo(item)">删除</el-button>
|
</div>
|
</div>
|
<div class="plan_main_content">
|
<div class="plan_content_items">
|
<div class="plan_content_title">月份</div>
|
<div class="plan_content_datas" style="background-color:#052C55;color:#39B5FE" v-for="(item,index) in numLists" :key="index">{{item}}</div>
|
</div>
|
<div class="plan_content_items" style="margin-bottom:0px;border-bottom-color:transparent;">
|
<div class="plan_content_title">管片需求数量(环)</div>
|
<div class="plan_content_datas" v-for="(iten,index) in item.planProductArray" :key="index">{{iten.split('.')[0]}}</div>
|
</div>
|
<div class="plan_content_items">
|
<div class="plan_content_title">已生产管片数量(环)</div>
|
<div class="plan_content_datas" v-for="(it,index) in item.productedArray" :key="index">{{it.split('.')[0]}}</div>
|
</div>
|
</div>
|
</div>
|
</div>
|
</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===true ? '新增' :asyncTitle===false ? '修改':'查看'"
|
: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="proId">
|
<el-select v-model="ruleForm.proId" placeholder="请选择项目名称" :disabled="disabled" @change="changeSizes" clearable>
|
<el-option
|
v-for="item in optionsProject"
|
:key="item.proId"
|
:label="item.proName"
|
:value="item.proId">
|
</el-option>
|
</el-select>
|
</el-form-item>
|
<el-form-item label="尺寸:" prop="size">
|
<el-select v-model="ruleForm.size" placeholder="请选择尺寸" :disabled="disabled">
|
<el-option
|
v-for="item in optionsSize"
|
:key="item.sizeId"
|
:label="item.sizeName"
|
:value="item.sizeId">
|
</el-option>
|
</el-select>
|
</el-form-item>
|
<el-form-item label="年份:" prop="planYear">
|
<el-date-picker
|
v-model="ruleForm.planYear"
|
value-format="yyyy"
|
:disabled="disabled"
|
type="year"
|
placeholder="请选择年份">
|
</el-date-picker>
|
</el-form-item>
|
<div class="months_items">
|
<div v-for="(item,index) in monthLists" :key="index" class="month_index">
|
<el-input placeholder="请输入" v-model="item.planProduct" type="number" :disabled="disabled">
|
<template slot="prepend">{{item.month}}月</template>
|
</el-input>
|
</div>
|
<div class="months_nums">
|
<span>合计:</span>
|
<span style="color:#18F8F9;font-size:20px;font-weight:600;margin-left:5px">{{allMonths}}</span>
|
<span>环</span>
|
</div>
|
</div>
|
</el-form>
|
<div slot="footer" v-if="asyncTitle !=='see'">
|
<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,
|
disabled:false,//是否禁止修改
|
loading: false,
|
allMonths:null,//计算出来的总数
|
rowId:'',//某一行id
|
dataList: [], //管片生产计划信息
|
optionsProject:[],//项目名称
|
asyncTitle: true, // 对话框title 新增:true 修改:false
|
asyncVisible: false, // 添加 修改对话框
|
ruleForm: {}, // 按钮表单
|
rules: {
|
proId: [{
|
required: true,
|
message: '请选择项目名称',
|
trigger: 'change'
|
}],
|
size: [{
|
required: true,
|
message: '请选择尺寸',
|
trigger: 'change'
|
}],
|
planYear: [{
|
required: true,
|
message: '请选择年份',
|
trigger: 'change'
|
}],
|
},
|
optionsSize:[],//尺寸
|
optionsHass:[],//配筋
|
optionsBlocks:[],//块号
|
monthLists:[],//弹框中的月
|
numLists:[1,2,3,4,5,6,7,8,9,10,11,12,'合计'],
|
}
|
},
|
mounted() {
|
const that = this;
|
// 根据窗口大小动态修改组件尺寸
|
window.onresize = () => {
|
that.size = changeSize();
|
}
|
that.searchButtonInfo(true);
|
that.getAllProjects()
|
},
|
watch:{
|
'monthLists':{
|
handler:function(val){
|
let allNum=0
|
val.map(item =>{
|
allNum+=item.planProduct*1
|
})
|
this.allMonths = allNum
|
return this.allMonths
|
},
|
deep:true
|
},
|
asyncVisible(bol) {
|
if(!bol) {
|
this.ruleForm = {};
|
this.$refs.ruleForm.resetFields();
|
}
|
}
|
},
|
methods: {
|
//获取管片计划月份
|
getPlanMonth(val){
|
this.$api.Ducts.getMonthsList({planId:val}).then(res=>{
|
if(res.statusMsg==='ok'){
|
this.monthLists = res.data.monthList
|
this.allMonths = res.data.planProduct
|
}else{
|
this.$message.warning(res.statusMsg)
|
}
|
})
|
},
|
//获得所有项目名称
|
getAllProjects(){
|
let obj = {
|
pageNum: 1,
|
pageSize: 100000000
|
}
|
this.$api.Engineer.searchProjects(obj).then(res=>{
|
if(res.statusMsg === 'ok'){
|
this.optionsProject = res.data.list
|
}else{
|
this.$message.warning(res.statusMsg)
|
}
|
})
|
},
|
//通过选择项目选择尺寸
|
changeSizes(val){
|
this.ruleForm.size = ""
|
this.$api.Reinforce.searchProjectSize({proId:val,pageNum: 1,
|
pageSize:100000000}).then(res=>{
|
if(res.statusMsg === 'ok'){
|
if(this.ruleForm.proId ===""){
|
this.optionsSize = []
|
}else{
|
this.optionsSize = res.data.list
|
}
|
}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.Ducts.searchDuctPlan(params).then((res) => {
|
if(res.statusMsg === 'ok') {
|
this.total = res.data.total;
|
this.dataList = res.data.list;
|
this.loading = false;
|
}else{
|
this.$message.warning(res.statusMsg)
|
}
|
})
|
},
|
// 新增按钮信息
|
insertProp() {
|
this.asyncTitle = true;
|
this.asyncVisible = true;
|
this.disabled = false
|
this.getPlanMonth()
|
},
|
// 修改按钮信息
|
updateProp(row) {
|
this.$api.Reinforce.searchProjectSize({proId:row.proId,pageNum: 1,
|
pageSize:100000000}).then(res=>{
|
if(res.statusMsg === 'ok'){
|
this.optionsSize = res.data.list
|
}else{
|
this.$message.warning(res.statusMsg)
|
}
|
})
|
this.asyncTitle = false;
|
this.asyncVisible = true;
|
this.disabled = false
|
this.ruleForm = row
|
this.getPlanMonth(row.planId)
|
this.$set(this.ruleForm,'planYear',row.planYear+'')
|
this.rowId = row.planId
|
},
|
//查看按钮
|
detailaProp(row){
|
this.asyncTitle = 'see'
|
this.asyncVisible = true;
|
this.disabled = true
|
this.ruleForm = row
|
this.$set(this.ruleForm,'planYear',row.planYear+'')
|
this.getPlanMonth(row.planId)
|
},
|
// 删除按钮信息
|
deleteInfo(row) {
|
this.$confirm("该操作将删除该信息,是否继续删除?", "提示", {
|
confirmButtonText: "确定",
|
cancelButtonText: "取消",
|
type: "warning"
|
})
|
.then(() => {
|
this.$api.Ducts.deleteDuctPlan({planId: row.planId})
|
.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);
|
params.monthList = this.monthLists
|
params.planProduct = this.allMonths
|
this.$api.Ducts.insertDuctPlan(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);
|
params.monthList = this.monthLists
|
params.planProduct = this.allMonths
|
this.$api.Ducts.updateDuctPlan(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="scss" scoped>
|
@import '../../../style/layout-main.scss';
|
|
.months_items{
|
display: flex;
|
flex-wrap: wrap;
|
|
.month_index{
|
margin-left: 10px;
|
margin-bottom: 10px;
|
max-width: calc(100%/3 - 10px);
|
/deep/.el-input-group__prepend{
|
color: #19F6F8;
|
background-color: #122558;
|
border-color: #1B428F;
|
}
|
}
|
.months_nums{
|
width: 100%;
|
height: 50px;
|
margin-bottom: 24px;
|
border-radius: 3px;
|
background-color: #0B5274;
|
display: flex;
|
align-items: center;
|
span{
|
margin-left: 15px;
|
color: #fff;
|
}
|
}
|
}
|
.plan_main_card{
|
width: calc(100% - 36px);
|
border-top-left-radius: 6px;
|
border-top-right-radius: 6px;
|
border-bottom-left-radius: 6px;
|
border-bottom-right-radius: 6px;
|
background-color: #031A46;
|
margin: 0px 5px 24px 0px;
|
box-shadow:0px 0px 8px 0px #0C4F79;
|
|
.plan_main_header{
|
width: 100%;
|
height: 48px;
|
border-top-left-radius: 6px;
|
border-top-right-radius: 6px;
|
display: flex;
|
align-items: center;
|
justify-content: space-between;
|
background-color: rgba(57,181,254,0.3);
|
.plan_header_left{
|
display: flex;
|
span{
|
flex: none;
|
color: #39B5FE;
|
margin-left: 20px;
|
font-size: 16px;
|
font-weight: 600;
|
}
|
.plan_header_one{
|
margin-left: 40px;
|
position: relative;
|
&::before{
|
position: absolute;
|
left: -14px;
|
top: -1px;
|
content: '';
|
width: 5px;
|
height: 20px;
|
background-color: #39B5FE;
|
}
|
}
|
}
|
.plan_header_right{
|
margin-right: 15px;
|
}
|
}
|
.plan_main_content{
|
width: 100%;
|
height: calc(100% - 30px);
|
background-color:#031A46;
|
padding-top: 20px;
|
padding-bottom: 10px;
|
border-bottom-left-radius: 6px;
|
border-bottom-right-radius: 6px;
|
|
|
.plan_content_items{
|
display: flex;
|
border: 1px solid #39B5FE;
|
margin: 0px 15px 8px 15px;
|
|
.plan_content_title{
|
width: 145px;
|
padding: 12px 0px;
|
flex: none;
|
color: #39B5FE;
|
text-align: center;
|
background-color: #052C55;
|
}
|
.plan_content_datas{
|
flex: 1;
|
padding: 12px 0px;
|
color: #fff;
|
text-align: center;
|
border-left: 1px solid #1CB7E0;
|
}
|
}
|
}
|
}
|
</style>
|