406 lines
14 KiB
Vue
406 lines
14 KiB
Vue
<template>
|
|
<div class="app-container">
|
|
<el-card>
|
|
<el-input v-model="ManufacturerName" clearable placeholder="外协厂家名称" size="small" style="width:200px;margin: 10px 0 3px 0;" @keyup.enter.native="pageCurrent=1;pageSize=50;searchTable()" @clear="pageCurrent=1;pageSize=50;searchTable()"/>
|
|
<el-button type="primary" size="small" icon="el-icon-search" style="margin-left:20px" plain @click="pageCurrent=1;pageSize=50;searchTable()">查询</el-button>
|
|
<el-tooltip :open-delay="1200" effect="dark" content="新增外协厂家" placement="top">
|
|
<el-button type="distribution" icon="el-icon-circle-plus-outline" style="margin-left: 10px" size="small" @click="editType1('form');param = 0">外协厂家</el-button>
|
|
</el-tooltip>
|
|
<el-table v-loading="loading0" :data="tableData" height="550" style="width: 100%;" border>
|
|
<el-table-column label="序号" align="center" type="index" width="50"/>
|
|
<el-table-column label="外协厂家名称" align="center" width="280px">
|
|
<template slot-scope="scope">
|
|
{{ scope.row.外协厂家名称 }}
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column label="外协厂家简称" align="center" width="110px">
|
|
<template slot-scope="scope">
|
|
{{ scope.row.外协厂家简称 }}
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column label="地址" align="center" min-width="120px">
|
|
<template slot-scope="scope">
|
|
{{ scope.row.地址 }}
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column label="联系人" align="center" width="90px">
|
|
<template slot-scope="scope">
|
|
{{ scope.row.联系人 }}
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column label="电话" align="center" width="130px">
|
|
<template slot-scope="scope">
|
|
{{ scope.row.电话 }}
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column label="备注" align="center">
|
|
<template slot-scope="scope">
|
|
{{ scope.row.备注 }}
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column label="操作" align="center" width="100px" fixed="right">
|
|
<template slot-scope="scope">
|
|
<el-button size="mini" type="text" plain class="el-icon-edit" @click="handleChange1(scope.$index, scope.row, 'form');param = 1"/>
|
|
<el-button size="mini" type="text" plain class="el-icon-delete" @click="handleDelete(scope.$index, scope.row, 'form')"/>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table>
|
|
<div class="block">
|
|
<el-pagination
|
|
v-if="!loading0"
|
|
:current-page="pageCurrent"
|
|
:page-sizes="[50, 100]"
|
|
:page-size="pageSize"
|
|
:total="total"
|
|
layout="total, sizes, prev, pager, next, jumper"
|
|
@size-change="handleSizeChange"
|
|
@current-change="handleCurrentChange"/>
|
|
</div>
|
|
</el-card>
|
|
<el-dialog v-el-drag-dialog :visible.sync="dialogFormVisible" :title="title1" center style="min-height: 300px" width="700px">
|
|
<el-form ref="form" :model="form" :rules="rules" label-position="left" label-width="90px" class="demo-ruleForm">
|
|
<el-row>
|
|
<el-col :span="12">
|
|
<el-form-item label="厂家名称" prop="ManufacturerName" >
|
|
<el-input v-model="form.ManufacturerName" placeholder="厂家名称" clearable size="small"/>
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="12">
|
|
<el-form-item label="厂家简称" prop="ManufacturerAbbreviation">
|
|
<el-input v-model="form.ManufacturerAbbreviation" placeholder="厂家简称" clearable size="small" />
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
<el-row>
|
|
<el-col :span="12">
|
|
<el-form-item label="地址" prop="address">
|
|
<el-input v-model="form.address" placeholder="地址" clearable size="small" />
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="12">
|
|
<el-form-item label="联系人" prop="roleName">
|
|
<el-input v-model="form.roleName" placeholder="联系人" clearable size="small"/>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
<el-row>
|
|
<el-col :span="12">
|
|
<el-form-item label="电话" prop="phNumber">
|
|
<el-input v-model="form.phNumber" placeholder="电话" clearable size="small"/>
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="12">
|
|
<el-form-item label="备注" prop="Remarks">
|
|
<el-input v-model="form.Remarks" placeholder="备注" clearable size="small" />
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
<el-row v-show="false">
|
|
<el-col :span="12">
|
|
<el-form-item label="设备情况" prop="EquipmentCondition">
|
|
<el-input v-model="form.EquipmentCondition" placeholder="设备情况" clearable size="small"/>
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="12">
|
|
<el-form-item label="银行" prop="Fax">
|
|
<el-input v-model="form.Fax" placeholder="银行" clearable size="small"/>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
</el-form>
|
|
<div slot="footer" class="dialog-footer">
|
|
<el-button @click="callOff('form')">取消</el-button>
|
|
<el-button v-positive="'loading'" :disabled="false" type="primary" @click="submit('form')" >确定</el-button>
|
|
</div>
|
|
</el-dialog>
|
|
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import { searchtable, edittype, handlechange, handledelete } from '@/api/Outsourcing/OutFactoryMaintenance'
|
|
export default {
|
|
data() {
|
|
return {
|
|
editType1_disable: false,
|
|
loading0: false,
|
|
count1: 0,
|
|
count2: 0, // 清表单验证计数器
|
|
ManufacturerNumber: '', // 厂家序号
|
|
num1: '',
|
|
ManufacturerName: '', // 厂家名称
|
|
num2: '',
|
|
address: '', // 地址
|
|
num3: '',
|
|
roleName: '', // 联系人
|
|
num4: '',
|
|
phNumber: '', // 电话
|
|
num5: '',
|
|
Fax: '', // 传真
|
|
num6: '',
|
|
Remarks: '', // 备注
|
|
num7: '',
|
|
category: '', // 类别
|
|
num8: '',
|
|
EquipmentCondition: '', // 设备情况
|
|
num9: '',
|
|
ManufacturerAbbreviation: '', // 厂家简称
|
|
num10: '',
|
|
attention: '', // 关注
|
|
num11: '',
|
|
tableData: [], // 表格数据
|
|
pageSize: 50,
|
|
pageCurrent: 1,
|
|
total: 0,
|
|
CoManufacturerFlowNumber: '', // 外协厂家流水号
|
|
CoManufacturerFlowNumber1: '',
|
|
dialogFormVisible: false,
|
|
title1: '',
|
|
form: {
|
|
ManufacturerNumber: '', // 厂家序号
|
|
ManufacturerName: '', // 厂家名称
|
|
address: '', // 地址
|
|
roleName: '', // 联系人
|
|
phNumber: '', // 电话
|
|
Fax: '', // 传真
|
|
Remarks: '', // 备注
|
|
category: '', // 类别
|
|
EquipmentCondition: '', // 设备情况
|
|
ManufacturerAbbreviation: '', // 厂家简称
|
|
attention: '' // 关注
|
|
},
|
|
rules: {
|
|
ManufacturerName: [{ required: true, message: '请输入厂家名称', trigger: 'blur' }],
|
|
ManufacturerAbbreviation: [{ required: true, message: '请输入厂家简称', trigger: 'blur' }]
|
|
}
|
|
}
|
|
},
|
|
created() {
|
|
this.searchTable()
|
|
},
|
|
methods: {
|
|
// 查询
|
|
searchTable() {
|
|
this.loading0 = true
|
|
if (this.ManufacturerNumber !== '' && this.ManufacturerNumber !== null) {
|
|
this.num1 = 1
|
|
} else {
|
|
this.num1 = 0
|
|
this.ManufacturerNumber = ''
|
|
}
|
|
if (this.ManufacturerName !== '' && this.ManufacturerName !== null) {
|
|
this.num2 = 1
|
|
} else {
|
|
this.num2 = 0
|
|
this.ManufacturerName = ''
|
|
}
|
|
if (this.ManufacturerAbbreviation !== '' && this.ManufacturerAbbreviation !== null) {
|
|
this.num10 = 1
|
|
} else {
|
|
this.num10 = 0
|
|
this.ManufacturerAbbreviation = ''
|
|
}
|
|
if (this.address !== '' && this.address !== null) {
|
|
this.num3 = 1
|
|
} else {
|
|
this.num3 = 0
|
|
this.address = ''
|
|
}
|
|
if (this.roleName !== '' && this.roleName !== null) {
|
|
this.num4 = 1
|
|
} else {
|
|
this.num4 = 0
|
|
this.roleName = ''
|
|
}
|
|
if (this.phNumber !== '' && this.phNumber !== null) {
|
|
this.num5 = 1
|
|
} else {
|
|
this.num5 = 0
|
|
this.phNumber = ''
|
|
}
|
|
if (this.Fax !== '' && this.Fax !== null) {
|
|
this.num6 = 1
|
|
} else {
|
|
this.num6 = 0
|
|
this.Fax = ''
|
|
}
|
|
if (this.Remarks !== '' && this.Remarks !== null) {
|
|
this.num7 = 1
|
|
} else {
|
|
this.num7 = 0
|
|
this.Remarks = ''
|
|
}
|
|
if (this.category !== '' && this.category !== null) {
|
|
this.num8 = 1
|
|
} else {
|
|
this.num8 = 0
|
|
this.category = ''
|
|
}
|
|
if (this.attention !== '' && this.attention !== null) {
|
|
this.num11 = 1
|
|
} else {
|
|
this.num11 = 0
|
|
this.attention = ''
|
|
}
|
|
if (this.EquipmentCondition !== '' && this.EquipmentCondition !== null) {
|
|
this.num9 = 1
|
|
} else {
|
|
this.num9 = 0
|
|
this.EquipmentCondition = ''
|
|
}
|
|
searchtable(this.pageCurrent, this.pageSize, this.num1, this.ManufacturerNumber, this.num2, this.ManufacturerName, this.num10, this.ManufacturerAbbreviation, this.num3, this.address, this.num4, this.roleName, this.num5, this.phNumber, this.num6, this.Fax, this.num7, this.Remarks, this.num8, this.category, this.num11, this.attention, this.num9, this.EquipmentCondition).then(response => {
|
|
this.tableData = response.data.rows
|
|
this.total = response.data.total
|
|
this.loading0 = false
|
|
})
|
|
},
|
|
// 点击增加
|
|
editType1(formName) {
|
|
this.count1 = this.count1 + 1
|
|
if (this.count1 !== 1) {
|
|
this.$refs[formName].resetFields()
|
|
}
|
|
this.title1 = '新增外协厂家'
|
|
this.form.ManufacturerName = ''
|
|
this.form.ManufacturerNumber = ''
|
|
this.form.address = ''
|
|
this.form.roleName = ''
|
|
this.form.phNumber = ''
|
|
this.form.Fax = ''
|
|
this.form.Remarks = ''
|
|
this.form.category = ''
|
|
this.form.EquipmentCondition = ''
|
|
this.form.ManufacturerAbbreviation = ''
|
|
this.form.attention = ''
|
|
this.editType1_disable = false
|
|
this.dialogFormVisible = true
|
|
},
|
|
// 增加确定
|
|
editType() {
|
|
this.editType1_disable = true
|
|
edittype(this.form.ManufacturerNumber, this.form.ManufacturerName, this.form.ManufacturerAbbreviation, this.form.address, this.form.roleName, this.form.phNumber, this.form.Fax, this.form.Remarks, this.form.category, this.form.attention, this.form.EquipmentCondition).then(response => {
|
|
if (response.data[0].result === '1') {
|
|
this.$notify({
|
|
title: '成功',
|
|
message: '信息增加成功',
|
|
type: 'success'
|
|
})
|
|
this.pageCurrent = 1
|
|
this.pageSize = 50
|
|
this.searchTable()
|
|
} else {
|
|
this.editType1_disable = false
|
|
this.$message.error('信息增加失败')
|
|
}
|
|
})
|
|
this.dialogFormVisible = false
|
|
},
|
|
// 编辑打开
|
|
handleChange1(index, row, formName) {
|
|
this.count2 = this.count2 + 1
|
|
if (this.count2 !== 1) {
|
|
this.$refs[formName].resetFields()
|
|
}
|
|
this.form.ManufacturerNumber = row.序号
|
|
this.form.ManufacturerName = row.外协厂家名称
|
|
this.form.address = row.地址
|
|
this.form.roleName = row.联系人
|
|
this.form.phNumber = row.电话
|
|
this.form.Fax = row.银行
|
|
this.form.Remarks = row.备注
|
|
this.form.category = row.类别
|
|
this.form.EquipmentCondition = row.设备情况
|
|
this.form.ManufacturerAbbreviation = row.外协厂家简称
|
|
this.form.attention = row.关注
|
|
this.title1 = '编辑外协厂家'
|
|
this.CoManufacturerFlowNumber1 = row.外协厂家流水号
|
|
this.editType1_disable = false
|
|
this.dialogFormVisible = true
|
|
},
|
|
// 编辑确定
|
|
handleChange() {
|
|
this.editType1_disable = true
|
|
handlechange(this.CoManufacturerFlowNumber1, this.form.ManufacturerNumber, this.form.ManufacturerName, this.form.ManufacturerAbbreviation, this.form.address, this.form.roleName, this.form.phNumber, this.form.Fax, this.form.Remarks, this.form.category, this.form.attention, this.form.EquipmentCondition).then(response => {
|
|
if (response.data[0].result === '1') {
|
|
this.$notify({
|
|
title: '成功',
|
|
message: '信息修改成功',
|
|
type: 'success'
|
|
})
|
|
this.searchTable()
|
|
} else {
|
|
this.editType1_disable = false
|
|
this.$message.error('信息修改失败')
|
|
}
|
|
})
|
|
this.dialogFormVisible = false
|
|
},
|
|
// 提交添加或者修改
|
|
submit(formName) {
|
|
this.$refs[formName].validate((valid) => {
|
|
if (valid) {
|
|
if (this.param === 0) {
|
|
this.editType()
|
|
} else {
|
|
this.handleChange()
|
|
}
|
|
} else {
|
|
return false
|
|
}
|
|
})
|
|
},
|
|
// 重置表单
|
|
callOff(formName) {
|
|
this.dialogFormVisible = false
|
|
this.$refs[formName].resetFields()
|
|
},
|
|
// 删除
|
|
handleDelete(index, row) {
|
|
this.$confirm('此操作将永久删除该行, 是否继续?', '提示', {
|
|
confirmButtonText: '确定',
|
|
cancelButtonText: '取消',
|
|
type: 'warning'
|
|
}).then(() => {
|
|
handledelete(row.外协厂家流水号).then(response => {
|
|
if (response.data[0].result === '1') {
|
|
this.$notify({
|
|
title: '成功',
|
|
message: '信息删除成功',
|
|
type: 'success'
|
|
})
|
|
this.searchTable()
|
|
} else {
|
|
this.$message.error('信息删除失败')
|
|
}
|
|
})
|
|
}).catch(() => {
|
|
this.$message({
|
|
type: 'info',
|
|
message: '已取消删除'
|
|
})
|
|
})
|
|
},
|
|
// 分页
|
|
handleSizeChange(val) {
|
|
this.pageCurrent = 1
|
|
this.pageSize = val
|
|
this.searchTable()
|
|
},
|
|
handleCurrentChange(val) {
|
|
this.pageCurrent = val
|
|
this.searchTable()
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style scoped>
|
|
.el-input{
|
|
width: 210px;
|
|
}
|
|
.el-card{
|
|
margin: 0px;
|
|
}
|
|
</style>
|
|
|