优化代码

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
},
beforeQuery: {
type: Function
type: Function,
default(val) {
return val;
}
},
canQuery: {
type: Boolean,
@ -449,7 +452,7 @@ export default {
}
}
//
resultData = this.beforeQuery ? this.beforeQuery(resultData) : resultData;
resultData = this.beforeQuery(resultData);
return resultData;
},
query() {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -53,7 +53,7 @@
prop: 'skinStyle',
type: 'tag',
columnValue: (row) => {
return this.convertField(row.skinStyle, this.skinStyleList, ['code', 'name'])
return this.$convertField(row.skinStyle, this.skinStyleList, ['code', 'name'])
},
tagType: (row) => { return 'success' }
}
@ -89,17 +89,6 @@
}
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() {
if (this.$refs && this.$refs.pageRules) {

View File

@ -50,7 +50,7 @@
prop: 'skinStyle',
type: 'tag',
columnValue: (row) => {
return this.convertField(row.skinStyle, this.skinStyleList, ['code', 'name'])
return this.$convertField(row.skinStyle, this.skinStyleList, ['code', 'name'])
},
tagType: (row) => { return 'success' }
}
@ -86,17 +86,6 @@
}
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() {
this.doClose();
if (this.$refs && this.$refs.pageRules) {

View File

@ -53,7 +53,7 @@
prop: 'skinStyle',
type: 'tag',
columnValue: (row) => {
return this.convertField(row.skinStyle, this.skinStyleList, ['code', 'name'])
return this.$convertField(row.skinStyle, this.skinStyleList, ['code', 'name'])
},
tagType: (row) => { return 'success' }
}
@ -89,17 +89,6 @@
}
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() {
if (this.$refs && this.$refs.pageRules) {

View File

@ -22,9 +22,6 @@ import '@/scripts/GlobalPlugin';
import '@/directives';
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(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: '皮肤类型',
prop: 'skinCode',
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'; }
},
{

View File

@ -81,28 +81,28 @@ export default {
title: '皮肤类型',
prop: 'skinStyle',
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'; }
},
{
title: '产品',
prop: 'prdCode',
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'; }
},
{
title: '实训类型',
prop: 'type',
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'; }
},
{
title: '操作类型',
prop: 'operateType',
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'; }
},
{

View File

@ -59,7 +59,7 @@
prop: 'skinCode',
type: 'tag',
columnValue: (row) => {
return this.convertField(row.skinCode, this.skinCodeList, ['code', 'name'])
return this.$convertField(row.skinCode, this.skinCodeList, ['code', 'name'])
},
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) {
createQuest(data).then(resp => {

View File

@ -50,7 +50,7 @@
title: '皮肤类型',
prop: 'parameter',
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 '' }
},
{
@ -61,7 +61,7 @@
title: '状态',
prop: 'status',
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' } }
},
{
@ -115,17 +115,6 @@
this.loadInitData();
},
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() {
this.skinStyleList = [];
getSkinStyleList().then(response => {

View File

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

View File

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

View File

@ -72,21 +72,21 @@
title: '皮肤类型',
prop: 'skinStyle',
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 '' }
},
{
title: '实训类型',
prop: 'trainingType',
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' }
},
{
title: '操作类型',
prop: 'operateType',
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' }
},
{
@ -205,17 +205,6 @@
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) {
this.queryForm.queryObject.operateType.config.data = [];

View File

@ -99,28 +99,28 @@ export default {
title: '皮肤类型',
prop: 'skinStyle',
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 ''; }
},
{
title: '产品',
prop: 'prdCode',
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'; }
},
{
title: '实训类型',
prop: 'type',
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'; }
},
{
title: '操作类型',
prop: 'operateType',
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'; }
},
{

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -57,7 +57,7 @@
title: '考试结果',
prop: 'result',
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) => {
switch (row.result) {
case '01': return 'warning';
@ -108,17 +108,6 @@
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) {

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) {

View File

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

View File

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

View File

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

View File

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

View File

@ -52,7 +52,7 @@
title: '皮肤类型',
prop: 'skinStyle',
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 '' }
},
{
@ -114,19 +114,6 @@
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() {
this.$router.push({ path: `${UrlConfig.map.productDraft}/add/0` });

View File

@ -152,16 +152,6 @@
resizeHandler: function () {
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() {
//
this.display = 1;

View File

@ -115,17 +115,6 @@
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() {
this.$router.push(`${UrlConfig.map.skinStyleDraft}/add/null`);
},

View File

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

View File

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

View File

@ -76,7 +76,7 @@
title: '权限类型',
prop: 'type',
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 '' }
},
{
@ -128,7 +128,7 @@
title: '课程权限状态',
prop: 'status',
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) => {
switch (row.status) {
case '1': return 'success';
@ -183,30 +183,9 @@
this.loadInitData();
},
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() {
this.$Dictionary.effectiveType().then(list => {
this.convertList(list, this.EffectiveTypeList, elem => {
this.$convertList(list, this.EffectiveTypeList, elem => {
return true;
});
});
@ -214,7 +193,7 @@
list.forEach(elem => {
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;
});
});

View File

@ -190,16 +190,6 @@
resizeHandler: function () {
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() {
//
// ,
@ -218,7 +208,7 @@
}
//
this.$Dictionary.productType().then(list => {
this.convertList(list, this.productTypeList, elem => {
this.$convertList(list, this.productTypeList, elem => {
return true;
});
});
@ -226,7 +216,7 @@
//
this.TimeStyleDict = {};
this.$Dictionary.timeStyleType().then(list => {
this.convertList(list, this.TimeStyleList, elem => {
this.$convertList(list, this.TimeStyleList, elem => {
return true;
});
list.forEach(elem => {

View File

@ -64,7 +64,7 @@
title: '产品类型',
prop: 'productType',
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' }
},
{
@ -87,7 +87,7 @@
title: '状态',
prop: 'status',
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) => {
switch (row.status) {
case '1': return 'success';
@ -149,19 +149,9 @@
this.loadInitData();
},
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() {
this.$Dictionary.effectiveType().then(list => {
this.convertList(list, this.EffectiveTypeList, elem => {
this.$convertList(list, this.EffectiveTypeList, elem => {
return true;
});
});
@ -170,7 +160,7 @@
list.forEach(elem => {
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;
});
});
@ -184,17 +174,6 @@
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) {
this.$router.push({ path: `${UrlConfig.orderauthor.commodityDraft}/edit/${row.id}` });
},

View File

@ -78,7 +78,7 @@
title: '产品类型',
prop: 'productType',
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' }
},
{
@ -101,7 +101,7 @@
title: '状态',
prop: 'status',
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) => {
switch (row.status) {
case '1': return 'success';
@ -148,19 +148,9 @@
doClose() {
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() {
this.$Dictionary.effectiveType().then(list => {
this.convertList(list, this.EffectiveTypeList, elem => {
this.$convertList(list, this.EffectiveTypeList, elem => {
return true;
});
});
@ -169,7 +159,7 @@
list.forEach(elem => {
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;
});
});
@ -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) {
this.$emit('selectGoods', row);
this.doClose();

View File

@ -280,16 +280,6 @@
resizeHandler: function () {
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() {
this.$refs.addGoods.doShow();
},
@ -328,31 +318,31 @@
})
this.$Dictionary.permissionType().then(list => {
this.convertList(list, this.PermissionTypeList, elem => {
this.$convertList(list, this.PermissionTypeList, elem => {
return true;
});
});
this.$Dictionary.orderType().then(list => {
this.convertList(list, this.OrderTypeList, elem => {
this.$convertList(list, this.OrderTypeList, elem => {
return elem.code !== '01' //
});
});
this.$Dictionary.payStatus().then(list => {
this.convertList(list, this.PayStatusTypeList, elem => {
this.$convertList(list, this.PayStatusTypeList, elem => {
return elem.code !== '03' //
});
});
this.$Dictionary.payType().then(list => {
this.convertList(list, this.PayTypeList, elem => {
this.$convertList(list, this.PayTypeList, elem => {
return true
});
});
this.$Dictionary.bizType().then(list => {
this.convertList(list, this.BizTypeList, elem => {
this.$convertList(list, this.BizTypeList, elem => {
return true;
});
});

View File

@ -86,7 +86,7 @@
title: '权限类型',
prop: 'permissionType',
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 '' }
},
{
@ -120,7 +120,7 @@
title: '支付方式',
prop: 'payWays',
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' }
},
{
@ -131,7 +131,7 @@
title: '订单类型',
prop: 'orderType',
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' }
},
{
@ -142,14 +142,14 @@
title: '业务类型',
prop: 'bizType',
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' }
},
{
title: '支付状态',
prop: 'payStatus',
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) => {
switch (row.payStatus) {
case '01': return 'danger';
@ -199,27 +199,6 @@
this.loadInitData();
},
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() {
this.queryForm.queryObject.organizationId.config.data.length = 0;
getOrganizationList().then(response => {
@ -234,32 +213,32 @@
})
this.$Dictionary.bizType().then(list => {
this.convertList(list, this.BizTypeList, elem => {
this.$convertList(list, this.BizTypeList, elem => {
return true;
});
})
this.$Dictionary.orderType().then(list => {
this.convertList(list, this.OrderTypeList, elem => {
this.$convertList(list, this.OrderTypeList, elem => {
return true;
});
})
this.$Dictionary.payType().then(list => {
this.convertList(list, this.PayTypeList, elem => {
this.$convertList(list, this.PayTypeList, elem => {
return true;
});
})
this.$Dictionary.payStatus().then(list => {
this.convertList(list, this.PayStatusList, elem => {
this.$convertList(list, this.PayStatusList, elem => {
return true;
});
})
this.$Dictionary.effectiveType().then(list => {
this.convertList(list, this.EffectiveTypeList, elem => {
this.$convertList(list, this.EffectiveTypeList, elem => {
return true;
});
})
@ -268,7 +247,7 @@
list.forEach(elem => {
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;
});
})

View File

@ -74,7 +74,7 @@
title: '权限类型',
prop: 'permissionType',
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 '' }
},
{
@ -118,7 +118,7 @@
title: '课程权限状态',
prop: 'status',
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) => {
switch (row.status) {
case '1': return 'success';
@ -134,30 +134,9 @@
this.loadInitData();
},
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() {
this.$Dictionary.effectiveType().then(list => {
this.convertList(list, this.EffectiveTypeList, elem => {
this.$convertList(list, this.EffectiveTypeList, elem => {
return true;
});
});
@ -165,7 +144,7 @@
list.forEach(elem => {
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;
});
});

View File

@ -84,7 +84,7 @@
title: '权限类型',
prop: 'permissionType',
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 '' }
},
{
@ -171,17 +171,6 @@
this.queryForm.queryObject.canDistribute.config.data = this.$ConstSelect.PermissionUseList;
},
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) {
return String(row[porpInfo.property] || '').split(' ')[0];
},

View File

@ -87,7 +87,7 @@
title: '权限类型',
prop: 'permissionType',
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 '' }
},
{
@ -131,7 +131,7 @@
title: '权限状态',
prop: 'status',
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) => {
switch (row.status) {
case '1': return 'success';
@ -183,33 +183,12 @@
this.loadInitData();
},
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() {
this.$Dictionary.effectiveType().then(list => {
list.forEach(elem => {
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;
});
});
@ -217,7 +196,7 @@
list.forEach(elem => {
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;
});
this.PermissionTypeList.push({ value: undefined, label: '权限包' });

View File

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

View File

@ -82,21 +82,6 @@
doClose() {
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) {
this.$confirm(`是否确定设置"${row.name}"为权限所属人`, '提示', {

View File

@ -74,7 +74,7 @@ export default {
prop: 'lessonId',
type: 'tag',
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 ''; }
},
{
@ -122,7 +122,7 @@ export default {
title: '状态',
prop: 'status',
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) => {
switch (row.status) {
case '1': return 'success';
@ -214,7 +214,7 @@ export default {
});
this.$Dictionary.effectiveType().then(list => {
this.convertList(list, this.EffectiveTypeList, elem => {
this.$convertList(list, this.EffectiveTypeList, elem => {
return true;
});
});

View File

@ -46,7 +46,7 @@ export default {
title: '皮肤类型',
prop: 'skinStyle',
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 ''; }
},
{
@ -57,7 +57,7 @@ export default {
title: '产品类型',
prop: 'prdType',
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'; }
},
// {

View File

@ -50,7 +50,7 @@ export default {
title: '所属城市',
prop: 'cityCode',
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'; }
},
{

View File

@ -51,14 +51,14 @@ export default {
title: '所属城市',
prop: 'cityCode',
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'; }
},
{
title: '皮肤类型',
prop: 'skinStyle',
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 ''; }
},
{

View File

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

View File

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

View File

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

View File

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

View File

@ -54,7 +54,7 @@
title: '状态',
prop: 'status',
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) => {
switch (row.status) {
case '1': return 'success';
@ -97,17 +97,6 @@
}
},
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() {
this.EffectiveTypeList = [];
this.$Dictionary.effectiveType().then(list => {