Procházet zdrojové kódy

暂存,完成工序团队人员

Zachary před 1 týdnem
rodič
revize
9e7e8a1996

+ 136 - 135
app.json

@@ -1,137 +1,138 @@
 {
 {
-    "pages": [
-        "pages/login/phone",
-        "pages/login/selectSite",
-        "pages/login/retrievePassword",
-        "pages/tabbar/home/index",
-        "pages/tabbar/mine/index",
-        "pages/tabbar/message/index",
-        "pages/tabbar/mine/userMsg/index",
-        "pages/tabbar/message/details",
-        "pages/tabbar/mine/changePassword/index",
-        "pages/teams/index",
-        "pages/teams/addUsers",
-        "pages/teams/addRole",
-        "pages/group/index",
-        "pages/group/select",
-        "pages/tags/index",
-        "pages/tabbar/mine/webView",
-        "pages/tabbar/mine/associatedPublicNumber",
-        "pages/trace/insert",
-        "pages/trace/detail",
-        "pages/login/developerTools"
-    ],
-    "subpackages": [
-        {
-            "root": "bgj",
-            "pages": [
-                "handling/index",
-                "workOrder/index",
-                "customerArchive/index",
-                "workerHome/index",
-                "handling/detail",
-                "handling/transferWorkOrder/transfer",
-                "handling/assignAgent/assign",
-                "handling/linkWork/link",
-                "workOrder/detail",
-                "workOrder/nodes/index",
-                "workOrder/nodeDetail/index",
-                "workOrder/components/autoUpload/upload",
-                "workOrder/components/signName/index",
-                "workOrder/materialAdd/material",
-                "workOrder/signature/index"
-            ]
-        }
-    ],
-    "preloadRule": {
-        "pages/login/phone": {
-            "packages": [
-                "bgj"
-            ],
-            "network": "all"
-        }
-    },
-    "usingComponents": {
-        "Preview": "/components/preview/index",
-        "My_Empty": "/components/My_empty/index",
-        "Record": "/components/record/index",
-        "Files": "/components/files/index",
-        "Yl_Files": "/components/Yl_Files/index",
-        "Yl_Tabbar": "/components/Yl_Tabbar/index",
-        "Yl-tags": "/pages/tags/modules/Yl-tags/index",
-        "Yl-group": "/pages/group/modules/Yl-group/index",
-        "Yl_field": "/components/Yl_field/index",
-        "Yl_FloatingButton": "/components/Yl_FloatingButton/index",
-        "Yl_ReportForms": "/components/Yl_ReportForms/index",
-        "Yl_Headline": "/components/Yl_Headline/index",
-        "Yl_FunTabs": "/components/Yl_FunTabs/index",
-        "Yl_Head": "/components/Yl_Head/index",
-        "Yl_nav": "/components/Yl_nav/index",
-        "Yl_filtrate": "/components/Yl_filtrate/index",
-        "organization": "/components/organization/index",
-        "Yl_Filtrate1": "/components/Yl_Filtrate1/index",
-        "Yl_ListBox": "/components/Yl_ListBox/index",
-        "My_empty": "/components/My_empty/index",
-        "timeRange": "/components/timeRange/timeRange",
-        "van-button": "@vant/weapp/button/index",
-        "van-icon": "@vant/weapp/icon/index",
-        "van-image": "@vant/weapp/image/index",
-        "van-loading": "@vant/weapp/loading/index",
-        "van-tab": "@vant/weapp/tab/index",
-        "van-tabs": "@vant/weapp/tabs/index",
-        "van-search": "@vant/weapp/search/index",
-        "van-tag": "@vant/weapp/tag/index",
-        "van-dropdown-menu": "@vant/weapp/dropdown-menu/index",
-        "van-dropdown-item": "@vant/weapp/dropdown-item/index",
-        "van-tree-select": "@vant/weapp/tree-select/index",
-        "van-toast": "@vant/weapp/toast/index",
-        "van-cell": "@vant/weapp/cell/index",
-        "van-action-sheet": "@vant/weapp/action-sheet/index",
-        "van-popup": "@vant/weapp/popup/index",
-        "van-checkbox": "@vant/weapp/checkbox/index",
-        "van-checkbox-group": "@vant/weapp/checkbox-group/index",
-        "van-transition": "@vant/weapp/transition/index",
-        "van-dialog": "@vant/weapp/dialog/index",
-        "van-uploader": "@vant/weapp/uploader/index",
-        "viewDate": "/components/viewDate/index",
-        "filtrate": "/components/filtrate/filtrate"
-    },
-    "tabBar": {
-        "custom": true,
-        "color": "#000000",
-        "selectedColor": "#000000",
-        "backgroundColor": "#000000",
-        "list": [
-            {
-                "pagePath": "pages/tabbar/home/index"
-            },
-            {
-                "pagePath": "pages/tabbar/message/index"
-            },
-            {
-                "pagePath": "pages/tabbar/mine/index"
-            }
-        ]
-    },
-    "window": {
-        "backgroundTextStyle": "light",
-        "navigationBarBackgroundColor": "#085CDF",
-        "navigationBarTitleText": "班管家",
-        "navigationBarTextStyle": "white"
-    },
-    "permission": {
-        "scope.userLocation": {
-            "desc": "您的位置信息将用于小程序位置接口的效果展示"
-        }
-    },
-    "requiredPrivateInfos": [
-        "getLocation"
-    ],
-    "plugins": {
-        "WechatSI": {
-            "version": "0.0.7",
-            "provider": "wx069ba97219f66d99"
-        }
-    },
-    "sitemapLocation": "sitemap.json"
+	"pages": [
+		"pages/login/phone",
+		"pages/login/selectSite",
+		"pages/login/retrievePassword",
+		"pages/tabbar/home/index",
+		"pages/tabbar/mine/index",
+		"pages/tabbar/message/index",
+		"pages/tabbar/mine/userMsg/index",
+		"pages/tabbar/message/details",
+		"pages/tabbar/mine/changePassword/index",
+		"pages/teams/index",
+		"pages/teams/addUsers",
+		"pages/teams/addRole",
+		"pages/group/index",
+		"pages/group/select",
+		"pages/tags/index",
+		"pages/tabbar/mine/webView",
+		"pages/tabbar/mine/associatedPublicNumber",
+		"pages/trace/insert",
+		"pages/trace/detail",
+		"pages/login/developerTools"
+	],
+	"subpackages": [
+		{
+			"root": "bgj",
+			"pages": [
+				"handling/index",
+				"workOrder/index",
+				"customerArchive/index",
+				"workerHome/index",
+				"handling/detail",
+				"handling/transferWorkOrder/transfer",
+				"handling/assignAgent/assign",
+				"handling/linkWork/link",
+				"workOrder/detail",
+				"workOrder/nodes/index",
+				"workOrder/nodes/update/update",
+				"workOrder/nodeDetail/index",
+				"workOrder/components/autoUpload/upload",
+				"workOrder/components/signName/index",
+				"workOrder/materialAdd/material",
+				"workOrder/signature/index"
+			]
+		}
+	],
+	"preloadRule": {
+		"pages/login/phone": {
+			"packages": [
+				"bgj"
+			],
+			"network": "all"
+		}
+	},
+	"usingComponents": {
+		"Preview": "/components/preview/index",
+		"My_Empty": "/components/My_empty/index",
+		"Record": "/components/record/index",
+		"Files": "/components/files/index",
+		"Yl_Files": "/components/Yl_Files/index",
+		"Yl_Tabbar": "/components/Yl_Tabbar/index",
+		"Yl-tags": "/pages/tags/modules/Yl-tags/index",
+		"Yl-group": "/pages/group/modules/Yl-group/index",
+		"Yl_field": "/components/Yl_field/index",
+		"Yl_FloatingButton": "/components/Yl_FloatingButton/index",
+		"Yl_ReportForms": "/components/Yl_ReportForms/index",
+		"Yl_Headline": "/components/Yl_Headline/index",
+		"Yl_FunTabs": "/components/Yl_FunTabs/index",
+		"Yl_Head": "/components/Yl_Head/index",
+		"Yl_nav": "/components/Yl_nav/index",
+		"Yl_filtrate": "/components/Yl_filtrate/index",
+		"organization": "/components/organization/index",
+		"Yl_Filtrate1": "/components/Yl_Filtrate1/index",
+		"Yl_ListBox": "/components/Yl_ListBox/index",
+		"My_empty": "/components/My_empty/index",
+		"timeRange": "/components/timeRange/timeRange",
+		"van-button": "@vant/weapp/button/index",
+		"van-icon": "@vant/weapp/icon/index",
+		"van-image": "@vant/weapp/image/index",
+		"van-loading": "@vant/weapp/loading/index",
+		"van-tab": "@vant/weapp/tab/index",
+		"van-tabs": "@vant/weapp/tabs/index",
+		"van-search": "@vant/weapp/search/index",
+		"van-tag": "@vant/weapp/tag/index",
+		"van-dropdown-menu": "@vant/weapp/dropdown-menu/index",
+		"van-dropdown-item": "@vant/weapp/dropdown-item/index",
+		"van-tree-select": "@vant/weapp/tree-select/index",
+		"van-toast": "@vant/weapp/toast/index",
+		"van-cell": "@vant/weapp/cell/index",
+		"van-action-sheet": "@vant/weapp/action-sheet/index",
+		"van-popup": "@vant/weapp/popup/index",
+		"van-checkbox": "@vant/weapp/checkbox/index",
+		"van-checkbox-group": "@vant/weapp/checkbox-group/index",
+		"van-transition": "@vant/weapp/transition/index",
+		"van-dialog": "@vant/weapp/dialog/index",
+		"van-uploader": "@vant/weapp/uploader/index",
+		"viewDate": "/components/viewDate/index",
+		"filtrate": "/components/filtrate/filtrate"
+	},
+	"tabBar": {
+		"custom": true,
+		"color": "#000000",
+		"selectedColor": "#000000",
+		"backgroundColor": "#000000",
+		"list": [
+			{
+				"pagePath": "pages/tabbar/home/index"
+			},
+			{
+				"pagePath": "pages/tabbar/message/index"
+			},
+			{
+				"pagePath": "pages/tabbar/mine/index"
+			}
+		]
+	},
+	"window": {
+		"backgroundTextStyle": "light",
+		"navigationBarBackgroundColor": "#085CDF",
+		"navigationBarTitleText": "班管家",
+		"navigationBarTextStyle": "white"
+	},
+	"permission": {
+		"scope.userLocation": {
+			"desc": "您的位置信息将用于小程序位置接口的效果展示"
+		}
+	},
+	"requiredPrivateInfos": [
+		"getLocation"
+	],
+	"plugins": {
+		"WechatSI": {
+			"version": "0.0.7",
+			"provider": "wx069ba97219f66d99"
+		}
+	},
+	"sitemapLocation": "sitemap.json"
 }
 }

+ 7 - 30
bgj/workOrder/nodes/index.js

@@ -3,7 +3,7 @@ const _Http = getApp().globalData.http;
 Component({
 Component({
   properties: {
   properties: {
     nodes: {
     nodes: {
-      type: Object
+      type: Array
     },
     },
     prefix: {
     prefix: {
       type: Number,
       type: Number,
@@ -19,38 +19,15 @@ Component({
   lifetimes: {
   lifetimes: {
     attached: function () {
     attached: function () {
       getApp().globalData.Language.getLanguagePackage(this)
       getApp().globalData.Language.getLanguagePackage(this)
-      // 打印所有父组件传过来的参数
-      console.log('=== 组件接收的所有入参 ===', this.properties)
-      // 单独打印每个字段,方便排查
-      console.log('nodes:', this.properties.nodes)
-      console.log('prefix:', this.properties.prefix)
-      console.log('status:', this.properties.status)
-      console.log('sc_workorderid:', this.properties.sc_workorderid)
     }
     }
   },
   },
-  data: {
-
-  },
+  data: {statusList:['待开始','已完成','进行中']},
   methods: {
   methods: {
-    toWork(e) {
-      console.log(e,'eeeeeeeeeeee')
-      const {
-        item
-      } = e.currentTarget.dataset;
-      try {
-        if (item.child.length) return;
-      } catch (error) {
-        item.child = [];
-      }
-      console.log(item)
-      if (item.child.length) return;
-      item.title = (this.data.prefix ? this.data.prefix + '-' : '') + item.rowindex + '. ' + item.workpresetjson.workname;
-      item.status1 = this.data.status;
-      _Http.data = item;
-      let isleader = true;
+    toEditNode(e){
+      _Http.nodeItem = e.currentTarget.dataset.item;
       wx.navigateTo({
       wx.navigateTo({
-        url: (isleader ? '/bgj/workOrder/nodeDetail/index?id=' : '/bgj/workOrder/nodeDetail/index?class=stopClick&id=') + item.sc_workorder_nodeid + '&wid=' + item.sc_workorderid + (this.data.status != '进行中' ? '&class=stopClick' : '')
+        url: '/bgj/workOrder/nodes/update/update',
       })
       })
-    },
+    }
   }
   }
-})
+})

+ 54 - 54
bgj/workOrder/nodes/index.scss

@@ -1,57 +1,57 @@
-
 .node {
 .node {
-	display: flex;
-	padding: 10rpx;
-	font-family: Microsoft YaHei, Microsoft YaHei;
-	border-radius: 8rpx;
-	background-color: #fff;
-	transition: background-color 0.2s;
-
-	&.node-hover {
-		background-color: #f5f5f5;
-	}
-
-	.label,
-	.number {
-			font-size: 28rpx;
-	}
-
-	.number {
-			margin-right: 10rpx;
-	}
-
-	.stuta {
-			margin-top: 20rpx;
-			display: flex;
-
-			.tag {
-					border-radius: 8rpx;
-					padding: 8rpx 12rpx;
-					font-size: 24rpx;
-					color: #fff;
-			}
-	}
-
-	.images {
-			display: flex;
-			flex-wrap: wrap;
-
-			.image {
-					margin-top: 20rpx;
-					margin-right: 20rpx;
-			}
-	}
-}
-
-
-.child {
-	margin-left: -55rpx;
-	width: calc(100% + 65rpx);
-	transform: scale(0.9);
-
-	.label,
-	.number {
-			color: #333;
-	}
+  width: 100%;
+  box-sizing: border-box;
+  padding: 20rpx 30rpx;
+  background-color: #fff;
+  font-family: PingFang SC, PingFang SC;
+
+  .workname {
+    line-height: 40rpx;
+    color: #333333;
+    font-size: 28rpx;
+
+    .formcheck {
+      color: #E3041F;
+    }
+  }
+
+  .change {
+    margin-top: 16rpx;
+    line-height: 40rpx;
+    font-size: 28rpx;
+
+    .changedate {
+      color: #888888;
+    }
+
+    .changeby {
+      color: #3874F6;
+      margin-left: 30rpx;
+    }
+  }
+
+  .tabs {
+    display: flex;
+    justify-content: space-between;
+    margin-top: 16rpx;
+
+    .tab {
+      border-radius: 4rpx;
+      font-family: PingFang SC, PingFang SC;
+      font-size: 24rpx;
+      color: #FFFFFF;
+      padding: 8rpx 16rpx;
+    }
+
+    .tab1 {
+      background: #3874F6;
+      border-radius: 4rpx;
+      font-family: PingFang SC, PingFang SC;
+      font-weight: bold;
+      font-size: 28rpx;
+      color: #FFFFFF;
+      padding: 4rpx 32rpx;
+    }
+  }
 
 
 }
 }

+ 17 - 18
bgj/workOrder/nodes/index.wxml

@@ -1,19 +1,18 @@
-<navigator url="#" class="{{prefix ? 'node child' : 'node'}}" hover-class="node-hover" hover-start-time="50" hover-stay-time="100" wx:for="{{nodes}}" key="sc_workorder_nodeid" data-item="{{item}}" catch:tap="toWork">
-	<view class="number">
-		{{ (prefix ? prefix + '-' : '') + (index + 1) }}.
-	</view>
-	<view style="flex: 1;">
-		<view class="label">
-			{{ item.workpresetjson.workname }}
-		</view>
-		<Nodes wx:if="{{!prefix && item.child.length}}" status='{{status}}' nodes="{{item.child}}" prefix="{{(prefix ? prefix + '-' : '') + (index + 1)}}" />
-		<block wx:else>
-			<Yl_Files id="Yl_Files" attinfos='{{item.attinfos}}' />
-			<view class="stuta">
-				<view class="tag"  style="background-color:{{sColors['待开始']}};" wx:if="{{item.status == '0'}}">待开始</view>
-				<view class="tag" style="background-color:{{sColors['已完成']}};" wx:if="{{item.status == '1'}}">已完成</view>
-				<view class="tag" style="background-color:{{sColors['进行中']}};" wx:if="{{item.status == '2'}}">进行中</view>
-			</view>
-		</block>
-	</view>
+<navigator class="node" url="#" style="padding-right: {{prefix?'0rpx':'20rpx'}};" wx:for="{{nodes}}" wx:key="sc_workorder_nodeid" hover-class="{{item.child.length?'none':''}}" data-item="{{item}}" catch:tap="{{item.child.length?'':'toEditNode'}}">
+  <view class="workname"><text class="formcheck" wx:if="{{item.workpresetjson.formcheck}}">*</text><text wx:if="{{prefix}}">{{prefix}}-</text>{{item.rowindex}}. {{language[item.workpresetjson.workname]||item.workpresetjson.workname}}</view>
+  <block wx:if="{{!item.child.length}}">
+    <view wx:if="{{item.changedate}}" class="change">
+      <text class="changedate">{{item.changedate}}</text>
+      <text class="changeby">{{item.changeby}}</text>
+    </view>
+    <view class="tabs">
+      <view class="tab" style="background-color:{{sColors[statusList[item.status]]}};">
+        {{language[statusList[item.status]]||statusList[item.status]}}
+      </view>
+      <view class="tab1" wx:if="{{item.workpresetjson.logreport && item.status == 1}}">
+        {{language['汇报']||'汇报'}}
+      </view>
+    </view>
+  </block>
+  <Nodes wx:if="{{item.child && item.child.length}}" nodes='{{item.child}}' prefix='{{prefix + 1}}' />
 </navigator>
 </navigator>

+ 482 - 0
bgj/workOrder/nodes/update/update.js

@@ -0,0 +1,482 @@
+const _Http = getApp().globalData.http;
+const keys = {
+  passcheck: 'ispasscheck',
+};
+
+Page({
+  data: {
+    statusList:['待开始','已完成','进行中'],
+    detail: {},
+    title: '',
+    workpresetjson: {},
+    isEditing: false,
+    loading: false,
+    formModified: false,
+    originalForm: {},
+    form: {
+      remarks: '',
+      confirm: '',
+      itemtype: '',
+      questionedit: '',
+      additem: '',
+      passcheck: '',
+      fileupload: '',
+      dooramount: 0,
+      accessoryamount: 0,
+      otheramount: 0,
+      amountpay: 0,
+    },
+    questionoption: [],
+    confirmOptions: [],
+    newtitems: [],
+    oldtitems: [],
+    attinfos: [], // 原始附件信息
+    team: [], // 操作人员可选列表
+    selectedTrainers: [], // 已选操作人员
+    fileList: [], // 上传文件列表
+  },
+
+  onLoad() {
+    getApp().globalData.Language.getLanguagePackage(this, '工序详情')
+
+    const detail = _Http.nodeItem;
+    const detailPage = getCurrentPages().find(v => v.__route__ == 'bgj/workOrder/detail');
+    const workDetail = detailPage?.data?.detail || {};
+    if (!detail) {
+      wx.showToast({
+        title: '数据异常',
+        icon: 'none'
+      });
+      return;
+    }
+    const isEditing = true || workDetail.status == '进行中';
+    const workpresetjson = detail.workpresetjson || {};
+    const confirmOptions = workpresetjson.confirm_options || [];
+    const attinfos = detail.attinfos || [];
+
+    // 默认选中当前用户
+    const myUserid = wx.getStorageSync('userMsg').userid;
+    const team = (workDetail.team || []).map(t => ({
+      ...t,
+      _active: t.userid == myUserid,
+    }));
+    const selectedTrainers = team.filter(t => t._active);
+
+    this.setData({
+      detail,
+      workpresetjson,
+      isEditing,
+      confirmOptions,
+      attinfos,
+      form: {
+        remarks: '',
+        confirm: '',
+        itemtype: '',
+        questionedit: '',
+        additem: '',
+        passcheck: '',
+        fileupload: attinfos.length ? '1' : '',
+        dooramount: 0,
+        accessoryamount: 0,
+        otheramount: 0,
+        amountpay: 0,
+      },
+      newtitems: [],
+      oldtitems: [],
+      team,
+      selectedTrainers,
+    });
+    this.initForm(detail);
+  },
+
+  // ---- 初始化 ----
+
+  initForm(detail) {
+    const form = {
+      ...this.data.form
+    };
+
+    // keys映射表单值
+    for (const key in keys) {
+      const apiKey = keys[key];
+      if (detail[apiKey] !== undefined && detail[apiKey] !== null) {
+        form[key] = detail[apiKey];
+      }
+    }
+
+    // 配件
+    if (detail.detail && detail.detail[0]) {
+      const partsDetail = detail.detail[0];
+      const newtitems = (partsDetail.newtitems || []).map(item => ({
+        ...item,
+        imageUrl: this.getImageUrl(item),
+      }));
+      const oldtitems = (partsDetail.oldtitems || []).map(item => ({
+        ...item,
+        imageUrl: this.getImageUrl(item),
+      }));
+      form.newtitems = newtitems.length ? '1' : '';
+      form.additem = form.newtitems || oldtitems.length ? '1' : '0';
+      this.setData({
+        newtitems,
+        oldtitems
+      });
+    }
+
+    // 费用
+    if (detail.dooramount !== undefined) form.dooramount = detail.dooramount;
+    if (detail.accessoryamount !== undefined) form.accessoryamount = detail.accessoryamount;
+    if (detail.otheramount !== undefined) form.otheramount = detail.otheramount;
+    form.amountpay = (parseFloat(form.dooramount) || 0) +
+      (parseFloat(form.accessoryamount) || 0) +
+      (parseFloat(form.otheramount) || 0);
+
+    this.setData({
+      form
+    });
+    this.data.originalForm = JSON.parse(JSON.stringify(form));
+  },
+
+  getImageUrl(item) {
+    if (item.attinfos && item.attinfos.length) {
+      const info = item.attinfos[0];
+      if (info.subfiles) {
+        const thumb = info.subfiles.find(s => s.type === 'thumbnail');
+        return thumb?.url || info.url || '';
+      }
+      return info.url || '';
+    }
+    return item.imageUrl || '';
+  },
+
+  loadQuestionOptions(optionId) {
+    _Http.basic({
+      id: optionId,
+      content: {
+        nocache: true
+      },
+    }).then(res => {
+      if (res.code == 1 && Array.isArray(res.data)) {
+        this.setData({
+          questionoption: res.data
+        });
+      } else {
+        wx.showToast({
+          title: res.msg || '加载故障类型失败',
+          icon: 'none'
+        });
+      }
+    });
+  },
+
+  // ---- 交互事件 ----
+  onClickAway() {
+    if (!this.data.isEditing) {
+      wx.showToast({
+        title: '仅限工单进行中状态下编辑',
+        icon: 'none'
+      });
+    }
+  },
+
+  // 文件上传
+  onAfterRead(e) {
+    if (!this.data.isEditing) return;
+    const { file } = e.detail;
+    const fileList = [...this.data.fileList, { url: file.path, name: file.name, type: file.type }];
+    this.setData({ fileList, fileupload: '1' });
+  },
+
+  onDeleteFile(e) {
+    if (!this.data.isEditing) return;
+    const { index } = e.detail;
+    const fileList = [...this.data.fileList];
+    fileList.splice(index, 1);
+    const form = { ...this.data.form, fileupload: fileList.length ? '1' : '' };
+    this.setData({ fileList, form });
+  },
+
+  // 通用单选项点击(故障类型、确认信息、合格确认等)
+  clickRadio(e) {
+    if (!this.data.isEditing) return;
+    const value = e.currentTarget.dataset.value;
+    const key = e.currentTarget.dataset.key;
+    const form = {
+      ...this.data.form
+    };
+    form[key] = form[key] === value ? '' : value;
+
+    // 合格确认特殊处理
+    if (key === 'passcheck') {
+      // 这里不需要额外逻辑,参考原项目只是toggle
+    }
+
+    this.setData({
+      form
+    });
+  },
+
+  // 更换配件点击(带自动跳转逻辑)
+  clickAdditem(e) {
+    if (!this.data.isEditing) return;
+    const value = e.currentTarget.dataset.value;
+    const form = {
+      ...this.data.form
+    };
+    form.additem = form.additem === value ? '' : value;
+    this.setData({
+      form
+    });
+    if (form.additem == '1' && !this.data.newtitems.length && !this.data.oldtitems.length) {
+      this.toAddItem('newtitems');
+    }
+  },
+
+  // 文本输入
+  onFieldInput(e) {
+    if (!this.data.isEditing) return;
+    const key = e.currentTarget.dataset.key;
+    const value = e.detail.value;
+    const form = {
+      ...this.data.form
+    };
+    form[key] = value;
+    this.setData({
+      form
+    });
+  },
+
+  // 金额输入 + 自动计算总费用
+  onAmountInput(e) {
+    if (!this.data.isEditing) return;
+    const key = e.currentTarget.dataset.key;
+    const value = e.detail.value;
+    const form = {
+      ...this.data.form
+    };
+    form[key] = value;
+    const door = parseFloat(key === 'dooramount' ? value : form.dooramount) || 0;
+    const acc = parseFloat(key === 'accessoryamount' ? value : form.accessoryamount) || 0;
+    const other = parseFloat(key === 'otheramount' ? value : form.otheramount) || 0;
+    form.amountpay = door + acc + other;
+    this.setData({
+      form
+    });
+  },
+
+  // ---- 配件 ----
+
+  toAddItem(key) {
+    if (!this.data.isEditing) return;
+    // 支持 WXML 事件调用和代码直接调用
+    const selectedKey = (key && key.currentTarget) ? key.currentTarget.dataset.key : (key || 'newtitems');
+    getApp().globalData.basicsData = {
+      selected: selectedKey,
+      newtitems: [...this.data.newtitems],
+      oldtitems: [...this.data.oldtitems],
+    };
+
+    wx.navigateTo({
+      url: '/pages/select/accessories'
+    });
+
+    getApp().globalData.selectAcc = (res) => {
+      const newtitems = res.newtitems || [];
+      const oldtitems = res.oldtitems || [];
+      const form = {
+        ...this.data.form
+      };
+
+      // 根据配件属性自动选择维修类型
+      if (this.data.confirmOptions.includes('大修')) {
+        let maxAttr = -1;
+        newtitems.forEach(item => {
+          let attr = 0;
+          if (item.repairattribute) {
+            if (item.repairattribute.includes('大')) attr = 3;
+            else if (item.repairattribute.includes('中')) attr = 2;
+            else if (item.repairattribute.includes('小')) attr = 1;
+          }
+          if (attr > maxAttr) maxAttr = attr;
+        });
+        let confirmValue = '';
+        if (maxAttr == 3) confirmValue = '大修';
+        else if (maxAttr == 2) confirmValue = '中修';
+        else if (maxAttr == 1) confirmValue = '小修';
+        if (confirmValue && this.data.confirmOptions.includes(confirmValue)) {
+          form.confirm = confirmValue;
+        }
+      }
+
+      form.newtitems = newtitems.length ? '1' : '';
+      this.setData({
+        newtitems,
+        oldtitems,
+        form
+      });
+      wx.navigateBack();
+      delete getApp().globalData.selectAcc;
+      delete getApp().globalData.basicsData;
+    };
+  },
+
+  deleteItem(e) {
+    if (!this.data.isEditing) return;
+    const key = e.currentTarget.dataset.key;
+    const item = e.currentTarget.dataset.item;
+    const list = key === 'newtitems' ? [...this.data.newtitems] : [...this.data.oldtitems];
+    const filtered = list.filter(v => v.itemid !== item.itemid);
+    if (key === 'newtitems') {
+      const form = {
+        ...this.data.form
+      };
+      form.newtitems = filtered.length ? '1' : '';
+      this.setData({
+        newtitems: filtered,
+        form
+      });
+    } else {
+      this.setData({
+        oldtitems: filtered
+      });
+    }
+  },
+
+
+  // 操作人员多选切换
+  toggleTrainer(e) {
+    if (!this.data.isEditing) return;
+    const userid = e.currentTarget.dataset.userid;
+    // 直接切换 team 中的 _active 标记,WXML 只做简单 boolean 判断
+    const team = this.data.team.map(t => {
+      if (t.userid == userid) {
+        return { ...t, _active: !t._active };
+      }
+      return t;
+    });
+    const selectedTrainers = team.filter(t => t._active);
+    this.setData({ team, selectedTrainers });
+  },
+
+  // 填写不合格原因
+  inputNopassReason() {
+    return new Promise((resolve) => {
+      wx.showModal({
+        title: '不合格原因',
+        content: '请确认是否填写了不合格原因',
+        editable: true,
+        placeholderText: '请输入不合格原因',
+        confirmText: '确定',
+        cancelText: '取消',
+        success: (res) => {
+          if (res.confirm) {
+            resolve(res.content || '不合格');
+          } else {
+            resolve(null); // 取消保存
+          }
+        }
+      });
+    });
+  },
+
+  async save() {
+    if (this.data.loading) return;
+    this.setData({
+      loading: true
+    });
+
+    const form = this.data.form;
+    const detail = _Http.nodeItem;
+
+    // 检查是否有文件正在上传
+
+    // ispasscheck: 不传默认99,0=异常,1=正常
+    let ispasscheck = 99;
+    if (form.passcheck === '1') ispasscheck = 1;
+    else if (form.passcheck === '0') ispasscheck = 0;
+
+    // 不合格原因
+    let nopassreason = '';
+    if (ispasscheck === 0) {
+      nopassreason = await this.inputNopassReason();
+      if (nopassreason === null) {
+        this.setData({
+          loading: false
+        });
+        return; // 用户取消
+      }
+    }
+
+    // 构建配件数据 (新接口: sc_item_localid + qty)
+    let traintitem = [];
+    if (form.additem == '1') {
+      const mapItem = v => ({
+        sc_item_localid: v.itemid || v.sc_item_localid,
+        qty: v.qty || v.packageqty || 1,
+      });
+      traintitem = [
+        ...this.data.oldtitems.map(mapItem),
+        ...this.data.newtitems.map(mapItem),
+      ];
+    }
+
+    // 构建最终content
+    const nodeId = detail.sc_workorder_nodeid || detail.sa_workorder_nodeid;
+    const workorderId = detail.sc_workorderid || detail.sa_workorderid;
+
+    const content = {
+      isconfirm: 1,
+      sc_workorderid: workorderId,
+      sc_workorder_nodeid: nodeId,
+      ispasscheck,
+      nopassreason,
+      panoramaurl: form.panoramaurl || '',
+      remarks: form.remarks || '',
+      trainers: this.data.selectedTrainers.map(t => ({
+        userid: t.userid,
+        sys_enterpriseid: t.sys_enterpriseid || 0,
+        name: t.name || '',
+        phonenumber: t.phonenumber || '',
+        position: t.position || '',
+      })),
+      traintitem,
+    };
+
+    _Http.basic({
+      id: 2026052615154602,
+      content,
+    }).then(res => {
+      console.log('保存工序', res);
+      if (res.code != 1) {
+        this.setData({
+          loading: false
+        });
+        wx.showModal({
+          title: '保存失败',
+          content: res.msg,
+          showCancel: false
+        });
+        return;
+      }
+      // 绑定新上传的附件
+      // this.bindNewFiles(nodeId);
+      this.setData({
+        formModified: false,
+        loading: false
+      });
+      // 刷新父页面
+      const pages = getCurrentPages();
+      const detailPage = pages.find(v => v.__route__ == 'bgj/workOrder/detail');
+      if (detailPage && detailPage.getDetail) detailPage.getDetail();
+      wx.navigateBack();
+    }).catch(() => {
+      this.setData({
+        loading: false
+      });
+      wx.showToast({
+        title: '保存失败',
+        icon: 'none'
+      });
+    });
+  },
+});

+ 11 - 0
bgj/workOrder/nodes/update/update.json

@@ -0,0 +1,11 @@
+{
+  "usingComponents": {
+    "Yl_Files": "/components/Yl_Files/index",
+    "van-uploader": "@vant/weapp/uploader/index",
+    "van-radio": "@vant/weapp/radio/index",
+    "van-radio-group": "@vant/weapp/radio-group/index",
+    "van-button": "@vant/weapp/button/index",
+    "van-icon": "@vant/weapp/icon/index",
+    "van-dialog": "@vant/weapp/dialog/index"
+  }
+}

+ 290 - 0
bgj/workOrder/nodes/update/update.scss

@@ -0,0 +1,290 @@
+page {
+  background-color: #fff;
+}
+
+.content {
+  width: 100vw;
+  min-height: 100vh;
+  padding: 30rpx;
+  box-sizing: border-box;
+  background: #fff;
+
+  .title {
+    display: flex;
+    align-items: flex-start;
+    font-size: 36rpx;
+    font-weight: bold;
+    color: #3C7BFF;
+    margin-bottom: 10rpx;
+    line-height: 1.4;
+    word-break: break-all;
+
+    .tab {
+      flex-shrink: 0;
+      border-radius: 4rpx;
+      font-size: 24rpx;
+      font-weight: normal;
+      color: #FFFFFF;
+      padding: 4rpx 12rpx;
+      margin-left: 12rpx;
+      margin-top: 4rpx;
+      white-space: nowrap;
+    }
+  }
+
+  .remarks {
+    font-size: 28rpx;
+    color: #666666;
+    margin-top: 10rpx;
+    padding-left: 20rpx;
+    margin-bottom: 30rpx;
+
+
+  }
+
+  .form-wrap {
+    width: 100%;
+
+    .form-item {
+      padding: 24rpx 0;
+      border-bottom: 2rpx solid #f5f5f5;
+    }
+
+    .form-label {
+      font-size: 28rpx;
+      color: #333333;
+      margin-bottom: 16rpx;
+      font-weight: 500;
+      display: flex;
+      align-items: center;
+    }
+
+    .required-star {
+      color: #e34d59;
+      margin-right: 4rpx;
+    }
+
+    /* 选项按钮组 */
+    .options-box {
+      display: flex;
+      flex-wrap: wrap;
+      gap: 12rpx;
+
+      .option {
+        border: 2rpx solid #dadbde;
+        border-radius: 8rpx;
+        padding: 12rpx 28rpx;
+        font-size: 28rpx;
+        color: #606266;
+        transition: all 0.3s;
+        text-align: center;
+        min-width: 80rpx;
+
+        &.active {
+          background: #006EF7;
+          color: #fff;
+          border-color: #006EF7;
+        }
+      }
+
+      .option-empty {
+        font-size: 26rpx;
+        color: #999;
+        padding: 8rpx 0;
+      }
+    }
+
+    /* 文本域 */
+    .textarea-input {
+      width: 100%;
+      min-height: 80rpx;
+      padding: 20rpx;
+      border: 2rpx solid #dadbde;
+      border-radius: 8rpx;
+      font-size: 28rpx;
+      color: #333;
+      box-sizing: border-box;
+      background: #fafafa;
+    }
+
+    /* 子区块(配件区域) */
+    .sub-form-item {
+      margin-top: 20rpx;
+      padding: 16rpx;
+      background: #f7f8fa;
+      border-radius: 8rpx;
+
+      .sub-label {
+        display: flex;
+        align-items: center;
+        justify-content: space-between;
+        font-size: 26rpx;
+        color: #333;
+        margin-bottom: 12rpx;
+
+        .add-link {
+          color: #3874F6;
+          font-size: 26rpx;
+          padding: 4rpx 16rpx;
+          border: 2rpx solid #3874F6;
+          border-radius: 6rpx;
+        }
+      }
+    }
+
+    /* 配件列表 */
+    .acc-list {
+      .acc-item {
+        display: flex;
+        align-items: center;
+        justify-content: space-between;
+        padding: 14rpx 12rpx;
+        background: #fff;
+        border-radius: 8rpx;
+        margin-top: 10rpx;
+
+        .acc-info {
+          display: flex;
+          align-items: center;
+          flex: 1;
+          min-width: 0;
+
+          .acc-img {
+            width: 72rpx;
+            height: 72rpx;
+            border-radius: 8rpx;
+            margin-right: 16rpx;
+            background: #f0f0f0;
+            flex-shrink: 0;
+          }
+
+          .acc-img-placeholder {
+            width: 72rpx;
+            height: 72rpx;
+            border-radius: 8rpx;
+            margin-right: 16rpx;
+            background: #eee;
+            display: flex;
+            align-items: center;
+            justify-content: center;
+            font-size: 20rpx;
+            color: #999;
+            flex-shrink: 0;
+            text-align: center;
+            line-height: 72rpx;
+          }
+
+          .acc-detail {
+            flex: 1;
+            min-width: 0;
+
+            .acc-name {
+              font-size: 28rpx;
+              color: #333;
+              font-weight: 500;
+              overflow: hidden;
+              text-overflow: ellipsis;
+              white-space: nowrap;
+            }
+
+            .acc-model {
+              font-size: 24rpx;
+              color: #999;
+              margin-top: 4rpx;
+              overflow: hidden;
+              text-overflow: ellipsis;
+              white-space: nowrap;
+            }
+          }
+        }
+      }
+    }
+
+    /* 费用区域 */
+    .fee-row {
+      display: flex;
+
+      .fee-field {
+        flex: 1;
+        min-width: 0;
+
+        .fee-label {
+          font-size: 26rpx;
+          color: #666;
+          margin-bottom: 8rpx;
+        }
+
+        .fee-input {
+          width: 100%;
+          padding: 14rpx 16rpx;
+          border: 2rpx solid #dadbde;
+          border-radius: 8rpx;
+          font-size: 28rpx;
+          background: #fafafa;
+          box-sizing: border-box;
+        }
+
+        .fee-unit {
+          font-size: 24rpx;
+          color: #999;
+          margin-top: 6rpx;
+          display: inline-block;
+        }
+      }
+
+      .fee-gap {
+        width: 24rpx;
+        flex-shrink: 0;
+      }
+    }
+
+    .fee-line {
+      display: flex;
+      align-items: center;
+      margin-top: 16rpx;
+
+      .fee-label {
+        font-size: 26rpx;
+        color: #666;
+        white-space: nowrap;
+        margin-right: 16rpx;
+        min-width: 4em;
+      }
+
+      .fee-input {
+        flex: 1;
+        padding: 14rpx 16rpx;
+        border: 2rpx solid #dadbde;
+        border-radius: 8rpx;
+        font-size: 28rpx;
+        background: #fafafa;
+        min-width: 0;
+      }
+
+      .fee-unit {
+        font-size: 24rpx;
+        color: #999;
+        margin-left: 8rpx;
+        white-space: nowrap;
+      }
+    }
+  }
+
+  /* 保存按钮 */
+  .but-box {
+    margin-top: 60rpx;
+    padding: 0 20rpx;
+
+    .save-btn {
+      width: 100%;
+      height: 90rpx;
+      line-height: 90rpx;
+      background: #3874F6 !important;
+      border-radius: 8rpx;
+      font-size: 32rpx;
+      font-weight: bold;
+      color: #fff !important;
+      border: none !important;
+    }
+  }
+}

+ 132 - 0
bgj/workOrder/nodes/update/update.wxml

@@ -0,0 +1,132 @@
+<view class="content" catch:tap="onClickAway">
+  <view class="title" style="color: #3C7BFF;">
+    {{workpresetjson.workname}}
+    <view class="tab" style="background-color:{{sColors[statusList[detail.status]]}};">
+      {{language[statusList[detail.status]]||statusList[detail.status]}}
+    </view>
+  </view>
+  <view class="remarks" wx:if="{{workpresetjson.remarks}}">
+    — {{workpresetjson.remarks}}
+  </view>
+
+  <!-- 表单区域 -->
+  <view class="form-wrap">
+      <!-- 操作人员(多选,来源 team) -->
+      <view class="form-item" wx:if="{{team.length > 0}}">
+        <view class="form-label">操作人员</view>
+        <view class="options-box">
+          <view class="option {{item._active ? 'active' : ''}}" wx:for="{{team}}" wx:key="userid" catch:tap="toggleTrainer" data-userid="{{item.userid}}">
+            {{item.name}}
+          </view>
+        </view>
+      </view>
+
+          <!-- 拍照 -->
+    <view class="form-item" wx:if="{{workpresetjson.fileupload != 0}}">
+      <view class="form-label">
+        <text wx:if="{{workpresetjson.fileupload == 11}}" class="required-star">*</text>
+        拍照
+      </view>
+      <van-uploader file-list="{{fileList}}" max-count="9" disabled="{{!isEditing}}" bind:after-read="onAfterRead" bind:delete="onDeleteFile" />
+    </view>
+
+    <!-- 合格确认 -->
+    <view class="form-item" wx:if="{{workpresetjson.passcheck != 0}}">
+      <view class="form-label">
+        <text wx:if="{{workpresetjson.passcheck == 11}}" class="required-star">*</text>
+        合格确认
+      </view>
+      <view class="options-box">
+        <view class="option {{form.passcheck == '1' ? 'active' : ''}}" catch:tap="clickRadio" data-value="1" data-key="passcheck">正常</view>
+        <view class="option {{form.passcheck == '0' ? 'active' : ''}}" catch:tap="clickRadio" data-value="0" data-key="passcheck">异常</view>
+      </view>
+    </view>
+
+    <!-- 更换配件 -->
+    <view class="form-item" wx:if="{{workpresetjson.additem != 0}}">
+      <view class="form-label">
+        <text wx:if="{{workpresetjson.additem == 11}}" class="required-star">*</text>
+        是否更换配件
+      </view>
+      <view class="options-box">
+        <view class="option {{form.additem == '1' ? 'active' : ''}}" catch:tap="clickAdditem" data-value="1">是</view>
+        <view class="option {{form.additem == '0' ? 'active' : ''}}" catch:tap="clickAdditem" data-value="0">否</view>
+      </view>
+
+      <!-- 配件列表 -->
+      <block wx:if="{{form.additem == '1'}}">
+        <view class="sub-form-item">
+          <view class="sub-label">
+            <text>新配件({{newtitems.length}})</text>
+            <text class="add-link" catch:tap="toAddItem" data-key="newtitems">+ 去添加新配件</text>
+          </view>
+          <view wx:if="{{newtitems.length > 0}}" class="acc-list">
+            <view class="acc-item" wx:for="{{newtitems}}" wx:key="itemid">
+              <view class="acc-info">
+                <image class="acc-img" src="{{item.imageUrl}}" mode="aspectFill" wx:if="{{item.imageUrl}}" />
+                <text wx:else class="acc-img-placeholder">无图</text>
+                <view class="acc-detail">
+                  <view class="acc-name">{{item.itemname}}</view>
+                  <view class="acc-model" wx:if="{{item.model}}">{{item.model}}</view>
+                </view>
+              </view>
+              <van-icon name="delete" size="18px" color="#F56C6C" catch:tap="deleteItem" data-key="newtitems" data-item="{{item}}" wx:if="{{isEditing}}" />
+            </view>
+          </view>
+        </view>
+
+        <view class="sub-form-item">
+          <view class="sub-label">
+            <text>旧配件({{oldtitems.length}})</text>
+            <text class="add-link" catch:tap="toAddItem" data-key="oldtitems">+ 去添加旧配件</text>
+          </view>
+          <view wx:if="{{oldtitems.length > 0}}" class="acc-list">
+            <view class="acc-item" wx:for="{{oldtitems}}" wx:key="itemid">
+              <view class="acc-info">
+                <image class="acc-img" src="{{item.imageUrl}}" mode="aspectFill" wx:if="{{item.imageUrl}}" />
+                <text wx:else class="acc-img-placeholder">无图</text>
+                <view class="acc-detail">
+                  <view class="acc-name">{{item.itemname}}</view>
+                  <view class="acc-model" wx:if="{{item.model}}">{{item.model}}</view>
+                </view>
+              </view>
+              <van-icon name="delete" size="18px" color="#F56C6C" catch:tap="deleteItem" data-key="oldtitems" data-item="{{item}}" wx:if="{{isEditing}}" />
+            </view>
+          </view>
+        </view>
+      </block>
+    </view>
+
+    <!-- 确认信息 -->
+    <view class="form-item" wx:if="{{workpresetjson.confirm != 0}}">
+      <view class="form-label">
+        <text wx:if="{{workpresetjson.confirm == 11}}" class="required-star">*</text>
+        确认信息
+      </view>
+      <view class="options-box">
+        <view class="option {{form.confirm == item ? 'active' : ''}}" wx:for="{{confirmOptions}}" wx:key="*this" catch:tap="clickRadio" data-value="{{item}}" data-key="confirm">
+          {{item}}
+        </view>
+      </view>
+    </view>
+
+
+
+    <!-- 文字说明 -->
+    <view class="form-item" wx:if="{{workpresetjson.remarks != 0}}">
+      <view class="form-label">
+        <text wx:if="{{workpresetjson.remarks == 11}}" class="required-star">*</text>
+        文字说明
+      </view>
+      <textarea class="textarea-input" value="{{form.remarks}}" placeholder="文字说明" maxlength="499" auto-height disabled="{{!isEditing}}" bindinput="onFieldInput" data-key="remarks" />
+    </view>
+  </view>
+
+  <!-- 保存按钮 -->
+  <view class="but-box" wx:if="{{isEditing}}">
+    <van-button custom-class="save-btn" type="primary" size="large" loading="{{loading}}" disabled="{{loading}}" bindtap="save">
+      保存
+    </van-button>
+  </view>
+  <view style="height: 50px;" />
+</view>

+ 3 - 1
project.private.config.json

@@ -1,7 +1,9 @@
 {
 {
   "libVersion": "3.16.0",
   "libVersion": "3.16.0",
   "projectname": "Bng_bgj",
   "projectname": "Bng_bgj",
-  "condition": {},
+  "condition": {
+  
+  },
   "setting": {
   "setting": {
     "urlCheck": false,
     "urlCheck": false,
     "coverView": true,
     "coverView": true,

+ 8 - 4
static/icon.wxss

@@ -1,9 +1,9 @@
 @font-face {
 @font-face {
   font-family: "iconfont"; /* Project id 5176012 */
   font-family: "iconfont"; /* Project id 5176012 */
-  src: url('//at.alicdn.com/t/c/font_5176012_se72sc1gu1q.woff2?t=1780033529010') format('woff2'),
-       url('//at.alicdn.com/t/c/font_5176012_se72sc1gu1q.woff?t=1780033529010') format('woff'),
-       url('//at.alicdn.com/t/c/font_5176012_se72sc1gu1q.ttf?t=1780033529010') format('truetype'),
-       url('//at.alicdn.com/t/c/font_5176012_se72sc1gu1q.svg?t=1780033529010#iconfont') format('svg');
+  src: url('//at.alicdn.com/t/c/font_5176012_za4bov12f67.woff2?t=1780289829146') format('woff2'),
+       url('//at.alicdn.com/t/c/font_5176012_za4bov12f67.woff?t=1780289829146') format('woff'),
+       url('//at.alicdn.com/t/c/font_5176012_za4bov12f67.ttf?t=1780289829146') format('truetype'),
+       url('//at.alicdn.com/t/c/font_5176012_za4bov12f67.svg?t=1780289829146#iconfont') format('svg');
 }
 }
 
 
 .iconfont {
 .iconfont {
@@ -14,6 +14,10 @@
   -moz-osx-font-smoothing: grayscale;
   -moz-osx-font-smoothing: grayscale;
 }
 }
 
 
+.icon-zanwushuju:before {
+  content: "\e652";
+}
+
 .icon-zhipaijingxiaoshang:before {
 .icon-zhipaijingxiaoshang:before {
   content: "\e736";
   content: "\e736";
 }
 }