删除系统管理产品编辑

删除发布内容管理产品状态
This commit is contained in:
joylink_cuiweidong 2019-12-27 10:04:09 +08:00
parent 9b3c41dbfb
commit d15eca77ea
5 changed files with 0 additions and 637 deletions

View File

@ -22,7 +22,6 @@ const JointTraining = () => import('@/views/jointTraining/index');
const Error401 = () => import('@/views/error-page/401');
const Errpr404 = () => import('@/views/error-page/404');
const MapProduct = () => import('@/views/system/product/index');
const Dictionary = () => import('@/views/system/dictionary/index');
const DictionaryDetail = () => import('@/views/system/dictionaryDetail/index');
const UserControl = () => import('@/views/system/userControl/index');
@ -81,7 +80,6 @@ const PackageDraft = () => import('@/views/package/draft/ruleForm');
const PublishMap = () => import('@/views/publish/publishMap/index');
const PublishMapDetail = () => import('@/views/publish/publishMap/list'); // 发布历史
const ProductStatus = () => import('@/views/publish/productStatus/index');
const PublishLesson = () => import('@/views/publish/publishLesson/index');
const RunPlanTemplate = () => import('@/views/publish/runPlanTemplate/index');
const RunPlanCommon = () => import('@/views/publish/runPlanCommon/index');
@ -592,13 +590,6 @@ export const asyncRouter = [
hidden: true,
component: PublishMapDetail
},
{ // 产品状态
path: 'product',
component: ProductStatus,
meta: {
i18n: 'router.productStateManage'
}
},
{ // 发布课程
path: 'lesson',
component: PublishLesson,
@ -804,14 +795,6 @@ export const asyncRouter = [
i18n: 'router.subsystemGeneration'
}
},
{
// 产品编辑
path: 'product',
component: MapProduct,
meta: {
i18n: 'router.productEdit'
}
},
{ // 消息公告
path: 'news',
component: News,

View File

@ -1,131 +0,0 @@
<template>
<div>
<QueryListPage ref="queryListPage" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" />
</div>
</template>
<script>
import { getProductList, putMapProductOnLine, putMapProductOffLine } from '@/api/management/mapprd';
import { getPublishMapListOnline } from '@/api/jmap/map';
export default {
name: 'PublishExam',
data() {
return {
prdTypeList: [],
mapIdList: [],
pagerConfig: {
pageSize: 'pageSize',
pageIndex: 'pageNum'
},
queryForm: {
labelWidth: '140px',
reset: true,
queryObject: {
name: {
type: 'text',
label: this.$t('publish.productName')
}
}
},
queryList: {
query: getProductList,
selectCheckShow: false,
indexShow: true,
columns: [
{
title: this.$t('publish.productName'),
prop: 'name'
},
{
title: this.$t('publish.mapName'),
prop: 'mapId',
type: 'tag',
columnValue: (row) => { return this.$convertField(row.mapId, this.mapIdList, ['id', 'name']); },
tagType: (row) => { return ''; }
},
{
title: this.$t('publish.productType'),
prop: 'prdType',
type: 'tag',
columnValue: (row) => { return this.$convertField(row.prdType, this.prdTypeList, ['code', 'name']); },
tagType: (row) => { return 'success'; }
},
{
type: 'button',
title: this.$t('global.operate'),
width: '250',
buttons: [
{
name: this.$t('global.putaway'),
handleClick: this.handlePutaway,
type: '',
showControl: (row) => { return row.status != 1; }
},
{
name: this.$t('global.soldOut'),
handleClick: this.handleSoldOut,
type: 'warning',
showControl: (row) => { return row.status == 1; }
}
]
}
]
},
currentModel: {}
};
},
created() {
this.loadInitData();
},
methods: {
loadInitData() {
this.prdTypeList = [];
this.$Dictionary.productPostType().then(list => {
this.prdTypeList = list;
});
this.mapIdList = [];
getPublishMapListOnline().then(response => {
this.mapIdList = response.data;
});
},
handlePutaway(index, row) {
this.$confirm(this.$t('publish.wellPutawayProduct'), this.$t('global.tips'), {
confirmButtonText: this.$t('global.confirm'),
cancelButtonText: this.$t('global.cancel'),
type: 'warning'
}).then(() => {
putMapProductOnLine(row.id).then(response => {
this.$message.success(this.$t('publish.operationSuccess'));
this.reloadTable();
}).catch(() => {
this.reloadTable();
this.$messageBox(this.$t('error.operationFailure'));
});
}).catch(() => { });
},
handleSoldOut(index, row) {
this.$confirm(this.$t('publish.wellSoldOutProduct'), this.$t('global.tips'), {
confirmButtonText: this.$t('global.confirm'),
cancelButtonText: this.$t('global.cancel'),
type: 'warning'
}).then(() => {
putMapProductOffLine(row.id).then(response => {
this.$message.success(this.$t('publish.operationSuccess'));
this.reloadTable();
}).catch(() => {
this.reloadTable();
this.$messageBox(this.$t('error.operationFailure'));
});
}).catch(() => { });
},
reloadTable() {
this.queryList.reload();
}
}
};
</script>

View File

@ -1,289 +0,0 @@
<template>
<div v-loading="loading" class="card-box">
<el-steps class="steps" :active="display">
<el-step :title="title" icon="el-icon-edit-outline" />
<el-step title="" icon="el-icon-upload" />
</el-steps>
<el-card class="forms" style="padding-top: 40px">
<el-form ref="form" :model="addModel" label-width="140px">
<el-form-item :label="$t('map.mapName')" prop="mapName">
<el-input v-model="addModel.mapName" :disabled="true" />
</el-form-item>
<el-form-item :label="$t('map.productType') + ':'" prop="prdType">
<el-radio-group v-model="addModel.prdType" :disabled="isUpdate">
<template v-for="item in chooseList">
<el-radio-button :key="item.code" :label="item.code">{{ item.name }}</el-radio-button>
</template>
</el-radio-group>
</el-form-item>
<el-form-item :label="$t('map.productName') + ':'" prop="name" :rules="baseRules.name">
<el-input v-model="addModel.name" />
</el-form-item>
<el-form-item
v-if="isShowTrainTypes"
:label="$t('map.associateTrainingTypes') + ':'"
prop="trainTypes"
:rules="baseRules.trainTypes"
>
<el-select v-model="addModel.trainTypes" multiple :placeholder="$t('map.pleaseSelect')" @change="trainTypesChange">
<el-option
v-for="item in trainTypesList"
:key="item.code"
:label="item.name"
:value="item.code"
/>
</el-select>
</el-form-item>
<el-form-item :label="$t('map.productDescription') + ':'" prop="remarks" :rules="baseRules.remarks">
<el-input v-model="addModel.remarks" type="textarea" :rows="4" />
</el-form-item>
</el-form>
</el-card>
<div class="draft">
<el-button-group>
<el-button v-if="isCreate" type="primary" @click="create">{{ $t('map.create') }}</el-button>
<el-button v-if="isUpdate" type="primary" @click="update">{{ $t('map.updata') }}</el-button>
<el-button v-if="isDelete" type="danger" @click="deleteObj">{{ $t('map.deleteObj') }}</el-button>
</el-button-group>
</div>
</div>
</template>
<script>
import { createTrainingCategory, updateTrainingCategory, getProductDetail, deleteTrainingCategory } from '@/api/management/mapprd';
import { getPublishMapInfo } from '@/api/jmap/map';
export default {
name: 'ShowDetail',
data() {
return {
loading: false,
node: null,
display: 1,
codeDisabled: true,
rules: {},
trainTypesList: [],
initTrainTypes: [],
chooseList: [],
addModel: {
id: '',
mapId: '',
mapName: '',
name: '',
remarks: '',
prdType: '01',
trainTypes: []
}
};
},
computed: {
title() {
if (this.node && this.node.data) {
if (this.node.data.type === 'Map') {
return this.$t('map.createProductCategories');
} else if (this.node.data.type === 'Prd' ||
this.node.data.type === 'Prd') {
return this.$t('map.editTraining');
}
}
return this.$t('map.selectOperation');
},
isCreate() {
return this.node && this.node.data.type === 'Map';
},
isUpdate() {
return this.node && this.node.data.type === 'Prd';
},
isDelete() {
return this.node && this.node.data.type === 'Prd';
},
isShowTrainTypes() {
return this.addModel.prdType != '03' && this.addModel.prdType != '04' && this.addModel.prdType != '05';
},
baseRules() {
return {
name: [
{ required: true, message: this.$t('rules.productNameEnter'), trigger: 'change' }
],
remarks: [
{ required: true, message: this.$t('rules.productDescriptionEnter'), trigger: 'change' }
],
trainTypes: [
{ required: true, message: this.$t('rules.trainingTypeSelect'), trigger: 'change' }
]
};
}
},
mounted() {
this.$Dictionary.trainingType().then(list => {
this.trainTypesList = list;
});
this.$Dictionary.productPostType().then(list => {
this.chooseList = list;
});
},
methods: {
loadData(node) {
if (node) {
//
this.node = node;
this.initTrainTypes = [];
this.$refs.form.resetFields();
this.loading = true;
if (node.data.type === 'Map') {
this.codeDisabled = false;
getPublishMapInfo(node.data.id).then(res => {
this.addModel.mapName = node.data.name;
this.addModel.lineCode = res.data.lineCode;
this.addModel.mapId = node.data.id;
this.loading = false;
}).catch(error => {
this.loading = false;
this.$message.error(error.message);
});
} else if (node.data.type === 'Prd') {
this.codeDisabled = true;
getProductDetail(node.data.id).then(response => {
this.addModel.mapName = node.parent.data.name;
this.addModel.mapId = node.parent.data.id;
this.addModel.name = response.data.name;
this.addModel.remarks = response.data.remarks;
this.addModel.prdType = response.data.prdType;
this.addModel.trainTypes = this.initTrainTypes = response.data.trainTypes;
this.addModel.id = response.data.id;
this.loading = false;
}).catch((error) => {
this.loading = false;
this.$message.error(error.message);
});
} else {
this.addModel.prdType = '01';
this.loading = false;
}
//
this.$nextTick(function () {
this.$refs.form.clearValidate();
});
}
},
create() {
this.$refs.form.validate((valid) => {
if (valid) {
const data = {
mapName: this.addModel.mapName,
mapId: this.addModel.mapId,
name: this.addModel.name,
remarks: this.addModel.remarks,
prdType: this.addModel.prdType,
trainTypes: this.isShowTrainTypes ? this.addModel.trainTypes : []
};
createTrainingCategory(data).then(response => {
this.initTrainTypes = this.addModel.trainTypes;
this.$emit('refresh');
this.$message.success(this.$t('tip.productCreationSuccessfully'));
}).catch((error) => {
this.$message.error(`${this.$t('tip.productCreationFailed')}, ${error.message}`);
});
}
});
},
update() {
this.$refs.form.validate((valid) => {
if (valid) {
this.addModel.trainTypes = this.isShowTrainTypes ? this.addModel.trainTypes : [];
updateTrainingCategory(this.addModel).then(response => {
this.initTrainTypes = this.addModel.trainTypes;
this.$message.success(this.$t('tip.updateProductSuccessfully'));
this.$emit('refresh');
}).catch((error) => {
this.$message.error(`${this.$t('tip.updateProductFailed')}, ${error.message}`);
});
}
});
},
trainTypesChange(tag) {
if (this.initTrainTypes && this.initTrainTypes.length > 0) {
this.initTrainTypes.forEach(elem => {
if (this.addModel.trainTypes.indexOf(elem) < 0) {
this.addModel.trainTypes = this.initTrainTypes;
this.$messageBox(this.$t('tip.narrowScope'));
}
});
}
},
deleteObj() {
this.$refs.form.validate((valid) => {
if (valid) {
deleteTrainingCategory(this.addModel).then(response => {
this.$message.success(this.$t('tip.deleteProductSuccessfully'));
this.$refs.form.resetFields();
this.node = null;
this.$emit('refresh');
}).catch(error => {
if (error.code === 500009) {
this.$message.error(this.$t('tip.cannotDeleteProduct'));
} else {
this.$message.error(this.$t('tip.deleteProductFailed'));
}
});
}
});
}
}
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
@import "src/styles/mixin.scss";
.card-box {
padding-top: 20px;
height: 100%;
overflow: auto;
}
.steps {
width: 980px;
margin: 0 auto;
/deep/ {
.el-step__icon.is-icon {
width: 95px;
}
}
}
.forms {
width: 800px;
margin: 0 auto;
margin-top: 20px;
/deep/ {
.el-select {
float: left;
width: calc(600px);
}
.el-textarea {
float: left;
width: calc(600px);
}
.el-form-item__content>.el-input {
float: left;
width: calc(600px);
}
.el-input-number {
float: left;
width: calc(250px);
}
}
}
.draft {
width: 300px;
text-align: center;
margin: 20px auto;
}
</style>

View File

@ -1,58 +0,0 @@
<template>
<div class="contnt_box">
<div class="training-tree">
<training-tree-operate ref="trainingTree" @loadData="loadData" />
</div>
<div class="training-draft">
<edit-detail-operate ref="training" @refresh="refresh" />
</div>
</div>
</template>
<script>
import TrainingTreeOperate from './tree';
import EditDetailOperate from './edit';
//
export default {
name: 'TrainingEditOperate',
components: {
EditDetailOperate,
TrainingTreeOperate
},
data() {
return {
};
},
methods: {
loadData(node) {
this.$nextTick(() => {
this.$refs.training.loadData(node);
});
},
refresh() {
this.$nextTick(() => {
this.$refs.trainingTree.refresh();
});
}
}
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
@import "src/styles/mixin.scss";
.contnt_box{
height: 100%;
.training-tree {
float: left;
width: 420px;
height: 100%;
}
.training-draft {
float: left;
width: calc(100% - 420px);
height: 100%;
}
}
</style>

View File

@ -1,142 +0,0 @@
<template>
<div v-loading="loading" class="joylink-card map-list-main">
<div class="clearfix">
<span>{{ $t('map.productCategories') }}</span>
</div>
<filter-city ref="filerCity" filter-empty :query-function="queryFunction" :local-param-name="localParamName" @filterSelectChange="refresh" />
<el-input v-model="filterText" :placeholder="$t('tip.enterKeywordsFiltering')" clearable />
<div style="height: calc(100% - 87px);">
<el-tree
ref="trainingTree"
:data="treeData"
:filter-node-method="filterNode"
:lazy="false"
:props="defaultProps"
class="tree-height-max"
expand-on-click-node
highlight-current
@node-click="clickEvent"
>
<span slot-scope="{ node }">
<span v-if="node.data.type == 'skin'" class="el-icon-news" />
<span v-if="node.data.type == 'prd'" class="el-icon-tickets" />
<span v-if="node.data.type == 'trainingType'" class="el-icon-document" />
<span v-if="node.data.type == 'trainingType'" class="el-icon-edit" />
<span>&nbsp;{{ node.label }}</span>
</span>
</el-tree>
</div>
</div>
</template>
<script>
import { getPublishMapTree } from '@/api/management/mapprd';
import FilterCity from '@/views/components/filterCity';
export default {
name: 'TreeOperate',
components: {
FilterCity
},
data() {
return {
loading: true,
queryFunction: getPublishMapTree,
defaultProps: {
children: 'children',
label: 'name'
},
filterText: '',
treeData: [],
node: {},
point: {
x: 0,
y: 0
},
localParamName: 'product_cityCode',
cityCode: ''
};
},
watch: {
filterText(val) {
this.$refs.trainingTree.filter(val);
}
},
methods: {
filterNode(value, data) {
if (!value) return true;
return data.name.indexOf(value) !== -1;
},
showContextMenu(e, obj, node, vueElem) {
e.preventDefault();
this.point = {
x: e.clientX,
y: e.clientY
};
if (obj) {
this.node = node;
this.$refs.menu.show();
}
},
clickEvent(obj, node, data) {
this.$store.dispatch('menuOperation/setPopMenu', { position: null, menu: null });
this.$emit('loadData', node);
},
convertTreeData(list) {
const tree = [];
if (list && list.length) {
/* 去除列表的training节点*/
list.forEach(elem => {
elem.children = this.convertTreeData(elem.children);
if (elem.type !== 'TrainingType') {
tree.push(elem);
}
});
}
return tree;
},
async refresh(filterSelect) {
this.loading = true;
try {
if (filterSelect) {
this.cityCode = filterSelect;
}
const res = await getPublishMapTree(this.cityCode);
this.treeData = this.convertTreeData(res.data);
this.$nextTick(() => {
this.loading = false;
});
} catch (error) {
this.loading = false;
this.$messageBox(this.$t('error.refreshFailed'));
}
}
}
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
.map-list-main{
height: 100%;
}
.clearfix{
padding: 0 20px;
border-bottom: 1px solid #EBEEF5;
box-sizing: border-box;
height: 47px;
line-height: 47px;
}
.tree-height-max{
height: 100%;
}
</style>
<style>
.el-tree {
overflow-x: hidden;
}
.el-tree-node.is-current>.el-tree-node__content {
background-color: #e4e3e3 !important;
}
</style>