plm前端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

353 lines
10 KiB

<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="cutSearch(true)" >刷新</el-button>
<el-button type="primary" @click="newCut()" v-if="!ifDisableFlag">新增</el-button>
</el-form-item>
<el-table
height="200"
:data="cutTable"
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="updateCut(scope.row)">编辑</a>
<a type="text" size="small" @click="deleteCut(scope.row)">删除</a>
</template>
</el-table-column>
<el-table-column
v-for="(item,index) in columnList" :key="index"
:prop="item.columnProp"
header-align="center"
:align="item.align"
:min-width="item.columnWidth"
:label="item.columnLabel">
</el-table-column>
</el-table>
<el-row :gutter="20" >
<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">
<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="cutFlag" width="600px">
<el-form :inline="true" label-position="top" style="margin-left: 7px;margin-top: -5px;">
<el-form-item :label="'次序'">
<el-input v-model="cutData.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="cutData.cuttingMachine" style="width: 130px" ></el-input>
</el-form-item>
<el-form-item :label="'程序名称和路径'">
<el-input v-model="cutData.programName" style="width: 130px" ></el-input>
</el-form-item>
<el-form-item :label="'刀的进给速度及转速'">
<el-input v-model="cutData.cuttingSpeed" 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="'刀模参数'">
<el-input v-model="cutData.spec" style="width: 130px" ></el-input>
</el-form-item>
<el-form-item :label="'P2P公差'">
<el-input v-model="cutData.p2c" style="width: 130px" ></el-input>
</el-form-item>
<el-form-item :label="'C2C公差'" >
<el-input v-model="cutData.c2c" 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="'备注'">
<el-input v-model="cutData.remarks" style="width: 570px" ></el-input>
</el-form-item>
</el-form>
<el-footer style="height:40px;margin-top: 10px;text-align:center">
<el-button type="primary" @click="cutSave()">保存</el-button>
<el-button type="primary" @click="cutFlag = false">取消</el-button>
</el-footer>
</el-dialog>
<Chooselist ref="baseList" @getBaseData="getBaseData"></Chooselist>
</div>
</template>
<script>
import {
searchBMCncDetail,
updateBMCncDetail,
searchBMCncCut,
saveBMCncCut,
deleteBMCncCut,
} 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:'',
action:'',
},
cutTable:[],
cutData:{
id:'',
site: '',
codeNo:'',
order:'',
cuttingMachine:'',
programName:'',
cuttingSpeed:'',
spec:'',
p2c:'',
c2c:'',
remarks:'',
updateBy:'',
updateDate:'',
},
columnList:[
{
columnProp: "order",
align: "right",
columnLabel: "次序",
columnWidth: 30
},
{
columnProp: "cuttingMachine",
align: "left",
columnLabel: "机器类别",
columnWidth: 60
},
{
columnProp: "programName",
align: "left",
columnLabel: "程序名称和路径",
columnWidth: 60
},
{
columnProp: "cuttingSpeed",
align: "left",
columnLabel: "刀的进给速度及转速",
columnWidth: 60
},
{
columnProp: "spec",
align: "left",
columnLabel: "刀模参数",
columnWidth: 60
},
{
columnProp: "p2c",
align: "left",
columnLabel: "P2P公差",
columnWidth: 60
},
{
columnProp: "c2c",
align: "left",
columnLabel: "C2C公差",
columnWidth: 60
},
{
columnProp: "remarks",
align: "left",
columnLabel: "备注",
columnWidth: 60
},
],
cutFlag: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.cutSearch();
},
searchTable(type){
searchBMCncDetail(this.searchData).then(({data}) => {
if(data.rows.length>0){
this.dataForm = data.rows[0];
if(type){
this.$message.success( '操作成功')
}
}else {
this.dataForm.site=this.searchData.site
this.dataForm.codeNo=this.searchData.codeNo
}
});
},
saveData(){
this.$confirm("是否保存信息?", '保存提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
}).then(() => {
updateBMCncDetail(this.dataForm).then(({data}) => {
if (data && data.code === 0) {
this.$message.success( '操作成功')
} else {
this.$message.error(data.msg)
}
})
}).catch(() => {
return
})
},
newCut(){
if(this.searchData.codeNo==''){
this.$message.success('数据错误,请关闭页面重试!')
return false;
}
let number=1;
for (let i = 0; i <this.cutTable.length ; i++) {
if(number<=this.cutTable[i].order){
number=Number(this.cutTable[i].order)+1
}
}
this.cutData={
id:0,
site: this.searchData.site,
codeNo:this.searchData.codeNo,
order:number,
cuttingMachine:'',
programName:'',
cuttingSpeed:'',
spec:'',
p2c:'',
c2c:'',
remarks:'',
updateBy:'',
updateDate:'',
}
this.cutFlag=true;
},
updateCut(row){
this.cutData=JSON.parse(JSON.stringify(row))
this.cutFlag=true;
},
cutSearch(){
searchBMCncCut(this.searchData).then(({data}) => {
this.cutTable = data.rows
});
},
cutSave(){
this.$confirm("是否保存信息?", '保存提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
}).then(() => {
saveBMCncCut(this.cutData).then(({data}) => {
if (data && data.code === 0) {
this.cutSearch();
this.cutFlag=false
this.$message.success( '操作成功')
} else {
this.$message.error(data.msg)
}
})
}).catch(() => {
})
},
deleteCut(row){
this.$confirm(`是否删除这条信息?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
deleteBMCncCut(row).then(({data}) => {
if (data && data.code === 0) {
this.cutSearch();
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {}
})
} else {
this.$alert(data.msg, '错误', {
confirmButtonText: '确定'
})
}
})
}).catch(() => {
})
},
},
}
</script>
<style scoped>
</style>