<template>
|
<div class="choose height overflow">
|
<div class="width overflow height92">
|
<div class="chose-height">
|
<div class="flex margintopbot justify-between">
|
<div class="width50 flex align-center">
|
<label class="width40 textalign">零件编号:</label>
|
<el-input size="mini"
|
clearable
|
v-model="iqnuer.itemName"
|
class="width60"> </el-input>
|
</div>
|
<div class="width50 flex align-center">
|
<label class="width40 textalign">零件名称:</label>
|
<el-input size="mini"
|
clearable
|
v-model="iqnuer.itemDes"
|
class="width60"> </el-input>
|
</div>
|
<el-button type="primary"
|
size="mini"
|
@click="itemSearch">查询</el-button>
|
</div>
|
<div class="flex width justify-between"></div>
|
</div>
|
<div class="width chose-tebleheight margin-top2 overflow">
|
<table-container height="91%"
|
:wipelist="wipelist"
|
:tableHead="tableHead"
|
:tableData="tableData"
|
:operation="false"
|
:currentPage="page"
|
:pageSize="pageSize"
|
:totle="totle"
|
:setshow="false"
|
:delShow="true"
|
:selectionShow="true"
|
@del="del"
|
@handleSelectionChange="handleSelectionChange"
|
@CurrentChange="CurrentChange" />
|
</div>
|
</div>
|
<div class="choose-button text-right margin-right15 margin-top2">
|
<el-button type="primary"
|
size="mini"
|
class="form-buttom"
|
@click="submitForm">确认选择</el-button>
|
<el-button type="primary"
|
size="mini"
|
class="form-buttom"
|
@click="$emit('cancel')">取消</el-button>
|
</div>
|
</div>
|
</template>
|
|
<script>
|
import { TableContainer, Modal } from '@/components/index';
|
import { itemSearch, ItemDelete } from '@/api/enterchoose';
|
const { edterchoose } = require('@/components/tableContainer/tableHead');
|
export default {
|
data () {
|
return {
|
iqnuer: {},
|
inOrderCodelist: [
|
{
|
label: '无',
|
value: ''
|
}
|
],
|
tableData: [],
|
handlelist: [], //勾选数据
|
totle: 0,
|
page: 1,
|
pageSize: 20
|
};
|
},
|
props: {
|
wipelist: {
|
type: Array,
|
default: () => []
|
},
|
inOrderCodeShow: {
|
type: Boolean,
|
default: true
|
},
|
choice: {
|
type: Boolean,
|
default: true
|
}
|
},
|
components: { TableContainer },
|
computed: {
|
tableHead () {
|
return edterchoose;
|
}
|
},
|
mounted () {
|
this.itemSearch();
|
},
|
methods: {
|
//查询
|
itemSearch () {
|
itemSearch(this.page + '&onePageNum=' + this.pageSize, this.iqnuer).then(res => {
|
if (res.code == 0) {
|
let data = res.data;
|
data.forEach(item => {
|
item.image = process.env.IMAGE_URL + item.image;
|
});
|
this.tableData = data;
|
this.totle = res.num;
|
}
|
});
|
},
|
CurrentChange (e) {
|
this.page = e;
|
this.itemSearch();
|
},
|
//勾选
|
handleSelectionChange (e) {
|
console.log(e);
|
this.handlelist = e;
|
},
|
submitForm () {
|
if (this.choice) {
|
if (this.handlelist.length == 1) {
|
this.$emit('chooseClick', this.handlelist, this.iqnuer.inOrderCode);
|
} else if (this.handlelist.length == 0) {
|
this.$message({
|
type: 'warning',
|
message: '请勾选一条数据'
|
});
|
} else if (this.handlelist.length > 1) {
|
this.$message({
|
type: 'warning',
|
message: '只能勾选一条数据'
|
});
|
}
|
} else {
|
this.$emit('chooseClick', this.handlelist, this.iqnuer.inOrderCode);
|
}
|
},
|
//删除
|
del (row) {
|
this.$confirm('此操作将永久删除该数据, 是否继续?', '提示', {
|
confirmButtonText: '确定',
|
cancelButtonText: '取消',
|
type: 'warning'
|
})
|
.then(() => {
|
const { itemName } = { ...row };
|
ItemDelete({ itemName }).then(res => {
|
if (res.code == 0) {
|
this.$message({
|
type: 'success',
|
message: '删除成功'
|
});
|
this.itemSearch();
|
} else {
|
this.$message({
|
type: 'warning',
|
message: '删除失败'
|
});
|
}
|
});
|
})
|
.catch(() => {
|
this.$message({
|
type: 'info',
|
message: '已取消删除'
|
});
|
});
|
}
|
},
|
watch: {}
|
};
|
</script>
|
|
<style lang="scss" scoped>
|
.choose {
|
width: 98%;
|
padding: 1%;
|
.chose-height {
|
height: 40px;
|
}
|
.chose-tebleheight {
|
height: calc(100% - 60px);
|
}
|
.show-pwd {
|
position: absolute;
|
right: 10px;
|
top: 3px;
|
font-size: 16px;
|
color: #889aa4;
|
cursor: pointer;
|
user-select: none;
|
}
|
.centent-form {
|
height: 92%;
|
width: 100%;
|
margin: auto;
|
}
|
.choose-button {
|
}
|
::v-deep .el-form-item__content {
|
width: 60%;
|
}
|
::v-deep .el-select {
|
// width: 100%;
|
}
|
}
|
</style>
|