Commit 3d531691 authored by zhanglongbao's avatar zhanglongbao

feat

parent ae26d968
......@@ -9,17 +9,12 @@ declare module 'vue' {
export interface GlobalComponents {
Address: typeof import('./src/components/widget/field/address/index.vue')['default']
Avatar: typeof import('./src/components/avatar/index.vue')['default']
<<<<<<< HEAD
Client_tag: typeof import('./src/components/widget/field/client_tag/index.vue')['default']
copy: typeof import('./src/components/select_order_tag copy/index.vue')['default']
=======
>>>>>>> b8bdf7f (fix)
Create_form_data: typeof import('./src/components/create_form_data/index.vue')['default']
Date_time: typeof import('./src/components/widget/field/date_time/index.vue')['default']
Date_time_range: typeof import('./src/components/widget/field/date_time_range/index.vue')['default']
Dd: typeof import('./src/components/name/dd.vue')['default']
Dept: typeof import('./src/components/widget/field/dept/index.vue')['default']
Field: typeof import('./src/components/widget/field/index.vue')['default']
File: typeof import('./src/components/widget/field/file/index.vue')['default']
Image: typeof import('./src/components/widget/field/image/index.vue')['default']
Input: typeof import('./src/components/widget/field/input/index.vue')['default']
......@@ -37,12 +32,9 @@ declare module 'vue' {
Select: typeof import('./src/components/select/index.vue')['default']
Select_address: typeof import('./src/components/select_address/index.vue')['default']
Select_client: typeof import('./src/components/select_client/index.vue')['default']
<<<<<<< HEAD
Select_client_tag: typeof import('./src/components/select_client_tag/index.vue')['default']
Select_order_tag: typeof import('./src/components/select_order_tag/index.vue')['default']
Select_product: typeof import('./src/components/select_product/index.vue')['default']
=======
>>>>>>> b8bdf7f (fix)
Select_time: typeof import('./src/components/select_time/index.vue')['default']
Select_user_dept: typeof import('./src/components/select_user_dept/index.vue')['default']
Signature: typeof import('./src/components/widget/field/signature/index.vue')['default']
......@@ -51,6 +43,7 @@ declare module 'vue' {
User: typeof import('./src/components/widget/field/user/index.vue')['default']
User_dept_list: typeof import('./src/components/user_dept_list/index.vue')['default']
VanCascader: typeof import('vant/es')['Cascader']
VanCheckbox: typeof import('vant/es')['Checkbox']
VanDatePicker: typeof import('vant/es')['DatePicker']
VanPicker: typeof import('vant/es')['Picker']
VanPopup: typeof import('vant/es')['Popup']
......
......@@ -11,6 +11,7 @@
"dependencies": {
"axios": "^1.7.5",
"dingtalk-jsapi": "^3.0.38",
"mitt": "^3.0.1",
"pinia": "^2.2.2",
"smooth-signature": "^1.0.15",
"vant": "^4.9.4",
......
......@@ -11,6 +11,9 @@ dependencies:
dingtalk-jsapi:
specifier: ^3.0.38
version: 3.0.38
mitt:
specifier: ^3.0.1
version: 3.0.1
pinia:
specifier: ^2.2.2
version: 2.2.2(typescript@5.5.4)(vue@3.4.38)
......@@ -997,6 +1000,10 @@ packages:
brace-expansion: 2.0.1
dev: true
/mitt@3.0.1:
resolution: {integrity: sha512-vKivATfr97l2/QBCYAkXYDbrIWPM2IIKEl7YPhjCvKlG3kE2gm+uBo6nEXK3M5/Ffh/FLpKExzOQ3JJoJGFKBw==}
dev: false
/mlly@1.7.1:
resolution: {integrity: sha512-rrVRZRELyQzrIUAVMHxP97kv+G786pHmOKzuFII8zDYahFBS7qnHh2AlYSl1GAHhaMPCz6/oHjVMcfFYgFYHgA==}
dependencies:
......
......@@ -33,6 +33,7 @@ import popupComp from "@/components/popup/index.vue";
export interface Props {
value?: any;
params?: any;
onHide?(): void;
onConfirm?(value: any): void;
}
......@@ -64,6 +65,7 @@ const params = computed(() => ({
params: {
form_id: client_form_list.value[0].form_id,
size: 1000,
...props.params,
},
}));
const { list, getList } = useDataList(params);
......
......@@ -23,8 +23,7 @@
</template>
<script setup lang="ts">
import { computed, ref } from "vue";
import api from "@/api";
import { ref } from "vue";
import { useUserTag, UserTag } from "@/utils/useTag";
import { hexToRgba } from "@/utils/public";
import popupComp from "@/components/popup/index.vue";
......@@ -57,7 +56,6 @@ const select = (tag: UserTag) => {
} else {
selected_tags.value.push(tag);
}
change(selected_tags.value.map((it) => it.id));
};
const isSelected = (tag: UserTag) => {
return selected_tags.value.some((it: UserTag) => it.id == tag.id);
......
......@@ -23,8 +23,7 @@
</template>
<script setup lang="ts">
import { computed, ref } from "vue";
import api from "@/api";
import { ref } from "vue";
import { useOrderTag, OrderTag } from "@/utils/useTag";
import { hexToRgba } from "@/utils/public";
import popupComp from "@/components/popup/index.vue";
......
......@@ -33,6 +33,7 @@ import popupComp from "@/components/popup/index.vue";
export interface Props {
value?: any;
params?: any;
onHide?(): void;
onConfirm?(value: any): void;
}
......
......@@ -15,7 +15,7 @@
}">
<i v-if="tag.label_icon" :class="tag.label_icon"></i>
<span>{{ tag.label_name }}</span>
<i class="icon-69 remove" @click="select(tag)"></i>
<i class="icon-69 remove" @click="removeTag(tag)"></i>
</div>
<div class="tag add" @click="selectClientTag">
......@@ -30,7 +30,8 @@
import { ref } from "vue";
import { FieldProps } from "../config";
import { hexToRgba } from "@/utils/public.ts";
import { $selectClientTag } from '@/components/select_client_tag/index'
import { $selectClientTag } from "@/components/select_client_tag/index";
import { UserTag } from "@/utils/useTag";
const props = defineProps<FieldProps>();
const emit = defineEmits(["edit"]);
......@@ -41,7 +42,7 @@ const change = () => {
});
};
const selected_tag = ref([]);
const selected_tag = ref<UserTag[]>([]);
const selectClientTag = () => {
$selectClientTag({
......@@ -51,6 +52,10 @@ const selectClientTag = () => {
},
});
};
const removeTag = (tag: UserTag) => {
selected_tag.value = selected_tag.value.filter((it) => it.id !== tag.id);
change();
};
const init = () => {
selected_tag.value = props.data[props.config.key_id] || [];
......
......@@ -21,7 +21,7 @@ const props = defineProps<FieldProps>();
const emit = defineEmits(["edit"]);
const change = (e: any) => {
emit("edit", { [props.config.key_id]: e.target.modelValue });
emit("edit", { [props.config.key_id]: e.target.value });
};
</script>
......
......@@ -21,7 +21,7 @@ const props = defineProps<FieldProps>();
const emit = defineEmits(["edit"]);
const change = (e: any) => {
emit("edit", { [props.config.key_id]: e.target.modelValue });
emit("edit", { [props.config.key_id]: e.target.value });
};
</script>
......
......@@ -42,7 +42,7 @@
</template>
<script setup lang="ts">
import { ref } from "vue";
import { ref, onBeforeUnmount } from "vue";
import { FieldProps } from "../config";
import { $selectClient } from "@/components/select_client/index";
......@@ -58,23 +58,29 @@ const change = () => {
};
const client = ref<any>({});
const init = () => {
client.value = props.data[props.config.key_id] || {};
};
init();
const selectClient = () => {
$selectClient({
value: client.value,
onConfirm: (data) => {
client.value = data;
console.log("client", client.value);
change();
window.mitt.emit("order_client_change");
},
});
};
window.mitt.on("order_product_change", (select_client: any) => {
client.value = select_client;
change();
});
onBeforeUnmount(() => {
window.mitt.off("order_product_change");
});
const init = () => {
client.value = props.data[props.config.key_id] || {};
};
init();
</script>
<style lang="less" scoped>
......
......@@ -34,9 +34,9 @@
</template>
<script setup lang="ts">
import { ref } from "vue";
import { onBeforeUnmount, ref } from "vue";
import { FieldProps } from "../config";
import { $selectProduct } from '@/components/select_product/index'
import { $selectProduct } from "@/components/select_product/index";
const props = defineProps<FieldProps>();
const emit = defineEmits(["edit"]);
......@@ -47,20 +47,29 @@ const change = () => {
const product = ref<any>({});
const init = () => {
product.value = props.data[props.config.key_id] || {};
};
init();
const selectProduct = () => {
$selectProduct({
value: product.value,
onConfirm: (data) => {
onConfirm: async (data) => {
product.value = data;
change();
window.mitt.emit("order_product_change", data.customer_id);
},
});
};
window.mitt.on("order_client_change", () => {
product.value = {};
change();
});
onBeforeUnmount(() => {
window.mitt.off("order_client_change");
});
const init = () => {
product.value = props.data[props.config.key_id] || {};
};
init();
</script>
<style lang="less" scoped>
......
......@@ -15,7 +15,7 @@
}">
<i v-if="tag.label_icon" :class="tag.label_icon"></i>
<span>{{ tag.label_name }}</span>
<i class="icon-69 remove" @click="select(tag)"></i>
<i class="icon-69 remove" @click="removeTag(tag)"></i>
</div>
<div class="tag add" @click="selectOrderTag">
......@@ -31,6 +31,7 @@ import { ref } from "vue";
import { FieldProps } from "../config";
import { hexToRgba } from "@/utils/public.ts";
import { $selectOrderTag } from "@/components/select_order_tag/index";
import { OrderTag } from "@/utils/useTag";
const props = defineProps<FieldProps>();
const emit = defineEmits(["edit"]);
......@@ -41,7 +42,7 @@ const change = () => {
});
};
const selected_tag = ref([]);
const selected_tag = ref<OrderTag[]>([]);
const selectOrderTag = () => {
$selectOrderTag({
......@@ -51,6 +52,10 @@ const selectOrderTag = () => {
},
});
};
const removeTag = (tag: OrderTag) => {
selected_tag.value = selected_tag.value.filter((it) => it.id !== tag.id);
change();
};
const init = () => {
selected_tag.value = props.data[props.config.key_id] || [];
......
......@@ -3,6 +3,7 @@ import App from "./App.vue";
import { initApp } from "@/utils/init";
import router from "@/router";
import { createPinia } from "pinia";
import mitt from "mitt";
// css
import "./assets/css/reset.css";
......@@ -10,6 +11,8 @@ import "./assets/css/global.less";
import "./assets/icon/style.css";
import "vant/lib/toast/index.css";
window.mitt = mitt();
const app = createApp(App);
app.use(createPinia());
app.use(router);
......
......@@ -114,6 +114,7 @@ import { ref } from "vue";
import api from "@/api";
import { File, hexToRgba } from "@/utils/public";
import { $createFormData } from "@/components/create_form_data/index";
import { $toast } from "@/components/toast/index";
// 产品详情
const product_detail = ref<{
......@@ -125,21 +126,21 @@ const getProductDetail = async () => {
const msg = await api.external.getInfoByQrCode();
if (msg.code == 0) {
product_detail.value = msg.data;
console.log("product_detail", product_detail.value);
}
};
// 显示配置
interface ButtonType {
button_name: string;
order_form_id: string;
button_order_type: number;
}
interface QrCodeConfig {
form_id: string;
back_ground: File | null;
show_customer_fields: string[];
show_product_fields: string[];
buttons: {
button_name: string;
order_form_id: string;
button_order_type: string;
}[];
buttons: ButtonType[];
[k: string]: any;
}
const detail_config = ref<QrCodeConfig>({} as QrCodeConfig);
......@@ -147,7 +148,6 @@ const getDetailConfig = async () => {
const msg = await api.external.getQrCodeWindow();
if (msg.code == 0) {
detail_config.value = msg.data;
console.log("detail_config", detail_config.value);
}
};
const getShowCusmtomerFields = (id: string) => {
......@@ -158,9 +158,19 @@ const getShowProductFields = (id: string) => {
};
// 创建
const createFormData = (button: any) => {
const createFormData = (button: ButtonType) => {
$createFormData({
form_id: button.order_form_id,
onConfirm: async (data) => {
const msg = await api.order.saveOrder({
...data,
form_id: button.order_form_id,
order_type: button.button_order_type,
});
if (msg.code == 0) {
$toast({ type: "success", message: "创建成功" });
}
},
});
};
......
/// <reference types="vite/client" />
declare module "*.vue" {
import { ComponentOptions } from "vue";
const componentOptions: ComponentOptions;
export default componentOptions;
import { ComponentOptions } from "vue";
const componentOptions: ComponentOptions;
export default componentOptions;
}
interface Window {
mitt: Emitter;
}
{
"compilerOptions": {
"target": "ES2020",
"useDefineForClassFields": true,
"module": "ESNext",
"lib": ["ES2020", "DOM", "DOM.Iterable"],
"skipLibCheck": true,
"compilerOptions": {
"target": "ES2020",
"useDefineForClassFields": true,
"module": "ESNext",
"lib": ["ES2020", "DOM", "DOM.Iterable"],
"skipLibCheck": true,
/* Bundler mode */
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "preserve",
// 不提示this有any类型
"noImplicitThis": false,
/* Bundler mode */
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "preserve",
// 不提示this有any类型
"noImplicitThis": false,
/* Linting */
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true,
/* Linting */
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true,
"baseUrl": "./",
//路径映射,相对于baseUrl
"paths": {
"@/*": ["./src/*"]
}
},
"include": ["src/**/*.ts", "src/**/*.tsx", "src/**/*.vue"],
"references": [{ "path": "./tsconfig.node.json" }]
"baseUrl": "./",
//路径映射,相对于baseUrl
"paths": {
"@/*": ["./src/*"]
}
},
"include": ["src/**/*.ts", "src/**/*.tsx", "src/**/*.vue"],
"references": [{ "path": "./tsconfig.node.json" }]
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment