324 lines
8.9 KiB
Vue
324 lines
8.9 KiB
Vue
<!--
|
||
* @Author: zhp
|
||
* @Date: 2023-01-11 09:24:58
|
||
* @LastEditTime: 2023-07-18 10:21:38
|
||
* @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="2" class="item">
|
||
<el-button type="primary" size="small" @click="conditionSearch">条件搜索</el-button>
|
||
</el-badge> -->
|
||
</SearchBar>
|
||
<base-table :table-props="tableProps" :page="listQuery.page" :limit="listQuery.limit" :table-data="tableData">
|
||
<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 :dialogTitle="addOrEditTitle" :dialogVisible="addOrUpdateVisible" @cancel="handleCancel"
|
||
@confirm="handleConfirm" :before-close="handleCancel">
|
||
<samplingPlan-add ref="addOrUpdate" @refreshDataList="successSubmit">
|
||
</samplingPlan-add>
|
||
<!-- <el-row slot="footer" type="flex" justify="end"> </el-row> -->
|
||
</base-dialog>
|
||
<base-dialog :dialogTitle="searchOrEditTitle" :dialogVisible="searchOrUpdateVisible" @cancel="handleSearchCancel"
|
||
@confirm="handleSearchConfirm" :before-close="handleSearchCancel">
|
||
<samplingPlan-search ref="searchOrUpdate" @successSubmit="conditionSearchSubmit"></samplingPlan-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 samplingPlanAdd from "./components/samplingPlan-add"
|
||
// import AddOrUpdate from './params-add-or-update'
|
||
import samplingPlanSearch from "./components/samplingPlanSearch.vue"
|
||
import lowHigh from "./components/lowHigh.vue"
|
||
import basicSearch from "@/mixins/basic-search"
|
||
import i18n from "@/i18n"
|
||
const tableProps = [
|
||
{
|
||
prop: 'sampleRange',
|
||
label: i18n.t("quality.sampleRange"),
|
||
align: 'center',
|
||
subcomponent: lowHigh,
|
||
},
|
||
{
|
||
prop: 'zeroPointZeroOne',
|
||
label: i18n.t("quality.zeroPointZeroOne"),
|
||
align: 'center'
|
||
},
|
||
{
|
||
prop: 'zeroPointZeroOneFive',
|
||
label: i18n.t("quality.zeroPointZeroOneFive"),
|
||
align: 'center'
|
||
},
|
||
{
|
||
prop: 'zeroPointZeroTwoFive',
|
||
label: i18n.t("quality.zeroPointZeroTwoFive"),
|
||
align: 'center'
|
||
},
|
||
{
|
||
prop: 'zeroPointZeroFour',
|
||
label: i18n.t("quality.zeroPointZeroFour"),
|
||
align: 'center'
|
||
},
|
||
{
|
||
prop: 'zeroPointZeroSixFive',
|
||
label: i18n.t("quality.zeroPointZeroSixFive"),
|
||
align: 'center'
|
||
},
|
||
{
|
||
prop: 'zeroPointOne',
|
||
label: i18n.t("quality.zeroPointOne"),
|
||
align: 'center'
|
||
},
|
||
{
|
||
prop: 'zeroPointOneFive',
|
||
label: i18n.t("quality.zeroPointOneFive"),
|
||
align: 'center'
|
||
},
|
||
{
|
||
prop: 'zeroPointTwoFive',
|
||
label: i18n.t("quality.zeroPointTwoFive"),
|
||
align: 'center'
|
||
},
|
||
{
|
||
prop: 'zeroPointFour',
|
||
label: i18n.t("quality.zeroPointFour"),
|
||
align: 'center'
|
||
},
|
||
{
|
||
prop: 'zeroPointSixFive',
|
||
label: i18n.t("quality.zeroPointSixFive"),
|
||
align: 'center'
|
||
},
|
||
{
|
||
prop: 'onePointZero',
|
||
label: i18n.t("quality.onePointZero"),
|
||
align: 'center'
|
||
},
|
||
{
|
||
prop: 'onePointFive',
|
||
label: i18n.t("quality.onePointFive"),
|
||
align: 'center'
|
||
},
|
||
{
|
||
prop: 'twoPointFive',
|
||
label: i18n.t("quality.twoPointFive"),
|
||
align: 'center'
|
||
},
|
||
{
|
||
prop: 'fourPointZero',
|
||
label: i18n.t("quality.fourPointZero"),
|
||
align: 'center'
|
||
},
|
||
{
|
||
prop: 'sixPointFive',
|
||
label: i18n.t("quality.sixPointFive"),
|
||
align: 'center'
|
||
},
|
||
{
|
||
prop: 'ten',
|
||
label: i18n.t("quality.ten"),
|
||
align: 'center'
|
||
},
|
||
|
||
]
|
||
const tableBtn = [
|
||
{
|
||
type: "edit",
|
||
btnName: "编辑",
|
||
},
|
||
{
|
||
type: "delete",
|
||
btnName: "删除",
|
||
},
|
||
];
|
||
export default {
|
||
mixins: [basicPage, basicSearch],
|
||
components: {
|
||
samplingPlanSearch,
|
||
samplingPlanAdd
|
||
},
|
||
data() {
|
||
return {
|
||
urlOptions: {
|
||
getDataListURL: "/quality/qmsSamplingPlan/page",
|
||
deleteURL: "/quality/qmsSamplingPlan",
|
||
},
|
||
tableProps,
|
||
tableBtn,
|
||
searchOrEditTitle: '',
|
||
searchOrUpdateVisible: false,
|
||
searchOrUpdateVisible: false,
|
||
formConfig: [
|
||
{
|
||
type: 'input',
|
||
label: i18n.t('quality.sampleSize'),
|
||
placeholder: i18n.t('quality.sampleSize'),
|
||
param: 'sampleSize',
|
||
clearable: true
|
||
},
|
||
{
|
||
type: 'select',
|
||
label: i18n.t('quality.inspectionLevel'),
|
||
placeholder: i18n.t('quality.inspectionLevel'),
|
||
param: 'inspectionLevel',
|
||
selectOptions: [
|
||
{
|
||
id: 'S-1',
|
||
name: 'S-1'
|
||
},
|
||
{
|
||
id: 'S-2',
|
||
name: 'S-2'
|
||
},
|
||
{
|
||
id: 'S-3',
|
||
name: 'S-3'
|
||
},
|
||
{
|
||
id: 'S-4',
|
||
name: 'S-4'
|
||
},
|
||
{
|
||
id: 'Ⅰ',
|
||
name: 'Ⅰ'
|
||
},
|
||
{
|
||
id: 'Ⅱ',
|
||
name: 'Ⅱ'
|
||
},
|
||
{
|
||
id: 'Ⅲ',
|
||
name: 'Ⅲ'
|
||
}
|
||
],
|
||
clearable: true,
|
||
filterable: true
|
||
},
|
||
{
|
||
type: "button",
|
||
btnName: "搜索",
|
||
name: "search",
|
||
color: "primary",
|
||
// plain: true,
|
||
},
|
||
{
|
||
type: "button",
|
||
btnName: "新增",
|
||
name: "add",
|
||
color: 'success',
|
||
plain: true
|
||
// plain: true,
|
||
}
|
||
],
|
||
};
|
||
},
|
||
// components: {
|
||
// AddOrUpdate,
|
||
// },
|
||
deactivated() {
|
||
this.listQuery.inspectionLevel = null
|
||
this.listQuery.sampleSize = null
|
||
},
|
||
methods: {
|
||
//search-bar点击
|
||
handleProductCancel() {
|
||
this.productOrUpdateVisible = false;
|
||
this.productOrEditTitle = "";
|
||
},
|
||
// handleSearchCancel() {
|
||
// this.searchOrEditTitle = "";
|
||
// this.searchOrUpdateVisible = false;
|
||
// },
|
||
conditionSearch() {
|
||
this.searchOrEditTitle = "搜索";
|
||
this.searchOrUpdateVisible = true;
|
||
this.$nextTick(() => {
|
||
this.$refs.searchOrUpdate.init();
|
||
});
|
||
},
|
||
conditionSearchSubmit(dataForm) {
|
||
this.listQuery.inspectionLevel = dataForm.inspectionLevel
|
||
this.listQuery.sampleSize = dataForm.sampleSize
|
||
this.listQuery.page = 1;
|
||
this.getDataList();
|
||
this.searchOrUpdateVisible = false;
|
||
// console.log(11111);
|
||
// this.conditionSearchSubmit();
|
||
},
|
||
handleClick(val) {
|
||
console.log(val);
|
||
if (val.type === "delete") {
|
||
this.$confirm(`确定对[名称=${val.data.failureTypeName}]进行删除操作?`, "提示", {
|
||
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);
|
||
});
|
||
}
|
||
},
|
||
buttonClick(val) {
|
||
switch (val.btnName) {
|
||
case "search":
|
||
// this.listQuery.paramCode = val.paramCode;
|
||
this.listQuery.page = 1;
|
||
this.listQuery.inspectionLevel = val.inspectionLevel ? val.inspectionLevel :null
|
||
this.listQuery.sampleSize = val.sampleSize ? val.sampleSize :null
|
||
this.getDataList();
|
||
break;
|
||
case "add":
|
||
this.addOrEditTitle = this.$t('add')
|
||
this.addOrUpdateVisible = true;
|
||
this.addOrUpdateHandle()
|
||
break;
|
||
default:
|
||
console.log(val)
|
||
}
|
||
},
|
||
}
|
||
};
|
||
</script>
|