| | |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item> |
| | | <el-button type="primary" @click="handleQuery">搜索</el-button> |
| | | <el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button> |
| | | <el-button icon="Refresh" @click="resetQuery">重置</el-button> |
| | | </el-form-item> |
| | | <el-form-item style="float: right"> |
| | | <el-button type="primary" icon="plus" @click="handleDialog('add')">新增</el-button> |
| | | </el-form-item> |
| | | </el-form> |
| | | </div> |
| | | <div class="table-box"> |
| | | <div class=" mt20 mb20"> |
| | | <el-button type="primary" icon="Plus" @click="handleDialog('add')">新增</el-button> |
| | | <div class="table-bg-style"> |
| | | <div class="table-box"> |
| | | <el-table :data="tableData" style="width: 100%"> |
| | | <el-table-column prop="code" label="参数编码" align="center" show-overflow-tooltip /> |
| | | <el-table-column prop="name" label="参数名称" align="center" show-overflow-tooltip /> |
| | | <el-table-column |
| | | prop="unit" |
| | | label="单位" |
| | | align="center" |
| | | show-overflow-tooltip |
| | | :formatter="(row, column) => proxy.selectDictLabel(sys_unit, row.unit)" |
| | | /> |
| | | <el-table-column prop="deviceType" label="设备类型" align="center" show-overflow-tooltip> |
| | | <template #default="scope"> |
| | | <dict-tag :options="sys_device_type" :value="scope.row.deviceType" /> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="gatewayKey" label="网关标识" align="center" show-overflow-tooltip /> |
| | | <el-table-column fixed="right" label="操作" width="180" align="center" show-overflow-tooltip> |
| | | <template #default="scope"> |
| | | <el-button link type="primary" icon="Edit" @click="handleEdit(scope.row.id)"> 修改 </el-button> |
| | | |
| | | <el-button link type="primary" icon="Delete" @click="handleDel(scope.row)"> 删除 </el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | <pagination |
| | | v-show="pageTotal > 0" |
| | | :total="pageTotal" |
| | | v-model:page="queryParams.pageNum" |
| | | v-model:limit="queryParams.pageSize" |
| | | @pagination="getList" |
| | | /> |
| | | </div> |
| | | <el-table :data="tableData" style="width: 100%"> |
| | | <el-table-column prop="code" label="参数编码" align="center" show-overflow-tooltip /> |
| | | <el-table-column prop="name" label="参数名称" align="center" show-overflow-tooltip /> |
| | | <el-table-column prop="unit" label="单位" align="center" show-overflow-tooltip |
| | | :formatter="(row, column) => proxy.selectDictLabel(sys_unit, row.unit)" /> |
| | | <el-table-column prop="deviceType" label="设备类型" align="center" show-overflow-tooltip> |
| | | <template #default="scope"> |
| | | <dict-tag :options="sys_device_type" :value="scope.row.deviceType" /> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column fixed="right" label="操作" width="180" align="center" show-overflow-tooltip> |
| | | <template #default="scope"> |
| | | <el-button link type="primary" icon="Edit" @click="handleEdit(scope.row.id)"> |
| | | 修改 |
| | | </el-button> |
| | | |
| | | <el-button link type="primary" icon="Delete" @click="handleDel(scope.row)"> |
| | | 删除 |
| | | </el-button> |
| | | </template> |
| | | |
| | | </el-table-column> |
| | | </el-table> |
| | | <pagination v-show="pageTotal > 0" :total="pageTotal" v-model:page="queryParams.pageNum" |
| | | v-model:limit="queryParams.pageSize" @pagination="getList" /> |
| | | </div> |
| | | <el-dialog v-model="dialogVisible" :title="dialogTitle" width="500"> |
| | | <el-form ref="formRef" :model="form" :rules="rules" label-width="auto"> |
| | |
| | | <el-option v-for="dict in sys_device_type" :key="dict.value" :label="dict.label" :value="dict.value" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="网关标识" prop="gatewayKey"> |
| | | <el-input v-model="form.gatewayKey" placeholder="请输入网关标识" clearable /> |
| | | </el-form-item> |
| | | </el-form> |
| | | <template #footer> |
| | | <div class="dialog-footer"> |
| | | <el-button @click="handleClose">取消</el-button> |
| | | <el-button type="primary" @click="handleOk"> |
| | | 确认 |
| | | </el-button> |
| | | <el-button type="primary" @click="handleOk"> 确认 </el-button> |
| | | </div> |
| | | </template> |
| | | </el-dialog> |
| | |
| | | </template> |
| | | |
| | | <script setup name="collect"> |
| | | import { listTemplate, addTemplate, getTempById, putTemplate, delTempById } from '@/api/modelConfiguration/collectIndicator.js' |
| | | import { reactive, ref } from 'vue'; |
| | | import { Delete, Edit, Search, Share, Upload } from '@element-plus/icons-vue' |
| | | const { proxy } = getCurrentInstance(); |
| | | const { sys_device_type } = proxy.useDict("sys_device_type"); |
| | | const { sys_unit } = proxy.useDict("sys_unit"); |
| | | |
| | | |
| | | import { |
| | | listTemplate, |
| | | addTemplate, |
| | | getTempById, |
| | | putTemplate, |
| | | delTempById, |
| | | } from "@/api/modelConfiguration/collectIndicator.js" |
| | | import { reactive, ref } from "vue" |
| | | import { Delete, Edit, Search, Share, Upload } from "@element-plus/icons-vue" |
| | | const { proxy } = getCurrentInstance() |
| | | const { sys_device_type } = proxy.useDict("sys_device_type") |
| | | const { sys_unit } = proxy.useDict("sys_unit") |
| | | |
| | | let queryParams = ref({ |
| | | pageNum: 1, |
| | |
| | | }) |
| | | let pageTotal = ref(0) |
| | | let dialogVisible = ref(false) |
| | | let dialogTitle = ref('') |
| | | let dialogTitle = ref("") |
| | | |
| | | let queryForm = ref({}) |
| | | let form = ref({}) |
| | | let tableData = ref([]) |
| | | const rules = { |
| | | code: [{ required: true, message: '请输入', trigger: 'blur' },], |
| | | name: [{ required: true, message: '请输入', trigger: 'blur' },], |
| | | unit: [{ required: true, message: '请选择', trigger: 'change' },], |
| | | deviceType: [{ required: true, message: '请选择', trigger: 'change' },], |
| | | code: [{ required: true, message: "请输入", trigger: "blur" }], |
| | | name: [{ required: true, message: "请输入", trigger: "blur" }], |
| | | unit: [{ required: true, message: "请选择", trigger: "change" }], |
| | | deviceType: [{ required: true, message: "请选择", trigger: "change" }], |
| | | } |
| | | |
| | | function handleQuery() { |
| | |
| | | getList() |
| | | } |
| | | |
| | | |
| | | function resetQuery() { |
| | | queryForm.value = {} |
| | | queryParams.value.pageNum = 1 |
| | | getList() |
| | | } |
| | | function handleEdit(id) { |
| | | getTempById({ id }).then(res => { |
| | | getTempById({ id }).then((res) => { |
| | | if (res.code == 200) { |
| | | handleDialog() |
| | | form.value = JSON.parse(JSON.stringify(res.data)) |
| | |
| | | } |
| | | |
| | | function handleDel(row) { |
| | | proxy.$modal.confirm('是否确认删除指标名为"' + row.name + '"的数据项?', '警告', { |
| | | confirmButtonText: '确定', |
| | | cancelButtonText: '取消', |
| | | type: 'warning' |
| | | }).then(() => { |
| | | return delTempById(row.id) |
| | | }).then(() => { |
| | | getList() |
| | | proxy.$modal.msgSuccess('删除成功') |
| | | }).catch(function () { |
| | | }) |
| | | |
| | | proxy.$modal |
| | | .confirm('是否确认删除指标名为"' + row.name + '"的数据项?', "警告", { |
| | | confirmButtonText: "确定", |
| | | cancelButtonText: "取消", |
| | | type: "warning", |
| | | }) |
| | | .then(() => { |
| | | return delTempById(row.id) |
| | | }) |
| | | .then(() => { |
| | | getList() |
| | | proxy.$modal.msgSuccess("删除成功") |
| | | }) |
| | | .catch(function () {}) |
| | | } |
| | | |
| | | function getList() { |
| | | let params = { |
| | | ...queryParams.value, |
| | | ...queryForm.value |
| | | ...queryForm.value, |
| | | } |
| | | listTemplate(params).then(res => { |
| | | tableData.value = res.rows; |
| | | listTemplate(params).then((res) => { |
| | | tableData.value = res.rows |
| | | pageTotal.value = res.total |
| | | }); |
| | | }) |
| | | } |
| | | |
| | | function handleDialog(type) { |
| | | if (type == 'add') { |
| | | dialogTitle = '新增采集参数模版' |
| | | if (type == "add") { |
| | | dialogTitle = "新增采集参数模版" |
| | | } else { |
| | | dialogTitle = '修改采集参数模版' |
| | | dialogTitle = "修改采集参数模版" |
| | | } |
| | | dialogVisible.value = true |
| | | } |
| | | |
| | | function handleOk() { |
| | | proxy.$refs.formRef.validate(valid => { |
| | | console.log('valid===>', valid); |
| | | proxy.$refs.formRef.validate((valid) => { |
| | | console.log("valid===>", valid) |
| | | if (valid) { |
| | | if (form.value.id) { |
| | | putTemplate(form.value).then(res => { |
| | | putTemplate(form.value).then((res) => { |
| | | proxy.$modal.msgSuccess(res.msg) |
| | | dialogVisible.value = false |
| | | getList() |
| | | }) |
| | | } else { |
| | | addTemplate(form.value).then(res => { |
| | | console.log('res===>新增', res); |
| | | addTemplate(form.value).then((res) => { |
| | | console.log("res===>新增", res) |
| | | proxy.$modal.msgSuccess(res.msg) |
| | | dialogVisible.value = false |
| | | getList() |
| | | }) |
| | | } |
| | | |
| | | } |
| | | }) |
| | | |
| | | } |
| | | |
| | | function handleClose() { |
| | |
| | | } |
| | | |
| | | getList() |
| | | |
| | | </script> |
| | | |
| | | <style lang="scss" scoped> |