|
@@ -11,51 +11,72 @@
|
|
|
<span style="margin: 0 15px;color: #666;font-weight: bold;">类目名称:{{ detailsData&&detailsData.sparePartsNo }}</span>
|
|
|
</template>
|
|
|
</a-page-header>
|
|
|
- <a-card size="small" :bordered="false" class="chooseProductEdit-cont">
|
|
|
- <div class="table-page-search-wrapper" style="display:flex;align-items: center;justify-content: space-between;">
|
|
|
- <div style="flex-grow:1;">
|
|
|
- <a-form layout="inline" id="chooseProductEdit-form-btn" @keyup.enter.native="$refs.table.refresh(true)">
|
|
|
- <a-row :gutter="15">
|
|
|
- <a-col :md="6" :sm="24">
|
|
|
- <a-form-item label="产品编码"><a-input id="chooseProductEdit-productCode" v-model.trim="productForm.productCode" allowClear placeholder="请输入产品编码" /></a-form-item>
|
|
|
- </a-col>
|
|
|
- <a-col :md="6" :sm="24">
|
|
|
- <a-form-item label="产品名称"><a-input id="chooseProductEdit-productName" v-model.trim="productForm.productName" allowClear placeholder="请输入产品名称" /></a-form-item>
|
|
|
- </a-col>
|
|
|
- <a-col :md="6" :sm="24" style="margin-bottom: 10px;">
|
|
|
- <a-button type="primary" id="chooseProductEdit-refresh" @click="$refs.table.refresh(true)">查询</a-button>
|
|
|
- <a-button style="margin-left: 5px" id="chooseProductEdit-reset" @click="resetSearchForm">重置</a-button>
|
|
|
- </a-col>
|
|
|
- </a-row>
|
|
|
- </a-form>
|
|
|
- </div>
|
|
|
+ <a-card size="small" :bordered="false" class="chooseProductEdit-cont table-page-search-wrapper">
|
|
|
+ <!-- 搜索条件 -->
|
|
|
+ <div ref="tableSearch">
|
|
|
+ <a-form layout="inline" @keyup.enter.native="$refs.table.refresh(true)">
|
|
|
+ <a-row :gutter="15">
|
|
|
+ <a-col :md="6" :sm="24">
|
|
|
+ <a-form-item label="产品名称">
|
|
|
+ <a-input id="productPricingList-name" v-model.trim="queryParam.name" allowClear placeholder="请输入产品名称"/>
|
|
|
+ </a-form-item>
|
|
|
+ </a-col>
|
|
|
+ <a-col :md="6" :sm="24">
|
|
|
+ <a-form-item label="产品编码/原厂编码">
|
|
|
+ <a-input id="productPricingList-queryWord" v-model.trim="queryParam.queryWord" allowClear placeholder="请输入产品编码/原厂编码"/>
|
|
|
+ </a-form-item>
|
|
|
+ </a-col>
|
|
|
+ <a-col :md="6" :sm="24">
|
|
|
+ <a-form-item label="品牌">
|
|
|
+ <ProductBrand id="productPricingList-productBrandSn" v-model="queryParam.productBrandSn"></ProductBrand>
|
|
|
+ </a-form-item>
|
|
|
+ </a-col>
|
|
|
+ <a-col :md="6" :sm="24">
|
|
|
+ <a-form-item label="产品分类">
|
|
|
+ <ProductType id="productPricingList-productType" placeholder="请选择产品分类" @change="changeProductType" v-model="productType"></ProductType>
|
|
|
+ </a-form-item>
|
|
|
+ </a-col>
|
|
|
+ <a-col :md="6" :sm="24">
|
|
|
+ <a-form-item label="产品商城状态">
|
|
|
+ <v-select code="ENABLE_FLAG" id="promotionRulesList-enabledFlag" v-model="queryParam.enabledFlag" allowClear placeholder="请选择产品商城状态"></v-select>
|
|
|
+ </a-form-item>
|
|
|
+ </a-col>
|
|
|
+ <a-col :md="6" :sm="24" style="margin-bottom: 10px;">
|
|
|
+ <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="promotionRulesList-refresh">查询</a-button>
|
|
|
+ <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="promotionRulesList-reset">重置</a-button>
|
|
|
+ </a-col>
|
|
|
+ </a-row>
|
|
|
+ </a-form>
|
|
|
</div>
|
|
|
- <div class="showBtn">
|
|
|
- <a-button id="chooseProductEdit-add" v-if="$hasPermissions('B_chooseProductEdit_add')" type="primary" class="button-warning" @click="handleAddEdit">新增产品</a-button>
|
|
|
- <a-button id="chooseProductEdit-ex" v-if="$hasPermissions('B_chooseProductEdit_import')" class="button-warning" @click="handleImport">导入产品</a-button>
|
|
|
- <a-button
|
|
|
- id="chooseProductEdit-queryQty"
|
|
|
- type="primary"
|
|
|
- class="button-warning"
|
|
|
- :loading="loading"
|
|
|
- v-if="$hasPermissions('B_chooseProductEdit_thirdQty')"
|
|
|
- @click="handleThirdQty">第三方库存</a-button>
|
|
|
- <a-alert type="info">
|
|
|
- <div slot="message" class="total-bar">
|
|
|
- <span>采购数量:{{ statisticsObj && (statisticsObj.productTotalQty || statisticsObj.productTotalQty == 0) ? statisticsObj.productTotalQty : '--' }};</span>
|
|
|
- <span v-if="$hasPermissions('M_chooseProductEdit_costPrice')">采购金额:{{ (statisticsObj && (statisticsObj.productTotalCost || statisticsObj.productTotalCost == 0) )? statisticsObj.productTotalCost : '--' }};</span>
|
|
|
- </div>
|
|
|
- </a-alert>
|
|
|
+ <!-- 操作按钮 -->
|
|
|
+ <div class="table-operator">
|
|
|
+ <a-button type="primary" @click="handleAddProduct">选择产品</a-button>
|
|
|
+ <span>
|
|
|
+ <a-button type="primary" class="button-info" @click="handleAdd">批量上架</a-button>
|
|
|
+ <a-button @click="handleAdd">批量下架</a-button>
|
|
|
+ <a-button type="primary" class="button-error" ghost @click="handleAdd">批量删除</a-button>
|
|
|
+ <span>已选1项</span>
|
|
|
+ </span>
|
|
|
</div>
|
|
|
<s-table
|
|
|
- class="sTable"
|
|
|
+ class="sTable fixPagination"
|
|
|
ref="table"
|
|
|
size="small"
|
|
|
+ :style="{ height: tableHeight+65+'px' }"
|
|
|
:rowKey="(record) => record.id"
|
|
|
:columns="columns"
|
|
|
:data="loadData"
|
|
|
+ :pageSize="30"
|
|
|
+ :row-selection="{ columnWidth: 40 }"
|
|
|
+ @rowSelection="rowSelectionFun"
|
|
|
+ :scroll="{ y: tableHeight-170 }"
|
|
|
:defaultLoadData="false"
|
|
|
bordered>
|
|
|
+ <!-- 产品编码 -->
|
|
|
+ <template slot="productCode" slot-scope="text, record">
|
|
|
+ <span style="padding-right: 15px;">{{ record.productCode }}</span>
|
|
|
+ <a-badge count="热" :number-style="{ zoom:'80%' }"></a-badge>
|
|
|
+ </template>
|
|
|
<!-- 操作 -->
|
|
|
<template slot="action" slot-scope="text, record">
|
|
|
<a-button
|
|
@@ -77,35 +98,21 @@
|
|
|
</s-table>
|
|
|
</a-card>
|
|
|
</a-spin>
|
|
|
- <div class="affix-cont">
|
|
|
- <a-button
|
|
|
- size="large"
|
|
|
- style="padding: 0 60px;"
|
|
|
- :disabled="spinning"
|
|
|
- type="primary"
|
|
|
- class="button-primary"
|
|
|
- v-if="$hasPermissions('B_chooseProductEdit_submit')"
|
|
|
- @click="handleSubmit"
|
|
|
- id="chooseProductEdit-submit">提交</a-button>
|
|
|
- </div>
|
|
|
- <!-- 新增弹窗-->
|
|
|
- <add-modal
|
|
|
+ <!-- 编辑弹窗-->
|
|
|
+ <editProductModal
|
|
|
v-drag
|
|
|
:itemSn="itemSn"
|
|
|
- :openModal="openAddModal"
|
|
|
- :nowData="detailsData"
|
|
|
+ :openModal="opeEditModal"
|
|
|
@ok="resetTable"
|
|
|
- @close="openAddModal=false" />
|
|
|
- <!-- 导入弹窗 -->
|
|
|
- <importGuideModal :openModal="openGuideModal" :params="{sparePartsSn: $route.query.sn}" @close="openGuideModal=false" @ok="hanldleImportOk" />
|
|
|
- <!-- 编辑基础信息弹窗 -->
|
|
|
- <basic-info-modal
|
|
|
- v-drag
|
|
|
- :openModal="openBasicInfoModal"
|
|
|
- :itemData="itemObj"
|
|
|
- :itemSn="sparePartsSn"
|
|
|
- @ok="resetSearchForm"
|
|
|
- @close="openBasicInfoModal = false" />
|
|
|
+ @close="opeEditModal=false" />
|
|
|
+ <!-- 添加产品 -->
|
|
|
+ <chooseProduct
|
|
|
+ ref="chooseProduct"
|
|
|
+ :chooseType="chooseTypeList"
|
|
|
+ :itemSn="$route.params.sn"
|
|
|
+ :openModal="showProModal"
|
|
|
+ @ok="addProductSuccess"
|
|
|
+ @close="closeProductModal"></chooseProduct>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
@@ -115,14 +122,16 @@ import { commonMixin } from '@/utils/mixin'
|
|
|
import { STable, VSelect } from '@/components'
|
|
|
// import addModal from './addModal.vue'
|
|
|
// import basicInfoModal from './basicInfoModal.vue'
|
|
|
-// import importGuideModal from './importGuideModal.vue'
|
|
|
+import chooseProduct from './chooseProductsModal.vue'
|
|
|
+import ProductType from '@/views/common/productType.js'
|
|
|
+import ProductBrand from '@/views/common/productBrand.js'
|
|
|
// 接口
|
|
|
-import { purchaseDetailPageList, queryDetailCount, purchaseDetailDel, purchaseSubmit, purchaseImportBatchInsert, purchaseDetailPageCount } from '@/api/purchase'
|
|
|
+import { financeBookDetailQueryPage, queryDetailCount, purchaseDetailDel, purchaseSubmit, purchaseImportBatchInsert, purchaseDetailPageCount } from '@/api/financeBook'
|
|
|
import { getThirdStockQty } from '@/api/salesNew'
|
|
|
export default {
|
|
|
name: 'ChooseProductEdit',
|
|
|
mixins: [commonMixin],
|
|
|
- components: { STable, VSelect },
|
|
|
+ components: { STable, VSelect, ProductType, ProductBrand, chooseProduct },
|
|
|
data () {
|
|
|
return {
|
|
|
spinning: false,
|
|
@@ -134,6 +143,8 @@ export default {
|
|
|
detailsData: null, // 基础信息数据
|
|
|
addMoreLoading: false, // 防止多次添加 加载状态
|
|
|
loading: false, // 第三方库存按钮加载状态
|
|
|
+ opeEditModal: false, // 编辑弹窗
|
|
|
+ showProModal: false, // 选择产品弹窗
|
|
|
// 查询参数
|
|
|
productForm: {
|
|
|
productCode: '', // 产品编码
|
|
@@ -143,12 +154,22 @@ export default {
|
|
|
sparePartsSn: undefined, // 采购入库sn
|
|
|
itemSn: undefined, // 列表行 sn
|
|
|
itemObj: null, // 基础信息弹窗回显数据
|
|
|
+ queryParam: {
|
|
|
+ name: '',
|
|
|
+ queryWord: '', // 产品编码/原厂编码
|
|
|
+ productBrandSn: undefined, // 产品品牌
|
|
|
+ productTypeSn1: '', // 产品一级分类
|
|
|
+ productTypeSn2: '', // 产品二级分类
|
|
|
+ productTypeSn3: '' // 产品三级分类
|
|
|
+ },
|
|
|
+ rowSelectionInfo: null,
|
|
|
+ tableHeight: 0, // 表格高度
|
|
|
// 加载数据方法 必须为 Promise 对象
|
|
|
loadData: parameter => {
|
|
|
this.productForm.sparePartsSn = this.sparePartsSn
|
|
|
const parames = Object.assign(parameter, this.productForm)
|
|
|
// 获取列表数据 有分页
|
|
|
- return purchaseDetailPageList(parames).then(res => {
|
|
|
+ return financeBookDetailQueryPage(parames).then(res => {
|
|
|
let data
|
|
|
if (res.status == 200) {
|
|
|
data = res.data
|
|
@@ -173,27 +194,44 @@ export default {
|
|
|
const _this = this
|
|
|
const arr = [
|
|
|
{ title: '序号', dataIndex: 'no', align: 'center', width: '4%' },
|
|
|
- { title: '产品编码', dataIndex: 'productCode', width: '18%', align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
- { title: '产品名称', dataIndex: 'productName', width: '25%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
|
|
|
- { title: '单位', dataIndex: 'unit', align: 'center', width: '6%', customRender: function (text) { return text || '--' } },
|
|
|
- { title: '采购数量', dataIndex: 'productQty', align: 'center', width: '13%', customRender: function (text) { return text || text == 0 ? text : '--' } },
|
|
|
- { title: '第三方库存', dataIndex: 'thirdStockQty', align: 'center', width: '10%', customRender: function (text) { return text || text == 0 ? text : '--' } },
|
|
|
- // { title: '采购单价', dataIndex: 'productCost', width: '8%', align: 'right', customRender: function (text) { return text || text == 0 ? _this.toThousands(text, 2) : '--' }, },
|
|
|
- // { title: '采购金额', dataIndex: 'subtotal', width: '8%', align: 'right', customRender: function (text) { return text || text == 0 ? _this.toThousands(text, 2) : '--' } },
|
|
|
+ { title: '产品编码', dataIndex: 'productCode', width: '10%', align: 'center', scopedSlots: { customRender: 'productCode' } },
|
|
|
+ { title: '产品名称', dataIndex: 'productName', width: '15%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
|
|
|
+ { title: '原厂编码', dataIndex: 'unit', align: 'center', width: '8%', customRender: function (text) { return text || '--' } },
|
|
|
+ { title: '品牌', dataIndex: 'unit', align: 'center', width: '7%', customRender: function (text) { return text || '--' } },
|
|
|
+ { title: '产品分类', dataIndex: 'unit', align: 'center', width: '7%', customRender: function (text) { return text || '--' } },
|
|
|
+ { title: '售价', dataIndex: 'productCost', width: '7%', align: 'right', customRender: function (text) { return text || text == 0 ? _this.toThousands(text, 2) : '--' } },
|
|
|
+ { title: '售价类型', dataIndex: 'unit', align: 'center', width: '7%', customRender: function (text) { return text || '--' } },
|
|
|
+ { title: '终端价', dataIndex: 'productCost', width: '7%', align: 'right', customRender: function (text) { return text || text == 0 ? _this.toThousands(text, 2) : '--' } },
|
|
|
+ { title: '车主价', dataIndex: 'productCost', width: '7%', align: 'right', customRender: function (text) { return text || text == 0 ? _this.toThousands(text, 2) : '--' } },
|
|
|
+ { title: '优先级', dataIndex: 'unit', align: 'center', width: '7%', customRender: function (text) { return text || '--' } },
|
|
|
+ { title: '添加时间', dataIndex: 'unit', align: 'center', width: '7%', customRender: function (text) { return text || '--' } },
|
|
|
+ { title: '产品商城状态', dataIndex: 'unit', align: 'center', width: '9%', customRender: function (text) { return text || '--' } },
|
|
|
{ title: '操作', scopedSlots: { customRender: 'action' }, width: '10%', align: 'center' }
|
|
|
]
|
|
|
- if (this.$hasPermissions('M_chooseProductEdit_costPrice')) {
|
|
|
- arr.splice(6, 0, { title: '采购单价', dataIndex: 'productCost', width: '8%', align: 'right', customRender: function (text) { return text || text == 0 ? _this.toThousands(text, 2) : '--' } })
|
|
|
- if (this.detailsData && this.detailsData.supplierName) {
|
|
|
- arr.splice(7, 0, { title: '采购金额', dataIndex: 'subtotal', width: '8%', align: 'right', customRender: function (text) { return text || text == 0 ? _this.toThousands(text, 2) : '--' } })
|
|
|
- } else {
|
|
|
- arr.splice(7, 0, { title: '采购金额', dataIndex: 'subtotal', width: '8%', align: 'right', customRender: function (text) { return text || '--' } })
|
|
|
- }
|
|
|
- }
|
|
|
+ // if (this.$hasPermissions('M_chooseProductEdit_costPrice')) {
|
|
|
+ // arr.splice(6, 0, { title: '采购单价', dataIndex: 'productCost', width: '8%', align: 'right', customRender: function (text) { return text || text == 0 ? _this.toThousands(text, 2) : '--' } })
|
|
|
+ // if (this.detailsData && this.detailsData.supplierName) {
|
|
|
+ // arr.splice(7, 0, { title: '采购金额', dataIndex: 'subtotal', width: '8%', align: 'right', customRender: function (text) { return text || text == 0 ? _this.toThousands(text, 2) : '--' } })
|
|
|
+ // } else {
|
|
|
+ // arr.splice(7, 0, { title: '采购金额', dataIndex: 'subtotal', width: '8%', align: 'right', customRender: function (text) { return text || '--' } })
|
|
|
+ // }
|
|
|
+ // }
|
|
|
return arr
|
|
|
+ },
|
|
|
+ // 计算选中数据条数
|
|
|
+ selectCount () {
|
|
|
+ return this.rowSelectionInfo && this.rowSelectionInfo.selectedRowKeys.length
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
+ // 表格选中项
|
|
|
+ rowSelectionFun (obj) {
|
|
|
+ this.rowSelectionInfo = obj || null
|
|
|
+ },
|
|
|
+ // 添加产品
|
|
|
+ handleAddProduct () {
|
|
|
+ this.showProModal = true
|
|
|
+ },
|
|
|
// 新增产品成功 刷新基础信息时间,防止重复提交
|
|
|
handleAddOk () {
|
|
|
this.pageInit()
|
|
@@ -231,12 +269,12 @@ export default {
|
|
|
},
|
|
|
// 新增/编辑产品
|
|
|
handleAddEdit (row) {
|
|
|
- if (this.detailsData && !this.detailsData.supplierName) {
|
|
|
- this.$message.warning('供应商不能为空,请先编辑基础信息!')
|
|
|
- return
|
|
|
- }
|
|
|
- this.itemSn = (row && row.sparePartsDetailSn) ? row.sparePartsDetailSn : null
|
|
|
- this.openAddModal = true
|
|
|
+ // if (this.detailsData && !this.detailsData.supplierName) {
|
|
|
+ // this.$message.warning('供应商不能为空,请先编辑基础信息!')
|
|
|
+ // return
|
|
|
+ // }
|
|
|
+ // this.itemSn = (row && row.sparePartsDetailSn) ? row.sparePartsDetailSn : null
|
|
|
+ this.openEditModal = true
|
|
|
},
|
|
|
// 导入产品
|
|
|
handleImport () {
|
|
@@ -247,7 +285,7 @@ export default {
|
|
|
const _this = this
|
|
|
this.$confirm({
|
|
|
title: '提示',
|
|
|
- content: '确认要删除吗?',
|
|
|
+ content: '确认删除产品吗?',
|
|
|
centered: true,
|
|
|
closable: true,
|
|
|
onOk () {
|
|
@@ -271,7 +309,7 @@ export default {
|
|
|
},
|
|
|
// 刷新列表 更新操作时间
|
|
|
resetTable () {
|
|
|
- this.itemSn = undefined
|
|
|
+ this.opeEditModal = false
|
|
|
this.$refs.table.refresh(true)
|
|
|
},
|
|
|
// 重置
|
|
@@ -296,8 +334,14 @@ export default {
|
|
|
this.sparePartsSn = this.$route.query.sn
|
|
|
this.$nextTick(() => {
|
|
|
this.resetSearchForm()
|
|
|
+ this.setTableH()
|
|
|
})
|
|
|
},
|
|
|
+ // 计算表格高度
|
|
|
+ setTableH () {
|
|
|
+ const headHeight = this.$refs.tableSearch.offsetHeight
|
|
|
+ this.tableHeight = window.innerHeight - headHeight - 280
|
|
|
+ },
|
|
|
// 获取页面统计数据
|
|
|
getStatisticsData (ajaxData) {
|
|
|
purchaseDetailPageCount(ajaxData).then(res => {
|
|
@@ -343,36 +387,14 @@ export default {
|
|
|
.chooseProductEdit-wrap {
|
|
|
position: relative;
|
|
|
height: 100%;
|
|
|
- padding-bottom: 51px;
|
|
|
box-sizing: border-box;
|
|
|
> .ant-spin-nested-loading {
|
|
|
- overflow-y: scroll;
|
|
|
height: 100%;
|
|
|
}
|
|
|
- .showBtn{
|
|
|
- display:flex;
|
|
|
- align-items:center;
|
|
|
- margin-bottom:10px;
|
|
|
- }
|
|
|
.chooseProductEdit-cont {
|
|
|
margin-top: 6px;
|
|
|
- .ant-divider-horizontal {
|
|
|
- margin: 10px 0 24px;
|
|
|
- }
|
|
|
- .total-bar {
|
|
|
- display: flex;
|
|
|
- align-items: center;
|
|
|
- justify-content: space-between;
|
|
|
- > div {
|
|
|
- &:last-child {
|
|
|
- display: flex;
|
|
|
- align-items: center;
|
|
|
- justify-content: space-between;
|
|
|
- > div {
|
|
|
- padding: 0 10px;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+ .table-operator{
|
|
|
+ margin-bottom:6px;
|
|
|
}
|
|
|
}
|
|
|
}
|