Commit b7ab2de4 authored by 祁正's avatar 祁正

国际品牌管理

parent 67c00a60
......@@ -12,7 +12,7 @@
</div>
<el-table style="margin-top: 15px" border v-loading="loading" :data="brandDataList" @selection-change="handleSelectionChange">
<el-table-column type="index" label="序号" width="105" align="center" >
<el-table-column type="index" label="序号" width="175" align="center" >
<template #header>
<div style="display: flex;flex-direction: column">
<div>{{cn.serialNumber}}</div>
......@@ -134,6 +134,7 @@ const data = reactive({
queryParams: {
pageNum: 1,
pageSize: 10,
type:"国内"
},
rules: {
type: [
......
<template>
<div class="app-container">
<div style="width: 100%;display: flex;align-items: center;justify-content: flex-end">
<el-button
plain
class="btn-C"
@click="handleAdd"
style=""
>{{cn.handleAdd}}/{{en.handleAdd}}</el-button>
</div>
<el-table style="margin-top: 15px" border v-loading="loading" :data="brandDataList" @selection-change="handleSelectionChange">
<el-table-column type="index" label="序号" width="175" align="center" >
<template #header>
<div style="display: flex;flex-direction: column">
<div>{{cn.serialNumber}}</div>
<div>{{en.serialNumber}}</div>
</div>
</template>
</el-table-column>
<el-table-column label="类型" align="center" prop="type" >
<template #header>
<div style="display: flex;flex-direction: column">
<div>{{cn.type}}</div>
<div>{{en.type}}</div>
</div>
</template>
</el-table-column>
<el-table-column label="品牌" align="center" prop="brand" >
<template #header>
<div style="display: flex;flex-direction: column">
<div>{{cn.brand}}</div>
<div>{{en.brand}}</div>
</div>
</template>
</el-table-column>
<el-table-column label="更新人" align="center" prop="updateUserName" >
<template #header>
<div style="display: flex;flex-direction: column">
<div>{{cn.updateUserName}}</div>
<div>{{en.updateUserName}}</div>
</div>
</template>
</el-table-column>
<el-table-column label="更新时间" align="center" prop="updateTime">
<template #header>
<div style="display: flex;flex-direction: column">
<div>{{cn.updateTime}}</div>
<div>{{en.updateTime}}</div>
</div>
</template>
</el-table-column>
<el-table-column label="备注" align="center" prop="remark" >
<template #header>
<div style="display: flex;flex-direction: column">
<div>{{cn.remark}}</div>
<div>{{en.remark}}</div>
</div>
</template>
<template #default="scope">
{{scope.row.remark || '--'}}
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template #header>
<div style="display: flex;flex-direction: column">
<div>{{cn.operation}}</div>
<div>{{en.operation}}</div>
</div>
</template>
<template #default="scope">
<el-button link type="primary" @click="handleUpdate(scope.row)" >{{cn.handleUpdate}}/{{en.handleUpdate}}</el-button>
<el-button link type="danger" @click="handleDelete(scope.row)" >{{cn.handleDelete}}/{{en.handleDelete}}</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
v-model:page="queryParams.pageNum"
v-model:limit="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改国际品牌数据对话框 -->
<el-dialog top="30" :title="title" v-model="open" width="500px" append-to-body>
<el-form ref="brandDataRef" label-position="top" :model="form" :rules="rules" label-width="80px">
<el-form-item :label="`${cn.type}/${en.type}`" prop="type">
<el-input v-model="form.type" disabled placeholder="请输入类型" />
</el-form-item>
<el-form-item :label="`${cn.brand}/${en.brand}`" prop="brand">
<el-input v-model="form.brand" placeholder="请输入品牌" />
</el-form-item>
<el-form-item :label="`${cn.remark}/${en.remark}`" prop="remark">
<el-input v-model="form.remark" placeholder="请输入内容" />
</el-form-item>
</el-form>
<template #footer>
<div class="dialog-footer">
<el-button class="btn-A" type="primary" @click="submitForm">{{cn.submitForm}}/{{en.submitForm}}</el-button>
<el-button class="btn-B" @click="cancel">{{cn.cancel}}/{{en.cancel}}</el-button>
</div>
</template>
</el-dialog>
</div>
</template>
<script setup >
import { listBrandData, getBrandData, delBrandData, addBrandData, updateBrandData } from "@/api/brandData/brandData";
import cn from "@/locales/system/domesticBrand/cn.json"
import en from "@/locales/system/domesticBrand/en.json"
const { proxy } = getCurrentInstance();
const brandDataList = ref([]);
const open = ref(false);
const loading = ref(true);
const showSearch = ref(true);
const ids = ref([]);
const single = ref(true);
const multiple = ref(true);
const total = ref(0);
const title = ref("");
const form = ref({
type:'国际'
})
const data = reactive({
queryParams: {
pageNum: 1,
pageSize: 10,
type:"国际"
},
rules: {
type: [
{ required: true, message: "类型不能为空", trigger: "blur" }
],
brand: [
{ required: true, message: "品牌不能为空", trigger: "blur" }
],
}
});
const { queryParams, rules } = toRefs(data);
/** 查询国际品牌数据列表 */
function getList() {
loading.value = true;
listBrandData(queryParams.value).then(response => {
brandDataList.value = response.rows;
total.value = response.total;
loading.value = false;
});
}
// 取消按钮
function cancel() {
open.value = false;
reset();
}
// 表单重置
function reset() {
form.value = {
brand: null,
remark: null,
type:"国际"
};
}
/** 搜索按钮操作 */
function handleQuery() {
queryParams.value.pageNum = 1;
getList();
}
/** 重置按钮操作 */
function resetQuery() {
proxy.resetForm("queryRef");
handleQuery();
}
// 多选框选中数据
function handleSelectionChange(selection) {
ids.value = selection.map(item => item.id);
single.value = selection.length != 1;
multiple.value = !selection.length;
}
/** 新增按钮操作 */
function handleAdd() {
reset();
open.value = true;
title.value = cn.add + '/' + en.add;
}
/** 修改按钮操作 */
function handleUpdate(row) {
reset();
const _id = row.id || ids.value
getBrandData(_id).then(response => {
form.value = response.data;
open.value = true;
title.value = cn.handleUpdate + "/" +en.handleUpdate;
});
}
/** 提交按钮 */
function submitForm() {
proxy.$refs["brandDataRef"].validate(valid => {
if (valid) {
if (form.value.id != null) {
updateBrandData(form.value).then(response => {
proxy.$modal.msgSuccess("修改成功");
open.value = false;
getList();
});
} else {
addBrandData(form.value).then(response => {
proxy.$modal.msgSuccess("新增成功");
open.value = false;
getList();
});
}
}
});
}
/** 删除按钮操作 */
function handleDelete(row) {
const _ids = row.id || ids.value;
proxy.$modal.confirm('是否确认删除该数据项?').then(function() {
return delBrandData(_ids);
}).then(() => {
getList();
proxy.$modal.msgSuccess("删除成功");
}).catch(() => {});
}
/** 导出按钮操作 */
function handleExport() {
proxy.download('brandData/brandData/export', {
...queryParams.value
}, `brandData_${new Date().getTime()}.xlsx`)
}
getList();
</script>
<style scoped lang="scss">
:deep(.el-pagination) {
display: flex;
justify-content: center;
width: 100%;
margin-top: 24px;
}
:deep(.el-pagination.is-background .el-pager li.is-active){
background-color: #0154FB;
}
</style>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment