|
@@ -10,94 +10,92 @@
|
|
:width="900">
|
|
:width="900">
|
|
<a-spin :spinning="spinning" tip="Loading...">
|
|
<a-spin :spinning="spinning" tip="Loading...">
|
|
<div class="products-con">
|
|
<div class="products-con">
|
|
- <div>
|
|
|
|
- <!-- 搜索条件 -->
|
|
|
|
- <div class="table-page-search-wrapper">
|
|
|
|
- <a-form-model
|
|
|
|
- ref="ruleForm"
|
|
|
|
- class="form-model-con"
|
|
|
|
- layout="inline"
|
|
|
|
- :model="queryParam"
|
|
|
|
- @keyup.enter.native="handleSearch"
|
|
|
|
- :label-col="formItemLayout.labelCol"
|
|
|
|
- :wrapper-col="formItemLayout.wrapperCol">
|
|
|
|
- <a-row :gutter="15">
|
|
|
|
- <a-col :md="6" :sm="24">
|
|
|
|
- <a-form-model-item label="产品编码">
|
|
|
|
- <a-input id="chooseProducts-code" v-model.trim="queryParam.code" allowClear placeholder="请输入产品编码"/>
|
|
|
|
- </a-form-model-item>
|
|
|
|
- </a-col>
|
|
|
|
- <a-col :md="6" :sm="24">
|
|
|
|
- <a-form-model-item label="产品名称">
|
|
|
|
- <a-input id="chooseProducts-name" v-model.trim="queryParam.name" allowClear placeholder="请输入产品名称"/>
|
|
|
|
- </a-form-model-item>
|
|
|
|
- </a-col>
|
|
|
|
- <a-col :md="6" :sm="24">
|
|
|
|
- <a-form-model-item label="产品分类">
|
|
|
|
- <productTypeAll placeholder="请选择产品分类" @change="changeProductType" v-model="queryParam.productType" id="chooseProducts-productType"></productTypeAll>
|
|
|
|
- </a-form-model-item>
|
|
|
|
- </a-col>
|
|
|
|
- <a-col :md="6" :sm="24">
|
|
|
|
- <a-form-model-item label="产品品牌">
|
|
|
|
- <ProductBrand id="chooseProducts-productBrandSn" v-model="queryParam.productBrandSn"></ProductBrand>
|
|
|
|
- </a-form-model-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="chooseProducts-refresh">查询</a-button>
|
|
|
|
- <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="chooseProducts-reset">重置</a-button>
|
|
|
|
- </a-col>
|
|
|
|
- </a-row>
|
|
|
|
- </a-form-model>
|
|
|
|
- </div>
|
|
|
|
- <div style="margin-bottom: 10px">
|
|
|
|
- <a-button type="primary" ghost :loading="loading" @click="handleSave">批量添加</a-button>
|
|
|
|
- <span style="margin-left: 5px">
|
|
|
|
- <template v-if="selectCount"> {{ `已选 ${selectCount} 项` }} </template>
|
|
|
|
- </span>
|
|
|
|
- </div>
|
|
|
|
- <!-- 列表 -->
|
|
|
|
- <s-table
|
|
|
|
- class="sTable"
|
|
|
|
- ref="table"
|
|
|
|
- size="small"
|
|
|
|
- :rowKey="(record) => record.productSn"
|
|
|
|
- rowKeyName="productSn"
|
|
|
|
- :row-selection="{ columnWidth: 40, getCheckboxProps:record =>({props: { disabled: this.chooseDataList && this.chooseDataList.indexOf(record.productSn) > -1 }}) }"
|
|
|
|
- @rowSelection="rowSelectionFun"
|
|
|
|
- :columns="columns"
|
|
|
|
- :data="loadData"
|
|
|
|
- :defaultLoadData="false"
|
|
|
|
- style="max-height:580px;"
|
|
|
|
- :scroll="{ y: 520 }"
|
|
|
|
- bordered>
|
|
|
|
- <!-- 产品分类 -->
|
|
|
|
- <template slot="productType" slot-scope="text, record">
|
|
|
|
- <span v-if="record.productTypeName2 || record.productTypeName3">{{ record.productTypeName2 }} {{ record.productTypeName3 ? '>' : '' }} {{ record.productTypeName3 }}</span>
|
|
|
|
- <span v-else>--</span>
|
|
|
|
- </template>
|
|
|
|
- <!-- 包装数 -->
|
|
|
|
- <template slot="productQty" slot-scope="text, record">
|
|
|
|
- <span v-if="record.packQty">
|
|
|
|
- {{ record.packQty }}{{ record.unit }}{{ '/'+record.packQtyUnit }}
|
|
|
|
- </span>
|
|
|
|
- <span v-else>--</span>
|
|
|
|
- </template>
|
|
|
|
- </s-table>
|
|
|
|
|
|
+ <!-- 搜索条件 -->
|
|
|
|
+ <div class="table-page-search-wrapper">
|
|
|
|
+ <a-form-model
|
|
|
|
+ ref="ruleForm"
|
|
|
|
+ class="form-model-con"
|
|
|
|
+ layout="inline"
|
|
|
|
+ :model="queryParam"
|
|
|
|
+ :label-col="formItemLayout.labelCol"
|
|
|
|
+ :wrapper-col="formItemLayout.wrapperCol">
|
|
|
|
+ <a-row :gutter="15">
|
|
|
|
+ <a-col :md="6" :sm="24">
|
|
|
|
+ <a-form-model-item label="产品编码">
|
|
|
|
+ <a-input id="chooseProducts-code" v-model.trim="queryParam.code" allowClear placeholder="请输入产品编码"/>
|
|
|
|
+ </a-form-model-item>
|
|
|
|
+ </a-col>
|
|
|
|
+ <a-col :md="6" :sm="24">
|
|
|
|
+ <a-form-model-item label="产品名称">
|
|
|
|
+ <a-input id="chooseProducts-name" v-model.trim="queryParam.name" allowClear placeholder="请输入产品名称"/>
|
|
|
|
+ </a-form-model-item>
|
|
|
|
+ </a-col>
|
|
|
|
+ <a-col :md="6" :sm="24">
|
|
|
|
+ <a-form-model-item label="产品分类">
|
|
|
|
+ <productTypeAll placeholder="请选择产品分类" @change="changeProductType" v-model="queryParam.productType" id="chooseProducts-productType"></productTypeAll>
|
|
|
|
+ </a-form-model-item>
|
|
|
|
+ </a-col>
|
|
|
|
+ <a-col :md="6" :sm="24">
|
|
|
|
+ <a-form-model-item label="产品品牌">
|
|
|
|
+ <ProductBrand id="chooseProducts-productBrandSn" v-model="queryParam.productBrandSn"></ProductBrand>
|
|
|
|
+ </a-form-model-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="chooseProducts-refresh">查询</a-button>
|
|
|
|
+ <a-button style="margin-left: 5px" @click="resetData" :disabled="disabled" id="chooseProducts-reset">重置</a-button>
|
|
|
|
+ </a-col>
|
|
|
|
+ </a-row>
|
|
|
|
+ </a-form-model>
|
|
|
|
+ </div>
|
|
|
|
+ <div style="margin-bottom: 10px">
|
|
|
|
+ <a-button type="primary" ghost :loading="loading" @click="handleSave">批量添加</a-button>
|
|
|
|
+ <span style="margin-left: 5px">
|
|
|
|
+ <template v-if="selectCount"> {{ `已选 ${selectCount} 项` }} </template>
|
|
|
|
+ </span>
|
|
</div>
|
|
</div>
|
|
|
|
+ <!-- 列表 -->
|
|
|
|
+ <s-table
|
|
|
|
+ class="sTable"
|
|
|
|
+ ref="table"
|
|
|
|
+ size="small"
|
|
|
|
+ :rowKey="(record) => record.productSn"
|
|
|
|
+ rowKeyName="productSn"
|
|
|
|
+ :row-selection="{ columnWidth: 40, getCheckboxProps:record =>({props: { disabled: this.chooseDataList && this.chooseDataList.indexOf(record.productSn) > -1 } })}"
|
|
|
|
+ @rowSelection="rowSelectionFun"
|
|
|
|
+ :columns="columns"
|
|
|
|
+ :data="loadData"
|
|
|
|
+ :defaultLoadData="false"
|
|
|
|
+ style="max-height:460px;"
|
|
|
|
+ :scroll="{ y: 400 }"
|
|
|
|
+ bordered>
|
|
|
|
+ <!-- 产品分类 -->
|
|
|
|
+ <template slot="productType" slot-scope="text, record">
|
|
|
|
+ <span v-if="record.productTypeName2 || record.productTypeName3">{{ record.productTypeName2 }} {{ record.productTypeName3 ? '>' : '' }} {{ record.productTypeName3 }}</span>
|
|
|
|
+ <span v-else>--</span>
|
|
|
|
+ </template>
|
|
|
|
+ <!-- 包装数 -->
|
|
|
|
+ <template slot="productQty" slot-scope="text, record">
|
|
|
|
+ <span v-if="record.packQty">
|
|
|
|
+ {{ record.packQty }}{{ record.unit }}{{ record.packQtyUnit?'/'+record.packQtyUnit:'' }}
|
|
|
|
+ </span>
|
|
|
|
+ <span v-else>--</span>
|
|
|
|
+ </template>
|
|
|
|
+ </s-table>
|
|
</div>
|
|
</div>
|
|
</a-spin>
|
|
</a-spin>
|
|
</a-modal>
|
|
</a-modal>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script>
|
|
<script>
|
|
|
|
+import { commonMixin } from '@/utils/mixin'
|
|
import { STable } from '@/components'
|
|
import { STable } from '@/components'
|
|
-import tablePagination from '@/views/common/tablePagination.vue'
|
|
|
|
|
|
+import { productList } from '@/api/product'
|
|
import ProductBrand from '@/views/common/productBrand.js'
|
|
import ProductBrand from '@/views/common/productBrand.js'
|
|
import productTypeAll from '@/views/common/productTypeAll.js'
|
|
import productTypeAll from '@/views/common/productTypeAll.js'
|
|
-import { productList } from '@/api/product'
|
|
|
|
export default {
|
|
export default {
|
|
name: 'ChooseProductsModal',
|
|
name: 'ChooseProductsModal',
|
|
- components: { STable, tablePagination, ProductBrand, productTypeAll },
|
|
|
|
|
|
+ components: { STable, ProductBrand, productTypeAll },
|
|
|
|
+ mixins: [commonMixin],
|
|
props: {
|
|
props: {
|
|
openModal: { // 弹框显示状态
|
|
openModal: { // 弹框显示状态
|
|
type: Boolean,
|
|
type: Boolean,
|
|
@@ -111,6 +109,7 @@ export default {
|
|
}
|
|
}
|
|
},
|
|
},
|
|
data () {
|
|
data () {
|
|
|
|
+ const _this = this
|
|
return {
|
|
return {
|
|
spinning: false,
|
|
spinning: false,
|
|
isShow: this.openModal, // 是否打开弹框
|
|
isShow: this.openModal, // 是否打开弹框
|
|
@@ -135,6 +134,9 @@ export default {
|
|
{ title: '产品编码', dataIndex: 'code', align: 'center' },
|
|
{ title: '产品编码', dataIndex: 'code', align: 'center' },
|
|
{ title: '产品名称', dataIndex: 'name', align: 'center', ellipsis: true, customRender: function (text) { return text || '--' } },
|
|
{ title: '产品名称', dataIndex: 'name', align: 'center', ellipsis: true, customRender: function (text) { return text || '--' } },
|
|
{ title: '原厂编码', dataIndex: 'origCode', align: 'center', ellipsis: true, customRender: function (text) { return text || '--' } },
|
|
{ title: '原厂编码', dataIndex: 'origCode', align: 'center', ellipsis: true, customRender: function (text) { return text || '--' } },
|
|
|
|
+ { title: '省级价', dataIndex: 'provincePrice', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
|
|
|
|
+ { title: '市级价', dataIndex: 'cityPrice', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
|
|
|
|
+ { title: '特约价', dataIndex: 'specialPrice', width: '6%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
|
|
{ title: '品牌', dataIndex: 'productBrandName', align: 'center', ellipsis: true, customRender: function (text) { return text || '--' } },
|
|
{ title: '品牌', dataIndex: 'productBrandName', align: 'center', ellipsis: true, customRender: function (text) { return text || '--' } },
|
|
{ title: '产品分类', scopedSlots: { customRender: 'productType' }, width: '10%', align: 'center' },
|
|
{ title: '产品分类', scopedSlots: { customRender: 'productType' }, width: '10%', align: 'center' },
|
|
{ title: '包装数', scopedSlots: { customRender: 'productQty' }, align: 'center' },
|
|
{ title: '包装数', scopedSlots: { customRender: 'productQty' }, align: 'center' },
|
|
@@ -181,22 +183,23 @@ export default {
|
|
this.queryParam.productTypeSn2 = ''
|
|
this.queryParam.productTypeSn2 = ''
|
|
this.queryParam.productTypeSn3 = ''
|
|
this.queryParam.productTypeSn3 = ''
|
|
this.queryParam.productType = []
|
|
this.queryParam.productType = []
|
|
- },
|
|
|
|
- // 重置
|
|
|
|
- resetSearchForm () {
|
|
|
|
- this.resetData()
|
|
|
|
this.$nextTick(() => {
|
|
this.$nextTick(() => {
|
|
this.$refs.table.refresh()
|
|
this.$refs.table.refresh()
|
|
- this.$refs.table.clearTable()
|
|
|
|
})
|
|
})
|
|
},
|
|
},
|
|
|
|
+ // 清空选项
|
|
|
|
+ resetSearchForm () {
|
|
|
|
+ this.rowSelectionInfo = null
|
|
|
|
+ this.$refs.table.clearSelected()
|
|
|
|
+ },
|
|
// 保存
|
|
// 保存
|
|
handleSave () {
|
|
handleSave () {
|
|
if (!this.rowSelectionInfo || (this.rowSelectionInfo && this.rowSelectionInfo.selectedRowKeys.length < 1)) {
|
|
if (!this.rowSelectionInfo || (this.rowSelectionInfo && this.rowSelectionInfo.selectedRowKeys.length < 1)) {
|
|
this.$message.warning('请在列表勾选后再进行操作!')
|
|
this.$message.warning('请在列表勾选后再进行操作!')
|
|
return
|
|
return
|
|
}
|
|
}
|
|
- this.$emit('ok', this.rowSelectionInfo && this.rowSelectionInfo.selectedRows)
|
|
|
|
|
|
+ const resultList = JSON.parse(JSON.stringify(this.rowSelectionInfo && this.rowSelectionInfo.selectedRows))
|
|
|
|
+ this.$emit('ok', resultList)
|
|
this.isShow = false
|
|
this.isShow = false
|
|
},
|
|
},
|
|
// 产品分类 change
|
|
// 产品分类 change
|
|
@@ -205,6 +208,7 @@ export default {
|
|
this.queryParam.productTypeSn2 = val[1] ? val[1] : ''
|
|
this.queryParam.productTypeSn2 = val[1] ? val[1] : ''
|
|
this.queryParam.productTypeSn3 = val[2] ? val[2] : ''
|
|
this.queryParam.productTypeSn3 = val[2] ? val[2] : ''
|
|
},
|
|
},
|
|
|
|
+ // 禁用
|
|
handleDisabled (list) {
|
|
handleDisabled (list) {
|
|
this.chooseDataList = list
|
|
this.chooseDataList = list
|
|
}
|
|
}
|
|
@@ -217,19 +221,22 @@ export default {
|
|
// 重定义的弹框状态
|
|
// 重定义的弹框状态
|
|
isShow (newValue, oldValue) {
|
|
isShow (newValue, oldValue) {
|
|
if (!newValue) {
|
|
if (!newValue) {
|
|
|
|
+ this.resetSearchForm()
|
|
this.$emit('close')
|
|
this.$emit('close')
|
|
} else {
|
|
} else {
|
|
const _this = this
|
|
const _this = this
|
|
- _this.resetSearchForm()
|
|
|
|
- let selectedRows = []
|
|
|
|
- const selectedRowKeys = []
|
|
|
|
- selectedRows = _this.chooseData
|
|
|
|
- _this.chooseData.map(item => {
|
|
|
|
- selectedRowKeys.push(item.goodsSn)
|
|
|
|
- })
|
|
|
|
- this.$nextTick(() => { // 页面渲染完成后的回调
|
|
|
|
- _this.$refs.table.setTableSelected(selectedRowKeys, selectedRows) // 设置表格选中项
|
|
|
|
- })
|
|
|
|
|
|
+ _this.resetData()
|
|
|
|
+ if (_this.chooseData && _this.chooseData.length > 0) {
|
|
|
|
+ let selectedRows = []
|
|
|
|
+ const selectedRowKeys = []
|
|
|
|
+ _this.chooseData.forEach(item => {
|
|
|
|
+ selectedRowKeys.push(item.goodsSn)
|
|
|
|
+ })
|
|
|
|
+ selectedRows = _this.chooseData
|
|
|
|
+ this.$nextTick(() => { // 页面渲染完成后的回调
|
|
|
|
+ _this.$refs.table.setTableSelected(selectedRowKeys, selectedRows) // 设置表格选中项
|
|
|
|
+ })
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|