|
|
<template> <div class="mod-config">
<el-form label-position="top" style="margin-top: 1px; margin-left: 0px;" > <el-form-item > <el-button type="primary" @click="colorSearch(true)" >刷新</el-button> <el-button type="primary" @click="newColor()" v-if="!ifDisableFlag">新增</el-button> </el-form-item> <el-table height="400" :data="colorTable" border style="width: 100%"> <el-table-column prop="" header-align="center" align="center" min-width="30" v-if="!ifDisableFlag" label="操作"> <template slot-scope="scope"> <a type="text" size="small" @click="updateColor(scope.row)">编辑</a> <a type="text" size="small" @click="deleteColor(scope.row)">删除</a> </template> </el-table-column> <el-table-column prop="order" header-align="center" align="center" min-width="40" label="色序"> </el-table-column> <el-table-column prop="seqNo" header-align="center" align="center" min-width="60" label="序号"> </el-table-column> <el-table-column prop="ink" header-align="center" align="left" min-width="60" label="Ink"> </el-table-column> <el-table-column prop="type" header-align="center" align="left" min-width="60" label="Type"> </el-table-column> <el-table-column prop="otherRef" header-align="center" align="left" min-width="60" label="%G"> </el-table-column>
</el-table> <el-row :gutter="20"> <el-col :span="24"><div class="grid-content bg-purple"> <el-form-item :label="'备注/Remarks'"> <el-input type="textarea" v-model="dataForm.remark " :rows="3" resize='none' maxlength="120" show-word-limit :disabled="ifDisableFlag" style="height: 60px" > </el-input> </el-form-item> </div></el-col> </el-row> <el-row :gutter="20" style="margin-top: 60px"> <el-col :span="24"><div class="grid-content bg-purple"> <el-form-item :label="'Action'"> <el-input type="textarea" v-model="dataForm.action " :rows="3" resize='none' maxlength="120" show-word-limit :disabled="ifDisableFlag" style="height: 60px" > </el-input> </el-form-item> </div></el-col> </el-row> </el-form>
<el-form label-position="top" style="margin-top:60px; margin-left: 0px;text-align:center" v-if="!ifDisableFlag"> <el-button type="primary" @click="saveData()" >保存数据</el-button> </el-form>
<el-dialog append-to-body title="颜色信息" :close-on-click-modal="false" v-drag :visible.sync="colorFlag" width="600px"> <el-form :inline="true" label-position="top" style="margin-left: 7px;margin-top: -5px;"> <el-form-item :label="'色序'"> <el-input v-model="colorData.order" type="number" style="width: 130px" onkeyup="value=value.replace(/^(0+)|[^\d]+/g,'')" ></el-input> </el-form-item> <el-form-item :label="'序号'"> <el-input v-model="colorData.seqNo" type="number" style="width: 130px" onkeyup="value=value.replace(/^(0+)|[^\d]+/g,'')" ></el-input> </el-form-item> <el-form-item :label="'Ink'"> <el-input v-model="colorData.ink" style="width: 130px" ></el-input> </el-form-item> <el-form-item :label="'Type'"> <el-input v-model="colorData.type" style="width: 130px" ></el-input> </el-form-item> </el-form> <el-form :inline="true" label-position="top" style="margin-left: 7px;margin-top: -5px;"> <el-form-item :label="'%G'"> <el-input v-model="colorData.otherRef" style="width: 130px" ></el-input> </el-form-item> </el-form> <el-footer style="height:40px;margin-top: 10px;text-align:center"> <el-button type="primary" @click="colorSave()">保存</el-button> <el-button type="primary" @click="colorFlag = false">取消</el-button> </el-footer> </el-dialog>
<Chooselist ref="baseList" @getBaseData="getBaseData"></Chooselist> </div></template>
<script> import { searchBMPrintOtherDetail, updateBMPrintOtherDetail, searchBMPrintOtherColor, saveBMPrintOtherColor, deleteBMPrintOtherColor, } from "@/api/sampleManagement/technicalSpecificationList.js" import Chooselist from '@/views/modules/common/Chooselist' export default { components: { Chooselist }, data() { return { searchData: { site: '', username: this.$store.state.user.name, codeNo: '', buNo:'', }, ifDisableFlag:false, dataForm:{ site: '', codeNo:'', plateNo:'', cutterNumber:'', cutterLayout:'', action:'', feedback:'', remark:'',
}, colorTable:[], colorData:{ id:'', site: '', codeNo:'', order:'', seqNo:'', ink:'', type:'', otherRef:'', }, colorFlag:false, } }, methods: { // 获取基础数据列表S
getBaseList (val, type) { this.tagNo = val this.tagNo1 = type this.$nextTick(() => { let strVal = '' if (val === 1013) { if(type==1) { strVal = this.dataForm.partType } } this.$refs.baseList.init(val, strVal) }) }, /* 列表方法的回调 */ getBaseData (val) { if (this.tagNo === 1013) { if(this.tagNo1==1) { this.dataForm.partType = val.Base_id this.dataForm.partTypeDesc = val.Base_desc } } }, //初始化组件的参数
init(inData) { if(this.dataForm.codeNo!=null&&this.dataForm.codeNo!=''){ return false; } //初始化参数
this.searchData = JSON.parse(JSON.stringify(inData)); if(this.searchData.ifDisableFlag){ this.ifDisableFlag=true } //刷新表格
this.searchTable(); this.colorSearch();
}, searchTable(){ searchBMPrintOtherDetail(this.searchData).then(({data}) => { if(data.rows.length>0){ this.dataForm = data.rows[0]; }else { this.dataForm.site=this.searchData.site this.dataForm.codeNo=this.searchData.codeNo } }); }, saveData(){ this.$confirm("是否保存信息?", '保存提示', { confirmButtonText: '确定', cancelButtonText: '取消', }).then(() => { updateBMPrintOtherDetail(this.dataForm).then(({data}) => { if (data && data.code === 0) { this.$message.success( '操作成功') this.$emit("closeModel") } else { this.$message.error(data.msg) } }) }).catch(() => { return }) },
newColor(){ if(this.searchData.codeNo==''){ this.$message.success('数据错误,请关闭页面重试!') return false; } let number=1; for (let i = 0; i <this.colorTable.length ; i++) { if(number<=this.colorTable[i].order){ number=Number(this.colorTable[i].order)+1 } } this.colorData={ id:0, site: this.searchData.site, codeNo:this.searchData.codeNo, order:number, color:'', meshModel:'', meshSize:'', angle:'', coatingType:'', filmNo:'', stencilNo:'', updateBy:'', updateDate:'', } this.colorFlag=true; }, updateColor(row){ this.colorData=JSON.parse(JSON.stringify(row)) this.colorFlag=true; },
colorSearch(type){ searchBMPrintOtherColor(this.searchData).then(({data}) => { if(type){ this.$message.success( '操作成功') } this.colorTable = data.rows }); }, colorSave(){ this.$confirm("是否保存信息?", '保存提示', { confirmButtonText: '确定', cancelButtonText: '取消', }).then(() => { saveBMPrintOtherColor(this.colorData).then(({data}) => { if (data && data.code === 0) { this.colorSearch(); this.colorFlag=false this.$message.success( '操作成功')
} else { this.$message.error(data.msg) } }) }).catch(() => {
}) }, deleteColor(row){ this.$confirm(`是否删除这条信息?`, '提示', { confirmButtonText: '确定', cancelButtonText: '取消', type: 'warning' }).then(() => { deleteBMPrintOtherColor(row).then(({data}) => { if (data && data.code === 0) { this.colorSearch(); this.$message({ message: '操作成功', type: 'success', duration: 1500, onClose: () => {} }) } else { this.$alert(data.msg, '错误', { confirmButtonText: '确定' }) } }) }).catch(() => { }) },
}, }</script>
<style scoped>
</style>
|