优化代码

This commit is contained in:
zyy 2019-08-08 15:57:36 +08:00
parent b67a37bc33
commit c3f600b015
56 changed files with 2866 additions and 3182 deletions

View File

@ -164,7 +164,10 @@ export default {
required: true required: true
}, },
beforeQuery: { beforeQuery: {
type: Function type: Function,
default(val) {
return val;
}
}, },
canQuery: { canQuery: {
type: Boolean, type: Boolean,
@ -449,7 +452,7 @@ export default {
} }
} }
// //
resultData = this.beforeQuery ? this.beforeQuery(resultData) : resultData; resultData = this.beforeQuery(resultData);
return resultData; return resultData;
}, },
query() { query() {

View File

@ -1,119 +1,126 @@
<template> <template>
<el-dialog :title="title" class="beijing-01__schedule choose-plan-template" :visible.sync="dialogShow" width="80%" <el-dialog
:before-close="doClose" :modal="false" :close-on-click-modal="false" v-dialogDrag> v-dialogDrag
<QueryListPage ref="pageRules" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList"> :title="title"
</QueryListPage> class="beijing-01__schedule choose-plan-template"
<el-row type="flex" justify="center" class="button-group"> :visible.sync="dialogShow"
<el-button type="primary" @click="handleConfirm" :loading="loading"> </el-button> width="80%"
<el-button @click="dialogShow = false"> </el-button> :before-close="doClose"
</el-row> :modal="false"
</el-dialog> :close-on-click-modal="false"
>
<QueryListPage ref="pageRules" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" />
<el-row type="flex" justify="center" class="button-group">
<el-button type="primary" :loading="loading" @click="handleConfirm"> </el-button>
<el-button @click="dialogShow = false"> </el-button>
</el-row>
</el-dialog>
</template> </template>
<script> <script>
import { runPlanTemplateList } from '@/api/runplan'; import { runPlanTemplateList } from '@/api/runplan';
import { getSkinStyleList } from '@/api/management/mapskin' import { getSkinStyleList } from '@/api/management/mapskin';
import { UrlConfig } from '@/router/index'; import { UrlConfig } from '@/router/index';
export default { export default {
name: 'ChooseTemplatePlan', name: 'ChooseTemplatePlan',
data() { data() {
return { return {
dialogShow: false, dialogShow: false,
loading: false, loading: false,
skinStyleList: [], skinStyleList: [],
pagerConfig: { pagerConfig: {
pageSize: 'pageSize', pageSize: 'pageSize',
pageIndex: 'pageNum' pageIndex: 'pageNum'
}, },
queryForm: { queryForm: {
reset: true, reset: true,
labelWidth: '100px', labelWidth: '100px',
queryObject: { queryObject: {
name: { name: {
type: 'text', type: 'text',
label: '运行图名称' label: '运行图名称'
} }
} }
}, },
queryList: { queryList: {
query: this.queryFunction, query: this.queryFunction,
selectCheckShow: false, selectCheckShow: false,
radioShow: true, radioShow: true,
columns: [ columns: [
{ {
title: '运行图名称', title: '运行图名称',
prop: 'name' prop: 'name'
}, },
{ {
title: '皮肤类型', title: '皮肤类型',
prop: 'skinStyle', prop: 'skinStyle',
type: 'tag', type: 'tag',
columnValue: (row) => { columnValue: (row) => {
return this.convertField(row.skinStyle, this.skinStyleList, ['code', 'name']) return this.$convertField(row.skinStyle, this.skinStyleList, ['code', 'name']);
}, },
tagType: (row) => { return 'success' } tagType: (row) => { return 'success'; }
} }
] ]
}, },
currentModel: {} currentModel: {}
} };
}, },
computed: { computed: {
title() { title() {
return '选择模板运行图' return '选择模板运行图';
} }
}, },
methods: { methods: {
loadInitData() { loadInitData() {
this.skinStyleList = []; this.skinStyleList = [];
getSkinStyleList().then(response => { getSkinStyleList().then(response => {
this.skinStyleList = response.data; this.skinStyleList = response.data;
}) });
}, },
doShow() { doShow() {
this.loading = false; this.loading = false;
this.dialogShow = true; this.dialogShow = true;
this.loadInitData(); this.loadInitData();
}, },
doClose() { doClose() {
this.dialogShow = false; this.dialogShow = false;
}, },
queryFunction(params) { queryFunction(params) {
if (this.$store.state.map && this.$store.state.map.map) { if (this.$store.state.map && this.$store.state.map.map) {
params['skinStyle'] = this.$store.getters['map/skinStyle']; params['skinStyle'] = this.$store.getters['map/skinStyle'];
} }
return runPlanTemplateList(params); return runPlanTemplateList(params);
}, },
convertField(fieldValue, enumList, converFormat) { convertField(fieldValue, enumList, converFormat) {
if (converFormat && converFormat.length >= 2) { if (enumList && converFormat && converFormat.length >= 2) {
let value = converFormat[0]; const value = converFormat[0];
let label = converFormat[1]; const label = converFormat[1];
for (let i = 0; enumList && i < enumList.length; i++) { for (let i = 0; i < enumList.length; i++) {
if ('' + fieldValue === '' + enumList[i][value]) { if ('' + fieldValue === '' + enumList[i][value]) {
return enumList[i][label]; return enumList[i][label];
} }
} }
} }
}, },
handleConfirm() { handleConfirm() {
this.doClose(); this.doClose();
if (this.$refs && this.$refs.pageRules) { if (this.$refs && this.$refs.pageRules) {
const choose = this.$refs.pageRules.currentChoose(); const choose = this.$refs.pageRules.currentChoose();
if (choose) { if (choose) {
this.$emit('chooseConfirm', choose); this.$emit('chooseConfirm', choose);
} else { } else {
this.$messageBox(`请选择模板运行图`); this.$messageBox(`请选择模板运行图`);
} }
} }
}, },
reloadTable() { reloadTable() {
this.queryList.reload() this.queryList.reload();
} }
} }
} };
</script> </script>
<style rel="stylesheet/scss" lang="scss" scoped> <style rel="stylesheet/scss" lang="scss" scoped>
@import "src/styles/mixin.scss"; @import "src/styles/mixin.scss";
</style> </style>

View File

@ -1,153 +1,160 @@
<template> <template>
<el-dialog :title="title" class="beijing-01__schedule reload-today-plan" :visible.sync="dialogShow" width="80%" <el-dialog
:before-close="doClose" :modal="false" :close-on-click-modal="false" v-dialogDrag> v-dialogDrag
<QueryListPage ref="pageRules" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList"> :title="title"
</QueryListPage> class="beijing-01__schedule reload-today-plan"
<el-row type="flex" justify="center" class="button-group"> :visible.sync="dialogShow"
<el-button type="primary" @click="handleConfirm" :loading="loading"> </el-button> width="80%"
<el-button @click="dialogShow = false"> </el-button> :before-close="doClose"
</el-row> :modal="false"
</el-dialog> :close-on-click-modal="false"
>
<QueryListPage ref="pageRules" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" />
<el-row type="flex" justify="center" class="button-group">
<el-button type="primary" :loading="loading" @click="handleConfirm"> </el-button>
<el-button @click="dialogShow = false"> </el-button>
</el-row>
</el-dialog>
</template> </template>
<script> <script>
import { listPublishMap } from '@/api/jmap/mapdraft'; import { listPublishMap } from '@/api/jmap/mapdraft';
import { runPlanTemplateList, deleteRunPlanTemplate, generateUserRunPlanEveryDay } from '@/api/runplan'; import { runPlanTemplateList, deleteRunPlanTemplate, generateUserRunPlanEveryDay } from '@/api/runplan';
import { getStationListBySkinStyle } from '@/api/runplan'; import { getStationListBySkinStyle } from '@/api/runplan';
import { getEveryDayRunPlanData } from '@/api/simulation'; import { getEveryDayRunPlanData } from '@/api/simulation';
import { getSkinStyleList } from '@/api/management/mapskin' import { getSkinStyleList } from '@/api/management/mapskin';
import { UrlConfig } from '@/router/index'; import { UrlConfig } from '@/router/index';
export default { export default {
name: 'ReloadTodayPlan', name: 'ReloadTodayPlan',
data() { data() {
return { return {
dialogShow: false, dialogShow: false,
loading: false, loading: false,
skinStyleList: [], skinStyleList: [],
pagerConfig: { pagerConfig: {
pageSize: 'pageSize', pageSize: 'pageSize',
pageIndex: 'pageNum' pageIndex: 'pageNum'
}, },
queryForm: { queryForm: {
reset: true, reset: true,
labelWidth: '100px', labelWidth: '100px',
queryObject: { queryObject: {
name: { name: {
type: 'text', type: 'text',
label: '运行图名称' label: '运行图名称'
} }
} }
}, },
queryList: { queryList: {
query: this.queryFunction, query: this.queryFunction,
selectCheckShow: false, selectCheckShow: false,
radioShow: true, radioShow: true,
columns: [ columns: [
{ {
title: '运行图名称', title: '运行图名称',
prop: 'name' prop: 'name'
}, },
{ {
title: '皮肤类型', title: '皮肤类型',
prop: 'skinStyle', prop: 'skinStyle',
type: 'tag', type: 'tag',
columnValue: (row) => { columnValue: (row) => {
return this.convertField(row.skinStyle, this.skinStyleList, ['code', 'name']) return this.$convertField(row.skinStyle, this.skinStyleList, ['code', 'name']);
}, },
tagType: (row) => { return 'success' } tagType: (row) => { return 'success'; }
} }
] ]
}, },
currentModel: {} currentModel: {}
} };
}, },
computed: { computed: {
title() { title() {
return '加载当天计划' return '加载当天计划';
} }
}, },
methods: { methods: {
loadInitData() { loadInitData() {
this.skinStyleList = []; this.skinStyleList = [];
getSkinStyleList().then(response => { getSkinStyleList().then(response => {
this.skinStyleList = response.data; this.skinStyleList = response.data;
}) });
}, },
doShow() { doShow() {
this.loading = false; this.loading = false;
this.dialogShow = true; this.dialogShow = true;
this.loadInitData(); this.loadInitData();
}, },
doClose() { doClose() {
this.dialogShow = false; this.dialogShow = false;
}, },
queryFunction(params) { queryFunction(params) {
if (this.$store.state.map && this.$store.state.map.map) { if (this.$store.state.map && this.$store.state.map.map) {
params['skinStyle'] = this.$store.getters['map/skinStyle']; params['skinStyle'] = this.$store.getters['map/skinStyle'];
} }
return runPlanTemplateList(params); return runPlanTemplateList(params);
}, },
convertField(fieldValue, enumList, converFormat) { convertField(fieldValue, enumList, converFormat) {
if (converFormat && converFormat.length >= 2) { if (enumList && converFormat && converFormat.length >= 2) {
let value = converFormat[0]; const value = converFormat[0];
let label = converFormat[1]; const label = converFormat[1];
for (let i = 0; enumList && i < enumList.length; i++) { for (let i = 0; i < enumList.length; i++) {
if ('' + fieldValue === '' + enumList[i][value]) { if ('' + fieldValue === '' + enumList[i][value]) {
return enumList[i][label]; return enumList[i][label];
} }
} }
} }
}, },
// //
handleConfirm() { handleConfirm() {
if (this.$refs && this.$refs.pageRules) { if (this.$refs && this.$refs.pageRules) {
const choose = this.$refs.pageRules.currentChoose(); const choose = this.$refs.pageRules.currentChoose();
if (choose && choose.id) { if (choose && choose.id) {
this.loading = true; this.loading = true;
generateUserRunPlanEveryDay(choose.id, this.$route.query.group).then(response => { generateUserRunPlanEveryDay(choose.id, this.$route.query.group).then(response => {
this.loading = false; this.loading = false;
this.reloadTable() this.reloadTable();
this.loadRunData(); this.loadRunData();
this.doClose(); this.doClose();
this.$message.success(`生成用户每日运行图成功`); this.$message.success(`生成用户每日运行图成功`);
}).catch(error => { }).catch(() => {
this.loading = false; this.loading = false;
this.reloadTable() this.reloadTable();
this.$messageBox(`生成用户每日运行图失败`); this.$messageBox(`生成用户每日运行图失败`);
}) });
} else { } else {
this.$messageBox(`请选择需要加载的运行图`); this.$messageBox(`请选择需要加载的运行图`);
} }
} }
}, },
loadRunData() { loadRunData() {
let skinStyle = this.$route.query.skinStyle; const skinStyle = this.$route.query.skinStyle;
this.$store.dispatch('runPlan/clear'); this.$store.dispatch('runPlan/clear');
if (skinStyle) { if (skinStyle) {
getStationListBySkinStyle(skinStyle).then(response => { getStationListBySkinStyle(skinStyle).then(response => {
let stations = response.data; const stations = response.data;
this.PlanConvert = this.$theme.loadPlanConvert(skinStyle); this.PlanConvert = this.$theme.loadPlanConvert(skinStyle);
this.$store.dispatch('runPlan/setStations', stations).then(() => { this.$store.dispatch('runPlan/setStations', stations).then(() => {
getEveryDayRunPlanData(this.$route.query.group).then(resp => { getEveryDayRunPlanData(this.$route.query.group).then(resp => {
this.$store.dispatch('runPlan/setPlanData', resp.data); this.$store.dispatch('runPlan/setPlanData', resp.data);
}).catch(error => { }).catch(() => {
this.$store.dispatch('runPlan/setPlanData', []); this.$store.dispatch('runPlan/setPlanData', []);
this.$messageBox(`获取运行图数据失败`); this.$messageBox(`获取运行图数据失败`);
}) });
}) });
}).catch(error => { }).catch(() => {
this.$messageBox(`获取车站列表失败`); this.$messageBox(`获取车站列表失败`);
}); });
} }
}, },
reloadTable() { reloadTable() {
this.queryList.reload() this.queryList.reload();
} }
} }
} };
</script> </script>
<style rel="stylesheet/scss" lang="scss" scoped> <style rel="stylesheet/scss" lang="scss" scoped>
@import "src/styles/mixin.scss"; @import "src/styles/mixin.scss";
</style> </style>

View File

@ -1,119 +1,126 @@
<template> <template>
<el-dialog :title="title" class="beijing-01__schedule choose-plan-template" :visible.sync="dialogShow" width="80%" <el-dialog
:before-close="doClose" :modal="false" :close-on-click-modal="false" v-dialogDrag> :title="title"
<QueryListPage ref="pageRules" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList"> v-dialogDrag
</QueryListPage> class="beijing-01__schedule choose-plan-template"
<el-row type="flex" justify="center" class="button-group"> :visible.sync="dialogShow"
<el-button type="primary" @click="handleConfirm" :loading="loading"> </el-button> width="80%"
<el-button @click="dialogShow = false"> </el-button> :before-close="doClose"
</el-row> :modal="false"
</el-dialog> :close-on-click-modal="false"
>
<QueryListPage ref="pageRules" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" />
<el-row type="flex" justify="center" class="button-group">
<el-button type="primary" :loading="loading" @click="handleConfirm"> </el-button>
<el-button @click="dialogShow = false"> </el-button>
</el-row>
</el-dialog>
</template> </template>
<script> <script>
import { runPlanTemplateList } from '@/api/runplan'; import { runPlanTemplateList } from '@/api/runplan';
import { getSkinStyleList } from '@/api/management/mapskin' import { getSkinStyleList } from '@/api/management/mapskin';
import { UrlConfig } from '@/router/index'; import { UrlConfig } from '@/router/index';
export default { export default {
name: 'ChooseTemplatePlan', name: 'ChooseTemplatePlan',
data() { data() {
return { return {
dialogShow: false, dialogShow: false,
loading: false, loading: false,
skinStyleList: [], skinStyleList: [],
pagerConfig: { pagerConfig: {
pageSize: 'pageSize', pageSize: 'pageSize',
pageIndex: 'pageNum' pageIndex: 'pageNum'
}, },
queryForm: { queryForm: {
reset: true, reset: true,
labelWidth: '100px', labelWidth: '100px',
queryObject: { queryObject: {
name: { name: {
type: 'text', type: 'text',
label: '运行图名称' label: '运行图名称'
} }
} }
}, },
queryList: { queryList: {
query: this.queryFunction, query: this.queryFunction,
selectCheckShow: false, selectCheckShow: false,
radioShow: true, radioShow: true,
columns: [ columns: [
{ {
title: '运行图名称', title: '运行图名称',
prop: 'name' prop: 'name'
}, },
{ {
title: '皮肤类型', title: '皮肤类型',
prop: 'skinStyle', prop: 'skinStyle',
type: 'tag', type: 'tag',
columnValue: (row) => { columnValue: (row) => {
return this.convertField(row.skinStyle, this.skinStyleList, ['code', 'name']) return this.$convertField(row.skinStyle, this.skinStyleList, ['code', 'name']);
}, },
tagType: (row) => { return 'success' } tagType: (row) => { return 'success'; }
} }
] ]
}, },
currentModel: {} currentModel: {}
} };
}, },
computed: { computed: {
title() { title() {
return '选择模板运行图' return '选择模板运行图';
} }
}, },
methods: { methods: {
loadInitData() { loadInitData() {
this.skinStyleList = []; this.skinStyleList = [];
getSkinStyleList().then(response => { getSkinStyleList().then(response => {
this.skinStyleList = response.data; this.skinStyleList = response.data;
}) });
}, },
doShow() { doShow() {
this.loading = false; this.loading = false;
this.dialogShow = true; this.dialogShow = true;
this.loadInitData(); this.loadInitData();
}, },
doClose() { doClose() {
this.dialogShow = false; this.dialogShow = false;
}, },
queryFunction(params) { queryFunction(params) {
if (this.$store.state.map && this.$store.state.map.map) { if (this.$store.state.map && this.$store.state.map.map) {
params['skinStyle'] = this.$store.getters['map/skinStyle']; params['skinStyle'] = this.$store.getters['map/skinStyle'];
} }
return runPlanTemplateList(params); return runPlanTemplateList(params);
}, },
convertField(fieldValue, enumList, converFormat) { convertField(fieldValue, enumList, converFormat) {
if (converFormat && converFormat.length >= 2) { if (enumList && converFormat && converFormat.length >= 2) {
let value = converFormat[0]; const value = converFormat[0];
let label = converFormat[1]; const label = converFormat[1];
for (let i = 0; enumList && i < enumList.length; i++) { for (let i = 0; i < enumList.length; i++) {
if ('' + fieldValue === '' + enumList[i][value]) { if ('' + fieldValue === '' + enumList[i][value]) {
return enumList[i][label]; return enumList[i][label];
} }
} }
} }
}, },
handleConfirm() { handleConfirm() {
this.doClose(); this.doClose();
if (this.$refs && this.$refs.pageRules) { if (this.$refs && this.$refs.pageRules) {
const choose = this.$refs.pageRules.currentChoose(); const choose = this.$refs.pageRules.currentChoose();
if (choose) { if (choose) {
this.$emit('chooseConfirm', choose); this.$emit('chooseConfirm', choose);
} else { } else {
this.$messageBox(`请选择模板运行图`); this.$messageBox(`请选择模板运行图`);
} }
} }
}, },
reloadTable() { reloadTable() {
this.queryList.reload() this.queryList.reload();
} }
} }
} };
</script> </script>
<style rel="stylesheet/scss" lang="scss" scoped> <style rel="stylesheet/scss" lang="scss" scoped>
@import "src/styles/mixin.scss"; @import "src/styles/mixin.scss";
</style> </style>

View File

@ -59,7 +59,7 @@ export default {
prop: 'skinStyle', prop: 'skinStyle',
type: 'tag', type: 'tag',
columnValue: (row) => { columnValue: (row) => {
return this.convertField(row.skinStyle, this.skinStyleList, ['code', 'name']); return this.$convertField(row.skinStyle, this.skinStyleList, ['code', 'name']);
}, },
tagType: (row) => { return 'success'; } tagType: (row) => { return 'success'; }
} }
@ -96,7 +96,7 @@ export default {
return runPlanTemplateList(params); return runPlanTemplateList(params);
}, },
convertField(fieldValue, enumList, converFormat) { convertField(fieldValue, enumList, converFormat) {
if (converFormat && converFormat.length >= 2) { if (enumList && converFormat && converFormat.length >= 2) {
const value = converFormat[0]; const value = converFormat[0];
const label = converFormat[1]; const label = converFormat[1];
for (let i = 0; i < enumList.length; i++) { for (let i = 0; i < enumList.length; i++) {

View File

@ -1,119 +1,126 @@
<template> <template>
<el-dialog :title="title" class="beijing-01__schedule choose-plan-template" :visible.sync="dialogShow" width="80%" <el-dialog
:before-close="doClose" :modal="false" :close-on-click-modal="false" v-dialogDrag> :title="title"
<QueryListPage ref="pageRules" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList"> class="beijing-01__schedule choose-plan-template"
</QueryListPage> :visible.sync="dialogShow"
<el-row type="flex" justify="center" class="button-group"> v-dialogDrag
<el-button type="primary" @click="handleConfirm" :loading="loading"> </el-button> width="80%"
<el-button @click="dialogShow = false"> </el-button> :before-close="doClose"
</el-row> :modal="false"
</el-dialog> :close-on-click-modal="false"
>
<QueryListPage ref="pageRules" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" />
<el-row type="flex" justify="center" class="button-group">
<el-button type="primary" :loading="loading" @click="handleConfirm"> </el-button>
<el-button @click="dialogShow = false"> </el-button>
</el-row>
</el-dialog>
</template> </template>
<script> <script>
import { runPlanTemplateList } from '@/api/runplan'; import { runPlanTemplateList } from '@/api/runplan';
import { getSkinStyleList } from '@/api/management/mapskin' import { getSkinStyleList } from '@/api/management/mapskin';
import { UrlConfig } from '@/router/index'; import { UrlConfig } from '@/router/index';
export default { export default {
name: 'ChooseTemplatePlan', name: 'ChooseTemplatePlan',
data() { data() {
return { return {
dialogShow: false, dialogShow: false,
loading: false, loading: false,
skinStyleList: [], skinStyleList: [],
pagerConfig: { pagerConfig: {
pageSize: 'pageSize', pageSize: 'pageSize',
pageIndex: 'pageNum' pageIndex: 'pageNum'
}, },
queryForm: { queryForm: {
reset: true, reset: true,
labelWidth: '100px', labelWidth: '100px',
queryObject: { queryObject: {
name: { name: {
type: 'text', type: 'text',
label: '运行图名称' label: '运行图名称'
} }
} }
}, },
queryList: { queryList: {
query: this.queryFunction, query: this.queryFunction,
selectCheckShow: false, selectCheckShow: false,
radioShow: true, radioShow: true,
columns: [ columns: [
{ {
title: '运行图名称', title: '运行图名称',
prop: 'name' prop: 'name'
}, },
{ {
title: '皮肤类型', title: '皮肤类型',
prop: 'skinStyle', prop: 'skinStyle',
type: 'tag', type: 'tag',
columnValue: (row) => { columnValue: (row) => {
return this.convertField(row.skinStyle, this.skinStyleList, ['code', 'name']) return this.$convertField(row.skinStyle, this.skinStyleList, ['code', 'name']);
}, },
tagType: (row) => { return 'success' } tagType: (row) => { return 'success'; }
} }
] ]
}, },
currentModel: {} currentModel: {}
} };
}, },
computed: { computed: {
title() { title() {
return '选择模板运行图' return '选择模板运行图';
} }
}, },
methods: { methods: {
loadInitData() { loadInitData() {
this.skinStyleList = []; this.skinStyleList = [];
getSkinStyleList().then(response => { getSkinStyleList().then(response => {
this.skinStyleList = response.data; this.skinStyleList = response.data;
}) });
}, },
doShow() { doShow() {
this.loading = false; this.loading = false;
this.dialogShow = true; this.dialogShow = true;
this.loadInitData(); this.loadInitData();
}, },
doClose() { doClose() {
this.dialogShow = false; this.dialogShow = false;
}, },
queryFunction(params) { queryFunction(params) {
if (this.$store.state.map && this.$store.state.map.map) { if (this.$store.state.map && this.$store.state.map.map) {
params['skinStyle'] = this.$store.getters['map/skinStyle']; params['skinStyle'] = this.$store.getters['map/skinStyle'];
} }
return runPlanTemplateList(params); return runPlanTemplateList(params);
}, },
convertField(fieldValue, enumList, converFormat) { convertField(fieldValue, enumList, converFormat) {
if (converFormat && converFormat.length >= 2) { if (converFormat && converFormat.length >= 2) {
let value = converFormat[0]; const value = converFormat[0];
let label = converFormat[1]; const label = converFormat[1];
for (let i = 0; enumList && i < enumList.length; i++) { for (let i = 0; enumList && i < enumList.length; i++) {
if ('' + fieldValue === '' + enumList[i][value]) { if ('' + fieldValue === '' + enumList[i][value]) {
return enumList[i][label]; return enumList[i][label];
} }
} }
} }
}, },
handleConfirm() { handleConfirm() {
this.doClose(); this.doClose();
if (this.$refs && this.$refs.pageRules) { if (this.$refs && this.$refs.pageRules) {
const choose = this.$refs.pageRules.currentChoose(); const choose = this.$refs.pageRules.currentChoose();
if (choose) { if (choose) {
this.$emit('chooseConfirm', choose); this.$emit('chooseConfirm', choose);
} else { } else {
this.$messageBox(`请选择模板运行图`); this.$messageBox(`请选择模板运行图`);
} }
} }
}, },
reloadTable() { reloadTable() {
this.queryList.reload() this.queryList.reload();
} }
} }
} };
</script> </script>
<style rel="stylesheet/scss" lang="scss" scoped> <style rel="stylesheet/scss" lang="scss" scoped>
@import "src/styles/mixin.scss"; @import "src/styles/mixin.scss";
</style> </style>

View File

@ -53,7 +53,7 @@
prop: 'skinStyle', prop: 'skinStyle',
type: 'tag', type: 'tag',
columnValue: (row) => { columnValue: (row) => {
return this.convertField(row.skinStyle, this.skinStyleList, ['code', 'name']) return this.$convertField(row.skinStyle, this.skinStyleList, ['code', 'name'])
}, },
tagType: (row) => { return 'success' } tagType: (row) => { return 'success' }
} }
@ -89,17 +89,6 @@
} }
return runPlanTemplateList(params); return runPlanTemplateList(params);
}, },
convertField(fieldValue, enumList, converFormat) {
if (converFormat && converFormat.length >= 2) {
let value = converFormat[0];
let label = converFormat[1];
for (let i = 0; enumList && i < enumList.length; i++) {
if ('' + fieldValue === '' + enumList[i][value]) {
return enumList[i][label];
}
}
}
},
// //
handleConfirm() { handleConfirm() {
if (this.$refs && this.$refs.pageRules) { if (this.$refs && this.$refs.pageRules) {

View File

@ -50,7 +50,7 @@
prop: 'skinStyle', prop: 'skinStyle',
type: 'tag', type: 'tag',
columnValue: (row) => { columnValue: (row) => {
return this.convertField(row.skinStyle, this.skinStyleList, ['code', 'name']) return this.$convertField(row.skinStyle, this.skinStyleList, ['code', 'name'])
}, },
tagType: (row) => { return 'success' } tagType: (row) => { return 'success' }
} }
@ -86,17 +86,6 @@
} }
return runPlanTemplateList(params); return runPlanTemplateList(params);
}, },
convertField(fieldValue, enumList, converFormat) {
if (converFormat && converFormat.length >= 2) {
let value = converFormat[0];
let label = converFormat[1];
for (let i = 0; enumList && i < enumList.length; i++) {
if ('' + fieldValue === '' + enumList[i][value]) {
return enumList[i][label];
}
}
}
},
handleConfirm() { handleConfirm() {
this.doClose(); this.doClose();
if (this.$refs && this.$refs.pageRules) { if (this.$refs && this.$refs.pageRules) {

View File

@ -53,7 +53,7 @@
prop: 'skinStyle', prop: 'skinStyle',
type: 'tag', type: 'tag',
columnValue: (row) => { columnValue: (row) => {
return this.convertField(row.skinStyle, this.skinStyleList, ['code', 'name']) return this.$convertField(row.skinStyle, this.skinStyleList, ['code', 'name'])
}, },
tagType: (row) => { return 'success' } tagType: (row) => { return 'success' }
} }
@ -89,17 +89,6 @@
} }
return runPlanTemplateList(params); return runPlanTemplateList(params);
}, },
convertField(fieldValue, enumList, converFormat) {
if (converFormat && converFormat.length >= 2) {
let value = converFormat[0];
let label = converFormat[1];
for (let i = 0; enumList && i < enumList.length; i++) {
if ('' + fieldValue === '' + enumList[i][value]) {
return enumList[i][label];
}
}
}
},
// //
handleConfirm() { handleConfirm() {
if (this.$refs && this.$refs.pageRules) { if (this.$refs && this.$refs.pageRules) {

View File

@ -22,9 +22,6 @@ import '@/scripts/GlobalPlugin';
import '@/directives'; import '@/directives';
import messages from '@/i18n/index'; import messages from '@/i18n/index';
// window.THREE = require('@/jlmap3d/main/three.min.js');
// window.zlib = require('@/jlmap3d/main/inflate.min.js');
Vue.use(ElementUI); Vue.use(ElementUI);
Vue.use(VueI18n); Vue.use(VueI18n);
@ -68,3 +65,39 @@ Vue.prototype.$messageBox = function(msge) {
}); });
} }
}; };
Vue.prototype.$convertField = function(fieldValue, enumList, converFormat, isList = false) {
const arr = [];
if (enumList && converFormat && converFormat.length >= 2) {
const value = converFormat[0];
const label = converFormat[1];
if (isList) {
enumList.forEach((element, i) => {
fieldValue.forEach((v, j) => {
if ('' + fieldValue[j] === '' + enumList[i][value]) {
arr.push(enumList[i][label]);
}
});
});
} else {
for (let i = 0; i < enumList.length; i++) {
if ('' + fieldValue === '' + enumList[i][value]) {
return enumList[i][label];
}
}
}
}
return isList ? arr: '';
};
Vue.prototype.$convertList = function(FromList, ToList, checktypeFunction) {
if (FromList) {
ToList.length = 0;
FromList.forEach(elem => {
if (checktypeFunction(elem)) {
ToList.push({ value: elem.code, label: elem.name });
}
});
}
};

View File

@ -104,7 +104,7 @@ export default {
title: '皮肤类型', title: '皮肤类型',
prop: 'skinCode', prop: 'skinCode',
type: 'tag', type: 'tag',
columnValue: (row) => { return this.convertField(row.skinCode, this.skinCodeList, ['code', 'name']); }, columnValue: (row) => { return this.$convertField(row.skinCode, this.skinCodeList, ['code', 'name']); },
tagType: (row) => { return 'success'; } tagType: (row) => { return 'success'; }
}, },
{ {

View File

@ -81,28 +81,28 @@ export default {
title: '皮肤类型', title: '皮肤类型',
prop: 'skinStyle', prop: 'skinStyle',
type: 'tag', type: 'tag',
columnValue: (row) => { return this.convertField(row.skinStyle, this.skinStyleList, ['code', 'name']); }, columnValue: (row) => { return this.$convertField(row.skinStyle, this.skinStyleList, ['code', 'name']); },
tagType: (row) => { return 'success'; } tagType: (row) => { return 'success'; }
}, },
{ {
title: '产品', title: '产品',
prop: 'prdCode', prop: 'prdCode',
type: 'tag', type: 'tag',
columnValue: (row) => { return this.convertField(row.prdCode, this.prdTypeList, ['code', 'name']); }, columnValue: (row) => { return this.$convertField(row.prdCode, this.prdTypeList, ['code', 'name']); },
tagType: (row) => { return 'success'; } tagType: (row) => { return 'success'; }
}, },
{ {
title: '实训类型', title: '实训类型',
prop: 'type', prop: 'type',
type: 'tag', type: 'tag',
columnValue: (row) => { return this.convertField(row.type, this.trainingTypeList, ['code', 'name']); }, columnValue: (row) => { return this.$convertField(row.type, this.trainingTypeList, ['code', 'name']); },
tagType: (row) => { return 'success'; } tagType: (row) => { return 'success'; }
}, },
{ {
title: '操作类型', title: '操作类型',
prop: 'operateType', prop: 'operateType',
type: 'tag', type: 'tag',
columnValue: (row) => { return this.convertField(row.operateType, this.trainingOperateTypeMap[row.type], ['code', 'name']); }, columnValue: (row) => { return this.$convertField(row.operateType, this.trainingOperateTypeMap[row.type], ['code', 'name']); },
tagType: (row) => { return 'success'; } tagType: (row) => { return 'success'; }
}, },
{ {

View File

@ -59,7 +59,7 @@
prop: 'skinCode', prop: 'skinCode',
type: 'tag', type: 'tag',
columnValue: (row) => { columnValue: (row) => {
return this.convertField(row.skinCode, this.skinCodeList, ['code', 'name']) return this.$convertField(row.skinCode, this.skinCodeList, ['code', 'name'])
}, },
tagType: (row) => { return '' } tagType: (row) => { return '' }
}, },
@ -112,17 +112,6 @@
}) })
}) })
}, },
convertField(fieldValue, enumList, converFormat) {
if (converFormat && converFormat.length >= 2) {
let value = converFormat[0];
let label = converFormat[1];
for (let i = 0; enumList && i < enumList.length; i++) {
if ('' + fieldValue === '' + enumList[i][value]) {
return enumList[i][label];
}
}
}
},
// //
handleConfirmCreate(data) { handleConfirmCreate(data) {
createQuest(data).then(resp => { createQuest(data).then(resp => {

View File

@ -50,7 +50,7 @@
title: '皮肤类型', title: '皮肤类型',
prop: 'parameter', prop: 'parameter',
type: 'tag', type: 'tag',
columnValue: (row) => { return this.convertField(row.parameter, this.skinStyleList, ['code', 'name']) }, columnValue: (row) => { return this.$convertField(row.parameter, this.skinStyleList, ['code', 'name']) },
tagType: (row) => { return '' } tagType: (row) => { return '' }
}, },
{ {
@ -61,7 +61,7 @@
title: '状态', title: '状态',
prop: 'status', prop: 'status',
type: 'tag', type: 'tag',
columnValue: (row) => { return this.convertField(row.status, this.taskStatusList, ['code', 'name']) }, columnValue: (row) => { return this.$convertField(row.status, this.taskStatusList, ['code', 'name']) },
tagType: (row) => { if (row.status != '03') { return 'warning' } else { return 'success' } } tagType: (row) => { if (row.status != '03') { return 'warning' } else { return 'success' } }
}, },
{ {
@ -115,17 +115,6 @@
this.loadInitData(); this.loadInitData();
}, },
methods: { methods: {
convertField(fieldValue, enumList, converFormat) {
if (converFormat && converFormat.length >= 2) {
let value = converFormat[0];
let label = converFormat[1];
for (let i = 0; enumList && i < enumList.length; i++) {
if ('' + fieldValue === '' + enumList[i][value]) {
return enumList[i][label];
}
}
}
},
loadInitData() { loadInitData() {
this.skinStyleList = []; this.skinStyleList = [];
getSkinStyleList().then(response => { getSkinStyleList().then(response => {

View File

@ -1,115 +1,115 @@
<template> <template>
<el-dialog :title="title" :visible.sync="dialogVisible" width="25%" :before-close="handleClose" center> <el-dialog :title="title" :visible.sync="dialogVisible" width="25%" :before-close="handleClose" center>
<data-form ref="dataform" :form="form" :formModel="formModel" :rules="rules"></data-form> <data-form ref="dataform" :form="form" :form-model="formModel" :rules="rules" />
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
<el-button type="primary" @click="doSave" v-loading="loading"> </el-button> <el-button v-loading="loading" type="primary" @click="doSave"> </el-button>
<el-button @click="handleClose"> </el-button> <el-button @click="handleClose"> </el-button>
</span> </span>
</el-dialog> </el-dialog>
</template> </template>
<script> <script>
import { addTrainingRulesList } from '@/api/management/operation'; import { addTrainingRulesList } from '@/api/management/operation';
import { OperationList } from '@/scripts/OperationConfig'; import { OperationList } from '@/scripts/OperationConfig';
import { getSkinStyleList } from '@/api/management/mapskin'; import { getSkinStyleList } from '@/api/management/mapskin';
export default { export default {
name: 'AddBatch', name: 'AddBatch',
data() { data() {
return { return {
loading: false, loading: false,
dialogVisible: false, dialogVisible: false,
formModel: { formModel: {
skinStyle: '', skinStyle: ''
}, },
skinStyleList: [], skinStyleList: [],
isShow: false, isShow: false
} };
}, },
computed: { computed: {
form() { form() {
let isAdd = this.type === 'ADD' this.type === 'ADD';
let form = { const form = {
labelWidth: '120px', labelWidth: '120px',
items: [ items: [
{ prop: 'skinStyle', label: '皮肤类型', type: 'select', required: true, options: this.skinStyleList }, { prop: 'skinStyle', label: '皮肤类型', type: 'select', required: true, options: this.skinStyleList }
] ]
} };
return form return form;
}, },
rules() { rules() {
let crules = { const crules = {
skinStyle: [ skinStyle: [
{ required: true, message: '请选择皮肤类型', trigger: 'change' }, { required: true, message: '请选择皮肤类型', trigger: 'change' }
], ]
} };
return crules return crules;
}, },
title() { title() {
return '自动生成操作' return '自动生成操作';
} }
}, },
mounted() { mounted() {
this.init(); this.init();
}, },
methods: { methods: {
init() { init() {
// //
this.skinStyleList = []; this.skinStyleList = [];
getSkinStyleList().then(response => { getSkinStyleList().then(response => {
this.skinStyleList = response.data.map(item => { this.skinStyleList = response.data.map(item => {
let params = {} const params = {};
params.label = item.name; params.label = item.name;
params.value = item.code; params.value = item.code;
return params; return params;
}); });
}) });
}, },
show(total) { show(total) {
if (total) { if (total) {
this.isShow = true; this.isShow = true;
} }
this.loading = false; this.loading = false;
this.dialogVisible = true this.dialogVisible = true;
}, },
doSave() { doSave() {
let self = this const self = this;
this.$refs.dataform.validateForm(() => { this.$refs.dataform.validateForm(() => {
if (this.isShow) { if (this.isShow) {
this.$confirm('此操作将清空改皮肤下所有操作定义, 是否继续?', '提示', { this.$confirm('此操作将清空改皮肤下所有操作定义, 是否继续?', '提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
self.create() self.create();
}).catch(() => { }) }).catch(() => { });
} else { } else {
self.create() self.create();
} }
}) });
}, },
create() { create() {
let self = this const self = this;
this.loading = true; this.loading = true;
addTrainingRulesList(this.formModel.skinStyle, OperationList[this.formModel.skinStyle].list).then(response => { addTrainingRulesList(this.formModel.skinStyle, OperationList[this.formModel.skinStyle].list).then(response => {
self.loading = false; self.loading = false;
self.$message.success('批量生成操作定义成功') self.$message.success('批量生成操作定义成功');
self.handleClose() self.handleClose();
self.$emit('reloadTable'); // self.$emit('reloadTable'); //
}).catch(error => { }).catch(error => {
self.loading = false; self.loading = false;
self.$message.error('批量生成操作定义失败:' + error.message) self.$message.error('批量生成操作定义失败:' + error.message);
}) });
}, },
handleClose() { handleClose() {
this.formModel = { this.formModel = {
skinStyle: '', skinStyle: ''
} };
this.$refs.dataform.resetForm(); this.$refs.dataform.resetForm();
this.isShow = false; this.isShow = false;
this.dialogVisible = false this.dialogVisible = false;
} }
} }
} };
</script> </script>

View File

@ -1,300 +1,297 @@
<template> <template>
<el-dialog :title="title" :visible.sync="dialogVisible" width="30%" :before-close="handleClose" center> <el-dialog :title="title" :visible.sync="dialogVisible" width="30%" :before-close="handleClose" center>
<data-form ref="dataform" :form="form" :formModel="formModel" :rules="rules"></data-form> <data-form ref="dataform" :form="form" :form-model="formModel" :rules="rules" />
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
<el-button type="primary" @click="doSave" v-loading="loading"> </el-button> <el-button v-loading="loading" type="primary" @click="doSave"> </el-button>
<el-button @click="handleClose"> </el-button> <el-button @click="handleClose"> </el-button>
</span> </span>
</el-dialog> </el-dialog>
</template> </template>
<script> <script>
import { create, checkDicCodeExist, getData, update } from '@/api/management/dictionary' import { postTrainingRulesData, putTrainingRulesData, getPlaceholderList } from '@/api/management/operation';
import { postTrainingRulesData, putTrainingRulesData, getPlaceholderList } from '@/api/management/operation'; import { getSkinStyleList } from '@/api/management/mapskin';
import { validateCharCode } from '@/utils/validate'
import { getSkinStyleList } from '@/api/management/mapskin';
export default { export default {
name: 'TrainingEdit', name: 'TrainingEdit',
props: { props: {
type: { type: {
type: String, type: String,
required: true required: true
} }
}, },
data() { data() {
return { return {
loading: false, loading: false,
dialogVisible: false, dialogVisible: false,
formModel: { formModel: {
trainingName: '', trainingName: '',
trainingType: '', trainingType: '',
operateType: '', operateType: '',
skinStyle: '', skinStyle: '',
minDuration: '', minDuration: '',
maxDuration: '', maxDuration: '',
trainingRemark: '', trainingRemark: '',
productTypes: [], productTypes: []
}, },
skinStyleList: [], skinStyleList: [],
trainingTypeList: [], trainingTypeList: [],
trainingOperateTypeMap: {}, trainingOperateTypeMap: {},
placeholderList: [], placeholderList: []
} };
}, },
computed: { computed: {
form() { form() {
let isAdd = this.type === 'ADD' const isAdd = this.type === 'ADD';
let form = { const form = {
labelWidth: '120px', labelWidth: '120px',
items: [ items: [
{ prop: 'skinStyle', label: '皮肤类型', type: 'select', required: true, options: this.skinStyleList, disabled: !isAdd }, { prop: 'skinStyle', label: '皮肤类型', type: 'select', required: true, options: this.skinStyleList, disabled: !isAdd },
{ prop: 'trainingType', label: '实训类型', type: 'select', required: true, options: this.trainingTypeList, disabled: !isAdd, change: true, onChange: this.changeList }, { prop: 'trainingType', label: '实训类型', type: 'select', required: true, options: this.trainingTypeList, disabled: !isAdd, change: true, onChange: this.changeList },
{ prop: 'operateType', label: '操作类型', type: 'select', required: true, options: this.trainingOperateTypeMap[this.formModel.trainingType], disabled: !isAdd }, { prop: 'operateType', label: '操作类型', type: 'select', required: true, options: this.trainingOperateTypeMap[this.formModel.trainingType], disabled: !isAdd },
{ label: '', type: 'button', options: this.placeholderList, style: 'margin-bottom: 0; margin-top: -10px;', typeBtn: 'info', click: this.addTrainName }, { label: '', type: 'button', options: this.placeholderList, style: 'margin-bottom: 0; margin-top: -10px;', typeBtn: 'info', click: this.addTrainName },
{ prop: 'trainingName', label: '实训名称', type: 'text', required: true, rightWidth: true, tooltip: true, info: '选择占位符 {} 不可删除,否则名称显示会有问题!' }, { prop: 'trainingName', label: '实训名称', type: 'text', required: true, rightWidth: true, tooltip: true, info: '选择占位符 {} 不可删除,否则名称显示会有问题!' },
{ prop: 'minDuration', label: '最佳用时', type: 'text', required: true }, { prop: 'minDuration', label: '最佳用时', type: 'text', required: true },
{ prop: 'maxDuration', label: '最大用时', type: 'text', required: true }, { prop: 'maxDuration', label: '最大用时', type: 'text', required: true },
{ label: '', type: 'button', options: this.placeholderList, style: 'margin-bottom: 0; margin-top: -10px;', typeBtn: 'info', click: this.addTrainRemark }, { label: '', type: 'button', options: this.placeholderList, style: 'margin-bottom: 0; margin-top: -10px;', typeBtn: 'info', click: this.addTrainRemark },
{ prop: 'trainingRemark', label: '实训说明', type: 'textarea', required: true, tooltip: true, info: '选择占位符 {} 不可删除,否则说明显示会有问题!' }, { prop: 'trainingRemark', label: '实训说明', type: 'textarea', required: true, tooltip: true, info: '选择占位符 {} 不可删除,否则说明显示会有问题!' }
] ]
} };
return form return form;
}, },
rules() { rules() {
let crules = { const crules = {
trainingName: [ trainingName: [
{ required: true, message: '请输入实训名称', trigger: 'blur' }, { required: true, message: '请输入实训名称', trigger: 'blur' }
], ],
trainingType: [ trainingType: [
{ required: true, message: '请输入实训类型', trigger: 'change' }, { required: true, message: '请输入实训类型', trigger: 'change' }
], ],
operateType: [ operateType: [
{ required: true, message: '请输入操作类型', trigger: 'change' } { required: true, message: '请输入操作类型', trigger: 'change' }
], ],
skinStyle: [ skinStyle: [
{ required: true, message: '请选择皮肤类型', trigger: 'change' }, { required: true, message: '请选择皮肤类型', trigger: 'change' }
], ],
minDuration: [ minDuration: [
{ required: true, message: '请输入最佳用时', trigger: 'blur' } { required: true, message: '请输入最佳用时', trigger: 'blur' }
], ],
maxDuration: [ maxDuration: [
{ required: true, message: '请输入最大用时', trigger: 'blur' }, { required: true, message: '请输入最大用时', trigger: 'blur' }
], ],
trainingRemark: [ trainingRemark: [
{ required: true, max: 500, message: '请输入实训说明', trigger: 'blur' }, { required: true, max: 500, message: '请输入实训说明', trigger: 'blur' }
], ]
} };
return crules return crules;
}, },
title() { title() {
if (this.type === 'ADD') { if (this.type === 'ADD') {
return '创建操作规则' return '创建操作规则';
} else { } else {
return '编辑操作规则' return '编辑操作规则';
} }
} }
}, },
mounted() { mounted() {
this.init(); this.init();
}, },
methods: { methods: {
init() { init() {
// //
this.skinStyleList = []; this.skinStyleList = [];
getSkinStyleList().then(response => { getSkinStyleList().then(response => {
this.skinStyleList = response.data.map(item => { this.skinStyleList = response.data.map(item => {
let params = {} const params = {};
params.label = item.name; params.label = item.name;
params.value = item.code; params.value = item.code;
return params; return params;
}); });
}) });
// //
this.trainingTypeList = []; this.trainingTypeList = [];
this.$Dictionary.trainingType().then(list => { this.$Dictionary.trainingType().then(list => {
this.trainingTypeList = list.map(item => { this.trainingTypeList = list.map(item => {
let params = {} const params = {};
params.label = item.name; params.label = item.name;
params.value = item.code; params.value = item.code;
return params; return params;
}); });
}) });
// //
this.trainingOperateTypeMap = {} this.trainingOperateTypeMap = {};
this.$Dictionary.stationControl().then(list => { this.$Dictionary.stationControl().then(list => {
this.trainingOperateTypeMap['01'] = list.map(item => { this.trainingOperateTypeMap['01'] = list.map(item => {
let params = {} const params = {};
params.label = item.name; params.label = item.name;
params.value = item.code; params.value = item.code;
return params; return params;
});; // }); //
}); });
this.$Dictionary.signalOperation().then(list => { this.$Dictionary.signalOperation().then(list => {
this.trainingOperateTypeMap['02'] = list.map(item => { this.trainingOperateTypeMap['02'] = list.map(item => {
let params = {} const params = {};
params.label = item.name; params.label = item.name;
params.value = item.code; params.value = item.code;
return params; return params;
});; // }); //
}); });
this.$Dictionary.switchOperation().then(list => { this.$Dictionary.switchOperation().then(list => {
this.trainingOperateTypeMap['03'] = list.map(item => { this.trainingOperateTypeMap['03'] = list.map(item => {
let params = {} const params = {};
params.label = item.name; params.label = item.name;
params.value = item.code; params.value = item.code;
return params; return params;
});; // }); //
}); });
this.$Dictionary.sectionOperation().then(list => { this.$Dictionary.sectionOperation().then(list => {
this.trainingOperateTypeMap['04'] = list.map(item => { this.trainingOperateTypeMap['04'] = list.map(item => {
let params = {} const params = {};
params.label = item.name; params.label = item.name;
params.value = item.code; params.value = item.code;
return params; return params;
});; // }); //
}); });
this.$Dictionary.stationStandOperation().then(list => { this.$Dictionary.stationStandOperation().then(list => {
this.trainingOperateTypeMap['05'] = list.map(item => { this.trainingOperateTypeMap['05'] = list.map(item => {
let params = {} const params = {};
params.label = item.name; params.label = item.name;
params.value = item.code; params.value = item.code;
return params; return params;
});; // }); //
}); });
this.$Dictionary.trainPlanOperation().then(list => { this.$Dictionary.trainPlanOperation().then(list => {
this.trainingOperateTypeMap['06'] = list.map(item => { this.trainingOperateTypeMap['06'] = list.map(item => {
let params = {} const params = {};
params.label = item.name; params.label = item.name;
params.value = item.code; params.value = item.code;
return params; return params;
});; // }); //
}); });
this.$Dictionary.trainOperation().then(list => { this.$Dictionary.trainOperation().then(list => {
this.trainingOperateTypeMap['07'] = list.map(item => { this.trainingOperateTypeMap['07'] = list.map(item => {
let params = {} const params = {};
params.label = item.name; params.label = item.name;
params.value = item.code; params.value = item.code;
return params; return params;
});; // }); //
}); });
},
async show(data) {
this.loading = false;
this.dialogVisible = true;
if (data && data.id) {
//
const res = await getPlaceholderList({ trainingType: data.trainingType, skinStyle: data.skinStyle });
this.placeholderList = res.data;
this.formModel = {
id: data.id,
trainingName: this.repliceName(data.trainingName, this.placeholderList),
trainingType: data.trainingType,
operateType: data.operateType,
productTypes: data.productTypes,
skinStyle: data.skinStyle,
minDuration: data.minDuration,
maxDuration: data.maxDuration,
trainingRemark: this.repliceName(data.trainingRemark, this.placeholderList)
};
}
},
repliceName(fieldValue, enumList) {
if (enumList && enumList.length > 0) {
for (let i = 0; i < enumList.length; i++) {
if (fieldValue.includes(`{${enumList[i].id}}`)) {
fieldValue = fieldValue.replace(`{${enumList[i].id}}`, `{${enumList[i].name}}`);
}
}
return fieldValue;
}
},
changeList(val) {
//
getPlaceholderList({ trainingType: val, skinStyle: '02' }).then(res => {
this.placeholderList = res.data;
});
},
addTrainName(val) {
this.formModel.trainingName = `${this.formModel.trainingName}{${val.name}}`;
},
addTrainRemark(val) {
this.formModel.trainingRemark = `${this.formModel.trainingRemark}{${val.name}}`;
},
doSave() {
const self = this;
this.$refs.dataform.validateForm(() => {
if (self.type === 'ADD') {
self.create();
} else {
self.update();
}
});
},
create() {
const self = this;
this.placeholderList.forEach(item => {
if (this.formModel.trainingName.includes(`{${item.name}}`)) {
const name = this.formModel.trainingName.replace(`{${item.name}}`, `{${item.id}}`);
this.formModel.trainingName = name;
}
if (this.formModel.trainingRemark.includes(`{${item.name}}`)) {
const remark = this.formModel.trainingRemark.replace(`{${item.name}}`, `{${item.id}}`);
this.formModel.trainingRemark = remark;
}
});
}, this.loading = true;
async show(data) { postTrainingRulesData(this.formModel).then(response => {
this.loading = false; self.loading = false;
this.dialogVisible = true self.$message.success('创建操作定义成功');
if (data && data.id) { self.handleClose();
// self.$emit('reloadTable');
let res = await getPlaceholderList({ trainingType: data.trainingType, skinStyle: data.skinStyle }); }).catch(error => {
this.placeholderList = res.data; self.loading = false;
this.formModel = { self.$message.error('创建操作定义失败:' + error.message);
id: data.id, });
trainingName: this.repliceName(data.trainingName, this.placeholderList), },
trainingType: data.trainingType, update() {
operateType: data.operateType, const self = this;
productTypes: data.productTypes, this.placeholderList.forEach(item => {
skinStyle: data.skinStyle, if (this.formModel.trainingName.includes(`{${item.name}}`)) {
minDuration: data.minDuration, const name = this.formModel.trainingName.replace(`{${item.name}}`, `{${item.id}}`);
maxDuration: data.maxDuration, this.formModel.trainingName = name;
trainingRemark: this.repliceName(data.trainingRemark, this.placeholderList), }
}; if (this.formModel.trainingRemark.includes(`{${item.name}}`)) {
} const remark = this.formModel.trainingRemark.replace(`{${item.name}}`, `{${item.id}}`);
}, this.formModel.trainingRemark = remark;
repliceName(fieldValue, enumList) { }
if (enumList && enumList.length > 0) { });
for (let i = 0; enumList && i < enumList.length; i++) {
if (fieldValue.includes(`{${enumList[i].id}}`)) {
fieldValue = fieldValue.replace(`{${enumList[i].id}}`, `{${enumList[i].name}}`);
}
}
return fieldValue;
}
},
changeList(val) {
//
getPlaceholderList({ trainingType: val, skinStyle: '02' }).then(res => {
this.placeholderList = res.data;
})
},
addTrainName(val) {
this.formModel.trainingName = `${this.formModel.trainingName}{${val.name}}`
},
addTrainRemark(val) {
this.formModel.trainingRemark = `${this.formModel.trainingRemark}{${val.name}}`
},
doSave() {
let self = this
this.$refs.dataform.validateForm(() => {
if (self.type === 'ADD') {
self.create()
} else {
self.update()
}
})
},
create() {
let self = this
this.placeholderList.forEach(item => {
if (this.formModel.trainingName.includes(`{${item.name}}`)) {
let name = this.formModel.trainingName.replace(`{${item.name}}`, `{${item.id}}`);
this.formModel.trainingName = name;
}
if (this.formModel.trainingRemark.includes(`{${item.name}}`)) {
let remark = this.formModel.trainingRemark.replace(`{${item.name}}`, `{${item.id}}`);
this.formModel.trainingRemark = remark;
}
})
this.loading = true; this.loading = true;
postTrainingRulesData(this.formModel).then(response => { putTrainingRulesData(this.formModel).then(response => {
self.loading = false; self.loading = false;
self.$message.success('创建操作定义成功') self.$message.success('创建操作定义成功');
self.handleClose() self.handleClose();
self.$emit('reloadTable') self.$emit('reloadTable');
}).catch(error => { }).catch(error => {
self.loading = false; self.loading = false;
self.$message.error('创建操作定义失败:' + error.message) self.$message.error('创建操作定义失败:' + error.message);
}) });
}, },
update() { handleClose() {
let self = this this.formModel = {
this.placeholderList.forEach(item => { trainingName: '',
if (this.formModel.trainingName.includes(`{${item.name}}`)) { trainingType: '',
let name = this.formModel.trainingName.replace(`{${item.name}}`, `{${item.id}}`); operateType: '',
this.formModel.trainingName = name; skinStyle: '',
} minDuration: '',
if (this.formModel.trainingRemark.includes(`{${item.name}}`)) { maxDuration: '',
let remark = this.formModel.trainingRemark.replace(`{${item.name}}`, `{${item.id}}`); trainingRemark: ''
this.formModel.trainingRemark = remark; };
} this.$refs.dataform.resetForm();
}) this.dialogVisible = false;
}
this.loading = true; }
putTrainingRulesData(this.formModel).then(response => { };
self.loading = false; </script>
self.$message.success('创建操作定义成功')
self.handleClose()
self.$emit('reloadTable')
}).catch(error => {
self.loading = false;
self.$message.error('创建操作定义失败:' + error.message)
})
},
handleClose() {
this.formModel = {
trainingName: '',
trainingType: '',
operateType: '',
skinStyle: '',
minDuration: '',
maxDuration: '',
trainingRemark: '',
}
this.$refs.dataform.resetForm()
this.dialogVisible = false
}
}
}
</script>

View File

@ -61,7 +61,7 @@
title: '设备类型', title: '设备类型',
prop: 'deviceType', prop: 'deviceType',
type: 'tag', type: 'tag',
columnValue: (row) => { return this.convertField(row.deviceType, this.deviceList, ['value', 'label']) }, columnValue: (row) => { return this.$convertField(row.deviceType, this.deviceList, ['value', 'label']) },
tagType: (row) => { return 'success' } tagType: (row) => { return 'success' }
}, },
{ {
@ -136,18 +136,6 @@
queryFunction(params) { queryFunction(params) {
return getOperateStepDataList(this.dicId, params) return getOperateStepDataList(this.dicId, params)
}, },
//
convertField(fieldValue, enumList, converFormat) {
if (converFormat && converFormat.length >= 2) {
let value = converFormat[0];
let label = converFormat[1];
for (let i = 0; enumList && i < enumList.length; i++) {
if ('' + fieldValue === '' + enumList[i][value]) {
return enumList[i][label];
}
}
}
},
handleEdit(index, row) { handleEdit(index, row) {
this.$refs.edit.show(row) this.$refs.edit.show(row)
}, },

View File

@ -72,21 +72,21 @@
title: '皮肤类型', title: '皮肤类型',
prop: 'skinStyle', prop: 'skinStyle',
type: 'tag', type: 'tag',
columnValue: (row) => { return this.convertField(row.skinStyle, this.skinStyleList, ['code', 'name']) }, columnValue: (row) => { return this.$convertField(row.skinStyle, this.skinStyleList, ['code', 'name']) },
tagType: (row) => { return '' } tagType: (row) => { return '' }
}, },
{ {
title: '实训类型', title: '实训类型',
prop: 'trainingType', prop: 'trainingType',
type: 'tag', type: 'tag',
columnValue: (row) => { return this.convertField(row.trainingType, this.trainingTypeList, ['code', 'name']) }, columnValue: (row) => { return this.$convertField(row.trainingType, this.trainingTypeList, ['code', 'name']) },
tagType: (row) => { return 'success' } tagType: (row) => { return 'success' }
}, },
{ {
title: '操作类型', title: '操作类型',
prop: 'operateType', prop: 'operateType',
type: 'tag', type: 'tag',
columnValue: (row) => { return this.convertField(row.operateType, this.trainingOperateTypeMap[row.trainingType], ['code', 'name']) }, columnValue: (row) => { return this.$convertField(row.operateType, this.trainingOperateTypeMap[row.trainingType], ['code', 'name']) },
tagType: (row) => { return 'success' } tagType: (row) => { return 'success' }
}, },
{ {
@ -205,17 +205,6 @@
return fieldValue; return fieldValue;
} }
}, },
convertField(fieldValue, enumList, converFormat) {
if (converFormat && converFormat.length >= 2) {
let value = converFormat[0];
let label = converFormat[1];
for (let i = 0; enumList && i < enumList.length; i++) {
if ('' + fieldValue === '' + enumList[i][value]) {
return enumList[i][label];
}
}
}
},
// //
typeChoose(form) { typeChoose(form) {
this.queryForm.queryObject.operateType.config.data = []; this.queryForm.queryObject.operateType.config.data = [];

View File

@ -99,28 +99,28 @@ export default {
title: '皮肤类型', title: '皮肤类型',
prop: 'skinStyle', prop: 'skinStyle',
type: 'tag', type: 'tag',
columnValue: (row) => { return this.convertField(row.skinStyle, this.skinStyleList, ['code', 'name']); }, columnValue: (row) => { return this.$convertField(row.skinStyle, this.skinStyleList, ['code', 'name']); },
tagType: (row) => { return ''; } tagType: (row) => { return ''; }
}, },
{ {
title: '产品', title: '产品',
prop: 'prdCode', prop: 'prdCode',
type: 'tag', type: 'tag',
columnValue: (row) => { return this.convertField(row.prdCode, this.prdTypeList, ['code', 'name']); }, columnValue: (row) => { return this.$convertField(row.prdCode, this.prdTypeList, ['code', 'name']); },
tagType: (row) => { return 'success'; } tagType: (row) => { return 'success'; }
}, },
{ {
title: '实训类型', title: '实训类型',
prop: 'type', prop: 'type',
type: 'tag', type: 'tag',
columnValue: (row) => { return this.convertField(row.type, this.trainingTypeList, ['code', 'name']); }, columnValue: (row) => { return this.$convertField(row.type, this.trainingTypeList, ['code', 'name']); },
tagType: (row) => { return 'success'; } tagType: (row) => { return 'success'; }
}, },
{ {
title: '操作类型', title: '操作类型',
prop: 'operateType', prop: 'operateType',
type: 'tag', type: 'tag',
columnValue: (row) => { return this.convertField(row.operateType, this.trainingOperateTypeMap[row.type], ['code', 'name']); }, columnValue: (row) => { return this.$convertField(row.operateType, this.trainingOperateTypeMap[row.type], ['code', 'name']); },
tagType: (row) => { return 'success'; } tagType: (row) => { return 'success'; }
}, },
{ {

View File

@ -1,155 +1,153 @@
<template> <template>
<el-dialog :title="title" :visible.sync="dialogVisible" width="30%" :before-close="handleClose" center> <el-dialog :title="title" :visible.sync="dialogVisible" width="30%" :before-close="handleClose" center>
<data-form ref="dataform" :form="form" :formModel="formModel" :rules="rules"></data-form> <data-form ref="dataform" :form="form" :form-model="formModel" :rules="rules" />
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
<el-button type="primary" @click="doSave"> </el-button> <el-button type="primary" @click="doSave"> </el-button>
<el-button @click="dialogVisible = false"> </el-button> <el-button @click="dialogVisible = false"> </el-button>
</span> </span>
</el-dialog> </el-dialog>
</template> </template>
<script> <script>
import { create, checkDicCodeExist, getData, update } from '@/api/management/dictionary' import { create, checkDicCodeExist, getData, update } from '@/api/management/dictionary';
import { validateCharCode } from '@/utils/validate' import { validateCharCode } from '@/utils/validate';
export default { export default {
name: 'DictionaryEdit', name: 'DictionaryEdit',
props: { props: {
type: { type: {
type: String, type: String,
required: true required: true
} }
}, },
data() { data() {
return { return {
dialogVisible: false, dialogVisible: false,
formModel: { formModel: {
code: '', code: '',
name: '', name: '',
status: '1', status: '1',
remarks: '' remarks: ''
} }
} };
}, },
computed: { computed: {
form() { form() {
let isAdd = this.type === 'ADD' const isAdd = this.type === 'ADD';
let form = { const form = {
labelWidth: '60px', labelWidth: '60px',
items: [ items: [
{ prop: 'code', label: '编码', type: 'text', required: true, disabled: !isAdd }, { prop: 'code', label: '编码', type: 'text', required: true, disabled: !isAdd },
{ prop: 'name', label: '名称', type: 'text', required: true }, { prop: 'name', label: '名称', type: 'text', required: true },
{ {
prop: 'status', label: '状态', type: 'select', required: true, options: this.$ConstSelect.Status prop: 'status', label: '状态', type: 'select', required: true, options: this.$ConstSelect.Status
}, },
{ prop: 'remarks', label: '备注', type: 'textarea', required: false }, { prop: 'remarks', label: '备注', type: 'textarea', required: false }
] ]
} };
return form return form;
}, },
rules() { rules() {
let crules = { const crules = {
name: [ name: [
{ required: true, message: '请输入名称', trigger: 'blur' }, { required: true, message: '请输入名称', trigger: 'blur' },
{ min: 1, max: 25, message: '长度在 1 到 25 个字符', trigger: 'blur' } { min: 1, max: 25, message: '长度在 1 到 25 个字符', trigger: 'blur' }
], ],
status: [ status: [
{ required: true, message: '请选择状态', trigger: 'change' } { required: true, message: '请选择状态', trigger: 'change' }
], ],
remarks: [ remarks: [
{ max: 50, message: '不能超过 50 个字符', trigger: 'blur' } { max: 50, message: '不能超过 50 个字符', trigger: 'blur' }
] ]
} };
if (this.type === 'ADD') { if (this.type === 'ADD') {
return Object.assign(crules, { return Object.assign(crules, {
code: [ code: [
{ required: true, message: '请输入编码', trigger: 'blur' }, { required: true, message: '请输入编码', trigger: 'blur' },
{ min: 1, max: 25, message: '长度在 1 到 25 个字符', trigger: 'blur' }, { min: 1, max: 25, message: '长度在 1 到 25 个字符', trigger: 'blur' },
{ validator: this.validateCode, trigger: 'blur' } { validator: this.validateCode, trigger: 'blur' }
] ]
}) });
} else { } else {
return crules return crules;
} }
}, },
title() { title() {
if (this.type === 'ADD') { if (this.type === 'ADD') {
return '创建目录' return '创建目录';
} else { } else {
return '编辑目录' return '编辑目录';
} }
} }
}, },
methods: { methods: {
validateCode(rule, value, callback) { validateCode(rule, value, callback) {
if (!validateCharCode(value)) { if (!validateCharCode(value)) {
return callback(new Error('格式不正确,只能是字符/数字/_')) return callback(new Error('格式不正确,只能是字符/数字/_'));
} else { } else {
checkDicCodeExist(value).then(response => { checkDicCodeExist(value).then(response => {
if (response.data) { if (response.data) {
return callback(new Error('编码已存在')) return callback(new Error('编码已存在'));
} else { } else {
return callback() return callback();
} }
}).catch(error => { }).catch(() => {
return callback(new Error('服务异常')) return callback(new Error('服务异常'));
}) });
} }
}, },
show(id) { show(id) {
this.dialogVisible = true this.dialogVisible = true;
if (id) { if (id) {
getData(id).then(response => { getData(id).then(response => {
this.formModel = response.data this.formModel = response.data;
this.$refs.dataform.resetForm() this.$refs.dataform.resetForm();
}).catch(error => { });
}
}) },
} doSave() {
}, const self = this;
doSave() { this.$refs.dataform.validateForm(() => {
let self = this if (self.type === 'ADD') {
this.$refs.dataform.validateForm(() => { self.create();
if (self.type === 'ADD') { } else {
self.create() self.update();
} else { }
self.update() });
} },
}) create() {
}, const self = this;
create() { create(this.formModel).then(response => {
let self = this self.$message.success('创建字典目录成功');
create(this.formModel).then(response => { self.handleClose();
self.$message.success('创建字典目录成功') self.$emit('reloadTable');
self.handleClose() }).catch(error => {
self.$emit('reloadTable') self.$message.error('创建字典目录失败:' + error.message);
}).catch(error => { });
self.$message.error('创建字典目录失败:' + error.message) },
}) update() {
}, const self = this;
update() { update(this.formModel).then(response => {
let self = this self.$message.success('更新字典目录成功');
update(this.formModel).then(response => { self.handleClose();
self.$message.success('更新字典目录成功') self.$emit('reloadTable');
self.handleClose() }).catch(error => {
self.$emit('reloadTable') self.$message.error('更新字典目录失败:' + error.message);
}).catch(error => { });
self.$message.error('更新字典目录失败:' + error.message) },
}) handleClose(done) {
}, this.formModel = {
handleClose(done) { code: '',
this.formModel = { name: '',
code: '', status: '1',
name: '', remarks: ''
status: '1', };
remarks: '' this.$refs.dataform.resetForm();
} if (done) {
this.$refs.dataform.resetForm() done();
if (done) { } else {
done() this.dialogVisible = false;
} else { }
this.dialogVisible = false }
} }
} };
} </script>
}
</script>

View File

@ -1,138 +1,137 @@
<template> <template>
<div> <div>
<QueryListPage ref="queryListPage" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList"> <QueryListPage ref="queryListPage" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" />
</QueryListPage> <dictionary-edit ref="create" type="ADD" @reloadTable="reloadTable" />
<dictionary-edit ref="create" type="ADD" @reloadTable="reloadTable"></dictionary-edit> <dictionary-edit ref="edit" type="EDIT" @reloadTable="reloadTable" />
<dictionary-edit ref="edit" type="EDIT" @reloadTable="reloadTable"></dictionary-edit> </div>
</div>
</template> </template>
<script> <script>
import { list, create, del } from '@/api/management/dictionary' import { list, del } from '@/api/management/dictionary';
import DictionaryEdit from '@/views/management/dictionary/edit' import DictionaryEdit from '@/views/management/dictionary/edit';
export default { export default {
name: 'Dictionary', name: 'Dictionary',
components: { components: {
DictionaryEdit DictionaryEdit
}, },
data() { data() {
return { return {
pagerConfig: { pagerConfig: {
pageSize: 'pageSize', pageSize: 'pageSize',
pageIndex: 'pageNum' pageIndex: 'pageNum'
}, },
queryForm: { queryForm: {
labelWidth: '80px', labelWidth: '80px',
reset: true, reset: true,
queryObject: { queryObject: {
code: { code: {
type: 'text', type: 'text',
label: '编码' label: '编码'
}, },
name: { name: {
type: 'text', type: 'text',
label: '名称' label: '名称'
}, },
status: { status: {
type: 'select', type: 'select',
label: '状态', label: '状态',
config: { config: {
data: this.$ConstSelect.Status data: this.$ConstSelect.Status
} }
} }
} }
}, },
queryList: { queryList: {
query: list, query: list,
selectCheckShow: false, selectCheckShow: false,
indexShow: true, indexShow: true,
columns: [ columns: [
{ {
title: '编码', title: '编码',
prop: 'code' prop: 'code'
}, },
{ {
title: '名称', title: '名称',
prop: 'name' prop: 'name'
}, },
{ {
title: '状态', title: '状态',
prop: 'status', prop: 'status',
type: 'tag', type: 'tag',
columnValue: (row) => { return this.$ConstSelect.translate(row.status, 'Status') }, columnValue: (row) => { return this.$ConstSelect.translate(row.status, 'Status'); },
tagType: (row) => { if (row.status === '0') { return 'danger' } else { return 'success' } } tagType: (row) => { if (row.status === '0') { return 'danger'; } else { return 'success'; } }
}, },
{ {
title: '说明', title: '说明',
prop: 'remarks' prop: 'remarks'
}, },
{ {
type: 'button', type: 'button',
title: '操作', title: '操作',
width: '250', width: '250',
buttons: [ buttons: [
{ {
name: '字典明细', name: '字典明细',
handleClick: this.handleViewDetail handleClick: this.handleViewDetail
}, },
{ {
name: '编辑', name: '编辑',
handleClick: this.handleEdit handleClick: this.handleEdit
}, },
{ {
name: '删除', name: '删除',
handleClick: this.handleDelete, handleClick: this.handleDelete,
type: 'danger' type: 'danger'
}, }
] ]
} }
], ],
actions: [ actions: [
{ text: '新增', handler: this.handleAdd }, { text: '新增', handler: this.handleAdd }
// { text: '', btnCode: 'employee_delete', handler: this.handleBatchDelete, type: 'danger' } // { text: '', btnCode: 'employee_delete', handler: this.handleBatchDelete, type: 'danger' }
] ]
}, },
currentModel: {} currentModel: {}
} };
}, },
methods: { methods: {
handleViewDetail(index, row) { handleViewDetail(index, row) {
this.$router.push({ path: `/system/dictionary/detail`, query: { id: row.id } }) this.$router.push({ path: `/system/dictionary/detail`, query: { id: row.id } });
}, },
handleEdit(index, row) { handleEdit(index, row) {
this.$refs.edit.show(row.id) this.$refs.edit.show(row.id);
}, },
handleAdd() { handleAdd() {
this.$refs.create.show() this.$refs.create.show();
}, },
handleBatchDelete() { handleBatchDelete() {
}, },
handleDelete(index, row) { handleDelete(index, row) {
this.$confirm('此操作将删除该类型, 是否继续?', '提示', { this.$confirm('此操作将删除该类型, 是否继续?', '提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
del(row.id).then(response => { del(row.id).then(response => {
this.$message.success('删除成功') this.$message.success('删除成功');
this.reloadTable() this.reloadTable();
}).catch(error => { }).catch(() => {
this.reloadTable() this.reloadTable();
this.$messageBox('删除失败') this.$messageBox('删除失败');
}) });
}) });
}, },
reloadTable() { reloadTable() {
this.queryList.reload() this.queryList.reload();
} }
} }
} };
</script> </script>

View File

@ -1,159 +1,157 @@
<template> <template>
<el-dialog :title="title" :visible.sync="dialogVisible" width="30%" :before-close="handleClose" center> <el-dialog :title="title" :visible.sync="dialogVisible" width="30%" :before-close="handleClose" center>
<data-form ref="dataform" :form="form" :formModel="formModel" :rules="rules"></data-form> <data-form ref="dataform" :form="form" :form-model="formModel" :rules="rules" />
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
<el-button type="primary" @click="doSave"> </el-button> <el-button type="primary" @click="doSave"> </el-button>
<el-button @click="dialogVisible = false"> </el-button> <el-button @click="dialogVisible = false"> </el-button>
</span> </span>
</el-dialog> </el-dialog>
</template> </template>
<script> <script>
import { create, checkDicDetailCodeExist, getData, update } from '@/api/management/dictionaryDetail' import { create, checkDicDetailCodeExist, getData, update } from '@/api/management/dictionaryDetail';
import { validateCharCode } from '@/utils/validate' import { validateCharCode } from '@/utils/validate';
export default { export default {
name: 'DictionaryDetailEdit', name: 'DictionaryDetailEdit',
props: { props: {
type: { type: {
type: String, type: String,
required: true required: true
}, },
dicId: { dicId: {
type: String, type: String,
required: true required: true
} }
}, },
data() { data() {
return { return {
dialogVisible: false, dialogVisible: false,
formModel: { formModel: {
code: '', code: '',
name: '', name: '',
status: '1', status: '1',
remarks: '' remarks: ''
} }
} };
}, },
computed: { computed: {
form() { form() {
let isAdd = this.type === 'ADD' const isAdd = this.type === 'ADD';
let form = { const form = {
labelWidth: '60px', labelWidth: '60px',
items: [ items: [
{ prop: 'code', label: '编码', type: 'text', required: true, disabled: !isAdd }, { prop: 'code', label: '编码', type: 'text', required: true, disabled: !isAdd },
{ prop: 'name', label: '名称', type: 'text', required: true }, { prop: 'name', label: '名称', type: 'text', required: true },
{ {
prop: 'status', label: '状态', type: 'select', required: true, options: this.$ConstSelect.Status prop: 'status', label: '状态', type: 'select', required: true, options: this.$ConstSelect.Status
}, },
{ prop: 'remarks', label: '备注', type: 'textarea', required: false }, { prop: 'remarks', label: '备注', type: 'textarea', required: false }
] ]
} };
return form return form;
}, },
rules() { rules() {
let crules = { const crules = {
name: [ name: [
{ required: true, message: '请输入名称', trigger: 'blur' }, { required: true, message: '请输入名称', trigger: 'blur' },
{ min: 1, max: 25, message: '长度在 1 到 25 个字符', trigger: 'blur' } { min: 1, max: 25, message: '长度在 1 到 25 个字符', trigger: 'blur' }
], ],
status: [ status: [
{ required: true, message: '请选择状态', trigger: 'change' } { required: true, message: '请选择状态', trigger: 'change' }
], ],
remarks: [ remarks: [
{ max: 50, message: '不能超过 50 个字符', trigger: 'blur' } { max: 50, message: '不能超过 50 个字符', trigger: 'blur' }
] ]
} };
if (this.type === 'ADD') { if (this.type === 'ADD') {
return Object.assign(crules, { return Object.assign(crules, {
code: [ code: [
{ required: true, message: '请输入编码', trigger: 'blur' }, { required: true, message: '请输入编码', trigger: 'blur' },
{ min: 1, max: 25, message: '长度在 1 到 25 个字符', trigger: 'blur' }, { min: 1, max: 25, message: '长度在 1 到 25 个字符', trigger: 'blur' },
{ validator: this.validateCode, trigger: 'blur' } { validator: this.validateCode, trigger: 'blur' }
] ]
}) });
} else { } else {
return crules return crules;
} }
}, },
title() { title() {
if (this.type === 'ADD') { if (this.type === 'ADD') {
return '创建明细' return '创建明细';
} else { } else {
return '编辑明细' return '编辑明细';
} }
} }
}, },
methods: { methods: {
validateCode(rule, value, callback) { validateCode(rule, value, callback) {
if (!validateCharCode(value)) { if (!validateCharCode(value)) {
return callback(new Error('格式不正确,只能是字符/数字/_')) return callback(new Error('格式不正确,只能是字符/数字/_'));
} else { } else {
checkDicDetailCodeExist(this.dicId, value).then(response => { checkDicDetailCodeExist(this.dicId, value).then(response => {
if (response.data) { if (response.data) {
return callback(new Error('编码已存在')) return callback(new Error('编码已存在'));
} else { } else {
return callback() return callback();
} }
}).catch(error => { }).catch(() => {
return callback(new Error('服务异常')) return callback(new Error('服务异常'));
}) });
} }
}, },
show(id) { show(id) {
this.dialogVisible = true this.dialogVisible = true;
if (id) { if (id) {
getData(this.dicId, id).then(response => { getData(this.dicId, id).then(response => {
this.formModel = response.data this.formModel = response.data;
this.$refs.dataform.resetForm() this.$refs.dataform.resetForm();
}).catch(error => { });
}
}) },
} doSave() {
}, const self = this;
doSave() { this.$refs.dataform.validateForm(() => {
let self = this if (self.type === 'ADD') {
this.$refs.dataform.validateForm(() => { self.create();
if (self.type === 'ADD') { } else {
self.create() self.update();
} else { }
self.update() });
} },
}) create() {
}, const self = this;
create() { create(this.dicId, this.formModel).then(response => {
let self = this self.$message.success('创建字典目录成功');
create(this.dicId, this.formModel).then(response => { self.handleClose();
self.$message.success('创建字典目录成功') self.$emit('reloadTable');
self.handleClose() }).catch(error => {
self.$emit('reloadTable') self.$message.error('创建字典目录失败:' + error.message);
}).catch(error => { });
self.$message.error('创建字典目录失败:' + error.message) },
}) update() {
}, const self = this;
update() { update(this.dicId, this.formModel).then(response => {
let self = this self.$message.success('更新字典目录成功');
update(this.dicId, this.formModel).then(response => { self.handleClose();
self.$message.success('更新字典目录成功') self.$emit('reloadTable');
self.handleClose() }).catch(error => {
self.$emit('reloadTable') self.$message.error('更新字典目录失败:' + error.message);
}).catch(error => { });
self.$message.error('更新字典目录失败:' + error.message) },
}) handleClose(done) {
}, this.formModel = {
handleClose(done) { code: '',
this.formModel = { name: '',
code: '', status: '1',
name: '', remarks: ''
status: '1', };
remarks: '' this.$refs.dataform.resetForm();
} if (done) {
this.$refs.dataform.resetForm() done();
if (done) { } else {
done() this.dialogVisible = false;
} else { }
this.dialogVisible = false }
} }
} };
} </script>
}
</script>

View File

@ -1,161 +1,156 @@
<template> <template>
<div> <div>
<!-- <turnback-bar :title="turnbackBarTitle"></turnback-bar> --> <!-- <turnback-bar :title="turnbackBarTitle"></turnback-bar> -->
<QueryListPage ref="queryListPage" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList"> <QueryListPage ref="queryListPage" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" />
</QueryListPage> <div class="draft">
<div class="draft"> <el-button-group>
<el-button-group> <el-button type="primary" @click="turnback">返回</el-button>
<el-button type="primary" @click="turnback">返回</el-button> </el-button-group>
</el-button-group>
</div>
<dictionary-detail-edit ref="create" type="ADD" :dicId="dicId" @reloadTable="reloadTable">
</dictionary-detail-edit>
<dictionary-detail-edit ref="edit" type="EDIT" :dicId="dicId" @reloadTable="reloadTable">
</dictionary-detail-edit>
</div> </div>
<dictionary-detail-edit ref="create" type="ADD" :dic-id="dicId" @reloadTable="reloadTable" />
<dictionary-detail-edit ref="edit" type="EDIT" :dic-id="dicId" @reloadTable="reloadTable" />
</div>
</template> </template>
<script> <script>
import { list, create, del } from '@/api/management/dictionaryDetail' import { list, del } from '@/api/management/dictionaryDetail';
import { getData } from '@/api/management/dictionary' import { getData } from '@/api/management/dictionary';
import DictionaryDetailEdit from '@/views/management/dictionaryDetail/edit' import DictionaryDetailEdit from '@/views/management/dictionaryDetail/edit';
export default { export default {
name: 'DictionaryDetail', name: 'DictionaryDetail',
components: { components: {
DictionaryDetailEdit DictionaryDetailEdit
}, },
data() { data() {
return { return {
dicId: '', dicId: '',
dic: {}, dic: {},
pagerConfig: { pagerConfig: {
pageSize: 'pageSize', pageSize: 'pageSize',
pageIndex: 'pageNum' pageIndex: 'pageNum'
}, },
queryForm: { queryForm: {
labelWidth: '80px', labelWidth: '80px',
reset: true, reset: true,
queryObject: { queryObject: {
code: { code: {
type: 'text', type: 'text',
label: '编码' label: '编码'
}, },
name: { name: {
type: 'text', type: 'text',
label: '名称' label: '名称'
}, },
status: { status: {
type: 'select', type: 'select',
label: '状态', label: '状态',
config: { config: {
data: this.$ConstSelect.Status data: this.$ConstSelect.Status
} }
} }
} }
}, },
queryList: { queryList: {
query: this.queryFunction, query: this.queryFunction,
selectCheckShow: false, selectCheckShow: false,
indexShow: true, indexShow: true,
columns: [ columns: [
{ {
title: '编码', title: '编码',
prop: 'code' prop: 'code'
}, },
{ {
title: '名称', title: '名称',
prop: 'name' prop: 'name'
}, },
{ {
title: '状态', title: '状态',
prop: 'status', prop: 'status',
type: 'tag', type: 'tag',
columnValue: (row) => { return this.$ConstSelect.translate(row.status, 'Status') }, columnValue: (row) => { return this.$ConstSelect.translate(row.status, 'Status'); },
tagType: (row) => { if (row.status === '0') { return 'danger' } else { return 'success' } } tagType: (row) => { if (row.status === '0') { return 'danger'; } else { return 'success'; } }
}, },
{ {
title: '说明', title: '说明',
prop: 'remarks' prop: 'remarks'
}, },
{ {
type: 'button', type: 'button',
title: '操作', title: '操作',
width: '250', width: '250',
buttons: [ buttons: [
{ {
name: '编辑', name: '编辑',
handleClick: this.handleEdit handleClick: this.handleEdit
}, },
{ {
name: '删除', name: '删除',
handleClick: this.handleDelete, handleClick: this.handleDelete,
type: 'danger' type: 'danger'
}, }
] ]
} }
], ],
actions: [ actions: [
{ text: '新增', btnCode: 'employee_insert', handler: this.handleAdd }, { text: '新增', btnCode: 'employee_insert', handler: this.handleAdd }
// { text: '', btnCode: 'employee_delete', handler: this.handleBatchDelete, type: 'danger' } // { text: '', btnCode: 'employee_delete', handler: this.handleBatchDelete, type: 'danger' }
] ]
}, },
currentModel: {} currentModel: {}
} };
}, },
// computed: { // computed: {
// turnbackBarTitle() { // turnbackBarTitle() {
// return this.dic.name + '(' + this.dic.code + ')' // return this.dic.name + '(' + this.dic.code + ')'
// } // }
// }, // },
created() { created() {
this.dicId = this.$route.query.id; this.dicId = this.$route.query.id;
getData(this.dicId).then(response => { getData(this.dicId).then(response => {
this.dic = response.data this.dic = response.data;
}).catch(error => { });
},
}) methods: {
}, queryFunction(params) {
return list(this.dicId, params);
},
methods: { handleEdit(index, row) {
queryFunction(params) { this.$refs.edit.show(row.id);
return list(this.dicId, params) },
},
handleEdit(index, row) { handleAdd() {
this.$refs.edit.show(row.id) this.$refs.create.show();
}, },
handleAdd() { handleBatchDelete() {
this.$refs.create.show()
},
handleBatchDelete() { },
}, handleDelete(index, row) {
del(this.dicId, row.id).then(response => {
this.$message.success('删除成功');
this.reloadTable();
}).catch(() => {
this.reloadTable();
this.$messageBox('删除失败');
});
},
handleDelete(index, row) { reloadTable() {
del(this.dicId, row.id).then(response => { this.queryList.reload();
this.$message.success('删除成功') },
this.reloadTable()
}).catch(error => {
this.reloadTable()
this.$messageBox('删除失败')
})
},
reloadTable() { turnback() {
this.queryList.reload() this.$router.go(-1);
}, }
}
turnback() { };
this.$router.go(-1)
}
}
}
</script> </script>
<style rel="stylesheet/scss" lang="scss" scoped> <style rel="stylesheet/scss" lang="scss" scoped>
.draft { .draft {
@ -163,4 +158,4 @@
text-align: center; text-align: center;
margin: 20px auto; margin: 20px auto;
} }
</style> </style>

View File

@ -1,206 +1,194 @@
<template> <template>
<div> <div>
<QueryListPage ref="queryListPage" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList"> <QueryListPage ref="queryListPage" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" />
</QueryListPage>
</div> </div>
</template> </template>
<script> <script>
import { getExistingSimulation,deleteExistingSimulation } from '@/api/simulation'; import { getExistingSimulation, deleteExistingSimulation } from '@/api/simulation';
export default { export default {
name: 'SimulationManage', name: 'SimulationManage',
components: { components: {
}, },
data() { data() {
return { return {
examResultList: [], examResultList: [],
LessonList: [], LessonList: [],
mapList: [], mapList: [],
pagerConfig: { pagerConfig: {
pageSize: 'pageSize', pageSize: 'pageSize',
pageIndex: 'pageNum' pageIndex: 'pageNum'
}, },
queryForm: { queryForm: {
labelWidth: '100px', labelWidth: '100px',
reset: true, reset: true,
queryObject: { queryObject: {
group: { group: {
type: 'text', type: 'text',
label: '仿真Group' label: '仿真Group'
}, },
userName: { userName: {
type: 'text', type: 'text',
label: '用户名' label: '用户名'
}, },
mobile: { mobile: {
type: 'text', type: 'text',
label: '手机号' label: '手机号'
}, },
skinCode: { skinCode: {
type: 'select', type: 'select',
label: '皮肤编号', label: '皮肤编号',
config: { config: {
data: this.$ConstSelect.skinCode data: this.$ConstSelect.skinCode
} }
}, },
prdType: { prdType: {
type: 'select', type: 'select',
label: '产品类型', label: '产品类型',
config: { config: {
data: [] data: []
} }
}, },
type: { type: {
type: 'select', type: 'select',
label: '仿真类型', label: '仿真类型',
config: { config: {
data: this.$ConstSelect.SimulationType data: this.$ConstSelect.SimulationType
} }
} }
} }
}, },
queryList: { queryList: {
query: getExistingSimulation, query: getExistingSimulation,
selectCheckShow: false, selectCheckShow: false,
indexShow: true, indexShow: true,
columns: [ columns: [
{ {
title: '用户名称', title: '用户名称',
prop: 'creator.name' prop: 'creator.name'
}, },
{ {
title: '用户电话', title: '用户电话',
prop: 'creator.mobile' prop: 'creator.mobile'
}, },
{ {
title: 'Group', title: 'Group',
prop: 'group' prop: 'group'
}, },
{ {
title: '是否错误', title: '是否错误',
prop: 'error', prop: 'error',
type: 'tag', type: 'tag',
columnValue: (row) => { return this.$ConstSelect.translate(row.error, 'Whether') }, columnValue: (row) => { return this.$ConstSelect.translate(row.error, 'Whether'); },
tagType: (row) => { tagType: (row) => {
switch (row.error) { switch (row.error) {
case true: return 'success'; case true: return 'success';
case false: return 'danger'; case false: return 'danger';
} }
} }
}, },
{ {
title: '产品', title: '产品',
prop: 'mapPrdVO.name' prop: 'mapPrdVO.name'
}, },
{ {
title: '是否暂停', title: '是否暂停',
prop: 'pause', prop: 'pause',
type: 'tag', type: 'tag',
columnValue: (row) => { return this.$ConstSelect.translate(row.pause, 'Whether') }, columnValue: (row) => { return this.$ConstSelect.translate(row.pause, 'Whether'); },
tagType: (row) => { tagType: (row) => {
switch (row.pause) { switch (row.pause) {
case true: return 'success'; case true: return 'success';
case false: return 'danger'; case false: return 'danger';
} }
} }
}, },
{ {
title: '是否按计划行车', title: '是否按计划行车',
prop: 'runAsPlan', prop: 'runAsPlan',
type: 'tag', type: 'tag',
columnValue: (row) => { return this.$ConstSelect.translate(row.runAsPlan, 'Whether') }, columnValue: (row) => { return this.$ConstSelect.translate(row.runAsPlan, 'Whether'); },
tagType: (row) => { tagType: (row) => {
switch (row.runAsPlan) { switch (row.runAsPlan) {
case true: return 'success'; case true: return 'success';
case false: return 'danger'; case false: return 'danger';
} }
} }
}, },
{ {
title: '皮肤编号', title: '皮肤编号',
prop: 'skinCode', prop: 'skinCode',
type: 'tag', type: 'tag',
columnValue: (row) => { return this.convertField(row.skinCode, this.$ConstSelect.skinCode, ['value', 'label'])}, columnValue: (row) => { return this.$convertField(row.skinCode, this.$ConstSelect.skinCode, ['value', 'label']); },
tagType: (row) => { return 'success' } tagType: (row) => { return 'success'; }
}, },
{ {
title: '仿真类型', title: '仿真类型',
prop: 'type', prop: 'type',
type: 'tag', type: 'tag',
columnValue: (row) => { return this.convertField(row.type, this.$ConstSelect.SimulationType, ['value', 'label']) }, columnValue: (row) => { return this.$convertField(row.type, this.$ConstSelect.SimulationType, ['value', 'label']); },
tagType: (row) => { return 'success' } tagType: (row) => { return 'success'; }
}, },
{ {
title: '仿真成员ID', title: '仿真成员ID',
prop: 'sessionList', prop: 'sessionList',
type: 'basicText', type: 'basicText',
columnValue: (row) => { return this.listJoiningTogether(row.sessionList) } columnValue: (row) => { return this.listJoiningTogether(row.sessionList); }
}, },
{ {
type: 'button', type: 'button',
title: '操作', title: '操作',
// width: '250', // width: '250',
buttons: [ buttons: [
{ {
name: '销毁', name: '销毁',
handleClick: this.handleDelete, handleClick: this.handleDelete,
type: 'danger', type: 'danger'
}, }
] ]
} }
], ]
}, },
currentModel: {} currentModel: {}
} };
}, },
created() { created() {
this.$Dictionary.productType().then(list => { this.$Dictionary.productType().then(list => {
list.forEach(elem => { list.forEach(elem => {
this.queryForm.queryObject.prdType.config.data.push({ value: elem.code, label: elem.name }); this.queryForm.queryObject.prdType.config.data.push({ value: elem.code, label: elem.name });
}); });
}); });
}, },
methods: { methods: {
convertField(fieldValue, enumList, converFormat) { listJoiningTogether(sessionList) {
if (converFormat && converFormat.length >= 2) { let sessionId = '';
let value = converFormat[0]; if (sessionList.length>0) {
let label = converFormat[1]; sessionList.forEach((item) => {
for (let i = 0; enumList && i < enumList.length; i++) { sessionId = sessionId+item+',';
if ('' + fieldValue === '' + enumList[i][value]) { });
return enumList[i][label]; sessionId = sessionId.substring(0, sessionId.length-1);
} }
} return sessionId;
} },
}, handleDelete(index, row) {
listJoiningTogether(sessionList) { this.$confirm('此操作将删除此用户仿真数据, 是否继续?', '提示', {
let sessionId = ''; confirmButtonText: '确定',
if(sessionList.length>0){ cancelButtonText: '取消',
sessionList.forEach((item) => { type: 'warning'
sessionId = sessionId+item+','; }).then(() => {
}); deleteExistingSimulation(row.group).then(response => {
sessionId = sessionId.substring(0,sessionId.length-1); this.$message.success('删除成功');
} this.reloadTable();
return sessionId; }).catch(() => {
}, this.reloadTable();
handleDelete(index, row) { this.$messageBox('删除失败');
this.$confirm('此操作将删除此用户仿真数据, 是否继续?', '提示', { });
confirmButtonText: '确定', });
cancelButtonText: '取消', },
type: 'warning' reloadTable() {
}).then(() => { this.queryList.reload();
deleteExistingSimulation(row.group).then(response => { }
this.$message.success('删除成功'); }
this.reloadTable() };
}).catch(error => {
this.reloadTable();
this.$messageBox('删除失败')
})
})
},
reloadTable() {
this.queryList.reload()
}
}
}
</script> </script>

View File

@ -1,146 +1,129 @@
<template> <template>
<div> <div>
<QueryListPage ref="queryListPage" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList"> <QueryListPage ref="queryListPage" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" />
</QueryListPage> <dictionary-edit ref="edit" @reloadTable="reloadTable" />
<dictionary-edit ref="edit" @reloadTable="reloadTable"></dictionary-edit> <correlation-map ref="correlationMap" />
<correlation-map ref="correlationMap"></correlation-map> </div>
</div>
</template> </template>
<script> <script>
import { getUserList } from '@/api/management/user'; import { getUserList } from '@/api/management/user';
import localStore from 'storejs'; import DictionaryEdit from './edit';
import DictionaryEdit from './edit' import CorrelationMap from './correlationMap';
import CorrelationMap from './correlationMap';
export default { export default {
name: 'UserControl', name: 'UserControl',
components: { components: {
DictionaryEdit, DictionaryEdit,
CorrelationMap CorrelationMap
}, },
data() { data() {
return { return {
pagerConfig: { pagerConfig: {
pageSize: 'pageSize', pageSize: 'pageSize',
pageIndex: 'pageNum' pageIndex: 'pageNum'
}, },
queryForm: { queryForm: {
labelWidth: '80px', labelWidth: '80px',
reset: true, reset: true,
queryObject: { queryObject: {
name: { name: {
type: 'text', type: 'text',
label: '名称' label: '名称'
}, },
roles: { roles: {
type: 'select', type: 'select',
label: '角色', label: '角色',
config: { config: {
data: this.$ConstSelect.roleList data: this.$ConstSelect.roleList
} }
} }
} }
}, },
queryList: { queryList: {
query: getUserList, query: getUserList,
selectCheckShow: false, selectCheckShow: false,
indexShow: true, indexShow: true,
columns: [ columns: [
{ {
title: '名称', title: '名称',
prop: 'name' prop: 'name'
}, },
{ {
title: '昵称', title: '昵称',
prop: 'nickname' prop: 'nickname'
}, },
{ {
title: '电话', title: '电话',
prop: 'mobile' prop: 'mobile'
}, },
{ {
title: '邮箱', title: '邮箱',
prop: 'email' prop: 'email'
}, },
{ {
title: '角色', title: '角色',
prop: 'roles', prop: 'roles',
type: 'tagMore', type: 'tagMore',
columnValue: (row) => { return this.convertField(row.roles, this.$ConstSelect.roleList, ['value', 'label']) }, columnValue: (row) => { return this.$convertField(row.roles, this.$ConstSelect.roleList, ['value', 'label'], true); },
tagType: (row) => { return 'success' } tagType: (row) => { return 'success'; }
}, },
{ {
type: 'button', type: 'button',
title: '操作', title: '操作',
width: '250', width: '250',
buttons: [ buttons: [
{ {
name: '编辑', name: '编辑',
handleClick: this.handleUserEdit, handleClick: this.handleUserEdit
}, },
{ {
name: '订阅地图', name: '订阅地图',
handleClick: this.handleMapCorrelation, handleClick: this.handleMapCorrelation,
type: 'danger', type: 'danger'
}, }
] ]
} }
] ]
}, },
currentModel: {} currentModel: {}
} };
}, },
created() { created() {
}, },
methods: { methods: {
convertField(fieldValue, enumList, converFormat) { //
let arr = []; handleUserEdit(index, row) {
if (converFormat && converFormat.length >= 2) { this.$refs.edit.doShow(row);
let value = converFormat[0]; },
let label = converFormat[1];
enumList.forEach((element, i) => {
fieldValue.forEach((v, j) => {
if ('' + fieldValue[j] === '' + enumList[i][value]) {
arr.push(enumList[i][label])
}
})
});
}
return arr;
},
//
handleUserEdit(index, row) {
this.$refs.edit.doShow(row)
},
// //
handleUserDelete(index, row) { handleUserDelete(index, row) {
this.$confirm('此操作将删除该类型, 是否继续?', '提示', { this.$confirm('此操作将删除该类型, 是否继续?', '提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
// delPublishMap(row.id).then(response => { // delPublishMap(row.id).then(response => {
// this.$message.success('') // this.$message.success('')
// this.reloadTable() // this.reloadTable()
// localStore.remove('mapId') // localStore.remove('mapId')
// }).catch(error => { // }).catch(error => {
// this.reloadTable() // this.reloadTable()
// this.$messageBox('') // this.$messageBox('')
// }) // })
}) });
}, },
// //
handleMapCorrelation(index, row) { handleMapCorrelation(index, row) {
this.$refs.correlationMap.doShow(row); this.$refs.correlationMap.doShow(row);
}, },
reloadTable() { reloadTable() {
this.queryList.reload() this.queryList.reload();
} }
} }
} };
</script> </script>

View File

@ -57,7 +57,7 @@
title: '考试结果', title: '考试结果',
prop: 'result', prop: 'result',
type: 'tag', type: 'tag',
columnValue: (row) => { return this.convertField(row.result, this.$ConstSelect.examResultList, ['value', 'label']) }, columnValue: (row) => { return this.$convertField(row.result, this.$ConstSelect.examResultList, ['value', 'label']) },
tagType: (row) => { tagType: (row) => {
switch (row.result) { switch (row.result) {
case '01': return 'warning'; case '01': return 'warning';
@ -108,17 +108,6 @@
loadInitData() { loadInitData() {
}, },
convertField(fieldValue, enumList, converFormat) {
if (converFormat && converFormat.length >= 2) {
let value = converFormat[0];
let label = converFormat[1];
for (let i = 0; enumList && i < enumList.length; i++) {
if ('' + fieldValue === '' + enumList[i][value]) {
return enumList[i][label];
}
}
}
},
// //
edit(index, row) { edit(index, row) {

View File

@ -129,17 +129,6 @@
} }
} }
}, },
convertField(fieldValue, enumList, converFormat) {
if (converFormat && converFormat.length >= 2) {
let value = converFormat[0];
let label = converFormat[1];
for (let i = 0; enumList && i < enumList.length; i++) {
if ('' + fieldValue === '' + enumList[i][value]) {
return enumList[i][label];
}
}
}
},
// //
edit(index, row) { edit(index, row) {

View File

@ -1,186 +1,184 @@
<template> <template>
<div> <div>
<el-dialog :title="title" :visible.sync="dialogVisible" width="30%" :before-close="handleClose" center> <el-dialog :title="title" :visible.sync="dialogVisible" width="30%" :before-close="handleClose" center>
<data-form ref="dataform" :form="form" :formModel="formModel" :rules="rules"></data-form> <data-form ref="dataform" :form="form" :form-model="formModel" :rules="rules" />
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
<el-button type="primary" @click="doSave"> </el-button> <el-button type="primary" @click="doSave"> </el-button>
<el-button @click="handleClose"> </el-button> <el-button @click="handleClose"> </el-button>
</span> </span>
</el-dialog> </el-dialog>
<add-training ref="addTraining" @selectTrain="selectTrain"></add-training> <add-training ref="addTraining" @selectTrain="selectTrain" />
</div> </div>
</template> </template>
<script> <script>
import { create, checkDicDetailCodeExist, getData } from '@/api/management/dictionaryDetail' import { addUserTraining } from '@/api/jmap/training';
import { addUserTraining } from '@/api/jmap/training'; import { getPublishLessonList } from '@/api/jmap/lesson';
import { validateCharCode } from '@/utils/validate'; import { getDimUserList } from '@/api/management/user';
import { getPublishLessonList } from '@/api/jmap/lesson'; import AddTraining from './addTraining';
import { getDimUserList } from '@/api/management/user';
import AddTraining from './addTraining';
export default { export default {
name: 'UsersTrainingAdd', name: 'UsersTrainingAdd',
props: { components: {
type: { AddTraining
type: String, },
required: true props: {
}, type: {
}, type: String,
components: { required: true
AddTraining, }
}, },
data() { data() {
return { return {
dialogVisible: false, dialogVisible: false,
formModel: { formModel: {
lessonId: '', lessonId: '',
trainingId: '', trainingId: '',
trainingName: '', trainingName: '',
userId: '', userId: '',
userName: '', userName: '',
duration: '', duration: ''
}, },
LessonList: [], LessonList: [],
UserList: [], UserList: [],
UserLoading: false, UserLoading: false
} };
}, },
computed: { computed: {
form() { form() {
let isAdd = this.type === 'ADD' this.type === 'ADD';
let form = { const form = {
labelWidth: '100px', labelWidth: '100px',
items: [ items: [
{ prop: 'lessonId', label: '课程名称', type: 'select', required: true, options: this.LessonList, }, { prop: 'lessonId', label: '课程名称', type: 'select', required: true, options: this.LessonList },
{ prop: 'trainingName', label: '实训名称', type: 'text', required: true, rightWidth: true, disabled: true, buttontip: '选择实训', buttonClick: this.buttonClick, placeholder: '请选择实训' }, { prop: 'trainingName', label: '实训名称', type: 'text', required: true, rightWidth: true, disabled: true, buttontip: '选择实训', buttonClick: this.buttonClick, placeholder: '请选择实训' },
{ prop: 'userName', label: '用户名称', type: 'complete', required: false, placeholder: '', querySearchAsync: this.querySearchAsync, handleSelect: this.prdSelect, placeholder: '请输入昵称/名字/手机号' }, { prop: 'userName', label: '用户名称', type: 'complete', required: false, querySearchAsync: this.querySearchAsync, handleSelect: this.prdSelect, placeholder: '请输入昵称/名字/手机号' },
{ prop: 'duration', label: '实训时长', type: 'text', required: true, rightWidth: true, message: 's' }, { prop: 'duration', label: '实训时长', type: 'text', required: true, rightWidth: true, message: 's' }
] ]
} };
return form return form;
}, },
rules() { rules() {
let crules = { const crules = {
lessonId: [ lessonId: [
{ required: true, message: '请输入教学名称', trigger: 'change' }, { required: true, message: '请输入教学名称', trigger: 'change' }
], ],
trainingName: [ trainingName: [
{ required: true, message: '请选择实训', trigger: 'change' }, { required: true, message: '请选择实训', trigger: 'change' }
], ],
userName: [ userName: [
{ required: true, message: '请输入用户名称', trigger: 'change' }, { required: true, message: '请输入用户名称', trigger: 'change' }
], ],
duration: [ duration: [
{ required: true, message: '请输入时长', trigger: 'blur' }, { required: true, message: '请输入时长', trigger: 'blur' }
], ]
} };
return crules return crules;
}, },
title() { title() {
return '创建用户实训' return '创建用户实训';
} }
}, },
mounted() { mounted() {
this.initLoadPage(); this.initLoadPage();
}, },
methods: { methods: {
initLoadPage() { initLoadPage() {
// //
this.LessonList.length = 0; this.LessonList.length = 0;
this.UserList.length = 0; this.UserList.length = 0;
getPublishLessonList().then(response => { getPublishLessonList().then(response => {
let data = response.data; const data = response.data;
if (data && data.length) { if (data && data.length) {
data.forEach(elem => { data.forEach(elem => {
this.LessonList.push({ value: elem.id, label: elem.name }); this.LessonList.push({ value: elem.id, label: elem.name });
}) });
} }
}); });
}, },
// input // input
async querySearchAsync(queryString, cb) { async querySearchAsync(queryString, cb) {
// queryString // queryString
let results = []; const results = [];
if (queryString) { if (queryString) {
try { try {
let params = { const params = {
fuzzyParam: queryString, fuzzyParam: queryString
}; };
let res = await getDimUserList(params); const res = await getDimUserList(params);
let list = res.data; const list = res.data;
list.forEach(item => { list.forEach(item => {
let value = { const value = {
id: item.id, id: item.id,
value: `${item.nickname}(${item.name})${item.mobile}` value: `${item.nickname}(${item.name})${item.mobile}`
} };
results.push(value); results.push(value);
}) });
cb(results); cb(results);
} catch (error) { } catch (error) {
console.error(error, '查询用户list'); console.error(error, '查询用户list');
cb(results); cb(results);
} }
} else { } else {
cb(results); cb(results);
} }
}, },
prdSelect(item) { prdSelect(item) {
this.formModel.userId = item.id; this.formModel.userId = item.id;
}, },
selectTrain(data) { selectTrain(data) {
this.formModel.trainingId = data.id; this.formModel.trainingId = data.id;
this.formModel.trainingName = data.name; this.formModel.trainingName = data.name;
}, },
buttonClick() { buttonClick() {
if (this.formModel.lessonId) { if (this.formModel.lessonId) {
this.$refs.addTraining.show(this.formModel.lessonId); this.$refs.addTraining.show(this.formModel.lessonId);
} else { } else {
this.$message.error('请先选择课程名称') this.$message.error('请先选择课程名称');
} }
}, },
show(data) { show(data) {
this.dialogVisible = true this.dialogVisible = true;
// this.formModel = { // this.formModel = {
// lessonId: '', // lessonId: '',
// trainingId: '', // trainingId: '',
// trainingName: '', // trainingName: '',
// userId: '', // userId: '',
// userName: '', // userName: '',
// duration: '', // duration: '',
// }; // };
}, },
doSave() { doSave() {
let self = this const self = this;
this.$refs.dataform.validateForm(() => { this.$refs.dataform.validateForm(() => {
self.save() self.save();
}) });
}, },
save() { save() {
let self = this const self = this;
if (this.formModel.userId) { if (this.formModel.userId) {
addUserTraining(this.formModel).then(response => { addUserTraining(this.formModel).then(response => {
self.$message.success('创建成功!') self.$message.success('创建成功!');
self.handleClose() self.handleClose();
self.$emit('reloadTable') self.$emit('reloadTable');
}).catch(error => { }).catch(error => {
self.$message.error('创建失败!' + error.message) self.$message.error('创建失败!' + error.message);
}) });
} else { } else {
self.$message.error('请选择用户') self.$message.error('请选择用户');
} }
}, },
handleClose(done) { handleClose(done) {
this.formModel = { this.formModel = {
lessonId: '', lessonId: '',
trainingId: '', trainingId: '',
trainingName: '', trainingName: '',
userId: '', userId: '',
userName: '', userName: '',
duration: '', duration: ''
} };
this.dialogVisible = false this.dialogVisible = false;
} }
} }
} };
</script> </script>

View File

@ -1,92 +1,98 @@
<template> <template>
<el-dialog :title="title" :visible.sync="dialogVisibles" width="30%" :before-close="handleClose" center> <el-dialog :title="title" :visible.sync="dialogVisibles" width="30%" :before-close="handleClose" center>
<el-scrollbar wrapClass="scrollbar-wrapper" :style="{ height: '280px', width:'100%' }"> <el-scrollbar wrap-class="scrollbar-wrapper" :style="{ height: '280px', width:'100%' }">
<el-tree ref="tree" :data="treeData" :props="defaultProps" highlight-current @node-click="clickEvent" <el-tree
:span=22> ref="tree"
<span class="custom-tree-node" slot-scope="{ node, data }"> :data="treeData"
<span class="el-icon-tickets"> :props="defaultProps"
<span>&nbsp;{{ node.label }}</span> highlight-current
</span> :span="22"
</span> @node-click="clickEvent"
</el-tree> >
</el-scrollbar> <span slot-scope="{ node }" class="custom-tree-node">
<span slot="footer" class="dialog-footer"> <span class="el-icon-tickets">
<el-button type="primary" @click="doSave" :disabled="disabled"> </el-button> <span>&nbsp;{{ node.label }}</span>
<el-button @click="handleClose"> </el-button> </span>
</span> </span>
</el-dialog> </el-tree>
</el-scrollbar>
<span slot="footer" class="dialog-footer">
<el-button type="primary" :disabled="disabled" @click="doSave"> </el-button>
<el-button @click="handleClose"> </el-button>
</span>
</el-dialog>
</template> </template>
<script> <script>
import { getPublishLessonDetail } from '@/api/jmap/lesson'; import { getPublishLessonDetail } from '@/api/jmap/lesson';
export default { export default {
name: 'AddTraining', name: 'AddTraining',
props: { props: {
}, },
data() { data() {
return { return {
dialogVisibles: false, dialogVisibles: false,
title: '选择实训', title: '选择实训',
treeData: [{ treeData: [{
children: [], children: [],
name: '', name: ''
}], }],
defaultProps: { defaultProps: {
children: 'children', children: 'children',
label: 'name' label: 'name'
}, },
training: {}, training: {},
disabled: true, disabled: true
} };
}, },
computed: { computed: {
}, },
mounted() { mounted() {
}, },
methods: { methods: {
clickEvent(data) { clickEvent(data) {
if (data.trainingSelect) { if (data.trainingSelect) {
this.training = { this.training = {
name: data.name, name: data.name,
id: data.id id: data.id
}; };
this.disabled = false; this.disabled = false;
} else { } else {
this.disabled = true; this.disabled = true;
} }
}, },
async show(lessonId) { async show(lessonId) {
this.dialogVisibles = true this.dialogVisibles = true;
try { try {
let res = await getPublishLessonDetail({ id: lessonId }); const res = await getPublishLessonDetail({ id: lessonId });
this.treeData[0].children = res.data.chapters; this.treeData[0].children = res.data.chapters;
this.treeData[0].name = res.data.name; this.treeData[0].name = res.data.name;
this.treeData[0].children.forEach(ele => { this.treeData[0].children.forEach(ele => {
ele.children = ele.trainingVos; ele.children = ele.trainingVos;
ele.children.forEach(item => { ele.children.forEach(item => {
item.trainingSelect = true; item.trainingSelect = true;
}) });
}); });
} catch (error) { } catch (error) {
console.error(error); console.error(error);
} }
}, },
doSave() { doSave() {
this.$emit('selectTrain', this.training) this.$emit('selectTrain', this.training);
this.handleClose(); this.handleClose();
}, },
handleClose() { handleClose() {
this.treeData = [{ this.treeData = [{
children: [], children: [],
name: '', name: ''
}]; }];
this.trainingId = ''; this.trainingId = '';
this.training = {}; this.training = {};
this.dialogVisibles = false; this.dialogVisibles = false;
} }
} }
} };
</script> </script>

View File

@ -1,108 +1,106 @@
<template> <template>
<el-dialog :title="title" :visible.sync="dialogVisible" width="30%" :before-close="handleClose" center> <el-dialog :title="title" :visible.sync="dialogVisible" width="30%" :before-close="handleClose" center>
<data-form ref="dataform" :form="form" :formModel="formModel" :rules="rules"></data-form> <data-form ref="dataform" :form="form" :form-model="formModel" :rules="rules" />
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
<el-button type="primary" @click="doSave"> </el-button> <el-button type="primary" @click="doSave"> </el-button>
<el-button @click="handleClose"> </el-button> <el-button @click="handleClose"> </el-button>
</span> </span>
</el-dialog> </el-dialog>
</template> </template>
<script> <script>
import { create, checkDicDetailCodeExist, getData } from '@/api/management/dictionaryDetail' import { putUserTraining } from '@/api/jmap/training';
import { putUserTraining } from '@/api/jmap/training'; export default {
import { validateCharCode } from '@/utils/validate' name: 'UsersTrainingEdit',
export default { props: {
name: 'UsersTrainingEdit', type: {
props: { type: String,
type: { required: true
type: String, }
required: true },
}, data() {
}, return {
data() { dialogVisible: false,
return { formModel: {
dialogVisible: false, id: '',
formModel: { lessonName: '',
id: '', userName: '',
lessonName: '', trainingName: '',
userName: '', duration: ''
trainingName: '', // trainingCount: '',
duration: '', }
// trainingCount: '', };
} },
} computed: {
}, form() {
computed: { this.type === 'ADD';
form() { const form = {
let isAdd = this.type === 'ADD' labelWidth: '100px',
let form = { items: [
labelWidth: '100px', { prop: 'lessonName', label: '教学名称', type: 'text', required: false, disabled: true },
items: [ { prop: 'trainingName', label: '实训名称', type: 'text', required: true, disabled: true },
{ prop: 'lessonName', label: '教学名称', type: 'text', required: false, disabled: true }, { prop: 'userName', label: '用户名称', type: 'text', required: true, disabled: true },
{ prop: 'trainingName', label: '实训名称', type: 'text', required: true, disabled: true }, { prop: 'duration', label: '实训时长', type: 'text', required: true, rightWidth: true, message: 's' }
{ prop: 'userName', label: '用户名称', type: 'text', required: true, disabled: true }, ]
{ prop: 'duration', label: '实训时长', type: 'text', required: true, rightWidth: true, message: 's' }, };
] return form;
} },
return form rules() {
}, const crules = {
rules() { duration: [
let crules = { { required: true, message: '请输入时长', trigger: 'blur' }
duration: [ ]
{ required: true, message: '请输入时长', trigger: 'blur' }, };
], return crules;
} },
return crules title() {
}, return '编辑实训详情';
title() { }
return '编辑实训详情' },
} methods: {
}, show(data) {
methods: { this.dialogVisible = true;
show(data) { if (data && data.id) {
this.dialogVisible = true this.formModel = {
if (data && data.id) { id: data.id,
this.formModel = { lessonName: data.lessonName,
id: data.id, userName: data.userName,
lessonName: data.lessonName, trainingName: data.trainingName,
userName: data.userName, duration: data.duration
trainingName: data.trainingName, // trainingCount: data.trainingCount
duration: data.duration, };
// trainingCount: data.trainingCount }
}; },
} doSave() {
}, const self = this;
doSave() { this.$refs.dataform.validateForm(() => {
let self = this self.update();
this.$refs.dataform.validateForm(() => { });
self.update() },
}) update() {
}, const self = this;
update() { const param = {
let self = this; id: this.formModel.id,
let param = { duration: this.formModel.duration
id: this.formModel.id, };
duration: this.formModel.duration, putUserTraining(param).then(response => {
} self.$message.success('修改成功!');
putUserTraining(param).then(response => { self.handleClose();
self.$message.success('修改成功!') self.$emit('reloadTable');
self.handleClose() }).catch(error => {
self.$emit('reloadTable') self.$message.error('修改失败!' + error.message);
}).catch(error => { });
self.$message.error('修改失败!' + error.message) },
}) handleClose(done) {
}, this.formModel = {
handleClose(done) { id: '',
this.formModel = { lessonName: '',
id: '', userName: '',
lessonName: '', trainingName: '',
userName: '', duration: ''
trainingName: '', };
duration: '', this.dialogVisible = false;
} }
this.dialogVisible = false }
} };
} </script>
}
</script>

View File

@ -1,146 +1,144 @@
<template> <template>
<div> <div>
<QueryListPage ref="queryListPage" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList"> <QueryListPage ref="queryListPage" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" />
</QueryListPage> <users-training-edit ref="edit" type="EDIT" @reloadTable="reloadTable" />
<users-training-edit ref="edit" type="EDIT" @reloadTable="reloadTable"></users-training-edit> <users-training-add ref="add" type="ADD" @reloadTable="reloadTable" />
<users-training-add ref="add" type="ADD" @reloadTable="reloadTable"></users-training-add> </div>
</div>
</template> </template>
<script> <script>
import { getTrainingList, deleteUserTraining } from '@/api/jmap/training'; import { getTrainingList, deleteUserTraining } from '@/api/jmap/training';
import localStore from 'storejs'; import UsersTrainingEdit from './edit';
import UsersTrainingEdit from './edit'; import UsersTrainingAdd from './add';
import UsersTrainingAdd from './add' export default {
export default { name: 'UserTrainingEdit',
name: 'UserTrainingEdit', components: {
components: { UsersTrainingEdit,
UsersTrainingEdit, UsersTrainingAdd
UsersTrainingAdd, },
}, data() {
data() { return {
return { examResultList: [],
examResultList: [], pagerConfig: {
pagerConfig: { pageSize: 'pageSize',
pageSize: 'pageSize', pageIndex: 'pageNum'
pageIndex: 'pageNum' },
}, queryForm: {
queryForm: { labelWidth: '80px',
labelWidth: '80px', reset: true,
reset: true, queryObject: {
queryObject: { trainingName: {
trainingName: { type: 'text',
type: 'text', label: '实训名称'
label: '实训名称' },
}, userName: {
userName: { type: 'text',
type: 'text', label: '用户名'
label: '用户名' }
} }
}
}, },
queryList: { queryList: {
query: getTrainingList, query: getTrainingList,
selectCheckShow: false, selectCheckShow: false,
indexShow: true, indexShow: true,
columns: [ columns: [
{ {
title: '用户名称', title: '用户名称',
prop: 'userName' prop: 'userName'
}, },
{ {
title: '用户手机号', title: '用户手机号',
prop: 'userMobile' prop: 'userMobile'
}, },
{ {
title: '课程名称', title: '课程名称',
prop: 'lessonName' prop: 'lessonName'
}, },
{ {
title: '实训用时', title: '实训用时',
prop: 'duration', prop: 'duration',
type: 'tag', type: 'tag',
columnValue: (row) => { return this.computation(row.duration) }, columnValue: (row) => { return this.computation(row.duration); },
tagType: (row) => { return 'success' } tagType: (row) => { return 'success'; }
}, },
{ {
title: '实训名称', title: '实训名称',
prop: 'trainingName' prop: 'trainingName'
}, },
{ {
type: 'button', type: 'button',
title: '操作', title: '操作',
width: '250', width: '250',
buttons: [ buttons: [
{ {
name: '编辑', name: '编辑',
handleClick: this.edit, handleClick: this.edit,
showControl: (row) => { return row.fake != '0' } showControl: (row) => { return row.fake != '0'; }
}, },
{ {
name: '删除', name: '删除',
handleClick: this.handleDelete, handleClick: this.handleDelete,
type: 'danger', type: 'danger',
showControl: (row) => { return row.fake != '0' } showControl: (row) => { return row.fake != '0'; }
}, }
] ]
} }
], ],
actions: [ actions: [
{ text: '新增', handler: this.createTraining } { text: '新增', handler: this.createTraining }
], ]
}, },
currentModel: {} currentModel: {}
} };
}, },
created() { created() {
this.loadInitData(); this.loadInitData();
}, },
methods: { methods: {
loadInitData() { loadInitData() {
}, },
createTraining() { createTraining() {
this.$refs.add.show() this.$refs.add.show();
}, },
computation(fieldValue) { computation(fieldValue) {
if (fieldValue) { if (fieldValue) {
let f = parseInt(fieldValue / 60); const f = parseInt(fieldValue / 60);
let s = fieldValue % 60; const s = fieldValue % 60;
if (f > 0) { if (f > 0) {
return `${f}${s}`; return `${f}${s}`;
} else { } else {
return `${s}`; return `${s}`;
} }
} }
}, },
// //
edit(index, row) { edit(index, row) {
this.$refs.edit.show(row) this.$refs.edit.show(row);
}, },
// //
handleDelete(index, row) { handleDelete(index, row) {
this.$confirm('此操作将删除此考试结果, 是否继续?', '提示', { this.$confirm('此操作将删除此考试结果, 是否继续?', '提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
deleteUserTraining(row.id).then(response => { deleteUserTraining(row.id).then(response => {
this.$message.success('删除成功') this.$message.success('删除成功');
this.reloadTable() this.reloadTable();
}).catch(error => { }).catch(() => {
this.reloadTable() this.reloadTable();
this.$messageBox('删除失败') this.$messageBox('删除失败');
}) });
}) });
}, },
reloadTable() { reloadTable() {
this.queryList.reload() this.queryList.reload();
} }
} }
} };
</script> </script>

View File

@ -52,7 +52,7 @@
title: '皮肤类型', title: '皮肤类型',
prop: 'skinStyle', prop: 'skinStyle',
type: 'tag', type: 'tag',
columnValue: (row) => { return this.convertField(row.skinStyle, this.skinStyleList, ['code', 'name']) }, columnValue: (row) => { return this.$convertField(row.skinStyle, this.skinStyleList, ['code', 'name']) },
tagType: (row) => { return '' } tagType: (row) => { return '' }
}, },
{ {
@ -114,19 +114,6 @@
this.skinStyleList = response.data; this.skinStyleList = response.data;
}) })
}, },
convertField(fieldValue, enumList, converFormat) {
if (converFormat && converFormat.length >= 2) {
let value = converFormat[0];
let label = converFormat[1];
for (let i = 0; enumList && i < enumList.length; i++) {
if ('' + fieldValue === '' + enumList[i][value]) {
return enumList[i][label];
}
}
}
},
// //
handleAdd() { handleAdd() {
this.$router.push({ path: `${UrlConfig.map.productDraft}/add/0` }); this.$router.push({ path: `${UrlConfig.map.productDraft}/add/0` });

View File

@ -152,16 +152,6 @@
resizeHandler: function () { resizeHandler: function () {
this.height = this._clientHeight - 130; this.height = this._clientHeight - 130;
}, },
convertList(FromList, ToList, ChecktypeFunction) {
if (FromList) {
ToList.length = 0;
FromList.forEach(elem => {
if (ChecktypeFunction(elem)) {
ToList.push({ value: elem.code, label: elem.name });
}
});
}
},
initLoadPage() { initLoadPage() {
// //
this.display = 1; this.display = 1;

View File

@ -115,17 +115,6 @@
this.skinStyleList = response.data; this.skinStyleList = response.data;
}) })
}, },
convertField(fieldValue, enumList, converFormat) {
if (converFormat && converFormat.length >= 2) {
let value = converFormat[0];
let label = converFormat[1];
for (let i = 0; enumList && i < enumList.length; i++) {
if ('' + fieldValue === '' + enumList[i][value]) {
return enumList[i][label];
}
}
}
},
handleAdd() { handleAdd() {
this.$router.push(`${UrlConfig.map.skinStyleDraft}/add/null`); this.$router.push(`${UrlConfig.map.skinStyleDraft}/add/null`);
}, },

View File

@ -1,97 +1,91 @@
<template> <template>
<el-dialog :title="title" :visible.sync="dialogVisible" width="30%" :before-close="handleClose" center> <el-dialog :title="title" :visible.sync="dialogVisible" width="30%" :before-close="handleClose" center>
<div v-if="orderType"> <div v-if="orderType">
<data-form ref="dataform" :form="formOrder" :formModel="formOrderModel"></data-form> <data-form ref="dataform" :form="formOrder" :form-model="formOrderModel" />
</div> </div>
<div v-else> <div v-else>
<data-form ref="dataform" :form="form" :formModel="formModel"></data-form> <data-form ref="dataform" :form="form" :form-model="formModel" />
</div> </div>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
<el-button type="primary" @click="handleClose"> </el-button> <el-button type="primary" @click="handleClose"> </el-button>
</span> </span>
</el-dialog> </el-dialog>
</template> </template>
<script> <script>
import { create, checkDicDetailCodeExist, getData } from '@/api/management/dictionaryDetail' export default {
import { postSimulationStats } from '@/api/jmap/training'; name: 'AuthorDetail',
import { validateCharCode } from '@/utils/validate'; data() {
import { getPublishLessonList } from '@/api/jmap/lesson'; return {
import { getUserList } from '@/api/management/user'; dialogVisible: false,
formModel: {
export default { source: '',
name: 'authorDetail', userMobile: '',
data() { userName: ''
return { },
dialogVisible: false, formOrderModel: {
formModel: { source: '',
source: '', order: ''
userMobile: '', },
userName: '', PermissionTypeList: [],
}, orderType: '',
formOrderModel: { order: ''
source: '', };
order: '', },
}, computed: {
PermissionTypeList: [], form() {
orderType: '', const form = {
order: '', labelWidth: '100px',
} items: [
}, { prop: 'source', label: '来源', type: 'text', disabled: true },
computed: { { prop: 'name', label: '分发用户', type: 'text', disabled: true },
form() { { prop: 'mobile', label: '用户手机号', type: 'text', disabled: true }
let form = { ]
labelWidth: '100px', };
items: [ return form;
{ prop: 'source', label: '来源', type: 'text', disabled: true, }, },
{ prop: 'name', label: '分发用户', type: 'text', disabled: true, }, formOrder() {
{ prop: 'mobile', label: '用户手机号', type: 'text', disabled: true, }, const form = {
] labelWidth: '100px',
} items: [
return form { prop: 'source', label: '来源', type: 'text', disabled: true },
}, { prop: 'order', label: '订单号', type: 'text', disabled: true }
formOrder() { ]
let form = { };
labelWidth: '100px', return form;
items: [ },
{ prop: 'source', label: '来源', type: 'text', disabled: true, }, title() {
{ prop: 'order', label: '订单号', type: 'text', disabled: true, }, return '来源信息';
] }
} },
return form mounted() {
}, },
title() { methods: {
return '来源信息' show(data) {
} this.dialogVisible = true;
}, if (typeof data == 'object') {
mounted() { this.orderType = false;
}, this.formModel = {
methods: { source: '权限分发',
show(data) { mobile: data.mobile,
this.dialogVisible = true; name: data.name
if (typeof data == 'object') { };
this.orderType = false; } else {
this.formModel = { this.orderType = true;
source: '权限分发', this.formOrderModel = {
mobile: data.mobile, source: '订单创建',
name: data.name, order: data
}; };
} else { }
this.orderType = true; },
this.formOrderModel = { handleClose(done) {
source: '订单创建', this.formModel = {
order: data, source: '',
}; userMobile: '',
} userName: ''
}, };
handleClose(done) { this.dialogVisible = false;
this.formModel = { }
source: '', }
userMobile: '', };
userName: '', </script>
}
this.dialogVisible = false
}
}
}
</script>

View File

@ -1,192 +1,191 @@
<template> <template>
<div class="card-box"> <div class="card-box">
<el-steps class="steps" :active="display"> <el-steps class="steps" :active="display">
<el-step :title="title" icon="el-icon-edit-outline"></el-step> <el-step :title="title" icon="el-icon-edit-outline" />
<el-step title="" icon="el-icon-upload"></el-step> <el-step title="" icon="el-icon-upload" />
</el-steps> </el-steps>
<el-card class="forms"> <el-card class="forms">
<el-scrollbar wrapClass="scrollbar-wrapper" :style="{height:height -120 + 'px'}" style="padding-top: 40px"> <el-scrollbar wrap-class="scrollbar-wrapper" :style="{height:height -120 + 'px'}" style="padding-top: 40px">
<data-form ref="dataform" :form="form" :formModel="formModel" :rules="rules"></data-form> <data-form ref="dataform" :form="form" :form-model="formModel" :rules="rules" />
</el-scrollbar> </el-scrollbar>
</el-card> </el-card>
<div class="draft"> <div class="draft">
<el-button-group> <el-button-group>
<el-button type="primary" @click="create">创建</el-button> <el-button type="primary" @click="create">创建</el-button>
<el-button type="primary" @click="turnback">返回</el-button> <el-button type="primary" @click="turnback">返回</el-button>
</el-button-group> </el-button-group>
</div>
</div> </div>
</div>
</template> </template>
<script> <script>
import { getPublishLessonList } from '@/api/jmap/lesson'; import { getPublishLessonList } from '@/api/jmap/lesson';
import { getUserInfoByNameOrMobile } from '@/api/management/user'; import { getUserInfoByNameOrMobile } from '@/api/management/user';
import { createLessonPermisson } from '@/api/management/author'; import { createLessonPermisson } from '@/api/management/author';
import { validateCharCode } from '@/utils/validate'; import WindowResizeHandler from '@/mixin/WindowResizeHandler';
import WindowResizeHandler from '@/mixin/WindowResizeHandler';
export default { export default {
name: 'DictionaryDetailEdit', name: 'DictionaryDetailEdit',
mixins: [ mixins: [
WindowResizeHandler WindowResizeHandler
], ],
data() { data() {
return { return {
title: '添加用户权限', title: '添加用户权限',
height: '', height: '',
display: 1, display: 1,
LessonList: [], LessonList: [],
UserList: [], UserList: [],
PermissionTypeList: [], PermissionTypeList: [],
UserLoading: false, UserLoading: false,
formModel: { formModel: {
userId: '', userId: '',
type: '01', type: '01',
forever: true, forever: true,
lessonId: '', lessonId: '',
total: 0, total: 0
} }
} };
}, },
computed: { computed: {
form() { form() {
let form = { const form = {
labelWidth: '140px', labelWidth: '140px',
items: [ items: [
{ prop: 'userId', label: '用户名称', type: 'select', required: false, options: this.UserList, remote: this.userRemote, loading: this.UserLoading }, { prop: 'userId', label: '用户名称', type: 'select', required: false, options: this.UserList, remote: this.userRemote, loading: this.UserLoading },
{ prop: 'lessonId', label: '课程名称', type: 'select', required: false, options: this.LessonList }, { prop: 'lessonId', label: '课程名称', type: 'select', required: false, options: this.LessonList },
{ prop: 'type', label: '权限类型', type: 'select', required: false, options: this.PermissionTypeList }, { prop: 'type', label: '权限类型', type: 'select', required: false, options: this.PermissionTypeList },
{ prop: 'forever', label: '是否永久', type: 'radio', required: false, disabled: true, options: this.$ConstSelect.Whether }, { prop: 'forever', label: '是否永久', type: 'radio', required: false, disabled: true, options: this.$ConstSelect.Whether },
{ prop: 'total', label: '权限个数', type: 'number', required: false } { prop: 'total', label: '权限个数', type: 'number', required: false }
] ]
} };
return form return form;
}, },
rules() { rules() {
let baseRules = { const baseRules = {
userId: [ userId: [
{ required: true, message: '请输入用户名称', trigger: 'blur' } { required: true, message: '请输入用户名称', trigger: 'blur' }
], ],
lessonId: [ lessonId: [
{ required: true, message: '请选择课程', trigger: 'change' } { required: true, message: '请选择课程', trigger: 'change' }
], ],
type: [ type: [
{ required: true, message: '请选择权限类型', trigger: 'change' } { required: true, message: '请选择权限类型', trigger: 'change' }
], ],
forever: [ forever: [
{ required: true, message: '请选择', trigger: 'change' } { required: true, message: '请选择', trigger: 'change' }
], ],
total: [ total: [
{ required: true, message: '请输入购买的权限个数', trigger: 'change' }, { required: true, message: '请输入购买的权限个数', trigger: 'change' },
{ {
validator(rule, value, callback) { validator(rule, value, callback) {
if (Number.isInteger(Number(value)) && Number(value) >= 0) { if (Number.isInteger(Number(value)) && Number(value) >= 0) {
callback(); callback();
} else { } else {
callback(new Error("请输入有效权限个数")); callback(new Error('请输入有效权限个数'));
} }
}, },
trigger: 'blur', trigger: 'blur'
} }
] ]
} };
// //
this.$nextTick(function () { this.$nextTick(function () {
this.$refs.dataform.clearValidate(); this.$refs.dataform.clearValidate();
}); });
return baseRules; return baseRules;
} }
}, },
mounted() { mounted() {
this.initLoadPage(); this.initLoadPage();
}, },
methods: { methods: {
resizeHandler: function () { resizeHandler: function () {
this.height = this._clientHeight - 130; this.height = this._clientHeight - 130;
}, },
convertList(FromList, ToList, ChecktypeFunction) { convertList(FromList, ToList, checktypeFunction) {
if (FromList) { if (FromList) {
ToList.length = 0; ToList.length = 0;
FromList.forEach(elem => { FromList.forEach(elem => {
if (ChecktypeFunction(elem)) { if (checktypeFunction(elem)) {
ToList.push({ value: elem.code, label: elem.name }); ToList.push({ value: elem.code, label: elem.name });
} }
}); });
} }
}, },
initLoadPage() { initLoadPage() {
// //
this.display = 1; this.display = 1;
this.LessonList.length = 0; this.LessonList.length = 0;
getPublishLessonList().then(response => { getPublishLessonList().then(response => {
let data = response.data; const data = response.data;
if (data && data.length) { if (data && data.length) {
data.forEach(elem => { data.forEach(elem => {
this.LessonList.push({ value: elem.id, label: elem.name }); this.LessonList.push({ value: elem.id, label: elem.name });
}) });
} }
}); });
// //
this.$Dictionary.permissionType().then(list => { this.$Dictionary.permissionType().then(list => {
this.convertList(list, this.PermissionTypeList, elem => { this.$convertList(list, this.PermissionTypeList, elem => {
return true; return true;
}); });
}); });
// //
this.$nextTick(function () { this.$nextTick(function () {
this.$refs.dataform.resetForm(); this.$refs.dataform.resetForm();
}); });
}, },
userRemote(query) { userRemote(query) {
if (query !== '') { if (query !== '') {
this.loading = true; this.loading = true;
this.UserList.length = 0; this.UserList.length = 0;
setTimeout(() => { setTimeout(() => {
this.loading = false; this.loading = false;
getUserInfoByNameOrMobile({ query: query }).then(response => { getUserInfoByNameOrMobile({ query: query }).then(response => {
response.data.forEach(item => { response.data.forEach(item => {
this.UserList.push({ value: item.id, label: item.name }); this.UserList.push({ value: item.id, label: item.name });
}) });
}).catch(error => { }).catch(() => {
this.$messageBox('远程查询错误'); this.$messageBox('远程查询错误');
}); });
}, 200); }, 200);
} else { } else {
this.UserList.length = 0; this.UserList.length = 0;
} }
}, },
buildModel() { buildModel() {
let model = { const model = {
userId: this.formModel.userId, userId: this.formModel.userId,
lessonId: this.formModel.lessonId, lessonId: this.formModel.lessonId,
type: this.formModel.type, type: this.formModel.type,
forever: this.formModel.forever, forever: this.formModel.forever,
total: this.formModel.total, total: this.formModel.total
} };
return model; return model;
}, },
create() { create() {
this.$refs.dataform.validateForm(() => { this.$refs.dataform.validateForm(() => {
createLessonPermisson(this.buildModel()).then(response => { createLessonPermisson(this.buildModel()).then(response => {
this.display = 2; this.display = 2;
this.turnback(); this.turnback();
this.$message.success('创建成功'); this.$message.success('创建成功');
}).catch(error => { }).catch(() => {
this.$messageBox("创建失败"); this.$messageBox('创建失败');
}); });
}); });
}, },
turnback() { turnback() {
this.$router.go(-1) this.$router.go(-1);
} }
} }
} };
</script> </script>
<style rel="stylesheet/scss" lang="scss" scoped> <style rel="stylesheet/scss" lang="scss" scoped>
@ -231,4 +230,4 @@
text-align: center; text-align: center;
margin: 20px auto; margin: 20px auto;
} }
</style> </style>

View File

@ -76,7 +76,7 @@
title: '权限类型', title: '权限类型',
prop: 'type', prop: 'type',
type: 'tag', type: 'tag',
columnValue: (row) => { return this.convertField(row.type, this.PermissionTypeList, ['value', 'label']) }, columnValue: (row) => { return this.$convertField(row.type, this.PermissionTypeList, ['value', 'label']) },
tagType: (row) => { return '' } tagType: (row) => { return '' }
}, },
{ {
@ -128,7 +128,7 @@
title: '课程权限状态', title: '课程权限状态',
prop: 'status', prop: 'status',
type: 'tag', type: 'tag',
columnValue: (row) => { return this.convertField(row.status, this.EffectiveTypeList, ['value', 'label']) }, columnValue: (row) => { return this.$convertField(row.status, this.EffectiveTypeList, ['value', 'label']) },
tagType: (row) => { tagType: (row) => {
switch (row.status) { switch (row.status) {
case '1': return 'success'; case '1': return 'success';
@ -183,30 +183,9 @@
this.loadInitData(); this.loadInitData();
}, },
methods: { methods: {
convertList(FromList, ToList, ChecktypeFunction) {
if (FromList) {
ToList.length = 0;
FromList.forEach(elem => {
if (ChecktypeFunction(elem)) {
ToList.push({ value: elem.code, label: elem.name });
}
});
}
},
convertField(fieldValue, enumList, converFormat) {
if (converFormat && converFormat.length >= 2) {
let value = converFormat[0];
let label = converFormat[1];
for (let i = 0; enumList && i < enumList.length; i++) {
if ('' + fieldValue === '' + enumList[i][value]) {
return enumList[i][label];
}
}
}
},
loadInitData() { loadInitData() {
this.$Dictionary.effectiveType().then(list => { this.$Dictionary.effectiveType().then(list => {
this.convertList(list, this.EffectiveTypeList, elem => { this.$convertList(list, this.EffectiveTypeList, elem => {
return true; return true;
}); });
}); });
@ -214,7 +193,7 @@
list.forEach(elem => { list.forEach(elem => {
this.queryForm.queryObject.type.config.data.push({ value: elem.code, label: elem.name }); this.queryForm.queryObject.type.config.data.push({ value: elem.code, label: elem.name });
}); });
this.convertList(list, this.PermissionTypeList, elem => { this.$convertList(list, this.PermissionTypeList, elem => {
return true; return true;
}); });
}); });

View File

@ -190,16 +190,6 @@
resizeHandler: function () { resizeHandler: function () {
this.height = this._clientHeight - 170; this.height = this._clientHeight - 170;
}, },
convertList(FromList, ToList, ChecktypeFunction) {
if (FromList) {
ToList.length = 0;
FromList.forEach(elem => {
if (ChecktypeFunction(elem)) {
ToList.push({ value: elem.code, label: elem.name });
}
});
}
},
async initLoadPage() { async initLoadPage() {
// //
// , // ,
@ -218,7 +208,7 @@
} }
// //
this.$Dictionary.productType().then(list => { this.$Dictionary.productType().then(list => {
this.convertList(list, this.productTypeList, elem => { this.$convertList(list, this.productTypeList, elem => {
return true; return true;
}); });
}); });
@ -226,7 +216,7 @@
// //
this.TimeStyleDict = {}; this.TimeStyleDict = {};
this.$Dictionary.timeStyleType().then(list => { this.$Dictionary.timeStyleType().then(list => {
this.convertList(list, this.TimeStyleList, elem => { this.$convertList(list, this.TimeStyleList, elem => {
return true; return true;
}); });
list.forEach(elem => { list.forEach(elem => {

View File

@ -64,7 +64,7 @@
title: '产品类型', title: '产品类型',
prop: 'productType', prop: 'productType',
type: 'tag', type: 'tag',
columnValue: (row) => { return this.convertField(row.productType, this.productTypeList, ['value', 'label']) }, columnValue: (row) => { return this.$convertField(row.productType, this.productTypeList, ['value', 'label']) },
tagType: (row) => { return 'success' } tagType: (row) => { return 'success' }
}, },
{ {
@ -87,7 +87,7 @@
title: '状态', title: '状态',
prop: 'status', prop: 'status',
type: 'tag', type: 'tag',
columnValue: (row) => { return this.convertField(row.status, this.EffectiveTypeList, ['value', 'label']) }, columnValue: (row) => { return this.$convertField(row.status, this.EffectiveTypeList, ['value', 'label']) },
tagType: (row) => { tagType: (row) => {
switch (row.status) { switch (row.status) {
case '1': return 'success'; case '1': return 'success';
@ -149,19 +149,9 @@
this.loadInitData(); this.loadInitData();
}, },
methods: { methods: {
convertList(FromList, ToList, ChecktypeFunction) {
if (FromList) {
ToList.length = 0;
FromList.forEach(elem => {
if (ChecktypeFunction(elem)) {
ToList.push({ value: elem.code, label: elem.name });
}
});
}
},
async loadInitData() { async loadInitData() {
this.$Dictionary.effectiveType().then(list => { this.$Dictionary.effectiveType().then(list => {
this.convertList(list, this.EffectiveTypeList, elem => { this.$convertList(list, this.EffectiveTypeList, elem => {
return true; return true;
}); });
}); });
@ -170,7 +160,7 @@
list.forEach(elem => { list.forEach(elem => {
this.queryForm.queryObject.productType.config.data.push({ value: elem.code, label: elem.name }); this.queryForm.queryObject.productType.config.data.push({ value: elem.code, label: elem.name });
}); });
this.convertList(list, this.productTypeList, elem => { this.$convertList(list, this.productTypeList, elem => {
return true; return true;
}); });
}); });
@ -184,17 +174,6 @@
console.error(error, '获取发布地图'); console.error(error, '获取发布地图');
} }
}, },
convertField(fieldValue, enumList, converFormat) {
if (converFormat && converFormat.length >= 2) {
let value = converFormat[0];
let label = converFormat[1];
for (let i = 0; enumList && i < enumList.length; i++) {
if ('' + fieldValue === '' + enumList[i][value]) {
return enumList[i][label];
}
}
}
},
handleEdit(index, row) { handleEdit(index, row) {
this.$router.push({ path: `${UrlConfig.orderauthor.commodityDraft}/edit/${row.id}` }); this.$router.push({ path: `${UrlConfig.orderauthor.commodityDraft}/edit/${row.id}` });
}, },

View File

@ -78,7 +78,7 @@
title: '产品类型', title: '产品类型',
prop: 'productType', prop: 'productType',
type: 'tag', type: 'tag',
columnValue: (row) => { return this.convertField(row.productType, this.productTypeList, ['value', 'label']) }, columnValue: (row) => { return this.$convertField(row.productType, this.productTypeList, ['value', 'label']) },
tagType: (row) => { return 'success' } tagType: (row) => { return 'success' }
}, },
{ {
@ -101,7 +101,7 @@
title: '状态', title: '状态',
prop: 'status', prop: 'status',
type: 'tag', type: 'tag',
columnValue: (row) => { return this.convertField(row.status, this.EffectiveTypeList, ['value', 'label']) }, columnValue: (row) => { return this.$convertField(row.status, this.EffectiveTypeList, ['value', 'label']) },
tagType: (row) => { tagType: (row) => {
switch (row.status) { switch (row.status) {
case '1': return 'success'; case '1': return 'success';
@ -148,19 +148,9 @@
doClose() { doClose() {
this.show = false; this.show = false;
}, },
convertList(FromList, ToList, ChecktypeFunction) {
if (FromList) {
ToList.length = 0;
FromList.forEach(elem => {
if (ChecktypeFunction(elem)) {
ToList.push({ value: elem.code, label: elem.name });
}
});
}
},
async loadInitData() { async loadInitData() {
this.$Dictionary.effectiveType().then(list => { this.$Dictionary.effectiveType().then(list => {
this.convertList(list, this.EffectiveTypeList, elem => { this.$convertList(list, this.EffectiveTypeList, elem => {
return true; return true;
}); });
}); });
@ -169,7 +159,7 @@
list.forEach(elem => { list.forEach(elem => {
this.queryForm.queryObject.productType.config.data.push({ value: elem.code, label: elem.name }); this.queryForm.queryObject.productType.config.data.push({ value: elem.code, label: elem.name });
}); });
this.convertList(list, this.productTypeList, elem => { this.$convertList(list, this.productTypeList, elem => {
return true; return true;
}); });
}); });
@ -184,19 +174,6 @@
} }
}, },
convertField(fieldValue, enumList, converFormat) {
if (converFormat && converFormat.length >= 2) {
let value = converFormat[0];
let label = converFormat[1];
for (let i = 0; enumList && i < enumList.length; i++) {
if ('' + fieldValue === '' + enumList[i][value]) {
return enumList[i][label];
}
}
}
},
handleAdd(index, row) { handleAdd(index, row) {
this.$emit('selectGoods', row); this.$emit('selectGoods', row);
this.doClose(); this.doClose();

View File

@ -280,16 +280,6 @@
resizeHandler: function () { resizeHandler: function () {
this.height = this._clientHeight - 170; this.height = this._clientHeight - 170;
}, },
convertList(FromList, ToList, ChecktypeFunction) {
if (FromList) {
ToList.length = 0;
FromList.forEach(elem => {
if (ChecktypeFunction(elem)) {
ToList.push({ value: elem.code, label: elem.name });
}
});
}
},
buttonClick() { buttonClick() {
this.$refs.addGoods.doShow(); this.$refs.addGoods.doShow();
}, },
@ -328,31 +318,31 @@
}) })
this.$Dictionary.permissionType().then(list => { this.$Dictionary.permissionType().then(list => {
this.convertList(list, this.PermissionTypeList, elem => { this.$convertList(list, this.PermissionTypeList, elem => {
return true; return true;
}); });
}); });
this.$Dictionary.orderType().then(list => { this.$Dictionary.orderType().then(list => {
this.convertList(list, this.OrderTypeList, elem => { this.$convertList(list, this.OrderTypeList, elem => {
return elem.code !== '01' // return elem.code !== '01' //
}); });
}); });
this.$Dictionary.payStatus().then(list => { this.$Dictionary.payStatus().then(list => {
this.convertList(list, this.PayStatusTypeList, elem => { this.$convertList(list, this.PayStatusTypeList, elem => {
return elem.code !== '03' // return elem.code !== '03' //
}); });
}); });
this.$Dictionary.payType().then(list => { this.$Dictionary.payType().then(list => {
this.convertList(list, this.PayTypeList, elem => { this.$convertList(list, this.PayTypeList, elem => {
return true return true
}); });
}); });
this.$Dictionary.bizType().then(list => { this.$Dictionary.bizType().then(list => {
this.convertList(list, this.BizTypeList, elem => { this.$convertList(list, this.BizTypeList, elem => {
return true; return true;
}); });
}); });

View File

@ -86,7 +86,7 @@
title: '权限类型', title: '权限类型',
prop: 'permissionType', prop: 'permissionType',
type: 'tag', type: 'tag',
columnValue: (row) => { return this.convertField(row.permissionType, this.PermissionTypeList, ['value', 'label']) }, columnValue: (row) => { return this.$convertField(row.permissionType, this.PermissionTypeList, ['value', 'label']) },
tagType: (row) => { return '' } tagType: (row) => { return '' }
}, },
{ {
@ -120,7 +120,7 @@
title: '支付方式', title: '支付方式',
prop: 'payWays', prop: 'payWays',
type: 'tag', type: 'tag',
columnValue: (row) => { return this.convertField(row.payWays, this.PayTypeList, ['value', 'label']) }, columnValue: (row) => { return this.$convertField(row.payWays, this.PayTypeList, ['value', 'label']) },
tagType: (row) => { return 'success' } tagType: (row) => { return 'success' }
}, },
{ {
@ -131,7 +131,7 @@
title: '订单类型', title: '订单类型',
prop: 'orderType', prop: 'orderType',
type: 'tag', type: 'tag',
columnValue: (row) => { return this.convertField(row.orderType, this.OrderTypeList, ['value', 'label']) }, columnValue: (row) => { return this.$convertField(row.orderType, this.OrderTypeList, ['value', 'label']) },
tagType: (row) => { return 'success' } tagType: (row) => { return 'success' }
}, },
{ {
@ -142,14 +142,14 @@
title: '业务类型', title: '业务类型',
prop: 'bizType', prop: 'bizType',
type: 'tag', type: 'tag',
columnValue: (row) => { return this.convertField(row.bizType, this.BizTypeList, ['value', 'label']) }, columnValue: (row) => { return this.$convertField(row.bizType, this.BizTypeList, ['value', 'label']) },
tagType: (row) => { return 'success' } tagType: (row) => { return 'success' }
}, },
{ {
title: '支付状态', title: '支付状态',
prop: 'payStatus', prop: 'payStatus',
type: 'tag', type: 'tag',
columnValue: (row) => { return this.convertField(row.payStatus, this.PayStatusList, ['value', 'label']) }, columnValue: (row) => { return this.$convertField(row.payStatus, this.PayStatusList, ['value', 'label']) },
tagType: (row) => { tagType: (row) => {
switch (row.payStatus) { switch (row.payStatus) {
case '01': return 'danger'; case '01': return 'danger';
@ -199,27 +199,6 @@
this.loadInitData(); this.loadInitData();
}, },
methods: { methods: {
convertList(FromList, ToList, ChecktypeFunction) {
if (FromList) {
ToList.length = 0;
FromList.forEach(elem => {
if (ChecktypeFunction(elem)) {
ToList.push({ value: elem.code, label: elem.name });
}
});
}
},
convertField(fieldValue, enumList, converFormat) {
if (converFormat && converFormat.length >= 2) {
let value = converFormat[0];
let label = converFormat[1];
for (let i = 0; enumList && i < enumList.length; i++) {
if ('' + fieldValue === '' + enumList[i][value]) {
return enumList[i][label];
}
}
}
},
loadInitData() { loadInitData() {
this.queryForm.queryObject.organizationId.config.data.length = 0; this.queryForm.queryObject.organizationId.config.data.length = 0;
getOrganizationList().then(response => { getOrganizationList().then(response => {
@ -234,32 +213,32 @@
}) })
this.$Dictionary.bizType().then(list => { this.$Dictionary.bizType().then(list => {
this.convertList(list, this.BizTypeList, elem => { this.$convertList(list, this.BizTypeList, elem => {
return true; return true;
}); });
}) })
this.$Dictionary.orderType().then(list => { this.$Dictionary.orderType().then(list => {
this.convertList(list, this.OrderTypeList, elem => { this.$convertList(list, this.OrderTypeList, elem => {
return true; return true;
}); });
}) })
this.$Dictionary.payType().then(list => { this.$Dictionary.payType().then(list => {
this.convertList(list, this.PayTypeList, elem => { this.$convertList(list, this.PayTypeList, elem => {
return true; return true;
}); });
}) })
this.$Dictionary.payStatus().then(list => { this.$Dictionary.payStatus().then(list => {
this.convertList(list, this.PayStatusList, elem => { this.$convertList(list, this.PayStatusList, elem => {
return true; return true;
}); });
}) })
this.$Dictionary.effectiveType().then(list => { this.$Dictionary.effectiveType().then(list => {
this.convertList(list, this.EffectiveTypeList, elem => { this.$convertList(list, this.EffectiveTypeList, elem => {
return true; return true;
}); });
}) })
@ -268,7 +247,7 @@
list.forEach(elem => { list.forEach(elem => {
this.queryForm.queryObject.permissionType.config.data.push({ value: elem.code, label: elem.name }); this.queryForm.queryObject.permissionType.config.data.push({ value: elem.code, label: elem.name });
}); });
this.convertList(list, this.PermissionTypeList, elem => { this.$convertList(list, this.PermissionTypeList, elem => {
return true; return true;
}); });
}) })

View File

@ -74,7 +74,7 @@
title: '权限类型', title: '权限类型',
prop: 'permissionType', prop: 'permissionType',
type: 'tag', type: 'tag',
columnValue: (row) => { return this.convertField(row.permissionType, this.PermissionTypeList, ['value', 'label']) }, columnValue: (row) => { return this.$convertField(row.permissionType, this.PermissionTypeList, ['value', 'label']) },
tagType: (row) => { return '' } tagType: (row) => { return '' }
}, },
{ {
@ -118,7 +118,7 @@
title: '课程权限状态', title: '课程权限状态',
prop: 'status', prop: 'status',
type: 'tag', type: 'tag',
columnValue: (row) => { return this.convertField(row.status, this.EffectiveTypeList, ['value', 'label']) }, columnValue: (row) => { return this.$convertField(row.status, this.EffectiveTypeList, ['value', 'label']) },
tagType: (row) => { tagType: (row) => {
switch (row.status) { switch (row.status) {
case '1': return 'success'; case '1': return 'success';
@ -134,30 +134,9 @@
this.loadInitData(); this.loadInitData();
}, },
methods: { methods: {
convertList(FromList, ToList, ChecktypeFunction) {
if (FromList) {
ToList.length = 0;
FromList.forEach(elem => {
if (ChecktypeFunction(elem)) {
ToList.push({ value: elem.code, label: elem.name });
}
});
}
},
convertField(fieldValue, enumList, converFormat) {
if (converFormat && converFormat.length >= 2) {
let value = converFormat[0];
let label = converFormat[1];
for (let i = 0; enumList && i < enumList.length; i++) {
if ('' + fieldValue === '' + enumList[i][value]) {
return enumList[i][label];
}
}
}
},
loadInitData() { loadInitData() {
this.$Dictionary.effectiveType().then(list => { this.$Dictionary.effectiveType().then(list => {
this.convertList(list, this.EffectiveTypeList, elem => { this.$convertList(list, this.EffectiveTypeList, elem => {
return true; return true;
}); });
}); });
@ -165,7 +144,7 @@
list.forEach(elem => { list.forEach(elem => {
this.queryForm.queryObject.permissionType.config.data.push({ value: elem.code, label: elem.name }); this.queryForm.queryObject.permissionType.config.data.push({ value: elem.code, label: elem.name });
}); });
this.convertList(list, this.PermissionTypeList, elem => { this.$convertList(list, this.PermissionTypeList, elem => {
return true; return true;
}); });
}); });

View File

@ -84,7 +84,7 @@
title: '权限类型', title: '权限类型',
prop: 'permissionType', prop: 'permissionType',
type: 'tag', type: 'tag',
columnValue: (row) => { return this.convertField(row.permissionType, this.PermissionTypeList, ['value', 'label']) }, columnValue: (row) => { return this.$convertField(row.permissionType, this.PermissionTypeList, ['value', 'label']) },
tagType: (row) => { return '' } tagType: (row) => { return '' }
}, },
{ {
@ -171,17 +171,6 @@
this.queryForm.queryObject.canDistribute.config.data = this.$ConstSelect.PermissionUseList; this.queryForm.queryObject.canDistribute.config.data = this.$ConstSelect.PermissionUseList;
}, },
methods: { methods: {
convertField(fieldValue, enumList, converFormat) {
if (converFormat && converFormat.length >= 2) {
let value = converFormat[0];
let label = converFormat[1];
for (let i = 0; enumList && i < enumList.length; i++) {
if ('' + fieldValue === '' + enumList[i][value]) {
return enumList[i][label];
}
}
}
},
formatterDate(row, porpInfo) { formatterDate(row, porpInfo) {
return String(row[porpInfo.property] || '').split(' ')[0]; return String(row[porpInfo.property] || '').split(' ')[0];
}, },

View File

@ -87,7 +87,7 @@
title: '权限类型', title: '权限类型',
prop: 'permissionType', prop: 'permissionType',
type: 'tag', type: 'tag',
columnValue: (row) => { return this.convertField(row.permissionType, this.PermissionTypeList, ['value', 'label']) }, columnValue: (row) => { return this.$convertField(row.permissionType, this.PermissionTypeList, ['value', 'label']) },
tagType: (row) => { return '' } tagType: (row) => { return '' }
}, },
{ {
@ -131,7 +131,7 @@
title: '权限状态', title: '权限状态',
prop: 'status', prop: 'status',
type: 'tag', type: 'tag',
columnValue: (row) => { return this.convertField(row.status, this.EffectiveTypeList, ['value', 'label']) }, columnValue: (row) => { return this.$convertField(row.status, this.EffectiveTypeList, ['value', 'label']) },
tagType: (row) => { tagType: (row) => {
switch (row.status) { switch (row.status) {
case '1': return 'success'; case '1': return 'success';
@ -183,33 +183,12 @@
this.loadInitData(); this.loadInitData();
}, },
methods: { methods: {
convertList(FromList, ToList, ChecktypeFunction) {
if (FromList) {
ToList.length = 0;
FromList.forEach(elem => {
if (ChecktypeFunction(elem)) {
ToList.push({ value: elem.code, label: elem.name });
}
});
}
},
convertField(fieldValue, enumList, converFormat) {
if (converFormat && converFormat.length >= 2) {
let value = converFormat[0];
let label = converFormat[1];
for (let i = 0; enumList && i < enumList.length; i++) {
if ('' + fieldValue === '' + enumList[i][value]) {
return enumList[i][label];
}
}
}
},
loadInitData() { loadInitData() {
this.$Dictionary.effectiveType().then(list => { this.$Dictionary.effectiveType().then(list => {
list.forEach(elem => { list.forEach(elem => {
this.queryForm.queryObject.status.config.data.push({ value: elem.code, label: elem.name }); this.queryForm.queryObject.status.config.data.push({ value: elem.code, label: elem.name });
}) })
this.convertList(list, this.EffectiveTypeList, elem => { this.$convertList(list, this.EffectiveTypeList, elem => {
return true; return true;
}); });
}); });
@ -217,7 +196,7 @@
list.forEach(elem => { list.forEach(elem => {
this.queryForm.queryObject.permissionType.config.data.push({ value: elem.code, label: elem.name }); this.queryForm.queryObject.permissionType.config.data.push({ value: elem.code, label: elem.name });
}); });
this.convertList(list, this.PermissionTypeList, elem => { this.$convertList(list, this.PermissionTypeList, elem => {
return true; return true;
}); });
this.PermissionTypeList.push({ value: undefined, label: '权限包' }); this.PermissionTypeList.push({ value: undefined, label: '权限包' });

View File

@ -1,232 +1,220 @@
<template> <template>
<div> <div>
<QueryListPage ref="queryListPage" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList"> <QueryListPage ref="queryListPage" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList"/>
</QueryListPage> <select-role ref="selectRole" @reloadTable="reloadTable"/>
<select-role ref="selectRole" @reloadTable="reloadTable"></select-role> </div>
</div>
</template> </template>
<script> <script>
import { listUserPermision } from '@/api/management/author'; import { listUserPermision } from '@/api/management/author';
import { UrlConfig } from '@/router/index'; import { UrlConfig } from '@/router/index';
import { superAdmin } from '@/router'; import { superAdmin } from '@/router';
import selectRole from './selectRole/list'; import selectRole from './selectRole/list';
export default { export default {
name: 'author', name: 'Author',
components: { components: {
selectRole, selectRole
}, },
data() { data() {
return { return {
param: '', param: '',
WhetherTypeList: [], WhetherTypeList: [],
EffectiveTypeList: [], EffectiveTypeList: [],
PermissionTypeList: [], PermissionTypeList: [],
pagerConfig: { pagerConfig: {
pageSize: 'pageSize', pageSize: 'pageSize',
pageIndex: 'pageNum' pageIndex: 'pageNum'
}, },
queryForm: { queryForm: {
labelWidth: '120px', labelWidth: '120px',
reset: true, reset: true,
queryObject: { queryObject: {
'type': { 'type': {
type: 'select', type: 'select',
label: '权限类型', label: '权限类型',
config: { config: {
data: [] data: []
} }
}, },
'status': { 'status': {
type: 'select', type: 'select',
label: '权限状态', label: '权限状态',
value: '1', value: '1',
config: { config: {
data: [] data: []
} }
}, },
'canDistribute': { 'canDistribute': {
type: 'select', type: 'select',
label: '公用/专用', label: '公用/专用',
config: { config: {
data: [] data: []
} }
} }
} }
}, },
queryList: { queryList: {
query: this.queryFunction, query: this.queryFunction,
selectCheckShow: false, selectCheckShow: false,
indexShow: true, indexShow: true,
columns: [ columns: [
{ {
title: '权限类型', title: '权限类型',
prop: 'type', prop: 'type',
type: 'tag', type: 'tag',
columnValue: (row) => { return this.convertField(row.type, this.PermissionTypeList, ['value', 'label']) }, columnValue: (row) => { return this.$convertField(row.type, this.PermissionTypeList, ['value', 'label']); },
tagType: (row) => { return '' } tagType: (row) => { return ''; }
}, },
{ {
title: '地图名称', title: '地图名称',
prop: 'mapName', prop: 'mapName'
}, },
{ {
title: '地图产品名称', title: '地图产品名称',
prop: 'mapProductName', prop: 'mapProductName'
}, },
{ {
title: '课程名称', title: '课程名称',
prop: 'lessonName', prop: 'lessonName'
}, },
{ {
title: '公用/专用', title: '公用/专用',
prop: 'canDistribute', prop: 'canDistribute',
type: 'tag', type: 'tag',
columnValue: (row) => { return this.$ConstSelect.translate(row.canDistribute, 'PermissionUseList') }, columnValue: (row) => { return this.$ConstSelect.translate(row.canDistribute, 'PermissionUseList'); },
tagType: (row) => { tagType: (row) => {
switch (row.canDistribute) { switch (row.canDistribute) {
case true: return 'success'; case true: return 'success';
case false: return 'danger'; case false: return 'danger';
} }
} }
}, },
{ {
title: '是否永久', title: '是否永久',
prop: 'forever', prop: 'forever',
type: 'tag', type: 'tag',
columnValue: (row) => { return this.$ConstSelect.translate(row.forever, 'Whether') }, columnValue: (row) => { return this.$ConstSelect.translate(row.forever, 'Whether'); },
tagType: (row) => { tagType: (row) => {
switch (row.forever) { switch (row.forever) {
case true: return 'success'; case true: return 'success';
case false: return 'danger'; case false: return 'danger';
} }
} }
}, },
{ {
title: '权限总数', title: '权限总数',
prop: 'amount' prop: 'amount'
}, },
{ {
title: '剩余权限数量', title: '剩余权限数量',
prop: 'remains' prop: 'remains'
}, },
{ {
title: '开始时间', title: '开始时间',
prop: 'startTime', prop: 'startTime',
type: 'formatter', type: 'formatter',
formatter: this.formatterDate formatter: this.formatterDate
}, },
{ {
title: '结束时间', title: '结束时间',
prop: 'endTime', prop: 'endTime',
type: 'formatter', type: 'formatter',
formatter: this.formatterDate formatter: this.formatterDate
}, },
{ {
title: '权限归属人', title: '权限归属人',
prop: 'ownerName', prop: 'ownerName',
isShow: () => { return this.$store.state.user.roles.indexOf(superAdmin) != -1; }, isShow: () => { return this.$store.state.user.roles.indexOf(superAdmin) != -1; }
}, },
{ {
title: '权限状态', title: '权限状态',
prop: 'status', prop: 'status',
type: 'tag', type: 'tag',
columnValue: (row) => { return this.convertField(row.status, this.EffectiveTypeList, ['value', 'label']) }, columnValue: (row) => { return this.$convertField(row.status, this.EffectiveTypeList, ['value', 'label']); },
tagType: (row) => { tagType: (row) => {
switch (row.status) { switch (row.status) {
case '1': return 'success'; case '1': return 'success';
default: return 'danger'; default: return 'danger';
} }
} }
}, },
{ {
type: 'button', type: 'button',
title: '操作', title: '操作',
width: '200', width: '200',
hide: () => { return this.$store.state.user.roles.indexOf(superAdmin) < 0; }, hide: () => { return this.$store.state.user.roles.indexOf(superAdmin) < 0; },
buttons: [ buttons: [
{ {
name: '设置归属人', name: '设置归属人',
handleClick: this.handleRoleVest, handleClick: this.handleRoleVest,
type: '', type: ''
} }
] ]
} }
], ],
actions: [ actions: [
{ text: '打包权限', btnCode: 'employee_insert', handler: this.handlePermissionPack }, { text: '打包权限', btnCode: 'employee_insert', handler: this.handlePermissionPack }
] ]
} }
} };
}, },
mounted() { mounted() {
this.loadInitData(); this.loadInitData();
}, },
methods: { methods: {
convertList(FromList, ToList, ChecktypeFunction) { convertList(FromList, ToList, ChecktypeFunction) {
if (FromList) { if (FromList) {
ToList.length = 0; ToList.length = 0;
FromList.forEach(elem => { FromList.forEach(elem => {
if (ChecktypeFunction(elem)) { if (ChecktypeFunction(elem)) {
ToList.push({ value: elem.code, label: elem.name }); ToList.push({ value: elem.code, label: elem.name });
} }
}); });
} }
}, },
convertField(fieldValue, enumList, converFormat) { handleRoleVest(index, row) {
if (converFormat && converFormat.length >= 2) { this.$refs.selectRole.doShow(row.id);
let value = converFormat[0]; },
let label = converFormat[1]; loadInitData() {
for (let i = 0; enumList && i < enumList.length; i++) { this.queryForm.queryObject.canDistribute.config.data = this.$ConstSelect.PermissionUseList;
if ('' + fieldValue === '' + enumList[i][value]) {
return enumList[i][label];
}
}
}
},
handleRoleVest(index, row) {
this.$refs.selectRole.doShow(row.id);
},
loadInitData() {
this.queryForm.queryObject.canDistribute.config.data = this.$ConstSelect.PermissionUseList;
this.$Dictionary.effectiveType().then(list => { this.$Dictionary.effectiveType().then(list => {
list.forEach(elem => { list.forEach(elem => {
this.queryForm.queryObject.status.config.data.push({ value: elem.code, label: elem.name }); this.queryForm.queryObject.status.config.data.push({ value: elem.code, label: elem.name });
}); });
this.convertList(list, this.EffectiveTypeList, elem => { this.$convertList(list, this.EffectiveTypeList, elem => {
return true; return true;
}); });
}); });
this.$Dictionary.permissionType().then(list => { this.$Dictionary.permissionType().then(list => {
list.forEach(elem => { list.forEach(elem => {
this.queryForm.queryObject.type.config.data.push({ value: elem.code, label: elem.name }); this.queryForm.queryObject.type.config.data.push({ value: elem.code, label: elem.name });
}); });
this.convertList(list, this.PermissionTypeList, elem => { this.$convertList(list, this.PermissionTypeList, elem => {
return true; return true;
}); });
}); });
}, },
formatterDate(row, porpInfo) { formatterDate(row, porpInfo) {
if (row.hasOwnProperty(porpInfo.property)) { if (row.hasOwnProperty(porpInfo.property)) {
} }
return row[porpInfo.property]; return row[porpInfo.property];
}, },
queryFunction(params) { queryFunction(params) {
return listUserPermision(params); return listUserPermision(params);
}, },
handlePermissionPack() { handlePermissionPack() {
this.$router.push({ path: `${UrlConfig.permission.permissionDraft}` }) this.$router.push({ path: `${UrlConfig.permission.permissionDraft}` });
}, },
reloadTable() { reloadTable() {
if (this.queryList && this.queryList.reload) { if (this.queryList && this.queryList.reload) {
this.queryList.reload() this.queryList.reload();
} }
} }
} }
} };
</script> </script>

View File

@ -82,21 +82,6 @@
doClose() { doClose() {
this.show = false; this.show = false;
}, },
convertField(fieldValue, enumList, converFormat) {
let arr = [];
if (converFormat && converFormat.length >= 2) {
let value = converFormat[0];
let label = converFormat[1];
enumList.forEach((element, i) => {
fieldValue.forEach((v, j) => {
if ('' + fieldValue[j] === '' + enumList[i][value]) {
arr.push(enumList[i][label])
}
})
});
}
return arr;
},
selectRole(index, row) { selectRole(index, row) {
this.$confirm(`是否确定设置"${row.name}"为权限所属人`, '提示', { this.$confirm(`是否确定设置"${row.name}"为权限所属人`, '提示', {

View File

@ -74,7 +74,7 @@ export default {
prop: 'lessonId', prop: 'lessonId',
type: 'tag', type: 'tag',
show: !this.$route.query.lessonId, show: !this.$route.query.lessonId,
columnValue: (row) => { return this.convertField(row.lessonId, this.OrganizationList, ['id', 'name']); }, columnValue: (row) => { return this.$convertField(row.lessonId, this.OrganizationList, ['id', 'name']); },
tagType: (row) => { return ''; } tagType: (row) => { return ''; }
}, },
{ {
@ -122,7 +122,7 @@ export default {
title: '状态', title: '状态',
prop: 'status', prop: 'status',
type: 'tag', type: 'tag',
columnValue: (row) => { return this.convertField(row.status, this.EffectiveTypeList, ['value', 'label']); }, columnValue: (row) => { return this.$convertField(row.status, this.EffectiveTypeList, ['value', 'label']); },
tagType: (row) => { tagType: (row) => {
switch (row.status) { switch (row.status) {
case '1': return 'success'; case '1': return 'success';
@ -214,7 +214,7 @@ export default {
}); });
this.$Dictionary.effectiveType().then(list => { this.$Dictionary.effectiveType().then(list => {
this.convertList(list, this.EffectiveTypeList, elem => { this.$convertList(list, this.EffectiveTypeList, elem => {
return true; return true;
}); });
}); });

View File

@ -46,7 +46,7 @@ export default {
title: '皮肤类型', title: '皮肤类型',
prop: 'skinStyle', prop: 'skinStyle',
type: 'tag', type: 'tag',
columnValue: (row) => { return this.convertField(row.skinStyle, this.skinStyleList, ['code', 'name']); }, columnValue: (row) => { return this.$convertField(row.skinStyle, this.skinStyleList, ['code', 'name']); },
tagType: (row) => { return ''; } tagType: (row) => { return ''; }
}, },
{ {
@ -57,7 +57,7 @@ export default {
title: '产品类型', title: '产品类型',
prop: 'prdType', prop: 'prdType',
type: 'tag', type: 'tag',
columnValue: (row) => { return this.convertField(row.prdType, this.prdTypeList, ['code', 'name']); }, columnValue: (row) => { return this.$convertField(row.prdType, this.prdTypeList, ['code', 'name']); },
tagType: (row) => { return 'success'; } tagType: (row) => { return 'success'; }
}, },
// { // {

View File

@ -50,7 +50,7 @@ export default {
title: '所属城市', title: '所属城市',
prop: 'cityCode', prop: 'cityCode',
type: 'tag', type: 'tag',
columnValue: (row) => { return this.convertField(row.cityCode, this.cityList, ['code', 'name']); }, columnValue: (row) => { return this.$convertField(row.cityCode, this.cityList, ['code', 'name']); },
tagType: (row) => { return 'success'; } tagType: (row) => { return 'success'; }
}, },
{ {

View File

@ -51,14 +51,14 @@ export default {
title: '所属城市', title: '所属城市',
prop: 'cityCode', prop: 'cityCode',
type: 'tag', type: 'tag',
columnValue: (row) => { return this.convertField(row.cityCode, this.cityList, ['code', 'name']); }, columnValue: (row) => { return this.$convertField(row.cityCode, this.cityList, ['code', 'name']); },
tagType: (row) => { return 'success'; } tagType: (row) => { return 'success'; }
}, },
{ {
title: '皮肤类型', title: '皮肤类型',
prop: 'skinStyle', prop: 'skinStyle',
type: 'tag', type: 'tag',
columnValue: (row) => { return this.convertField(row.skinStyle, this.skinStyleList, ['code', 'name']); }, columnValue: (row) => { return this.$convertField(row.skinStyle, this.skinStyleList, ['code', 'name']); },
tagType: (row) => { return ''; } tagType: (row) => { return ''; }
}, },
{ {

View File

@ -56,7 +56,7 @@ export default {
prop: 'skinStyle', prop: 'skinStyle',
type: 'tag', type: 'tag',
columnValue: (row) => { columnValue: (row) => {
return this.convertField(row.skinStyle, this.skinStyleList, ['code', 'name']); return this.$convertField(row.skinStyle, this.skinStyleList, ['code', 'name']);
}, },
tagType: (row) => { return 'success'; } tagType: (row) => { return 'success'; }
} }

View File

@ -50,7 +50,7 @@ export default {
prop: 'skinStyle', prop: 'skinStyle',
type: 'tag', type: 'tag',
columnValue: (row) => { columnValue: (row) => {
return this.convertField(row.skinStyle, this.skinStyleList, ['code', 'name']); return this.$convertField(row.skinStyle, this.skinStyleList, ['code', 'name']);
}, },
tagType: (row) => { return ''; } tagType: (row) => { return ''; }
}, },

View File

@ -50,7 +50,7 @@ export default {
prop: 'skinStyle', prop: 'skinStyle',
type: 'tag', type: 'tag',
columnValue: (row) => { columnValue: (row) => {
return this.convertField(row.skinStyle, this.skinStyleList, ['code', 'name']); return this.$convertField(row.skinStyle, this.skinStyleList, ['code', 'name']);
}, },
tagType: (row) => { return ''; } tagType: (row) => { return ''; }
}, },

View File

@ -45,7 +45,7 @@ export default {
prop: 'skinCode', prop: 'skinCode',
type: 'tag', type: 'tag',
columnValue: (row) => { columnValue: (row) => {
return this.convertField(row.skinCode, this.skinCodeList, ['code', 'name']); return this.$convertField(row.skinCode, this.skinCodeList, ['code', 'name']);
}, },
tagType: (row) => { return ''; } tagType: (row) => { return ''; }
}, },

View File

@ -54,7 +54,7 @@
title: '状态', title: '状态',
prop: 'status', prop: 'status',
type: 'tag', type: 'tag',
columnValue: (row) => { return this.convertField(row.status, this.EffectiveTypeList, ['value', 'label']) }, columnValue: (row) => { return this.$convertField(row.status, this.EffectiveTypeList, ['value', 'label']) },
tagType: (row) => { tagType: (row) => {
switch (row.status) { switch (row.status) {
case '1': return 'success'; case '1': return 'success';
@ -97,17 +97,6 @@
} }
}, },
methods: { methods: {
convertField(fieldValue, enumList, converFormat) {
if (converFormat && converFormat.length >= 2) {
let value = converFormat[0];
let label = converFormat[1];
for (let i = 0; enumList && i < enumList.length; i++) {
if ('' + fieldValue === '' + enumList[i][value]) {
return enumList[i][label];
}
}
}
},
loadInitData() { loadInitData() {
this.EffectiveTypeList = []; this.EffectiveTypeList = [];
this.$Dictionary.effectiveType().then(list => { this.$Dictionary.effectiveType().then(list => {