|
@@ -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
|
|
|
}
|
|
|
}
|
|
|
|