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.
327 lines
9.5 KiB
327 lines
9.5 KiB
<template> |
|
<basic-container> |
|
<avue-crud :option="option" |
|
:table-loading="loading" |
|
:data="data" |
|
:page="page" |
|
:permission="permissionList" |
|
:before-open="beforeOpen" |
|
v-model="form" |
|
:search.sync="search" |
|
ref="crud" |
|
@row-update="rowUpdate" |
|
@row-save="rowSave" |
|
@row-del="rowDel" |
|
@search-change="searchChange" |
|
@search-reset="searchReset" |
|
@selection-change="selectionChange" |
|
@current-change="currentChange" |
|
@size-change="sizeChange" |
|
@on-load="onLoad"> |
|
<template slot="menuLeft"> |
|
<el-button type="danger" size="small" icon="el-icon-delete" plain v-if="permission.manufacturerinfo_delete" @click="handleDelete">批量删除</el-button> |
|
</template> |
|
<template slot="menuRight"> |
|
<el-button type="primary" size="small" plain @click="handleDetailAdd" v-if="permission.manufacturerinfo_add">新增</el-button> |
|
<el-button type="primary" size="small" plain @click="handleReject" v-if="permission.manufacturerinfo_reject">批量驳回</el-button> |
|
<el-button type="primary" size="small" plain @click="handleAuditing" v-if="permission.manufacturerinfo_audit">批量审核</el-button> |
|
<el-button type="primary" size="small" plain @click="handleExport()" v-if="permission.manufacturerinfo_export">导出</el-button> |
|
</template> |
|
</avue-crud> |
|
</basic-container> |
|
</template> |
|
|
|
<script> |
|
import {getList, getDetail, add, update, remove, reject, auditing} from "@/api/spares/manufacturerinfo"; |
|
import {getToken} from "@/util/auth"; |
|
import expUtil from "@/util/exportUtil"; |
|
import {mapGetters} from "vuex"; |
|
|
|
export default { |
|
data() { |
|
return { |
|
form: {}, |
|
search: {}, |
|
query: {}, |
|
loading: true, |
|
page: { |
|
pageSize: 10, |
|
currentPage: 1, |
|
total: 0 |
|
}, |
|
selectionList: [], |
|
option: { |
|
height: 'auto', |
|
calcHeight: 210, |
|
searchShow: true, |
|
searchMenuSpan: 6, |
|
tip: false, |
|
border: true, |
|
index: true, |
|
viewBtn: true, |
|
selection: true, |
|
refreshBtn: false, |
|
searchShowBtn: false, |
|
column: [ |
|
{ |
|
label: "统一社会信用代码/组织机构", |
|
prop: "creditCode", |
|
search: true, |
|
rules: [{ |
|
required: true, |
|
message: "请输入统一社会信用代码/组织机构", |
|
trigger: "blur" |
|
}] |
|
}, |
|
{ |
|
label: "制造商名称", |
|
prop: "manufacturerName", |
|
search: true, |
|
rules: [{ |
|
required: true, |
|
message: "请输入制造商名称", |
|
trigger: "blur" |
|
}] |
|
}, |
|
{ |
|
label: "注册地址", |
|
prop: "registeredAddress", |
|
rules: [{ |
|
required: true, |
|
message: "请输入注册地址", |
|
trigger: "blur" |
|
}] |
|
}, |
|
{ |
|
label: "生产地址", |
|
prop: "productionAddress", |
|
rules: [{ |
|
required: true, |
|
message: "请输入生产地址", |
|
trigger: "blur" |
|
}] |
|
}, |
|
{ |
|
label: "联系电话", |
|
prop: "contactNumber", |
|
rules: [{ |
|
required: true, |
|
message: "请输入联系电话", |
|
trigger: "blur" |
|
}] |
|
}, |
|
{ |
|
label: "电子邮箱", |
|
prop: "email", |
|
rules: [{ |
|
required: true, |
|
message: "请输入电子邮箱", |
|
trigger: "blur" |
|
}] |
|
}, |
|
{ |
|
label: "经营范围", |
|
prop: "businessScope", |
|
}, |
|
{ |
|
label: "执行标准", |
|
prop: "approvalStatus", |
|
type: "select", |
|
dicUrl: "/api/daf-system/dict/dictionary?code=check_status", |
|
props: { |
|
label: "dictValue", |
|
value: "dictKey" |
|
}, |
|
}, |
|
] |
|
}, |
|
data: [] |
|
}; |
|
}, |
|
computed: { |
|
...mapGetters(["permission"]), |
|
permissionList() { |
|
return { |
|
addBtn: false, |
|
viewBtn: false, |
|
delBtn: this.vaildData(this.permission.manufacturerinfo_delete, false), |
|
editBtn: this.vaildData(this.permission.manufacturerinfo_edit, false) |
|
}; |
|
}, |
|
ids() { |
|
let ids = []; |
|
this.selectionList.forEach(ele => { |
|
ids.push(ele.id); |
|
}); |
|
return ids.join(","); |
|
} |
|
}, |
|
methods: { |
|
rowSave(row, done, loading) { |
|
add(row).then(() => { |
|
done(); |
|
this.onLoad(this.page); |
|
this.$message({ |
|
type: "success", |
|
message: "操作成功!" |
|
}); |
|
}, error => { |
|
window.console.log(error); |
|
loading(); |
|
}); |
|
}, |
|
rowUpdate(row, index, done, loading) { |
|
update(row).then(() => { |
|
done(); |
|
this.onLoad(this.page); |
|
this.$message({ |
|
type: "success", |
|
message: "操作成功!" |
|
}); |
|
}, error => { |
|
window.console.log(error); |
|
loading(); |
|
}); |
|
}, |
|
rowDel(row) { |
|
this.$confirm("确定将选择数据删除?", { |
|
confirmButtonText: "确定", |
|
cancelButtonText: "取消", |
|
type: "warning" |
|
}) |
|
.then(() => { |
|
return remove(row.id); |
|
}) |
|
.then(() => { |
|
this.onLoad(this.page); |
|
this.$message({ |
|
type: "success", |
|
message: "操作成功!" |
|
}); |
|
}); |
|
}, |
|
handleDelete() { |
|
if (this.selectionList.length === 0) { |
|
this.$message.warning("请选择至少一条数据"); |
|
return; |
|
} |
|
this.$confirm("确定将选择数据删除?", { |
|
confirmButtonText: "确定", |
|
cancelButtonText: "取消", |
|
type: "warning" |
|
}) |
|
.then(() => { |
|
return remove(this.ids); |
|
}) |
|
.then(() => { |
|
this.onLoad(this.page); |
|
this.$message({ |
|
type: "success", |
|
message: "操作成功!" |
|
}); |
|
this.$refs.crud.toggleSelection(); |
|
}); |
|
}, |
|
beforeOpen(done, type) { |
|
if (["edit", "view"].includes(type)) { |
|
getDetail(this.form.id).then(res => { |
|
this.form = res.data.data; |
|
}); |
|
} |
|
done(); |
|
}, |
|
searchReset() { |
|
this.query = {}; |
|
this.onLoad(this.page); |
|
}, |
|
searchChange(params, done) { |
|
this.query = params; |
|
this.page.currentPage = 1; |
|
this.onLoad(this.page, params); |
|
done(); |
|
}, |
|
selectionChange(list) { |
|
this.selectionList = list; |
|
}, |
|
selectionClear() { |
|
this.selectionList = []; |
|
this.$refs.crud.toggleSelection(); |
|
}, |
|
currentChange(currentPage){ |
|
this.page.currentPage = currentPage; |
|
}, |
|
sizeChange(pageSize){ |
|
this.page.pageSize = pageSize; |
|
}, |
|
onLoad(page, params = {}) { |
|
this.loading = true; |
|
getList(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => { |
|
const data = res.data.data; |
|
this.page.total = data.total; |
|
this.data = data.records; |
|
this.loading = false; |
|
this.selectionClear(); |
|
}); |
|
}, |
|
handleDetailAdd() { |
|
this.$refs.crud.rowAdd(); |
|
}, |
|
handleAuditing() { |
|
if (this.selectionList.length === 0) { |
|
this.$message.warning("请选择至少一条数据"); |
|
return; |
|
} |
|
this.$confirm("是否将选择数据审核?", { |
|
confirmButtonText: "确定", |
|
cancelButtonText: "取消", |
|
type: "warning" |
|
}) |
|
.then(() => { |
|
return auditing(this.ids); |
|
}) |
|
.then(() => { |
|
this.onLoad(this.page); |
|
this.$message({ |
|
type: "success", |
|
message: "操作成功!" |
|
}); |
|
this.$refs.crud.toggleSelection(); |
|
}); |
|
}, |
|
handleReject() { |
|
if (this.selectionList.length === 0) { |
|
this.$message.warning("请选择至少一条数据"); |
|
return; |
|
} |
|
this.$confirm("是否将选择数据审核?", { |
|
confirmButtonText: "确定", |
|
cancelButtonText: "取消", |
|
type: "warning" |
|
}) |
|
.then(() => { |
|
return reject(this.ids); |
|
}) |
|
.then(() => { |
|
this.onLoad(this.page); |
|
this.$message({ |
|
type: "success", |
|
message: "操作成功!" |
|
}); |
|
this.$refs.crud.toggleSelection(); |
|
}); |
|
}, |
|
handleExport() { |
|
this.$confirm("是否导出数据?", "提示", { |
|
confirmButtonText: "确定", |
|
cancelButtonText: "取消", |
|
type: "warning" |
|
}).then(() => { |
|
expUtil.excelExportEasy(`/api/manufacturerinfo/export?daf-auth=${getToken()}`, this.search); |
|
}); |
|
}, |
|
} |
|
}; |
|
</script> |
|
|
|
<style> |
|
</style>
|
|
|