NULL1222 1 неделя назад
Родитель
Сommit
bfbdf0441c

+ 3 - 1
app.json

@@ -39,7 +39,9 @@
                 "workOrder/components/autoUpload/upload",
                 "workOrder/components/signName/index",
                 "workOrder/materialAdd/material",
-                "workOrder/signature/index"
+                "workOrder/signature/index",
+                "workOrder/material/index",
+                "workOrder/team/index"
             ]
         }
     ],

+ 12 - 9
bgj/workOrder/detail.js

@@ -14,10 +14,12 @@ Page({
       model: "#Nodes"
     }, {
       label: "工单物料",
-      idname: "sc_workorderid"
+      idname: "sc_workorderid",
+      model: "#material"
     }, {
       label: "团队信息",
-      idname: "sc_workorderid"
+      idname: "sc_workorderid",
+      model: "#team"
     }, {
       label: "工单信息",
       idname: "sc_workorderid"
@@ -195,7 +197,7 @@ Page({
       }
     } catch (error) {}
   },
-  
+
   onCancel() {
     this.setData({
       delShow: false,
@@ -256,25 +258,26 @@ Page({
         })
         break;
       case '作废':
-        console.log(this.data.delShow,"delShow")
+        console.log(this.data.delShow, "delShow")
         this.setData({
           delShow: true
         })
-        console.log(this.data.delShow,"delShow2")
+        console.log(this.data.delShow, "delShow2")
 
         break;
       case '完结工单':
         wx.showModal({
           title: getApp().globalData.Language.getMapText('提示'),
-          content: getApp().globalData.Language.getMapText(`确认完结工单吗`) + '?',
-          confirmBtn: getApp().globalData.Language.getMapText('确定'),
-          cancelBtn: getApp().globalData.Language.getMapText('取消'),
+          content: getApp().globalData.Language.getMapText(`是否生成质保卡`) + '?',
+          confirmBtn: getApp().globalData.Language.getMapText('生成'),
+          cancelBtn: getApp().globalData.Language.getMapText('不生成'),
           complete: ({
             confirm
           }) => {
             if (confirm) _Http.basic({
               "content": {
-                "sc_workorderid": this.data.sc_workorderid
+                "sc_workorderid": this.data.sc_workorderid,
+                "applytype": 1
               },
               "id": "2026052113561302",
             }).then(res => {

+ 4 - 1
bgj/workOrder/detail.json

@@ -2,7 +2,10 @@
   "usingComponents": {
       "Files": "/components/files/index",
       "Record": "/components/record/index",
-      "Nodes": "/bgj/workOrder/nodes/index"
+      "Nodes": "/bgj/workOrder/nodes/index",
+      "Material": "/bgj/workOrder/material/index",
+      "Team": "/bgj/workOrder/team/index"
+
   },
   "navigationBarTitleText": "工单详情"
 }

+ 2 - 0
bgj/workOrder/detail.wxml

@@ -21,6 +21,8 @@
 <Yl_FunTabs list='{{tabsList}}' showIcon='{{false}}' active='{{tabsActive}}' bind:onChenge="tabsChange">
   <Preview slot='工单信息' list1='{{list1}}' list2='{{list2}}' />
   <Nodes slot='工序信息' id='Nodes' wx:if="{{detail.nodes}}" nodes='{{detail.nodes}}' sc_workorderid='{{detail.sc_workorderid}}' status="{{detail.status}}" />
+  <Material slot="工单物料" id='material' sc_workorderid="{{sc_workorderid}}"></Material>
+  <Team slot="团队信息" id='team' sc_workorderid="{{sc_workorderid}}"></Team>
   <Record slot='操作记录' id="Record" ownertable='sc_serviceform' ownerid='{{detail.sc_workorderid}}' />
   <Files slot='附件' id="Files" ownertable='sc_serviceform' ownerid='{{detail.sc_workorderid}}' />
   <view style="height: 180rpx;" />

+ 76 - 0
bgj/workOrder/material/index.js

@@ -0,0 +1,76 @@
+const _Http = getApp().globalData.http;
+
+Component({
+  options: {
+    addGlobalClass: true
+  },
+  properties: {
+    sc_workorderid: {
+      type: String,
+      value: ''
+    }
+  },
+  data: {
+    id: 2026052716201902,
+    content: {
+      nocache: true,
+      pageNumber: 1,
+      pageSize: 20,
+      where: {
+        condition: "",
+      }
+    },
+    list: []
+  },
+  lifetimes: {
+    attached: function () {
+      getApp().globalData.Language.getLanguagePackage(this)
+    },
+  },
+  methods: {
+    getList(sc_workorderid, init = false) {
+      let content = {
+        ...this.data.content,
+        sc_workorderid: sc_workorderid || this.properties.sc_workorderid
+      };
+      _Http.init(content, init).then(content => {
+        _Http.basic({
+          id: this.data.id,
+          content
+        }).then(res => {
+          this.selectComponent('#ListBox').RefreshToComplete();
+          if (res.code != '1') return wx.showToast({
+            title: res.msg,
+            icon: "none"
+          })
+          const arr = res.data.map(item => {
+            item.showBrand = Array.isArray(item.brand) ?
+              item.brand.map(v => v.brandname).join(',') :
+              '--'
+            // 图片:优先缩略图
+            let imgSrc = ''
+            if (Array.isArray(item.attinfos) && item.attinfos.length > 0) {
+              const info = item.attinfos[0]
+              if (Array.isArray(info.subfiles)) {
+                const thumb = info.subfiles.find(s => s.type === 'thumbnail')
+                if (thumb?.url) {
+                  imgSrc = thumb.url
+                } else if (info.url) {
+                  imgSrc = info.url
+                }
+              } else if (info.url) {
+                imgSrc = info.url
+              }
+            }
+            item.imgUrl = imgSrc
+            return item
+          })
+          this.setData({
+            content: _Http.paging(content, res),
+            list: res.pageNumber == 1 ? arr : this.data.list.concat(arr)
+          })
+        })
+      })
+    },
+  }
+});

+ 5 - 0
bgj/workOrder/material/index.json

@@ -0,0 +1,5 @@
+{
+  "component": true,
+  "usingComponents": {
+  }
+}

+ 83 - 0
bgj/workOrder/material/index.scss

@@ -0,0 +1,83 @@
+.team-head {
+  display: flex;
+  align-items: center;
+  width: 100vw;
+  height: 120rpx;
+  padding: 20rpx 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;
+
+    .custom-class {
+      --search-background-color: #fff !important;
+      padding-right: 10rpx !important;
+    }
+
+    .but {
+      display: flex;
+      align-items: center;
+      justify-content: center;
+      flex-shrink: 0;
+      width: 80rpx;
+      height: 80rpx;
+      border-radius: 8rpx;
+      border: 2rpx solid #CCCCCC;
+      margin-left: 20rpx;
+      color: #666666;
+      background-color: #FFFFFF;
+    }
+  }
+}
+.item {
+  display: flex;
+  background: #ffffff;
+  padding: 20rpx 30rpx;
+  box-sizing: border-box;
+  border-bottom: 2rpx solid #DDDDDD;
+
+  .material-img {
+    width: 112rpx;
+    height: 112rpx;
+    border-radius: 16rpx 16rpx 16rpx 16rpx;
+  }
+
+  .main {
+    display: flex;
+    flex-direction: column;
+    flex: 1;
+    .name {
+      font-family: PingFang SC, PingFang SC;
+      font-weight: 600;
+      font-size: 28rpx;
+      color: #333333;
+      text-align: left;
+      font-style: normal;
+    }
+
+    .row {
+      padding-top: 8rpx;
+      font-family: PingFang SC, PingFang SC;
+      font-weight: 400;
+      font-size: 24rpx;
+      color: #999999;
+      text-align: left;
+      font-style: normal;
+    }
+  }
+
+}
+
+
+
+
+

+ 24 - 0
bgj/workOrder/material/index.wxml

@@ -0,0 +1,24 @@
+<view class="team-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" size="24" />
+    </navigator>
+  </view>
+</view>
+
+<view class="item" wx:for="{{list}}" wx:key="sc_item_localid">
+  <image class="material-img" src="{{item.imgUrl}}"></image>
+  <view class="main">
+    <view class="name">{{language[item.name] || item.name}}</view>
+    <view class="row">{{language['编号']||'编号'}}:{{item.code}} </view>
+    <view class="row">{{language['型号']||'型号'}}:{{item.type||"--"}} </view>
+    <view class="row">{{language['规格']||'规格'}}:{{item.spec||"--"}} </view>
+    <view class="row">{{language['品牌']||'品牌'}}:{{item.showBrand}} </view>
+    <view class="row">{{language['数量']||'数量'}}:{{item.qty}} </view>
+  </view>
+</view>
+<My_Empty wx:if="{{list.length==0}}" />

+ 2 - 2
bgj/workOrder/materialAdd/material.wxml

@@ -7,7 +7,7 @@
     <view class="content">
       <image class="material-img" src="{{item.imgUrl}}"></image>
       <view class="main" style="padding-left: {{!radio?'10rpx':''}};">
-        <view class="name">{{language[item.enterprisename] || item.enterprisename}}</view>
+        <view class="name">{{language[item.name] || item.name}}</view>
         <view class="row">{{language['编号']||'编号'}}:{{item.code}} </view>
         <view class="row">{{language['型号']||'型号'}}:{{item.type||"--"}} </view>
         <view class="row">{{language['规格']||'规格'}}:{{item.spec||"--"}} </view>
@@ -17,7 +17,7 @@
     </view>
   </navigator>
   <view wx:if="{{!radio}}" style="height: 150rpx;" />
-  <Yl_Empty wx:if="{{list.length==0}}" />
+  <My_empty wx:if="{{list.length==0}}" />
 </Yl_ListBox>
 <block wx:if="{{!radio}}">
   <view class="footer">

+ 124 - 0
bgj/workOrder/team/index.js

@@ -0,0 +1,124 @@
+const _Http = getApp().globalData.http;
+
+Component({
+  options: {
+    addGlobalClass: true
+  },
+  properties: {
+    sc_workorderid: {
+      type: String,
+      value: ''
+    }
+  },
+  data: {
+    id: 20220930103501,
+    version: 1,
+    content: {
+      ownertable: "sc_workorder",
+      ownerid: "",
+      where: {
+        condition: "",
+      },
+    },
+    list: [],
+    showSearch: false,
+    focus: false,
+    condition: ""
+  },
+  lifetimes: {
+    attached: function () {
+      getApp().globalData.Language.getLanguagePackage(this)
+    },
+  },
+  methods: {
+    getList(sc_workorderid, init = false) {
+      let ownerid = sc_workorderid || this.properties.sc_workorderid;
+      // ownerid变化时强制刷新,避免切换工单后拼接旧数据
+      if (ownerid && ownerid !== this.data.content.ownerid) {
+        init = true;
+      }
+      let content = {
+        ...this.data.content,
+        ownerid
+      };
+      _Http.init(content, init).then(content => {
+        _Http.basic({
+          id: this.data.id,
+          content
+        }).then(res => {
+          if (res.code != '1') return wx.showToast({
+            title: res.msg,
+            icon: "none"
+          });
+          // 该接口不分页,始终替换列表,不拼接旧数据
+          let tableData = this.buildTableData(res.data);
+          this.setData({
+            content: _Http.paging(content, res),
+            list: res.data,
+            tableData: tableData
+          })
+        })
+      })
+    },
+    buildTableData(list) {
+      const result = [];
+      if (!Array.isArray(list) || list.length === 0) return result;
+      list.forEach((group) => {
+        const leader = (group.teamleader && group.teamleader[0]) || {};
+        const members = group.team || [];
+        // 组长行
+        result.push({
+          name: leader.name || group.teamname || "--",
+          phonenumber: leader.phonenumber || "--",
+          position: leader.position || "--",
+          isLeader: true,
+        });
+        // 组员行
+        members.forEach((member) => {
+          result.push({
+            name: member.name || "--",
+            phonenumber: member.phonenumber || "--",
+            position: member.position || "--",
+            isLeader: false,
+          });
+        });
+      });
+      return result;
+    },
+    callPhone(e) {
+      wx.makePhoneCall({
+        phoneNumber: e.currentTarget.dataset.number
+      })
+    },
+    toSearch() {
+      if (this.data.showSearch && this.data.content.where.condition) {
+        // 点击关闭搜索框 清空搜索条件,刷新列表
+        this.data.content.where.condition = '';
+        this.getList("", true); // init=true 重置分页
+      } else if (this.data.condition) {
+        // 输入了关键词,搜索
+        this.data.content.where.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)
+    },
+  }
+});

+ 5 - 0
bgj/workOrder/team/index.json

@@ -0,0 +1,5 @@
+{
+  "component": true,
+  "usingComponents": {
+  }
+}

+ 106 - 0
bgj/workOrder/team/index.scss

@@ -0,0 +1,106 @@
+.team-head {
+  display: flex;
+  align-items: center;
+  width: 100vw;
+  height: 120rpx;
+  padding: 20rpx 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;
+
+    .custom-class {
+      --search-background-color: #fff !important;
+      padding-right: 10rpx !important;
+    }
+
+    .but {
+      display: flex;
+      align-items: center;
+      justify-content: center;
+      flex-shrink: 0;
+      width: 80rpx;
+      height: 80rpx;
+      border-radius: 8rpx;
+      border: 2rpx solid #CCCCCC;
+      margin-left: 20rpx;
+      color: #666666;
+      background-color: #FFFFFF;
+    }
+  }
+}
+
+.item {
+  margin-bottom: 20rpx;
+  padding: 20rpx 30rpx;
+  width: 100vw;
+  background: #FFFFFF;
+  box-sizing: border-box;
+  margin-bottom: 20rpx;
+
+  .title {
+    display: flex;
+    justify-content: space-between;
+    align-items: flex-end;
+
+    .name {
+      font-family: PingFang SC, PingFang SC;
+      font-weight: 400;
+      font-size: 28rpx;
+      color: #666666;
+      text-align: left;
+      font-style: normal;
+      text-transform: none;
+
+      .position {
+        font-family: PingFang SC, PingFang SC;
+        font-weight: 400;
+        font-size: 24rpx;
+        color: #999999;
+        text-align: left;
+        font-style: normal;
+        text-transform: none;
+      }
+    }
+
+    .tab {
+      display: inline-block;
+      padding: 0 10rpx;
+      line-height: 40rpx;
+      background: #3874F6;
+      border-radius: 100rpx;
+      font-family: PingFang SC, PingFang SC;
+      font-weight: 400;
+      font-size: 24rpx;
+      color: #FFFFFF;
+      text-align: left;
+      font-style: normal;
+      text-transform: none;
+    }
+  }
+}
+
+.phonenumber {
+  padding-top: 20rpx;
+  font-family: PingFang SC, PingFang SC;
+  font-weight: 400;
+  font-size: 24rpx;
+  color: #3874F6;
+  text-align: left;
+  font-style: normal;
+  text-transform: none;
+}
+
+
+
+
+

+ 25 - 0
bgj/workOrder/team/index.wxml

@@ -0,0 +1,25 @@
+<view class="team-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" size="24"/>
+    </navigator>
+  </view>
+</view>
+
+<view class="item" wx:for="{{tableData}}" wx:key="userid">
+  <view class="title">
+    <view class="name">
+      {{item.name}}
+      <text class="position" wx:if="{{item.position}}">{{item.position}}</text>
+    </view>
+    <view class="tab" wx:if="{{item.isLeader}}">
+      {{language['负责人']||'负责人'}}
+    </view>
+  </view>
+  <view class="phonenumber" wx:if="{{item.phonenumber}}" data-number="{{item.phonenumber}}" bind:tap="callPhone">{{item.phonenumber}}</view>
+</view>
+<My_Empty wx:if="{{list.length==0}}" />

+ 8 - 4
static/icon.wxss

@@ -1,9 +1,9 @@
 @font-face {
   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 {
@@ -14,6 +14,10 @@
   -moz-osx-font-smoothing: grayscale;
 }
 
+.icon-zanwushuju:before {
+  content: "\e652";
+}
+
 .icon-zhipaijingxiaoshang:before {
   content: "\e736";
 }