xiaohaizhao 2 месяцев назад
Родитель
Сommit
ab30c2efcf

+ 14 - 2
E-service/workOrder/detail.js

@@ -38,6 +38,8 @@ Page({
       model: "#NotarizeBill"
     }, {
       label: "服务团队"
+    }, {
+      label: "工单信息"
     }],
     tabsActive: 0,
     reason: {
@@ -55,8 +57,6 @@ Page({
     this.getDetail()
   },
   getDetail() {
-    /* ①通用模板(服务商品、服务确认单、服务团队、工单信息)
-②工序模板(工序详情、工单物料、服务确认单、服务团队、工单信息) */
     _Http.basic({
       "id": 20230208140103,
       "content": {
@@ -71,6 +71,15 @@ Page({
       this.setData({
         detail: res.data
       })
+      if (res.data.actiontype == '非工序模板') {
+        this.setData({
+          tabsList: this.data.tabsList.filter(v => ['服务商品', '服务确认单', '服务团队', '工单信息'].includes(v.label))
+        })
+      } else {
+        this.setData({
+          tabsList: this.data.tabsList.filter(v => ['工序详情', '工单物料', '服务确认单', '服务团队', '工单信息'].includes(v.label))
+        })
+      }
       this.setPreview(res);
       this.setTabbar()
       this.partialRenewal()
@@ -512,6 +521,9 @@ Page({
 
     }
   },
+  onReachBottom() {
+    this.partialRenewal();
+  },
   callPhone(e) {
     wx.makePhoneCall({
       phoneNumber: e.currentTarget.dataset.number

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

@@ -4,6 +4,7 @@
     "Product": "./product/index",
     "Material": "./material/index",
     "Nodes": "./nodes/index",
+    "Team": "./team/index",
     "NotarizeBill": "./notarizeBill/index"
   }
 }

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

@@ -62,6 +62,7 @@
 	<view slot='工序详情' style="padding: 20rpx; background-color: #fff;">
 		<Nodes id='Nodes' wx:if="{{detail}}" nodes='{{detail.nodes}}' sa_workorderid='{{detail.sa_workorderid}}' status="{{detail.status}}" />
 	</view>
+	<Team slot='服务团队' list='{{detail.team}}' projectleader='{{detail.projectleader}}' sa_workorderid='{{detail.sa_workorderid}}' disabled="{{detail.status != '进行中' && (isLeader || isworkleader)}}" />
 	<Product slot='服务商品' id='Product' disabled="{{detail.status != '进行中'}}" />
 	<Material slot='工单物料' id='Material' />
 	<NotarizeBill slot='服务确认单' billData='{{detail}}' id='NotarizeBill' />

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

@@ -1,4 +1,4 @@
-<Yl_Head2 tabs="{{[{title:'待接单'},{title:'待开始'},{title:'进行中'},{title:'暂停'},{title:'已确认'},{title:'已中止'}]}}" bind:onSearch='onSearch' bind:onChangeTab='onChangeTab' />
+<Yl_Head2 tabs="{{[{title:'待接单'},{title:'待开始'},{title:'进行中'},{title:'暂停'},{title:'已确认'},{title:'已完成'},{title:'已中止'}]}}" bind:onSearch='onSearch' bind:onChangeTab='onChangeTab' />
 <Yl_ListBox id='ListBox' bind:getlist='getList'>
 	<block wx:if="{{list[0].address}}">
 		<navigator class="item" url="/E-service/workOrder/detail?id={{item.sa_workorderid}}" wx:for="{{list}}" wx:key="sa_workorderid">

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

@@ -19,7 +19,6 @@ Component({
   lifetimes: {
     attached: function () {
       getApp().globalData.Language.getLanguagePackage(this)
-      console.log(this.data.sa_workorderid, this.data.nodes)
     }
   },
   data: {

+ 1 - 1
E-service/workOrder/product/index.wxml

@@ -1,6 +1,6 @@
 <view class="head">
   <view class="count">
-    总共{{content.total}}个
+    {{language['总共']||'总共'}}{{content.total}}{{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' />

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

@@ -0,0 +1,144 @@
+const _Http = getApp().globalData.http;
+
+Component({
+  options: {
+    addGlobalClass: true
+  },
+  properties: {
+    list: {
+      type: Array
+    },
+    disabled: {
+      type: Boolean
+    },
+    sa_workorderid: {
+      type: [String, Number]
+    },
+    projectleader: {
+      type: [String, Number]
+    }
+  },
+  lifetimes: {
+    attached: function () {
+      getApp().globalData.Language.getLanguagePackage(this)
+    }
+  },
+  data: {
+    showTeams: false
+  },
+  methods: {
+    selectTeams(e) {
+      const {
+        userid
+      } = e.currentTarget.dataset.item;
+      let teams = this.data.teams;
+      let i = teams.findIndex(v => v == userid);
+      if (i != -1) {
+        teams = teams.filter(v => v != userid)
+      } else {
+        teams.push(userid)
+      }
+      this.setData({
+        teams
+      })
+    },
+    addUser() {
+      _Http.basic({
+        "id": 20220930103603,
+        "content": {
+          ownertable: 'sa_workorder',
+          ownerid: this.data.sa_workorderid,
+          "userids": this.data.teams,
+          "justuserids": 1
+        }
+      }).then(res => {
+        console.log("添加成员", res)
+        wx.showToast({
+          title: res.code == '1' ? getApp().globalData.Language.getMapText('修改成功') : res.msg,
+          icon: "none",
+          mask: true
+        });
+        if (res.code == '1') {
+          this.showTeamDialog()
+          getCurrentPages().find(v => v.__route__ == 'E-service/workOrder/detail').getDetail()
+        }
+      })
+    },
+    showTeamDialog() {
+      if (!this.data.workers) _Http.basic({
+        "id": "20230213143003",
+        "version": 1,
+        "content": {
+          "where": {
+            "condition": ""
+          }
+        }
+      }).then(res => {
+        console.log(res)
+        this.setData({
+          workers: res.data
+        })
+      })
+      this.setData({
+        showTeams: !this.data.showTeams,
+        teams: this.data.list.map(v => v.userid)
+      })
+    },
+    callPhone(e) {
+      wx.makePhoneCall({
+        phoneNumber: e.currentTarget.dataset.number
+      })
+    },
+    changeLeader(e) {
+      const {
+        detail
+      } = e.currentTarget.dataset;
+      wx.showModal({
+        title: getApp().globalData.Language.getMapText('提示'),
+        content: getApp().globalData.Language.getMapText(`是否确认选择`) + getApp().globalData.Language.getMapText(detail.name) + getApp().globalData.Language.getMapText(`执行工单`) + '?',
+        confirmBtn: getApp().globalData.Language.getMapText('确定'),
+        cancelBtn: getApp().globalData.Language.getMapText('取消'),
+        complete: ({
+          confirm
+        }) => {
+          if (confirm) _Http.basic({
+            "content": {
+              "sa_workorderid": this.data.sa_workorderid,
+              "userid": detail.userid
+            },
+            "id": 2026012714183302,
+          }).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()
+          })
+        }
+      })
+    },
+    deleteUser(e) {
+      const {
+        item
+      } = e.currentTarget.dataset;
+      wx.showModal({
+        title: getApp().globalData.Language.getMapText('提示'),
+        content: getApp().globalData.Language.getMapText(`是否确认移除`) + '“' + item.name + '”' + getApp().globalData.Language.getMapText(`团队成员`) + '?',
+        confirmBtn: getApp().globalData.Language.getMapText('确定'),
+        cancelBtn: getApp().globalData.Language.getMapText('取消'),
+        complete: ({
+          confirm
+        }) => {
+          if (confirm) _Http.basic({
+            "id": 20220930103803,
+            "content": {
+              "ownertable": "sa_workorder",
+              "ownerid": this.data.sa_workorderid,
+              "userids": [item.userid]
+            },
+          }).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()
+          })
+        }
+      })
+    }
+  }
+})

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

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

+ 114 - 0
E-service/workOrder/team/index.scss

@@ -0,0 +1,114 @@
+.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 {
+	position: relative;
+	padding: 20rpx 30rpx;
+	width: 100vw;
+	background: #FFFFFF;
+	box-sizing: border-box;
+	margin-bottom: 20rpx;
+
+	.label {
+		font-family: PingFang SC, PingFang SC;
+		font-weight: 400;
+		font-size: 28rpx;
+		color: #666666;
+
+		.role {
+			width: 96rpx;
+			height: 34rpx;
+			font-family: PingFang SC, PingFang SC;
+			font-weight: 400;
+			font-size: 24rpx;
+			color: #999999;
+		}
+
+		.phonenumber {
+			width: 152rpx;
+			height: 34rpx;
+			font-family: PingFang SC, PingFang SC;
+			font-weight: 400;
+			font-size: 24rpx;
+			color: #3874F6;
+			text-align: left;
+			font-style: normal;
+			text-transform: none;
+		}
+
+		text {
+			margin-left: 20rpx;
+		}
+	}
+
+	.tab {
+		display: inline-block;
+		font-family: PingFang SC, PingFang SC;
+		font-size: 24rpx;
+		color: #FFFFFF;
+
+		height: 40rpx;
+		line-height: 40rpx;
+		background: #3874F6;
+		border-radius: 100rpx;
+		padding: 0 10rpx;
+		margin-top: 12rpx;
+	}
+
+	.change {
+		height: 34rpx;
+		font-family: PingFang SC, PingFang SC;
+		font-weight: 400;
+		font-size: 24rpx;
+		color: #3874F6;
+		line-height: 44rpx;
+		margin-top: 12rpx;
+	}
+
+	.icon-guanlian-shanchu {
+		position: absolute;
+		top: 0;
+		right: 0;
+		color: #999;
+		padding: 20rpx 30rpx;
+		font-size: 28rpx;
+	}
+}

+ 39 - 0
E-service/workOrder/team/index.wxml

@@ -0,0 +1,39 @@
+<view class="head">
+	<view class="count">
+		{{language['服务团队']||'服务团队'}}
+	</view>
+	<view class="expand">
+		<navigator wx:if="{{!disabled}}" url="#" class="but" bindtap="showTeamDialog">
+			<van-icon name="plus" />
+		</navigator>
+	</view>
+</view>
+
+<view class="item" wx:for="{{list}}" wx:key="userid">
+	<view class="label">{{item.name}} <text class="role" wx:if="{{item.position}}">{{item.position}}</text> <text class="phonenumber" wx:if="{{item.phonenumber}}" data-number="{{item.phonenumber}}" bind:tap="callPhone">{{item.phonenumber}}</text></view>
+
+	<view class="tab" wx:if="{{item.isleader}}">
+		{{language['负责人']||'负责人'}}
+	</view>
+	<block wx:else>
+		<view class="change iconfont icon-zhuanyi" wx:if="{{!disabled}}" data-detail="{{item}}" bind:tap="changeLeader">
+			设为负责人
+		</view>
+	</block>
+	<view data-item="{{item}}" bind:tap="deleteUser" class="iconfont icon-guanlian-shanchu" wx:if="{{!item.isleader}}"></view>
+</view>
+
+<Yl_Empty wx:if="{{list.length==0}}" />
+
+<t-dialog visible="{{showTeams}}" title="{{language['参与成员']||'参与成员'}}" confirm-btn="{{language['确定']||'确定'}}" cancel-btn="{{language['取消']||'取消'}}" bind:confirm="addUser" bind:cancel="showTeamDialog">
+	<view slot="content">
+		<view style="height: 40rpx;" />
+		<view>
+			<block wx:for="{{workers}}" wx:key="rowindex">
+				<t-tag wx:if="{{projectleader!=item.name}}" style="margin: 5px 5px 0 0;" variant="{{wqp.query(teams,item.userid)?'dark':'outline'}}" theme="primary" data-item="{{item}}" bindtap="selectTeams">{{ item.name }}</t-tag>
+			</block>
+		</view>
+	</view>
+</t-dialog>
+
+<wxs src="../../../utils/wxmlQueryPer.wxs" module="wqp" />