|
@@ -30,21 +30,21 @@
|
|
|
<el-table-column type="selection" width="55" />
|
|
|
<el-table-column prop="name" label="模版名称" show-overflow-tooltip width="200"></el-table-column>
|
|
|
<el-table-column prop="groupingText" label="质检分类" show-overflow-tooltip></el-table-column>
|
|
|
- <el-table-column label="是否启用" show-overflow-tooltip>
|
|
|
- <template #default="{ row }">
|
|
|
- <el-switch
|
|
|
- v-model="row.isEnable"
|
|
|
- :active-value="1"
|
|
|
- :inactive-value="0"
|
|
|
- inline-prompt
|
|
|
- active-text="启用"
|
|
|
- inactive-text="禁用"
|
|
|
- @change="changeIsEnable(row)"
|
|
|
- v-if="auth('quality:template:edit')"
|
|
|
- />
|
|
|
- <span v-else>{{ row.isEnable === 1 ? '启用' : '禁用' }}</span>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
+ <el-table-column label="是否启用" show-overflow-tooltip>
|
|
|
+ <template #default="{ row }">
|
|
|
+ <el-switch
|
|
|
+ v-model="row.isEnable"
|
|
|
+ :active-value="1"
|
|
|
+ :inactive-value="0"
|
|
|
+ inline-prompt
|
|
|
+ active-text="启用"
|
|
|
+ inactive-text="禁用"
|
|
|
+ @change="changeIsEnable(row)"
|
|
|
+ v-if="auth('quality:template:edit')"
|
|
|
+ />
|
|
|
+ <span v-else>{{ row.isEnable === 1 ? '启用' : '禁用' }}</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
<el-table-column prop="creatorName" label="创建人" show-overflow-tooltip></el-table-column>
|
|
|
<el-table-column prop="creationTime" label="创建时间" show-overflow-tooltip width="170">
|
|
|
<template #default="{ row }">
|
|
@@ -75,18 +75,18 @@
|
|
|
/>
|
|
|
</el-card>
|
|
|
<!-- 模板新增 -->
|
|
|
- <quality-template-add ref="templateAdd" @updateList="queryList" :templateGrouping="templateGrouping"/>
|
|
|
+ <quality-template-add ref="templateAdd" @updateList="queryList" :templateGrouping="templateGrouping" />
|
|
|
<!-- 模板编辑 -->
|
|
|
<quality-template-edit ref="templateEditRef" @updateList="queryList" :templateGrouping="templateGrouping" />
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script lang="ts" setup name="qualityTemplate">
|
|
|
-import {defineAsyncComponent, onMounted, reactive, ref} from 'vue';
|
|
|
-import {ElMessage, ElMessageBox, FormInstance} from 'element-plus';
|
|
|
-import {formatDate} from '/@/utils/formatTime';
|
|
|
-import {auth} from '/@/utils/authFunction';
|
|
|
-import {templateBaseData, templateDelete, templateList, templateUpdate} from "/@/api/quality/template"
|
|
|
+import { defineAsyncComponent, onMounted, reactive, ref } from 'vue';
|
|
|
+import { ElMessage, ElMessageBox, FormInstance } from 'element-plus';
|
|
|
+import { formatDate } from '/@/utils/formatTime';
|
|
|
+import { auth } from '/@/utils/authFunction';
|
|
|
+import { templateBaseData, templateDelete, templateList, templateUpdate } from '/@/api/quality/template';
|
|
|
|
|
|
// 引入组件
|
|
|
const QualityTemplateAdd = defineAsyncComponent(() => import('/@/views/quality/template/components/Template-add.vue')); // 模板新增
|
|
@@ -99,7 +99,7 @@ const state = reactive<any>({
|
|
|
// 查询参数
|
|
|
PageIndex: 1,
|
|
|
PageSize: 10,
|
|
|
- Grouping: null,
|
|
|
+ Grouping: null,
|
|
|
Name: null,
|
|
|
},
|
|
|
total: 0, // 总条数
|
|
@@ -110,7 +110,7 @@ const templateGrouping = ref<EmptyArrayType>([]); // 质检分组
|
|
|
const getBaseData = async () => {
|
|
|
try {
|
|
|
const res = await templateBaseData();
|
|
|
- templateGrouping.value = res.result?.templateGrouping ?? [];
|
|
|
+ templateGrouping.value = res.result?.templateGrouping ?? [];
|
|
|
} catch (error) {
|
|
|
console.log(error);
|
|
|
}
|
|
@@ -120,7 +120,7 @@ const queryList = () => {
|
|
|
state.loading = true;
|
|
|
if (!auth('quality:template:query')) ElMessage.error('抱歉,您没有权限获取质检模板列表!');
|
|
|
else {
|
|
|
- templateList(state.queryParams)
|
|
|
+ templateList(state.queryParams)
|
|
|
.then((res) => {
|
|
|
state.loading = false;
|
|
|
state.tableData = res.result.items ?? [];
|
|
@@ -155,31 +155,31 @@ const handleSelectionChange = (val: any[]) => {
|
|
|
};
|
|
|
// 修改是否启用
|
|
|
const changeIsEnable = (row: any) => {
|
|
|
- ElMessageBox.confirm(`您确定要${row.isEnable ? '启用' : '禁用'}:【${row.name}】模板,是否继续?`, '提示', {
|
|
|
- confirmButtonText: '确认',
|
|
|
- cancelButtonText: '取消',
|
|
|
- type: 'warning',
|
|
|
- draggable: true,
|
|
|
- cancelButtonClass: 'default-button',
|
|
|
- autofocus: false,
|
|
|
- })
|
|
|
- .then(() => {
|
|
|
- const request = {
|
|
|
- ...row,
|
|
|
- isEnable: row.isEnable,
|
|
|
- };
|
|
|
- templateUpdate(request)
|
|
|
- .then(() => {
|
|
|
- ElMessage.success('操作成功');
|
|
|
- queryList();
|
|
|
- })
|
|
|
- .catch(() => {
|
|
|
- queryList();
|
|
|
- });
|
|
|
- })
|
|
|
- .catch(() => {
|
|
|
- queryList();
|
|
|
- });
|
|
|
+ ElMessageBox.confirm(`您确定要${row.isEnable ? '启用' : '禁用'}:【${row.name}】模板,是否继续?`, '提示', {
|
|
|
+ confirmButtonText: '确认',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning',
|
|
|
+ draggable: true,
|
|
|
+ cancelButtonClass: 'default-button',
|
|
|
+ autofocus: false,
|
|
|
+ })
|
|
|
+ .then(() => {
|
|
|
+ const request = {
|
|
|
+ ...row,
|
|
|
+ isEnable: row.isEnable,
|
|
|
+ };
|
|
|
+ templateUpdate(request)
|
|
|
+ .then(() => {
|
|
|
+ ElMessage.success('操作成功');
|
|
|
+ queryList();
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
+ queryList();
|
|
|
+ });
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
+ queryList();
|
|
|
+ });
|
|
|
};
|
|
|
// 删除参数
|
|
|
const onTemplateDelete = () => {
|
|
@@ -194,7 +194,7 @@ const onTemplateDelete = () => {
|
|
|
autofocus: false,
|
|
|
})
|
|
|
.then(() => {
|
|
|
- templateDelete({ ids }).then(() => {
|
|
|
+ templateDelete({ ids }).then(() => {
|
|
|
ElMessage.success('操作成功');
|
|
|
queryList();
|
|
|
});
|