浏览代码

联调出入库计划

Qukatie 1 周之前
父节点
当前提交
a78b6a40bb

+ 3 - 3
src/api/storehouse/outStockPlan.js → src/api/storehouse/plan.js

@@ -12,8 +12,8 @@ export const getList = (params) => {
 export const remove = (data) => {
     return request({
         url: '/api/blade-sales-part/tire/center/warehouse/plan/removePlan',
-        method: 'post',
-        data
+        method: 'get',
+        params: data
     })
 }
 export const getDetails = (data) => {
@@ -33,7 +33,7 @@ export const submit = (data) => {
 
 export const itemRemove = (data) => {
     return request({
-        url: '/api/blade-sales-part/tire/center/warehouse/plan/removePlan',
+        url: '/api/blade-sales-part/tire/center/warehouse/plan/removeItem',
         method: 'get',
         params: data
     })

+ 217 - 231
src/views/storehouse/inStockManage/inStockPlan/detailsPage.vue

@@ -8,10 +8,19 @@
             </div>
             <div class="add-customer-btn">
                 <el-button class="el-button&#45;&#45;small-yh" style="margin-left: 6px;" type="primary" size="small"
-                    v-if="editButton" @click="confirmEditing">编 辑
+                    v-if="editButton" @click="inEdit">编 辑
                 </el-button>
                 <el-button class="el-button--small-yh" v-else style="margin-left: 6px;" type="primary" size="small"
-                    :disabled="isSaveBtn" @click="editCustomer">保 存
+                    :disabled="isSaveBtn" @click="editCustomer(0)">保 存
+                </el-button>
+                <el-button class="el-button--small-yh" v-if="form.id && form.status == 0" style="margin-left: 6px;"
+                    type="success" size="small" @click="editCustomer(1)" :disabled="form.status == 1">提 交
+                </el-button>
+                <el-button class="el-button--small-yh" v-if="form.status == 1" style="margin-left: 6px;" type="success"
+                    size="small" @click="editCustomer(2)">通 过
+                </el-button>
+                <el-button class="el-button--small-yh" v-if="form.status == 1" style="margin-left: 6px;" type="danger"
+                    size="small" @click="approve()">驳 回
                 </el-button>
             </div>
         </div>
@@ -22,39 +31,38 @@
                         <!-- 联系人 -->
                         <el-select v-model="form.contacts" placeholder="请选择" size="small" style="width:60%" clearable
                             filterable allow-create default-first-option @change="contactsChange($event)"
-                            :disabled=isContacts>
+                            :disabled="editButton || form.status == 2">
                             <el-option v-for="item in contactsOption" :key="item.cname" :label="item.cname"
                                 :value="item.contacts" />
                         </el-select>
                     </template>
-                    <template slot-scope="{row,index}" slot="recAddress">
-                        <!-- 地址 -->
-                        <el-select v-model="form.recAddress" placeholder="请选择" size="small" style="width:60%" clearable
-                            filterable allow-create default-first-option :disabled=isContacts>
-                            <el-option v-for="item in recAddressOption" :key="item.id"
-                                :label="item.belongtoarea + item.detailedAddress"
-                                :value="item.belongtoarea + item.detailedAddress" />
-                        </el-select>
-                    </template>
+                    <tempalte slot="customerName">
+                        <dic-select v-model="form.customerName" placeholder="货主" key="id" label="cname" res="records"
+                            url="/blade-sales-part/corpsDesc/list?current=1&size=20&&enableOrNot=1" :filterable="true"
+                            :remote="true" dataName="cname" @selectChange="dicChange('customerName', $event)"
+                            :disabled="editButton || form.status == 2"></dic-select>
+                    </tempalte>
                 </avue-form>
             </trade-card>
             <trade-card title="明细信息">
                 <el-tabs v-model="activeName" type="card">
-                    <el-tab-pane label="入库明细" name="sale_detail">
+                    <el-tab-pane label="商品明细" name="sale_detail">
                         <avue-crud :option="optionContacts" v-model="formContacts" ref="formContacts"
-                                   :data="form.planItemsList" :key="key" @row-save="rowSave" @row-update="rowUpdate"
-                                   @row-close="rowClose" :before-close="beforeClose"
-                                   @selection-change="selectionContacts"
-                                   @resetColumn="resetColumnTwo('formContacts', 'optionContacts', 'optionContactsBack', 269.1)"
-                                   @saveColumn="saveColumnTwo('formContacts', 'optionContacts', 'optionContactsBack', 269.1)">
+                            :data="form.planItemsList" :key="key" @row-save="rowSave" @row-update="rowUpdate"
+                            @row-close="rowClose" :before-close="beforeClose" @selection-change="selectionContacts"
+                            @resetColumn="resetColumnTwo('formContacts', 'optionContacts', 'optionContactsBack', 269.1)"
+                            @saveColumn="saveColumnTwo('formContacts', 'optionContacts', 'optionContactsBack', 269.1)">
                             <template slot-scope="{scope,row}" slot="menuLeft">
-                                <el-button type="primary" icon="el-icon-plus" size="small" :disabled="isAddBtn"
-                                    @click="rowAdd(row)">添加商品
+                                <el-button type="primary" icon="el-icon-plus" size="small"
+                                    :disabled="editButton || form.status == 2" @click="rowAdd(row)">添加商品
+                                </el-button>
+                                <el-button type="success" size="small" :disabled="editButton || form.status == 2"
+                                    icon="el-icon-bottom" @click="excelDialogfun('code')">按Code导入
                                 </el-button>
                                 <el-button type="primary" icon="el-icon-printer" size="small" @click="handlePrint">打印
                                 </el-button>
                                 <el-button type="danger" plain size="small" @click="batchDelete"
-                                    :disabled="form.status != '录入' || editButton">一键删除
+                                    :disabled="editButton || form.status == 2 || selectionMultilist.length == 0">一键删除
                                 </el-button>
                             </template>
                             <template slot="goodsId" slot-scope="{ row }">
@@ -88,10 +96,8 @@
                                 <span v-else>{{ row.dot }}</span>
                             </template>
 
-                            <template slot="subTotalMoney" slot-scope="{ row }">{{
-                                (row.goodsNum *
-                                    row.price).toFixed(2)
-                            }}
+                            <template slot="subTotalMoney" slot-scope="{ row }">
+                                {{ (row.goodsNum * row.price).toFixed(2) }}
                             </template>
 
                             <template slot="remarks" slot-scope="{ row }">
@@ -100,16 +106,16 @@
                                 <span v-else>{{ row.remarks }}</span>
                             </template>
                             <template slot-scope="{type,size,row,index,disabled}" slot="menu">
-                                <el-button v-if="mingxibaocun" :size="size" :disabled="disabled || isAdd" :type="type"
-                                    :icon="row.$cellEdit ? 'el-icon-plus' : 'el-icon-edit'"
+                                <el-button v-if="mingxibaocun" :size="size" :disabled="editButton || form.status == 2"
+                                    :type="type" :icon="row.$cellEdit ? 'el-icon-plus' : 'el-icon-edit'"
                                     @click="hangeditBtn(row, index)">编辑
                                 </el-button>
-                                <el-button v-else :size="size" :disabled="disabled || isAdd" :type="type"
+                                <el-button v-else :size="size" :disabled="editButton || form.status == 2" :type="type"
                                     :icon="row.$cellEdit ? 'el-icon-plus' : 'el-icon-edit'"
                                     @click="hangbaocun(row, index)">保存
                                 </el-button>
-                                <el-button icon="el-icon-delete" :size="size" :disabled="disabled || isDisabled"
-                                           :type="type" @click="rowDelBox(row, index, 'planItemsList')">删除
+                                <el-button icon="el-icon-delete" :size="size" :disabled="editButton || form.status == 2"
+                                    :type="type" @click="rowDelBox(row, index, 'planItemsList')">删除
                                 </el-button>
                             </template>
                         </avue-crud>
@@ -126,7 +132,20 @@
             <report-dialog :switchDialog="switchDialog" reportName="轮胎商城-采购订单" :reportId="form.id"
                 @onClose="onClose()"></report-dialog>
         </div>
-
+        <el-dialog title="导入明细" append-to-body :visible.sync="excelBox" v-if="excelBox" width="555px"
+            :close-on-click-modal="false" v-dialog-drag>
+            <avue-form :option="excelOption" v-model="excelForm" table-loading="excelLoading"
+                :upload-before="uploadBefore" :upload-after="uploadAfter">
+                <template slot="excelTemplate">
+                    <el-button type="primary" @click="derivation">
+                        点击下载<i class="el-icon-download el-icon--right"></i>
+                    </el-button>
+                </template>
+            </avue-form>
+            <p style="text-align: center;color: #DC0505">
+                温馨提示 第一次导入时请先下载模板
+            </p>
+        </el-dialog>
         <el-dialog title="选择商品" append-to-body class="el-dialogDeep" :visible.sync="dialogVisible" width="80%"
             :close-on-click-modal="false" :destroy-on-close="true" :close-on-press-escape="false" @close="closeGoods">
             <el-row :style="{ height: rowHeight }">
@@ -182,6 +201,17 @@
                     :loading="saveLoading">导入</el-button>
             </span>
         </el-dialog>
+        <el-dialog title="驳回数据" append-to-body :visible.sync="approveVisible" width="30%" :close-on-click-modal="false"
+            v-dialog-drag>
+            <span>
+                <el-input type="textarea" :rows="5" placeholder="请输入驳回原因" v-model="textarea">
+                </el-input>
+            </span>
+            <span slot="footer" class="dialog-footer">
+                <el-button @click="approveVisible = false" size="mini">取消</el-button>
+                <el-button type="danger" @click="approveVisible = false; editCustomer(3)" size="mini">确定</el-button>
+            </span>
+        </el-dialog>
     </div>
 </template>
 
@@ -190,12 +220,7 @@ import { getDetails as getCustom } from "@/api/tirePartsMall/basicData/customerI
 import { getDetails as getDetailsLT } from "@/api/tirePartsMall/basicData/commodityInformation/index"
 import { dateFormat } from "@/util/date";
 import { getToken } from "@/util/auth";
-import {
-    getDetails,
-    submit,
-    delOrderItem,
-    shortcutWarehousing
-} from "@/api/tirePartsMall/salesManagement/saleOrder";
+import { shortcutWarehousing } from "@/api/tirePartsMall/salesManagement/saleOrder";
 import { dotList, goodsDetail } from "@/api/tirePartsMall/purchasingManagement/warehouseEntryOrder";
 import reportDialog from "@/components/report-dialog/main";
 import checkSchedule from "@/components/checkL/checkSchedule";
@@ -203,12 +228,14 @@ import check from "@/components/checkL/check";
 import { getCorpType, getList } from "@/api/tirePartsMall/basicData/commodityInformation"
 import { isProcurement } from "@/api/basicData/configuration";
 import commodity from "../../configuration/commodity.json";
-import {submitPlan} from "@/api/storehouse/plan/plan-in";
-
+import { getDetails, submit, itemRemove } from "@/api/storehouse/plan.js";
+import dicSelect from "@/components/dicSelect/main";
 export default {
     name: "detailsPage",
     data() {
         return {
+            approveVisible: false,
+            excelBox: false,
             numberDecimal: 0,
             SelectSearch: {},
             // 编辑还是保存
@@ -261,7 +288,6 @@ export default {
 
             inventory: 0,
             isStatus: 1,
-            excelBox: false,
             // 商品名称
             goodsIdoptions: [],
             dataList: [],
@@ -306,48 +332,44 @@ export default {
             form: {
                 planItemsList: [],
                 outboundRecordsList: [],
-                bsType: 'RP'
+                bsType: 'RP',
+                status: 0,
+            },
+            excelOption: {
+                submitBtn: false,
+                emptyBtn: false,
+                column: [
+                    {
+                        label: "模板下载",
+                        prop: "excelTemplate",
+                        formslot: true,
+                        span: 24
+                    },
+                    {
+                        label: "导入明细",
+                        prop: "excelFile",
+                        type: "upload",
+                        drag: true,
+                        loadText: "上传中,请稍等",
+                        accept: '.xls,.xlsx',
+                        span: 24,
+                        propsHttp: {
+                            res: "data"
+                        },
+                        tip: "请上传 .xls,.xlsx 标准格式文件",
+                        action: "/api/blade-sales-part/ship/import-item"
+                    }
+                ]
             },
             optionForm: {
                 menuBtn: false,
                 span: 8,
                 disabled: false,
+                labelWidth: 100,
                 column: [{
                     label: '货主',
-                    prop: "customerId",
+                    prop: "customerName",
                     disabled: false,
-                    remote: true,
-                    type: 'select',
-                    props: {
-                        label: 'cname',
-                        value: 'id'
-                    },
-                    cascader: ['recAddress'],
-                    click: () => {
-                        this.$refs.form.dicInit()
-                    },
-                    change: (data) => {
-                        console.info('data----', data)
-                        if (this.$refs.form.DIC.customerId || !this.onLoad.id) {
-                            getCustom({ id: data.value }).then(res => {
-                                console.info('res----', res)
-                                this.dicUrlWithCustomId = res.data.data.id ? res.data.data.id : ''
-                                // this.form.storageId ? this.form.storageId : res.data.data.deliveryWarehouseId
-                                // this.form.storageId = res.data.data.deliveryWarehouseId
-                                this.form.storageId = this.form.storageId ? this.form.storageId : res.data.data.deliveryWarehouseId
-                                this.form.contacts = res.data.data.corpsAttnList[0].cname
-                                this.form.phone = res.data.data.corpsAttnList[0].tel
-                                //联系人
-                                this.contactsOption = res.data.data.corpsAttnList
-                                //地址
-                                this.recAddressOption = res.data.data.corpsAddrList
-                                console.log('contactsOption', this.contactsOption);
-                                this.form.recAddress = res.data.data.corpsAddrList[0].belongtoarea + res.data.data.corpsAddrList[0].detailedAddress
-
-                            })
-                        }
-                    },
-                    dicUrl: '/api/blade-sales-part/corpsDesc/listAll?cname={{key}}&corpType=KH&enableOrNot=1',
                     rules: [{
                         required: true,
                         message: " ",
@@ -370,7 +392,7 @@ export default {
                     }]
                 },
                 {
-                    label: '业务日期',
+                    label: '计划入库日期',
                     prop: "businesDate",
                     searchProp: "businesDateList",
                     disabled: false,
@@ -387,6 +409,21 @@ export default {
                     ]
                 },
                 {
+                    label: "制单人",
+                    prop: "createUserName",
+                    disabled: true,
+                },
+                {
+                    label: '单据编号',
+                    prop: "ordNo",
+                    disabled: true,
+                },
+                {
+                    label: '计划总数量',
+                    prop: "goodsTotalNum",
+                    disabled: true,
+                },
+                {
                     label: '联系人',
                     type: "select",
                     prop: "contacts",
@@ -403,18 +440,6 @@ export default {
                     disabled: false,
 
                     prop: "phone",
-                }, {
-                    label: '地址',
-                    prop: "recAddress",
-                    type: 'select',
-                    allowCreate: true,
-                    filterable: true,
-                    disabled: false,
-                    props: {
-                        label: 'address',
-                        value: 'address'
-                    },
-                    dicUrl: '/api/blade-sales-part/corpsAddr/corpIdByAddr?pid={{key}}'
                 },
                 {
                     label: '备注',
@@ -545,11 +570,6 @@ export default {
                     }]
                 },
                 {
-                    label: '库存',
-                    prop: 'inventory',
-                    overHidden: true,
-                    width: 100
-                }, {
                     label: '批次号',
                     prop: 'dot',
                     cell: true,
@@ -619,87 +639,6 @@ export default {
                     overHidden: true,
                     width: 100
                 },
-
-                {
-                    label: '收货数量',
-                    prop: 'sendNum',
-                    overHidden: true,
-                    width: 100,
-                    disabled: true,
-                    editDisplay: false,
-                    addDisplay: false
-                },
-                {
-                    label: '返利后单价',
-                    prop: 'rebatePrice',
-                    overHidden: true,
-                    width: 100,
-                    cell: true,
-                },
-                {
-                    label: '返利后成本价',
-                    prop: 'rebateCostprie',
-                    overHidden: true,
-                    width: 100,
-                    disabled: true,
-                    editDisplay: false,
-                    addDisplay: false
-                },
-                {
-                    label: '返利后利润',
-                    prop: 'rebateProfit',
-                    overHidden: true,
-                    width: 100,
-                    disabled: true,
-                    editDisplay: false,
-                    addDisplay: false
-                },
-                {
-                    label: '退货数量',
-                    prop: "returnsNumber",
-                    overHidden: true,
-                    width: 100,
-                    disabled: true,
-                },
-                {
-                    label: '退货金额',
-                    prop: "returnsAmount",
-                    overHidden: true,
-                    width: 100,
-                    disabled: true,
-                },
-                // {
-                //     label: '利润',
-                //     prop: 'profit',
-                //     overHidden: true,
-                //     width: 100
-                // },
-
-                // {
-                //     label: '返利',
-                //     prop: 'thisAmount',
-                //     overHidden: true,
-                //     width: 100
-                // },
-                // {
-                //     label: '成本',
-                //     prop: 'costprie',
-                //     overHidden: true,
-                //     width: 100,
-                //     disabled: true,
-                //     editDisplay: false,
-                //     addDisplay: false
-
-                // },
-                // {
-                //     label: '毛利',
-                //     prop: 'grossProfit',
-                //     overHidden: true,
-                //     width: 100,
-                //     disabled: true,
-                //     editDisplay: false,
-                //     addDisplay: false
-                // },
                 {
                     label: '备注',
                     prop: "remarks",
@@ -786,7 +725,7 @@ export default {
             }
         }
     },
-    components: { reportDialog, check, checkSchedule },
+    components: { reportDialog, check, checkSchedule, dicSelect },
     props: {
         onLoad: Object,
         detailData: Object
@@ -849,11 +788,7 @@ export default {
         if (this.onLoad.id && this.detailData.id) {
             this.$set(this.optionForm, 'disabled', true)
             this.$set(this.optionContactsBack, 'disabled', true)
-            this.isContacts = true
-
-            this.isDisabled = true
-            //添加删除按钮禁用
-            this.isAdd = true
+            this.editButton = true
             this.getDetail(this.onLoad.id, true)
         } else if (this.onLoad.id) {
             this.getDetail(this.onLoad.id, true)
@@ -871,6 +806,36 @@ export default {
         })
     },
     methods: {
+        inEdit() {
+            if (this.form.status != 2) {
+                this.editButton = false
+                this.$set(this.optionForm, 'disabled', false)
+                this.$set(this.optionContactsBack, 'disabled', false)
+            }
+        },
+        dicChange(name, row) {
+            if (name == 'customerName') {
+                if (row) {
+                    this.form.customerId = row.id
+                    getCustom({ id: row.id }).then(res => {
+                        if (res.data.data) {
+                            this.dicUrlWithCustomId = res.data.data.id ? res.data.data.id : ''
+                            this.form.storageId = this.form.storageId ? this.form.storageId : res.data.data.deliveryWarehouseId
+                            this.form.contacts = res.data.data.corpsAttnList[0].cname
+                            this.form.phone = res.data.data.corpsAttnList[0].tel
+                            this.contactsOption = res.data.data.corpsAddrList
+                        }
+                    })
+                } else {
+                    this.form.customerId = null
+                    this.form.customerName = null
+                    this.dicUrlWithCustomId = null
+                    this.form.storageId = null
+                    this.form.contacts = null
+                    this.form.phone = null
+                }
+            }
+        },
         // 一键入库
         oneClickStorage() {
             if (this.form.planItemsList.length == 0) {
@@ -1160,11 +1125,57 @@ export default {
             let matchedContact = this.contactsOption.find(item => item.contacts == e);
             // 判断是否找到匹配的对象
             this.$set(this.form, 'phone', matchedContact.tel)
-            // this.$set(this.form, 'recAddress', matchedContact.belongtoarea + matchedContact.detailedAddress)
 
         },
+        uploadAfter(res, done, loading, column) {
+            if (Array.isArray(res)) {
+                if (res instanceof Array) {
+                    this.form.planItemsList = this.form.planItemsList.concat(res)
+                    res.forEach(item => {
+                        dotList({
+                            storageId: this.form.storageId,
+                            goodsId: res.goodsId
+                        }).then(e => {
+                            this.findObject(this.optionContactsBack.column, "dot").dicData = e.data.data
+                        })
+                    })
+                }
+            } else {
+                this.$message.error(res)
+            }
+            loading = false;
+            done(res);
+        },
+        derivation() {
+            window.open(
+                `${this.templateUrl}?${this.website.tokenHeader
+                }=${getToken()}&stockId=${this.form.storageId}`
+            );
+        },
+        uploadBefore(file, done, loading) {
+            done();
+            loading = true;
+        },
+        // 销售明细 导入按钮
+        excelDialogfun(name) {
+            if (!this.form.customerId) {
+                this.$message.error('请选择货主')
+                return
+            }
+            if (name == '名称') {
+                this.findObject(this.excelOption.column, "excelFile").action = '/api/blade-sales-part/order/import-item-name'
+                this.templateUrl = '/api/blade-sales-part/order/export-item-name'
+            } else if (name == 'code') {
+                this.findObject(this.excelOption.column, "excelFile").action = '/api/blade-sales-part/order/import-item-code'
+                this.templateUrl = '/api/blade-sales-part/order/export-item-code'
+            }
+            this.excelBox = true
+        },
+        approve(type) {
+            this.approveVisible = true
+        },
         //修改提交触发
-        editCustomer() {
+        editCustomer(type) {
             this.$refs["form"].validate((valid, done) => {
                 done();
                 let picihao = false
@@ -1190,10 +1201,7 @@ export default {
                             this.form.planItemsList[i].sendNum = 0
                         }
                     }
-                    this.mingxibaocun = true
-                    if (picihao) {
-                        return
-                    }
+                    this.form.status = type
                     const loading = this.$loading({
                         lock: true,
                         text: '加载中',
@@ -1201,23 +1209,9 @@ export default {
                         background: 'rgba(255,255,255,0.7)'
                     });
                     this.form.storageName = this.form.$storageId ? this.form.$storageId : ''
-                    submitPlan({
-                        bsType: "RP",
-                        ...this.form
-                    }).then(res => {
-                        this.$message.success("保存成功");
-                        this.getDetail(res.data.data.id)
-                        this.isDisabledTask = false
-                        // this.editButton = true // 让编辑按钮出来
-                        // this.isDisabledTask = false;
-                        // this.viewDisabled = false;
-                        this.isAddBtn = false // 表格的添加商品禁用
-                        this.$set(this.optionForm, 'disabled', false)
-                        this.$set(this.optionContactsBack, 'disabled', false)
-                        this.isContacts = true // 基础信息联系人 和地址插槽禁用
-                        // 表格的删除按钮禁用
-                        this.isDisabled = false
-                        this.isAdd = false // 表格的编辑和保存按钮禁用
+                    submit(this.form).then(res => {
+                        this.$message.success("操作成功");
+                        this.getDetail(res.data.data)
                         loading.close();
                     }).finally(() => {
                         loading.close();
@@ -1244,35 +1238,10 @@ export default {
                 this.$nextTick(() => {
                     this.$refs.formContacts.doLayout()
                 })
-                if (this.form.status == '审核中') {
-                    this.isApplySettlement = false;
-                    this.isRevocationRequest = false // 撤销请核能点击
-                }
-                if (this.form.generateTask == '已生成') {
-                    this.buttonText = '撤销任务';
-                    this.buttonColor = 'warning'
-                }
-                this.optionForm.column.forEach(its => {
-                    if (JSON.parse(localStorage.getItem('saber-userInfo')).content.role_name.split(',').includes('销售')) {
-                        if (its.prop == 'cost' || its.prop == 'grossProfit') {
-                            this.$set(its, 'display', false)
-                        }
-                    }
-                })
-                this.form.planItemsList.forEach((items) => {
-                    if (!items.subTotalMoney) {
-                        items.subTotalMoney = items.goodsNum * items.price
-                        items.grossProfit = items.subTotalMoney - items.costprie
-                    }
-                })
-                if (res.data.data.checkStatus == '审核完成') {
-                    console.log('审核完成');
+                if (res.data.data.status==2) {
                     this.$set(this.optionForm, 'disabled', true)
                     this.$set(this.optionContactsBack, 'disabled', true)
-                    this.isContacts = true
-                    this.isDisabled = true
-                    //添加删除按钮禁用
-                    this.isAdd = true
+                    this.editButton = true
                 }
                 loading.close();
             }).catch(() => {
@@ -1286,7 +1255,7 @@ export default {
                 type: "warning"
             }).then(() => {
                 if (row.id) {
-                    delOrderItem({ ids: row.id }).then(res => {
+                    itemRemove({ ids: row.id }).then(res => {
                         this.form.planItemsList.splice(index, 1);
                         this.$message.success("操作成功!");
                     });
@@ -1326,7 +1295,7 @@ export default {
                 })
                 // 有id 的处理
                 if (itemsWithId.length != 0) {
-                    delOrderItem({ ids: arrIds.join(',') }).then(res => {
+                    itemRemove({ ids: arrIds.join(',') }).then(res => {
                         this.$message.success("操作成功!");
                     });
                 }
@@ -1397,6 +1366,19 @@ export default {
         backToList(type) {
             this.$emit("backToList", type);
         },
+    },
+    watch: {
+        "form.planItemsList": {
+            // 执行方法
+            handler(Value, newValue) {
+                this.form.goodsTotalNum = 0
+                Value.forEach(item => {
+                    this.form.goodsTotalNum += Number(item.goodsNum ? item.goodsNum : 0)
+                })
+            },
+            deep: false, // 深度监听
+            immediate: false  // 第一次改变就执行
+        },
     }
 }
 </script>
@@ -1405,4 +1387,8 @@ export default {
 ::v-deep .el-form-item {
     margin-bottom: 8px !important;
 }
+
+::v-deep .el-dialog__body {
+    padding: 10px 20px;
+}
 </style>

+ 9 - 16
src/views/storehouse/inStockManage/inStockPlan/index.vue

@@ -34,11 +34,7 @@
         <template slot-scope="{type,size,row,index}" slot="menu">
           <!-- <el-button :size="size" :type="type" @click="check(row)">查看</el-button> -->
           <!--  判断是否一键采购过 然后展示不同的判断按钮-->
-          <el-button v-if="row.shortcutWarehousingStatus == '1'" :size="size" :type="type"
-            :disabled="row.status != '录入' && row.item >= 1" @click="$refs.crud.rowDel(row, index)">删除</el-button>
-
-          <el-button v-else :size="size" :type="type"
-            :disabled="row.status != '录入' && row.status != '待确认' && row.item >= 1 || row.numberRows >= 1"
+          <el-button :size="size" :type="type" :disabled="row.status != 0 && row.numberRows >= 1"
             @click="$refs.crud.rowDel(row, index)">删除</el-button>
         </template>
         <template slot="corpNameSearch">
@@ -67,7 +63,7 @@
 </template>
 
 <script>
-import { getList, remove, getGoodsInfo } from "@/api/tirePartsMall/salesManagement/saleOrder";
+import { getList, remove } from "@/api/storehouse/plan.js";
 import detailsPage from "./detailsPage"
 import { getDetails } from "@/api/tirePartsMall/salesManagement/saleOrder";
 import { getToken } from "@/util/auth";
@@ -84,9 +80,7 @@ export default {
       returnStatusList: [],
       detailsOpen: false,
       loading: false,
-      search: {
-        bsType: 'RP'
-      },
+      search: {},
       form: {},
       dataList: [],
       detailData: {},
@@ -249,7 +243,7 @@ export default {
           decimals: 2
         },],
         column: [{
-          label: '业务单号',
+          label: '单据编号',
           prop: "ordNo",
           search: true,
           overHidden: true,
@@ -304,7 +298,7 @@ export default {
           search: true,
           overHidden: true,
           type: 'select',
-          dicUrl: "/api/blade-system/dict-biz/dictionary?code=procurement_Status",
+          dicUrl: "/api/blade-system/dict-biz/dictionary?code=center_plan_status",
           props: {
             label: "dictValue",
             value: "dictKey"
@@ -445,7 +439,7 @@ export default {
     this.option.column.forEach(item => {
       if (item.search) i++
     })
-    this.getWorkDicts("procurement_Status").then(res => {
+    this.getWorkDicts("center_plan_status").then(res => {
       this.orderStatusList = res.data.data
     });
     this.getWorkDicts("settlement_Status").then(res => {
@@ -474,7 +468,6 @@ export default {
           }
         }
       }
-      config.params.bsType = 'CG'
       console.log(config, 427)
       const routeData = this.$router.resolve({
         path: '/api/blade-sales-part/order/listExport',      //跳转目标下载地址
@@ -545,7 +538,7 @@ export default {
         ...params,
         current: page.currentPage,
         size: page.pageSize,
-        bsType: "CG",
+        bsType: 'RP',
         ...Object.assign(params, this.search)
       }
       this.loading = true
@@ -607,7 +600,7 @@ export default {
 }
 </script>
 
-<style scoped>
+<style lang="scss" scoped>
 .bottomBox {
   padding: 3px 6px;
   border-radius: 12px;
@@ -615,7 +608,7 @@ export default {
   font-size: 10px;
 }
 
-/deep/ .el-col-md-8 {
+::v-deep .el-col-md-8 {
   width: 24.33333%;
 }
 </style>

+ 137 - 169
src/views/storehouse/outStockManage/outStockPlan/detailsPage.vue

@@ -18,28 +18,19 @@
         <div style="margin-top: 50px">
             <trade-card title="基础信息">
                 <avue-form :option="optionForm" v-model="form" ref="form">
-                    <tempalte slot="customerName" slot-scope="{ row }">
-                        <search-query :datalist="customerData" :selectValue="form.customerName" :clearable="true"
-                            :buttonIf="false" :filterable="true" :remote="true"
-                            :disabled="!(form.status == 0 || form.status == 3)" placeholder="请选择货主"
-                            :forParameter="{ key: 'id', label: 'cname', value: 'cname' }" @corpFocus="KHgetListfun"
-                            @remoteMethod="KHgetListfun" @corpChange="KHcorpChange" @corpClear="KHClear">
-                        </search-query>
-                    </tempalte>
                     <template slot-scope="{row,index}" slot="contacts">
                         <el-select v-model="form.contacts" placeholder="请选择" size="small" style="width:60%" clearable
                             filterable allow-create default-first-option @change="contactsChange($event)"
-                            :disabled="!(form.status == 0 || form.status == 3)">
+                            :disabled="form.status == 2">
                             <el-option v-for="item in contactsOption" :key="item.id" :label="item.contacts"
                                 :value="item.contacts" />
                         </el-select>
                     </template>
-                    <tempalte slot="salerName">
-                        <dic-select v-model="form.salerName" placeholder="业务员" key="id" label="name"
-                            url="/blade-user/salerList" :filterable="true"
-                            @selectChange="dicChange('salerName', $event)"
-                            :disabled="!(form.status == 0 || form.status == 3)">
-                        </dic-select>
+                    <tempalte slot="customerName">
+                        <dic-select v-model="form.customerName" placeholder="货主" key="id" label="cname" res="records"
+                            url="/blade-sales-part/corpsDesc/list?current=1&size=20&&enableOrNot=1" :filterable="true"
+                            :remote="true" dataName="cname" @selectChange="dicChange('customerName', $event)"
+                            :disabled="editButton || form.status == 2"></dic-select>
                     </tempalte>
                 </avue-form>
             </trade-card>
@@ -52,13 +43,15 @@
                             @resetColumn="resetColumnTwo('formContacts', 'optionContacts', 'optionContactsBack', 269.6)"
                             @saveColumn="saveColumnTwo('formContacts', 'optionContacts', 'optionContactsBack', 269.6)">
                             <template slot-scope="{scope,row}" slot="menuLeft">
-                                <el-button type="primary" icon="el-icon-plus" size="small"
-                                    :disabled="!(form.status == 0 || form.status == 3)"
+                                <el-button type="primary" icon="el-icon-plus" size="small" :disabled="form.status == 2"
                                     @click="rowAdd(row, 1)">添加商品</el-button>
+                                <el-button type="success" size="small" :disabled="form.status == 2"
+                                    icon="el-icon-bottom" @click="excelDialogfun('code')">按Code导入
+                                </el-button>
                                 <el-button type="primary" icon="el-icon-printer" size="small"
                                     @click="handlePrint">打印</el-button>
                                 <el-button type="danger" plain size="small" @click="batchDelete"
-                                    :disabled="!(form.status == 0 || form.status == 3)">一键删除</el-button>
+                                    :disabled="form.status == 2">一键删除</el-button>
                                 <el-popover width="600" trigger="click">
                                     <avue-crud :data="inventoryData" :option="inventoryOption"></avue-crud>
                                     <el-button type="primary" plain size="small" slot="reference" @click="viewInventory"
@@ -100,17 +93,15 @@
                                 <span v-else>{{ row.remarks }}</span>
                             </template>
                             <template slot-scope="{type,size,row,index,disabled}" slot="menu">
-                                <el-button v-if="mingxibaocun" :size="size"
-                                    :disabled="!(form.status == 0 || form.status == 3)" :type="type"
+                                <el-button v-if="mingxibaocun" :size="size" :disabled="form.status == 2" :type="type"
                                     :icon="row.$cellEdit ? 'el-icon-plus' : 'el-icon-edit'"
                                     @click="hangeditBtn(row, index)">编辑
                                 </el-button>
-                                <el-button v-else :size="size" :disabled="!(form.status == 0 || form.status == 3)"
-                                    :type="type" :icon="row.$cellEdit ? 'el-icon-plus' : 'el-icon-edit'"
+                                <el-button v-else :size="size" :disabled="form.status == 2" :type="type"
+                                    :icon="row.$cellEdit ? 'el-icon-plus' : 'el-icon-edit'"
                                     @click="hangbaocun(row, index)">保存
                                 </el-button>
-                                <el-button icon="el-icon-delete" :size="size"
-                                    :disabled="!(form.status == 0 || form.status == 3)" :type="type"
+                                <el-button icon="el-icon-delete" :size="size" :disabled="form.status == 2" :type="type"
                                     @click="rowDelBox(row, index, 'planItemsList')">删除
                                 </el-button>
                             </template>
@@ -128,7 +119,20 @@
             <report-dialog :switchDialog="switchDialog" :reportName="reportName" :reportId="form.id"
                 @onClose="onClose()"></report-dialog>
         </div>
-
+        <el-dialog title="导入明细" append-to-body :visible.sync="excelBox" v-if="excelBox" width="555px"
+            :close-on-click-modal="false" v-dialog-drag>
+            <avue-form :option="excelOption" v-model="excelForm" table-loading="excelLoading"
+                :upload-before="uploadBefore" :upload-after="uploadAfter">
+                <template slot="excelTemplate">
+                    <el-button type="primary" @click="derivation">
+                        点击下载<i class="el-icon-download el-icon--right"></i>
+                    </el-button>
+                </template>
+            </avue-form>
+            <p style="text-align: center;color: #DC0505">
+                温馨提示 第一次导入时请先下载模板
+            </p>
+        </el-dialog>
 
         <el-dialog title="选择商品" append-to-body class="el-dialogDeep" :visible.sync="dialogVisible" width="80%"
             :close-on-click-modal="false" :destroy-on-close="true" :close-on-press-escape="false" @close="closeGoods">
@@ -209,25 +213,8 @@
 <script>
 import { getDetails as getCustom } from "@/api/tirePartsMall/basicData/customerInformation"
 import { getDetails as getDetailsGods } from '@/api/tirePartsMall/basicData/commodityInformation'
-import {
-    getDetails,
-    submit,
-    generateShipTask,
-    tradingBox,
-    itemRemove,
-    checkOrder,
-    confirmRefund,
-    revokeCheckOrder,
-    goodsListXs,
-    revokeGenerateShipTask,
-    goodsPageXs,
-    getGoodAllList,
-    generateReturns,
-    whetherExistenceFinancing,
-    checkOrderRW,
-    revokeCheckOrderRW,
-    getParamservice
-} from "@/api/tirePartsMall/salesManagement/saleOrder";
+import { goodsListXs, goodsPageXs } from "@/api/tirePartsMall/salesManagement/saleOrder";
+import { getDetails, submit, itemRemove } from "@/api/storehouse/plan.js";
 import { dotList, goodsDetail } from "@/api/tirePartsMall/purchasingManagement/warehouseEntryOrder";
 import reportDialog from "@/components/report-dialog/main";
 import { dateFormat } from "@/util/date";
@@ -250,6 +237,7 @@ export default {
     name: "detailsPage",
     data() {
         return {
+            excelBox: false,
             inventoryData2: [],
             numberDecimal: 0,
             goodsType: 1,
@@ -338,6 +326,7 @@ export default {
                     value: "id",
                 }
             },
+            templateUrl: '', // 模板url
             // 表格需要的配置
             optionTwo: commodityxsho,
             loading: false,
@@ -389,13 +378,40 @@ export default {
                 planItemsList: [],
                 outboundRecordsList: [],
                 status: 0,
-                bsType:'CP'
+                bsType: 'CP'
+            },
+            excelOption: {
+                submitBtn: false,
+                emptyBtn: false,
+                column: [
+                    {
+                        label: "模板下载",
+                        prop: "excelTemplate",
+                        formslot: true,
+                        span: 24
+                    },
+                    {
+                        label: "导入明细",
+                        prop: "excelFile",
+                        type: "upload",
+                        drag: true,
+                        loadText: "上传中,请稍等",
+                        accept: '.xls,.xlsx',
+                        span: 24,
+                        propsHttp: {
+                            res: "data"
+                        },
+                        tip: "请上传 .xls,.xlsx 标准格式文件",
+                        action: "/api/blade-sales-part/ship/import-item"
+                    }
+                ]
             },
             customerData: [], // 货主数据
             optionForm: {
                 menuBtn: false,
                 span: 8,
                 disabled: false,
+                labelWidth:100,
                 column: [{
                     label: '货主',
                     prop: "customerName",
@@ -406,17 +422,8 @@ export default {
                         message: " ",
                         trigger: "blur"
                     }]
-                },
+                }, 
                 {
-                    label: '业务员',
-                    disabled: false,
-                    prop: "salerName",
-                    rules: [{
-                        required: true,
-                        message: " ",
-                        trigger: "blur"
-                    }]
-                }, {
                     label: '仓库',
                     prop: "storageId",
                     type: 'select',
@@ -427,6 +434,28 @@ export default {
                         value: 'id'
                     },
                     dicUrl: '/api/blade-sales-part/storageDesc/listAll',
+                }, 
+                {
+                    label: '计划出库日期',
+                    prop: "businesDate",
+                    searchProp: "businesDateList",
+                    disabled: false,
+                    type: "datetime",
+                    value: dateFormat(new Date(), 'yyyy-MM-dd'),
+                    format: "yyyy-MM-dd",
+                    valueFormat: "yyyy-MM-dd",
+                    rules: [
+                        {
+                            required: true,
+                            message: "",
+                            trigger: "blur"
+                        }
+                    ]
+                },
+                {
+                    label: "制单人",
+                    prop: "createUserName",
+                    disabled: true,
                 },
                 {
                     label: '联系人',
@@ -458,33 +487,11 @@ export default {
                         value: 'address'
                     },
                     dicUrl: '/api/blade-sales-part/corpsAddr/corpIdByAddr?pid={{key}}'
-                }, {
-                    label: '业务日期',
-                    prop: "businesDate",
-                    searchProp: "businesDateList",
-                    disabled: false,
-                    type: "datetime",
-                    value: dateFormat(new Date(), 'yyyy-MM-dd'),
-                    format: "yyyy-MM-dd",
-                    valueFormat: "yyyy-MM-dd",
-                    rules: [
-                        {
-                            required: true,
-                            message: "",
-                            trigger: "blur"
-                        }
-                    ]
-                }, {
-                    label: '收款方式',
-                    prop: "receivableType",
-                    type: "select",
-                    disabled: false,
-                    dicUrl: "/api/blade-system/dict-biz/dictionary?code=receivableType",
-                    props: {
-                        label: "dictValue",
-                        value: "dictValue"
-                    },
-                    value: '网络支付'
+                },
+                {
+                    label: '单据编号',
+                    prop: "ordNo",
+                    disabled: true,
                 },
                 {
                     label: '配送方式',
@@ -517,24 +524,12 @@ export default {
                     prop: "expressNo"
                 },
                 {
-                    label: '单据编号',
-                    prop: "ordNo",
-                    disabled: true
-                },
-                {
-                    label: '出库日期',
-                    prop: "deliveryBusinesDate",
-                    disabled: true,
-                    type: "datetime",
-                    format: "yyyy-MM-dd",
-                    valueFormat: "yyyy-MM-dd HH:mm:ss"
-                }, {
                     label: '备注',
                     prop: "remarks",
                     type: 'textarea',
                     disabled: false,
-                    span: 16,
-                    minRows: 1
+                    span: 24,
+                    minRows: 2
                 }]
             },
             optionContacts: {},
@@ -616,14 +611,8 @@ export default {
                         disabled: false,
                         remote: true,
                         overHidden: true,
-                    }, {
-                        label: '库存',
-                        prop: 'inventory',
-                        width: 250,
-                        disabled: false,
-                        remote: true,
-                        overHidden: true,
-                    }, {
+                    },
+                    {
                         label: '数量',
                         prop: 'goodsNum',
                         overHidden: true,
@@ -910,8 +899,7 @@ export default {
         if (this.onLoad.id && this.detailData.id) {
             this.$set(this.optionForm, 'disabled', true)
             this.$set(this.optionContactsBack, 'disabled', true)
-            this.isContacts = true
-            this.isDisabled = true
+            this.editButton = true
             this.getDetail(this.onLoad.id, true)
         } else if (this.onLoad.id) {
             this.getDetail(this.onLoad.id, true)
@@ -921,6 +909,29 @@ export default {
         })
     },
     methods: {
+        dicChange(name, row) {
+            if (name == 'customerName') {
+                if (row) {
+                    this.form.customerId = row.id
+                    getCustom({ id: row.id }).then(res => {
+                        if (res.data.data) {
+                            this.dicUrlWithCustomId = res.data.data.id ? res.data.data.id : ''
+                            this.form.storageId = this.form.storageId ? this.form.storageId : res.data.data.deliveryWarehouseId
+                            this.form.contacts = res.data.data.corpsAttnList[0].cname
+                            this.form.phone = res.data.data.corpsAttnList[0].tel
+                            this.contactsOption = res.data.data.corpsAddrList
+                        }
+                    })
+                } else {
+                    this.form.customerId = null
+                    this.form.customerName = null
+                    this.dicUrlWithCustomId = null
+                    this.form.storageId = null
+                    this.form.contacts = null
+                    this.form.phone = null
+                }
+            }
+        },
         viewInventory() {
             this.inventoryData = []
             inventoryList({ cname: this.selectionMultilist[0].goodsName }).then(res => [
@@ -954,59 +965,30 @@ export default {
             loading = false;
             done(res);
         },
+        derivation() {
+            window.open(
+                `${this.templateUrl}?${this.website.tokenHeader
+                }=${getToken()}&stockId=${this.form.storageId}`
+            );
+        },
         uploadBefore(file, done, loading) {
             done();
             loading = true;
         },
-        // 货主监听
-        KHcorpChange(value) {
-            for (let item of this.customerData) {
-                if (item.cname == value) {
-                    this.$set(this.form, 'customerId', item.id)
-                    this.$set(this.form, 'customerName', item.cname)
-
-                    if (this.$refs.form.DIC.customerId || !this.onLoad.id) {
-                        getCustom({ id: item.id }).then(res => {
-                            if (res.data.data) {
-                                this.dicUrlWithCustomId = res.data.data.id ? res.data.data.id : ''
-                                this.form.storageId = this.form.storageId ? this.form.storageId : res.data.data.deliveryWarehouseId
-                                this.form.contacts = res.data.data.corpsAttnList[0].cname
-                                this.form.phone = res.data.data.corpsAttnList[0].tel
-                                this.contactsOption = res.data.data.corpsAddrList
-                                this.form.recAddress = res.data.data.corpsAddrList[0].belongtoarea + res.data.data.corpsAddrList[0].detailedAddress
-                                this.form.salerId = res.data.data.salesmanId ? res.data.data.salesmanId : ''
-                                this.form.salerName = res.data.data.salesmanName ? res.data.data.salesmanName : ''
-                            }
-                        })
-                    }
-
-                }
+        // 销售明细 导入按钮
+        excelDialogfun(name) {
+            if (!this.form.customerId) {
+                this.$message.error('请选择货主')
+                return
             }
-        },
-        KHClear() {
-            this.form.customerId = ''
-            this.form.customerName = ''
-            this.dicUrlWithCustomId = ''
-            this.form.storageId = ''
-            this.form.contacts = ''
-            this.form.phone = ''
-            this.contactsOption = ''
-            this.form.recAddress = ''
-            this.form.salerId = ''
-            this.form.salerName = ''
-            this.KHgetListfun()
-        },
-        // 获取货主数据
-        KHgetListfun(cname) {
-            KHgetList({
-                current: 1,
-                size: 10,
-                corpType: 'KH',
-                enableOrNot: 1,
-                cname: cname ? cname : null,
-            }).then(res => {
-                this.customerData = res.data.data.records
-            })
+            if (name == '名称') {
+                this.findObject(this.excelOption.column, "excelFile").action = '/api/blade-sales-part/order/import-item-name'
+                this.templateUrl = '/api/blade-sales-part/order/export-item-name'
+            } else if (name == 'code') {
+                this.findObject(this.excelOption.column, "excelFile").action = '/api/blade-sales-part/order/import-item-code'
+                this.templateUrl = '/api/blade-sales-part/order/export-item-code'
+            }
+            this.excelBox = true
         },
         // 获取详细明细信息
         getDetailsfun() {
@@ -1064,17 +1046,6 @@ export default {
             this.onLoadfun(this.page, params);
             done()
         },
-        dicChange(name, row) {
-            if (name == 'salerName') {
-                if (row) {
-                    this.form.salerId = row.id
-                    this.form.salerName = row.name
-                } else {
-                    this.form.salerId = null
-                    this.form.salerName = null
-                }
-            }
-        },
         // 标签页切换
         tabHandle(data) {
             if (data.name == 'searchList') {
@@ -1305,10 +1276,7 @@ export default {
                     });
                     this.form.storageName = this.form.$storageId ? this.form.$storageId : ''
                     this.form.billType = this.form.billType ? this.form.billType : 0
-                    submit({
-                        bsType: "XS",
-                        ...this.form
-                    }).then(res => {
+                    submit(this.form).then(res => {
                         this.$message.success("保存成功");
                         this.getDetail(res.data.data.id)
                         this.isDisabledTask = false

+ 5 - 7
src/views/storehouse/outStockManage/outStockPlan/index.vue

@@ -64,7 +64,7 @@
 </template>
 
 <script>
-import { getList, remove, getGoodsInfo } from "@/api/storehouse/outStockPlan.js";
+import { getList, remove} from "@/api/storehouse/plan.js";
 import detailsPage from "./detailsPage"
 import { getDetails } from "@/api/tirePartsMall/salesManagement/saleOrder";
 import { getToken } from "@/util/auth";
@@ -81,9 +81,7 @@ export default {
       actualStatusList: [],
       returnStatusList: [],
       loading: false,
-      search: {
-        bsType:'CP'
-      },
+      search: {},
       form: {},
       dataList: [],
       detailData: {},
@@ -505,7 +503,7 @@ export default {
         }
       }
       console.log(config, 427)
-      config.params.bsType = 'XS'
+      config.params.bsType = 'CP'
       const routeData = this.$router.resolve({
         path: '/api/blade-sales-part/order/listExport',      //跳转目标下载地址
         query: {
@@ -587,7 +585,7 @@ export default {
         ...params,
         current: page.currentPage,
         size: page.pageSize,
-        bsType: "XS",
+        bsType: "CP",
         ...Object.assign(params, this.search)
       }
       this.loading = true
@@ -639,7 +637,7 @@ export default {
 }
 </script>
 
-<style scoped>
+<style lang="scss" scoped>
 .itemTable ::v-deep .el-table {
   margin-left: 50px;
   width: 100%;