|
@@ -3,48 +3,48 @@
|
|
|
<!-- 搜索条件 -->
|
|
|
<div ref="tableSearch" class="table-page-search-wrapper">
|
|
|
<a-form layout="inline" @keyup.enter.native="searchForm">
|
|
|
- <a-row :gutter="15">
|
|
|
- <a-col :md="8" :sm="24">
|
|
|
+ <a-row type="flex" :gutter="12" justify="start">
|
|
|
+ <a-col flex="auto">
|
|
|
<a-form-item label="产品编码">
|
|
|
<a-input id="shoppingCar-code" v-model.trim="queryParam.code" allowClear placeholder="请输入产品编码"/>
|
|
|
</a-form-item>
|
|
|
</a-col>
|
|
|
- <a-col :md="8" :sm="24">
|
|
|
+ <a-col flex="auto">
|
|
|
<a-form-item label="产品名称">
|
|
|
<a-input id="shoppingCar-name" v-model.trim="queryParam.name" allowClear placeholder="请输入产品名称"/>
|
|
|
</a-form-item>
|
|
|
</a-col>
|
|
|
- <a-col :md="8" :sm="24">
|
|
|
+ <a-col flex="250px">
|
|
|
<a-form-item label="产品分类">
|
|
|
<ProductType id="shoppingCar-productType" placeholder="请选择产品分类" :isDealer="true" @change="changeProductType" v-model="productType"></ProductType>
|
|
|
</a-form-item>
|
|
|
</a-col>
|
|
|
- <a-col :md="8" :sm="24">
|
|
|
+ <a-col flex="250px">
|
|
|
<a-form-item label="产品品牌">
|
|
|
<ProductBrand id="shoppingCar-productBrandSn" placeholder="请选择产品品牌" v-model="queryParam.productBrandSn"></ProductBrand>
|
|
|
</a-select>
|
|
|
</a-form-item>
|
|
|
</a-col>
|
|
|
- <a-col :md="6" :sm="24" style="margin-bottom: 10px;">
|
|
|
+ <a-col flex="auto">
|
|
|
<a-button type="primary" @click="searchForm" :disabled="disabled" id="shoppingCar-refresh">查询</a-button>
|
|
|
<a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="shoppingCar-reset">重置</a-button>
|
|
|
</a-col>
|
|
|
</a-row>
|
|
|
</a-form>
|
|
|
- </div>
|
|
|
- <!-- 操作按钮 -->
|
|
|
- <div class="table-operator" v-if="$hasPermissions('B_JgProduct_enable')">
|
|
|
- <a-row :gutter="16">
|
|
|
- <a-col class="gutter-row" :span="12">
|
|
|
- <a-button type="primary" ghost v-if="type=='globalBtn'" @click="deleteMore">
|
|
|
- 批量删除
|
|
|
- </a-button>
|
|
|
- <a-button type="primary" ghost v-else>
|
|
|
- 批量添加
|
|
|
- </a-button>
|
|
|
- <span v-if="rowSelectionInfo&&rowSelectionInfo.selectedRowKeys">已选 {{ rowSelectionInfo.selectedRowKeys.length }} 项</span>
|
|
|
- </a-col>
|
|
|
- </a-row>
|
|
|
+ <!-- 操作按钮 -->
|
|
|
+ <div class="table-operator">
|
|
|
+ <a-row :gutter="16">
|
|
|
+ <a-col class="gutter-row" :span="24">
|
|
|
+ <a-button type="primary" ghost v-if="modes=='pages'" @click="deleteMore">
|
|
|
+ 批量删除
|
|
|
+ </a-button>
|
|
|
+ <a-button type="primary" ghost v-if="modes=='modals'" @click="addMore">
|
|
|
+ 批量添加
|
|
|
+ </a-button>
|
|
|
+ <span v-if="rowSelectionInfo&&rowSelectionInfo.selectedRowKeys">已选 {{ rowSelectionInfo.selectedRowKeys.length }} 项</span>
|
|
|
+ </a-col>
|
|
|
+ </a-row>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
<!-- 列表 -->
|
|
|
<s-table
|
|
@@ -52,7 +52,7 @@
|
|
|
ref="table"
|
|
|
:style="{ height: tableHeight+84.5+'px' }"
|
|
|
size="small"
|
|
|
- :row-selection="$hasPermissions('B_JgProduct_enable')?rowSelection:null"
|
|
|
+ :row-selection="{ columnWidth: 40 }"
|
|
|
@rowSelection="rowSelectionFun"
|
|
|
rowKeyName="productSn"
|
|
|
:rowKey="(record) => record.productSn"
|
|
@@ -79,6 +79,12 @@ export default {
|
|
|
name: 'ShoppingCarList',
|
|
|
components: { STable, ProductType, ProductBrand },
|
|
|
mixins: [commonMixin],
|
|
|
+ props:{
|
|
|
+ modes:{
|
|
|
+ type: String,
|
|
|
+ default: 'pages'
|
|
|
+ }
|
|
|
+ },
|
|
|
data () {
|
|
|
return {
|
|
|
tableHeight: 0,
|
|
@@ -120,50 +126,9 @@ export default {
|
|
|
itemId: '', // 当前产品id
|
|
|
productTypeList: [], // 分类下拉数据
|
|
|
rowSelectionInfo: null,
|
|
|
- type: 'globalBtn'
|
|
|
- }
|
|
|
- },
|
|
|
- computed: {
|
|
|
- rowSelection () {
|
|
|
- return {
|
|
|
- getCheckboxProps: record => ({
|
|
|
- props: {
|
|
|
- disabled: record.enabledFlag == undefined // Column configuration not to be checked
|
|
|
- }
|
|
|
- })
|
|
|
- }
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
- // 批量删除
|
|
|
- deleteMore () {
|
|
|
- this.$confirm({
|
|
|
- title: '提示',
|
|
|
- content: '您已经选择3个产品,确认要将已选产品从购物车中移除吗?',
|
|
|
- centered: true,
|
|
|
- onOk: () => {
|
|
|
- console.log('确定删除')
|
|
|
- }
|
|
|
- })
|
|
|
- },
|
|
|
- inited (viewer) {
|
|
|
- if (viewer) {
|
|
|
- const imageUrl = []
|
|
|
- viewer.map(item => {
|
|
|
- imageUrl.push(item.imageUrl)
|
|
|
- })
|
|
|
- this.$viewerApi({
|
|
|
- images: imageUrl
|
|
|
- })
|
|
|
- }
|
|
|
- },
|
|
|
- onChangeList (checkedValues) {
|
|
|
- this.chooseShowList = checkedValues
|
|
|
- },
|
|
|
- // 详情
|
|
|
- handleDetail (row) {
|
|
|
- this.$router.push({ name: 'viewProduct', params: { sn: row.productSn } })
|
|
|
- },
|
|
|
// 查询
|
|
|
searchForm () {
|
|
|
this.$refs.table.clearSelected() // 清空表格选中项
|
|
@@ -186,100 +151,68 @@ export default {
|
|
|
getColumns () {
|
|
|
const _this = this
|
|
|
this.columns = [
|
|
|
- { title: '产品编码', dataIndex: 'code', width: '12%', align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
- { title: '产品名称', dataIndex: 'name', width: '30%', align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
- { title: '单位', dataIndex: 'origCode', width: '12%', align: 'center', customRender: function (text) { return (!text || text == ' ') ? '--' : text } },
|
|
|
- { title: '包装数', dataIndex: 'terminalPrice', width: '8%', align: 'right', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
|
|
|
- { title: '可用库存数量', dataIndex: 'carOwnersPrice', width: '8%', align: 'right', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
|
|
|
+ { title: '产品编码', dataIndex: 'code', width: '15%', align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
+ { title: '产品名称', dataIndex: 'name', width: '33%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
|
|
|
+ { title: '可用库存数量', dataIndex: 'carOwnersPrice', width: '13%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
|
|
|
{ title: '成本价', dataIndex: 'price1', width: '8%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
|
|
|
- { title: '采购数量', scopedSlots: { customRender: 'purchaseQty' }, width: '20%', align: 'center' }
|
|
|
+ { title: '单位', dataIndex: 'origCode', width: '8%', align: 'center', customRender: function (text) { return (!text || text == ' ') ? '--' : text } },
|
|
|
+ { title: '包装数', dataIndex: 'terminalPrice', width: '8%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
|
|
|
+ { title: '采购数量', scopedSlots: { customRender: 'purchaseQty' }, width: '15%', align: 'center' }
|
|
|
]
|
|
|
},
|
|
|
- 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] : ''
|
|
|
},
|
|
|
- // 启用 禁用
|
|
|
- changeStatus (record) {
|
|
|
+ // 表格选中项
|
|
|
+ rowSelectionFun (obj) {
|
|
|
+ this.rowSelectionInfo = obj || null
|
|
|
+ },
|
|
|
+ // 批量删除
|
|
|
+ deleteMore () {
|
|
|
+ const rows = this.rowSelectionInfo && this.rowSelectionInfo.selectedRowKeys || []
|
|
|
+ if (!this.rowSelectionInfo || (rows.length <= 0)) {
|
|
|
+ this.$message.warning('请在列表勾选后再进行批量操作!')
|
|
|
+ return
|
|
|
+ }
|
|
|
this.$confirm({
|
|
|
title: '提示',
|
|
|
- content: record.enabledFlag == '1' ? '产品被禁用后,不能再销售,确定禁用吗?' : '确定启用吗?',
|
|
|
+ content: '您已经选择'+rows.length+'个产品,确认要将已选产品从购物车中移除吗?',
|
|
|
centered: true,
|
|
|
onOk: () => {
|
|
|
- this.setEnable(record.enabledFlag == 1 ? '0' : '1', [record.productSn])
|
|
|
- }
|
|
|
- })
|
|
|
- },
|
|
|
- // 启用 禁用
|
|
|
- setEnable (enabledFlag, snList) {
|
|
|
- const params = {
|
|
|
- productSnList: snList,
|
|
|
- enabledFlag: enabledFlag
|
|
|
- }
|
|
|
- this.spinning = true
|
|
|
- productUpdate(params).then(res => {
|
|
|
- if (res.status == 200) {
|
|
|
- this.$message.success(res.message)
|
|
|
- this.$refs.table.clearSelected()
|
|
|
- this.rowSelectionInfo = null
|
|
|
- this.$refs.table.refresh()
|
|
|
- this.spinning = false
|
|
|
- } else {
|
|
|
- this.$refs.table.refresh()
|
|
|
- this.spinning = false
|
|
|
+ console.log('确定删除')
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
- // 表格选中项
|
|
|
- rowSelectionFun (obj) {
|
|
|
- this.rowSelectionInfo = obj || null
|
|
|
- },
|
|
|
- // 批量操作
|
|
|
- handleOutbounds (type) {
|
|
|
- console.log(this.rowSelectionInfo && this.rowSelectionInfo.selectedRowKeys.length)
|
|
|
- if (!this.rowSelectionInfo || (this.rowSelectionInfo && this.rowSelectionInfo.selectedRowKeys.length <= 0)) {
|
|
|
+ // 批量添加
|
|
|
+ addMore () {
|
|
|
+ const rows = this.rowSelectionInfo && this.rowSelectionInfo.selectedRowKeys || []
|
|
|
+ if (!this.rowSelectionInfo || (rows.length <= 0)) {
|
|
|
this.$message.warning('请在列表勾选后再进行批量操作!')
|
|
|
return
|
|
|
}
|
|
|
this.$confirm({
|
|
|
title: '提示',
|
|
|
- content: type == '2' ? '产品被禁用后,不能再销售,确定批量禁用吗?' : '确定批量启用吗?',
|
|
|
+ content: '确定批量添加吗?',
|
|
|
centered: true,
|
|
|
onOk: () => {
|
|
|
- this.setEnable(type == '2' ? '0' : '1', this.rowSelectionInfo.selectedRowKeys)
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
- handleMenuClick (e) {
|
|
|
- this.handleOutbounds(e.key)
|
|
|
- },
|
|
|
pageInit () {
|
|
|
const _this = this
|
|
|
- _this.type = _this.$route.params.type
|
|
|
- this.$nextTick(() => { // 页面渲染完成后的回调
|
|
|
- _this.setTableH()
|
|
|
- })
|
|
|
+ this.setTableH()
|
|
|
this.getColumns()
|
|
|
+ this.resetSearchForm()
|
|
|
},
|
|
|
setTableH () {
|
|
|
- const tableSearchH = this.$refs.tableSearch.offsetHeight
|
|
|
- this.tableHeight = window.innerHeight - tableSearchH - 235
|
|
|
+ this.$nextTick(() => { // 页面渲染完成后的回调
|
|
|
+ const tableSearchH = this.$refs.tableSearch.offsetHeight
|
|
|
+ this.tableHeight = window.innerHeight - tableSearchH - (this.modes == 'pages' ? 200 : 320)
|
|
|
+ })
|
|
|
},
|
|
|
- // 打开自定义报价弹窗
|
|
|
- handleEditPrice () {
|
|
|
- // const oldPrice = {
|
|
|
-
|
|
|
- // }
|
|
|
- // this.$refs.editPrice.setOldPrice(oldPrice)
|
|
|
- this.openEditPriceModal = true
|
|
|
- }
|
|
|
},
|
|
|
watch: {
|
|
|
'$store.state.app.winHeight' (newValue, oldValue) { // 窗口变更时,需同时更改表格高度
|
|
@@ -289,14 +222,12 @@ export default {
|
|
|
mounted () {
|
|
|
if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
|
|
|
this.pageInit()
|
|
|
- this.resetSearchForm()
|
|
|
}
|
|
|
},
|
|
|
activated () {
|
|
|
// 如果是新页签打开,则重置当前页面
|
|
|
if (this.$store.state.app.isNewTab) {
|
|
|
this.pageInit()
|
|
|
- this.resetSearchForm()
|
|
|
}
|
|
|
},
|
|
|
beforeRouteEnter (to, from, next) {
|