From 03abaa317408167c3840fac31aeb86874b8a220d Mon Sep 17 00:00:00 2001 From: wxh <458319019@qq.com> Date: Tue, 30 Jul 2024 09:53:45 +0800 Subject: [PATCH 1/6] =?UTF-8?q?feat:=20=E4=BA=BA=E5=91=98=E7=AE=A1?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ant-vue/src/api/index.ts | 6 ++ ant-vue/src/components/select/DeptSelect.vue | 48 ++++++++++------ ant-vue/src/i18n/en.ts | 2 +- ant-vue/src/i18n/zh-CHS.ts | 2 +- ant-vue/src/plugins/vxe-table.ts | 4 +- ant-vue/src/views/dept/index.vue | 7 ++- ant-vue/src/views/product/index.vue | 4 +- ant-vue/src/views/role/index.vue | 7 ++- ant-vue/src/views/user/index.vue | 59 +++++++++++++++++--- 9 files changed, 105 insertions(+), 34 deletions(-) diff --git a/ant-vue/src/api/index.ts b/ant-vue/src/api/index.ts index 105aa30..60d6fed 100644 --- a/ant-vue/src/api/index.ts +++ b/ant-vue/src/api/index.ts @@ -261,9 +261,15 @@ export async function UserDelete(id: any) { export async function UserBindRole(data: any) { return await axios.post(`${url}/User/BindRole`, data); } +export async function UserBindDept(data: any) { + return await axios.post(`${url}/User/BindDept`, data); +} export async function UserQueryBindRole(params: any) { return await axios.get(`${url}/User/QueryBindRole?user_id=${params}`, ); } +export async function UserQueryBindDept(params: any) { + return await axios.get(`${url}/User/QueryBindDept?user_id=${params}`, ); +} //产品 export async function ProductPage(params: any) { diff --git a/ant-vue/src/components/select/DeptSelect.vue b/ant-vue/src/components/select/DeptSelect.vue index 147d6a3..1653ebf 100644 --- a/ant-vue/src/components/select/DeptSelect.vue +++ b/ant-vue/src/components/select/DeptSelect.vue @@ -1,15 +1,15 @@ + + + 生产计划 + \ No newline at end of file diff --git a/ant-vue/src/views/user/index.vue b/ant-vue/src/views/user/index.vue index b150798..17a8be0 100644 --- a/ant-vue/src/views/user/index.vue +++ b/ant-vue/src/views/user/index.vue @@ -34,7 +34,7 @@ {{$t('message.edit')}} {{$t('message.assigningRoles')}} - 分配部门 + {{$t('message.assigningDept')}} {{$t('message.delete')}} -- Gitee From 8db0c968702bc382b7b066cc5b451898b41a7f18 Mon Sep 17 00:00:00 2001 From: wxh <458319019@qq.com> Date: Tue, 30 Jul 2024 10:32:46 +0800 Subject: [PATCH 3/6] fix: sa --- ant-vue/src/views/production-plans/index.vue | 259 ++++++++++++++++++- 1 file changed, 255 insertions(+), 4 deletions(-) diff --git a/ant-vue/src/views/production-plans/index.vue b/ant-vue/src/views/production-plans/index.vue index b49d94c..cb73a6d 100644 --- a/ant-vue/src/views/production-plans/index.vue +++ b/ant-vue/src/views/production-plans/index.vue @@ -1,7 +1,258 @@ - + \ No newline at end of file -- Gitee From ada3a89272d95f4607737effaab8336af88f61a4 Mon Sep 17 00:00:00 2001 From: wxh <458319019@qq.com> Date: Wed, 31 Jul 2024 14:21:56 +0800 Subject: [PATCH 4/6] =?UTF-8?q?fix:=20=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ant-vue/src/api/index.ts | 7 +- ant-vue/src/components/select/Product.vue | 12 +- ant-vue/src/views/production-plans/index.vue | 118 ++++++++++++------- 3 files changed, 93 insertions(+), 44 deletions(-) diff --git a/ant-vue/src/api/index.ts b/ant-vue/src/api/index.ts index b9beebf..faf8743 100644 --- a/ant-vue/src/api/index.ts +++ b/ant-vue/src/api/index.ts @@ -306,8 +306,11 @@ export async function ProductionPlanCreate(data: any) { return await axios.post(`${url}/ProductionPlan/create`, data); } export async function ProductionPlanUpdate(data: any) { - return await axios.post(`${url}/ProductionPlan/change_state`, data); + return await axios.post(`${url}/ProductionPlan/update`, data); } export async function ProductionPlanDelete(id: any) { - return await axios.post(`${url}/SimCard/delete/${id}`); + return await axios.post(`${url}/ProductionPlan/delete/${id}`); +} +export async function ProductionPlanDetail(id: any) { + return await axios.get(`${url}/ProductionPlan/${id}`); } \ No newline at end of file diff --git a/ant-vue/src/components/select/Product.vue b/ant-vue/src/components/select/Product.vue index e86b602..308220f 100644 --- a/ant-vue/src/components/select/Product.vue +++ b/ant-vue/src/components/select/Product.vue @@ -14,7 +14,7 @@ const { t } = useI18n(); const page = ref(1); const pageSelect = ref(1); const options = ref([]); -const value = ref(props.modelValue); +const value = ref(); const valueResult = ref(""); const valueSearch = ref(""); const showOpen = ref(false); @@ -24,7 +24,7 @@ const List = async () => { const { data } = await ProductPage({ name: "", page: page.value, page_size: 100 }); const listArr = data.data.data.map((item: any) => ({ value: item.ID, label: item.name })); options.value = options.value.concat(listArr); - if (Number(props.modelValue) && !options.value.map((it) => it.value).includes(Number(props.modelValue))) { + if (Number(props.modelValue) && !options.value.map((it: any) => it.value).includes(Number(props.modelValue))) { page.value++; await List(); } else { @@ -40,6 +40,12 @@ const List = async () => { valueResult.value = value.value; }; +watch(()=>props.modelValue,(newValue)=>{ + console.log(newValue) + if(newValue) { + value.value = newValue + } +}) const select = async (ValueClick: any) => { if (ValueClick === -11) { value.value = valueResult.value; @@ -98,6 +104,8 @@ watch(value, async (newValue) => { page.value = 1; valueSearch.value = ""; await List(); + }else { + emits("update:modelValue", newValue); } }); diff --git a/ant-vue/src/views/production-plans/index.vue b/ant-vue/src/views/production-plans/index.vue index cb73a6d..a17f82d 100644 --- a/ant-vue/src/views/production-plans/index.vue +++ b/ant-vue/src/views/production-plans/index.vue @@ -13,16 +13,13 @@ - - - - - - {{ column.dataIndex === 'expiration'?formatDate(text):text }} - - + + {{formatDate(text)}} + + + {{formatDate(text)}} - + {{$t('message.save')}} @@ -31,7 +28,7 @@ - {{$t('message.edit')}} + {{$t('message.edit')}} {{$t('message.delete')}} @@ -41,19 +38,34 @@ - + - + - + - + + + + + 准备中 + 进行中 + 已完成 + - + + + + + + + + + - + @@ -63,16 +75,15 @@ - \ No newline at end of file -- Gitee From 8e7c14ed40466e813a3096ee8c3b949c05621457 Mon Sep 17 00:00:00 2001 From: wxh <458319019@qq.com> Date: Wed, 7 Aug 2024 16:17:14 +0800 Subject: [PATCH 5/6] =?UTF-8?q?fix:=20=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ant-vue/src/components/select/Product.vue | 22 ++- ant-vue/src/i18n/en.ts | 12 ++ ant-vue/src/i18n/zh-CHS.ts | 12 ++ ant-vue/src/views/mqtt-management/index.vue | 2 +- ant-vue/src/views/production-plans/index.vue | 130 +++++++++++------- .../src/views/signal-configuration/index.vue | 35 ++++- 6 files changed, 151 insertions(+), 62 deletions(-) diff --git a/ant-vue/src/components/select/Product.vue b/ant-vue/src/components/select/Product.vue index 308220f..dfa77b7 100644 --- a/ant-vue/src/components/select/Product.vue +++ b/ant-vue/src/components/select/Product.vue @@ -14,15 +14,16 @@ const { t } = useI18n(); const page = ref(1); const pageSelect = ref(1); const options = ref([]); -const value = ref(); +const value = ref(props.modelValue); const valueResult = ref(""); const valueSearch = ref(""); const showOpen = ref(false); +const unit = ref(''); -const emits = defineEmits(["update:modelValue"]); +const emits = defineEmits(["update:modelValue",'dataUnit']); const List = async () => { const { data } = await ProductPage({ name: "", page: page.value, page_size: 100 }); - const listArr = data.data.data.map((item: any) => ({ value: item.ID, label: item.name })); + const listArr = data.data.data.map((item: any) => ({ value: item.ID, label: item.name,unit:item.sku })); options.value = options.value.concat(listArr); if (Number(props.modelValue) && !options.value.map((it: any) => it.value).includes(Number(props.modelValue))) { page.value++; @@ -36,12 +37,18 @@ const List = async () => { }); } } + if(!unit.value) { + unit.value = options.value.filter((it:any)=>it.value===value.value)[0]?.unit + console.log(unit.value) + emits("dataUnit", unit.value); + } + emits("update:modelValue", value.value); + // emits("dataUnit", unit.value); valueResult.value = value.value; }; watch(()=>props.modelValue,(newValue)=>{ - console.log(newValue) if(newValue) { value.value = newValue } @@ -54,7 +61,7 @@ const select = async (ValueClick: any) => { await List(); } else { const { data } = await ProductPage({ name: valueSearch.value, page: pageSelect.value, page_size: 100 }); - const listArr = data.data.data.map((item: any) => ({ value: item.ID, label: item.name })); + const listArr = data.data.data.map((item: any) => ({ value: item.ID, label: item.name, unit:item.sku })); options.value = options.value.concat(listArr); if (data.data.total > 0 && options.value.length < data.data.total) { pageSelect.value++; @@ -87,7 +94,7 @@ const handleSearch = async (val: string) => { return; } options.value = []; - const listArr = data.data.data.map((item: any) => ({ value: item.ID, label: item.name })); + const listArr = data.data.data.map((item: any) => ({ value: item.ID, label: item.name, unit:item.sku })); options.value = options.value.concat(listArr); if (data.data.total > 0 && options.value.length < data.data.total) { pageSelect.value++; @@ -105,6 +112,9 @@ watch(value, async (newValue) => { valueSearch.value = ""; await List(); }else { + value.value = newValue + unit.value = options.value.filter((it:any)=>it.value===value.value)[0]?.unit + emits("dataUnit", unit.value); emits("update:modelValue", newValue); } }); diff --git a/ant-vue/src/i18n/en.ts b/ant-vue/src/i18n/en.ts index 676dd28..3a0d038 100644 --- a/ant-vue/src/i18n/en.ts +++ b/ant-vue/src/i18n/en.ts @@ -254,6 +254,18 @@ const en = { mongo: "mongo", mysql: "mysql", token: "token", + // 生产计划 + productionPlanStartDate: 'Production plan start date', + endDateOfProductionPlan: 'Production plan End date', + describe: 'Describe', + preparing: 'Preparing', + ongoing: 'Ongoing', + finished: 'Finished', + productionPlanName: 'Production Plan Name', + productionName: 'Production Name', + pleaseEnterTheQuantity: 'Please enter the quantity', + pleaseSelectADate: 'Please select a date', + pleaseSelectStatus: 'Please select daily status' }, }; diff --git a/ant-vue/src/i18n/zh-CHS.ts b/ant-vue/src/i18n/zh-CHS.ts index 89aa3aa..b4457c2 100644 --- a/ant-vue/src/i18n/zh-CHS.ts +++ b/ant-vue/src/i18n/zh-CHS.ts @@ -254,6 +254,18 @@ const zhCHS = { mongo: "mongo", mysql: "mysql", token: "token", + // 生产计划 + productionPlanStartDate: '生产计划开始日期', + endDateOfProductionPlan: '生产计划结束日期', + describe: '描述', + preparing: '准备中', + ongoing: '进行中', + finished: '已完成', + productionPlanName: '生产计划名称', + productionName: '生产产品', + pleaseEnterTheQuantity: '请输入数量', + pleaseSelectADate: '请选择日期', + pleaseSelectStatus: '请选择状态' }, }; diff --git a/ant-vue/src/views/mqtt-management/index.vue b/ant-vue/src/views/mqtt-management/index.vue index d6e7f37..44070dd 100644 --- a/ant-vue/src/views/mqtt-management/index.vue +++ b/ant-vue/src/views/mqtt-management/index.vue @@ -191,7 +191,7 @@ let rules: Record = { subtopic: [{ required: true, message: t('message.pleaseTopic'), trigger: "blur" }], payload: [{ required: true, message: t('message.pleaseMessage'), trigger: "blur" }], qos: [{ required: true, message: t('message.pleaseService'), trigger: "change" }], - topic: [{ required: true, message: t('message.pleaseTopic'), trigger: "blur" }], + topic: [{ required: true, message: t('message.pleaseTopic'), trigger: "change" }], retained: [{ required: true, message: t('message.pleaseChooseMessage'), trigger: "change" }], }; const routerStore = useRouterNameStore(); diff --git a/ant-vue/src/views/production-plans/index.vue b/ant-vue/src/views/production-plans/index.vue index a17f82d..78c511e 100644 --- a/ant-vue/src/views/production-plans/index.vue +++ b/ant-vue/src/views/production-plans/index.vue @@ -9,7 +9,7 @@ {{ $t('message.search') }} - {{ $t('message.addition') }} + {{ $t('message.addition') }} @@ -38,32 +38,30 @@ - + - - + + - - + + - - - - - - 准备中 - 进行中 - 已完成 + + + {{ $t('message.preparing') }} + {{ $t('message.ongoing') }} + {{ $t('message.finished') }} - - + + - + - - - + + + + ({{item.unit}}) + + - @@ -84,7 +82,10 @@ import {message} from "ant-design-vue"; import dayjs from "dayjs"; import Product from '@/components/select/Product.vue' import {cloneDeep} from "lodash-es"; - +import utc from 'dayjs/plugin/utc'; +import timezone from 'dayjs/plugin/timezone'; +dayjs.extend(utc); +dayjs.extend(timezone); interface DataItem { name: string; description: string; @@ -99,6 +100,7 @@ const pagination = reactive({ pageSize: 10, showSizeChanger: true, // 显示每页显示条目数选择器 }); +const disabled = ref(false); const nameStr = ref(''); const modalVisible = ref(false); const form = reactive({ @@ -107,7 +109,8 @@ const form = reactive({ end_date: '', status:'', description: '', - product_plans: [{product_id: '',quantity: '' }], + date: '', + product_plans: [{product_id: '',quantity: '',unit: '' }], }); const list = ref([]); const columns = ref([ @@ -120,19 +123,19 @@ const columns = ref([ dataIndex: "name", }, { - title: '生产计划开始日期', + title: t('message.productionPlanStartDate'), dataIndex: "start_date", }, { - title: '生产计划结束日期', + title: t('message.endDateOfProductionPlan'), dataIndex: "end_date", }, { - title: '描述', + title: t('message.describe'), dataIndex: "description", }, { - title: '状态', + title: t('message.status'), dataIndex: "status_name", }, { @@ -140,14 +143,16 @@ const columns = ref([ dataIndex: "operation", } ]); -const statusName = {'1':'准备中','2':'进行中','3':'已完成'} +const title = ref(''); + +let statusName = {'1': t('message.preparing'),'2': t('message.ongoing'),'3': t('message.finished')} let rules: Record = { - name: [{ required: true, message: t('message.pleaseEnterOperatorName'), trigger: "change" }], - start_date: [{ required: true, message: t('message.pleaseEnterImsi'), trigger: "change" }], - end_date: [{ required: true, message: t('message.pleaseEnterIccid'), trigger: "change" }], - description: [{ required: true, message: t('message.pleaseEnterAccessNumber'), trigger: "change" }], + name: [{ required: true, message: t('message.pleaseName'), trigger: "change" }], + date: [{ required: true, message: t('message.pleaseSelectADate'), trigger: "change" }], + status: [{ required: true, message: t('message.pleaseSelectStatus'), trigger: "change" }], + description: [{ required: true, message: t('message.pleaseEnterDescription'), trigger: "change" }], }; watch(locale, () => { @@ -157,24 +162,24 @@ watch(locale, () => { dataIndex: "id", }, { - title: t('message.operatorName'), - dataIndex: "operator", + title: t('message.name'), + dataIndex: "name", }, { - title: t('message.imsi'), - dataIndex: "imsi", + title: t('message.productionPlanStartDate'), + dataIndex: "start_date", }, { - title: t('message.iccid'), - dataIndex: "iccid", + title: t('message.endDateOfProductionPlan'), + dataIndex: "end_date", }, { - title: t('message.accessNumber'), - dataIndex: "access_number", + title: t('message.describe'), + dataIndex: "description", }, { - title: t('message.expiration'), - dataIndex: "expiration", + title: t('message.status'), + dataIndex: "status_name", }, { title: t('message.operation'), @@ -182,15 +187,34 @@ watch(locale, () => { } ] rules = { - operator: [{ required: true, message: t('message.pleaseEnterOperatorName'), trigger: "change" }], - access_number: [{ required: true, message: t('message.pleaseEnterImsi'), trigger: "change" }], - expiration: [{ required: true, message: t('message.pleaseEnterIccid'), trigger: "change" }], - iccid: [{ required: true, message: t('message.pleaseEnterAccessNumber'), trigger: "change" }], - imsi: [{ required: true, message: t('message.pleaseEnterExpiration'), trigger: "change" }], + name: [{ required: true, message: t('message.pleaseName'), trigger: "change" }], + date: [{ required: true, message: t('message.pleaseSelectADate'), trigger: "change" }], + status: [{ required: true, message: t('message.pleaseSelectStatus'), trigger: "change" }], + description: [{ required: true, message: t('message.pleaseEnterDescription'), trigger: "change" }], } }); const formatDate = (date: string) => dayjs(date).format('YYYY-MM-DD'); +const onDateFun = ()=> { + form.start_date = dayjs(form.date[0]).format('YYYY-MM-DDTHH:mm:ss[Z]') + form.end_date = dayjs(form.date[1]).format('YYYY-MM-DDTHH:mm:ss[Z]') +} + +const onClose = ()=>{ + Object.assign(form,{ + name: '', + start_date: '', + end_date: '', + status:'', + description: '', + date: '', + product_plans: [{product_id: '',quantity: '',unit: '' }]}) +} + +const dataUnit = (index:number,unit:string)=>{ + form.product_plans[index].unit = unit +} + const pageList = async () => { const { data } = await ProductionPlanPage({name:nameStr.value, page: pagination.current, page_size: pagination.pageSize }); pagination.total = data.data?.total || 0; @@ -207,12 +231,16 @@ const pageList = async () => { }; const edit = async(record: string) => { - modalVisible.value = true const { data } = await ProductionPlanDetail(record.id); - console.log(data.data); - Object.assign(form, cloneDeep(data.data)) - console.log(form); - // editableData[key] = cloneDeep(list.value.filter((item) => key === item.key)[0]); + Object.assign(form, cloneDeep(data.data),{ + start_date:dayjs(data.data.start_date).format('YYYY-MM-DDTHH:mm:ss[Z]'), + end_date:dayjs(data.data.end_date).format('YYYY-MM-DDTHH:mm:ss[Z]') + }) + disabled.value = dayjs(data.data.start_date).isBefore(dayjs()); + form.date = [form.start_date,form.end_date] + form.product_plans = cloneDeep(data.data.product_plans) + modalVisible.value = true + title.value = t('message.edit') }; const save = async (key: string) => { Object.assign(list.value.filter((item) => key === item.key)[0], editableData[key]); diff --git a/ant-vue/src/views/signal-configuration/index.vue b/ant-vue/src/views/signal-configuration/index.vue index 7fc2187..8f883f0 100644 --- a/ant-vue/src/views/signal-configuration/index.vue +++ b/ant-vue/src/views/signal-configuration/index.vue @@ -43,7 +43,7 @@ - {{ $t('message.check') }} + {{ $t('message.check') }} {{$t('message.edit')}} {{ $t('message.SignalAlarmConfig') }} {{ $t('message.historicalData') }} @@ -64,6 +64,15 @@ + + + + + + + + + {{ $t('message.text') }} @@ -134,6 +143,9 @@ let rules: Record = { alias: [{ required: true, message: t('message.pleaseAlias'), trigger: "blur" }], cache_size: [{ required: true, message: t('message.pleaseCacheSize'), trigger: "blur" }], unit: [{ required: true, message: t('message.pleaseUnit'), trigger: "blur" }], + protocol: [{ required: true, message: t('message.pleaseAlias'), trigger: "change" }], + device_uid: [{ required: true, message: t('message.pleaseAlias'), trigger: "change" }], + identification_code: [{ required: true, message: t('message.pleaseAlias'), trigger: "change" }], }; const jump = useRouteJump(); const formRef = ref(null); @@ -142,7 +154,7 @@ const route = useRoute(); const value = ref(""); const modalVisible = ref(false); const modalView = ref(false); -const form = reactive({ mqtt_client_id: Number(route.query.id) || "", name: "", type: "", alias: "", cache_size: 1, unit: "" }); +const form = reactive({ mqtt_client_id: Number(route.query.id) || "", name: "", type: "", alias: "", cache_size: 1, unit: "",protocol:'mqtt',identification_code:String(route.query.mqtt_client_id), device_uid:Number(route.query.mqtt_client_id)}); let columns = [ { title: t('message.uniCode'), @@ -156,6 +168,18 @@ let columns = [ title: t('message.type'), dataIndex: "type", }, + { + title: 'IdentificationCode', + dataIndex:'identification_code' + }, + { + title: 'protocol', + dataIndex:'protocol' + }, + { + title: 'device_uid', + dataIndex:'device_uid' + }, { title: t('message.alias'), dataIndex: "alias", @@ -285,6 +309,9 @@ const pageList = async () => { ID: item.ID, mqtt_client_id: item.mqtt_client_id, mqtt_client_name: item.mqtt_client_name, + device_uid: item.device_uid, + identification_code: item.identification_code, + protocol: item.protocol, name: item.name, type: item.type, alias: item.alias, @@ -303,12 +330,12 @@ const handleTableChange = async (page: any) => { await pageList(); }; -const onView = (id: number, rowId: number, alias: string, unit: string, type: string) => { +const onView = (rowId: number, alias: string, unit: string, type: string, protocol: string,device_uid:number,identification_code:string) => { const time = dayjs(); const data = type === "数字" ? QueryInfluxdb : QueryStrInfluxdb; showSpinning.value = true; data({ - measurement: String(id), + measurement: protocol+'_'+device_uid+'_'+identification_code, fields: [String(rowId), "storage_time", "push_time"], start_time: time.subtract(30, "day").unix(), end_time: time.unix(), -- Gitee From 6030ef53d6801dc1b44cd640862ce700d4438097 Mon Sep 17 00:00:00 2001 From: wxh <458319019@qq.com> Date: Fri, 9 Aug 2024 15:22:29 +0800 Subject: [PATCH 6/6] =?UTF-8?q?fix:=20=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/select/SignalModeSelect.vue | 5 +- .../src/components/select/SignalSelect.vue | 4 +- .../src/views/calculate-parameters/index.vue | 30 ++++++++- ant-vue/src/views/mqtt-management/index.vue | 3 +- .../views/script-alarm-parameters/index.vue | 63 +++++++++++++------ .../src/views/signal-configuration/index.vue | 12 +++- ant-vue/src/views/signal/index.vue | 25 +++++--- ant-vue/src/views/visualization/add.vue | 47 ++++++++------ 8 files changed, 138 insertions(+), 51 deletions(-) diff --git a/ant-vue/src/components/select/SignalModeSelect.vue b/ant-vue/src/components/select/SignalModeSelect.vue index 4f38982..55429d6 100644 --- a/ant-vue/src/components/select/SignalModeSelect.vue +++ b/ant-vue/src/components/select/SignalModeSelect.vue @@ -50,7 +50,7 @@ watch( ); const List = async () => { const { data } = await SignalPage({ mqtt_client_id: mqttClientId.value, page: page.value, page_size: 100, type: "数字" }); - const listArr = data.data.data.map((item: any) => ({ value: String(item[props.name]), label: item.name + "(" + item.alias + ")", alias: item.alias, unit: item.unit })); + const listArr = data.data.data.map((item: any) => ({ value: String(item[props.name]), label: item.name + "(" + item.alias + '/'+item.identification_code+")",protocol:item.protocol,device_uid:item.device_uid, identification_code:item.identification_code, unit: item.unit })); options.value = options.value.concat(listArr); if (!props.show) { if (!value.value) { @@ -93,7 +93,7 @@ const select = async (valueClick: any) => { await List(); } else { const { data } = await SignalPage({ mqtt_client_id: valueSearch.value, page: pageSelect.value, page_size: 100, type: "数字" }); - const listArr = data.data.data.map((item: any) => ({ value: String(item[props.name]), label: item.name + "(" + item.alias + ")", alias: item.alias, unit: item.unit })); + const listArr = data.data.data.map((item: any) => ({ value: String(item[props.name]), label: item.name + "(" + item.alias + '/'+item.identification_code+")", alias: item.alias, protocol:item.protocol,device_uid:item.device_uid, identification_code:item.identification_code, unit: item.unit })); options.value = options.value.concat(listArr); if (data.data.total > 0 && options.value.length < data.data.total) { pageSelect.value++; @@ -110,6 +110,7 @@ const select = async (valueClick: any) => { }; const onChange = (value:any, option:any) => { + console.log(option) emits("custom-event", option); emits("update:modelValue", value); }; diff --git a/ant-vue/src/components/select/SignalSelect.vue b/ant-vue/src/components/select/SignalSelect.vue index 6988bae..03a265a 100644 --- a/ant-vue/src/components/select/SignalSelect.vue +++ b/ant-vue/src/components/select/SignalSelect.vue @@ -70,7 +70,7 @@ const List = async () => { params.type = "数字"; } const { data } = await SignalPage(params); - const list1 = data.data.data.map((item: any) => ({ value: item[props.name], label: item.name + "(" + item.alias + ")", name: item.name, alias: item.alias, unit: item.unit })); + const list1 = data.data.data.map((item: any) => ({ value: item[props.name], label: item.name + "(" + item.alias + ")", name: item.name, alias: item.alias,protocol:item.protocol,device_uid:item.device_uid, identification_code:item.identification_code, unit: item.unit })); options.value = options.value.concat(list1); if (!props.show) { value.value = value.value || Number(route.query.id) || options.value[0]?.value; @@ -118,7 +118,7 @@ const select = async (ValueClick: any) => { params.type = "数字"; } const { data } = await SignalPage(params); - const list1 = data.data.data.map((item: any) => ({ value: item[props.name], label: item.name + "(" + item.alias + ")", name: item.name, alias: item.alias, unit: item.unit })); + const list1 = data.data.data.map((item: any) => ({ value: item[props.name], label: item.name + "(" + item.alias + ")", name: item.name, alias: item.alias,protocol:item.protocol,device_uid:item.device_uid, identification_code:item.identification_code, unit: item.unit })); options.value = options.value.concat(list1); if (data.data.total > 0 && options.value.length < data.data.total) { page1.value++; diff --git a/ant-vue/src/views/calculate-parameters/index.vue b/ant-vue/src/views/calculate-parameters/index.vue index 35a2b6d..40b7dac 100644 --- a/ant-vue/src/views/calculate-parameters/index.vue +++ b/ant-vue/src/views/calculate-parameters/index.vue @@ -63,6 +63,9 @@ + + + @@ -72,6 +75,12 @@ + + + + + + {{ $t('message.mean') }} @@ -132,7 +141,7 @@ let rules: Record = { }; const formRef = ref(null); const modalVisible = ref(false); -const form = reactive({ calc_rule_id: "", mqtt_client_id: "", signal_id: "", signal_name: "", name: "", reduce: "" }); +const form = reactive({ calc_rule_id: "", mqtt_client_id: "", signal_id: "", signal_name: "", name: "", reduce: "",protocol:"mqtt",identification_code:'',device_uid:"" }); let columns = [ { title: t('message.name'), @@ -149,6 +158,22 @@ let columns = [ title: t('message.signalName'), dataIndex: "signal_name", }, + { + title: 'protocol', + dataIndex: "protocol", + }, + { + title: 'device_uid', + dataIndex: "device_uid", + }, + { + title: 'identification_code', + dataIndex: "identification_code", + }, + { + title: t('message.signalName'), + dataIndex: "signal_name", + }, { title: t('message.aggregationMethod'), dataIndex: "reduce", @@ -324,8 +349,11 @@ const pageList = async () => { }; const handleCustomEvent = (payload: any) => { + console.log(payload) if (payload.value !== -11) { form.signal_name = payload.name; + form.device_uid = payload.device_uid; + form.identification_code = payload.identification_code; } }; diff --git a/ant-vue/src/views/mqtt-management/index.vue b/ant-vue/src/views/mqtt-management/index.vue index 44070dd..dcec4d0 100644 --- a/ant-vue/src/views/mqtt-management/index.vue +++ b/ant-vue/src/views/mqtt-management/index.vue @@ -349,6 +349,7 @@ const onCopy = async () => { var result = { "Time": Math.floor(Date.now() / 1000), "DataRows": dataRows, + "IdentificationCode": "${scriptId.value}", "DeviceUid": "${scriptId.value}", "Nc": nc }; @@ -365,7 +366,7 @@ const cancel = (key: string) => { const onSignal = (id: string) => { routerStore.setRouterName("/signal-configuration/index"); - jump.routeJump({ path: "/signal-configuration/index", query: { mqtt_client_id: id } }); + jump.routeJump({ path: "/signal-configuration/index", query: { mqtt_client_id: id,protocol :"mqtt" } }); }; const save = async (key: string) => { Object.assign(list.value.filter((item) => key === item.key)[0], editableData[key]); diff --git a/ant-vue/src/views/script-alarm-parameters/index.vue b/ant-vue/src/views/script-alarm-parameters/index.vue index 00d4cfe..f970fb4 100644 --- a/ant-vue/src/views/script-alarm-parameters/index.vue +++ b/ant-vue/src/views/script-alarm-parameters/index.vue @@ -13,24 +13,24 @@ - + - + - {{ record.mqtt_client_name }} + {{ record.mqtt_client_name }} {{ record.signal_name }} {{ text }} @@ -60,11 +60,19 @@ - - + + + mqtt + + + + - + + + + @@ -87,7 +95,7 @@ import {useI18n} from "vue-i18n"; interface DataItem { name: string; - mqtt_client_id: string; + device_uid: string; signal_id: string; } const { t,locale } = useI18n(); @@ -110,7 +118,7 @@ let rules: Record = { trigger: "blur", }, ], - mqtt_client_id: [{ required: true, message: t('message.pleaseSelectClientID'), trigger: "change" }], + device_uid: [{ required: true, message: t('message.pleaseSelectClientID'), trigger: "change" }], signal_id: [{ required: true, message: t('message.pleaseSignalName'), trigger: "change" }], }; const title = ref(t('message.addition')); @@ -125,11 +133,19 @@ const columns = ref([ }, { title: t('message.clientID'), - dataIndex: "mqtt_client_id", + dataIndex: "device_uid", render: ({ record }: any) => { return record.mqtt_client_name; }, }, + { + title: 'device_uid', + dataIndex: "device_uid", + }, + { + title: 'identification_code', + dataIndex: "identification_code", + }, { title: t('message.signalName'), dataIndex: "signal_id", @@ -150,10 +166,12 @@ const editableData: UnwrapRef> = reactive({}); const form = reactive({ id: "", name: "", - mqtt_client_id: "", + device_uid: "", + protocol: "", signal_delay_waring_id: "", signal_name: "", signal_id: "", + identification_code: "" }); const formState = reactive({ name: "" }); const signalName = ref(""); @@ -165,9 +183,9 @@ watch( }, ); watch( - () => form.mqtt_client_id, + () => form.device_uid, () => { - (formRef.value as HTMLFormElement).clearValidate("mqtt_client_id"); + (formRef.value as HTMLFormElement).clearValidate("device_uid"); }, ); watch( @@ -188,11 +206,19 @@ watch(locale, () => { }, { title: t('message.clientID'), - dataIndex: "mqtt_client_id", + dataIndex: "device_uid", render: ({ record }) => { return record.mqtt_client_name; }, }, + { + title: 'device_uid', + dataIndex: "device_uid", + }, + { + title: 'identification_code', + dataIndex: "identification_code", + }, { title: t('message.signalName'), dataIndex: "signal_id", @@ -224,7 +250,7 @@ watch(locale, () => { trigger: "blur", }, ], - mqtt_client_id: [{ required: true, message: t('message.pleaseSelectClientID'), trigger: "change" }], + device_uid: [{ required: true, message: t('message.pleaseSelectClientID'), trigger: "change" }], signal_id: [{ required: true, message: t('message.pleaseSignalName'), trigger: "change" }] } }); @@ -250,10 +276,11 @@ const pageList = async () => { key: index, ID: item.ID, name: item.name, - mqtt_client_id: item.mqtt_client_id, + device_uid: item.device_uid, mqtt_client_name: item.mqtt_client_name, signal_name: item.signal_name, signal_id: item.signal_id, + identification_code: item.identification_code })); }; const edit = (key: string) => { @@ -320,7 +347,7 @@ const save = async (key: string) => { Object.assign(list.value.filter((item) => key === item.key)[0], editableData[key]); const data = list.value.filter((item) => key === item.key)[0]; delete editableData[key]; - if (!data.mqtt_client_id || !data.signal_name) { + if (!data.device_uid || !data.signal_name) { message.error(t('message.clientSignal')); return; } diff --git a/ant-vue/src/views/signal-configuration/index.vue b/ant-vue/src/views/signal-configuration/index.vue index 8f883f0..ed2641c 100644 --- a/ant-vue/src/views/signal-configuration/index.vue +++ b/ant-vue/src/views/signal-configuration/index.vue @@ -3,6 +3,11 @@ + + + mqtt + + @@ -45,7 +50,7 @@ {{ $t('message.check') }} {{$t('message.edit')}} - {{ $t('message.SignalAlarmConfig') }} + {{ $t('message.SignalAlarmConfig') }} {{ $t('message.historicalData') }} {{$t('message.delete')}} @@ -152,6 +157,7 @@ const formRef = ref(null); const routerStore = useRouterNameStore(); const route = useRoute(); const value = ref(""); +const protocol = ref(route.query.protocol|| 'mqtt'); const modalVisible = ref(false); const modalView = ref(false); const form = reactive({ mqtt_client_id: Number(route.query.id) || "", name: "", type: "", alias: "", cache_size: 1, unit: "",protocol:'mqtt',identification_code:String(route.query.mqtt_client_id), device_uid:Number(route.query.mqtt_client_id)}); @@ -302,7 +308,7 @@ const confirm = async (id: string) => { }; const pageList = async () => { - const { data } = await SignalPage({ mqtt_client_id: value.value, page: pagination.current, page_size: pagination.pageSize }); + const { data } = await SignalPage({ device_uid: value.value, protocol : route.query.protocol, page: pagination.current, page_size: pagination.pageSize }); pagination.total = data.data?.total || 0; list.value = data.data.data?.map((item: any, index: number) => ({ key: index, @@ -339,6 +345,8 @@ const onView = (rowId: number, alias: string, unit: string, type: string, protoc fields: [String(rowId), "storage_time", "push_time"], start_time: time.subtract(30, "day").unix(), end_time: time.unix(), + device_uid: Number(route.query.mqtt_client_id) || device_uid, + protocol:route.query.protocol || protocol, aggregation: { every: 1, function: type === "数字" ? "mean" : "first", diff --git a/ant-vue/src/views/signal/index.vue b/ant-vue/src/views/signal/index.vue index e403bdc..b223981 100644 --- a/ant-vue/src/views/signal/index.vue +++ b/ant-vue/src/views/signal/index.vue @@ -2,11 +2,16 @@ + + + mqtt + + - + - + {{ $t('message.search') }} @@ -84,6 +89,9 @@ + + + @@ -119,7 +127,8 @@ const formRefTime = ref(null); const modalVisible = ref(false); const modalTime = ref(false); const modalHistory = ref(false); -const form = reactive({ mqtt_client_id: "", signal_id: "", max: "", min: "", in_or_out: 1, checked: true }); +const protocol = ref('mqtt'); +const form = reactive({ device_uid: "", signal_id: "", max: "", min: "", in_or_out: 1, checked: true,identification_code:'',protocol:protocol.value}); let columns = [ { title: t('message.uniCode'), @@ -151,6 +160,7 @@ let rules: Record = { min: [{ required: true, message: t('message.pleaseMinimum'), trigger: "blur" }], max: [{ required: true, message: t('message.pleaseMaximum'), trigger: "blur" }], checked: [{ required: true, message: t('message.pleaseAlarm'), trigger: "change" }], + identification_code: [{ required: true, message: '请输入identification_code', trigger: "change" }], date: [{ required: true, message: t('message.pleaseTime'), trigger: "change" }], }; const showSpinning = ref(false); @@ -178,7 +188,7 @@ const columnsResult = ref([ }, ]); -watch([() => form.mqtt_client_id, () => form.signal_id], async ([newParam1, newParam2], []) => { +watch([() => form.device_uid, () => form.signal_id], async ([newParam1, newParam2], []) => { if (newParam1 && newParam2) { await pageList(); } @@ -235,7 +245,7 @@ const onAddData = () => { (formRef.value as HTMLFormElement) .validate() .then(() => { - if (!form.signal_id || !form.mqtt_client_id) { + if (!form.signal_id || !form.device_uid) { message.error(t('message.clientSignal')); return; } @@ -294,6 +304,7 @@ const save = async (key: string) => { // eslint-disable-next-line @typescript-eslint/no-dynamic-delete delete editableData[key]; data.in_or_out = data.in_or_out ? 1 : 0; + data.protocol = protocol.value; await SignalWaringConfigUpdate(data); await pageList(); }; @@ -314,12 +325,12 @@ const confirm = async (id: string) => { }; const pageList = async () => { - const { data } = await SignalWaringConfigPage({ mqtt_client_id: form.mqtt_client_id, signal_id: form.signal_id, page: paginations.current, page_size: paginations.pageSize }); + const { data } = await SignalWaringConfigPage({ device_uid: form.device_uid, protocol:protocol.value, signal_id: form.signal_id, page: paginations.current, page_size: paginations.pageSize }); paginations.total = data.data?.total || 0; list.value = data.data.data?.map((item: any, index: number) => ({ key: index, ID: item.ID, - mqtt_client_id: item.mqtt_client_id, + device_uid: item.device_uid, signal: item.signal, signal_id: item.signal_id, in_or_out: item.in_or_out === 1, diff --git a/ant-vue/src/views/visualization/add.vue b/ant-vue/src/views/visualization/add.vue index b8d8c8a..693f11a 100644 --- a/ant-vue/src/views/visualization/add.vue +++ b/ant-vue/src/views/visualization/add.vue @@ -74,19 +74,26 @@ - {{ $t('message.clientID') }} - {{ $t('message.signalName') }} - {{ $t('message.statisticalMethods') }} + 协议 + {{ $t('message.clientID') }} + {{ $t('message.signalName') }} + + {{ $t('message.statisticalMethods') }} - - + + + mqtt + + + + - - + + - - + + {{ $t('message.mean') }} {{ $t('message.sum') }} {{ $t('message.min') }} @@ -153,7 +160,7 @@ const listArr = ref([ start_time: null, end_time: null, aggregation: { every: 1, function: "mean", create_empty: false }, - list: [{ client_id: "", fields: "", function: "mean" }], + list: [{ client_id: "", fields: "", function: "mean", protocol:'mqtt', device_uid:'', identification_code: '' }], }, showSpinning: false, chart: {}, @@ -162,7 +169,7 @@ const listArr = ref([ const modalVisible = ref(false); const modalSave = ref(false); const time = ref(); -const form = reactive({ client_id: "", fields: [], start_time: "", end_time: "", every: 1, function: "mean", create_empty: false, list: [{ client_id: "", fields: "", function: "mean" }] }); +const form = reactive({ client_id: "", fields: [], start_time: "", end_time: "", every: 1, function: "mean", create_empty: false, list: [{ client_id: "", fields: "", function: "mean", protocol:'mqtt', device_uid:'', identification_code: '' }] }); const indexNumber = ref(0); const activeKey = ref("dynamic_Time"); const dateTime = ref(''); @@ -235,7 +242,7 @@ function onAdd() { start_time: null, end_time: null, aggregation: { every: 1, function: "mean", create_empty: false }, - list: [{ client_id: "", fields: "", function: "mean" }], + list: [{ client_id: "", fields: "", function: "mean",protocol:'mqtt', device_uid:'', identification_code: '' }], }, chart: {}, showSpinning: false, @@ -301,7 +308,7 @@ const onConfirm = () => { modalVisible.value = false; form.list.forEach((item, index) => { QueryInfluxdb({ - measurement: String(item.client_id), + measurement: item.protocol + '_' + item.device_uid +'_' + item.identification_code, fields: [String(item.fields), "storage_time", "push_time"], start_time: activeKey.value === "dynamic_Time" ? start_time : form.start_time, end_time: activeKey.value === "dynamic_Time" ? end_time : form.end_time, @@ -316,7 +323,7 @@ const onConfirm = () => { const dataArr = await SignalPage({ mqtt_client_id: item.client_id, page: 1, page_size: pageSize }); const signalList = dataArr.data.data?.data || []; listArr.value[indexNumber.value].param = { - measurement: form.client_id, + measurement: item.protocol + '_' + item.device_uid +'_' + item.identification_code, fields: form.fields, aggregation: { every: form.every, @@ -424,7 +431,7 @@ const onSaveInformation = () => { data.id = id.value; DashboardUpdate(data).then(({ data }) => { if (data.code === 20000) { - router.push({ path: "/visualization/index" }); + router.push({ path: "/visualization/list" }); } }).catch(e=>{ console.error(e) @@ -432,7 +439,7 @@ const onSaveInformation = () => { } else { DashboardCreate(data).then(({ data }) => { if (data.code === 20000) { - router.push({ path: "/visualization/index" }); + router.push({ path: "/visualization/list" }); } }).catch(e=>{ console.error(e) @@ -454,7 +461,7 @@ const getData = async (index: number) => { listArr.value[index].showSpinning = true; listArr.value[index].param.list.forEach((text: any, number: number) => { QueryInfluxdb({ - measurement: String(text.client_id), + measurement: text.protocol + '_' + text.device_uid +'_' + text.identification_code, fields: [String(text.fields), "storage_time", "push_time"], start_time: listArr.value[index].param.sub ? start_time : listArr.value[index].param.start_time, end_time: listArr.value[index].param.sub ? end_time : listArr.value[index].param.end_time, @@ -579,8 +586,12 @@ const onChange = (text: string, index: number) => { listArr.value[index].chart = { ...data }; }; -const handleCustomEvent = (payload: any) => { +const handleCustomEvent = (index:number, payload: any) => { + console.log(payload[0]) if (payload.value !== -11) { + form.list[index].device_uid = payload[0]?.device_uid + form.list[index].identification_code = payload[0]?.identification_code + form.list[index].protocol = payload[0]?.protocol optionList.value.push(...payload); } }; -- Gitee