first commit

This commit is contained in:
zc
2025-06-05 09:55:41 +08:00
commit 935360c185
459 changed files with 61034 additions and 0 deletions

View File

@@ -0,0 +1,415 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="产品名称" prop="name">
<el-input
v-model="queryParams.name"
placeholder="请输入产品名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="产品型号" prop="version">
<el-input
v-model="queryParams.version"
placeholder="请输入"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="节点类型" prop="genre">
<el-select v-model="queryParams.genre" placeholder="请选择" clearable>
<el-option
v-for="dict in dict.type.sys_product_genre"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['system:product:add']"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['system:product:edit']"
>修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['system:product:remove']"
>删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['system:product:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="productList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="产品图片地址" align="center" prop="avatar" >
<template v-slot="scope">
<el-image style="width: 80px; height: 80px" :src="scope.row.avatar" fit="cover"
:preview-src-list="[scope.row.avatar]"
/>
</template>
</el-table-column>
<el-table-column label="产品名称" align="center" prop="name" />
<el-table-column label="产品型号" align="center" prop="version" />
<el-table-column label="产品品类" align="center" prop="bigtype" >
<template v-slot="scope">
<dict-tag :options="dict.type.sys_product_bigtype" :value="scope.row.bigtype"/>
</template>
</el-table-column>
<el-table-column label="产品品类" align="center" prop="subtype" >
<template v-slot="scope">
<dict-tag :options="dict.type.sys_product_subtype" :value="scope.row.subtype"/>
</template>
</el-table-column>
<el-table-column label="节点类型" align="center" prop="genre" >
<template v-slot="scope">
<dict-tag :options="dict.type.sys_product_genre" :value="scope.row.genre"/>
</template>
</el-table-column>
<el-table-column label="产品描述" align="center" prop="describes" />
<el-table-column label="联网方式" align="center" prop="network" >
<template v-slot="scope">
<dict-tag :options="dict.type.sys_product_network" :value="scope.row.network"/>
</template>
</el-table-column>
<el-table-column label="数据格式" align="center" prop="dataFormat" />
<el-table-column label="数据校验级别" align="center" prop="scale" />
<el-table-column label="认证方式" align="center" prop="attestation" >
<template v-slot="scope">
<dict-tag :options="dict.type.sys_product_attestation" :value="scope.row.attestation"/>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['system:product:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['system:product:remove']"
>删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改产品信息对话框 -->
<el-dialog :title="title" :visible.sync="open" width="780px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="120px">
<el-row>
<el-col :span="24" >
<el-form-item label="产品图片" prop="avatar">
<image-upload v-model="form.avatar" :limit="1" :isShowTip="false"/>
</el-form-item>
</el-col>
<el-col :span="24" >
<el-form-item label="产品名称" prop="name">
<el-input v-model="form.name" placeholder="请输入产品名称" />
</el-form-item>
</el-col>
<el-col :span="24" >
<el-form-item label="产品型号" prop="version">
<el-input v-model="form.version" type="textarea" placeholder="请输入内容" />
</el-form-item>
</el-col>
<el-col :span="24" >
<el-form-item label="产品品类" prop="bigtype">
<el-select v-model="form.bigtype" placeholder="请选择" clearable>
<el-option
v-for="dict in dict.type.sys_product_bigtype"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
<el-select v-model="form.subtype" placeholder="请选择" clearable>
<el-option
v-for="dict in dict.type.sys_product_subtype"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="24" >
<el-form-item label="节点类型" prop="genre">
<el-select v-model="form.genre" placeholder="请选择" clearable>
<el-option
v-for="dict in dict.type.sys_product_genre"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select> </el-form-item>
</el-col>
<el-col :span="24" >
<el-form-item label="产品描述" prop="describes">
<el-input v-model="form.describes" placeholder="请输入产品描述" />
</el-form-item>
</el-col>
<el-col :span="24" >
<el-form-item label="联网方式" prop="network">
<el-select v-model="form.network" placeholder="请选择" clearable>
<el-option
v-for="dict in dict.type.sys_product_network"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="24" >
<el-form-item label="数据格式" prop="dataFormat">
<el-input v-model="form.dataFormat" placeholder="请输入数据格式" />
</el-form-item>
</el-col>
<el-col :span="24" >
<el-form-item label="数据校验级别" prop="scale">
<el-input v-model="form.scale" placeholder="请输入数据校验级别" />
</el-form-item>
</el-col>
<el-col :span="24" >
<el-form-item label="认证方式" prop="attestation">
<el-select v-model="form.attestation" placeholder="请选择" clearable>
<el-option
v-for="dict in dict.type.sys_product_attestation"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { listProduct, getProduct, delProduct, addProduct, updateProduct } from "@/api/system/product";
export default {
name: "Product",
/** 字典查询 */
dicts: ['sys_product_bigtype','sys_product_subtype','sys_product_genre','sys_product_network','sys_product_attestation'],
data() {
return {
// 遮罩层
loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 产品信息表格数据
productList: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
name: null,
bigtype: null,
subtype: null,
genre: null,
describes: null,
network: null,
dataFormat: null,
scale: null,
attestation: null,
},
// 表单参数
form: {},
// 表单校验
rules: {
avatar: [
{ required: true, message: "产品图片不能为空", trigger: "blur" }
],
name: [
{ required: true, message: "产品名称不能为空", trigger: "blur" }
],
version: [
{ required: true, message: "产品型号不能为空", trigger: "blur" }
],
}
};
},
created() {
this.getList();
},
methods: {
/** 查询产品信息列表 */
getList() {
this.loading = true;
listProduct(this.queryParams).then(response => {
this.productList = response.rows;
this.total = response.total;
this.loading = false;
});
},
// 取消按钮
cancel() {
this.open = false;
this.reset();
},
// 表单重置
reset() {
this.form = {
id: null,
avatar: null,
name: null,
version: null,
bigtype: null,
subtype: null,
genre: null,
describes: null,
network: null,
dataFormat: null,
scale: null,
attestation: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加产品信息";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id || this.ids
getProduct(id).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改产品信息";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != null) {
updateProduct(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addProduct(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$modal.confirm('是否确认删除产品信息编号为"' + ids + '"的数据项?').then(function() {
return delProduct(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
this.download('system/product/export', {
...this.queryParams
}, `product_${new Date().getTime()}.xlsx`)
}
}
};
</script>