xiaohaizhao 1 year ago
parent
commit
53a03c7cfe

+ 29 - 57
Eservice/agent/billCanUseProduct/index.js

@@ -6,40 +6,47 @@ Page({
    * 页面的初始数据
    */
   data: {
-    param:{
+    param: {
       "id": "20230206161703",
-      "version":1,
+      "version": 1,
       "content": {
-        "pageSize":20,
-        "pageNumber":1,
-        "sa_serviceorderid":0,
-        "sa_orderid":0,
-        "where":{
-          "condition":""
+        "pageSize": 20,
+        "pageNumber": 1,
+        "sa_serviceorderid": 0,
+        "isAll": 1, // 1-服务单产品,0-产品库
+        "sa_orderid": 0,
+        "where": {
+          "condition": ""
         }
       }
     },
-    value:'',
-    list:[],
-    selection:[]
+    value: '',
+    list: [],
+    selection: []
   },
-  search (data) {
+  tabChange(e) {
+    this.data.param.content.isAll = e.detail.title == '产品库' ? '0' : '1';
+    this.data.param.content.pageNumber = 1;
+    this.listData()
+
+  },
+  search(data) {
     this.data.param.content.where.condition = data.detail.value
     this.data.list = []
     this.data.param.content.pageNumber = 1
-
     this.listData()
   },
-  clear () {
+  clear() {
     this.data.param.content.where.condition = ''
     this.data.list = []
     this.data.param.content.pageNumber = 1
   },
-  async listData () {
+  async listData() {
     const res = await api._post(this.data.param)
+    console.log(res)
     if (res.data.length > 0) {
       this.setData({
-        list:this.data.list.concat(res.data)
+        list: res.pageNumber == 1 ? res.data : this.data.list.concat(res.data)
       })
     } else {
       wx.showToast({
@@ -54,12 +61,12 @@ Page({
       selection: event.detail.value,
     });
   },
-  refresh () {
+  refresh() {
     this.setData({
-      selection:[]
+      selection: []
     })
   },
-  onConfirm () {
+  onConfirm() {
     let pages = getCurrentPages();
     let prePage = pages[pages.length - 2];
     prePage.getAdd(this.data.selection)
@@ -71,39 +78,11 @@ Page({
   onLoad(options) {
     let pages = getCurrentPages();
     let prePage = pages[pages.length - 2];
-    this.data.param.content.sa_serviceorderid = prePage.data.sa_serviceorderid
-    this.data.param.content.sa_orderid = prePage.data.sa_orderid
+    this.data.param.content.sa_serviceorderid = prePage.data.sa_serviceorderid || prePage.data.billData.sa_serviceorderid
+    this.data.param.content.sa_orderid = prePage.data.sa_orderid || prePage.data.billData.sa_orderid
     this.listData()
   },
 
-  /**
-   * 生命周期函数--监听页面初次渲染完成
-   */
-  onReady() {
-
-  },
-
-  /**
-   * 生命周期函数--监听页面显示
-   */
-  onShow() {
-
-  },
-
-  /**
-   * 生命周期函数--监听页面隐藏
-   */
-  onHide() {
-
-  },
-
-  /**
-   * 生命周期函数--监听页面卸载
-   */
-  onUnload() {
-
-  },
-
   /**
    * 页面相关事件处理函数--监听用户下拉动作
    */
@@ -117,14 +96,7 @@ Page({
    * 页面上拉触底事件的处理函数
    */
   onReachBottom() {
-    this.data.param.content.pageNumber ++
+    this.data.param.content.pageNumber++
     this.listData()
   },
-
-  /**
-   * 用户点击右上角分享
-   */
-  onShareAppMessage() {
-
-  }
 })

+ 28 - 30
Eservice/agent/billCanUseProduct/index.wxml

@@ -1,35 +1,33 @@
 <!--pages/agent/billCanUseProduct/index.vue.wxml-->
-<t-pull-down-refresh
-  value="{{baseRefresh.value}}"
-  loadingProps="{{loadingProps}}"
-  loadingTexts="{{['下拉刷新', '松手刷新', '正在刷新', '刷新完成']}}"
-  bind:refresh="onPullDownRefresh"
-  bind:scrolltolower="onReachBottom"
->
-<view style="padding:10px">
-  <t-search model:value="{{value}}" placeholder="根据商品名称搜索"bind:submit="search" bind:clear="clear"  shape="round"/>
-  <view wx:if="{{selection.length > 0}}" style="padding:10px 10px 0 10px" class="flex-align-center flex-between">
-    <t-button size="small" variant="text" bind:tap="refresh">重 置</t-button>
-    <t-button theme="primary" size="small" variant="text" bind:tap="onConfirm">添加选中的商品</t-button>
-  </view>
-  <t-checkbox-group value="{{selection}}" bind:change="handleGroupChange" >
-    <t-cell wx:for="{{list}}" wx:key="itemid" title="{{item.itemname}}">
-      <view class="avatar" slot="left-icon">
-        <image src="{{item.attinfos[0].url}}" style="width: 60px;height: 60px;" mode="aspectFill"/>
-      </view>
-      <view slot="description">
-        <view class="small">
-          商品编号:{{item.itemno}}
+<van-tabs title-active-color='var(--assist)' color='var(--assist)' bind:change='tabChange'	>
+  <van-tab title="服务单产品" />
+  <van-tab title="产品库" />
+</van-tabs>
+<t-pull-down-refresh value="{{baseRefresh.value}}" loadingProps="{{loadingProps}}" loadingTexts="{{['下拉刷新', '松手刷新', '正在刷新', '刷新完成']}}" bind:refresh="onPullDownRefresh" bind:scrolltolower="onReachBottom">
+  <view style="padding:10px">
+    <t-search model:value="{{value}}" placeholder="根据商品名称搜索" bind:submit="search" bind:clear="clear" shape="round" />
+    <view wx:if="{{selection.length > 0}}" style="padding:10px 10px 0 10px" class="flex-align-center flex-between">
+      <t-button size="small" variant="text" bind:tap="refresh">重 置</t-button>
+      <t-button theme="primary" size="small" variant="text" bind:tap="onConfirm">添加选中的商品</t-button>
+    </view>
+    <t-checkbox-group value="{{selection}}" bind:change="handleGroupChange">
+      <t-cell wx:for="{{list}}" wx:key="itemid" title="{{item.itemname}}">
+        <view class="avatar" slot="left-icon">
+          <image src="{{item.attinfos[0].url}}" style="width: 60px;height: 60px;" mode="aspectFill" />
+        </view>
+        <view slot="description">
+          <view class="small">
+            商品编号:{{item.itemno}}
+          </view>
+          <view class="small">
+            商品型号:{{item.model}}
+          </view>
         </view>
-        <view class="small">
-          商品型号:{{item.model}}
+        <view class="avatar" slot="right-icon">
+          <t-checkbox value="{{item.itemid}}" />
         </view>
-      </view>
-      <view class="avatar" slot="right-icon">
-        <t-checkbox value="{{item.itemid}}"/>
-      </view>
-    </t-cell>
-  </t-checkbox-group>
-</view>
+      </t-cell>
+    </t-checkbox-group>
+  </view>
 
 </t-pull-down-refresh>

+ 47 - 19
Eservice/components/productCard/index.js

@@ -1,36 +1,64 @@
-// components/productCard/index.js
+const _Http = getApp().globalData.http;
+
 Component({
   /**
    * 组件的属性列表
    */
   properties: {
-    data:{
-      value:'',
-      type:{}
+    data: {
+      value: '',
+      type: {}
     },
-    changeQty:{
-      value:false,
-      type:Boolean
-    }
-  },
-
-  /**
-   * 组件的初始数据
-   */
-  data: {
-
+    changeQty: {
+      value: false,
+      type: Boolean
+    },
+    model: {
+      type: String,
+      value: 1
+    },
+    changeItem: Function
   },
-
   /**
    * 组件的方法列表
    */
   methods: {
-    onIconTap (data) {
+    onIconTap(data) {
       this.triggerEvent("delete", this.data.data);
     },
-    inputChange (e) {
+    inputChange(e) {
       this.data.data.qty = e.detail.value
       this.triggerEvent("input", this.data.data);
+    },
+    onBlur(e) {
+      let {
+        value
+      } = e.detail,
+        data = this.data.data,
+        name = e.currentTarget.dataset.name;
+      if (data[name] == value) return;
+      if (name == 'qty' && value <= 0) {
+        wx.showToast({
+          title: '数量不符合规则,已重置为1',
+        })
+        data[name] = 1
+      } else {
+        data[name] = value
+      }
+      _Http.basic({
+        "id": "20230215201903",
+        "content": {
+          "sa_workorderid": data.sa_workorderid,
+          "iteminfos": [data]
+        }
+      }).then(res => {
+        console.log("产品修改", res)
+        if (res.msg != '成功') return wx.showToast({
+          title: res.msg,
+          icon: "none"
+        });
+        this.triggerEvent("changeItem", data)
+      });
     }
   }
-})
+})

+ 43 - 9
Eservice/components/productCard/index.wxml

@@ -1,7 +1,7 @@
 <!--components/productCard/index.wxml-->
 <view class="card">
   <view class="flex">
-    <image wx:if="{{data.attinfos}}" src="{{data.attinfos[0].url}}" mode="aspectFill"/>
+    <image wx:if="{{data.attinfos[0].url}}" src="{{data.attinfos[0].url}}" mode="aspectFill" />
     <view>
       <view>{{data.itemname}}</view>
       <view class="small">
@@ -10,15 +10,49 @@
       <view class="small">
         商品型号:{{data.model}}
       </view>
-      <view wx:if="{{changeQty}}" class="small flex-align-center">
-        数量:<input value="{{data.qty}}" bindinput="inputChange" placeholder="输入数量"></input>
-      </view>
-      <view wx:else="{{changeQty}}" class="small flex-align-center">
-        数量:{{data.qty?data.qty:0}}
-      </view>
+      <block wx:if="{{model==1}}">
+        <view wx:if="{{changeQty}}" class="small flex-align-center">
+          数量:<input value="{{data.qty}}" bindinput="inputChange" placeholder="输入数量"></input>
+        </view>
+        <view wx:else="{{changeQty}}" class="small flex-align-center">
+          数量:{{data.qty?data.qty:0}}
+        </view>
+      </block>
+      <block wx:else-if="{{model==3}}">
+        <view class="small">
+          数量:{{data.qty?data.qty:0}}
+        </view>
+        <view class="small">
+          处理过程:{{data.processing}}
+        </view>
+        <view class="small">
+          处理结果:{{data.result}}
+        </view>
+        <view class="small">
+          原因分析:{{data.reason}}
+        </view>
+      </block>
     </view>
   </view>
-  <view class="deleteBtn" >
-    <t-icon class="deleteBtn" size="36rpx" name="delete" data-name="{{item}}" data-item="{{item}}" bind:click="onIconTap" />
+  <view wx:if="{{model!=3}}" class="deleteBtn">
+    <t-icon size="36rpx" name="delete" data-item="{{item}}" bind:click="onIconTap" />
   </view>
+  <block wx:if="{{model==2}}">
+    <view class="input">
+      <view class="label">数量</view>
+      <input type="digit" value="{{data.qty}}" data-name='qty' bindblur='onBlur' />
+    </view>
+    <view class="input">
+      <view class="label">处理过程</view>
+      <textarea auto-height value="{{data.processing}}" data-name='processing' bindblur='onBlur' />
+    </view>
+    <view class="input">
+      <view class="label">处理结果</view>
+      <textarea auto-height value="{{data.result}}" data-name='result' bindblur='onBlur' />
+    </view>
+    <view class="input">
+      <view class="label">原因分析</view>
+      <textarea auto-height value="{{data.reason}}" data-name='reason' bindblur='onBlur' />
+    </view>
+  </block>
 </view>

+ 42 - 13
Eservice/components/productCard/index.wxss

@@ -1,41 +1,70 @@
 /* components/productCard/index.wxss */
-.card{
-  display: flex;
-  align-items: center;
+.card {
+  position: relative;
   padding: 10px;
 }
-.flex{
-  flex: 1;
+
+.flex {
   display: flex;
 }
-.card image{
+
+.card image {
   width: 50px;
   height: 50px;
   margin-right: 10px;
 }
-.small{
+
+.small {
   font-size: 24rpx;
-  color:#999;
+  color: #999;
   line-height: 25px;
 }
+
 .deleteBtn {
+  position: absolute;
   height: 25px;
   width: 25px;
   border-radius: 100%;
   font-size: 15rpx;
-  color:#fff;
+  color: #fff;
   background-color: #e34d59;
   display: flex;
   align-items: center;
   justify-content: space-around;
+  top: 80rpx;
+  right:10rpx;
 }
-.flex-align-center{
+
+.flex-align-center {
   display: flex;
   align-items: center;
 }
-input{
-  border-bottom:1px solid #f1f2f3 ;
+
+input {
+  border-bottom: 1px solid #f1f2f3;
   width: 50px;
   margin-left: 5px;
-  color:#333
+  color: #333
+}
+
+
+.input {
+  display: flex;
+  margin-top: 16rpx;
+}
+
+.input .label {
+  width: 140rpx;
+  font-size: 28rpx;
+  line-height: 48rpx;
+}
+
+
+.input input,
+.input textarea {
+  height: 37rpx;
+  width: 450rpx;
+  border: 1rpx solid #ddd;
+  margin: 0 !important;
+  padding: 8rpx !important;
 }

+ 2 - 1
Eservice/webView/index.json

@@ -1,3 +1,4 @@
 {
-  "usingComponents": {}
+  "usingComponents": {},
+  "navigationBarTitleText": "预览"
 }

+ 43 - 1
Eservice/workOrderDetail/index.js

@@ -3,6 +3,44 @@ import Dialog from 'tdesign-miniprogram/dialog/index';
 Page({
   data: {
 
+  },
+  // 跳转到物料添加
+  addProduct() {
+    wx.navigateTo({
+      url: '/Eservice/agent/billCanUseProduct/index',
+    })
+  },
+  // 添加物料
+  async getAdd(selection) {
+    let arr = selection.map(e => {
+      return {
+        "sa_workorder_node_itemsid": 0,
+        "itemid": e,
+        "qty": 1
+      }
+    })
+    this.data.billData.titems = this.data.billData.titems.concat(arr)
+    this.updateMaterial(this.data.billData.titems)
+  },
+  //修改物料
+  changeItem({
+    detail
+  }) {
+    let index = this.data.billData.titems.findIndex(v => v.sa_workorder_node_itemsid == detail.sa_workorder_node_itemsid)
+    if (index != -1) this.setData({
+      [`billData.titems[${index}]`]: detail
+    })
+  },
+  async updateMaterial(titems) {
+    const res = await api._post({
+      "id": "20230215201903",
+      "content": {
+        "sa_workorder_confirmationid": this.data.confirmBills[0].sa_workorder_confirmationid,
+        "sa_workorderid": this.data.billData.sa_workorderid,
+        "iteminfos": titems
+      }
+    })
+    this.mainData()
   },
   /* 修改团队 */
   checkTeam(e) {
@@ -97,7 +135,11 @@ Page({
 
   },
   toConfirmBill(data) {
-    if (this.data.billData.type === '安装培训') {
+    if (this.data.billData.actiontype === "非工序模板") {
+      wx.navigateTo({
+        url: '/Eservice/materielConfirmBill/index?id=' + data.currentTarget.dataset.item.sa_workorder_confirmationid + '&class=' + this.data.stopClick,
+      })
+    } else if (this.data.billData.type === '安装培训') {
       wx.navigateTo({
         url: '/Eservice/trainConfirmBill/index?id=' + data.currentTarget.dataset.item.sa_workorder_confirmationid + '&class=' + this.data.stopClick,
       })

+ 2 - 1
Eservice/workOrderDetail/index.json

@@ -6,6 +6,7 @@
     "t-dialog": "tdesign-miniprogram/dialog/dialog",
     "t-tabs": "tdesign-miniprogram/tabs/tabs",
     "t-tab-panel": "tdesign-miniprogram/tab-panel/tab-panel",
-    "t-cell": "tdesign-miniprogram/cell/cell"
+    "t-cell": "tdesign-miniprogram/cell/cell",
+    "product-card": "../components/productCard/index"
   }
 }

+ 6 - 0
Eservice/workOrderDetail/index.scss

@@ -41,4 +41,10 @@ page{
   position: fixed;
   bottom: 0;
   background-color: #fff;
+}
+
+/* 非工序 */
+.panel {
+  padding: 10px;
+  background-color: #fff;
 }

+ 13 - 6
Eservice/workOrderDetail/index.wxml

@@ -51,14 +51,23 @@
   </card>
   <t-tabs defaultValue="{{0}}" bind:change="onTabsChange" bind:click="onTabsClick" t-class="custom-tabs">
     <t-tab-panel label="工单进度" value="0">
-      <view style="padding:10px">
 
-        <view class="small mt-5" wx:for="{{billData.nodes}}" wx:key="sa_workorder_nodeid">
+      <view wx:if="{{billData.actiontype=='非工序模板'}}">
+        <view class="panel">
+          <card style="margin-top:10px" wx:for="{{billData.titems}}" wx:key="itemid">
+            <product-card style="flex:1" model='2' slot="content" data="{{item}}" changeQty="{{false}}" bind:delete="deleteMaterial" bind:input="qtyChange" bind:changeItem="changeItem" />
+          </card>
 
-          {{index + 1}}.{{item.workpresetjson.workname}}
+          <view style="width: 100%; text-align: center;">
+            <t-button size="extra-small" variant="primary" bind:tap="addProduct">添加产品</t-button>
+          </view>
+        </view>
+      </view>
 
+      <view wx:else style="padding:10px">
+        <view class="small mt-5" wx:for="{{billData.nodes}}" wx:key="sa_workorder_nodeid">
+          {{index + 1}}.{{item.workpresetjson.workname}}
           <image-view isdelete="{{false}}" wx:if="{{item.attinfos.length > 0}}" list="{{item.attinfos}}" />
-
           <navigator url="{{billData.status=='进行中'?('/Eservice/nodeDetail/index?id=' + child.sa_workorder_nodeid + '&wid=' + id +'&class=' + stopClick):'#'}}" class="textIndentNodeChild smallChild" wx:for="{{item.child}}" wx:key="sa_workorder_nodeid" bindtap="isStopToPage" wx:for-item="child" wx:for-index="childIndex">
             {{index + 1}}-{{childIndex + 1}}.{{child.workpresetjson.workname}}
             <image-view isdelete="{{false}}" wx:if="{{child.attinfos.length > 0}}" list="{{child.attinfos}}" />
@@ -70,8 +79,6 @@
           </navigator>
           <t-divider dashed />
         </view>
-
-
       </view>
     </t-tab-panel>
     <t-tab-panel label="确认单" value="1">

+ 3 - 7
Eservice/workerLeader/agentList/index.js

@@ -37,13 +37,9 @@ Page({
   },
   onSubmit(data) {
     this.data.param.content.where.condition = data.detail.value
-    this.data.list = []
-    this.data.param.content.pageNumber = 1
-    this.listData()
-  },
-  onSubmit(data) {
-    this.data.param.content.where.condition = ''
-    this.data.list = []
+    this.setData({
+      list:[]
+    })
     this.data.param.content.pageNumber = 1
     this.listData()
   },

+ 1 - 1
Eservice/workerLeader/agentList/index.wxml

@@ -1,5 +1,5 @@
 <view class="example-search">
-  <t-search model:value="{{value}}" bind:submit="onSubmit" bind:clear="onClear" placeholder="搜索" />
+  <t-search model:value="{{value}}" bind:submit="onSubmit" bind:clear="onSubmit" placeholder="搜索" />
 </view>
 <t-pull-down-refresh
   value="{{baseRefresh.value}}"

+ 2 - 1
app.json

@@ -110,7 +110,8 @@
         "workBillConfirmInfo/index",
         "installConfirmBill/index",
         "serviceConfirmBill/index",
-        "webView/index"
+        "webView/index",
+        "materielConfirmBill/index"
       ]
     }
   ],

+ 4 - 2
packageA/market/index.js

@@ -106,11 +106,13 @@ Page({
 			}
 		};
 		if (this.data.sys_enterpriseid) content.sys_enterpriseid = this.data.sys_enterpriseid;
+
+
 		_Http.basic({
-			"id": 20221223141802,
+			"id": this.data.userrole == '业务员' ? 20230418142202 : 20221223141802,
 			content
 		}, false).then(res => {
-			console.log("获取领域", res)
+			console.log("获取领域", this.data.userrole, res)
 			if (res.msg != '成功') {
 				res.data = [{
 					rowindex: 0,

+ 2 - 2
utils/Http.js

@@ -1,7 +1,7 @@
 class HTTP {
     constructor() {
-        // this.baseUrl = "http://61.164.207.46:8000";
-        this.baseUrl = "https://oms.idcgroup.com.cn:8079";
+        this.baseUrl = "http://61.164.207.46:8000";
+        // this.baseUrl = "https://oms.idcgroup.com.cn:8079";
     }
     request({
         url,