From 75f043dfa6660716364e66ee0b3cf99f44255686 Mon Sep 17 00:00:00 2001 From: DYL0109 <dn18191638832@163.com> Date: 星期三, 16 四月 2025 19:20:36 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/develop1.0' into dyl_dev --- zhitan-vue/src/views/modelconfiguration/collectindicator/collectIndicator.vue | 159 ++++++++++++++++++++++++++++------------------------ 1 files changed, 85 insertions(+), 74 deletions(-) diff --git a/zhitan-vue/src/views/modelconfiguration/collectindicator/collectIndicator.vue b/zhitan-vue/src/views/modelconfiguration/collectindicator/collectIndicator.vue index 7ba4ec1..6b9fab2 100644 --- a/zhitan-vue/src/views/modelconfiguration/collectindicator/collectIndicator.vue +++ b/zhitan-vue/src/views/modelconfiguration/collectindicator/collectIndicator.vue @@ -14,40 +14,48 @@ </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"> @@ -67,13 +75,14 @@ <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> @@ -81,14 +90,18 @@ </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, @@ -96,16 +109,16 @@ }) 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() { @@ -113,14 +126,13 @@ 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)) @@ -129,62 +141,62 @@ } 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() { @@ -194,7 +206,6 @@ } getList() - </script> <style lang="scss" scoped> -- Gitblit v1.9.3