Explorar o código

调整合同添加工具,工具借用管理

qymljy %!s(int64=2) %!d(string=hai) anos
pai
achega
22bc0f298c

+ 4 - 3
src/HDrpManagement/toolBorrowingMag/detail/tabs/toolList.vue

@@ -3,10 +3,11 @@
 <!--    <addProduct class="inline-16" :data="data" @onConfirm="listData()"></addProduct>-->
     <addTool ref="addTool" :params="paramsAdd" :tablecolsAdd="tablecolsAdd" title="添加" @addSuccess="addTools"
              @addProduct="addTool" @uploadData="uploadData" @closeDrawer="listData();$emit('onSuccess')"
-             class="inline-16"
+             class="inline-16 normal-margin" v-if="data.status === '新建'"
     ></addTool>
     <uploadAllData
-        class="inline-16"
+        v-if="data.status === '新建'"
+        class="inline-16 normal-margin"
         :total="total"
         @onSuccess="listData();$emit('onSuccess')"
         @handlePullApi="handlePullApi"
@@ -14,7 +15,7 @@
         idName="sa_orderitemsid"
         type="del"
     ></uploadAllData>
-    <el-button v-if="tool.checkAuth($route.name,'adddispatch')" size="small" type="primary" @click="adddispatch">一键发货</el-button>
+    <el-button  class="inline-16 normal-margin" v-if="tool.checkAuth($route.name,'adddispatch')" size="small" type="primary" @click="adddispatch">一键发货</el-button>
     <el-table
       ref="multipleTable"
       :data="tableData"

+ 119 - 3
src/SDrpManagement/salerToolBorrowing/detail/tabs/toolList.vue

@@ -1,6 +1,20 @@
 <template>
   <div>
-    <add-product ref="addpro" :data="data" @onConfirm="listData"></add-product>
+<!--    <add-product ref="addpro" :data="data" @onConfirm="listData"></add-product>-->
+    <addTool  ref="addTool" :params="paramsAdd" :tablecolsAdd="tablecolsAdd" title="添加" @addSuccess="addTools"
+             @addProduct="addTool" @uploadData="uploadData" @closeDrawer="listData();$emit('onSuccess')"
+             class="inline-16 normal-margin" v-if="data.status === '新建'"
+    ></addTool>
+    <uploadAllData
+        v-if="data.status === '新建'"
+        class="inline-16 normal-margin"
+        :total="total"
+        @onSuccess="listData();$emit('onSuccess')"
+        @handlePullApi="handlePullApi"
+        @handleDelApi="handleDelApi"
+        idName="sa_orderitemsid"
+        type="del"
+    ></uploadAllData>
     <el-table
       ref="multipleTable"
       :data="tableData"
@@ -174,13 +188,15 @@
 
 <script>
 import addProduct from '@/template/toolBorrowingCanUseProduct/index.vue'
-
+import addTool from '@/template/addTool/index'
+import uploadAllData from '@/components/uploadAllData/index'
 export default {
   props:['data','type'],
   data () {
     return {
       dataRefresh:true,
       tableData:[],
+      tablecolsAdd:[],
       param:{
         "id": 20230116104102,
         "content": {
@@ -192,6 +208,17 @@ export default {
           }
         },
       },
+      paramsAdd:{
+        "id": 20230116111602,
+        "content": {
+          "sa_orderid": this.$route.query.id,
+          "pageNumber": 1,
+          "pageSize": 100,
+          "where": {
+            "condition": ""
+          }
+        },
+      },
       pickerOptions: {
         disabledDate(time) {
           return time.getTime() < (Date.now() - 24 * 3600 * 1000);
@@ -204,7 +231,7 @@ export default {
     }
   },
   components:{
-    addProduct
+    addProduct,addTool,uploadAllData
   },
   methods:{
     async listData () {
@@ -317,9 +344,98 @@ export default {
         },
       })
     },
+    /*批量添加工具*/
+    async addTools(data){
+      let item = data.map(item => {
+        return {
+          sa_orderitemsid:0,
+          itemid:item.itemid,
+          qty:item.orderminqty,
+          needdate:item.deliverydate
+        }
+      })
+      let res = await this.$api.requested({
+        "id": 20221109093602,
+        "content": {
+          "sa_orderid": this.$route.query.id, //订单ID
+          "sys_enterpriseid": this.data.sys_enterpriseid, //企业ID
+          "type": "工具借用单", //订单类型
+          "items": item
+        },
+      })
+      this.tool.showMessage(res,() => {
+        this.listData()
+        this.$refs.addTool.listData()
+        this.$emit('onSuccess')
+      })
+    },
+    /*单独添加*/
+    async addTool(data){
+      let res = await this.$api.requested({
+        "id": 20221109093602,
+        "content": {
+          "sa_orderid": this.$route.query.id, //订单ID
+          "sys_enterpriseid": this.data.sys_enterpriseid, //企业ID
+          "type": "工具借用单", //订单类型
+          "items": [
+            {
+              sa_orderitemsid:0,
+              itemid:data.itemid,
+              qty:data.orderminqty,
+              needdate:data.deliverydate
+            }
+          ]
+        },
+      })
+      this.tool.showMessage(res,() => {
+        this.listData()
+        this.$refs.addTool.listData()
+        this.$emit('onSuccess')
+      })
+    },
+    /*一键添加*/
+    uploadData (uploadApi,data) {
+      uploadApi.id = 20221109093602
+      uploadApi.content = {
+        "sa_orderid": this.$route.query.id, //订单ID
+        "sys_enterpriseid": this.data.sys_enterpriseid, //企业ID
+        "type": "工具借用单", //订单类型
+        "items": data.map(e=>{
+          return {
+            sa_orderitemsid:0,
+            itemid:e.itemid,
+            qty:e.orderminqty,
+            needdate:e.deliverydate
+          }
+        })
+      }
+      this.listData()
+      this.$refs.addTool.listData()
+      this.$emit('onSuccess')
+    },
+    /*拉取数据*/
+    handlePullApi (pullApi) {
+      pullApi.content = JSON.parse(JSON.stringify(this.param.content))
+      pullApi.id = 20230116104102
+      pullApi.content.sa_orderid = this.$route.query.id
+    },
+    /*一键删除*/
+    handleDelApi (delApi,data) {
+      delApi.id = 20221109093702
+      delApi.content = {
+        "sa_orderid":this.$route.query.id,
+        "sa_orderitemsids": data,
+        "pageNumber":0,
+        "pageSize":0
+      }
+      this.listData()
+    },
   },
   mounted () {
     this.listData()
+  },
+  created() {
+    this.tablecolsAdd = this.tool.tabelCol(this.$route.name).addToolTable.tablecols
   }
 }
 

+ 119 - 3
src/SDrpManagement/toolBorrowing/detail/tabs/toolList.vue

@@ -1,6 +1,20 @@
 <template>
   <div>
-    <add-product ref="addpro" :data="data" @onConfirm="listData"></add-product>
+<!--    <add-product ref="addpro" :data="data" @onConfirm="listData"></add-product>-->
+    <addTool ref="addTool" :params="paramsAdd" :tablecolsAdd="tablecolsAdd" title="添加" @addSuccess="addTools"
+             @addProduct="addTool" @uploadData="uploadData" @closeDrawer="listData();$emit('onSuccess')"
+             class="inline-16 normal-margin" v-if="data.status === '新建'"
+    ></addTool>
+    <uploadAllDa
+        v-if="data.status === '新建'"
+        class="inline-16 normal-margin"
+        :total="total"
+        @onSuccess="listData();$emit('onSuccess')"
+        @handlePullApi="handlePullApi"
+        @handleDelApi="handleDelApi"
+        idName="sa_orderitemsid"
+        type="del"
+    ></uploadAllDa>
     <el-table
       ref="multipleTable"
       :data="tableData"
@@ -174,13 +188,15 @@
 
 <script>
 import addProduct from '@/template/toolBorrowingCanUseProduct/index.vue'
-
+import addTool from '@/template/addTool/index'
+import uploadAllData from '@/components/uploadAllData/index'
 export default {
   props:['data','type'],
   data () {
     return {
       dataRefresh:true,
       tableData:[],
+      tablecolsAdd:[],
       param:{
         "id": 20230116104102,
         "content": {
@@ -192,6 +208,17 @@ export default {
           }
         },
       },
+      paramsAdd:{
+        "id": 20230116111602,
+        "content": {
+          "sa_orderid": this.$route.query.id,
+          "pageNumber": 1,
+          "pageSize": 100,
+          "where": {
+            "condition": ""
+          }
+        },
+      },
       pickerOptions: {
         disabledDate(time) {
           return time.getTime() < (Date.now() - 24 * 3600 * 1000);
@@ -204,7 +231,7 @@ export default {
     }
   },
   components:{
-    addProduct
+    addProduct,addTool,uploadAllData
   },
   methods:{
     async listData () {
@@ -318,9 +345,98 @@ export default {
         },
       })
     },
+    /*批量添加工具*/
+    async addTools(data){
+      let item = data.map(item => {
+        return {
+          sa_orderitemsid:0,
+          itemid:item.itemid,
+          qty:item.orderminqty,
+          needdate:item.deliverydate
+        }
+      })
+      let res = await this.$api.requested({
+        "id": 20221109093602,
+        "content": {
+          "sa_orderid": this.$route.query.id, //订单ID
+          "sys_enterpriseid": this.data.sys_enterpriseid, //企业ID
+          "type": "工具借用单", //订单类型
+          "items": item
+        },
+      })
+      this.tool.showMessage(res,() => {
+        this.listData()
+        this.$refs.addTool.listData()
+        this.$emit('onSuccess')
+      })
+    },
+    /*单独添加*/
+    async addTool(data){
+      let res = await this.$api.requested({
+        "id": 20221109093602,
+        "content": {
+          "sa_orderid": this.$route.query.id, //订单ID
+          "sys_enterpriseid": this.data.sys_enterpriseid, //企业ID
+          "type": "工具借用单", //订单类型
+          "items": [
+            {
+              sa_orderitemsid:0,
+              itemid:data.itemid,
+              qty:data.orderminqty,
+              needdate:data.deliverydate
+            }
+          ]
+        },
+      })
+      this.tool.showMessage(res,() => {
+        this.listData()
+        this.$refs.addTool.listData()
+        this.$emit('onSuccess')
+      })
+    },
+    /*一键添加*/
+    uploadData (uploadApi,data) {
+      uploadApi.id = 20221109093602
+      uploadApi.content = {
+        "sa_orderid": this.$route.query.id, //订单ID
+        "sys_enterpriseid": this.data.sys_enterpriseid, //企业ID
+        "type": "工具借用单", //订单类型
+        "items": data.map(e=>{
+          return {
+            sa_orderitemsid:0,
+            itemid:e.itemid,
+            qty:e.orderminqty,
+            needdate:e.deliverydate
+          }
+        })
+      }
+      this.listData()
+      this.$refs.addTool.listData()
+      this.$emit('onSuccess')
+    },
+    /*拉取数据*/
+    handlePullApi (pullApi) {
+      pullApi.content = JSON.parse(JSON.stringify(this.param.content))
+      pullApi.id = 20230116104102
+      pullApi.content.sa_orderid = this.$route.query.id
+    },
+    /*一键删除*/
+    handleDelApi (delApi,data) {
+      delApi.id = 20221109093702
+      delApi.content = {
+        "sa_orderid":this.$route.query.id,
+        "sa_orderitemsids": data,
+        "pageNumber":0,
+        "pageSize":0
+      }
+      this.listData()
+    },
   },
   mounted () {
     this.listData()
+  },
+  created() {
+    this.tablecolsAdd = this.tool.tabelCol(this.$route.name).addToolTable.tablecols
   }
 }