diff --git a/src/api/basedata/eqpbook/channel.js b/src/api/basedata/eqpbook/channel.js index 8b54185..a343bb3 100644 --- a/src/api/basedata/eqpbook/channel.js +++ b/src/api/basedata/eqpbook/channel.js @@ -30,7 +30,7 @@ export function eqpbookList(query) { // 新增 export function postAdd(query) { return request({ - url: '/basedata/alg', + url: '/basedata/eqpbook/channel', method: 'post', data: query }) @@ -39,14 +39,14 @@ export function postAdd(query) { // 编辑查询 export function getItem(query) { return request({ - url: `/basedata/alg/${query}`, + url: `/basedata/eqpbook/channel/${query}`, method: 'get', }) } // 编辑 export function edit(query) { return request({ - url: `/basedata/alg/edit`, + url: `/basedata/eqpbook/channel/edit`, method: 'post', data: query }) diff --git a/src/api/basedata/patrolpointmnt/patrolpoint.js b/src/api/basedata/patrolpointmnt/patrolpoint.js new file mode 100644 index 0000000..5c698a8 --- /dev/null +++ b/src/api/basedata/patrolpointmnt/patrolpoint.js @@ -0,0 +1,42 @@ +import request from '@/utils/request'; +// 初始化list +export function getList(query) { + return request({ + url: '/basedata/patrolpointmnt/patrolpoint/list', + method: 'get', + params: query + }) +} +// 删除 +export function postRemove(query) { + return request({ + url: `/basedata/patrolpointmnt/patrolpoint/remove/${query}`, + method: 'post', + // params: query + }) +} + +// 新增 +export function postAdd(query) { + return request({ + url: '/basedata/patrolpointmnt/patrolpoint', + method: 'post', + data: query + }) +} + +// 编辑查询 +export function getItem(query) { + return request({ + url: `/basedata/patrolpointmnt/patrolpoint/${query}`, + method: 'get', + }) +} +// 编辑 +export function edit(query) { + return request({ + url: `/basedata/patrolpointmnt/patrolpoint/edit`, + method: 'post', + data: query + }) +} \ No newline at end of file diff --git a/src/views/basedata/eqpbook/channel/index.vue b/src/views/basedata/eqpbook/channel/index.vue index c76c30c..345ae67 100644 --- a/src/views/basedata/eqpbook/channel/index.vue +++ b/src/views/basedata/eqpbook/channel/index.vue @@ -50,7 +50,7 @@ >{{ $t("share.search") }} {{ - $t("share.search") + $t("share.reset") }} @@ -99,30 +99,35 @@ + + + + + {{ $t("share.edit") }} - + + - + + - + + + - + + + + + + + + + + + + {{ $t("share.cancel") }} - {{ + {{ $t("share.confirm") }} @@ -323,9 +346,13 @@ export default { total: 10, dialogVisible: false, title: this.$t("channel.AddDeviceChannel"), - dialogForm: {}, + dialogForm: { + channelName: "", + channelType: "", + eqpbookId: "", + }, // 只保留一次定义 rules: { - ChannelName: [ + channelName: [ { required: true, message: @@ -335,26 +362,25 @@ export default { trigger: "blur", }, ], - ChannelType: [ + channelType: [ { required: true, message: this.$t("share.PleaseChoose") + " " + this.$t("channel.ChannelType"), - trigger: "blur", + trigger: "change", }, ], - device: [ + eqpbookId: [ { required: true, message: this.$t("share.PleaseChoose") + " " + this.$t("channel.device"), - trigger: "blur", + trigger: "change", }, ], }, - dialogForm: {}, type: 0, ids: [], eqpbookListData: [], @@ -394,21 +420,22 @@ export default { this.dialogVisible = false; }, add() { + this.type=0; + this.dialogForm = { + channelName: "", + channelType: "", + eqpbookId: "", + }; this.dialogVisible = true; this.title = this.$t("channel.AddDeviceChannel"); }, - handleEdit() { + handleEdit(id) { + this.type=1; this.dialogVisible = true; this.title = this.$t("channel.EditDeviceChannel"); - }, - onSubmit() { - this.$refs["ruleForm"].validate((v) => { - if (v) { - this.$message({ - message: this.$t("share.success"), - type: "success", - }); - this.dialogVisible = false; + getItem(id).then((res) => { + if(res.code==200){ + this.dialogForm = res.data; } }); }, @@ -447,31 +474,35 @@ export default { this.ids = selection.map((item) => item.channelId); }, // 弹框确定 - submitForm() { - return; - if (this.type == 0) { - postAdd(this.dialogForm).then((res) => { - if (res.code == 200) { - this.$message({ - type: "success", - message: "添加成功!", + submitForm(ruleForm) { + console.log(this.dialogForm); + this.$refs[ruleForm].validate((v) => { + if (v) { + if (this.type == 0) { + postAdd(this.dialogForm).then((res) => { + if (res.code == 200) { + this.$message({ + type: "success", + message: "添加成功!", + }); + this.dialogVisible = false; + this.init(); + } }); - this.dialogVisible = false; - this.init(); - } - }); - } else { - edit(this.dialogForm).then((res) => { - if (res.code == 200) { - this.$message({ - type: "success", - message: "编辑成功!", + } else { + edit(this.dialogForm).then((res) => { + if (res.code == 200) { + this.$message({ + type: "success", + message: "编辑成功!", + }); + this.dialogVisible = false; + this.init(); + } }); - this.dialogVisible = false; - this.init(); } - }); - } + } + }); }, }, }; diff --git a/src/views/basedata/patrolpointmnt/patrolpoint/index.vue b/src/views/basedata/patrolpointmnt/patrolpoint/index.vue index b7fa2e5..8a7f890 100644 --- a/src/views/basedata/patrolpointmnt/patrolpoint/index.vue +++ b/src/views/basedata/patrolpointmnt/patrolpoint/index.vue @@ -3,6 +3,7 @@ {{ $t("share.new") }} - - {{ - $t("share.edit") - }} - - + + @@ -75,38 +82,40 @@ align="center" > - + + @@ -117,6 +126,7 @@ :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" + @pagination="init" /> - + - + - + - - + + - - + + - {{ $t('share.cancel') }} - {{ $t('share.confirm') }} + {{ $t("share.cancel") }} + {{ + $t("share.confirm") + }} @@ -196,7 +222,12 @@ height="500px" > - + // import Editor from "@/components/Editor"; +import { + getList, + getItem, + postAdd, + postRemove, + edit, + postUpdate, +} from "@/api/basedata/patrolpointmnt/patrolpoint"; export default { data() { return { - queryParams: {}, + queryParams: { + pageNum: 1, + pageSize: 10, + }, tableData: [], total: 10, dialogVisible: false, - title: this.$t('patrolpoint.AddInspectionPoints'), - typeTitle: this.$t('patrolpoint.SetIntelligentRecognitionType'), + title: this.$t("patrolpoint.AddInspectionPoints"), + typeTitle: this.$t("patrolpoint.SetIntelligentRecognitionType"), typedialogVisible: false, - rules:{ - PointName: [ - { required: true, message:this.$t('share.PleaseEnter')+' '+ this.$t('share.PointName'), trigger: 'blur' } - - ] - } + dialogForm: {}, + rules: { + patrolpointName: [ + { + required: true, + message: "请输入点位名称", + trigger: "blur", + }, + ], + }, }; }, - mounted() {}, + mounted() { + this.init(); + }, methods: { + // 初始化 + init() { + getList(this.queryParams).then((res) => { + this.tableData = res.rows; + this.total = res.data.total; + }); + }, + // 查询 + handleQuery() { + this.init(); + }, + // 重置 + resetQuery() { + this.queryParams = {}; + this.init(); + }, // 给表头加必填符号* addRedStar(h, { column }) { return [ @@ -253,16 +317,83 @@ export default { ]; }, add() { + this.dialogForm = {}; + this.type = 0; this.dialogVisible = true; - this.title=this.$t('patrolpoint.AddInspectionPoints') + this.title = this.$t("patrolpoint.AddInspectionPoints"); }, - handleEdit(){ + handleEdit(id) { + this.type = 1; this.dialogVisible = true; - this.title=this.$t('patrolpoint.EditInspectionPoints') + this.title = this.$t("patrolpoint.EditInspectionPoints"); + getItem(id).then((res) => { + if(res.code==200){ + this.dialogForm = res.data; + } + }); }, tableTyle() { this.typedialogVisible = true; }, + // 新增修改弹框确认 + submitForm(ruleForm) { + this.$refs[ruleForm].validate((v) => { + if (v) { + if (this.type == 0) { + postAdd(this.dialogForm).then((res) => { + if (res.code == 200) { + this.$message({ + type: "success", + message: "添加成功!", + }); + this.dialogVisible = false; + this.init(); + } + }); + } else { + edit(this.dialogForm).then((res) => { + if (res.code == 200) { + this.$message({ + type: "success", + message: "编辑成功!", + }); + this.dialogVisible = false; + this.init(); + } + }); + } + } + }); + }, + handleClose() { + this.dialogVisible = false; + }, + // 删除 + // 删除 + handleDelete(id) { + this.$confirm(`确定要删除Id为${id}的数据吗?`, "删除", { + confirmButtonText: "确定", + cancelButtonText: "取消", + type: "warning", + }) + .then(() => { + postRemove(id).then((res) => { + if (res.code == 200) { + this.$message({ + type: "success", + message: "删除成功!", + }); + this.init(); + } + }); + }) + .catch(() => { + this.$message({ + type: "info", + message: "已取消删除", + }); + }); + }, }, };