|
@@ -5,6 +5,16 @@
|
|
|
<slot name="operation"></slot>
|
|
|
<el-button style="margin:0 0 10px 10px" size="small" type="primary" :disabled="data.status !== '新建'" v-if="type !== 'confirmdate'" @click="drawer = true">{{setcol === 24?'添 加':'取 消'}}</el-button>
|
|
|
<excel style="margin:0 0 10px 10px" :tablecols="columnTitle" :param="param" :total="total" :excelTitle="excelTitle"></excel>
|
|
|
+ <uploadAllData
|
|
|
+ style="margin:0 0 10px 10px"
|
|
|
+ :total="total"
|
|
|
+ @onSuccess="listData()"
|
|
|
+ @handlePullApi="handlePullApi"
|
|
|
+ @handleDelApi="handleDelApi"
|
|
|
+ idName="sa_orderitemsid"
|
|
|
+ type="del"
|
|
|
+ ></uploadAllData>
|
|
|
+ <!-- <el-button type="primary" size="small" style="margin:0 0 10px 10px" @click="allProduct">一 键 删 除</el-button> -->
|
|
|
</div>
|
|
|
<p class="normal-margin" style="font-size: 13px !important;color:red;font-weight: normal" v-if="data.status === '新建'">{{checkFreefreightamount}}</p>
|
|
|
<el-table
|
|
@@ -326,17 +336,27 @@
|
|
|
</div>
|
|
|
</el-drawer>
|
|
|
</el-col>
|
|
|
+ <el-dialog
|
|
|
+ title=""
|
|
|
+ :visible.sync="progressVisible"
|
|
|
+ :show-close="false"
|
|
|
+ append-to-body
|
|
|
+ width="500px">
|
|
|
+ <el-progress v-if="totalPage" :percentage="Math.floor(progress / totalPage * 100)"></el-progress>
|
|
|
+ </el-dialog>
|
|
|
</el-row>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
import addProduct from './addProduct.vue'
|
|
|
import excel from '../export_excel.vue'
|
|
|
+import uploadAllData from '@/components/uploadAllData/index'
|
|
|
export default {
|
|
|
props:['data','type'],
|
|
|
components:{
|
|
|
excel,
|
|
|
- addProduct
|
|
|
+ addProduct,
|
|
|
+ uploadAllData
|
|
|
},
|
|
|
computed: {
|
|
|
checkNB () {
|
|
@@ -378,7 +398,7 @@ export default {
|
|
|
"content": {
|
|
|
"sa_orderid": 0, //订单ID
|
|
|
"pageNumber": 1,
|
|
|
- "pageSize": 10000,
|
|
|
+ "pageSize": 20,
|
|
|
"where": {
|
|
|
"condition": ""
|
|
|
}
|
|
@@ -398,7 +418,11 @@ export default {
|
|
|
currentPage:0,
|
|
|
time: null,
|
|
|
value2:'',
|
|
|
- stockOptions:[]
|
|
|
+ stockOptions:[],
|
|
|
+ totalPage:0,
|
|
|
+ progress:0,
|
|
|
+ progressVisible:false,
|
|
|
+ deleteIds:[]
|
|
|
}
|
|
|
},
|
|
|
methods:{
|
|
@@ -407,9 +431,75 @@ export default {
|
|
|
const res = await this.$api.requested(this.param)
|
|
|
this.tableData = res.data
|
|
|
this.total = res.total
|
|
|
+ this.totalPage = Math.ceil(this.total /200)
|
|
|
this.currentPage = res.pageNumber
|
|
|
this.queryBasicInfo()
|
|
|
},
|
|
|
+ handlePullApi (pullApi) {
|
|
|
+ pullApi.content = {
|
|
|
+ "sa_orderid": 0, //订单ID
|
|
|
+ "pageNumber": 1,
|
|
|
+ "pageSize": 20,
|
|
|
+ "where": {
|
|
|
+ "condition": ""
|
|
|
+ }
|
|
|
+ }
|
|
|
+ pullApi.id = 20221109093902
|
|
|
+ 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
|
|
|
+ }
|
|
|
+ },
|
|
|
+ /* 一键选择所有商品 */
|
|
|
+ async allProduct () {
|
|
|
+ if (this.total > 200) {
|
|
|
+ this.$confirm(`总共删除${this.total}个商品,时间较长,是否继续`,'提示',{
|
|
|
+ confirmButtonText:'确定',
|
|
|
+ cancelButtonText:'取消',
|
|
|
+ type:'warning'
|
|
|
+ }).then(async () => {
|
|
|
+ this.progressVisible = true
|
|
|
+ let totalPage = Math.ceil(this.total / 200)
|
|
|
+ for (let index = 1; index <= totalPage; index++) {
|
|
|
+ this.pullData(index)
|
|
|
+ }
|
|
|
+ // this.$emit('onConfirm',res.data)
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ this.$confirm('是否删除所有数据?','提示',{
|
|
|
+ confirmButtonText:'确定',
|
|
|
+ cancelButtonText:'取消',
|
|
|
+ type:'warning'
|
|
|
+ }).then(async () => {
|
|
|
+ this.param.content.sa_orderid = this.$route.query.id
|
|
|
+ this.param.content.pageNumber = 1
|
|
|
+ this.param.content.pageSize = 200
|
|
|
+ const res = await this.$api.requested(this.param)
|
|
|
+ this.deleteIds.push(...res.data.map(item => item.sa_orderitemsid))
|
|
|
+ this.deleteOrderProduct(this.deleteIds)
|
|
|
+ })
|
|
|
+
|
|
|
+ }
|
|
|
+ },
|
|
|
+ /* 拉取数据 */
|
|
|
+ async pullData (page) {
|
|
|
+ this.param.content.sa_orderid = this.$route.query.id
|
|
|
+ this.param.content.pageNumber = page
|
|
|
+ this.param.content.pageSize = 200
|
|
|
+ const res = await this.$api.requested(this.param)
|
|
|
+ this.progress++
|
|
|
+ this.deleteIds.push(...res.data.map(item => item.sa_orderitemsid))
|
|
|
+ if (this.progress >= this.totalPage) {
|
|
|
+ this.deleteOrderProduct(this.deleteIds)
|
|
|
+ this.progressVisible = false
|
|
|
+ this.progress = 0
|
|
|
+ this.param.content.pageSize = 20
|
|
|
+ }
|
|
|
+ },
|
|
|
handleSizeChange(val) {
|
|
|
// console.log(`每页 ${val} 条`);
|
|
|
this.params.content.pageSize = val
|
|
@@ -425,12 +515,13 @@ export default {
|
|
|
"id": 20221109093702,
|
|
|
"content": {
|
|
|
"sa_orderid":this.$route.query.id,
|
|
|
- "sa_orderitemsids": [row.sa_orderitemsid]
|
|
|
+ "sa_orderitemsids": Object.prototype.toString.call(row).indexOf('Array') != -1 ? row : [row.sa_orderitemsid]
|
|
|
},
|
|
|
})
|
|
|
this.tool.showMessage(res,()=>{
|
|
|
this.listData()
|
|
|
this.$emit('onSuccess')
|
|
|
+ this.deleteIds = []
|
|
|
})
|
|
|
},
|
|
|
stockChange (item,row,index) {
|
|
@@ -542,28 +633,27 @@ export default {
|
|
|
this.$emit('select',selection)
|
|
|
},
|
|
|
// 订单添加商品
|
|
|
- async onConfirm (data) {
|
|
|
- const res = await this.$api.requested({
|
|
|
- "id": 20221109093602,
|
|
|
- "content": {
|
|
|
- "sa_orderid": this.$route.query.id, //订单ID
|
|
|
- "sys_enterpriseid": this.data.sys_enterpriseid, //企业ID
|
|
|
- "type": this.data.type, //订单类型
|
|
|
- "items": data.map(e=>{
|
|
|
- return {
|
|
|
- sa_orderitemsid:0,
|
|
|
- itemid:e.itemid,
|
|
|
- qty:e.orderminqty,
|
|
|
- needdate:e.deliverydate
|
|
|
- }
|
|
|
- })
|
|
|
- },
|
|
|
- })
|
|
|
- this.tool.showMessage(res,()=>{
|
|
|
- this.drawer = false
|
|
|
- this.listData()
|
|
|
- this.$emit('onSuccess')
|
|
|
- })
|
|
|
+ async onConfirm (data,isupload) {
|
|
|
+ if (isupload) {
|
|
|
+ const res = await this.$api.requested({
|
|
|
+ "id": 20221109093602,
|
|
|
+ "content": {
|
|
|
+ "sa_orderid": this.$route.query.id, //订单ID
|
|
|
+ "sys_enterpriseid": this.data.sys_enterpriseid, //企业ID
|
|
|
+ "type": this.data.type, //订单类型
|
|
|
+ "items": data.map(e=>{
|
|
|
+ return {
|
|
|
+ sa_orderitemsid:0,
|
|
|
+ itemid:e.itemid,
|
|
|
+ qty:e.orderminqty,
|
|
|
+ needdate:e.deliverydate
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ })
|
|
|
+ }
|
|
|
+ this.listData()
|
|
|
+ this.$emit('onSuccess')
|
|
|
},
|
|
|
async queryStock (val) {
|
|
|
const res = await this.$api.requested({
|