fix: 产品仪表盘新增上传详情更改数据回显

This commit is contained in:
leiqiaochu 2023-03-16 10:15:56 +08:00
parent f76f76965d
commit 708f93dc28
5 changed files with 17 additions and 14 deletions

View File

@ -228,7 +228,6 @@ const getOnline = () => {
onlineYdata.reverse(); onlineYdata.reverse();
setOnlineChartOpition(x, onlineYdata); setOnlineChartOpition(x, onlineYdata);
onlineFooter.value[0].value = y?.[1]; onlineFooter.value[0].value = y?.[1];
console.log(res.result);
} }
}); });
}; };

View File

@ -41,19 +41,21 @@
</j-descriptions> </j-descriptions>
</j-card> </j-card>
<!-- 编辑 --> <!-- 编辑 -->
<Save ref="saveRef" :isAdd="isAdd" :title="title" /> <Save ref="saveRef" :isAdd="isAdd" :title="title" @success="refresh"/>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { useProductStore } from '@/store/product'; import { useProductStore } from '@/store/product';
import Save from '../../Save/index.vue'; import Save from '../../Save/index.vue';
import moment from 'moment'; import moment from 'moment';
import { useRoute } from 'vue-router';
import { import {
EditOutlined, EditOutlined,
DeleteOutlined, DeleteOutlined,
PlusOutlined, PlusOutlined,
} from '@ant-design/icons-vue'; } from '@ant-design/icons-vue';
const productStore = useProductStore(); const productStore = useProductStore();
const route = useRoute();
const saveRef = ref(); const saveRef = ref();
const isAdd = ref(2); const isAdd = ref(2);
const title = ref('编辑'); const title = ref('编辑');
@ -69,4 +71,10 @@ const editConfig = () => {
const changeTables = () => { const changeTables = () => {
productStore.tabActiveKey = 'Device'; productStore.tabActiveKey = 'Device';
}; };
/**
* 修改成功刷新
*/
const refresh = () =>{
productStore.refresh(route.params.id as string);
}
</script> </script>

View File

@ -151,7 +151,6 @@ watch(
() => route.params.id, () => route.params.id,
(newId) => { (newId) => {
if (newId) { if (newId) {
console.log(newId);
productStore.tabActiveKey = 'Info'; productStore.tabActiveKey = 'Info';
productStore.refresh(newId as string); productStore.refresh(newId as string);
} }
@ -230,7 +229,7 @@ const getProtocol = async () => {
* 详情页跳转到设备页 * 详情页跳转到设备页
*/ */
const jumpDevice = () => { const jumpDevice = () => {
console.log(productStore.current?.id); // console.log(productStore.current?.id);
const searchParams = { const searchParams = {
column: 'productId', column: 'productId',
termType: 'eq', termType: 'eq',

View File

@ -22,8 +22,8 @@
<div class="product-title">产品创建成功</div> <div class="product-title">产品创建成功</div>
</div> </div>
<div style="display: flex"> <div style="display: flex">
<div class="product-id">产品ID: {{ idValue.value }}</div> <div class="product-id">产品ID: {{ idValue }}</div>
<div class="product-btn" @click="showDetail">查看详情</div> <div class="product-btn" @click="showDetail" style="cursor: pointer;">查看详情</div>
</div> </div>
<div>接下来推荐操作:</div> <div>接下来推荐操作:</div>
<div class="product-main">1配置产品接入方式</div> <div class="product-main">1配置产品接入方式</div>
@ -49,10 +49,12 @@
import { getImage } from '@/utils/comm.ts'; import { getImage } from '@/utils/comm.ts';
import { useProductStore } from '@/store/product'; import { useProductStore } from '@/store/product';
import { CheckCircleOutlined } from '@ant-design/icons-vue'; import { CheckCircleOutlined } from '@ant-design/icons-vue';
import { useMenuStore } from '@/store/menu';
const visible = ref<boolean>(false); const visible = ref<boolean>(false);
const productStore = useProductStore(); const productStore = useProductStore();
const router = useRouter(); const router = useRouter();
const idValue = ref({}); const idValue = ref({});
const menuStore = useMenuStore();
/** /**
* 弹窗关闭 * 弹窗关闭
*/ */
@ -70,17 +72,12 @@ const show = (id: string) => {
* 查看详情 * 查看详情
*/ */
const showDetail = () => { const showDetail = () => {
jump(idValue.value); menuStore.jumpPage('device/Product/Detail',{id:idValue.value})
};
/**
* 跳转页面
*/
const jump = (id: string) => {
router.push('/iot/device/product/detail/' + id);
}; };
defineExpose({ defineExpose({
show: show, show: show,
}); });
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
.product-tips { .product-tips {

View File

@ -395,7 +395,7 @@ const submitData = () => {
message.success('保存成功!'); message.success('保存成功!');
visible.value = false; visible.value = false;
emit('success'); emit('success');
dialogRef.value.show(form.id); dialogRef.value.show(res.result.id);
} else { } else {
message.error('操作失败'); message.error('操作失败');
} }