xiaohaizhao пре 2 месеци
родитељ
комит
3ffa3f30f3

+ 5 - 0
E-service/serviceBillList/detail.js

@@ -33,6 +33,11 @@ Page({
       label: "受理信息",
       idname: "sa_serviceorderid",
       color: "#3874F6"
+    }, {
+      label: "关联改善单",
+      idname: "sa_serviceorderid",
+      color: "#F48403",
+      model: "#Improvement"
     }],
     tabsActive: 0,
     reason: {

+ 1 - 0
E-service/serviceBillList/detail.json

@@ -9,6 +9,7 @@
     "WorkOrderTeam": "/E-service/workOrder/team/index",
     "WorkOrderPview": "/E-service/workOrder/Pview/index",
     "WorkOrderNotarizeBill": "/E-service/workOrder/notarizeBill/index",
+    "Improvement": "/E-service/workOrder/Improvement/index",
     "Files": "/components/files/index",
     "Record": "/components/record/index"
   }

+ 1 - 0
E-service/serviceBillList/detail.wxml

@@ -58,6 +58,7 @@
 	<ServiceProduct slot='服务商品' id="ServiceProduct" sa_orderid='{{detail.sa_orderid}}' disabled='{{detail.status!="新建"}}' />
 	<ServicePview1 id='ServicePview1' slot='申请信息' />
 	<ServicePview2 id='ServicePview2' slot='受理信息' />
+	<Improvement slot='关联改善单' id='Improvement' idname='2026022709165502' />
 
 	<!-- 工单 -->
 	<WorkOrderPview id='WorkOrderPview' slot='工单信息' tabColorS='{{tabColorS}}' />

+ 2 - 2
E-service/serviceImprovement/detail.js

@@ -9,7 +9,7 @@ Page({
         color: "#3874F6"
       },
       无效: {
-        bgColor: "#FCE4E4",
+        bgColor: "#FDE4E3",
         color: "#ED4949"
       },
     },
@@ -230,7 +230,7 @@ Page({
     }, {
       label: "改善结果",
       value: res.data.result,
-      style: `color:${this.data.sColors[res.data.result]}`
+      style: `color:${this.data.tabColorS[res.data.result].color}`
     }, {
       label: "备注",
       value: res.data.remarks

+ 2 - 2
E-service/serviceImprovement/index.js

@@ -30,7 +30,7 @@ Page({
         color: "#3874F6"
       },
       无效: {
-        bgColor: "#FCE4E4",
+        bgColor: "#FDE4E3",
         color: "#ED4949"
       },
     },
@@ -38,7 +38,7 @@ Page({
   },
   async onLoad(options) {
     this.getList()
-    getApp().globalData.Language.getLanguagePackage(this, 'E-订单');
+    getApp().globalData.Language.getLanguagePackage(this, '服务改善');
     let filtratelist = [{
       label: "改善类别",
       index: null,

+ 107 - 0
E-service/workOrder/Improvement/index.js

@@ -0,0 +1,107 @@
+const _Http = getApp().globalData.http;
+
+Component({
+  properties: {
+    idname: {
+      type: [String, Number]
+    }
+  },
+  options: {
+    addGlobalClass: true
+  },
+  lifetimes: {
+    attached: function () {
+      getApp().globalData.Language.getLanguagePackage(this)
+    }
+  },
+  data: {
+    sa_workorderid: 0,
+    content: {
+      nocache: true,
+      pageNumber: 1,
+      pageSize: 10,
+      pageTotal: 1,
+      total: null,
+      where: {
+        condition: ""
+      }
+    },
+    list: [],
+    showSearch: false,
+    focus: false,
+    condition: "",
+    tabColorS: {
+      有效: {
+        bgColor: "#E1EAFE",
+        color: "#3874F6"
+      },
+      无效: {
+        bgColor: "#FDE4E3",
+        color: "#ED4949"
+      },
+    },
+  },
+  methods: {
+    getList(id, init = false) {
+      console.log("getList", id)
+      let content = {
+        ...this.data.content,
+        sa_workorderid: id || this.data.sa_workorderid,
+        sa_serviceorderid: id || this.data.sa_workorderid,
+      };
+      content.where.sa_workorderid = content.sa_workorderid
+      if (init) {
+        content.pageNumber = 1
+        content.pageTotal = 1
+      }
+      _Http.basic({
+        "id": this.data.idname,
+        content
+      }).then(res => {
+        console.log("服务确认单", res)
+        if (res.code != '1') return wx.showToast({
+          title: res.data,
+          icon: "none"
+        });
+        this.setData({
+          "content.pageNumber": res.pageNumber + 1,
+          "content.pageTotal": res.pageTotal,
+          "content.total": res.total,
+          list: res.pageNumber == 1 ? res.data : this.data.list.concat(res.data),
+          sa_workorderid: content.sa_workorderid
+        })
+      })
+    },
+    toSearch() {
+      if (this.data.showSearch && this.data.content.where.condition) {
+        this.data.content.where.condition = '';
+        this.getList("", true);
+      } else if (this.data.condition) {
+        this.data.content.where.condition = this.data.condition;
+        this.setData({
+          condition: this.data.condition
+        })
+        this.getList("", true);
+      }
+      this.setData({
+        showSearch: !this.data.showSearch
+      })
+      setTimeout(() => {
+        this.setData({
+          focus: this.data.showSearch
+        })
+      }, 300)
+    },
+    onChange({
+      detail
+    }) {
+      this.data.condition = detail;
+    },
+    onSearch({
+      detail
+    }) {
+      this.data.content.where.condition = detail;
+      this.getList("", true)
+    },
+  }
+})

+ 6 - 0
E-service/workOrder/Improvement/index.json

@@ -0,0 +1,6 @@
+{
+  "component": true,
+  "usingComponents": {
+    "t-cell": "tdesign-miniprogram/cell/cell"
+  }
+}

+ 95 - 0
E-service/workOrder/Improvement/index.scss

@@ -0,0 +1,95 @@
+.head {
+	display: flex;
+	align-items: center;
+	width: 100vw;
+	height: 120rpx;
+	padding: 0 20rpx 0 30rpx;
+	box-sizing: border-box;
+
+	.count {
+		font-size: 28rpx;
+		font-family: PingFang SC-Regular, PingFang SC;
+		color: #333333;
+	}
+
+	.expand {
+		flex: 1;
+		display: flex;
+		align-items: center;
+		justify-content: flex-end;
+
+		.but {
+			display: flex;
+			align-items: center;
+			justify-content: center;
+			flex-shrink: 0;
+			width: 80rpx;
+			height: 80rpx;
+			background: #FFFFFF;
+			border-radius: 8rpx;
+			border: 2rpx solid #CCCCCC;
+			margin-left: 20rpx;
+			color: #666666;
+		}
+	}
+}
+
+.custom-class {
+	--search-background-color: #fff !important;
+	padding-right: 10rpx !important;
+}
+
+.item {
+	width: 690rpx;
+	background: #FFFFFF;
+	border-radius: 8rpx;
+	padding: 20rpx;
+	box-sizing: border-box;
+	margin: 0 auto 20rpx;
+
+	.head {
+		display: flex;
+		justify-content: space-between;
+		align-items: center;
+		width: 100%;
+		padding-bottom: 18rpx;
+		border-bottom: 1px solid #DDDDDD;
+
+		.tabs {
+			display: flex;
+
+			.tab {
+				font-family: PingFang SC, PingFang SC;
+				font-size: 24rpx;
+				padding: 0 12rpx;
+				line-height: 40rpx;
+				border-radius: 20rpx;
+				margin-right: 20rpx;
+				background-color: #E1EAFE;
+				color: #3874F6
+			}
+		}
+
+		.status {
+			font-family: PingFang SC, PingFang SC;
+			font-size: 28rpx;
+			color: #3874F6;
+		}
+	}
+
+	.address {
+		line-height: 40rpx;
+		font-family: PingFang SC, PingFang SC;
+		font-size: 28rpx;
+		color: #333333;
+		margin-top: 8rpx;
+	}
+
+	.row {
+		line-height: 34rpx;
+		font-family: PingFang SC, PingFang SC;
+		font-size: 24rpx;
+		color: #999999;
+		margin-top: 8rpx;
+	}
+}

+ 32 - 0
E-service/workOrder/Improvement/index.wxml

@@ -0,0 +1,32 @@
+<view class="head">
+	<view class="count">
+		{{language['关联改善单']||'关联改善单'}}
+	</view>
+	<view class="expand">
+		<van-search wx:if="{{showSearch}}" custom-class='custom-class' focus='{{focus}}' value="{{ condition }}" shape="round" bind:change='onChange' bind:search='onSearch' bind:clear='onSearch' placeholder="搜索关键词" background='#F4F5F7' />
+		<navigator url="#" class="but" bindtap="toSearch">
+			<van-icon name="search" />
+		</navigator>
+	</view>
+</view>
+<navigator class="item" url="/E-service/serviceImprovement/detail?id={{item.sa_service_improvementid}}" wx:for="{{list}}" wx:key="sa_serviceorderid">
+		<view class="head">
+			<view class="tabs">
+				<view class="tab" wx:if="{{item.type}}">
+					{{language[item.type]||item.type}}
+				</view>
+				<view class="tab" style="background-color: {{tabColorS[item.result].bgColor}};color:{{tabColorS[item.result].color}};">
+					{{language[item.result]||item.result}}
+				</view>
+			</view>
+			<view class="status" style="color:{{sColors[item.status]}};">{{language[item.status]||item.status}}</view>
+		</view>
+		<view class="address">{{language['改善单号']||'改善单号'}}:{{item.billno}}</view>
+		<view class="row">{{language['客诉大类']||'客诉大类'}}:{{language[item.class2]||item.class2 || '--'}}</view>
+		<view class="row">{{language['分析负责人']||'分析负责人'}}:{{item.name_analysis || '--'}}</view>
+		<view class="row">{{language['方案编辑人']||'方案编辑人'}}:{{item.name_charge || '--'}}</view>
+		<view class="row">{{language['负责部门']||'负责部门'}}:{{language[item.depname_charge]||item.depname_charge||'--'}}</view>
+		<view class="row">{{language['改善计划周期']||'改善计划周期'}}:{{item.planned_days}}{{language['天']||'天'}}</view>
+		<view class="row">{{language['改善方案进度']||'改善方案进度'}}:{{item.progress * 100}}%</view>
+	</navigator>
+	<Yl_Empty wx:if="{{list.length==0}}" />

+ 9 - 3
E-service/workOrder/detail.js

@@ -52,6 +52,11 @@ Page({
       label: "工单信息",
       idname: "sa_workorderid",
       color: "#2AA520"
+    }, {
+      label: "关联改善单",
+      idname: "sa_workorderid",
+      color: "#F48403",
+      model: "#Improvement"
     }],
     tabsActive: 0,
     reason: {
@@ -71,7 +76,8 @@ Page({
     _Http.basic({
       "id": 20230208140103,
       "content": {
-        "sa_workorderid": this.data.sa_workorderid
+        "sa_workorderid": this.data.sa_workorderid,
+        nocache: true
       },
     }).then(async res => {
       console.log("工单详情", res)
@@ -84,11 +90,11 @@ Page({
       })
       if (res.data.actiontype == '非工序模板') {
         this.setData({
-          tabsList: this.data.tabsList.filter(v => ['工单服务商品', '服务确认单', '服务团队', '工单信息'].includes(v.label))
+          tabsList: this.data.tabsList.filter(v => ['工单服务商品', '服务确认单', '服务团队', '工单信息', '关联改善单'].includes(v.label))
         })
       } else {
         this.setData({
-          tabsList: this.data.tabsList.filter(v => ['工序详情', '工单物料', '服务确认单', '服务团队', '工单信息'].includes(v.label))
+          tabsList: this.data.tabsList.filter(v => ['工序详情', '工单物料', '服务确认单', '服务团队', '工单信息', '关联改善单'].includes(v.label))
         })
       }
       this.selectComponent("#WorkOrderPview").setPreview(res);

+ 1 - 0
E-service/workOrder/detail.json

@@ -4,6 +4,7 @@
     "WorkOrderMaterial": "/E-service/workOrder/material/index",
     "WorkOrderNodes": "/E-service/workOrder/nodes/index",
     "WorkOrderTeam": "/E-service/workOrder/team/index",
+    "Improvement": "/E-service/workOrder/Improvement/index",
     "WorkOrderPview": "/E-service/workOrder/Pview/index",
     "WorkOrderNotarizeBill": "/E-service/workOrder/notarizeBill/index",
     "ServiceProduct": "/E-service/serviceBillList/product/index",

+ 1 - 1
E-service/workOrder/detail.wxml

@@ -70,7 +70,7 @@
 	<WorkOrderProduct slot='工单服务商品' id='WorkOrderProduct' disabled="{{detail.status != '进行中'}}" />
 	<WorkOrderMaterial slot='工单物料' id='WorkOrderMaterial' />
 	<WorkOrderNotarizeBill slot='服务确认单' billData='{{detail}}' id='WorkOrderNotarizeBill' disabled="{{detail.status != '进行中'}}" />
-	
+	<Improvement slot='关联改善单' id='Improvement' idname='2026022709163402' />
 	<!-- 服务申请单 -->
 	<ServiceProduct slot='服务商品' id="ServiceProduct" sa_orderid='{{detail.sa_orderid}}' disabled='{{true}}' />
 	<ServicePview1 id='ServicePview1' slot='申请信息' />

+ 0 - 1
E-service/workOrder/team/index.js

@@ -136,7 +136,6 @@ Component({
           }).then(res => {
             getApp().globalData.Language.showToast(res.code == '1' ? "操作成功" : res.msg)
             if (res.code == 1) getCurrentPages().find(v => v.__route__ == 'E-service/workOrder/detail').getDetail()
-            this.getList(true)
           })
         }
       })

+ 69 - 19
components/Yl_FunTabs/index.js

@@ -17,49 +17,99 @@ Component({
         showIcon: {
             type: Boolean,
             value: true
+        },
+        anchor: {
+            type: Number,
+            value: 0.4 // 锚点位置,0-1,表示选中项中心在容器宽度的比例位置
         }
     },
     data: {
         scrollLeft: 0,
-        startPoint: 0, //记录滑动的初始位置
-        slipFlag: false, //定义 滑动事件 节流阀, 防止一次滑动触发多次滑动事件
+        startPoint: 0,
+        slipFlag: false,
     },
     lifetimes: {
         attached: function () {
-            getApp().globalData.Language.getLanguagePackage(this)
+            getApp().globalData.Language.getLanguagePackage(this);
+        },
+        ready: function () {
+            this.setActive();
         }
     },
     methods: {
         tabsChenge(e) {
-            const {
-                index
-            } = e.currentTarget.dataset;
+            const { index } = e.currentTarget.dataset;
             if (this.data.active == index) return;
             this.setData({
                 active: index
+            }, () => {
+                this.setActive();
             });
-            this.setActive();
         },
         setActive() {
-            const that = this,
-                active = this.data.active,
-                query = wx.createSelectorQuery().in(this)
-            query.select('#active' + active).boundingClientRect(function (res) {
-                that.setData({
-                    scrollLeft: res.right - res.width
-                })
-            }).exec();
-            this.triggerEvent("onChenge", active)
+            const that = this;
+            const active = this.data.active;
+            const anchor = this.data.anchor;
+            const query = wx.createSelectorQuery().in(this);
+
+            query.select('.scroll').fields({ rect: true, scrollOffset: true })
+                .select(`#active${active}`).boundingClientRect()
+                .selectAll('.item').boundingClientRect()
+                .exec((res) => {
+                    const container = res[0];
+                    const elem = res[1];
+                    const items = res[2];
+
+                    if (!container || !elem || !items || items.length === 0) return;
+
+                    // 容器宽度通过 right - left 计算
+                    const containerWidth = container.right - container.left;
+                    const containerLeft = container.left;
+                    const currentScrollLeft = container.scrollLeft || 0;
+
+                    const firstItem = items[0];
+                    const lastItem = items[items.length - 1];
+
+                    // 第一个元素相对于内容左边界的偏移(通常为0)
+                    const firstItemLeftContent = firstItem.left - containerLeft + currentScrollLeft;
+                    // 最后一个元素右边界相对于内容左边界的偏移
+                    const lastItemRightContent = lastItem.left - containerLeft + currentScrollLeft + lastItem.width;
+                    const contentWidth = lastItemRightContent - firstItemLeftContent;
+
+                    const viewportWidth = containerWidth;
+                    const maxScrollLeft = Math.max(0, contentWidth - viewportWidth);
+
+                    // 选中元素在内容中的左偏移(相对于第一个元素)
+                    const elemLeftContent = elem.left - containerLeft + currentScrollLeft - firstItemLeftContent;
+
+                    // 目标:元素中心位于可视区域宽度 * anchor 处
+                    const targetElemLeftInViewport = viewportWidth * anchor - elem.width / 2;
+
+                    let targetScrollLeft = elemLeftContent - targetElemLeftInViewport;
+
+                    // 边界限制
+                    if (targetScrollLeft < 0) targetScrollLeft = 0;
+                    if (targetScrollLeft > maxScrollLeft) targetScrollLeft = maxScrollLeft;
+
+                    // 避免微小移动
+                    if (Math.abs(targetScrollLeft - currentScrollLeft) < 1) return;
+
+                    that.setData({
+                        scrollLeft: targetScrollLeft
+                    });
+                });
+
+            this.triggerEvent("onChenge", active);
         },
         myTouchStart(e) {
-            return;
+            return; // 禁用滑动切换
             this.setData({
                 slipFlag: true,
                 startPoint: e.touches[0]
             })
         },
         myTouchMove(e) {
-            return;
+            return; // 禁用滑动切换
             let active = this.data.active;
             if (((this.data.startPoint.clientX - e.touches[e.touches.length - 1].clientX) > 80) && this.data.slipFlag) {
                 if (active != this.data.list.length - 1) active++;
@@ -77,4 +127,4 @@ Component({
             this.setActive();
         },
     }
-})
+});

+ 8 - 1
project.private.config.json

@@ -27,10 +27,17 @@
         {
           "name": "E-service/workOrder/detail",
           "pathName": "E-service/workOrder/detail",
-          "query": "id=1385",
+          "query": "id=1406",
           "scene": null,
           "launchMode": "default"
         },
+        {
+          "name": "E-service/workOrder/detail",
+          "pathName": "E-service/workOrder/detail",
+          "query": "id=1385",
+          "launchMode": "default",
+          "scene": null
+        },
         {
           "name": "E-service/serviceImprovement/detail",
           "pathName": "E-service/serviceImprovement/detail",