|
@@ -20,26 +20,26 @@
|
|
|
</div>
|
|
|
|
|
|
<Card :bordered="false" dis-hover class="ivu-mt">
|
|
|
- <div class="new_tab" v-if="formValidate.id == 0">
|
|
|
+ <div class="new_tab" v-if="formValidate_0.id == 0">
|
|
|
<Tabs v-model="currentTab" @on-click="onClickTab">
|
|
|
<TabPane label="自建采购单" name="0" />
|
|
|
- <TabPane label="库间流转" name="1" />
|
|
|
- <TabPane label="商品在途" name="2" />
|
|
|
+ <TabPane label="汇总采购" name="1" />
|
|
|
+ <TabPane label="要货采购" name="2" />
|
|
|
</Tabs>
|
|
|
</div>
|
|
|
- <Form v-if="currentTab == 0" class="formValidate mt20" ref="formValidate" :rules="ruleValidate"
|
|
|
- :model="formValidate" :label-width="labelWidth" :label-position="labelPosition" @submit.native.prevent>
|
|
|
+ <Form v-if="currentTab == 0" class="formValidate mt20" ref="formValidate_0" :rules="ruleValidate"
|
|
|
+ :model="formValidate_0" :label-width="labelWidth" :label-position="labelPosition" @submit.native.prevent>
|
|
|
<Row :gutter="24" type="flex">
|
|
|
<Col span="24">
|
|
|
<FormItem label="仓库:" prop="wid">
|
|
|
- <el-cascader placeholder="请选择仓库" class="input-add" size="mini" v-model="formValidate.wid"
|
|
|
+ <el-cascader placeholder="请选择仓库" class="input-add" size="mini" v-model="formValidate_0.wid"
|
|
|
:options="data1" :props="props" @change="userSearchss" filterable clearable v-width="'400'">
|
|
|
</el-cascader>
|
|
|
</FormItem>
|
|
|
</Col>
|
|
|
<Col span="24">
|
|
|
<FormItem label="供应商:" prop="supplier_id" label-for="supplier_id">
|
|
|
- <Select v-model="formValidate.supplier_id" @on-change="userSearchsss" clearable
|
|
|
+ <Select v-model="formValidate_0.supplier_id" @on-change="userSearchsss" clearable
|
|
|
class="input-add">
|
|
|
<Option v-for="item in supplierList" :value="item.id" :key="item.id">
|
|
|
{{ item.supplier_name }}
|
|
@@ -48,8 +48,16 @@
|
|
|
</FormItem>
|
|
|
</Col>
|
|
|
<Col span="24">
|
|
|
+ <FormItem label="创建人:" prop="create_uid" v-if="formValidate_0.wid != 0 ">
|
|
|
+ <el-cascader placeholder="请选择创建人" class="input-add" size="mini"
|
|
|
+ v-model="formValidate_0.create_uid" :options="authList" :props="propsss" @change="checkAuth"
|
|
|
+ filterable clearable v-width="'400'">
|
|
|
+ </el-cascader>
|
|
|
+ </FormItem>
|
|
|
+ </Col>
|
|
|
+ <Col span="24">
|
|
|
<FormItem label="商品:" prop="goods">
|
|
|
- <Table :columns="formValidate.id == 0 ?columns:columnss" :data="chooseGoods" ref="table"
|
|
|
+ <Table :columns="formValidate_0.id == 0 ?columns:columnss" :data="chooseGoods" ref="table"
|
|
|
:loading="loading" no-userFrom-text="暂无数据" no-filtered-userFrom-text="暂无筛选结果">
|
|
|
<template slot-scope="{ row,index }" slot="product_num">
|
|
|
<Input v-model="chooseGoods[index].product_num" placeholder="请输入要货数量" v-width="'150'"
|
|
@@ -81,24 +89,25 @@
|
|
|
</template> -->
|
|
|
</Table>
|
|
|
<Button type="primary" class="submission" style="margin-top:20px;" @click="getGoods()"
|
|
|
- v-if="formValidate.id == 0">选择商品</Button>
|
|
|
+ v-if="formValidate_0.id == 0">选择商品</Button>
|
|
|
</FormItem>
|
|
|
</Col>
|
|
|
</Row>
|
|
|
</Form>
|
|
|
- <Form v-if="currentTab == 1" class="formValidate mt20" ref="formValidate" :rules="ruleValidate"
|
|
|
- :model="formValidate" :label-width="labelWidth" :label-position="labelPosition" @submit.native.prevent >
|
|
|
+ <Form v-if="currentTab == 1" class="formValidate mt20" ref="formValidate_1" :rules="ruleValidate"
|
|
|
+ :model="formValidate_1" :label-width="labelWidth" :label-position="labelPosition"
|
|
|
+ @submit.native.prevent>
|
|
|
<Row :gutter="24" type="flex">
|
|
|
<Col span="24">
|
|
|
<FormItem label="仓库:" prop="wid">
|
|
|
- <el-cascader placeholder="请选择仓库" class="input-add" size="mini" v-model="formValidate.wid"
|
|
|
+ <el-cascader placeholder="请选择仓库" class="input-add" size="mini" v-model="formValidate_1.wid"
|
|
|
:options="data1" :props="props" @change="chooseWid" filterable clearable v-width="'400'">
|
|
|
</el-cascader>
|
|
|
</FormItem>
|
|
|
</Col>
|
|
|
<Col span="24">
|
|
|
<FormItem label="供应商:" prop="supplier_id" label-for="supplier_id">
|
|
|
- <Select v-model="formValidate.supplier_id" @on-change="userSearchsss" clearable
|
|
|
+ <Select v-model="formValidate_1.supplier_id" @on-change="userSearchsss" clearable
|
|
|
class="input-add">
|
|
|
<Option v-for="item in supplierList" :value="item.id" :key="item.id">
|
|
|
{{ item.supplier_name }}
|
|
@@ -107,12 +116,105 @@
|
|
|
</FormItem>
|
|
|
</Col>
|
|
|
<Col span="24">
|
|
|
- <FormItem label="商品:" prop="goods" >
|
|
|
- <Table :columns="formValidate.id == 0 ?columns_1:columnss" :data="goods" ref="table"
|
|
|
- :loading="loading" no-userFrom-text="暂无数据" no-filtered-userFrom-text="暂无筛选结果" @on-selection-change="change">
|
|
|
+ <FormItem label="创建人:" prop="create_uid" v-if="formValidate_1.wid != 0 ">
|
|
|
+ <el-cascader placeholder="请选择创建人" class="input-add" size="mini"
|
|
|
+ v-model="formValidate_1.create_uid" :options="authList" :props="propsss" @change="checkAuth"
|
|
|
+ filterable clearable v-width="'400'">
|
|
|
+ </el-cascader>
|
|
|
+ </FormItem>
|
|
|
+ </Col>
|
|
|
+ <Col span="24">
|
|
|
+ <FormItem label="审核人:" prop="purchasing_person_uid" v-if="formValidate_1.wid != 0 ">
|
|
|
+ <el-cascader placeholder="请选择审核人" class="input-add" size="mini"
|
|
|
+ v-model="formValidate_1.purchasing_person_uid" :options="authList" :props="propsss"
|
|
|
+ filterable clearable v-width="'400'">
|
|
|
+ </el-cascader>
|
|
|
+ </FormItem>
|
|
|
+ </Col>
|
|
|
+ <Col span="24">
|
|
|
+ <FormItem label="商品:" prop="goods">
|
|
|
+ <Table :columns="formValidate_1.id == 0 ?columns_1:columnss" :data="goods" ref="table"
|
|
|
+ :loading="loading" no-userFrom-text="暂无数据" no-filtered-userFrom-text="暂无筛选结果"
|
|
|
+ @on-selection-change="change">
|
|
|
<template slot-scope="{ row,index }" slot="product_num">
|
|
|
- <Input v-model="goods[index].want_product_num" placeholder="请输入要货数量" v-width="'150'"
|
|
|
- type="number" />
|
|
|
+ <!-- <Input v-model="goods[index].want_product_num" placeholder="请输入要货数量" v-width="'150'"
|
|
|
+ type="number" /> -->
|
|
|
+ {{row.want_product_num}}
|
|
|
+ </template>
|
|
|
+ <template slot-scope="{ row,index }" slot="unit_type">
|
|
|
+ <Select v-model="goods[index].unit_type" style="width:200px">
|
|
|
+ <Option v-for="item in row.unitList" :value="item.value" :key="item.value">
|
|
|
+ {{ item.label }}
|
|
|
+ </Option>
|
|
|
+ </Select>
|
|
|
+ </template>
|
|
|
+ <template slot-scope="{ row,index }" slot="unit_types">
|
|
|
+ {{row.unit_name}}
|
|
|
+ </template>
|
|
|
+ <template slot-scope="{ row,index }" slot="store_num">
|
|
|
+ <span> {{ row.my.stock }}{{row.my.unit_name}}</span>
|
|
|
+ </template>
|
|
|
+ <template slot-scope="{ row, index }" slot="action">
|
|
|
+ <a @click="del(index)">删除</a>
|
|
|
+ </template>
|
|
|
+ <!-- <template slot-scope="{ row }" slot="product">
|
|
|
+ <div class="product">
|
|
|
+ <div class="image" v-viewer>
|
|
|
+ <img v-lazy="row.image">
|
|
|
+ </div>
|
|
|
+ <div class="title">{{ row.store_name }}</div>
|
|
|
+ </div>
|
|
|
+ </template> -->
|
|
|
+ </Table>
|
|
|
+ </FormItem>
|
|
|
+ </Col>
|
|
|
+ </Row>
|
|
|
+ </Form>
|
|
|
+ <Form v-if="currentTab == 2" class="formValidate mt20" ref="formValidate_2" :rules="ruleValidate"
|
|
|
+ :model="formValidate_2" :label-width="labelWidth" :label-position="labelPosition"
|
|
|
+ @submit.native.prevent>
|
|
|
+ <Row :gutter="24" type="flex">
|
|
|
+ <Col span="24">
|
|
|
+ <FormItem label="要货单号:" prop="want_order_id" label-for="want_order_id">
|
|
|
+ <Input v-model="formValidate_2.want_order_id" placeholder="请输入要货单号" v-width="'250'"/>
|
|
|
+ <span class="addClass" @click="addClass" >确认</span>
|
|
|
+ </FormItem>
|
|
|
+ </Col>
|
|
|
+ <Col span="24">
|
|
|
+ <FormItem label="供应商:" prop="supplier_id" label-for="supplier_id">
|
|
|
+ <Select v-model="formValidate_2.supplier_id" @on-change="userSearchsss" clearable
|
|
|
+ class="input-add">
|
|
|
+ <Option v-for="item in supplierList" :value="item.id" :key="item.id">
|
|
|
+ {{ item.supplier_name }}
|
|
|
+ </Option>
|
|
|
+ </Select>
|
|
|
+ </FormItem>
|
|
|
+ </Col>
|
|
|
+ <Col span="24">
|
|
|
+ <FormItem label="创建人:" prop="create_uid" v-if="formValidate_2.wid != 0 ">
|
|
|
+ <el-cascader placeholder="请选择创建人" class="input-add" size="mini"
|
|
|
+ v-model="formValidate_2.create_uid" :options="authList" :props="propsss" @change="checkAuth"
|
|
|
+ filterable clearable v-width="'400'">
|
|
|
+ </el-cascader>
|
|
|
+ </FormItem>
|
|
|
+ </Col>
|
|
|
+ <Col span="24">
|
|
|
+ <FormItem label="审核人:" prop="purchasing_person_uid" v-if="formValidate_2.wid != 0 ">
|
|
|
+ <el-cascader placeholder="请选择审核人" class="input-add" size="mini"
|
|
|
+ v-model="formValidate_2.purchasing_person_uid" :options="authList" :props="propsss"
|
|
|
+ filterable clearable v-width="'400'">
|
|
|
+ </el-cascader>
|
|
|
+ </FormItem>
|
|
|
+ </Col>
|
|
|
+ <Col span="24">
|
|
|
+ <FormItem label="商品:" prop="goods">
|
|
|
+ <Table :columns="formValidate_2.id == 0 ?columns_2:columnss" :data="goodss" ref="table"
|
|
|
+ :loading="loading" no-userFrom-text="暂无数据" no-filtered-userFrom-text="暂无筛选结果"
|
|
|
+ @on-selection-change="change">
|
|
|
+ <template slot-scope="{ row,index }" slot="product_num">
|
|
|
+ <!-- <Input v-model="goods[index].want_product_num" placeholder="请输入要货数量" v-width="'150'"
|
|
|
+ type="number" /> -->
|
|
|
+ {{row.want_product_num}}
|
|
|
</template>
|
|
|
<template slot-scope="{ row,index }" slot="unit_type">
|
|
|
<Select v-model="goods[index].unit_type" style="width:200px">
|
|
@@ -149,7 +251,7 @@
|
|
|
:style="{ left: `${!menuCollapse ? '200px' : isMobile ? '0' : '80px'}` }">
|
|
|
<Form>
|
|
|
<FormItem>
|
|
|
- <Button type="primary" class="submission" @click="handleSubmit('formValidate')">保存</Button>
|
|
|
+ <Button type="primary" class="submission" @click="handleSubmit('formValidate_' + currentTab)">保存</Button>
|
|
|
</FormItem>
|
|
|
</Form>
|
|
|
</Card>
|
|
@@ -173,7 +275,8 @@
|
|
|
getOutGoods,
|
|
|
createPurchase,
|
|
|
getWantInfo,
|
|
|
- getPurchaseGoods
|
|
|
+ getPurchaseGoods,
|
|
|
+ getWantList
|
|
|
} from "@/api/erp";
|
|
|
import {
|
|
|
keyApi,
|
|
@@ -200,7 +303,9 @@
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
- goods: [],
|
|
|
+ goodss: [],
|
|
|
+ chooseGoods_1: [], //汇总采购选中商品
|
|
|
+ goods: [], //汇总采购的商品列表
|
|
|
currentTab: 0,
|
|
|
supplierList: [],
|
|
|
loading: false,
|
|
@@ -268,6 +373,27 @@
|
|
|
minWidth: 150
|
|
|
},
|
|
|
|
|
|
+ ],
|
|
|
+ columns_2: [ {
|
|
|
+ title: "ID",
|
|
|
+ key: "product_id",
|
|
|
+ minWidth: 90
|
|
|
+ },{
|
|
|
+ title: '商品名称',
|
|
|
+ key: 'product_name',
|
|
|
+ minWidth: 160
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '数量',
|
|
|
+ slot: 'product_num',
|
|
|
+ minWidth: 90
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '单位',
|
|
|
+ slot: 'unit_types',
|
|
|
+ minWidth: 150
|
|
|
+ },
|
|
|
+
|
|
|
],
|
|
|
chooseGoods: [],
|
|
|
staffData: [],
|
|
@@ -302,11 +428,31 @@
|
|
|
sm: 24,
|
|
|
xs: 24,
|
|
|
},
|
|
|
- formValidate: {
|
|
|
+ formValidate_0: {
|
|
|
+ id: 0,
|
|
|
+ wid: 0,
|
|
|
+ goods: [],
|
|
|
+ supplier_id: 0,
|
|
|
+ create_admin_id: 0,
|
|
|
+ create_uid: 0
|
|
|
+ },
|
|
|
+ formValidate_1: {
|
|
|
id: 0,
|
|
|
wid: 0,
|
|
|
goods: [],
|
|
|
- supplier_id: 0
|
|
|
+ supplier_id: 0,
|
|
|
+ create_admin_id:0,
|
|
|
+ create_uid: 0,
|
|
|
+ purchasing_person_uid: 0
|
|
|
+ },
|
|
|
+ formValidate_2: {
|
|
|
+ id: 0,
|
|
|
+ wid: 0,
|
|
|
+ supplier_id: 0,
|
|
|
+ create_admin_id:0,
|
|
|
+ create_uid: 0,
|
|
|
+ purchasing_person_uid: 0,
|
|
|
+ want_order_id: '',
|
|
|
},
|
|
|
ruleValidate: {
|
|
|
supplier_id: [{
|
|
@@ -321,12 +467,17 @@
|
|
|
message: "请选择仓库",
|
|
|
trigger: "blur"
|
|
|
}, ],
|
|
|
- // create_uid: [{
|
|
|
- // type: "number",
|
|
|
- // required: true,
|
|
|
- // message: "请选择创建人",
|
|
|
- // trigger: "blur"
|
|
|
- // }, ],
|
|
|
+ create_uid: [{
|
|
|
+ type: "number",
|
|
|
+ required: true,
|
|
|
+ message: "请选择创建人",
|
|
|
+ trigger: "blur"
|
|
|
+ }, ],
|
|
|
+ want_order_id: [{
|
|
|
+ required: true,
|
|
|
+ message: "请选择要货单号",
|
|
|
+ trigger: "blur"
|
|
|
+ }, ],
|
|
|
// goods: [{
|
|
|
// type: "array",
|
|
|
// required: true,
|
|
@@ -357,20 +508,54 @@
|
|
|
},
|
|
|
methods: {
|
|
|
...mapMutations("admin/layout", ["setCopyrightShow"]),
|
|
|
+ addClass() {
|
|
|
+ if(this.formValidate_2.want_order_id) {
|
|
|
+ getWantInfo(this.formValidate_2.want_order_id).then(res => {
|
|
|
+ if(res.data && res.data.id) {
|
|
|
+ let data = res.data
|
|
|
+ this.formValidate_2.wid = data.wid
|
|
|
+ this.goodss = data.info
|
|
|
+ this.getUserList(data.wid)
|
|
|
+ }else {
|
|
|
+ return this.$Message.error(res.msg);
|
|
|
+ }
|
|
|
+ // console.log(res);
|
|
|
+ // if(res.data.data.length > 0) {
|
|
|
+ // this.goodss = res.data.data[0].info
|
|
|
+ // }else {
|
|
|
+ // return this.$Message.error('请输入正确的要货单号');
|
|
|
+ // }
|
|
|
+ })
|
|
|
+ }else {
|
|
|
+ return this.$Message.error('请输入要货单号');
|
|
|
+ }
|
|
|
+
|
|
|
+ },
|
|
|
change(e) {
|
|
|
console.log(e);
|
|
|
+ this.chooseGoods_1 = e
|
|
|
+ },
|
|
|
+ checkAuth(e) {
|
|
|
+ if (e) {
|
|
|
+ let obj = this.authList.find(item => item.id == e)
|
|
|
+ console.log(e,'check',obj);
|
|
|
+ this['formValidate_' +this.currentTab].create_admin_id = obj.admin_id
|
|
|
+ }
|
|
|
+
|
|
|
},
|
|
|
chooseWid(e) {
|
|
|
this.goods = []
|
|
|
- if(e) {
|
|
|
+ this.chooseGoods_1 = []
|
|
|
+ if (e) {
|
|
|
getPurchaseGoods({
|
|
|
wid: e
|
|
|
}).then(res => {
|
|
|
this.goods = res.data[0].data
|
|
|
- console.log(this.goods,'params');
|
|
|
+ console.log(this.goods, 'params');
|
|
|
})
|
|
|
+ this.getUserList(this.formValidate_1.wid)
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
},
|
|
|
onClickTab(e) {
|
|
|
console.log(e);
|
|
@@ -389,14 +574,14 @@
|
|
|
getWantInfo(id) {
|
|
|
getWantInfo(id).then(res => {
|
|
|
let data = res.data
|
|
|
- this.formValidate.id = data.id
|
|
|
- this.formValidate.create_uid = data.create_uid
|
|
|
+ this.formValidate_0.id = data.id
|
|
|
+ this.formValidate_0.create_uid = data.create_uid
|
|
|
this.chooseGoods = data.info
|
|
|
- this.formValidate.store_id = data.store_id
|
|
|
+ this.formValidate_0.store_id = data.store_id
|
|
|
if (data.wid) {
|
|
|
- this.formValidate.type = 0
|
|
|
- this.formValidate.wid = data.wid
|
|
|
- this.getUserList()
|
|
|
+ this.formValidate_0.type = 0
|
|
|
+ this.formValidate_0.wid = data.wid
|
|
|
+ this.getUserList(this.formValidate_0.wid)
|
|
|
}
|
|
|
})
|
|
|
},
|
|
@@ -429,7 +614,7 @@
|
|
|
this.chooseGoods = this.chooseGoods.concat(this.resetGoods(e, 're'))
|
|
|
},
|
|
|
getGoods() {
|
|
|
- if (this.formValidate.wid == 0) {
|
|
|
+ if (this.formValidate_0.wid == 0) {
|
|
|
return this.$Message.error('请选择仓库');
|
|
|
}
|
|
|
this.$refs.goodDetail.clearChoose()
|
|
@@ -437,9 +622,9 @@
|
|
|
this.$refs.goodDetail.formValidate.type = 0
|
|
|
this.$refs.goodDetail.formValidate.wid = this.formValidate.wid
|
|
|
},
|
|
|
- getUserList() {
|
|
|
+ getUserList(id) {
|
|
|
getUserList({
|
|
|
- wid: this.formValidate.wid
|
|
|
+ wid: id
|
|
|
}).then(res => {
|
|
|
// console.log(res);
|
|
|
this.authList = res.data.data
|
|
@@ -464,27 +649,10 @@
|
|
|
},
|
|
|
getGodownInfo(id) {
|
|
|
getGodownInfo(id).then(res => {
|
|
|
- this.formValidate = res.data
|
|
|
- this.formValidate.addressSelect = this.formValidate.addressSelect.map(item => item * 1)
|
|
|
- console.log(this.formValidate.addressSelect);
|
|
|
- })
|
|
|
- },
|
|
|
- addchack(e, selectedData) {
|
|
|
- console.log(selectedData, 'selectedData');
|
|
|
- e.forEach((i, index) => {
|
|
|
- if (index == 0) {
|
|
|
- this.formValidate.province = i
|
|
|
- } else if (index == 1) {
|
|
|
- this.formValidate.city = i
|
|
|
- } else if (index == 2) {
|
|
|
- this.formValidate.area = i
|
|
|
- } else {
|
|
|
- this.formValidate.street = i
|
|
|
- }
|
|
|
+ this.formValidate_0 = res.data
|
|
|
+ this.formValidate_0.addressSelect = this.formValidate_0.addressSelect.map(item => item * 1)
|
|
|
+ console.log(this.formValidate_0.addressSelect);
|
|
|
})
|
|
|
- this.formValidate.address = (selectedData.map(o => o.label)).join('/')
|
|
|
- // console.log('this.formValidate.addressSelect',this.formValidate.addressSelect);
|
|
|
-
|
|
|
},
|
|
|
cityInfo(data) {
|
|
|
cityApi(data).then(res => {
|
|
@@ -523,10 +691,10 @@
|
|
|
|
|
|
},
|
|
|
userSearchss(e) {
|
|
|
- this.formValidate.create_uid = "";
|
|
|
+ this.formValidate_0.create_uid = "";
|
|
|
this.authList = []
|
|
|
this.goods = []
|
|
|
- this.getUserList()
|
|
|
+ this.getUserList(this.formValidate_0.wid)
|
|
|
},
|
|
|
// 处理goods数据
|
|
|
handleGoods(list) {
|
|
@@ -553,41 +721,97 @@
|
|
|
item.unit_name = item.info['unit_name' + (item.unit_type == 0 ? '' : (item.unit_type == 1 ?
|
|
|
"_1" : "_2"))]
|
|
|
return item
|
|
|
+ }).filter(item => {
|
|
|
+ return item.product_num != 0
|
|
|
})
|
|
|
},
|
|
|
handleSubmit(name) {
|
|
|
- if(this.currentTab == 0) {
|
|
|
- if (this.formValidate.id == 0) {
|
|
|
- this.formValidate.goods = this.handleGoods(this.chooseGoods)
|
|
|
+ console.log('开始');
|
|
|
+ if (this.currentTab == 0) {
|
|
|
+ if (this.formValidate_0.id == 0) {
|
|
|
+ this.formValidate_0.goods = this.handleGoods(this.chooseGoods)
|
|
|
+ if(this.formValidate_0.goods.length == 0) {
|
|
|
+ return this.$Message.error('请选择商品并填写采购数量');
|
|
|
+ }
|
|
|
} else {
|
|
|
- this.formValidate.goods = this.chooseGoods
|
|
|
+ this.formValidate_0.goods = this.chooseGoods
|
|
|
+ }
|
|
|
+ } else if(this.currentTab == 1) {
|
|
|
+ console.log('汇总采购商品');
|
|
|
+ this.formValidate_1.goods = this.chooseGoods_1.filter(item => item.want_product_num != 0).map(item=>{
|
|
|
+ item.product_num = item.want_product_num
|
|
|
+ return item
|
|
|
+ })
|
|
|
+ if(this.formValidate_1.goods.length == 0) {
|
|
|
+ return this.$Message.error('请选择商品并填写采购数量');
|
|
|
}
|
|
|
- }else {
|
|
|
-
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
|
|
|
- this.$refs[name].validate((valid) => {
|
|
|
- if (valid) {
|
|
|
- this.formValidate.id = this.$route.query.id;
|
|
|
-
|
|
|
- createPurchase(this.formValidate.id, {
|
|
|
- wid: this.formValidate.wid,
|
|
|
- products: this.formValidate.goods,
|
|
|
- supplier_id: this.formValidate.supplier_id
|
|
|
- }).then(res => {
|
|
|
- this.$Message.success(res.msg);
|
|
|
- this.$router.push({
|
|
|
- path: this.roterPre + "/erp/purchase_list"
|
|
|
- });
|
|
|
- }).catch(err => {
|
|
|
- this.$Message.error(err.msg);
|
|
|
- })
|
|
|
- } else {
|
|
|
- // this.$Message.error("请输入参数模板名称");
|
|
|
- }
|
|
|
- });
|
|
|
+ try{
|
|
|
+ this.$refs[name].validate((valid) => {
|
|
|
+ if (valid) {
|
|
|
+ console.log('校验结束');
|
|
|
+ // this.formValidate.id = this.$route.query.id;
|
|
|
+ let pdata = {}
|
|
|
+ if (this.currentTab == 0) {
|
|
|
+ console.log('自建采购');
|
|
|
+ try {
|
|
|
+ pdata = {
|
|
|
+ id: this.$route.query.id,
|
|
|
+ wid: this.formValidate_0.wid,
|
|
|
+ products: this.formValidate_0.goods,
|
|
|
+ supplier_id: this.formValidate_0.supplier_id,
|
|
|
+ create_uid: this.formValidate_0.create_uid,
|
|
|
+ create_admin_id: this.formValidate_0.create_admin_id
|
|
|
+ }
|
|
|
+ } catch (e) {
|
|
|
+ //TODO handle the exception
|
|
|
+ console.log(e, '错误');
|
|
|
+ }
|
|
|
+ }else if(this.currentTab == 1) {
|
|
|
+ console.log('汇总采购');
|
|
|
+ pdata = {
|
|
|
+ id: this.$route.query.id,
|
|
|
+ wid: this.formValidate_1.wid,
|
|
|
+ goods_ids: this.formValidate_1.goods.map(item => item.product_id).join(','),
|
|
|
+ supplier_id: this.formValidate_1.supplier_id,
|
|
|
+ create_uid: this.formValidate_1.create_uid,
|
|
|
+ create_admin_id: this.formValidate_1.create_admin_id,
|
|
|
+ purchasing_person_uid: this.formValidate_1.purchasing_person_uid,
|
|
|
+ }
|
|
|
+ console.log('pdata',pdata);
|
|
|
+ }else if(this.currentTab == 2) {
|
|
|
+ console.log('要货单审核');
|
|
|
+ if(this.formValidate_2.wid == 0) {
|
|
|
+ return this.$Message.error('请确认要货单');
|
|
|
+ }
|
|
|
+ pdata = {
|
|
|
+ id: this.$route.query.id,
|
|
|
+ supplier_id: this.formValidate_2.supplier_id,
|
|
|
+ create_uid: this.formValidate_2.create_uid,
|
|
|
+ create_admin_id: this.formValidate_2.create_admin_id,
|
|
|
+ purchasing_person_uid: this.formValidate_2.purchasing_person_uid,
|
|
|
+ want_order_id: this.formValidate_2.want_order_id,
|
|
|
+ wid: this.formValidate_2.wid
|
|
|
+ }
|
|
|
+ }
|
|
|
+ createPurchase(pdata.id, pdata).then(res => {
|
|
|
+ this.$Message.success(res.msg);
|
|
|
+ this.$router.push({
|
|
|
+ path: this.roterPre + "/erp/purchase_list"
|
|
|
+ });
|
|
|
+ }).catch(err => {
|
|
|
+ this.$Message.error(err.msg);
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ // this.$Message.error("请输入参数模板名称");
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }catch(e){
|
|
|
+ console.log('err',e);
|
|
|
+ //TODO handle the exception
|
|
|
+ }
|
|
|
+
|
|
|
},
|
|
|
},
|
|
|
};
|
|
@@ -665,4 +889,10 @@
|
|
|
.ml16 {
|
|
|
margin-left: 16px;
|
|
|
}
|
|
|
+ .addClass {
|
|
|
+ color: #1890FF;
|
|
|
+ margin-left 14px;
|
|
|
+ padding 9px 0;
|
|
|
+ cursor pointer;
|
|
|
+ }
|
|
|
</style>
|