소스 검색

生产工单-消息推送框架搭建

aiwenzhu 1 개월 전
부모
커밋
0d34ab00ea

+ 58 - 1
src/api/common.js

@@ -337,7 +337,10 @@ export function handleWechatPush(send_weixin_data1, serviceId) {
   });
 }
 
-export function handleWechatPushOfOrder(send_weixin_data1, serviceId) {
+export function handleWechatPushOfInstallationOrder(
+  send_weixin_data1,
+  serviceId
+) {
   return new Promise((resolve, reject) => {
     GetDataByName(send_weixin_data1)
       .then((response) => {
@@ -392,3 +395,57 @@ export function handleWechatPushOfOrder(send_weixin_data1, serviceId) {
       });
   });
 }
+
+export function handleWechatPushOfWorkOrder(send_weixin_data1, serviceId) {
+  return new Promise((resolve, reject) => {
+    GetDataByName(send_weixin_data1)
+      .then((response) => {
+        console.log("微信推送(获取参数)======>", response);
+        if (response.data.message == "ok") {
+          var receiverStr = response.data.list[0].receivers;
+          var receiverArr = receiverStr.split(",");
+          var value1 = response.data.list[0].value1;
+          var value2 = response.data.list[0].value2;
+          var value3 = response.data.list[0].value3;
+          var value4 = response.data.list[0].value4;
+          var value5 = response.data.list[0].value5;
+
+          value4 =
+            value4.length > 17 ? value4.substring(0, 17) + "..." : value4;
+          value2 =
+            value2.length > 17 ? value2.substring(0, 17) + "..." : value2;
+          value3 =
+            value3.length > 17 ? value3.substring(0, 17) + "..." : value3;
+          value1 =
+            value1.length > 17 ? value1.substring(0, 17) + "..." : value1;
+
+          var send_weixin_data2 = {
+            target: receiverArr,
+            serviceId: serviceId,
+            keys: ["thing5", "thing2", "thing6", "thing11", "time7"],
+            content: [
+              { color: "#173177", value: value1 },
+              { color: "#173177", value: value2 },
+              { color: "#173177", value: value3 },
+              { color: "#173177", value: value4 },
+              { color: "#173177", value: value5 },
+            ],
+          };
+
+          wxpush(send_weixin_data2)
+            .then((response) => {
+              console.log("微信推送(发送返回)======>", response);
+              resolve(response);
+            })
+            .catch((error) => {
+              reject(error);
+            });
+        } else {
+          reject(new Error("获取推送参数失败"));
+        }
+      })
+      .catch((error) => {
+        reject(error);
+      });
+  });
+}

+ 7 - 6
src/views/productManagement/installationOrder/components/AddDialog.vue

@@ -388,7 +388,7 @@ import {
   GetDataByName,
   GetDataByNames,
   ExecDataByConfig,
-  handleWechatPushOfOrder,
+  handleWechatPushOfInstallationOrder,
 } from "@/api/common";
 import Cookies from "js-cookie";
 
@@ -765,11 +765,12 @@ export default {
                     },
                   };
 
-                  handleWechatPushOfOrder(send_weixin_data1, 76).catch(
-                    (error) => {
-                      console.error("微信推送失败:", error);
-                    }
-                  );
+                  handleWechatPushOfInstallationOrder(
+                    send_weixin_data1,
+                    76
+                  ).catch((error) => {
+                    console.error("微信推送失败:", error);
+                  });
                 } else {
                   this.$message.error(response.data || "保存失败");
                 }

+ 6 - 4
src/views/productManagement/installationOrder/components/DispatchDialog.vue

@@ -74,7 +74,7 @@
 import {
   ExecDataByConfig,
   GetDataByName,
-  handleWechatPushOfOrder,
+  handleWechatPushOfInstallationOrder,
 } from "@/api/common";
 import Cookies from "js-cookie";
 export default {
@@ -275,9 +275,11 @@ export default {
                 },
               };
 
-              handleWechatPushOfOrder(send_weixin_data1, 77).catch((error) => {
-                console.error("微信推送失败:", error);
-              });
+              handleWechatPushOfInstallationOrder(send_weixin_data1, 77).catch(
+                (error) => {
+                  console.error("微信推送失败:", error);
+                }
+              );
             } else {
               this.$message.error(response.msg || "派单失败");
             }

+ 21 - 13
src/views/productManagement/installationOrder/index.vue

@@ -643,7 +643,7 @@ import {
   GetDataByNames,
   PostDataByName,
   ExecDataByConfig,
-  handleWechatPushOfOrder,
+  handleWechatPushOfInstallationOrder,
 } from "@/api/common";
 import AddDialog from "./components/AddDialog";
 import exportMixin from "@/mixins/exportMixin";
@@ -1290,9 +1290,11 @@ export default {
             },
           };
 
-          handleWechatPushOfOrder(send_weixin_data1, 80).catch((error) => {
-            console.error("微信推送失败:", error);
-          });
+          handleWechatPushOfInstallationOrder(send_weixin_data1, 80).catch(
+            (error) => {
+              console.error("微信推送失败:", error);
+            }
+          );
 
           this.getList();
         } else {
@@ -1415,9 +1417,11 @@ export default {
             },
           };
 
-          handleWechatPushOfOrder(send_weixin_data1, 81).catch((error) => {
-            console.error("微信推送失败:", error);
-          });
+          handleWechatPushOfInstallationOrder(send_weixin_data1, 81).catch(
+            (error) => {
+              console.error("微信推送失败:", error);
+            }
+          );
 
           this.getList();
         } else {
@@ -1555,9 +1559,11 @@ export default {
             },
           };
 
-          handleWechatPushOfOrder(send_weixin_data1, 78).catch((error) => {
-            console.error("微信推送失败:", error);
-          });
+          handleWechatPushOfInstallationOrder(send_weixin_data1, 78).catch(
+            (error) => {
+              console.error("微信推送失败:", error);
+            }
+          );
 
           this.getList();
         } else {
@@ -1621,9 +1627,11 @@ export default {
             },
           };
 
-          handleWechatPushOfOrder(send_weixin_data1, 79).catch((error) => {
-            console.error("微信推送失败:", error);
-          });
+          handleWechatPushOfInstallationOrder(send_weixin_data1, 79).catch(
+            (error) => {
+              console.error("微信推送失败:", error);
+            }
+          );
 
           this.getList();
         } else {

+ 62 - 39
src/views/productManagement/productionWorkOrder/index.vue

@@ -178,39 +178,48 @@
             align="center"
             width="160"
           >
-          <template slot-scope="scope">
-  <template
-    v-if="
-      scope.row.days_diff !== null &&
-      scope.row.days_diff !== undefined &&
-      scope.row.days_diff !== ''
-    "
-  >
-    <span
-      :class="{
-        'normal-time': scope.row.days_diff > 3 || (scope.row.days_diff < 0),
-        'warning-time': scope.row.days_diff >= 0 && scope.row.days_diff <= 3,
-        'overdue-time': scope.row.days_diff < 0,
-      }"
-    >
-      <template v-if="scope.row.days_diff < 0">
-        已逾期 {{ Math.abs(scope.row.days_diff) }} 天 <!-- 负数全部显示为已逾期 -->
-      </template>
-      <template v-else>
-        <!-- 如果 orderStatus 是 '生产完成' 且 days_diff > 0,显示 '提前 X 天' -->
-        <template v-if="scope.row.orderStatus === '生产完成' && scope.row.days_diff > 0">
-          提前 {{ scope.row.days_diff }} 天
-        </template>
-        <template v-else>
-          {{ scope.row.days_diff }} 天 <!-- 其他情况直接显示天数 -->
-        </template>
-      </template>
-    </span>
-  </template>
-  <template v-else>
-    <!-- 如果 days_diff 是空字符串、null 或 undefined,显示空 -->
-  </template>
-</template>
+            <template slot-scope="scope">
+              <template
+                v-if="
+                  scope.row.days_diff !== null &&
+                  scope.row.days_diff !== undefined &&
+                  scope.row.days_diff !== ''
+                "
+              >
+                <span
+                  :class="{
+                    'normal-time':
+                      scope.row.days_diff > 3 || scope.row.days_diff < 0,
+                    'warning-time':
+                      scope.row.days_diff >= 0 && scope.row.days_diff <= 3,
+                    'overdue-time': scope.row.days_diff < 0,
+                  }"
+                >
+                  <template v-if="scope.row.days_diff < 0">
+                    已逾期 {{ Math.abs(scope.row.days_diff) }} 天
+                    <!-- 负数全部显示为已逾期 -->
+                  </template>
+                  <template v-else>
+                    <!-- 如果 orderStatus 是 '生产完成' 且 days_diff > 0,显示 '提前 X 天' -->
+                    <template
+                      v-if="
+                        scope.row.orderStatus === '生产完成' &&
+                        scope.row.days_diff > 0
+                      "
+                    >
+                      提前 {{ scope.row.days_diff }} 天
+                    </template>
+                    <template v-else>
+                      {{ scope.row.days_diff }} 天
+                      <!-- 其他情况直接显示天数 -->
+                    </template>
+                  </template>
+                </span>
+              </template>
+              <template v-else>
+                <!-- 如果 days_diff 是空字符串、null 或 undefined,显示空 -->
+              </template>
+            </template>
           </el-table-column>
 
           <el-table-column
@@ -1699,6 +1708,7 @@ import {
   ExecDataByConfig,
   GetAccount,
   transData,
+  handleWechatPushOfWorkOrder,
 } from "@/api/common";
 import Pagination from "@/components/Pagination1";
 import { MessageBox } from "element-ui";
@@ -3000,6 +3010,9 @@ export default {
       }
 
       this.createProductionOrderParm = {
+        common: {
+          returnmap: "0",
+        },
         data: [
           {
             name: "createProductionOrder",
@@ -3053,6 +3066,22 @@ export default {
       };
       ExecDataByConfig(this.createProductionOrderParm).then((response) => {
         if (response.msg !== "fail") {
+          var workOrderRowId = response.data[0].resultmaps.LastInsertId;
+
+          var send_weixin_data1 = {
+            name: "getRemindData",
+            parammaps: {
+              userId: Cookies.get("g_userId"),
+              remindId: 82,
+              remindTypeName: "生产工单",
+              rowId: workOrderRowId,
+            },
+          };
+
+          handleWechatPushOfWorkOrder(send_weixin_data1, 82).catch((error) => {
+            console.error("微信推送失败:", error);
+          });
+
           this.get_production_work_order();
           this.resetForm();
           this.get_production_work_order();
@@ -3306,9 +3335,3 @@ export default {
   text-overflow: ellipsis; /* 使用省略号表示溢出内容 */
 }
 </style>
-<<<<<<< HEAD
-
-
-
-=======
->>>>>>> f1f1d66c68304db39e340601f5791d2da4a32a97