<template>
|
<div class="main" v-if="!showPrint">
|
<div class="main_header">
|
<div class="header_item">
|
<span class="header_label">项目名称:</span>
|
<el-select v-model="search.proId" placeholder="请选择项目名称" clearable filterable @change="getAllType">
|
<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-select v-model="search.sizeId" placeholder="请选择尺寸" clearable>
|
<el-option
|
v-for="item in optionsSize"
|
:key="item.dictId"
|
:label="item.dictName"
|
:value="item.dictId">
|
</el-option>
|
</el-select>
|
</div>
|
<div class="header_item">
|
<span class="header_label">配筋:</span>
|
<el-select v-model="search.reinforcementId" placeholder="请选择配筋" clearable>
|
<el-option
|
v-for="item in optionsHass"
|
:key="item.dictId"
|
:label="item.dictName"
|
:value="item.dictId">
|
</el-option>
|
</el-select>
|
</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">
|
<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" show-overflow-tooltip></el-table-column>
|
<el-table-column prop="sizeName" label="尺寸" align="center"></el-table-column>
|
<el-table-column prop="reinforcementName" label="配筋" align="center"></el-table-column>
|
<el-table-column prop="blockName" label="块号" align="center"></el-table-column>
|
<el-table-column prop="printNum" label="数量(个)" align="center"></el-table-column>
|
<el-table-column prop="realName" label="创建人" align="center"></el-table-column>
|
<el-table-column prop="createTime" label="创建时间" align="center" show-overflow-tooltip></el-table-column>
|
<el-table-column label="操作" align="center" width="300">
|
<template #default="{ row }">
|
<el-button class="table_btn" size="mini" v-if="showButton('print')" @click="printProp(row)">打印</el-button>
|
<el-button class="delete_btn" size="mini" v-if="showButton('delete')" @click="deleteInfo(row)">删除</el-button>
|
<el-button class="table_btn" size="mini" v-if="showButton('print')" @click="showPrints(row)">查看打印信息</el-button>
|
</template>
|
</el-table-column>
|
</el-table>
|
</div>
|
<!-- <div v-show="showAbtn" v-for="(item,index) in printNums" :key="index"> -->
|
<!-- <a :id="`n${index}`" :href="`printpipe://1,${item.produceNumber}`"><p></p></a> -->
|
<!-- </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="proId">
|
<el-select v-model="ruleForm.proId" placeholder="请选择项目名称" @change="getAllType">
|
<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="sizeId">
|
<el-select v-model="ruleForm.sizeId" placeholder="请选择尺寸" clearable>
|
<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="reinforcementId">
|
<el-select v-model="ruleForm.reinforcementId" placeholder="请选择配筋" clearable>
|
<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="blockNum">
|
<el-select v-model="ruleForm.blockNum" placeholder="请选择块号" clearable>
|
<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="printNum">
|
<el-input-number v-model="ruleForm.printNum" :min="0"></el-input-number>
|
</el-form-item>
|
<div class="nums_index">
|
<div class="nums_items" v-for="(item,index) in numLists" :key="index" @click="changeNum(item)">{{item}}</div>
|
</div>
|
</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>
|
<div v-else>
|
<reins-print :show-print.sync="showPrint" :rowsData.sync="rowsData"></reins-print>
|
</div>
|
</template>
|
|
<script>
|
import { buttonPinia } from '../../../pinia/index';
|
import { throttle, changeSize} from '../../../plugins/public'; // 导入节流、动态切换组件尺寸方法
|
import ReinsPrint from './components/ReinsPrint.vue'
|
export default {
|
components:{
|
ReinsPrint
|
},
|
data() {
|
return {
|
printNums:[],//循环打印多少次数组
|
showAbtn:true,//是否展示a标签
|
size: changeSize(), // 组件尺寸
|
pageNum: 1,
|
pageSize: 10,
|
search:{},//查询条件
|
total: 0,
|
loading: false,
|
showPrint:false,//是否展示打印页面
|
rowsData:null,//一行数据
|
dataList: [], //钢筋笼信息打印
|
optionsProject:[],//项目名称
|
asyncTitle: true, // 对话框title 新增:true 修改:false
|
asyncVisible: false, // 添加 修改对话框
|
ruleForm: {
|
printNum:0
|
}, // 按钮表单
|
rules: {
|
proId: [{
|
required: true,
|
message: '请选择项目名称',
|
trigger: 'change'
|
}],
|
sizeId: [{
|
required: true,
|
message: '请选择尺寸',
|
trigger: 'change'
|
}],
|
reinforcementId: [{
|
required: true,
|
message: '请选择配筋',
|
trigger: 'change'
|
}],
|
blockNum: [{
|
required: true,
|
message: '请选择块号',
|
trigger: 'change'
|
}],
|
printNum: [{
|
required: true,
|
message: '请输入数量',
|
trigger: 'blur'
|
}],
|
},
|
optionsSize:[],//尺寸
|
optionsHass:[],//配筋
|
optionsBlocks:[],//块号
|
numLists:[5,10,15,20,25,30,40,50,60,70,80,90],//数字列表
|
}
|
},
|
watch: {
|
asyncVisible(bol) {
|
if(!bol) {
|
this.ruleForm = {};
|
this.$refs.ruleForm.resetFields();
|
}
|
}
|
},
|
mounted() {
|
const that = this;
|
// 根据窗口大小动态修改组件尺寸
|
window.onresize = () => {
|
that.size = changeSize();
|
}
|
that.searchButtonInfo(true);
|
that.getAllProjects()
|
},
|
methods: {
|
//执行去打印
|
gopPrints(numbers, arr){
|
const link = document.createElement('a');
|
link.id = `link`;
|
link.href = `printpipe://1,${arr[arr.length-1].produceNumber},${numbers}`
|
link.click()
|
},
|
//跳转打印页面
|
showPrints(row){
|
this.rowsData = row
|
this.showPrint = true
|
},
|
//选择个数
|
changeNum(value){
|
this.$set(this.ruleForm,'printNum',value)
|
},
|
//通过选择项目显示不同的尺寸配筋等
|
getAllType(val){
|
this.$set(this.search,'sizeId','')
|
this.$set(this.search,'reinforcementId','')
|
if(this.ruleForm.sizeId !==undefined){
|
this.$set(this.ruleForm,'sizeId','')
|
}
|
if(this.ruleForm.reinforcementId !==undefined){
|
this.$set(this.ruleForm,'reinforcementId','')
|
}
|
if(this.ruleForm.blockNum !==undefined){
|
this.$set(this.ruleForm,'blockNum','')
|
}
|
this.$api.Print.getTypePrints({proId:val,dictType:1}).then(res=>{
|
this.optionsSize = res.data
|
})
|
this.$api.Print.getTypePrints({proId:val,dictType:2}).then(res=>{
|
this.optionsHass = res.data
|
})
|
this.$api.Print.getTypePrints({proId:val,dictType:5}).then(res=>{
|
this.optionsBlocks = res.data
|
})
|
},
|
//获得所有项目名称
|
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)
|
}
|
})
|
},
|
// 查询按钮列表信息
|
searchButtonInfo(bol) {
|
if(bol) {
|
this.pageNum = 1;
|
}
|
let params = Object.assign({},this.search,{
|
pageNum: this.pageNum,
|
pageSize: this.pageSize
|
})
|
this.loading = true;
|
this.$api.Print.searchBearPrint(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;
|
},
|
// 打印按钮信息
|
printProp(val) {
|
this.$api.Print.printBears({steelPrintId:val.steelPrintId}).then(res=>{
|
if(res.statusMsg === 'ok'){
|
this.printNums = res.data;
|
this.gopPrints(val.printNum,this.printNums)
|
}else{
|
this.$message.warning(res.statusMsg)
|
}
|
})
|
},
|
// 删除按钮信息
|
deleteInfo(row) {
|
this.$confirm("该操作将删除该信息,是否继续删除?", "提示", {
|
confirmButtonText: "确定",
|
cancelButtonText: "取消",
|
type: "warning"
|
})
|
.then(() => {
|
this.$api.Print.deleteBearPrint({steelPrintId: row.steelPrintId})
|
.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.Print.insertBearPrint(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.Print.updateDuctRaw(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';
|
.nums_index{
|
display: flex;
|
justify-content: space-between;
|
margin-left: 90px;
|
background-color: #122558;
|
border-radius: 4px;
|
padding: 10px 15px 10px 10px;
|
margin-bottom: 10px;
|
overflow: auto;
|
.nums_items{
|
width: 28px;
|
height: 28px;
|
text-align: center;
|
padding: 5px;
|
border: 1px solid #19F6F8;
|
border-radius: 4px;
|
color: #19F6F8;
|
margin-right: 5px;
|
flex: none;
|
|
&:hover{
|
cursor: pointer;
|
color: #fff;
|
background-color: #18CCD8;
|
border-color: #18CCD8;
|
}
|
}
|
}
|
//滚动条样式
|
::-webkit-scrollbar {
|
width: 4px;
|
height: 3px;
|
}
|
::-webkit-scrollbar-thumb {
|
border-radius: 10px;
|
box-shadow: inset 0 0 5px #13497E;
|
background: transparent;
|
}
|
::-webkit-scrollbar-track {
|
box-shadow: inset 0 0 5px transparent;
|
border-radius: 0;
|
background: transparent;
|
}
|
</style>
|