|
|
<template> <div class="mod-config"> <el-form :inline="true" label-position="top" label-width="100px" > <el-form-item :label="'电视机ID'"> <el-input v-model="searchData.tvId" style="width: 130px"></el-input> </el-form-item> <el-form-item :label="'工位'"> <el-input v-model="searchData.workStation" style="width: 130px"></el-input> <el-button @click="search()" style="margin-left: 0px;margin-top:0px" type="primary">查询</el-button> </el-form-item> </el-form> <el-table :height="height" :data="tableData" border style="width: 100%"> <el-table-column v-for="(item,index) in columnList" :key="index" :sortable="item.columnSortable" :prop="item.columnProp" header-align="center" :show-overflow-tooltip="item.showOverflowTooltip" :align="item.align" :fixed="item.fixed==''?false:item.fixed" :min-width="item.columnWidth" :label="item.columnLabel"> <template slot-scope="scope"> <span v-if="!item.columnHidden"> {{ scope.row[item.columnProp] }}</span> <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span> </template> </el-table-column> <el-table-column prop="" header-align="center" align="center" width="140" fixed="right" label="操作"> <template slot-scope="scope" class="foo_container"> <a type="text" size="small" @click="tvModel(scope.row)">修改工位</a> </template> </el-table-column> </el-table>
<el-dialog title="维护工位" :close-on-click-modal="false" v-drag :visible.sync="tvModalFlag" width="215px"> <el-form :inline="true" label-position="top" style="margin-left: 22px;margin-top: -5px;" @submit.native.prevent> <el-form-item :label="'工位'"> <el-input v-model="tvData.workStation" style="width: 130px;" ></el-input> </el-form-item> </el-form> <el-footer style="height:40px;margin-top: 20px;text-align:center"> <el-button type="primary" @click="updateWorkStation()">确定</el-button> <el-button type="primary" @click="tvModalFlag = false">取消</el-button> </el-footer> </el-dialog> </div></template>
<script> import { getTvList, updateWorkStation, } from '@/api/production.js'
export default { name: 'tvList', data () { return { tvData:{ tvId:'', workStation:'', }, tvModalFlag:false, columnList: [ { tableId: "tvSopBase", tableName: this.$route.meta.title, columnProp: "tvId", columnLabel: "电视机ID", columnHidden: false, columnImage: false, columnSortable: false, columnWidth: 80, format: null, functionId: this.$route.meta.menuId, sortLv: 0, status: true, fixed: '', serialNumber: null, columnType: null, align: 'left' }, { tableId: "tvSopBase", tableName: this.$route.meta.title, columnProp: "workStation", columnLabel: "工位", columnHidden: false, columnImage: false, columnSortable: false, columnWidth: 80, format: null, functionId: this.$route.meta.menuId, sortLv: 0, status: true, fixed: '', serialNumber: null, columnType: null, align: 'left' } ], visible:false, // 导出 end
height: 200, tableData: [], searchData: { tvId:'', workStation: '', }, } }, mounted () { this.$nextTick(() => { this.height = window.innerHeight - 210 }) }, methods: { search () { getTvList(this.searchData).then(({data}) => { this.tableData = data.rows }) }, tvModel(row){ this.tvData.tvId=row.tvId; this.tvData.workStation=row.workStation; this.tvModalFlag=true; }, updateWorkStation(){ updateWorkStation(this.tvData).then(({data}) => { if (data && data.code === 0) { this.search(); this.tvModalFlag = false this.$message({ message: '操作成功', type: 'success', duration: 1500,
onClose: () => { } }) } else { this.$alert(data.msg, '错误', { confirmButtonText: '确定' }) } }) }, }, created () { this.search(); } }</script>
<style scoped>
</style>
|