Commit 3d531691 authored by zhanglongbao's avatar zhanglongbao

feat

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