|
@@ -15,7 +15,7 @@
|
|
|
<script>
|
|
|
import toolbar from './toolbar';
|
|
|
import mxFilterList from '@/mixins/filterList';
|
|
|
-import { getPage, delItem } from '@/api/photoWarehouse';
|
|
|
+import { getPage, delItem, updateItem } from '@/api/photoWarehouse';
|
|
|
|
|
|
export default {
|
|
|
name: 'ImageGoodsManagement',
|
|
@@ -116,10 +116,21 @@ export default {
|
|
|
{
|
|
|
key: 'isBeautiful',
|
|
|
name: '精选',
|
|
|
- width: this.$col.s,
|
|
|
- type: 'tag',
|
|
|
- fetchTagType: val => (val ? 'success' : 'info'),
|
|
|
- tagName: row => (row.isBeautiful ? '是' : '否')
|
|
|
+ width: this.$col.m,
|
|
|
+ type: 'switch',
|
|
|
+ switchName: ['是', '否'],
|
|
|
+ api: async row => {
|
|
|
+ console.log(row);
|
|
|
+ row.isBeautiful = !row.isBeautiful;
|
|
|
+ const { success } = await updateItem(row);
|
|
|
+ if (success) {
|
|
|
+ this.$success('修改成功!');
|
|
|
+ }
|
|
|
+ this.$g_emit('photo_reload');
|
|
|
+ }
|
|
|
+ // type: 'tag',
|
|
|
+ // fetchTagType: val => (val ? 'success' : 'info'),
|
|
|
+ // tagName: row => (row.isBeautiful ? '是' : '否')
|
|
|
},
|
|
|
{
|
|
|
key: 'isTake',
|
|
@@ -132,10 +143,22 @@ export default {
|
|
|
{
|
|
|
key: 'isShow',
|
|
|
name: '状态',
|
|
|
- width: this.$col.s,
|
|
|
- type: 'tag',
|
|
|
- fetchTagType: val => (val ? 'success' : 'info'),
|
|
|
- tagName: row => (row.isShow ? '上架' : '下架')
|
|
|
+ width: this.$col.b,
|
|
|
+ type: 'switch',
|
|
|
+ switchName: ['上架', '下架'],
|
|
|
+ api: async row => {
|
|
|
+ console.log(row);
|
|
|
+ row.isShow = !row.isShow;
|
|
|
+ const { success } = await updateItem(row);
|
|
|
+ if (success) {
|
|
|
+ this.$success('修改成功!');
|
|
|
+ }
|
|
|
+ this.$g_emit('photo_reload');
|
|
|
+ }
|
|
|
+ // width: this.$col.s,
|
|
|
+ // type: 'tag',
|
|
|
+ // fetchTagType: val => (val ? 'success' : 'info'),
|
|
|
+ // tagName: row => (row.isShow ? '上架' : '下架')
|
|
|
},
|
|
|
{
|
|
|
key: 'action',
|