fix: bug#10505 10443

This commit is contained in:
leiqiaochu 2023-03-17 15:48:50 +08:00
parent 7c9028dab4
commit 34bff0ecb4
6 changed files with 40 additions and 27 deletions

View File

@ -83,7 +83,7 @@ const props = defineProps({
type: Object as PropType<PopconfirmProps>, type: Object as PropType<PopconfirmProps>,
}, },
hasPermission: { hasPermission: {
type: String || Array, type: String || Array || Boolean,
}, },
style: { style: {
type: Object as PropType<CSSProperties> type: Object as PropType<CSSProperties>
@ -96,7 +96,7 @@ const props = defineProps({
const permissionStore = usePermissionStore() const permissionStore = usePermissionStore()
const isPermission = computed(() => { const isPermission = computed(() => {
if (!props.hasPermission) { if (!props.hasPermission || props.hasPermission === true) {
return true return true
} }
return permissionStore.hasPermission(props.hasPermission) return permissionStore.hasPermission(props.hasPermission)

View File

@ -29,5 +29,9 @@ export const useProductStore = defineStore({
setTabActiveKey(key: string) { setTabActiveKey(key: string) {
this.tabActiveKey = key this.tabActiveKey = key
}, },
reSet(){
this.current = {} as ProductItem
this.detail = {} as ProductItem
}
} }
}) })

View File

@ -76,6 +76,7 @@ import type { ActionsType } from '@/components/Table/index.vue';
import ModifyModal from './components/modifyModal/index.vue'; import ModifyModal from './components/modifyModal/index.vue';
import type { TableColumnType, TableProps } from 'ant-design-vue'; import type { TableColumnType, TableProps } from 'ant-design-vue';
import { message } from 'ant-design-vue'; import { message } from 'ant-design-vue';
const expandedRowKeys = ref<any>([]);
const tableRef = ref<Record<string, any>>({}); const tableRef = ref<Record<string, any>>({});
const modifyRef = ref(); const modifyRef = ref();
const dataSource = ref<any>([]); const dataSource = ref<any>([]);
@ -126,7 +127,7 @@ let params = ref();
* 搜索 * 搜索
*/ */
const handleSearch = (e: any) => { const handleSearch = (e: any) => {
params.value = e params.value = e;
}; };
/** /**
* 操作栏按钮 * 操作栏按钮

View File

@ -589,6 +589,7 @@ const search = (e: any) => {
}; };
}; };
const stepsRef = reactive({current:0})
// //
const steps = [ const steps = [
{ {
@ -673,19 +674,19 @@ const driver = new Driver({
nextBtnText: '下一步', nextBtnText: '下一步',
prevBtnText: '上一步', prevBtnText: '上一步',
onNext: () => { onNext: () => {
// ref.current = ref.current + 1; stepsRef.current = stepsRef.current + 1;
}, },
onPrevious: () => { onPrevious: () => {
// ref.current = ref.current - 1; stepsRef.current = stepsRef.current - 1;
}, },
onReset: () => { onReset: () => {
// if (ref.current !== 3) { if (stepsRef.current !== 3) {
// guide({ guide({
// name: 'guide', name: 'guide',
// content: 'skip', content: 'skip',
// }); });
// } }
// ref.current = 0; stepsRef.current = 0;
}, },
}); });
@ -695,16 +696,20 @@ const driver1 = new Driver({
closeBtnText: '不再提示', closeBtnText: '不再提示',
nextBtnText: '下一步', nextBtnText: '下一步',
prevBtnText: '上一步', prevBtnText: '上一步',
onNext: () => {}, onNext: () => {
onPrevious: () => {}, stepsRef.current = stepsRef.current + 1;
},
onPrevious: () => {
stepsRef.current = stepsRef.current - 1;
},
onReset: () => { onReset: () => {
// if (ref.current !== 4) { if (stepsRef.current !== 4) {
// // guide({ guide({
// // name: 'guide', name: 'guide',
// // content: 'skip', content: 'skip',
// // }); });
// } }
// ref.current = 0; stepsRef.current = 0;
}, },
}); });
@ -969,9 +974,11 @@ const submitData = async () => {
productStore.current = { ...res.result }; productStore.current = { ...res.result };
access.value = res.result; access.value = res.result;
message.success('操作成功!'); message.success('操作成功!');
getData();
} }
visible.value = false; visible.value = false;
queryParams.value = {}; queryParams.value = {};
}); });
} }
} else { } else {
@ -1085,11 +1092,11 @@ const add = () => {
/** /**
* 初始化 * 初始化
*/ */
watchEffect(() => { // watchEffect(() => {
if (productStore.current?.accessId) { // if (productStore.current?.accessId) {
getData(); // getData();
} // }
}); // });
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
:deep( :deep(

View File

@ -151,6 +151,7 @@ watch(
() => route.params.id, () => route.params.id,
(newId) => { (newId) => {
if (newId) { if (newId) {
productStore.reSet();
productStore.tabActiveKey = 'Info'; productStore.tabActiveKey = 'Info';
productStore.refresh(newId as string); productStore.refresh(newId as string);
} }

View File

@ -132,7 +132,7 @@
<PermissionButton <PermissionButton
:disabled="i.disabled" :disabled="i.disabled"
:popConfirm="i.popConfirm" :popConfirm="i.popConfirm"
:hasPermission="'device/Product:' + i.key" :hasPermission="i.key === 'view' ? true : 'device/Product:' + i.key"
:tooltip="{ :tooltip="{
...i.tooltip, ...i.tooltip,
}" }"