|
@@ -57,26 +57,17 @@
|
|
|
<a-row :gutter="15">
|
|
|
<a-col :md="6" :sm="24">
|
|
|
<a-form-item label="关键词">
|
|
|
- <a-input id="purchaseOrderEdit-bundleName" v-model.trim="queryParam.bundleName" allowClear placeholder="产品名称/产品编码/原厂编码/适用车型"/>
|
|
|
+ <a-input id="purchaseOrderEdit-bundleName" v-model.trim="queryParam.queryWord" allowClear placeholder="产品名称/产品编码/原厂编码/适用车型"/>
|
|
|
</a-form-item>
|
|
|
</a-col>
|
|
|
<a-col :md="6" :sm="24">
|
|
|
<a-form-item label="产品品牌">
|
|
|
- <a-select
|
|
|
- placeholder="请选择"
|
|
|
- id="purchaseOrderEdit-state"
|
|
|
- allowClear
|
|
|
- v-model="queryParam.dataSourceNo"
|
|
|
- :showSearch="true"
|
|
|
- option-filter-prop="children"
|
|
|
- :filter-option="filterOption">
|
|
|
- <a-select-option v-for="item in brandData" :key="item.salesChannelNo" :value="item.salesChannelNo">{{ item.salesChannelName }}</a-select-option>
|
|
|
- </a-select>
|
|
|
+ <ProductBrand id="purchaseOrderEdit-productBrand" v-model="queryParam.productBrandSn"></ProductBrand>
|
|
|
</a-form-item>
|
|
|
</a-col>
|
|
|
<a-col :md="6" :sm="24">
|
|
|
<a-form-item label="产品类别">
|
|
|
- <a-cascader :options="typeData" id="purchaseOrderEdit-state" placeholder="请选择产品类别" allowClear v-model="queryParam.brand" />
|
|
|
+ <ProductType id="purchaseOrderEdit-productType" @change="changeProductType" v-model="productType"></ProductType>
|
|
|
</a-form-item>
|
|
|
</a-col>
|
|
|
<template v-if="advanced">
|
|
@@ -105,7 +96,7 @@
|
|
|
:rowKey="(record) => record.id"
|
|
|
:columns="columns"
|
|
|
:data="loadData"
|
|
|
- :scroll="{ x: 1370 }"
|
|
|
+ :scroll="{ x: 1370, y:300 }"
|
|
|
bordered>
|
|
|
<!-- 采购数量 -->
|
|
|
<template slot="storageQuantity" slot-scope="text, record">
|
|
@@ -143,26 +134,33 @@
|
|
|
<!-- 列表 -->
|
|
|
<s-table
|
|
|
class="sTable"
|
|
|
- ref="table"
|
|
|
+ ref="purchaseTable"
|
|
|
size="default"
|
|
|
:rowKey="(record) => record.id"
|
|
|
:columns="chooseColumns"
|
|
|
:data="chooseLoadData"
|
|
|
- :scroll="{ x: 970 }"
|
|
|
+ :scroll="{ x: 970, y: 300 }"
|
|
|
bordered>
|
|
|
<!-- 采购数量 -->
|
|
|
<template slot="storageQuantity" slot-scope="text, record">
|
|
|
<a-input-number
|
|
|
- id="purchaseOrderEdit-storageQuantity"
|
|
|
- :value="record.storageQuantity"
|
|
|
+ id="purchaseOrderEdit-qty"
|
|
|
+ v-model="record.qty"
|
|
|
:precision="0"
|
|
|
- :min="0"
|
|
|
+ :min="1"
|
|
|
:max="999999"
|
|
|
+ @blur="e => qtyBlur(e.target.value, record)"
|
|
|
placeholder="请输入" />
|
|
|
</template>
|
|
|
<!-- 操作 -->
|
|
|
<template slot="action" slot-scope="text, record">
|
|
|
- <a-button size="small" type="link" @click="handleDel(record)" id="purchaseOrderEdit-del-btn">删除</a-button>
|
|
|
+ <a-button
|
|
|
+ size="small"
|
|
|
+ type="primary"
|
|
|
+ class="button-error"
|
|
|
+ :loading="delLoading"
|
|
|
+ @click="handleDel(record)"
|
|
|
+ id="purchaseOrderEdit-del-btn">删除</a-button>
|
|
|
</template>
|
|
|
</s-table>
|
|
|
</div>
|
|
@@ -188,15 +186,25 @@
|
|
|
<script>
|
|
|
import { STable, VSelect } from '@/components'
|
|
|
import basicInfoModal from './basicInfoModal.vue'
|
|
|
-import { purchaseDetail } from '@/api/purchase'
|
|
|
+import ProductType from '../../common/productType.js'
|
|
|
+import ProductBrand from '../../common/productBrand.js'
|
|
|
+import { purchaseDetail, purchaseWriteSubmit } from '@/api/purchase'
|
|
|
+import { purchaseDetailList, purchaseDetailSave, purchaseDetailDel } from '@/api/purchaseDetail'
|
|
|
export default {
|
|
|
- components: { STable, VSelect, basicInfoModal },
|
|
|
+ components: { STable, VSelect, basicInfoModal, ProductType, ProductBrand },
|
|
|
data () {
|
|
|
return {
|
|
|
openModal: false, // 选择基本信息弹框是否显示
|
|
|
detail: null, // 详细信息
|
|
|
// 选择产品
|
|
|
+ productType: [],
|
|
|
queryParam: {
|
|
|
+ productBrandSn: undefined,
|
|
|
+ queryWord: '',
|
|
|
+ brand: '',
|
|
|
+ productTypeSn1: '', // 产品一级分类
|
|
|
+ productTypeSn2: '', // 产品二级分类
|
|
|
+ productTypeSn3: '' // 产品三级分类
|
|
|
},
|
|
|
brandData: [], // 产品品牌 下拉数据
|
|
|
typeData: [], // 产品类别 下拉数据
|
|
@@ -219,80 +227,46 @@ export default {
|
|
|
// 加载数据方法 必须为 Promise 对象
|
|
|
loadData: parameter => {
|
|
|
this.disabled = true
|
|
|
- // return customerBundleDelayList( Object.assign(parameter, this.queryParam) ).then(res => {
|
|
|
- // const data = res.data
|
|
|
- // const no = (data.pageNo - 1) * data.pageSize
|
|
|
- // for (var i = 0; i < data.list.length; i++) {
|
|
|
- // data.list[i].no = no + i + 1
|
|
|
- // }
|
|
|
- // this.disabled = false
|
|
|
- // return data
|
|
|
- // })
|
|
|
- const _this = this
|
|
|
- return new Promise(function (resolve, reject) {
|
|
|
- const data = {
|
|
|
- pageNo: 1,
|
|
|
- pageSize: 10,
|
|
|
- list: [
|
|
|
- { id: '1', purchaseNo: 'jgqp11111111111', creatDate: '产品1', custName: 'jgqp111123545', totalP: '箭冠品牌', totalNums: '产品分类1', totalPrice: '5', payType: '122' }
|
|
|
- ],
|
|
|
- count: 10
|
|
|
- }
|
|
|
+ return customerBundleDelayList(Object.assign(parameter, this.queryParam)).then(res => {
|
|
|
+ const data = res.data
|
|
|
const no = (data.pageNo - 1) * data.pageSize
|
|
|
for (var i = 0; i < data.list.length; i++) {
|
|
|
data.list[i].no = no + i + 1
|
|
|
}
|
|
|
- _this.disabled = false
|
|
|
- resolve(data)
|
|
|
+ this.disabled = false
|
|
|
+ return data
|
|
|
})
|
|
|
},
|
|
|
- // 已选产品
|
|
|
+ // -------已选产品-------------
|
|
|
+ delLoading: false,
|
|
|
// 表头
|
|
|
chooseColumns: [
|
|
|
{ title: '序号', dataIndex: 'no', width: 80, align: 'center' },
|
|
|
- { title: '产品编码', dataIndex: 'creatDaite', width: 140, align: 'center', sorter: true },
|
|
|
- { title: '产品名称', dataIndex: 'custNayme', align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
- { title: '采购单价', dataIndex: 'mementPay', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
|
|
|
+ { title: '产品编码', dataIndex: 'productCode', width: 140, align: 'center', sorter: true },
|
|
|
+ { title: '产品名称', dataIndex: 'productName', align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
+ { title: '采购单价', dataIndex: 'price', width: 100, align: 'center', customRender: function (text) { return '¥' + (text || 0) } },
|
|
|
{ title: '采购数量', scopedSlots: { customRender: 'storageQuantity' }, width: 150, align: 'center' },
|
|
|
- { title: '单位', dataIndex: 'custsNakme', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
- { title: '采购金额', dataIndex: 'custssNakme', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? '¥' + text : '--') } },
|
|
|
+ { title: '单位', dataIndex: 'unit', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
+ { title: '采购金额', dataIndex: 'totalAmount', width: 100, align: 'center', customRender: function (text) { return '¥' + (text || 0) } },
|
|
|
{ title: '操作', scopedSlots: { customRender: 'action' }, width: 100, align: 'center', fixed: 'right' }
|
|
|
],
|
|
|
// 加载数据方法 必须为 Promise 对象
|
|
|
chooseLoadData: parameter => {
|
|
|
this.disabled = true
|
|
|
- // return customerBundleDelayList( Object.assign(parameter, this.queryParam) ).then(res => {
|
|
|
- // const data = res.data
|
|
|
- // const no = (data.pageNo - 1) * data.pageSize
|
|
|
- // for (var i = 0; i < data.list.length; i++) {
|
|
|
- // data.list[i].no = no + i + 1
|
|
|
- // }
|
|
|
- // this.disabled = false
|
|
|
- // return data
|
|
|
- // })
|
|
|
- const _this = this
|
|
|
- return new Promise(function (resolve, reject) {
|
|
|
- const data = {
|
|
|
- pageNo: 1,
|
|
|
- pageSize: 10,
|
|
|
- list: [
|
|
|
- { id: '1', purchaseNo: 'jgqp11111111111', custssName: 0, creatDate: '产品1', custName: 'jgqp111123545', totalP: '箭冠品牌', totalNums: '产品分类1', totalPrice: '5', payType: '122' }
|
|
|
- ],
|
|
|
- count: 10
|
|
|
- }
|
|
|
+ return purchaseDetailList(Object.assign(parameter, this.queryParam)).then(res => {
|
|
|
+ const data = res.data
|
|
|
const no = (data.pageNo - 1) * data.pageSize
|
|
|
for (var i = 0; i < data.list.length; i++) {
|
|
|
data.list[i].no = no + i + 1
|
|
|
}
|
|
|
- _this.disabled = false
|
|
|
- resolve(data)
|
|
|
+ this.disabled = false
|
|
|
+ return data
|
|
|
})
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
- // 获取采购单详情
|
|
|
+ // 获取采购单基本信息
|
|
|
getOrderDetail () {
|
|
|
purchaseDetail({ id: this.$route.params.id }).then(res => {
|
|
|
if (res.status == 200) {
|
|
@@ -305,41 +279,95 @@ export default {
|
|
|
handleOk (data) {
|
|
|
this.getOrderDetail()
|
|
|
},
|
|
|
- // 重置
|
|
|
- resetSearchForm () {
|
|
|
- this.queryParam.orderBundleNo = ''
|
|
|
- this.queryParam.orderBundle.custMobile = ''
|
|
|
- this.queryParam.bundleName = ''
|
|
|
- this.queryParam.itemName = ''
|
|
|
- this.oldTime = undefined
|
|
|
- this.newTime = undefined
|
|
|
- this.$refs.table.refresh(true)
|
|
|
- },
|
|
|
- // 添加
|
|
|
- handleAdd (row) {},
|
|
|
- // 删除
|
|
|
- handleDel (row) {},
|
|
|
// 编辑基本信息
|
|
|
handleEditInfo () {
|
|
|
this.openModal = true
|
|
|
this.$refs.baseInfo.setData(this.detail)
|
|
|
},
|
|
|
- // 提交
|
|
|
- handleSubmit () {
|
|
|
-
|
|
|
+ // ---已选产品-----
|
|
|
+ // 删除产品
|
|
|
+ handleDel (row) {
|
|
|
+ const _this = this
|
|
|
+ this.$confirm({
|
|
|
+ title: '提示',
|
|
|
+ content: '确认要删除吗?',
|
|
|
+ centered: true,
|
|
|
+ closable: true,
|
|
|
+ onOk () {
|
|
|
+ _this.delLoading = true
|
|
|
+ purchaseDetailDel({ id: row.id }).then(res => {
|
|
|
+ if (res.status == 200) {
|
|
|
+ _this.resetPurchaseDetail(true)
|
|
|
+ }
|
|
|
+ _this.$message.info(res.message)
|
|
|
+ _this.delLoading = false
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
},
|
|
|
- // 返回列表
|
|
|
- handleBack () {
|
|
|
- this.$router.push({ path: '/purchasingManagement/purchaseOrder/list' })
|
|
|
+ // 重新查询已选产品
|
|
|
+ resetPurchaseDetail (flag) {
|
|
|
+ this.$refs.purchaseTable.refresh(!!flag)
|
|
|
+ },
|
|
|
+ // 修改数量后
|
|
|
+ qtyBlur (v) {
|
|
|
+ // 光标移出,值发生改变再调用编辑接口
|
|
|
+ if (val != record.qty) {
|
|
|
+ purchaseDetailSave(record).then(res => {
|
|
|
+ if (res.status == 200) {
|
|
|
+ this.resetPurchaseDetail(true)
|
|
|
+ }
|
|
|
+ this.$message.info(res.message)
|
|
|
+ })
|
|
|
+ }
|
|
|
},
|
|
|
// 导入明细
|
|
|
handleImport () {
|
|
|
console.log(333)
|
|
|
},
|
|
|
+ // ---------产品库--------
|
|
|
filterOption (input, option) {
|
|
|
return (
|
|
|
option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
|
|
|
)
|
|
|
+ },
|
|
|
+ // 产品分类 change
|
|
|
+ changeProductType (val, opt) {
|
|
|
+ this.queryParam.productTypeSn1 = val[0] ? val[0] : ''
|
|
|
+ this.queryParam.productTypeSn2 = val[1] ? val[1] : ''
|
|
|
+ this.queryParam.productTypeSn3 = val[2] ? val[2] : ''
|
|
|
+ },
|
|
|
+ // 重置产品库
|
|
|
+ resetSearchForm () {
|
|
|
+ this.queryParam = {
|
|
|
+ productBrandSn: undefined,
|
|
|
+ productTypeSn1: '', // 产品一级分类
|
|
|
+ productTypeSn2: '', // 产品二级分类
|
|
|
+ productTypeSn3: '', // 产品三级分类
|
|
|
+ queryWord: '',
|
|
|
+ brand: ''
|
|
|
+ }
|
|
|
+ this.productType = []
|
|
|
+ this.$refs.table.refresh(true)
|
|
|
+ },
|
|
|
+ // 添加
|
|
|
+ handleAdd (row) {},
|
|
|
+ // ------------产品库 end --------
|
|
|
+ // 提交
|
|
|
+ handleSubmit () {
|
|
|
+ const _this = this
|
|
|
+ purchaseWriteSubmit({ id: this.$route.params.id }).then(res => {
|
|
|
+ if (res.status == 200) {
|
|
|
+ this.$message.success(res.message)
|
|
|
+ setTimeout(() => {
|
|
|
+ _this.handleBack()
|
|
|
+ }, 1000)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 返回列表
|
|
|
+ handleBack () {
|
|
|
+ this.$router.push({ naem: 'purchaseOrderList' })
|
|
|
}
|
|
|
},
|
|
|
beforeRouteEnter (to, from, next) {
|