qms/src/views/modules/code/startEightDisciplineCreateTeam.vue
2023-07-17 15:50:12 +08:00

267 lines
6.9 KiB
Vue

<!--
* @Author: zhp
* @Date: 2023-01-11 09:24:58
* @LastEditTime: 2023-07-17 10:39:16
* @LastEditors: zwq
* @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="120"
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="teamSetTitle"
:dialogVisible="teamSetVisible"
@cancel="handleCancel"
@confirm="handleConfirm"
:before-close="handleCancel"
>
<add-or-update
ref="teamSet"
:roleList="roleList"
@refreshDataList="successSubmit"
></add-or-update>
</base-dialog>
</div>
</el-card>
</template>
<script>
import basicPage from "@/mixins/basic-page";
// import transferRecordsAdd from "./components/transferRecords-add"
import AddOrUpdate from "./components/startEightDisciplineCreateTeam-add";
// import transferRecordsSearch from "./components/transferRecordsSearch"
// import available from "./components/available.vue"
import basicSearch from "@/mixins/basic-search";
import { timeFormatter } from "@/filters/code-filter";
import codeFilter from "@/filters/code-filter";
import i18n from "@/i18n";
const tableProps = [
{
prop: "title",
label: i18n.t("code.title"),
align: "center",
},
{
prop: "eightDisciplineType",
label: i18n.t("oss.type"),
align: "center",
filter: codeFilter("eightDisciplineType"),
},
{
prop: "occurrenceDate",
label: i18n.t("gage.createDate"),
align: "center",
filter: timeFormatter,
},
{
prop: "productName",
label: i18n.t("code.productName"),
align: "center",
},
{
prop: "customName",
label: i18n.t("gage.connection"),
align: "center",
},
{
prop: "description",
label: i18n.t("basic.remark"),
align: "center",
},
{
prop: 'userName',
label: i18n.t("code.userId"),
align: "center",
},
];
const tableBtn = [
// {
// type: "edit",
// btnName: "编辑",
// },
// {
// type: "delete",
// btnName: "删除",
// },
{
type: "team",
btnName: "团队",
},
];
export default {
mixins: [basicPage, basicSearch],
components: {
AddOrUpdate,
},
data() {
return {
urlOptions: {
getDataListURL: "/code/startEightDiscipline/page",
deleteURL: "/code/startEightDiscipline",
},
tableProps,
tableBtn,
teamSetTitle: "",
teamSetVisible: false,
listQuery: {
limit: 10,
page: 1,
eightDisciplineStatus: 2,
examineStatus: 0,
},
roleList: [],
searchOrEditTitle: "",
searchOrUpdateVisible: false,
formConfig: [
// {
// type: "",
// label: i18n.t("params.paramCode"),
// placeholder: i18n.t("params.paramCode"),
// param: "paramCode",
// },
// {
// type: "separate",
// },
{
type: "input",
label: i18n.t("code.title"),
placeholder: i18n.t("code.title"),
param: "title",
},
{
type: "button",
btnName: "搜索",
name: "search",
color: "primary",
},
],
};
},
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.page = 1;
this.getDataList();
this.searchOrUpdateVisible = false;
// console.log(11111);
// this.conditionSearchSubmit();
},
handleClick(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);
});
} else if (val.type === "team") {
this.$http
.get("/sys/user/list")
.then(({ data: res }) => {
if (res.code === 0) {
this.roleList = res.data;
this.teamSetVisible = true;
this.teamSetTitle = "团队";
this.$nextTick(() => {
this.$refs.teamSet.init(val.data.id);
});
}
})
.catch(() => {});
}
},
handleCancel() {
this.$refs.teamSet.formClear();
this.teamSetVisible = false;
this.teamSetTitle = "";
},
handleConfirm() {
this.$refs.teamSet.dataFormSubmit();
},
buttonClick(val) {
switch (val.btnName) {
case "search":
// this.listQuery.paramCode = val.paramCode;
this.listQuery.page = 1;
this.listQuery.title = val.title ? val.title : "";
this.getDataList();
break;
case "add":
this.addOrEditTitle = this.$t("add");
this.addOrUpdateVisible = true;
this.addOrUpdateHandle();
break;
default:
console.log(val);
}
},
},
};
</script>