319 lines
9.9 KiB
Vue
319 lines
9.9 KiB
Vue
<!--
|
|
* @Author: zhp
|
|
* @Date: 2023-06-19 15:52:51
|
|
* @LastEditTime: 2023-07-17 10:31:16
|
|
* @LastEditors: zhp
|
|
* @Description:
|
|
-->
|
|
<template>
|
|
<el-card shadow="never" class="aui-card--fill">
|
|
<div class="mod-sys__user">
|
|
<SearchBar :formConfigs="formConfig" ref="ruleForm" @headBtnClick="buttonClick">
|
|
<el-badge :value="1" class="item">
|
|
<el-button type="primary" size="small" @click="conditionSearch">条件搜索</el-button>
|
|
</el-badge>
|
|
</SearchBar>
|
|
<base-table id="palletTable" :table-props="tableProps" :page="listQuery.page" ref="palletTable1"
|
|
highlight-current-row :limit="listQuery.limit" :table-data="tableData" @current-change="handleCurrentChange">
|
|
<method-btn v-if="tableBtn.length" slot="handleBtn" :width="100" label="操作" :method-list="tableBtn"
|
|
@clickBtn="handleClick" />
|
|
</base-table>
|
|
<pagination :limit.sync="listQuery.limit" :page.sync="listQuery.page" :total="listQuery.total"
|
|
@pagination="getDataList" />
|
|
<!-- 弹窗, 新增 / 修改 -->
|
|
<base-dialog width="70%" :dialogTitle="addOrEditTitle" :dialogVisible="addOrUpdateVisible" @cancel="handleCancel"
|
|
@confirm="handleConfirm" :before-close="handleCancel">
|
|
<deliveryInspection-add ref="addOrUpdate" @successSubmit="successSubmit">
|
|
</deliveryInspection-add>
|
|
<!-- <el-row slot="footer" type="flex" justify="end"> </el-row> -->
|
|
</base-dialog>
|
|
<base-dialog width="70%" :dialogTitle="searchOrEditTitle" :dialogVisible="searchOrUpdateVisible"
|
|
@cancel="handleSearchCancel" @confirm="handleSearchConfirm" :before-close="handleSearchCancel">
|
|
<deliveryInspection-search ref="searchOrUpdate" @refreshDataList="conditionSearchSubmit">
|
|
</deliveryInspection-search>
|
|
<el-row slot="footer" type="flex" justify="end">
|
|
<el-col :span="12">
|
|
<el-button size="small" type="primary" plain class="btnTextStyle" @click="handleSearchCancel">
|
|
{{ $t("close") }}
|
|
</el-button>
|
|
<el-button size="small" class="btnTextStyle" type="primary" plain @click="handleSearchReset">{{
|
|
$t("reset")
|
|
}}</el-button>
|
|
<el-button type="primary" size="small" class="btnTextStyle" @click="handleSearchConfirm">
|
|
{{ $t("search") }}
|
|
</el-button>
|
|
</el-col>
|
|
</el-row>
|
|
</base-dialog>
|
|
</div>
|
|
</el-card>
|
|
</template>
|
|
|
|
<script>
|
|
import basicPage from "@/mixins/basic-page";
|
|
import basicSearch from "@/mixins/basic-search";
|
|
// import showProductList from "./components/showProductList.vue";
|
|
import deliveryInspectionSearch from "./components/deliveryInspectionSearch.vue";
|
|
import deliveryInspectionAdd from "./components/deliveryInspection-add.vue";
|
|
import i18n from "@/i18n";
|
|
// import i18n from "@/i18n";
|
|
const tableProps = [
|
|
{
|
|
prop: "inspectionStatus",
|
|
label: i18n.t('code.inspectionStatus'),
|
|
},
|
|
{
|
|
prop: "factoryName",
|
|
label: i18n.t('code.factoryName'),
|
|
},
|
|
{
|
|
prop: "batchNo",
|
|
label: i18n.t('code.batchNo'),
|
|
},
|
|
{
|
|
prop: "orderNumber",
|
|
label: i18n.t('code.orderNumber'),
|
|
},
|
|
{
|
|
prop: "productName",
|
|
label: i18n.t('code.productName'),
|
|
},
|
|
{
|
|
prop: "companyName",
|
|
label: i18n.t('code.companyName'),
|
|
},
|
|
{
|
|
prop: "productCode",
|
|
label: i18n.t('code.productCode'),
|
|
},
|
|
{
|
|
prop: "supplierName",
|
|
label: i18n.t('code.supplierName'),
|
|
},
|
|
{
|
|
prop: "batchQuantity",
|
|
label: i18n.t('code.batchQuantity'),
|
|
},
|
|
{
|
|
prop: "inspectionQuantity",
|
|
label: i18n.t('code.inspectionQuantity'),
|
|
},
|
|
{
|
|
prop: "checkoutTime",
|
|
label: i18n.t('code.checkoutTime'),
|
|
},
|
|
{
|
|
prop: "inspectionTime",
|
|
label: i18n.t('code.inspectionTime'),
|
|
},
|
|
{
|
|
prop: "inspectionType",
|
|
label: i18n.t('code.inspectionType'),
|
|
},
|
|
{
|
|
prop: "username",
|
|
label: i18n.t('code.username'),
|
|
},
|
|
{
|
|
prop: "source",
|
|
label: i18n.t('code.source'),
|
|
}
|
|
];
|
|
const tableBtn = [
|
|
{
|
|
type: "edit",
|
|
btnName: i18n.t('t.edit'),
|
|
},
|
|
{
|
|
type: "delete",
|
|
btnName: i18n.t('t.delete'),
|
|
},
|
|
];
|
|
export default {
|
|
mixins: [basicPage, basicSearch],
|
|
data() {
|
|
return {
|
|
urlOptions: {
|
|
getDataListURL: "code/deliveryInspection/page/term",
|
|
deleteURL: "/code/deliveryInspection",
|
|
},
|
|
tableProps,
|
|
tableBtn,
|
|
listQuery: {
|
|
limit: 10,
|
|
page:1
|
|
},
|
|
productData: {},
|
|
searchOrEditTitle: "",
|
|
searchOrUpdateVisible: false,
|
|
productOrEditTitle: "",
|
|
addOrEditTitle: '',
|
|
addOrUpdateVisible:false,
|
|
productOrUpdateVisible: false,
|
|
formConfig: [
|
|
// {
|
|
// type: "",
|
|
// label: i18n.t("params.paramCode"),
|
|
// placeholder: i18n.t("params.paramCode"),
|
|
// param: "paramCode",
|
|
// },
|
|
// {
|
|
// type: "separate",
|
|
// },
|
|
{
|
|
type: "button",
|
|
btnName: "新增",
|
|
name: "add",
|
|
color: "primary",
|
|
},
|
|
{
|
|
type: "button",
|
|
btnName: "搜索",
|
|
name: "search",
|
|
color: "primary",
|
|
// plain: true,
|
|
}
|
|
],
|
|
};
|
|
},
|
|
components: {
|
|
deliveryInspectionSearch,
|
|
deliveryInspectionAdd
|
|
},
|
|
methods: {
|
|
//search-bar点击
|
|
handleProductCancel() {
|
|
this.productOrUpdateVisible = false;
|
|
this.productOrEditTitle = "";
|
|
},
|
|
handleCurrentChange(val) {
|
|
this.productData = val.newVal ? val.newVal: {}
|
|
},
|
|
setCurrent(index) {
|
|
this.$refs.palletTable1.setCurrent("palletTable", index);
|
|
},
|
|
// handleSearchCancel() {
|
|
// this.searchOrEditTitle = "";
|
|
// this.searchOrUpdateVisible = false;
|
|
// },
|
|
conditionSearch() {
|
|
this.searchOrEditTitle = "搜索";
|
|
this.searchOrUpdateVisible = true;
|
|
this.$nextTick(() => {
|
|
this.$refs.searchOrUpdate.init();
|
|
});
|
|
},
|
|
// handleConfirm() {
|
|
// this.$refs.addOrUpdate.dataFormSubmitHandle();
|
|
// },
|
|
// conditionSearchSubmit() {},
|
|
conditionSearchSubmit(dataForm) {
|
|
// console.log(key);
|
|
this.listQuery.batchNo = dataForm.batchNo ? dataForm.batchNo : null
|
|
this.listQuery.customSamplingId = dataForm.customSamplingId ? dataForm.customSamplingId : null
|
|
this.listQuery.endTime = dataForm.timeSlot ? dataForm.timeSlot[1] : null
|
|
this.listQuery.startTime = dataForm.timeSlot ? dataForm.timeSlot[0] : null
|
|
this.listQuery.factoryId = dataForm.factoryId ? dataForm.factoryId : null
|
|
this.listQuery.inspectionStatus = dataForm.inspectionStatus ? dataForm.inspectionStatus : null
|
|
this.listQuery.inspectionType = dataForm.inspectionType ? dataForm.inspectionType : null
|
|
this.listQuery.productId = dataForm.productId ? dataForm.productId : null
|
|
this.listQuery.recheck = dataForm.recheck ? dataForm.recheck : null
|
|
this.listQuery.supplierId = dataForm.supplierId ? dataForm.supplierId : null
|
|
this.listQuery.task = dataForm.task ? dataForm.task : null
|
|
this.listQuery.userId = dataForm.userId ? dataForm.userId : null
|
|
this.listQuery.page = 1
|
|
this.getDataList(this.listQuery)
|
|
this.searchOrUpdateVisible = false
|
|
// console.log(11111);
|
|
// this.conditionSearchSubmit();
|
|
},
|
|
handleClick(val) {
|
|
if (val.type === "delete") {
|
|
this.$confirm(`确定对[名称=${val.data.customerTypeName}]进行删除操作?`, "提示", {
|
|
confirmButtonText: "确定",
|
|
cancelButtonText: "取消",
|
|
type: "warning",
|
|
})
|
|
.then(() => {
|
|
this.$http.delete(this.urlOptions.deleteURL, { data: [val.data.id] }).then(({ data }) => {
|
|
if (data && data.code === 0) {
|
|
this.$message({
|
|
message: "操作成功",
|
|
type: "success",
|
|
duration: 1500,
|
|
onClose: () => {
|
|
this.getDataList();
|
|
},
|
|
});
|
|
} else {
|
|
this.$message.error(data.msg);
|
|
}
|
|
});
|
|
})
|
|
.catch(() => { });
|
|
} else if (val.type === 'edit') {
|
|
this.addOrUpdateVisible = true
|
|
this.addOrEditTitle = this.$t('edit')
|
|
this.$nextTick(() => {
|
|
this.$refs.addOrUpdate.init(val.data.id);
|
|
});
|
|
}
|
|
},
|
|
// addOrUpdateHandle(productData) {
|
|
// this.addOrUpdateVisible = true;
|
|
// this.$nextTick(() => {
|
|
// this.$refs.addOrUpdate.init(productData);
|
|
// });
|
|
// },
|
|
getDataList() {
|
|
this.dataListLoading = true;
|
|
this.$http
|
|
.post(this.urlOptions.getDataListURL, this.listQuery,
|
|
)
|
|
.then(({ data: res }) => {
|
|
this.dataListLoading = false;
|
|
if (res.code !== 0) {
|
|
this.tableData = [];
|
|
this.listQuery.total = 0;
|
|
return this.$message.error(res.msg);
|
|
}
|
|
this.tableData = res.data.list;
|
|
this.listQuery.total = res.data.total;
|
|
})
|
|
.catch(() => {
|
|
this.dataListLoading = false;
|
|
})
|
|
},
|
|
buttonClick(val) {
|
|
switch (val.btnName) {
|
|
case "search":
|
|
// this.listQuery.paramCode = val.paramCode;
|
|
this.listQuery.key = null;
|
|
this.listQuery.page = 1;
|
|
this.getDataList();
|
|
break;
|
|
case "correlation":
|
|
this.productOrEditTitle = "产品";
|
|
this.productOrUpdateVisible = true;
|
|
// this.searchOrUpdateHandle(this.productData);
|
|
// this.searchOrUpdateVisible = true;
|
|
this.$nextTick(() => {
|
|
this.$refs.productOrUpdate.init(this.productData);
|
|
});
|
|
break;
|
|
case "add":
|
|
this.addOrEditTitle = '新增'
|
|
this.addOrUpdateVisible = true;
|
|
this.addOrUpdateHandle()
|
|
break;
|
|
case "cancel":
|
|
this.$refs.palletTable1.setCurrent("palletTable", -1);
|
|
break;
|
|
default:
|
|
console.log(val);
|
|
}
|
|
},
|
|
},
|
|
};
|
|
</script>
|