🐛 修改组件命名规则,去掉pontCore
This commit is contained in:
parent
673ea93312
commit
eebfca8790
@ -29,6 +29,7 @@ export default [
|
|||||||
dictionary: true,
|
dictionary: true,
|
||||||
sensor: true,
|
sensor: true,
|
||||||
station: true,
|
station: true,
|
||||||
|
material: true,
|
||||||
},
|
},
|
||||||
ecmaVersion: 2020,
|
ecmaVersion: 2020,
|
||||||
parser: parserVue,
|
parser: parserVue,
|
||||||
|
@ -1,73 +0,0 @@
|
|||||||
/**
|
|
||||||
* @description pont内置请求单例
|
|
||||||
*/
|
|
||||||
|
|
||||||
class PontCoreManager {
|
|
||||||
// static singleInstance = undefined as PontCoreManager;
|
|
||||||
private static singleInstance: PontCoreManager | null = null;
|
|
||||||
|
|
||||||
static getSignleInstance() {
|
|
||||||
if (!PontCoreManager.singleInstance) {
|
|
||||||
PontCoreManager.singleInstance = new PontCoreManager();
|
|
||||||
return PontCoreManager.singleInstance;
|
|
||||||
}
|
|
||||||
return PontCoreManager.singleInstance;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* fetch请求
|
|
||||||
* @param url 请求url
|
|
||||||
* @param options fetch 请求配置
|
|
||||||
*/
|
|
||||||
fetch(url: string, options = {}) {
|
|
||||||
return fetch(url, options).then((res) => {
|
|
||||||
return res.json();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 使用外部传入的请求方法替换默认的fetch请求
|
|
||||||
*/
|
|
||||||
useFetch(fetch: (url: string, options?: any) => Promise<any>) {
|
|
||||||
if (typeof fetch !== 'function') {
|
|
||||||
console.error('fetch should be a function ');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.fetch = fetch;
|
|
||||||
}
|
|
||||||
|
|
||||||
getUrl(path: string, queryParams: any) {
|
|
||||||
const params = {
|
|
||||||
...(queryParams || ({} as any)),
|
|
||||||
};
|
|
||||||
|
|
||||||
const url = path.replace(/\{([^\\}]*(?:\\.[^\\}]*)*)\}/gm, ( key) => {
|
|
||||||
// eslint-disable-next-line no-param-reassign
|
|
||||||
key = key.trim();
|
|
||||||
|
|
||||||
if (params[key] !== undefined) {
|
|
||||||
const value = params[key];
|
|
||||||
delete params[key];
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
console.warn('Please set value for template key: ', key);
|
|
||||||
return '';
|
|
||||||
});
|
|
||||||
|
|
||||||
const paramStr = Object.keys(params)
|
|
||||||
.map((key) => {
|
|
||||||
return params[key] === undefined ? '' : `${key}=${params[key]}`;
|
|
||||||
})
|
|
||||||
.filter((id) => id)
|
|
||||||
.join('&');
|
|
||||||
|
|
||||||
if (paramStr) {
|
|
||||||
return `${url}?${paramStr}`;
|
|
||||||
}
|
|
||||||
|
|
||||||
return url;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export const PontCore = PontCoreManager.getSignleInstance();
|
|
@ -30,10 +30,10 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import applyForm,{RowVO} from '../component/applyForm.vue'
|
import applyForm,{RowVO} from './apply-form.vue'
|
||||||
import scanForm from '../component/scanForm.vue'
|
import scanForm from './scan-form.vue'
|
||||||
import applyConfirm from '../component/applyConfirm.vue'
|
import applyConfirm from './apply-confirm.vue'
|
||||||
import successResul from '../component/successResul.vue'
|
import successResul from './success-resul.vue'
|
||||||
import api from '@/api'
|
import api from '@/api'
|
||||||
// 和外层界面的数据交互
|
// 和外层界面的数据交互
|
||||||
defineProps(
|
defineProps(
|
@ -37,7 +37,7 @@
|
|||||||
|
|
||||||
import api from '@/api'
|
import api from '@/api'
|
||||||
import { IPage } from '@/api/api'
|
import { IPage } from '@/api/api'
|
||||||
import apply from './applyModal.vue';
|
import apply from './apply-modal.vue';
|
||||||
|
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
|
@ -3,6 +3,6 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import applyModal from "@/views/stock/component/applyModal.vue";
|
import applyModal from "@/views/stock/component/apply-modal.vue";
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
@ -3,6 +3,6 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import applyModal from "@/views/stock/component/applyModal.vue";
|
import applyModal from "@/views/stock/component/apply-modal.vue";
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
@ -86,8 +86,8 @@ import { config, formItems } from './form'
|
|||||||
import { notification } from 'ant-design-vue'
|
import { notification } from 'ant-design-vue'
|
||||||
import dayjs from 'dayjs';
|
import dayjs from 'dayjs';
|
||||||
import { useUserStore } from '@/stores/user'
|
import { useUserStore } from '@/stores/user'
|
||||||
import scanForm from '../component/scanForm.vue'
|
import scanForm from '../component/scan-form.vue'
|
||||||
import resultForm from '../stocktaking/resultForm.vue'
|
import resultForm from './result-form.vue'
|
||||||
|
|
||||||
|
|
||||||
const searchKey = ref('')
|
const searchKey = ref('')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user