qms/src/views/modules/laboratory/qmsLaboratoryTesterInspectionQualification.vue

236 lines
7.2 KiB
Vue
Raw Normal View History

2023-05-24 16:40:29 +08:00
<!--
* @Author: zhp
* @Date: 2023-01-11 09:24:58
2023-06-21 16:56:28 +08:00
* @LastEditTime: 2023-06-20 15:35:30
2023-05-24 16:40:29 +08:00
* @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 :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">
<laboratoryTesterInspectionQualification-add ref="addOrUpdate" @refreshDataList="successSubmit">
</laboratoryTesterInspectionQualification-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">
<!-- <failureType-search ref="searchOrUpdate" @refreshDataList="conditionSearchSubmit"></failureType-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 laboratoryTesterInspectionQualificationAdd from "./components/laboratoryTesterInspectionQualification-add"
import { timeFormatter } from '@/filters'
import basicSearch from "@/mixins/basic-search"
import i18n from "@/i18n"
const tableProps = [
{
prop: 'code',
label: i18n.t("laboratory.code"),
align: 'center'
},
{
prop: 'name',
label: i18n.t("laboratory.name"),
align: 'center'
},
{
prop: 'qualificationDescription',
label: i18n.t("laboratory.qualificationDescription"),
align: 'center'
},
{
prop: 'validDate',
label: i18n.t("laboratory.validDate"),
align: 'center',
filter:timeFormatter
},
{
prop: 'getDate',
label: i18n.t("laboratory.getDate"),
align: 'center',
filter: timeFormatter
},
{
prop: 'remark',
label: i18n.t("laboratory.remark"),
align: 'center'
},
]
const tableBtn = [
{
type: "edit",
btnName: "编辑",
},
{
type: "delete",
btnName: "删除",
}
];
export default {
mixins: [basicPage, basicSearch],
components: {
// failureTypeSearch,
laboratoryTesterInspectionQualificationAdd
},
data() {
return {
urlOptions: {
getDataListURL: "/laboratory/qmsLaboratoryTesterInspectionQualification/page",
deleteURL: "/laboratory/qmsLaboratoryTesterInspectionQualification",
submitURL: '/laboratory/qmsLaboratoryTesterInspectionQualification'
// exportUrl: '/nonconform/qmsNonconformityReviewSheet/export'
},
tableProps,
tableBtn,
searchOrEditTitle: '',
searchOrUpdateVisible: false,
formConfig: [
// {
// type: "",
// label: i18n.t("params.paramCode"),
// placeholder: i18n.t("params.paramCode"),
// param: "paramCode",
// },
// {
// type: "separate",
// },
{
type: "button",
btnName: i18n.t('add'),
name: "add",
color: "primary",
},
{
type: "button",
btnName: i18n.t('search'),
name: "search",
color: "primary",
}
],
};
},
// components: {
// AddOrUpdate,
// },
mounted () {
if (this.$route.query) {
console.log(this.$route.query)
this.listQuery.laboratoryTesterId = this.$route.query.laboratoryTesterId
this.getDataList()
}
},
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.code = dataForm.code
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.name}]进行删除操作?`, "提示", {
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
2023-06-21 16:56:28 +08:00
this.addOrEditTitle = this.$t('edit')
2023-05-24 16:40:29 +08:00
this.$nextTick(() => {
this.$refs.addOrUpdate.init({ id:val.data.id })
});
}
},
buttonClick(val) {
switch (val.btnName) {
case "search":
// this.listQuery.paramCode = val.paramCode;
this.listQuery.page = 1
this.getDataList();
break;
case "export":
// this.listQuery.paramCode = val.paramCode;
this.listQuery.page = 1
this.exportHandle()
break;
case "add":
this.addOrEditTitle = '新增'
this.addOrUpdateVisible = true;
this.$nextTick(() => {
this.$refs.addOrUpdate.init({ laboratoryTesterId: this.$route.query.laboratoryTesterId })
})
break;
default:
console.log(val)
}
},
}
};
</script>