<template>
|
<el-main class="contbox" ref="contBox">
|
<div class="head" ref="headBox">
|
<BaseSearch
|
@getList="getList"
|
:formItemList="searchFormSchema"
|
@search="getList"
|
@showSearchChange="getElHeight(28)"
|
>
|
<template #actionButton>
|
<el-col :span="1.5">
|
<el-button
|
type="primary"
|
plain
|
icon="el-icon-plus"
|
size="mini"
|
@click="handleAdd"
|
v-hasPermi="['iqc_checkItem_create']"
|
>新增</el-button
|
>
|
</el-col>
|
<el-col :span="1.5">
|
<el-button
|
type="success"
|
plain
|
icon="el-icon-edit"
|
size="mini"
|
@click="handleUpdate"
|
v-hasPermi="['iqc_checkItem_edit']"
|
>修改</el-button
|
>
|
</el-col>
|
<el-col :span="1.5">
|
<el-button
|
type="danger"
|
plain
|
icon="el-icon-delete"
|
size="mini"
|
@click="handleDelete"
|
v-hasPermi="['iqc_checkItem_delete']"
|
>删除</el-button
|
>
|
</el-col>
|
</template>
|
</BaseSearch>
|
</div>
|
<TableCom
|
:column="tabiInfo.columns"
|
:table-data="tabiInfo.tableData"
|
:table-loading="tabiInfo.tableLoading"
|
:isSelection="tabiInfo.isSelection"
|
:height="elementHeight"
|
rowKey="warehouseId"
|
ref="tabel"
|
@checkData="checkData"
|
@checkLook="checkInfo"
|
>
|
<template slot="checkType" slot-scope="scope">
|
<dict-tag
|
:options="dict.type.check_type"
|
:value="scope.row.checkType"
|
/>
|
</template>
|
<template slot="isAutoCheck" slot-scope="scope">
|
<dict-tag
|
:options="dict.type.is_auto_check"
|
:value="scope.row.isAutoCheck"
|
/>
|
</template>
|
<template slot="isRequired" slot-scope="scope">
|
<dict-tag
|
:options="dict.type.is_required"
|
:value="scope.row.isRequired"
|
/>
|
</template>
|
<template slot="isToSpc" slot-scope="scope">
|
<dict-tag :options="dict.type.is_to_spc" :value="scope.row.isToSpc" />
|
</template>
|
<template slot="status" slot-scope="scope">
|
<dict-tag :options="dict.type.status" :value="scope.row.status" />
|
</template>
|
</TableCom>
|
<div class="pagination" ref="pagination">
|
<pagination
|
v-show="pageInfo.pageTotal > 0"
|
:total="pageInfo.pageTotal"
|
:page.sync="pageInfo.currentPage"
|
:limit.sync="pageInfo.pageSize"
|
@pagination="getList"
|
/>
|
</div>
|
<AddaddModal ref="addaddModal" @getList="getList" />
|
</el-main>
|
</template>
|
|
<script>
|
import TableCom from "@/components/Table/index";
|
import BaseSearch from "@/components/Table/BaseSearch";
|
|
import { columns, searchFormSchema } from "./info.data";
|
import mixin from "@/components/Table/mixins/resize";
|
import { listWarehouse, delWarehouse } from "@/api/basicData/warehouse";
|
import AddaddModal from "./addModal";
|
|
export default {
|
name: "Warehouse",
|
components: { TableCom, BaseSearch, AddaddModal },
|
mixins: [mixin],
|
dicts: ["check_type", "is_auto_check", "is_required", "is_to_spc", "status"],
|
data() {
|
return {
|
searchFormSchema: searchFormSchema,
|
tabiInfo: {
|
columns: columns,
|
tableData: [],
|
tableLoading: false,
|
isSelection: true,
|
rowClassName: "rowClassName",
|
},
|
pageInfo: {
|
pageSize: 10,
|
pageTotal: 0,
|
currentPage: 1,
|
},
|
visible: false,
|
ids: [],
|
open: false,
|
};
|
},
|
mounted() {
|
this.getList();
|
},
|
methods: {
|
getList(info = {}) {
|
this.ids = [];
|
this.tabiInfo.tableLoading = true;
|
let params = {
|
pageSize: this.pageInfo.pageSize,
|
pageNum: this.pageInfo.currentPage,
|
bizType: 10,
|
...info,
|
};
|
listWarehouse(params).then((res) => {
|
if (res.code == 200) {
|
this.pageInfo.pageTotal = res.total;
|
this.tabiInfo.tableData = res.rows;
|
this.tabiInfo.tableLoading = false;
|
}
|
});
|
},
|
checkData(data) {
|
if (data.length) {
|
this.ids = data.map((item) => {
|
return item.warehouseId;
|
});
|
} else {
|
this.ids = [];
|
}
|
},
|
handleAdd() {
|
this.$refs.addaddModal.elDialogShow(1);
|
},
|
checkInfo(info) {
|
this.$refs.addaddModal.elDialogShow(3, info.warehouseId);
|
},
|
/** 修改按钮操作 */
|
handleUpdate() {
|
if (this.ids.length > 1) {
|
this.$message({
|
message: "只能操作单条数据!",
|
type: "warning",
|
});
|
return;
|
} else if (this.ids.length < 1) {
|
this.$message({
|
message: "请选择数据",
|
type: "warning",
|
});
|
return;
|
}
|
this.$refs.addaddModal.elDialogShow(2, this.ids[0]);
|
},
|
handleDelete() {
|
const warehouseIds = this.ids;
|
|
if (warehouseIds.length) {
|
this.$modal
|
.confirm(
|
'是否确认删除已选中的数据项?'
|
)
|
.then(() => {
|
this.tabiInfo.tableLoading = true;
|
return delWarehouse(warehouseIds);
|
})
|
.then(() => {
|
this.tabiInfo.tableLoading = false;
|
this.ids = [];
|
this.getList();
|
this.$message({
|
message: "删除成功",
|
type: "success",
|
});
|
})
|
.catch(() => {})
|
.finally(() => {
|
this.tabiInfo.tableLoading = false;
|
});
|
} else {
|
this.$message({
|
message: "请选择数据",
|
type: "warning",
|
});
|
}
|
},
|
},
|
};
|
</script>
|
|
<style lang="less" scoped>
|
.rowClassName {
|
height: 50px;
|
}
|
.contbox {
|
width: 100;
|
height: 100%;
|
}
|
</style>
|