2019-07-26 13:32:43 +08:00
|
|
|
<template>
|
2019-08-19 18:42:53 +08:00
|
|
|
<div>
|
|
|
|
<QueryListPage ref="queryListPage" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" />
|
|
|
|
</div>
|
2019-07-26 13:32:43 +08:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2019-08-19 18:42:53 +08:00
|
|
|
import { getCommodityList, delCommodity, setCommodityStatus } from '@/api/management/goods';
|
|
|
|
import { UrlConfig } from '@/router/index';
|
|
|
|
import { listPublishMap } from '@/api/jmap/map';
|
2019-07-26 13:32:43 +08:00
|
|
|
|
2019-08-19 18:42:53 +08:00
|
|
|
export default {
|
|
|
|
name: 'Dictionary',
|
|
|
|
data() {
|
|
|
|
return {
|
2019-09-02 18:43:05 +08:00
|
|
|
// productTypeList: [],
|
2019-08-19 18:42:53 +08:00
|
|
|
EffectiveTypeList: [],
|
|
|
|
pagerConfig: {
|
|
|
|
pageSize: 'pageSize',
|
|
|
|
pageIndex: 'pageNum'
|
|
|
|
},
|
|
|
|
queryForm: {
|
2019-08-20 09:12:54 +08:00
|
|
|
labelWidth: '100px',
|
2019-08-19 18:42:53 +08:00
|
|
|
reset: true,
|
|
|
|
queryObject: {
|
|
|
|
name: {
|
|
|
|
type: 'text',
|
|
|
|
label: this.$t('orderAuthor.name')
|
|
|
|
},
|
2019-09-02 18:43:05 +08:00
|
|
|
// productType: {
|
|
|
|
// type: 'select',
|
|
|
|
// label: this.$t('orderAuthor.productType'),
|
|
|
|
// config: {
|
|
|
|
// data: []
|
|
|
|
// }
|
|
|
|
// },
|
|
|
|
// mapId: {
|
|
|
|
// type: 'select',
|
|
|
|
// label: this.$t('orderAuthor.map'),
|
|
|
|
// config: {
|
|
|
|
// data: []
|
|
|
|
// }
|
|
|
|
// },
|
2019-08-19 18:42:53 +08:00
|
|
|
status: {
|
|
|
|
type: 'select',
|
|
|
|
label: this.$t('orderAuthor.state'),
|
|
|
|
config: {
|
|
|
|
data: this.$ConstSelect.Status
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
queryList: {
|
|
|
|
query: getCommodityList,
|
|
|
|
selectCheckShow: false,
|
|
|
|
indexShow: true,
|
|
|
|
columns: [
|
|
|
|
{
|
|
|
|
title: this.$t('orderAuthor.commodityName'),
|
|
|
|
prop: 'name'
|
|
|
|
},
|
|
|
|
{
|
2019-08-29 09:31:58 +08:00
|
|
|
title: '权限名称',
|
|
|
|
prop: 'permissionName'
|
2019-08-19 18:42:53 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
title: this.$t('orderAuthor.price'),
|
|
|
|
prop: 'price'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
title: this.$t('orderAuthor.state'),
|
|
|
|
prop: 'status',
|
|
|
|
type: 'tag',
|
|
|
|
columnValue: (row) => { return this.$convertField(row.status, this.EffectiveTypeList, ['value', 'label']); },
|
|
|
|
tagType: (row) => {
|
|
|
|
switch (row.status) {
|
|
|
|
case '1': return 'success';
|
2019-09-02 17:05:53 +08:00
|
|
|
default: return 'warning';
|
2019-08-19 18:42:53 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
title: this.$t('orderAuthor.describtion'),
|
|
|
|
prop: 'remarks'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
title: this.$t('orderAuthor.creationTime'),
|
|
|
|
prop: 'createTime'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
type: 'button',
|
|
|
|
title: this.$t('global.operate'),
|
|
|
|
width: this.$i18n.locale == 'en' ? '300': '250',
|
|
|
|
buttons: [
|
|
|
|
{
|
|
|
|
name: this.$t('global.edit'),
|
|
|
|
type: 'primary',
|
|
|
|
handleClick: this.handleEdit
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: this.$t('orderAuthor.setupFailure'),
|
|
|
|
handleClick: this.handleEfficacy,
|
|
|
|
type: 'warning',
|
|
|
|
showControl: (row) => {
|
|
|
|
return row.status == '1';
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: this.$t('orderAuthor.setupEffective'),
|
|
|
|
type: 'primary',
|
|
|
|
handleClick: this.handleEfficacy,
|
|
|
|
showControl: (row) => {
|
|
|
|
return row.status == '0';
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: this.$t('global.delete'),
|
|
|
|
type: 'danger',
|
|
|
|
handleClick: this.handleDelete
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
],
|
|
|
|
actions: [
|
|
|
|
{ text: this.$t('global.add'), handler: this.handleAdd }
|
|
|
|
]
|
|
|
|
},
|
2019-07-26 13:32:43 +08:00
|
|
|
|
2019-08-19 18:42:53 +08:00
|
|
|
currentModel: {}
|
|
|
|
};
|
|
|
|
},
|
|
|
|
mounted() {
|
|
|
|
this.loadInitData();
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
async loadInitData() {
|
|
|
|
this.$Dictionary.effectiveType().then(list => {
|
|
|
|
this.$convertList(list, this.EffectiveTypeList, elem => {
|
|
|
|
return true;
|
|
|
|
});
|
|
|
|
});
|
2019-09-02 18:43:05 +08:00
|
|
|
// this.$Dictionary.productType().then(list => {
|
|
|
|
// list.forEach(elem => {
|
|
|
|
// this.queryForm.queryObject.productType.config.data.push({ value: elem.code, label: elem.name });
|
|
|
|
// });
|
|
|
|
// this.$convertList(list, this.productTypeList, elem => {
|
|
|
|
// return true;
|
|
|
|
// });
|
|
|
|
// });
|
|
|
|
// try {
|
|
|
|
// const res = await listPublishMap();
|
|
|
|
// res.data.forEach(elem => {
|
|
|
|
// this.queryForm.queryObject.mapId.config.data.push({ value: elem.id, label: elem.name });
|
|
|
|
// });
|
|
|
|
// } catch (error) {
|
|
|
|
// console.error(error, '获取发布地图');
|
|
|
|
// }
|
2019-08-19 18:42:53 +08:00
|
|
|
},
|
|
|
|
handleEdit(index, row) {
|
|
|
|
this.$router.push({ path: `${UrlConfig.orderauthor.commodityDraft}/edit/${row.id}` });
|
|
|
|
},
|
2019-07-26 13:32:43 +08:00
|
|
|
|
2019-08-19 18:42:53 +08:00
|
|
|
handleAdd() {
|
|
|
|
this.$router.push({ path: `${UrlConfig.orderauthor.commodityDraft}/add/0` });
|
|
|
|
},
|
|
|
|
// 设置失效
|
|
|
|
handleEfficacy(index, row) {
|
|
|
|
this.$confirm(this.$t('tip.updateProductTip'), this.$t('global.tips'), {
|
|
|
|
confirmButtonText: this.$t('global.confirm'),
|
|
|
|
cancelButtonText: this.$t('global.cancel'),
|
|
|
|
type: 'warning'
|
|
|
|
}).then(() => {
|
|
|
|
setCommodityStatus(row.id).then(res => {
|
|
|
|
this.$message.success(this.$t('tip.operationSuccessfully'));
|
|
|
|
this.reloadTable();
|
|
|
|
}).catch(() => {
|
|
|
|
this.$messageBox(this.$t('tip.operationFailed'));
|
|
|
|
this.reloadTable();
|
|
|
|
});
|
|
|
|
}).catch(() => { });
|
|
|
|
},
|
|
|
|
handleDelete(index, row) {
|
|
|
|
this.$confirm(this.$t('tip.deleteProductTip'), this.$t('global.tips'), {
|
|
|
|
confirmButtonText: this.$t('global.confirm'),
|
|
|
|
cancelButtonText: this.$t('global.cancel'),
|
|
|
|
type: 'warning'
|
|
|
|
}).then(() => {
|
|
|
|
delCommodity(row.id).then(response => {
|
|
|
|
this.$message.success(this.$t('tip.successfullyDelete'));
|
|
|
|
this.reloadTable();
|
|
|
|
}).catch(() => {
|
|
|
|
this.reloadTable();
|
|
|
|
this.$messageBox(this.$t('tip.failDelete'));
|
|
|
|
});
|
|
|
|
}).catch(() => { });
|
|
|
|
},
|
2019-07-26 13:32:43 +08:00
|
|
|
|
2019-08-19 18:42:53 +08:00
|
|
|
reloadTable() {
|
|
|
|
this.queryList.reload();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
2019-08-12 18:54:32 +08:00
|
|
|
</script>
|