|
@@ -65,9 +65,10 @@
|
|
|
ref="table"
|
|
|
:style="{ height: tableHeight+84.5+'px' }"
|
|
|
size="small"
|
|
|
- :row-selection="{}"
|
|
|
+ :row-selection="rowSelection"
|
|
|
@rowSelection="rowSelectionFun"
|
|
|
- :rowKey="(record) => record.id"
|
|
|
+ rowKeyName="productSn"
|
|
|
+ :rowKey="(record) => record.productSn"
|
|
|
:columns="columns"
|
|
|
:data="loadData"
|
|
|
:scroll="{ y: tableHeight }"
|
|
@@ -90,11 +91,13 @@
|
|
|
<a-switch
|
|
|
checkedChildren="启用"
|
|
|
unCheckedChildren="禁用"
|
|
|
- v-if="$hasPermissions('B_JgProduct_enable')"
|
|
|
+ v-if="$hasPermissions('B_JgProduct_enable')&&record.enabledFlag!=undefined"
|
|
|
@change="changeStatus(record)"
|
|
|
:checked="record.enabledFlag == 1 ? true : false"
|
|
|
/>
|
|
|
- <span v-else :style="{ color: record.enabledFlag == 1 ? '#00aa00' : '#999' }">{{ record.enabledFlag == 1 ? '已启用' : '已禁用' }}</span>
|
|
|
+ <span v-else :style="{ color: record.enabledFlag == 1 ? '#00aa00' : '#999' }">
|
|
|
+ {{ record.enabledFlag == 1 ? '已启用' : (record.enabledFlag!=undefined?'已禁用':'--') }}
|
|
|
+ </span>
|
|
|
</template>
|
|
|
<!-- 操作 -->
|
|
|
<template slot="action" slot-scope="text, record">
|
|
@@ -111,7 +114,7 @@
|
|
|
|
|
|
<script>
|
|
|
import { commonMixin } from '@/utils/mixin'
|
|
|
-import { productList, getCurrentDealer, dealerProductUpdate } from '@/api/product'
|
|
|
+import { productList, getCurrentDealer, productUpdate } from '@/api/product'
|
|
|
import ProductType from '../../common/productType.js'
|
|
|
import ProductBrand from '../../common/productBrand.js'
|
|
|
import { STable, VSelect } from '@/components'
|
|
@@ -164,20 +167,18 @@ export default {
|
|
|
rowSelectionInfo: null
|
|
|
}
|
|
|
},
|
|
|
- methods: {
|
|
|
- // 表格选中项
|
|
|
- rowSelectionFun (obj) {
|
|
|
- this.rowSelectionInfo = obj || null
|
|
|
- },
|
|
|
- // 批量操作
|
|
|
- handleOutbounds (type) {
|
|
|
- if (!this.rowSelectionInfo || (this.rowSelectionInfo && this.rowSelectionInfo.selectedRowKeys.length < 1)) {
|
|
|
- this.$message.warning('请在列表勾选后再进行批量操作!')
|
|
|
+ computed: {
|
|
|
+ rowSelection () {
|
|
|
+ return {
|
|
|
+ getCheckboxProps: record => ({
|
|
|
+ props: {
|
|
|
+ disabled: record.enabledFlag == undefined // Column configuration not to be checked
|
|
|
+ }
|
|
|
+ })
|
|
|
}
|
|
|
- },
|
|
|
- handleMenuClick (e) {
|
|
|
- this.handleOutbounds(e.key)
|
|
|
- },
|
|
|
+ }
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
inited (viewer) {
|
|
|
if (viewer) {
|
|
|
const imageUrl = []
|
|
@@ -202,9 +203,11 @@ export default {
|
|
|
this.queryParam.productTypeSn1 = ''
|
|
|
this.queryParam.productTypeSn2 = ''
|
|
|
this.queryParam.productTypeSn3 = ''
|
|
|
- this.queryParam.onlineFalg = '1'
|
|
|
+ this.queryParam.onlineFalg = ''
|
|
|
this.productType = []
|
|
|
this.$refs.table.refresh(true)
|
|
|
+ this.rowSelectionInfo = null
|
|
|
+ this.$refs.table.clearSelected()
|
|
|
},
|
|
|
// 设置表头
|
|
|
getColumns () {
|
|
@@ -258,20 +261,22 @@ export default {
|
|
|
content: record.enabledFlag == '1' ? '产品被禁用后,不能再销售,确定禁用吗?' : '确定启用吗?',
|
|
|
centered: true,
|
|
|
onOk: () => {
|
|
|
- this.setEnable(record)
|
|
|
+ this.setEnable(record.enabledFlag == 1 ? '0' : '1', [record.productSn])
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
// 启用 禁用
|
|
|
- setEnable (record) {
|
|
|
+ setEnable (enabledFlag, snList) {
|
|
|
const params = {
|
|
|
- id: record.id,
|
|
|
- enabledFlag: record.enabledFlag == 1 ? '0' : '1'
|
|
|
+ productSnList: snList,
|
|
|
+ enabledFlag: enabledFlag
|
|
|
}
|
|
|
this.spinning = true
|
|
|
- dealerProductUpdate(params).then(res => {
|
|
|
+ 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 {
|
|
@@ -280,6 +285,28 @@ export default {
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
+ // 表格选中项
|
|
|
+ rowSelectionFun (obj) {
|
|
|
+ this.rowSelectionInfo = obj || null
|
|
|
+ },
|
|
|
+ // 批量操作
|
|
|
+ handleOutbounds (type) {
|
|
|
+ if (!this.rowSelectionInfo || (this.rowSelectionInfo && this.rowSelectionInfo.selectedRowKeys.length < 0)) {
|
|
|
+ this.$message.warning('请在列表勾选后再进行批量操作!')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ this.$confirm({
|
|
|
+ title: '提示',
|
|
|
+ content: type == '2' ? '产品被禁用后,不能再销售,确定批量禁用吗?' : '确定批量启用吗?',
|
|
|
+ centered: true,
|
|
|
+ onOk: () => {
|
|
|
+ this.setEnable(type == '2' ? '0' : '1', this.rowSelectionInfo.selectedRowKeys)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ handleMenuClick (e) {
|
|
|
+ this.handleOutbounds(e.key)
|
|
|
+ },
|
|
|
pageInit () {
|
|
|
const _this = this
|
|
|
this.$nextTick(() => { // 页面渲染完成后的回调
|