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" />
|
2019-11-25 10:44:48 +08:00
|
|
|
<edit ref="edit" @reloadTable="reloadTable" />
|
2019-08-19 18:42:53 +08:00
|
|
|
</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';
|
2019-11-25 10:44:48 +08:00
|
|
|
import Edit from './edit';
|
2019-07-26 13:32:43 +08:00
|
|
|
|
2019-08-19 18:42:53 +08:00
|
|
|
export default {
|
2019-10-29 17:33:11 +08:00
|
|
|
name: 'Dictionary',
|
2019-11-25 10:44:48 +08:00
|
|
|
components: {
|
|
|
|
Edit
|
|
|
|
},
|
2019-10-29 17:33:11 +08:00
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
EffectiveTypeList: [],
|
2019-11-25 10:44:48 +08:00
|
|
|
dataInfo: {},
|
2019-10-29 17:33:11 +08:00
|
|
|
pagerConfig: {
|
|
|
|
pageSize: 'pageSize',
|
|
|
|
pageIndex: 'pageNum'
|
|
|
|
},
|
|
|
|
queryForm: {
|
|
|
|
labelWidth: '100px',
|
|
|
|
reset: true,
|
|
|
|
queryObject: {
|
|
|
|
name: {
|
|
|
|
type: 'text',
|
|
|
|
label: this.$t('orderAuthor.name')
|
|
|
|
},
|
|
|
|
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'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
title: this.$t('orderAuthor.permissionName'),
|
|
|
|
prop: 'permissionName'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
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';
|
|
|
|
default: return 'warning';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
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
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
2019-07-26 13:32:43 +08:00
|
|
|
|
2019-10-29 17:33:11 +08:00
|
|
|
currentModel: {}
|
|
|
|
};
|
|
|
|
},
|
|
|
|
mounted() {
|
|
|
|
this.loadInitData();
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
async loadInitData() {
|
|
|
|
this.$Dictionary.effectiveType().then(list => {
|
|
|
|
this.$convertList(list, this.EffectiveTypeList, elem => {
|
|
|
|
return true;
|
|
|
|
});
|
|
|
|
});
|
|
|
|
},
|
|
|
|
handleEdit(index, row) {
|
2019-11-25 10:44:48 +08:00
|
|
|
// this.$router.push({ path: `${UrlConfig.orderauthor.commodityDraft}/edit/${row.id}` });
|
|
|
|
this.$refs.edit.doShow(row);
|
2019-10-29 17:33:11 +08:00
|
|
|
},
|
|
|
|
// 设置失效
|
|
|
|
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((error) => {
|
|
|
|
this.$messageBox(`${this.$t('tip.operationFailed')}, ${error.message}`);
|
|
|
|
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((error) => {
|
|
|
|
this.reloadTable();
|
|
|
|
this.$messageBox(error.message);
|
|
|
|
});
|
|
|
|
}).catch(() => { });
|
|
|
|
},
|
2019-07-26 13:32:43 +08:00
|
|
|
|
2019-10-29 17:33:11 +08:00
|
|
|
reloadTable() {
|
|
|
|
this.queryList.reload();
|
|
|
|
}
|
|
|
|
}
|
2019-08-19 18:42:53 +08:00
|
|
|
};
|
2019-08-12 18:54:32 +08:00
|
|
|
</script>
|