|
|
@@ -0,0 +1,348 @@
|
|
|
+<template>
|
|
|
+ <div>
|
|
|
+ <el-row :gutter="10">
|
|
|
+ <el-col :span="setcol">
|
|
|
+ <div class="flex-align-center">
|
|
|
+ <el-button style="margin-bottom:10px" size="small" type="primary" :disabled="data.STATUS !== '新建'" v-if="type !== 'confirmdate'" @click="drawer = true">{{setcol === 24?'添 加':'取 消'}}</el-button>
|
|
|
+ <el-button style="margin-bottom:10px" :disabled="data.STATUS !== '新建' && selection.length == 0" size="small" type="primary" @click="batchDeleteOrderProduct">批量删除</el-button>
|
|
|
+ </div>
|
|
|
+ <el-table
|
|
|
+ ref="multipleTable"
|
|
|
+ :data="tableData"
|
|
|
+ height="500px"
|
|
|
+ style="width: 100%;"
|
|
|
+ size="small"
|
|
|
+ stripe
|
|
|
+ border
|
|
|
+ @selection-change="handleSelectionChange">
|
|
|
+ <el-table-column
|
|
|
+ type="selection"
|
|
|
+ width="55">
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ prop="sonum"
|
|
|
+ width="150"
|
|
|
+ label="订单号"
|
|
|
+ fixed>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ prop="itemname"
|
|
|
+ label="品名"
|
|
|
+ width="240"
|
|
|
+ fixed="left">
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ prop="itemno"
|
|
|
+ label="品号"
|
|
|
+ width="100"
|
|
|
+ fixed="left">
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ prop="erpitemno"
|
|
|
+ label="erp编码"
|
|
|
+ width="150">
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ prop="unitname"
|
|
|
+ label="单位"
|
|
|
+ width="90">
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ prop="qty"
|
|
|
+ label="数量"
|
|
|
+ width="180">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-input-number :controls="true" controls-position='right' v-if="data.STATUS === '新建'" size="mini" v-model="scope.row.qty" label="输入数量" @change="rowChange(scope.row,scope.$index)" :precision="2"></el-input-number>
|
|
|
+ <span v-else>{{scope.row.qty}}</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ prop="batchno"
|
|
|
+ label="批号"
|
|
|
+ width="180">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-select :disabled="data.STATUS !== '新建'" v-if="scope.row.batchcontrol == 1" v-model="scope.row.batchno" placeholder="请选择" @visible-change="visibleChange(scope.row)" size="mini" @change="rowChange(scope.row,scope.$index)">
|
|
|
+ <el-option
|
|
|
+ v-for="item in options"
|
|
|
+ :key="item.fbatchno"
|
|
|
+ :label="item.fbatchno + ':数量' + item.fqty"
|
|
|
+ :value="item.fbatchno">
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ <span v-else>{{scope.row.batchno}}</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ prop="undeliqty"
|
|
|
+ label="未发货数量"
|
|
|
+ width="100px">
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ label="备注"
|
|
|
+ width="300"
|
|
|
+ prop="remarks">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-input v-if="data.STATUS === '新建'" v-model="scope.row.remarks" placeholder="输入订单备注" size="mini" @change="rowChange(scope.row,scope.$index)"></el-input>
|
|
|
+ <p v-else>{{scope.row.remarks}}</p>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ prop="invbalqty"
|
|
|
+ width="120px"
|
|
|
+ label="erp即时库存"
|
|
|
+ fixed="right">
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ prop="delinvbalqty"
|
|
|
+ width="120px"
|
|
|
+ label="预估库存可用量"
|
|
|
+ fixed="right">
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ prop="outwarehouseqty"
|
|
|
+ width="120px"
|
|
|
+ label="实际已出库"
|
|
|
+ fixed="right">
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="操作" width="90" fixed="right">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-button type="text" size="mini" class="inline-16" @click="deleteOrderProduct(scope.row)" :disabled="data.STATUS !== '新建'">删 除</el-button>
|
|
|
+ <el-popconfirm
|
|
|
+ title="确定关闭当前行吗?"
|
|
|
+ @confirm="cancelRow(scope.row)"
|
|
|
+ >
|
|
|
+ <el-button slot="reference" type="text" size="mini" :disabled="data.STATUS !== '复核'">关闭</el-button>
|
|
|
+ </el-popconfirm>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ <div style="margin-top:16px;text-align:right">
|
|
|
+ <el-pagination
|
|
|
+ background
|
|
|
+ small
|
|
|
+ @size-change="handleSizeChange"
|
|
|
+ @current-change="handleCurrentChange"
|
|
|
+ :current-page="currentPage"
|
|
|
+ :page-size="param.content.pageSize"
|
|
|
+ layout="total, prev, pager, next, jumper"
|
|
|
+ :total="total">
|
|
|
+ </el-pagination>
|
|
|
+ </div>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="24 - setcol">
|
|
|
+ <el-drawer
|
|
|
+ title="添加产品"
|
|
|
+ :visible.sync="drawer"
|
|
|
+ append-to-body
|
|
|
+ size="80%"
|
|
|
+ direction="rtl">
|
|
|
+ <div class="drawer__panel">
|
|
|
+ <addProduct :drawer="drawer" :data="data" @onConfirm="onConfirm"></addProduct>
|
|
|
+ </div>
|
|
|
+ </el-drawer>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+import addProduct from '@/template/invoiceCanUseProduct/index.vue'
|
|
|
+export default {
|
|
|
+ props:['type','data'],
|
|
|
+ components:{addProduct},
|
|
|
+ data () {
|
|
|
+ return {
|
|
|
+ tableData:[],
|
|
|
+ drawer:false,
|
|
|
+ setcol:24,
|
|
|
+ param:{
|
|
|
+ "id": 20221115104703,
|
|
|
+ "content": {
|
|
|
+ "sa_orderid": 0,
|
|
|
+ "pageNumber": 1,
|
|
|
+ "pageSize": 100,
|
|
|
+ "where": {
|
|
|
+ "condition": ""
|
|
|
+ }
|
|
|
+ },
|
|
|
+ },
|
|
|
+ total:0,
|
|
|
+ currentPage:0,
|
|
|
+ time: null,
|
|
|
+ options:[],
|
|
|
+ selection:[]
|
|
|
+ }
|
|
|
+ },
|
|
|
+ methods:{
|
|
|
+ async listData () {
|
|
|
+ this.param.content.sa_dispatchid = this.$route.query.id
|
|
|
+ const res = await this.$api.requested(this.param)
|
|
|
+ this.tableData = res.data
|
|
|
+ this.total = res.total
|
|
|
+ this.currentPage = res.pageNumber
|
|
|
+ console.log(res.data);
|
|
|
+
|
|
|
+ },
|
|
|
+ handleSizeChange(val) {
|
|
|
+ // console.log(`每页 ${val} 条`);
|
|
|
+ this.params.content.pageSize = val
|
|
|
+ this.listData()
|
|
|
+ },
|
|
|
+ handleCurrentChange(val) {
|
|
|
+ // console.log(`当前页: ${val}`);
|
|
|
+ this.params.content.pageNumber = val
|
|
|
+ this.listData()
|
|
|
+ },
|
|
|
+ async deleteOrderProduct (row) {
|
|
|
+ const res = await this.$api.requested({
|
|
|
+ "id": 20221115104803,
|
|
|
+ "content": {
|
|
|
+ "sa_dispatch_itemsids": [row.sa_dispatch_itemsid]
|
|
|
+ },
|
|
|
+ })
|
|
|
+ this.tool.showMessage(res,()=>{
|
|
|
+ this.listData()
|
|
|
+ this.$emit('onSuccess')
|
|
|
+ })
|
|
|
+ },
|
|
|
+ batchDeleteOrderProduct () {
|
|
|
+ this.$confirm('当前选中' + this.selection.length + '条数据,是否确定删除?', '提示', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning'
|
|
|
+ }).then(async () => {
|
|
|
+ const res = await this.$api.requested({
|
|
|
+ "id": 20221115104803,
|
|
|
+ "content": {
|
|
|
+ "sa_dispatch_itemsids": this.selection.map(e=>{
|
|
|
+ return e.sa_dispatch_itemsid
|
|
|
+ })
|
|
|
+ },
|
|
|
+ })
|
|
|
+ this.tool.showMessage(res,()=>{
|
|
|
+ this.listData()
|
|
|
+ this.$emit('onSuccess')
|
|
|
+ })
|
|
|
+ }).catch(() => {
|
|
|
+ this.$message({
|
|
|
+ type: 'info',
|
|
|
+ message: '已取消删除'
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+ },
|
|
|
+ async updateOrderProduct (val) {
|
|
|
+ const res = await this.$api.requested({
|
|
|
+ "id": 20221110145302,
|
|
|
+ "content": val
|
|
|
+ })
|
|
|
+ },
|
|
|
+ qtyChange (val,index) {
|
|
|
+ let that = this
|
|
|
+ this.$set(this.tableData,index,val)
|
|
|
+ // console.log(val,this.tableData)
|
|
|
+ // // 防抖
|
|
|
+ if(this.time !== null){
|
|
|
+ clearTimeout(this.time);
|
|
|
+ }
|
|
|
+ this.time = setTimeout(() => {
|
|
|
+ that.updateOrderProduct({
|
|
|
+ "sa_orderitemsid":val.sa_orderitemsid,
|
|
|
+ "sa_orderid":this.$route.query.id,//订单ID
|
|
|
+ "itemid":val.itemid,//产品ID
|
|
|
+ "type":"数量",//调整类型,目前只支持数量
|
|
|
+ "oldvalue":val.qty,//原值
|
|
|
+ "newvalue":val.qty,//调整后值
|
|
|
+ "remarks":val.remarks
|
|
|
+ })
|
|
|
+ },500)
|
|
|
+ },
|
|
|
+ // 订单添加产品
|
|
|
+ async onConfirm (data) {
|
|
|
+ const res = await this.$api.requested({
|
|
|
+ "id": 20221115104603,
|
|
|
+ "content": {
|
|
|
+ "sa_dispatchid": this.$route.query.id, //订单ID
|
|
|
+ "iteminfos":data.map(e=>{
|
|
|
+ e.sa_dispatch_itemsid = 0
|
|
|
+ e.qty=e.undeliqty
|
|
|
+ e.remarks = e.remarks
|
|
|
+ return e
|
|
|
+ })
|
|
|
+ },
|
|
|
+ })
|
|
|
+ this.tool.showMessage(res,()=>{
|
|
|
+ this.drawer = false
|
|
|
+ this.listData()
|
|
|
+ this.$emit('onSuccess')
|
|
|
+ })
|
|
|
+ },
|
|
|
+ rowChange(val,index){
|
|
|
+ let that = this
|
|
|
+ this.$set(this.tableData,index,val)
|
|
|
+ // // 防抖
|
|
|
+ if(this.time !== null){
|
|
|
+ clearTimeout(this.time);
|
|
|
+ }
|
|
|
+ this.time = setTimeout(() => {
|
|
|
+ that.updateOrder({
|
|
|
+ "sa_dispatchid": this.$route.query.id, //订单ID
|
|
|
+ "iteminfos": [{
|
|
|
+ "sa_dispatch_itemsid": val.sa_dispatch_itemsid,//0表示新增
|
|
|
+ "qty": val.qty, //数量
|
|
|
+ "remarks":val.remarks,
|
|
|
+ "batchno":val.batchno
|
|
|
+ }]
|
|
|
+ },()=>{
|
|
|
+ this.listData()
|
|
|
+ })
|
|
|
+ },500)
|
|
|
+ },
|
|
|
+ async updateOrder (val,fn) {
|
|
|
+ const res = await this.$api.requested({
|
|
|
+ "id": 20221115104603,
|
|
|
+ "content": val
|
|
|
+ })
|
|
|
+ this.$emit('onSuccess')
|
|
|
+ res.code === 1?fn():this.$message({
|
|
|
+ message:res.msg,
|
|
|
+ type:'error'
|
|
|
+ })
|
|
|
+
|
|
|
+ },
|
|
|
+ // 批次查询
|
|
|
+ async visibleChange (row) {
|
|
|
+ const res = await this.$api.requested({
|
|
|
+ "id": "20230427101303",
|
|
|
+ "content": {
|
|
|
+ "itemnos":[row.itemno]
|
|
|
+ }
|
|
|
+ })
|
|
|
+ this.options = res.data
|
|
|
+ },
|
|
|
+ handleSelectionChange (val) {
|
|
|
+ this.selection = val
|
|
|
+ },
|
|
|
+ async cancelRow (row) {
|
|
|
+ const res = await this.$api.requested({
|
|
|
+ id: 20230522093703,
|
|
|
+ content:{
|
|
|
+ sa_dispatch_itemsids:[row.sa_dispatch_itemsid]
|
|
|
+ }
|
|
|
+ })
|
|
|
+ this.tool.showMessage({
|
|
|
+ code:res.code,
|
|
|
+ msg:res.data[0].errmsg
|
|
|
+ },()=>{
|
|
|
+ this.listData()
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
+ mounted () {
|
|
|
+ this.listData()
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+</script>
|
|
|
+<style>
|
|
|
+</style>
|