From 23a2fff92f73b9759849a8016601a6817d7470b1 Mon Sep 17 00:00:00 2001
From: zhangwei <1504152376@qq.com>
Date: 星期一, 25 八月 2025 17:30:30 +0800
Subject: [PATCH] -

---
 src/views/system/dept/utils/hook.tsx |  130 +++++++++++++++++++++++++------------------
 1 files changed, 75 insertions(+), 55 deletions(-)

diff --git a/src/views/system/dept/utils/hook.tsx b/src/views/system/dept/utils/hook.tsx
index a0c9b7b..1aaa5a9 100644
--- a/src/views/system/dept/utils/hook.tsx
+++ b/src/views/system/dept/utils/hook.tsx
@@ -1,8 +1,8 @@
-import dayjs from "dayjs";
+// import dayjs from "dayjs";
 import editForm from "../form.vue";
 import { handleTree } from "@/utils/tree";
 import { message } from "@/utils/message";
-import { zhaobiaoPageOrder } from "@/api/item/index";
+import { zhaobiaoPageOrder, findWechatOpenId } from "@/api/item/index";
 
 import {
   getCaigoufangshiList,
@@ -10,30 +10,31 @@
   getOrderStatusList,
   getRegionList,
   getDaimaleixingList,
+  addgetcontact,
   caigourenAdd,
   caigourenUpdate,
   caigourenDelete,
   caigourenBatchDelete
 } from "@/api/item/index";
-import { usePublicHooks } from "../../hooks";
+// import { usePublicHooks } from "../../hooks";
 import { addDialog } from "@/components/ReDialog";
 import { type Ref, reactive, ref, onMounted, h, computed } from "vue";
-import type { FormItemProps } from "../utils/types";
-import {
-  cloneDeep,
-  isAllEmpty,
-  deviceDetection,
-  getKeyList
-} from "@pureadmin/utils";
-import { useUserStoreHook } from "@/store/modules/user";
+import type { FormItemProps } from "./types";
+import { cloneDeep, deviceDetection, getKeyList } from "@pureadmin/utils";
+// import { useUserStoreHook } from "@/store/modules/user";
 import type { PaginationProps } from "@pureadmin/table";
+import { useUserStoreHook } from "@/store/modules/user";
 
-const nowRole = computed(() => {
-  return useUserStoreHook().nowRole;
-});
+import pdfPreview from "../../component/pdfPreview.vue";
+// const nowRole = computed(() => {
+//   return useUserStoreHook().nowRole;
+// });
 const selectedNum = ref(0);
 
 export function useDept(tableRef: Ref) {
+  const nowRole = computed(() => {
+    return useUserStoreHook().nowRole;
+  });
   const form = reactive({
     // 鏂板鏃ユ湡鑼冨洿锛屽彲涓� null锛岀被鍨嬩负鏁扮粍
     createDateRange: null,
@@ -102,10 +103,10 @@
   const formRef = ref();
   const dataList = ref([]);
   const loading = ref(true);
-  const { tagStyle } = usePublicHooks();
+  // const { tagStyle } = usePublicHooks();
   const getOrderStatus = row => {
     const res = state.orderStatusList.find(item => {
-      return row.orderStatus == item.status;
+      return row.orderStatus == item.value;
     });
     return res?.label;
   };
@@ -131,7 +132,7 @@
       label: "椤圭洰杩涘害",
       prop: "orderStatus",
       minWidth: 70,
-      cellRenderer: ({ row, props }) => getOrderStatus(row)
+      cellRenderer: ({ row }) => getOrderStatus(row)
     },
     {
       label: "鎶ュ悕璐�",
@@ -157,15 +158,13 @@
       label: "璐ㄧ枒",
       prop: "zhiyi",
       minWidth: 100,
-      cellRenderer: ({ row, props }) => (
-        <span>{row.status === 1 ? "鏈�" : "鏃�"}</span>
-      )
+      cellRenderer: ({ row }) => <span>{row.status === 1 ? "鏈�" : "鏃�"}</span>
     },
     {
       label: "鎶曡瘔",
       prop: "tousu",
       minWidth: 100,
-      cellRenderer: ({ row, props }) => (
+      cellRenderer: ({ row }) => (
         // <el-tag size={props.size} style={tagStyle.value(row.status)}>
         <span>{row.status === 1 ? "鏈�" : "鏃�"}</span>
         // </el-tag>
@@ -200,7 +199,7 @@
       label: "椤圭洰杩涘害",
       prop: "orderStatus",
       minWidth: 70,
-      cellRenderer: ({ row, props }) => getOrderStatus(row)
+      cellRenderer: ({ row }) => getOrderStatus(row)
     },
     {
       label: "鎶ュ悕璐�",
@@ -226,15 +225,13 @@
       label: "璐ㄧ枒",
       prop: "zhiyi",
       minWidth: 100,
-      cellRenderer: ({ row, props }) => (
-        <span>{row.status === 1 ? "鏈�" : "鏃�"}</span>
-      )
+      cellRenderer: ({ row }) => <span>{row.status === 1 ? "鏈�" : "鏃�"}</span>
     },
     {
       label: "鎶曡瘔",
       prop: "tousu",
       minWidth: 100,
-      cellRenderer: ({ row, props }) => (
+      cellRenderer: ({ row }) => (
         // <el-tag size={props.size} style={tagStyle.value(row.status)}>
         <span>{row.status === 1 ? "鏈�" : "鏃�"}</span>
         // </el-tag>
@@ -294,10 +291,23 @@
     console.log(`current page: ${val}`);
   }
 
-  function resetForm(formEl) {
-    if (!formEl) return;
-    formEl.resetFields();
-    onSearch();
+  function resetForm() {
+    // if (!formEl) return;
+    // formEl.resetFields();
+    // onSearch();
+
+    addDialog({
+      title: `棰勮pdf`,
+      props: {},
+      width: "60%",
+      draggable: true,
+      fullscreen: deviceDetection(),
+      fullscreenIcon: true,
+      sureBtnLoading: true,
+      closeOnClickModal: false,
+      contentRenderer: () => h(pdfPreview, { ref: formRef, formInline: null })
+      // jsx 璇硶 锛堟敞鎰忓湪.vue鏂囦欢鍚敤jsx璇硶锛岄渶瑕佸湪script寮�鍚痩ang="tsx"锛�
+    });
   }
   const checkboxAsRadio = data => {
     if (data.length > 1) {
@@ -305,6 +315,7 @@
     }
   };
   async function onSearch() {
+    findWechatOpenId();
     const obj = cloneDeep(form);
     obj.tousu = obj.tousu.join("");
     obj.zhiyi = obj.zhiyi.join("");
@@ -317,7 +328,7 @@
     pagination.pageSize = result.pageSize;
     pagination.currentPage = result.page;
     // if (!isAllEmpty(form.name)) {
-    //   // 鍓嶇鎼滅储閮ㄩ棬鍚嶇О
+    //   // 鍓嶇鎼滅储椤圭洰鍚嶇О
     //   newData = newData.filter(item => item.name.includes(form.name));
     // }
     // if (!isAllEmpty(form.status)) {
@@ -328,7 +339,7 @@
   }
 
   function formatHigherDeptOptions(treeList) {
-    // 鏍规嵁杩斿洖鏁版嵁鐨剆tatus瀛楁鍊煎垽鏂拷鍔犳槸鍚︾鐢╠isabled瀛楁锛岃繑鍥炲鐞嗗悗鐨勬爲缁撴瀯锛岀敤浜庝笂绾ч儴闂ㄧ骇鑱旈�夋嫨鍣ㄧ殑灞曠ず锛堝疄闄呭紑鍙戜腑涔熸槸濡傛锛屼笉鍙兘鍓嶇闇�瑕佺殑姣忎釜瀛楁鍚庣閮戒細杩斿洖锛岃繖鏃堕渶瑕佸墠绔嚜琛屾牴鎹悗绔繑鍥炵殑鏌愪簺瀛楁鍋氶�昏緫澶勭悊锛�
+    // 鏍规嵁杩斿洖鏁版嵁鐨剆tatus瀛楁鍊煎垽鏂拷鍔犳槸鍚︾鐢╠isabled瀛楁锛岃繑鍥炲鐞嗗悗鐨勬爲缁撴瀯锛岀敤浜庝笂绾ч」鐩骇鑱旈�夋嫨鍣ㄧ殑灞曠ず锛堝疄闄呭紑鍙戜腑涔熸槸濡傛锛屼笉鍙兘鍓嶇闇�瑕佺殑姣忎釜瀛楁鍚庣閮戒細杩斿洖锛岃繖鏃堕渶瑕佸墠绔嚜琛屾牴鎹悗绔繑鍥炵殑鏌愪簺瀛楁鍋氶�昏緫澶勭悊锛�
     if (!treeList || !treeList.length) return;
     const newTreeList = [];
     for (let i = 0; i < treeList.length; i++) {
@@ -339,8 +350,8 @@
     return newTreeList;
   }
 
-  function openDialog(title = "鏂板", row?: FormItemProps) {
-    console.log(row, "-");
+  async function openDialog(title = "鏂板", row?: FormItemProps) {
+    const { result } = title == "鏂板" ? await addgetcontact() : "";
 
     addDialog({
       title: `${title}椤圭洰`,
@@ -357,28 +368,36 @@
           baomingfei: row?.baomingfei ?? null, // 鎶ュ悕璐癸紙鍙�夛級
           toubiaobaozhengjin: row?.toubiaobaozhengjin ?? null, // 鎶曟爣淇濊瘉閲戯紙鍙�夛級
           lianhetitoubiao: row?.lianhetitoubiao ?? null, // 鑱斿悎浣撴姇鏍囷紙鍙�夛級
-          kaibiaofangshi: row?.kaibiaofangshi ?? null, // 寮�鏍囨柟寮忥紙鍙�夛級
+          kaibiaofangshi: row?.kaibiaofangshi ?? "绾歌川鏍�", // 寮�鏍囨柟寮忥紙鍙�夛級
           shifoufenbao: row?.shifoufenbao ?? "false", // 鏄惁鍒嗗寘锛堝彲閫夛級
           shifoutuisongxuanchuan: row?.shifoutuisongxuanchuan ?? "true", // 鏄惁鎺ㄩ�佸浼狅紙鍙�夛級
-          caigourenmingcheng: row?.caigourenmingcheng ?? null, // 閲囪喘浜哄悕绉帮紙鍙�夛級
+          caigourenmingcheng:
+            row?.caigourenmingcheng ?? result?.caigourenmingcheng, // 閲囪喘浜哄悕绉帮紙鍙�夛級
           xingzhengquyu: row?.xingzhengquyu.split(",") ?? [], // 琛屾斂鍖哄煙锛堝彲閫夛級
           xingzhengquyuName: row?.xingzhengquyuName ?? null, // 琛屾斂鍖哄煙鍚嶇О锛堝彲閫夛級
-          jigoudaima: row?.jigoudaima ?? null, // 鏈烘瀯浠g爜锛堝彲閫夛級
+          jigoudaima: row?.jigoudaima ?? result?.jigoudaima, // 鏈烘瀯浠g爜锛堝彲閫夛級
           daimaleixing: row?.daimaleixing ?? null, // 浠g爜绫诲瀷锛堝彲閫夛級
-          lianxiren: row?.lianxiren ?? null, // 鑱旂郴浜猴紙鍙�夛級
-          lianxidianhua: row?.lianxidianhua ?? null, // 鑱旂郴鐢佃瘽锛堝彲閫夛級
-          tongxindizhi: row?.tongxindizhi ?? null, // 閫氫俊鍦板潃锛堝彲閫夛級
-          dianziyoujian: row?.dianziyoujian ?? null, // 鐢靛瓙閭欢锛堝彲閫夛級
-          xiangmujingbanren: row?.xiangmujingbanren ?? null, // 椤圭洰缁忓姙浜猴紙鍙�夛級
+          lianxiren: row?.lianxiren ?? result?.lianxiren, // 鑱旂郴浜猴紙鍙�夛級
+          lianxidianhua: row?.lianxidianhua ?? result?.lianxidianhua, // 鑱旂郴鐢佃瘽锛堝彲閫夛級
+          tongxindizhi: row?.tongxindizhi ?? result?.tongxindizhi, // 閫氫俊鍦板潃锛堝彲閫夛級
+          dianziyoujian: row?.dianziyoujian ?? result?.dianziyoujian, // 鐢靛瓙閭欢锛堝彲閫夛級
+          xiangmujingbanren:
+            row?.xiangmujingbanren ?? result?.xiangmujingbanren, // 椤圭洰缁忓姙浜猴紙鍙�夛級
           zhiwu: row?.zhiwu ?? null, // 鑱屽姟锛堝彲閫夛級
           jingbanrendianhua: row?.jingbanrendianhua ?? null, // 缁忓姙浜虹數璇濓紙鍙�夛級
-          dailijigoumingcheng: row?.dailijigoumingcheng ?? null, // 浠g悊鏈烘瀯鍚嶇О锛堝彲閫夛級
-          dailiLianxiren: row?.dailiLianxiren ?? null, // 浠g悊鏈烘瀯鑱旂郴浜猴紙鍙�夛級
-          dailiLianxidianhua: row?.dailiLianxidianhua ?? null, // 浠g悊鏈烘瀯鑱旂郴鐢佃瘽锛堝彲閫夛級
-          dailiDianziyoujian: row?.dailiDianziyoujian ?? null, // 浠g悊鏈烘瀯鐢靛瓙閭欢锛堝彲閫夛級
-          dailiTongxindizhi: row?.dailiTongxindizhi ?? null, // 浠g悊鏈烘瀯閫氫俊鍦板潃锛堝彲閫夛級
-          dailiXiangmujingli: row?.dailiXiangmujingli ?? null, // 浠g悊鏈烘瀯椤圭洰缁忕悊锛堝彲閫�
-          dailijingliLianxidianhua: row?.dailijingliLianxidianhua ?? null // 浠g悊鏈烘瀯椤圭洰缁忕悊鑱旂郴鐢佃瘽锛堝彲閫夛級
+          dailijigoumingcheng:
+            row?.dailijigoumingcheng ?? result?.dailijigoumingcheng, // 浠g悊鏈烘瀯鍚嶇О锛堝彲閫夛級
+          dailiLianxiren: row?.dailiLianxiren ?? result?.dailiLianxiren, // 浠g悊鏈烘瀯鑱旂郴浜猴紙鍙�夛級
+          dailiLianxidianhua:
+            row?.dailiLianxidianhua ?? result?.dailiLianxidianhua, // 浠g悊鏈烘瀯鑱旂郴鐢佃瘽锛堝彲閫夛級
+          dailiDianziyoujian:
+            row?.dailiDianziyoujian ?? result?.dailiDianziyoujian, // 浠g悊鏈烘瀯鐢靛瓙閭欢锛堝彲閫夛級
+          dailiTongxindizhi:
+            row?.dailiTongxindizhi ?? result?.dailiTongxindizhi, // 浠g悊鏈烘瀯閫氫俊鍦板潃锛堝彲閫夛級
+          dailiXiangmujingli:
+            row?.dailiXiangmujingli ?? result?.dailiXiangmujingli, // 浠g悊鏈烘瀯椤圭洰缁忕悊锛堝彲閫�
+          dailijingliLianxidianhua:
+            row?.dailijingliLianxidianhua ?? result?.dailijingliLianxidianhua // 浠g悊鏈烘瀯椤圭洰缁忕悊鑱旂郴鐢佃瘽锛堝彲閫夛級
         }
       },
       width: "80%",
@@ -392,9 +411,6 @@
         const FormRef = formRef.value.getRef();
         const curData = cloneDeep(options.props.formInline as FormItemProps);
         async function chores() {
-          message(`鎮�${title}浜嗛」鐩悕绉颁负${curData.projectName}鐨勮繖鏉℃暟鎹甡, {
-            type: "success"
-          });
           // curData.dingbiaoguize = curData.dingbiaoguize.join("");
           curData.xingzhengquyu = curData.xingzhengquyu.join(",");
           let res;
@@ -406,6 +422,9 @@
           if (res.code == "200") {
             done(); // 鍏抽棴寮规
             onSearch(); // 鍒锋柊琛ㄦ牸鏁版嵁
+            message(`鎮�${title}浜嗛」鐩悕绉颁负${curData.projectName}鐨勮繖鏉℃暟鎹甡, {
+              type: "success"
+            });
           } else {
             closeLoading();
             message(res.message, {
@@ -474,9 +493,9 @@
     onSearch,
     /** 閲嶇疆 */
     resetForm,
-    /** 鏂板銆佷慨鏀归儴闂� */
+    /** 鏂板銆佷慨鏀归」鐩� */
     openDialog,
-    /** 鍒犻櫎閮ㄩ棬 */
+    /** 鍒犻櫎椤圭洰 */
     handleDelete,
     handleSelectionChange,
     handleSizeChange,
@@ -484,6 +503,7 @@
     pagination,
     checkboxAsRadio,
     onSelectionCancel,
-    onbatchDel
+    onbatchDel,
+    nowRole
   };
 }

--
Gitblit v1.9.1