中航光电热表web
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

272 lines
7.4 KiB

7 months ago
<template>
<basic-container>
5 months ago
<avue-crud
:option="option"
:table-loading="loading"
:data="data"
v-model:page="page"
v-model="form"
ref="crud"
@search-change="searchChange"
@search-reset="searchReset"
@selection-change="selectionChange"
@row-del="rowDel"
@current-change="currentChange"
@size-change="sizeChange"
@refresh-change="refreshChange"
@on-load="onLoad"
>
6 months ago
<template #menu-left>
5 months ago
<el-button type="primary" @click="handleAdd">新增</el-button>
<el-button type="danger" @click="handleDeletes">删除</el-button>
6 months ago
</template>
<template #menu-right>
<el-button type="primary" @click="handleImport">导入</el-button>
</template>
5 months ago
<template #menu="scope">
<el-button type="text" @click="handleView(scope.row)">详情</el-button>
<el-button type="text" @click="handleEdit(scope.row)">编辑</el-button>
<el-button type="text" @click="handleDel(scope.row)">删除</el-button>
</template>
<template #originalName="{ row }">
<a style="color:#284c89" :href="row.link" :download="row.originalName">{{row.originalName}}</a>
</template>
</avue-crud>
5 months ago
<!-- 新增 编辑删除 -->
<addTestProjectDialog
v-if="addOpen"
:showDialog="addOpen"
@closeDialog="closeDialog"
:title="title"
:projectId="projectId"
></addTestProjectDialog>
<!-- 导入 -->
<basic-import v-if="isShowImport" title="导入" :isShow="isShowImport"
templateUrl="/blade-desk/QA/CycleTestItem/download-excel-template"
templateName="试验项目模板.xlsx"
importUrl="/blade-desk/QA/CycleTestItem/import-excel"
@closeDialog="closeDialog"></basic-import>
</basic-container>
7 months ago
</template>
<script>
5 months ago
import addTestProjectDialog from './components/addTestProjectDialog.vue';
import { getList, remove} from '@/api/qualityManagement/periodicTesting/testProject.js';
import basicImport from '@/components/basic-import/main.vue'
7 months ago
export default {
5 months ago
components: {
addTestProjectDialog,
basicImport
5 months ago
},
data() {
return {
loading: false,
data: [],
6 months ago
projectForm: {},
projectRules: {
tpProject: [{ required: true, message: '请输入项目名称', trigger: 'blur' }],
testPieceTitle: [{ required: true, message: '请选择试验件', trigger: 'blur' }],
tpStandard: [{ required: true, message: '请输入试验标准', trigger: 'blur' }],
craftMan: [{ required: true, message: '请选择主管工艺', trigger: 'blur' }],
mecMan: [{ required: true, message: '请选择试验员', trigger: 'blur' }],
remDays: [{ required: true, message: '请选择超期提醒', trigger: 'blur' }],
textCycle: [{ required: true, message: '请选择试验周期', trigger: 'blur' }],
},
form: {},
page: {
pageSize: 10,
currentPage: 1,
total: 0,
},
6 months ago
selectionList: [],
isShowImport:false,
6 months ago
monthTags: [],
yearTags: [],
option: {
tip: false,
height: 'auto',
calcHeight: 32,
columnSort: true,
searchShow: true,
searchMenuSpan: 18,
searchIcon: true,
searchIndex: 3,
tree: false,
border: true,
5 months ago
index: false,
selection: true,
5 months ago
viewBtn: false,
delBtn: false,
addBtn: false,
editBtn: false,
editBtnText: '修改',
viewBtnText: '详情',
addBtnIcon: ' ',
viewBtnIcon: ' ',
delBtnIcon: ' ',
editBtnIcon: ' ',
labelWidth: 120,
dialogWidth: 600,
dialogClickModal: false,
searchEnter: true,
filterBtn: true,
searchShowBtn: false,
excelBtn: true,
showOverflowTooltip: true,
align: 'center',
5 months ago
searchLabelPosition: 'left',
searchGutter: 24,
searchSpan: 6,
menuAlign: 'left',
gridBtn: false,
searchMenuPosition: 'right',
column: [
{
label: '试验项目',
5 months ago
prop: 'name',
6 months ago
search: true,
sortable: true,
},
{
label: '试验条件',
5 months ago
prop: 'condition',
search: false,
sortable: true,
},
{
label: '试验标准',
prop: 'cycleTestStandardName',
search: false,
sortable: true,
},
{
6 months ago
label: '试验文件',
prop: 'originalName',
search: false,
sortable: true,
},
5 months ago
],
},
addOpen: false,
title: '新增',
};
},
5 months ago
mounted() {},
methods: {
5 months ago
closeDialog() {
this.addOpen = false;
this.isShowImport = false
5 months ago
this.refreshChange()
},
6 months ago
// 点击详情按钮
handleView(row) {
5 months ago
this.projectId = row.id;
this.title = '详情';
this.addOpen = true;
6 months ago
},
// 点击编辑按钮
handleEdit(row) {
5 months ago
this.projectId = row.id;
this.title = '编辑';
this.addOpen = true;
6 months ago
},
5 months ago
handleDel(row){
this.$confirm('确定删除所选数据?', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
}).then(() => {
return remove(row.id);
})
.then(() => {
this.onLoad(this.page);
this.$message({
type: 'success',
message: '操作成功!',
});
});
6 months ago
},
5 months ago
6 months ago
// 点击上方删除按钮,多条删除
handleDeletes() {
if (this.selectionList.length == 0) {
5 months ago
this.$message.error('请至少选择一条数据!');
6 months ago
} else {
this.$confirm('确定删除所选数据?', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
}).then(() => {
5 months ago
let ids = this.selectionList.map(item => item.id)
return remove(ids.join(','));
}).then(() => {
this.onLoad(this.page);
this.$message({
type: 'success',
message: '操作成功!',
});
});
6 months ago
}
},
// 点击导入按钮
handleImport() {
this.isShowImport = true
},
6 months ago
// 点击删除按钮
rowDel(row) {
this.$confirm('确定删除此条数据?', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
5 months ago
}).then(() => {});
6 months ago
},
// 点击新增按钮
handleAdd() {
5 months ago
this.title = '新增';
this.addOpen = true;
6 months ago
},
// 多选
selectionChange(list) {
this.selectionList = list;
},
searchReset() {
this.query = {};
this.onLoad(this.page);
},
searchChange(params, done) {
this.query = params;
this.page.currentPage = 1;
this.onLoad(this.page, params);
done();
},
currentChange(currentPage) {
this.page.currentPage = currentPage;
},
sizeChange(pageSize) {
this.page.pageSize = pageSize;
},
refreshChange() {
this.onLoad(this.page, this.query);
},
5 months ago
onLoad(page, params = {}) {
this.loading = true;
getList(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => {
this.data = res.data.data.records;
this.loading = false;
this.page.total = res.data.data.total
5 months ago
// this.selectionClear();
});
},
},
};
7 months ago
</script>
5 months ago
<style></style>