desc: 调整高度样式
This commit is contained in:
parent
7246568801
commit
c08e2afaaa
59
.eslintrc.js
59
.eslintrc.js
@ -25,31 +25,31 @@ module.exports = {
|
|||||||
"vue/no-v-html": "off",
|
"vue/no-v-html": "off",
|
||||||
'accessor-pairs': 2,
|
'accessor-pairs': 2,
|
||||||
"arrow-spacing": 0,//=>的前/后括号
|
"arrow-spacing": 0,//=>的前/后括号
|
||||||
'block-spacing': [2, 'always'],
|
'block-spacing': [2, 'always'], // 禁止或强制在代码块中开括号前和闭括号后有空格 { return 11 }
|
||||||
'brace-style': [2, '1tbs', {
|
'brace-style': [2, '1tbs', { // 强制在代码块中使用一致的大括号风格
|
||||||
'allowSingleLine': true
|
'allowSingleLine': true
|
||||||
}],
|
}],
|
||||||
'camelcase': [0, {
|
'camelcase': [0, { // 强制使用驼峰拼写法命名规定
|
||||||
'properties': 'always'
|
'properties': 'always'
|
||||||
}],
|
}],
|
||||||
'comma-dangle': [2, 'never'],
|
'comma-dangle': [2, 'never'], // 要求或禁止末尾逗号
|
||||||
'comma-spacing': [2, {
|
'comma-spacing': [2, { // 强制在逗号前后使用一致的空格
|
||||||
'before': false,
|
'before': false,
|
||||||
'after': true
|
'after': true
|
||||||
}],
|
}],
|
||||||
'comma-style': [2, 'last'],
|
'comma-style': [2, 'last'], // 强制在逗号前后使用一致的空格
|
||||||
'constructor-super': 2,
|
'constructor-super': 2, // 要求在构造函数中有super()调用
|
||||||
'curly': [2, 'multi-line'],
|
'curly': [2, 'multi-line'], // 强制所有控制语句使用一致的括号风格
|
||||||
'dot-location': [2, 'property'],
|
'dot-location': [2, 'property'], // 强制在点号之前和之后一致的换行
|
||||||
'eol-last': 2,
|
'eol-last': 2, // 禁止文件末尾存在空行禁止文件末尾存在空行
|
||||||
'generator-star-spacing': [2, {
|
'generator-star-spacing': [2, {
|
||||||
'before': true,
|
'before': true,
|
||||||
'after': true
|
'after': true
|
||||||
}],
|
}],
|
||||||
'handle-callback-err': [2, '^(err|error)$'],
|
'handle-callback-err': [2, '^(err|error)$'],
|
||||||
'indent': ["error", "tab"],
|
'indent': [2, 4], // 强制使用一致的缩进
|
||||||
'jsx-quotes': [2, 'prefer-single'],
|
'jsx-quotes': [2, 'prefer-single'], // 强制在JSX属性中一致地使用双引号或单引号
|
||||||
'key-spacing': [2, {
|
'key-spacing': [0, { // 强制要求在对象字面量的属性中键和值之间使用一致的间距
|
||||||
'beforeColon': false,
|
'beforeColon': false,
|
||||||
'afterColon': true
|
'afterColon': true
|
||||||
}],
|
}],
|
||||||
@ -58,8 +58,8 @@ module.exports = {
|
|||||||
'after': true
|
'after': true
|
||||||
}],
|
}],
|
||||||
"new-cap": 2,//函数名首行大写必须使用new方式调用,首行小写必须用不带new方式调用
|
"new-cap": 2,//函数名首行大写必须使用new方式调用,首行小写必须用不带new方式调用
|
||||||
'new-parens': 2,
|
'new-parens': 2, // 要求构造无参构造函数时有圆括号
|
||||||
'no-array-constructor': 2,
|
'no-array-constructor': 2, // 禁用Array构造函数
|
||||||
'no-caller': 2,
|
'no-caller': 2,
|
||||||
'no-console': 'off',
|
'no-console': 'off',
|
||||||
'no-class-assign': 2,
|
'no-class-assign': 2,
|
||||||
@ -94,9 +94,10 @@ module.exports = {
|
|||||||
}],
|
}],
|
||||||
'no-lone-blocks': 2,
|
'no-lone-blocks': 2,
|
||||||
"no-mixed-spaces-and-tabs": [2, false],//禁止混用tab和空格
|
"no-mixed-spaces-and-tabs": [2, false],//禁止混用tab和空格
|
||||||
"no-multi-spaces": 1,//不能用多余的空格
|
"no-multi-spaces": 1,// 不能用多余的空格
|
||||||
'no-multi-str': 2,
|
'no-multi-str': 2,
|
||||||
'no-multiple-empty-lines': [2, {
|
'no-multiple-empty-lines': [2, { // 禁止出现多行空行
|
||||||
|
// 最大连续空行数
|
||||||
'max': 1
|
'max': 1
|
||||||
}],
|
}],
|
||||||
'no-native-reassign': 2,
|
'no-native-reassign': 2,
|
||||||
@ -121,7 +122,7 @@ module.exports = {
|
|||||||
'no-sparse-arrays': 2,
|
'no-sparse-arrays': 2,
|
||||||
'no-this-before-super': 2,
|
'no-this-before-super': 2,
|
||||||
'no-throw-literal': 2,
|
'no-throw-literal': 2,
|
||||||
"no-trailing-spaces": 1,//一行结束后面不要有空格
|
"no-trailing-spaces": 1,// 禁止行尾空格
|
||||||
'no-undef': 2,
|
'no-undef': 2,
|
||||||
'no-undef-init': 2,
|
'no-undef-init': 2,
|
||||||
'no-unexpected-multiline': 2,
|
'no-unexpected-multiline': 2,
|
||||||
@ -139,7 +140,7 @@ module.exports = {
|
|||||||
'no-useless-computed-key': 2,
|
'no-useless-computed-key': 2,
|
||||||
'no-useless-constructor': 2,
|
'no-useless-constructor': 2,
|
||||||
'no-useless-escape': 0,
|
'no-useless-escape': 0,
|
||||||
'no-whitespace-before-property': 2,
|
'no-whitespace-before-property': 2, // 禁止属性前有空白
|
||||||
'no-with': 2,
|
'no-with': 2,
|
||||||
'one-var': [2, {
|
'one-var': [2, {
|
||||||
'initialized': 'never'
|
'initialized': 'never'
|
||||||
@ -150,21 +151,21 @@ module.exports = {
|
|||||||
':': 'before'
|
':': 'before'
|
||||||
}
|
}
|
||||||
}],
|
}],
|
||||||
"padded-blocks": 0,//块语句内行首行尾是否要空行
|
"padded-blocks": 0, // 块语句内行首行尾是否要空行
|
||||||
'quotes': [2, 'single', {
|
'quotes': [2, 'single', {
|
||||||
'avoidEscape': true,
|
'avoidEscape': true,
|
||||||
'allowTemplateLiterals': true
|
'allowTemplateLiterals': true
|
||||||
}],
|
}],
|
||||||
'semi': [2, 'always'], //语句强制分号结尾
|
'semi': [2, 'always'], // 语句强制分号结尾
|
||||||
'semi-spacing': [2, {
|
'semi-spacing': [2, { // 强制分号之前和之后使用一致的空格
|
||||||
'before': false,
|
'before': false,
|
||||||
'after': true
|
'after': true
|
||||||
}],
|
}],
|
||||||
"strict": 2,//使用严格模式
|
"strict": 2,//使用严格模式
|
||||||
'space-before-blocks': [2, 'always'], //不以新行开始的块{前面要不要有空格
|
'space-before-blocks': [2, 'always'], // 不以新行开始的块{前面要不要有空格 强制在块之前使用一致的空格
|
||||||
"space-before-function-paren": [0, "always"],//函数定义时括号前面要不要有空格
|
"space-before-function-paren": [0, "always"],// 函数定义时括号前面要不要有空格
|
||||||
"space-in-parens": [0, "never"],//小括号里面要不要有空格
|
"space-in-parens": [0, "never"],// 小括号里面要不要有空格
|
||||||
"space-infix-ops": 0,//中缀操作符周围要不要有空格
|
"space-infix-ops": 2,// 要求操作符周围有空格
|
||||||
'space-unary-ops': [2, {
|
'space-unary-ops': [2, {
|
||||||
'words': true,
|
'words': true,
|
||||||
'nonwords': false
|
'nonwords': false
|
||||||
@ -172,7 +173,7 @@ module.exports = {
|
|||||||
'spaced-comment': [2, 'always', {
|
'spaced-comment': [2, 'always', {
|
||||||
'markers': ['global', 'globals', 'eslint', 'eslint-disable', '*package', '!', ',']
|
'markers': ['global', 'globals', 'eslint', 'eslint-disable', '*package', '!', ',']
|
||||||
}], //注释风格要不要有空格什么的
|
}], //注释风格要不要有空格什么的
|
||||||
'template-curly-spacing': [2, 'never'],
|
// 'template-curly-spacing': [2, 'never'],
|
||||||
'use-isnan': 2, //禁止比较时使用NaN,只能用isNaN()
|
'use-isnan': 2, //禁止比较时使用NaN,只能用isNaN()
|
||||||
'valid-typeof': 2, //必须使用合法的typeof的值
|
'valid-typeof': 2, //必须使用合法的typeof的值
|
||||||
"wrap-iife": [2, "inside"],//立即执行函数表达式的小括号风格
|
"wrap-iife": [2, "inside"],//立即执行函数表达式的小括号风格
|
||||||
@ -180,7 +181,7 @@ module.exports = {
|
|||||||
'yoda': [2, 'never'], //禁止尤达条件
|
'yoda': [2, 'never'], //禁止尤达条件
|
||||||
'prefer-const': 2,
|
'prefer-const': 2,
|
||||||
'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0,
|
'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0,
|
||||||
"object-curly-spacing": [0, "never"],//大括号内是否允许不必要的空格
|
"object-curly-spacing": [0, "never"], // 强制在大括号中使用一致的空格
|
||||||
"array-bracket-spacing": [2, "never"], //是否允许非空数组里面有多余的空格
|
"array-bracket-spacing": [2, "never"], // 禁止或强制在括号内使用空格
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="query-list-page" :style="{height: queryList.height ? 'auto' : listPageHeight}">
|
<!-- :style="{height: queryList.height ? 'auto' : listPageHeight}" -->
|
||||||
|
<div class="query-list-page">
|
||||||
<query-form
|
<query-form
|
||||||
v-show="!(queryForm.show === false)"
|
v-show="!(queryForm.show === false)"
|
||||||
ref="queryForm"
|
ref="queryForm"
|
||||||
@ -152,315 +153,315 @@
|
|||||||
// import { mapGetters } from 'vuex'
|
// import { mapGetters } from 'vuex'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
QueryForm: resolve => { require(['@/components/QueryListPage/QueryForm'], resolve); } // 懒加载
|
QueryForm: resolve => { require(['@/components/QueryListPage/QueryForm'], resolve); } // 懒加载
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
queryForm: {
|
queryForm: {
|
||||||
type: Object,
|
type: Object,
|
||||||
required: true
|
required: true
|
||||||
},
|
},
|
||||||
pagerConfig: {
|
pagerConfig: {
|
||||||
type: Object,
|
type: Object,
|
||||||
default() {
|
default() {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
queryList: {
|
queryList: {
|
||||||
type: Object,
|
type: Object,
|
||||||
required: true
|
required: true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
loading: false,
|
loading: false,
|
||||||
choose: null,
|
choose: null,
|
||||||
queryData: {},
|
queryData: {},
|
||||||
currentpagerConfig: {},
|
currentpagerConfig: {},
|
||||||
headerCellStyle: {
|
headerCellStyle: {
|
||||||
// "background-color ": 'rgba(48, 60, 86, 1)',
|
// "background-color ": 'rgba(48, 60, 86, 1)',
|
||||||
// color: 'white'
|
// color: 'white'
|
||||||
},
|
},
|
||||||
listPageHeight: '100%',
|
listPageHeight: '100%',
|
||||||
tableHeight: 0,
|
tableHeight: 0,
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
pageIndex: 1,
|
pageIndex: 1,
|
||||||
pageOffset: 0,
|
pageOffset: 0,
|
||||||
canQuery: true, // 查询按钮是否可点
|
canQuery: true, // 查询按钮是否可点
|
||||||
thirdQRCodeMakeUrl: 'http://s.jiathis.com/qrcode.php?url='
|
thirdQRCodeMakeUrl: 'http://s.jiathis.com/qrcode.php?url='
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
globalPagerConfig: function() {
|
globalPagerConfig: function() {
|
||||||
const pagerConfig = {
|
const pagerConfig = {
|
||||||
pageSize: 'pageSize',
|
pageSize: 'pageSize',
|
||||||
pageIndex: 'pageNow'
|
pageIndex: 'pageNow'
|
||||||
};
|
};
|
||||||
return pagerConfig;
|
return pagerConfig;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
const self = this;
|
const self = this;
|
||||||
// queryList 如果没有data属性,就创建并赋值为[]
|
// queryList 如果没有data属性,就创建并赋值为[]
|
||||||
if (!this.queryList.data) {
|
if (!this.queryList.data) {
|
||||||
this.$set(this.queryList, 'data', []);
|
this.$set(this.queryList, 'data', []);
|
||||||
}
|
}
|
||||||
// queryList 如果没有total属性,就创建并赋值为0
|
// queryList 如果没有total属性,就创建并赋值为0
|
||||||
if (!this.queryList.total) {
|
if (!this.queryList.total) {
|
||||||
this.$set(this.queryList, 'total', 0);
|
this.$set(this.queryList, 'total', 0);
|
||||||
}
|
}
|
||||||
// 如果设置了pageConfig就使用它,否则使用globalPageConfig
|
// 如果设置了pageConfig就使用它,否则使用globalPageConfig
|
||||||
if (!this.pagerConfig) {
|
if (!this.pagerConfig) {
|
||||||
this.currentpagerConfig = Object.assign({}, this.globalPagerConfig);
|
this.currentpagerConfig = Object.assign({}, this.globalPagerConfig);
|
||||||
} else {
|
} else {
|
||||||
this.currentpagerConfig = Object.assign({}, this.pagerConfig);
|
this.currentpagerConfig = Object.assign({}, this.pagerConfig);
|
||||||
}
|
}
|
||||||
// queryList 如果没有selection属性,就创建并赋值为[]
|
// queryList 如果没有selection属性,就创建并赋值为[]
|
||||||
if (!this.queryList.selection) {
|
if (!this.queryList.selection) {
|
||||||
this.$set(this.queryList, 'selection', []);
|
this.$set(this.queryList, 'selection', []);
|
||||||
}
|
}
|
||||||
// 给queryList添加数据重载的方法
|
// 给queryList添加数据重载的方法
|
||||||
this.queryList.reload = function() {
|
this.queryList.reload = function() {
|
||||||
return self.commitQuery();
|
return self.commitQuery();
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
// this.commitQuery();
|
// this.commitQuery();
|
||||||
// this.tableHeight = this.$refs.table2.$el.offsetHeight + 23;
|
// this.tableHeight = this.$refs.table2.$el.offsetHeight + 23;
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
// 根据类型显示
|
// 根据类型显示
|
||||||
checkColumnTyep(column, typeName) {
|
checkColumnTyep(column, typeName) {
|
||||||
if (column.show === false) {
|
if (column.show === false) {
|
||||||
return false;
|
return false;
|
||||||
} else if (column.isShow) {
|
} else if (column.isShow) {
|
||||||
return column.isShow();
|
return column.isShow();
|
||||||
}
|
}
|
||||||
if (typeof column.type === 'undefined') {
|
if (typeof column.type === 'undefined') {
|
||||||
if (column.formatter instanceof Function) {
|
if (column.formatter instanceof Function) {
|
||||||
column.type = 'formatter';
|
column.type = 'formatter';
|
||||||
} else {
|
} else {
|
||||||
column.type = 'basic';
|
column.type = 'basic';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 类型是否匹配
|
// 类型是否匹配
|
||||||
const typeFlag = column.type === typeName;
|
const typeFlag = column.type === typeName;
|
||||||
return typeFlag;
|
return typeFlag;
|
||||||
},
|
},
|
||||||
isTableBtnDisabled(button, index, row) {
|
isTableBtnDisabled(button, index, row) {
|
||||||
if (button.isDisabled) {
|
if (button.isDisabled) {
|
||||||
return button.isDisabled(index, row);
|
return button.isDisabled(index, row);
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// 计算列表的列为链接时显示的名称,可能为列对象的字段
|
// 计算列表的列为链接时显示的名称,可能为列对象的字段
|
||||||
getTableBtnName(btnName, index, row) {
|
getTableBtnName(btnName, index, row) {
|
||||||
if (typeof btnName.trim() === 'function') {
|
if (typeof btnName.trim() === 'function') {
|
||||||
return btnName(index, row);
|
return btnName(index, row);
|
||||||
} else {
|
} else {
|
||||||
return btnName;
|
return btnName;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// 按钮查询
|
// 按钮查询
|
||||||
query(queryData) {
|
query(queryData) {
|
||||||
this.queryData = queryData;
|
this.queryData = queryData;
|
||||||
this.queryList.reload();
|
this.queryList.reload();
|
||||||
},
|
},
|
||||||
// 导出操作
|
// 导出操作
|
||||||
queryExport(queryData) {
|
queryExport(queryData) {
|
||||||
const self = this;
|
const self = this;
|
||||||
self.disableQuery();
|
self.disableQuery();
|
||||||
self.queryData = queryData;
|
self.queryData = queryData;
|
||||||
import('@/utils/Export2Excel').then(excel => {
|
import('@/utils/Export2Excel').then(excel => {
|
||||||
const tHeader = self.queryForm.exportConfig.header;
|
const tHeader = self.queryForm.exportConfig.header;
|
||||||
self.prepareExportData().then(data => {
|
self.prepareExportData().then(data => {
|
||||||
excel.export_json_to_excel(tHeader, data, self.queryForm.exportConfig.filename);
|
excel.export_json_to_excel(tHeader, data, self.queryForm.exportConfig.filename);
|
||||||
self.enableQuery();
|
self.enableQuery();
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
self.enableQuery();
|
self.enableQuery();
|
||||||
self.$message.error(`${this.$t('error.exportFailed')}: ${error.message}`);
|
self.$message.error(`${this.$t('error.exportFailed')}: ${error.message}`);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
// 导出数据准备
|
// 导出数据准备
|
||||||
prepareExportData() {
|
prepareExportData() {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
const filterVals = this.queryForm.exportConfig.filterVals;
|
const filterVals = this.queryForm.exportConfig.filterVals;
|
||||||
this.queryExportData().then(result => {
|
this.queryExportData().then(result => {
|
||||||
const list = result.list;
|
const list = result.list;
|
||||||
const data = this.formatJson(filterVals, list);
|
const data = this.formatJson(filterVals, list);
|
||||||
resolve(data);
|
resolve(data);
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
reject(error);
|
reject(error);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
// 格式化数据列表
|
// 格式化数据列表
|
||||||
formatJson(filterVals, list) {
|
formatJson(filterVals, list) {
|
||||||
return list.map(v => filterVals.map(fv => {
|
return list.map(v => filterVals.map(fv => {
|
||||||
let keys = [];
|
let keys = [];
|
||||||
if (typeof (fv) === 'string') {
|
if (typeof (fv) === 'string') {
|
||||||
keys = fv.split('.');
|
keys = fv.split('.');
|
||||||
} else {
|
} else {
|
||||||
keys = fv.key.split('.');
|
keys = fv.key.split('.');
|
||||||
}
|
}
|
||||||
let obj = v;
|
let obj = v;
|
||||||
keys.forEach(element => {
|
keys.forEach(element => {
|
||||||
obj = obj[element];
|
obj = obj[element];
|
||||||
});
|
});
|
||||||
if (fv.type === 'date') {
|
if (fv.type === 'date') {
|
||||||
const format = fv.format || 'yyyy-MM-dd';
|
const format = fv.format || 'yyyy-MM-dd';
|
||||||
return new Date(obj).Format(format);
|
return new Date(obj).Format(format);
|
||||||
} else if (fv.formatter instanceof Function) {
|
} else if (fv.formatter instanceof Function) {
|
||||||
return fv.formatter(v);
|
return fv.formatter(v);
|
||||||
} else {
|
} else {
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
},
|
},
|
||||||
// 查询需要导出的数据列表
|
// 查询需要导出的数据列表
|
||||||
queryExportData() {
|
queryExportData() {
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* 翻页方法
|
* 翻页方法
|
||||||
* pageIndex: 翻页后是第几页
|
* pageIndex: 翻页后是第几页
|
||||||
* params: 查询条件
|
* params: 查询条件
|
||||||
**/
|
**/
|
||||||
changePage(pageIndex, params) {
|
changePage(pageIndex, params) {
|
||||||
this.pageIndex = pageIndex;
|
this.pageIndex = pageIndex;
|
||||||
this.pageOffset = (this.pageIndex - 1) * this.pageSize;
|
this.pageOffset = (this.pageIndex - 1) * this.pageSize;
|
||||||
if (params) {
|
if (params) {
|
||||||
// 如果是点查询按钮到这来的,不用混合分页信息,已经有默认的第一页信息
|
// 如果是点查询按钮到这来的,不用混合分页信息,已经有默认的第一页信息
|
||||||
this.queryData = params;
|
this.queryData = params;
|
||||||
// 以防pageSize改变, 重新赋值
|
// 以防pageSize改变, 重新赋值
|
||||||
this.queryData[this.currentpagerConfig.pageSize] = this.pageSize;
|
this.queryData[this.currentpagerConfig.pageSize] = this.pageSize;
|
||||||
} else {
|
} else {
|
||||||
// 如果是点翻页按钮到这来的,把分页信息混合到this.queryData里
|
// 如果是点翻页按钮到这来的,把分页信息混合到this.queryData里
|
||||||
this.mixinBackPageInfoToQueryData();
|
this.mixinBackPageInfoToQueryData();
|
||||||
}
|
}
|
||||||
// 加时间戳
|
// 加时间戳
|
||||||
// this.queryData._time = this.$moment()._d.getTime();
|
// this.queryData._time = this.$moment()._d.getTime();
|
||||||
this.queryList.reload();
|
this.queryList.reload();
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* 改变分页大小回调函数,执行完毕后,iview会自动触发changePage事件,去查第一页数据
|
* 改变分页大小回调函数,执行完毕后,iview会自动触发changePage事件,去查第一页数据
|
||||||
*/
|
*/
|
||||||
pageSizeChange(newPageSize) {
|
pageSizeChange(newPageSize) {
|
||||||
if (newPageSize) {
|
if (newPageSize) {
|
||||||
this.pageSize = newPageSize;
|
this.pageSize = newPageSize;
|
||||||
this.changePage(1, this.queryData);
|
this.changePage(1, this.queryData);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* 把分页信息混合到this.queryData里
|
* 把分页信息混合到this.queryData里
|
||||||
*/
|
*/
|
||||||
mixinBackPageInfoToQueryData() {
|
mixinBackPageInfoToQueryData() {
|
||||||
// 当前的分页信息
|
// 当前的分页信息
|
||||||
const pagerParams = {
|
const pagerParams = {
|
||||||
pageSize: this.pageSize,
|
pageSize: this.pageSize,
|
||||||
pageIndex: this.pageIndex,
|
pageIndex: this.pageIndex,
|
||||||
pageOffset: this.pageOffset
|
pageOffset: this.pageOffset
|
||||||
};
|
};
|
||||||
const tempPagerParams = {};
|
const tempPagerParams = {};
|
||||||
// 肯定要有pageSize
|
// 肯定要有pageSize
|
||||||
tempPagerParams[this.currentpagerConfig.pageSize] = pagerParams.pageSize || this.queryData[this.currentpagerConfig.pageSize];
|
tempPagerParams[this.currentpagerConfig.pageSize] = pagerParams.pageSize || this.queryData[this.currentpagerConfig.pageSize];
|
||||||
// 判断使用 pageIndex 还是 pageOffset
|
// 判断使用 pageIndex 还是 pageOffset
|
||||||
if (this.currentpagerConfig.pageIndex) {
|
if (this.currentpagerConfig.pageIndex) {
|
||||||
// 使用 pageIndex
|
// 使用 pageIndex
|
||||||
tempPagerParams[this.currentpagerConfig.pageIndex] = pagerParams.pageIndex || this.queryData[this.currentpagerConfig.pageIndex];
|
tempPagerParams[this.currentpagerConfig.pageIndex] = pagerParams.pageIndex || this.queryData[this.currentpagerConfig.pageIndex];
|
||||||
} else {
|
} else {
|
||||||
// 使用 pageOffset
|
// 使用 pageOffset
|
||||||
tempPagerParams[this.currentpagerConfig.pageOffset] = pagerParams.pageOffset !== undefined ? pagerParams.pageOffset : this.queryData[this.currentpagerConfig.pageOffset];
|
tempPagerParams[this.currentpagerConfig.pageOffset] = pagerParams.pageOffset !== undefined ? pagerParams.pageOffset : this.queryData[this.currentpagerConfig.pageOffset];
|
||||||
}
|
}
|
||||||
// 将分页信息封装到查询条件中
|
// 将分页信息封装到查询条件中
|
||||||
this.queryData = { ...this.queryData, ...tempPagerParams };
|
this.queryData = { ...this.queryData, ...tempPagerParams };
|
||||||
},
|
},
|
||||||
preCommitQueryHandler() {
|
preCommitQueryHandler() {
|
||||||
// 填充表单
|
// 填充表单
|
||||||
// this.$refs.form2.initFormData(this.queryData);
|
// this.$refs.form2.initFormData(this.queryData);
|
||||||
// 预设分页组件
|
// 预设分页组件
|
||||||
this.pageIndex = parseInt(this.queryData[this.currentpagerConfig.pageIndex] || this.pageIndex);
|
this.pageIndex = parseInt(this.queryData[this.currentpagerConfig.pageIndex] || this.pageIndex);
|
||||||
this.pageSize = parseInt(this.queryData[this.currentpagerConfig.pageSize]);
|
this.pageSize = parseInt(this.queryData[this.currentpagerConfig.pageSize]);
|
||||||
},
|
},
|
||||||
commitQuery() {
|
commitQuery() {
|
||||||
const self = this;
|
const self = this;
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
self.disableQuery();
|
self.disableQuery();
|
||||||
self.mixinBackPageInfoToQueryData();
|
self.mixinBackPageInfoToQueryData();
|
||||||
const postData = this.queryData;
|
const postData = this.queryData;
|
||||||
if (postData === false) {
|
if (postData === false) {
|
||||||
self.enableQuery();
|
self.enableQuery();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (this.queryList.query instanceof Function) {
|
if (this.queryList.query instanceof Function) {
|
||||||
this.queryList.query(this.queryData).then(response => {
|
this.queryList.query(this.queryData).then(response => {
|
||||||
self.enableQuery();
|
self.enableQuery();
|
||||||
if (this.queryList.afterQuery && this.queryList.afterQuery instanceof Function) {
|
if (this.queryList.afterQuery && this.queryList.afterQuery instanceof Function) {
|
||||||
this.queryList.afterQuery(response.data);
|
this.queryList.afterQuery(response.data);
|
||||||
}
|
}
|
||||||
|
|
||||||
const resultData = response.data;
|
const resultData = response.data;
|
||||||
this.$set(this.queryList, 'data', resultData.list);
|
this.$set(this.queryList, 'data', resultData.list);
|
||||||
this.$set(this.queryList, 'total', resultData.total);
|
this.$set(this.queryList, 'total', resultData.total);
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
self.enableQuery();
|
self.enableQuery();
|
||||||
this.$message.error(`${this.$t('error.getListFailed')}:${error.message}`);
|
this.$message.error(`${this.$t('error.getListFailed')}:${error.message}`);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
const data = this.queryList.data;
|
const data = this.queryList.data;
|
||||||
if (data) {
|
if (data) {
|
||||||
self.enableQuery();
|
self.enableQuery();
|
||||||
if (this.queryList.afterQuery && this.queryList.afterQuery instanceof Function) {
|
if (this.queryList.afterQuery && this.queryList.afterQuery instanceof Function) {
|
||||||
this.queryList.afterQuery(data);
|
this.queryList.afterQuery(data);
|
||||||
}
|
}
|
||||||
this.$set(this.queryList, 'data', data);
|
this.$set(this.queryList, 'data', data);
|
||||||
|
|
||||||
let total = this.queryList.total;
|
let total = this.queryList.total;
|
||||||
if (!total) {
|
if (!total) {
|
||||||
total = this.queryList.data.length;
|
total = this.queryList.data.length;
|
||||||
}
|
}
|
||||||
this.$set(this.queryList, 'total', total);
|
this.$set(this.queryList, 'total', total);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
enableQuery() {
|
enableQuery() {
|
||||||
this.canQuery = true;
|
this.canQuery = true;
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
},
|
},
|
||||||
disableQuery() {
|
disableQuery() {
|
||||||
// 禁止查询按钮
|
// 禁止查询按钮
|
||||||
this.canQuery = false;
|
this.canQuery = false;
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
// 清空表格的数据
|
// 清空表格的数据
|
||||||
// this.queryList.data = [];
|
// this.queryList.data = [];
|
||||||
},
|
},
|
||||||
onSelect(selection, row) {
|
onSelect(selection, row) {
|
||||||
this.queryList.onSelect && this.queryList.onSelect(selection, row);
|
this.queryList.onSelect && this.queryList.onSelect(selection, row);
|
||||||
this.queryList.selection = selection;
|
this.queryList.selection = selection;
|
||||||
},
|
},
|
||||||
onSelectAll(selection) {
|
onSelectAll(selection) {
|
||||||
this.queryList.onSelectAll && this.queryList.onSelectAll(selection);
|
this.queryList.onSelectAll && this.queryList.onSelectAll(selection);
|
||||||
this.queryList.selection = selection;
|
this.queryList.selection = selection;
|
||||||
},
|
},
|
||||||
onSelectionChange(selection) {
|
onSelectionChange(selection) {
|
||||||
this.queryList.onSelectionChange && this.queryList.onSelectionChange(selection);
|
this.queryList.onSelectionChange && this.queryList.onSelectionChange(selection);
|
||||||
this.queryList.selection = selection;
|
this.queryList.selection = selection;
|
||||||
},
|
},
|
||||||
onRowClick(row) {
|
onRowClick(row) {
|
||||||
this.choose = row;
|
this.choose = row;
|
||||||
},
|
},
|
||||||
currentChoose() {
|
currentChoose() {
|
||||||
return this.choose;
|
return this.choose;
|
||||||
},
|
},
|
||||||
refresh(flag) {
|
refresh(flag) {
|
||||||
if (flag) {
|
if (flag) {
|
||||||
this.commitQuery();
|
this.commitQuery();
|
||||||
}
|
}
|
||||||
this.queryList.data = [...this.queryList.data];
|
this.queryList.data = [...this.queryList.data];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
1790
src/router/index.js
1790
src/router/index.js
File diff suppressed because it is too large
Load Diff
@ -1,14 +1,14 @@
|
|||||||
|
|
||||||
export function getBaseUrl() {
|
export function getBaseUrl() {
|
||||||
let BASE_API;
|
let BASE_API;
|
||||||
if (process.env.NODE_ENV === 'development') {
|
if (process.env.NODE_ENV === 'development') {
|
||||||
// BASE_API = 'https://joylink.club/jlcloud';
|
// BASE_API = 'https://joylink.club/jlcloud';
|
||||||
// BASE_API = 'https://test.joylink.club/jlcloud';
|
BASE_API = 'https://test.joylink.club/jlcloud';
|
||||||
BASE_API = 'http://192.168.3.5:9000'; // 袁琪
|
// BASE_API = 'http://192.168.3.5:9000'; // 袁琪
|
||||||
// BASE_API = 'http://192.168.3.6:9000'; // 旭强
|
// BASE_API = 'http://192.168.3.6:9000'; // 旭强
|
||||||
// BASE_API = 'http://192.168.3.41:9000'; // 王兴杰
|
// BASE_API = 'http://192.168.3.41:9000'; // 王兴杰
|
||||||
} else {
|
} else {
|
||||||
BASE_API = process.env.VUE_APP_BASE_API;
|
BASE_API = process.env.VUE_APP_BASE_API;
|
||||||
}
|
}
|
||||||
return BASE_API;
|
return BASE_API;
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-card>
|
<el-card style="height: 100%; overflow-y: auto;">
|
||||||
<div slot="header" style="text-align: center;">
|
<div slot="header" style="text-align: center;">
|
||||||
<b>{{ $t('lesson.courseName') + ': '+ name }}</b>
|
<b>{{ $t('lesson.courseName') + ': '+ name }}</b>
|
||||||
</div>
|
</div>
|
||||||
@ -38,98 +38,98 @@ import { getLessonTree } from '@/api/jmap/lessondraft';
|
|||||||
import { DeviceMenu } from '@/scripts/ConstDic';
|
import { DeviceMenu } from '@/scripts/ConstDic';
|
||||||
import OperateMenu from './operateMenu';
|
import OperateMenu from './operateMenu';
|
||||||
export default {
|
export default {
|
||||||
name: 'LessonDetail',
|
name: 'LessonDetail',
|
||||||
components: {
|
components: {
|
||||||
OperateMenu
|
OperateMenu
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
treeList: [],
|
treeList: [],
|
||||||
defaultProps: {
|
defaultProps: {
|
||||||
children: 'children',
|
children: 'children',
|
||||||
label: 'name'
|
label: 'name'
|
||||||
},
|
},
|
||||||
name: '',
|
name: '',
|
||||||
lessonId: '',
|
lessonId: '',
|
||||||
expandList: [],
|
expandList: [],
|
||||||
point: {
|
point: {
|
||||||
x: 0,
|
x: 0,
|
||||||
y: 0
|
y: 0
|
||||||
},
|
},
|
||||||
node: {
|
node: {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
width() {
|
width() {
|
||||||
return this.$store.state.app.width - 481 - this.widthLeft;
|
return this.$store.state.app.width - 481 - this.widthLeft;
|
||||||
},
|
},
|
||||||
height() {
|
height() {
|
||||||
return this.$store.state.app.height - 120;
|
return this.$store.state.app.height - 120;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.initPageData();
|
this.initPageData();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
initPageData() {
|
initPageData() {
|
||||||
getLessonTree(this.$route.query.lessonId || this.$route.query.id).then(resp => {
|
getLessonTree(this.$route.query.lessonId || this.$route.query.id).then(resp => {
|
||||||
if (resp.data && resp.data[0]) {
|
if (resp.data && resp.data[0]) {
|
||||||
this.name = resp.data[0].name;
|
this.name = resp.data[0].name;
|
||||||
this.lessonId = resp.data[0].id;
|
this.lessonId = resp.data[0].id;
|
||||||
this.treeList = resp.data;
|
this.treeList = resp.data;
|
||||||
}
|
}
|
||||||
this.editLesson();
|
this.editLesson();
|
||||||
});
|
});
|
||||||
|
|
||||||
},
|
},
|
||||||
clickEvent(obj, node, ele) {
|
clickEvent(obj, node, ele) {
|
||||||
},
|
},
|
||||||
filterNode(value, data) {
|
filterNode(value, data) {
|
||||||
if (!value) return true;
|
if (!value) return true;
|
||||||
return data.name.indexOf(value) !== -1;
|
return data.name.indexOf(value) !== -1;
|
||||||
},
|
},
|
||||||
editLesson() {
|
editLesson() {
|
||||||
this.$router.push( {path: `/design/lesson/details/edit/lessonEdit`, query: {id: this.lessonId, skinCode: this.$route.query.skinCode, cityCode: this.$route.query.cityCode, mapId: this.$route.query.mapId}} );
|
this.$router.push( {path: `/design/lesson/details/edit/lessonEdit`, query: {id: this.lessonId, skinCode: this.$route.query.skinCode, cityCode: this.$route.query.cityCode, mapId: this.$route.query.mapId}} );
|
||||||
},
|
},
|
||||||
createChapte(node) {
|
createChapte(node) {
|
||||||
this.$router.push({path: `/design/lesson/details/edit/chapterCreate`, query: {id: node.data.id, lessonId: this.lessonId, skinCode: this.$route.query.skinCode, cityCode: this.$route.query.cityCode, mapId: this.$route.query.mapId}});
|
this.$router.push({path: `/design/lesson/details/edit/chapterCreate`, query: {id: node.data.id, lessonId: this.lessonId, skinCode: this.$route.query.skinCode, cityCode: this.$route.query.cityCode, mapId: this.$route.query.mapId}});
|
||||||
},
|
},
|
||||||
updateChapte(node) {
|
updateChapte(node) {
|
||||||
this.$router.push( {path: `/design/lesson/details/edit/chapterEdit`, query: {id: node.data.id, skinCode: this.$route.query.skinCode, lessonId: this.lessonId, cityCode: this.$route.query.cityCode, mapId: this.$route.query.mapId}});
|
this.$router.push( {path: `/design/lesson/details/edit/chapterEdit`, query: {id: node.data.id, skinCode: this.$route.query.skinCode, lessonId: this.lessonId, cityCode: this.$route.query.cityCode, mapId: this.$route.query.mapId}});
|
||||||
},
|
},
|
||||||
showContextMenu(e, obj, node, vueElem) {
|
showContextMenu(e, obj, node, vueElem) {
|
||||||
if (obj && obj.type === 'Lesson' || obj.type === 'Chapter') {
|
if (obj && obj.type === 'Lesson' || obj.type === 'Chapter') {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
this.point = {
|
this.point = {
|
||||||
x: e.clientX,
|
x: e.clientX,
|
||||||
y: e.clientY
|
y: e.clientY
|
||||||
};
|
};
|
||||||
this.node = node;
|
this.node = node;
|
||||||
const menu = DeviceMenu.Lesson;
|
const menu = DeviceMenu.Lesson;
|
||||||
this.$store.dispatch('menuOperation/setPopMenu', { position: this.point, menu: menu });
|
this.$store.dispatch('menuOperation/setPopMenu', { position: this.point, menu: menu });
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
changeRouter(params) {
|
changeRouter(params) {
|
||||||
switch (params.event) {
|
switch (params.event) {
|
||||||
case '01':
|
case '01':
|
||||||
this.editLesson();
|
this.editLesson();
|
||||||
break;
|
break;
|
||||||
case '02':
|
case '02':
|
||||||
this.createChapte(params.node);
|
this.createChapte(params.node);
|
||||||
break;
|
break;
|
||||||
case '03':
|
case '03':
|
||||||
this.updateChapte(params.node);
|
this.updateChapte(params.node);
|
||||||
break;
|
break;
|
||||||
case '04':
|
case '04':
|
||||||
this.createChapte(params.node);
|
this.createChapte(params.node);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
refresh() {
|
refresh() {
|
||||||
this.initPageData();
|
this.initPageData();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
<style rel="stylesheet/scss" lang="scss" scoped>
|
<style rel="stylesheet/scss" lang="scss" scoped>
|
||||||
|
@ -1,5 +1,12 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-dialog v-dialogDrag :title="title" :visible.sync="dialogVisible" width="25%" :before-close="handleClose" center>
|
<el-dialog
|
||||||
|
v-dialogDrag
|
||||||
|
:title="title"
|
||||||
|
:visible.sync="dialogVisible"
|
||||||
|
width="25%"
|
||||||
|
:before-close="handleClose"
|
||||||
|
center
|
||||||
|
>
|
||||||
<data-form ref="dataform" :form="form" :form-model="formModel" :rules="rules" />
|
<data-form ref="dataform" :form="form" :form-model="formModel" :rules="rules" />
|
||||||
<span slot="footer" class="dialog-footer">
|
<span slot="footer" class="dialog-footer">
|
||||||
<el-button v-loading="loading" type="primary" @click="doSave">{{ $t('global.confirm') }}</el-button>
|
<el-button v-loading="loading" type="primary" @click="doSave">{{ $t('global.confirm') }}</el-button>
|
||||||
@ -14,102 +21,126 @@ import { OperationList } from '@/scripts/OperationConfig';
|
|||||||
import { getSkinCodeList } from '@/api/management/mapskin';
|
import { getSkinCodeList } from '@/api/management/mapskin';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'AddBatch',
|
name: 'AddBatch',
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
loading: false,
|
loading: false,
|
||||||
dialogVisible: false,
|
dialogVisible: false,
|
||||||
formModel: {
|
formModel: {
|
||||||
skinCode: this.$route.query.skinCode
|
|
||||||
},
|
|
||||||
skinCodeList: [],
|
|
||||||
isShow: false
|
|
||||||
};
|
|
||||||
},
|
|
||||||
computed: {
|
|
||||||
form() {
|
|
||||||
this.type === 'ADD';
|
|
||||||
const form = {
|
|
||||||
labelWidth: '120px',
|
|
||||||
items: [
|
|
||||||
{ prop: 'skinCode', label: this.$t('lesson.skinType'), type: 'select', required: true, options: this.skinCodeList, disabled: true }
|
|
||||||
]
|
|
||||||
};
|
|
||||||
return form;
|
|
||||||
},
|
|
||||||
rules() {
|
|
||||||
const crules = {
|
|
||||||
skinCode: [
|
|
||||||
{ required: true, message: this.$t('rules.inputSkinType'), trigger: 'change' }
|
|
||||||
]
|
|
||||||
};
|
|
||||||
return crules;
|
|
||||||
},
|
|
||||||
title() {
|
|
||||||
return this.$t('lesson.generationOperation');
|
|
||||||
}
|
|
||||||
},
|
|
||||||
mounted() {
|
|
||||||
this.init();
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
init() {
|
|
||||||
// 获取皮肤列表
|
|
||||||
this.skinCodeList = [];
|
|
||||||
getSkinCodeList().then(response => {
|
|
||||||
this.skinCodeList = 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() {
|
|
||||||
const self = this;
|
|
||||||
this.$refs.dataform.validateForm(() => {
|
|
||||||
if (this.isShow) {
|
|
||||||
this.$confirm(this.$t('lesson.wellClearOperate'), this.$t('global.tips'), {
|
|
||||||
confirmButtonText: this.$t('global.confirm'),
|
|
||||||
cancelButtonText: this.$t('global.cancel'),
|
|
||||||
type: 'warning'
|
|
||||||
}).then(() => {
|
|
||||||
self.create();
|
|
||||||
}).catch(() => { });
|
|
||||||
} else {
|
|
||||||
self.create();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
create() {
|
|
||||||
const self = this;
|
|
||||||
this.loading = true;
|
|
||||||
addTrainingRulesList(this.formModel.skinCode, OperationList[this.formModel.skinCode].list).then(response => {
|
|
||||||
self.loading = false;
|
|
||||||
self.$message.success(this.$t('lesson.batchCreateSuccess'));
|
|
||||||
self.handleClose();
|
|
||||||
self.$emit('reloadTable'); // 刷新列表
|
|
||||||
}).catch(error => {
|
|
||||||
self.loading = false;
|
|
||||||
self.$message.error(`${this.$('error.batchCreateFailed')}:${error.message}`);
|
|
||||||
});
|
|
||||||
},
|
|
||||||
handleClose() {
|
|
||||||
this.formModel = {
|
|
||||||
skinCode: this.$route.query.skinCode
|
skinCode: this.$route.query.skinCode
|
||||||
};
|
},
|
||||||
this.$refs.dataform.resetForm();
|
skinCodeList: [],
|
||||||
this.isShow = false;
|
isShow: false
|
||||||
this.dialogVisible = false;
|
};
|
||||||
}
|
},
|
||||||
}
|
computed: {
|
||||||
|
form() {
|
||||||
|
this.type === 'ADD';
|
||||||
|
const form = {
|
||||||
|
labelWidth: '120px',
|
||||||
|
items: [
|
||||||
|
{
|
||||||
|
prop: 'skinCode',
|
||||||
|
label: this.$t('lesson.skinType'),
|
||||||
|
type: 'select',
|
||||||
|
required: true,
|
||||||
|
options: this.skinCodeList,
|
||||||
|
disabled: true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
};
|
||||||
|
return form;
|
||||||
|
},
|
||||||
|
rules() {
|
||||||
|
const crules = {
|
||||||
|
skinCode: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: this.$t('rules.inputSkinType'),
|
||||||
|
trigger: 'change'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
};
|
||||||
|
return crules;
|
||||||
|
},
|
||||||
|
title() {
|
||||||
|
return this.$t('lesson.generationOperation');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
this.init();
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
init() {
|
||||||
|
// 获取皮肤列表
|
||||||
|
this.skinCodeList = [];
|
||||||
|
getSkinCodeList().then(response => {
|
||||||
|
this.skinCodeList = 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() {
|
||||||
|
const self = this;
|
||||||
|
this.$refs.dataform.validateForm(() => {
|
||||||
|
if (this.isShow) {
|
||||||
|
this.$confirm(
|
||||||
|
this.$t('lesson.wellClearOperate'),
|
||||||
|
this.$t('global.tips'),
|
||||||
|
{
|
||||||
|
confirmButtonText: this.$t('global.confirm'),
|
||||||
|
cancelButtonText: this.$t('global.cancel'),
|
||||||
|
type: 'warning'
|
||||||
|
}
|
||||||
|
)
|
||||||
|
.then(() => {
|
||||||
|
self.create();
|
||||||
|
})
|
||||||
|
.catch(() => {});
|
||||||
|
} else {
|
||||||
|
self.create();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
create() {
|
||||||
|
const self = this;
|
||||||
|
this.loading = true;
|
||||||
|
addTrainingRulesList(
|
||||||
|
this.formModel.skinCode,
|
||||||
|
OperationList[this.formModel.skinCode].list
|
||||||
|
)
|
||||||
|
.then(response => {
|
||||||
|
self.loading = false;
|
||||||
|
self.$message.success(this.$t('lesson.batchCreateSuccess'));
|
||||||
|
self.handleClose();
|
||||||
|
self.$emit('reloadTable'); // 刷新列表
|
||||||
|
})
|
||||||
|
.catch(error => {
|
||||||
|
self.loading = false;
|
||||||
|
self.$message.error(
|
||||||
|
`${this.$('error.batchCreateFailed')}:${error.message}`
|
||||||
|
);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
handleClose() {
|
||||||
|
this.formModel = {
|
||||||
|
skinCode: this.$route.query.skinCode
|
||||||
|
};
|
||||||
|
this.$refs.dataform.resetForm();
|
||||||
|
this.isShow = false;
|
||||||
|
this.dialogVisible = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
@ -13,289 +13,289 @@ import { postTrainingRulesData, putTrainingRulesData, getPlaceholderList } from
|
|||||||
import { getSkinCodeList } from '@/api/management/mapskin';
|
import { getSkinCodeList } from '@/api/management/mapskin';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'TrainingEdit',
|
name: 'TrainingEdit',
|
||||||
props: {
|
props: {
|
||||||
type: {
|
type: {
|
||||||
type: String,
|
type: String,
|
||||||
required: true
|
required: true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
loading: false,
|
loading: false,
|
||||||
dialogVisible: false,
|
dialogVisible: false,
|
||||||
formModel: {
|
formModel: {
|
||||||
trainingName: '',
|
trainingName: '',
|
||||||
trainingType: '',
|
trainingType: '',
|
||||||
operateType: '',
|
operateType: '',
|
||||||
skinCode: '',
|
skinCode: '',
|
||||||
minDuration: '',
|
minDuration: '',
|
||||||
maxDuration: '',
|
maxDuration: '',
|
||||||
trainingRemark: '',
|
trainingRemark: '',
|
||||||
productTypes: []
|
productTypes: []
|
||||||
},
|
},
|
||||||
skinCodeList: [],
|
skinCodeList: [],
|
||||||
trainingTypeList: [],
|
trainingTypeList: [],
|
||||||
trainingOperateTypeMap: {},
|
trainingOperateTypeMap: {},
|
||||||
placeholderList: []
|
placeholderList: []
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
form() {
|
form() {
|
||||||
const isAdd = this.type === 'ADD';
|
const isAdd = this.type === 'ADD';
|
||||||
const form = {
|
const form = {
|
||||||
labelWidth: '120px',
|
labelWidth: '120px',
|
||||||
items: [
|
items: [
|
||||||
{ prop: 'skinCode', label: this.$t('lesson.skinType'), type: 'select', required: true, options: this.skinCodeList, disabled: true },
|
{ prop: 'skinCode', label: this.$t('lesson.skinType'), type: 'select', required: true, options: this.skinCodeList, disabled: true },
|
||||||
{ prop: 'trainingType', label: this.$t('lesson.trainingType'), type: 'select', required: true, options: this.trainingTypeList, disabled: !isAdd, change: true, onChange: this.changeList },
|
{ prop: 'trainingType', label: this.$t('lesson.trainingType'), type: 'select', required: true, options: this.trainingTypeList, disabled: !isAdd, change: true, onChange: this.changeList },
|
||||||
{ prop: 'operateType', label: this.$t('lesson.operationType'), type: 'select', required: true, options: this.trainingOperateTypeMap[this.formModel.trainingType], disabled: !isAdd },
|
{ prop: 'operateType', label: this.$t('lesson.operationType'), type: 'select', required: true, options: this.trainingOperateTypeMap[this.formModel.trainingType], disabled: !isAdd },
|
||||||
{ label: '', type: 'button', options: this.placeholderList, style: 'margin-bottom: 0; margin-top: -10px;', typeBtn: 'info', click: this.addTrainName },
|
{ label: '', type: 'button', options: this.placeholderList, style: 'margin-bottom: 0; margin-top: -10px;', typeBtn: 'info', click: this.addTrainName },
|
||||||
{ prop: 'trainingName', label: this.$t('lesson.trainingName'), type: 'text', required: true, rightWidth: true, tooltip: true, info: this.$t('lesson.tipNamePlaceholderInfo') },
|
{ prop: 'trainingName', label: this.$t('lesson.trainingName'), type: 'text', required: true, rightWidth: true, tooltip: true, info: this.$t('lesson.tipNamePlaceholderInfo') },
|
||||||
{ prop: 'minDuration', label: this.$t('lesson.minDuration'), type: 'text', required: true },
|
{ prop: 'minDuration', label: this.$t('lesson.minDuration'), type: 'text', required: true },
|
||||||
{ prop: 'maxDuration', label: this.$t('lesson.maxDuration'), type: 'text', required: true },
|
{ prop: 'maxDuration', label: this.$t('lesson.maxDuration'), type: 'text', required: true },
|
||||||
{ label: '', type: 'button', options: this.placeholderList, style: 'margin-bottom: 0; margin-top: -10px;', typeBtn: 'info', click: this.addTrainRemark },
|
{ label: '', type: 'button', options: this.placeholderList, style: 'margin-bottom: 0; margin-top: -10px;', typeBtn: 'info', click: this.addTrainRemark },
|
||||||
{ prop: 'trainingRemark', label: this.$t('lesson.trainingRemark'), type: 'textarea', required: true, tooltip: true, info: this.$t('lesson.tipExplainPlaceholderInfo') }
|
{ prop: 'trainingRemark', label: this.$t('lesson.trainingRemark'), type: 'textarea', required: true, tooltip: true, info: this.$t('lesson.tipExplainPlaceholderInfo') }
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
return form;
|
return form;
|
||||||
},
|
},
|
||||||
rules() {
|
rules() {
|
||||||
const crules = {
|
const crules = {
|
||||||
trainingName: [
|
trainingName: [
|
||||||
{ required: true, message: this.$t('rules.inputTrainingName'), trigger: 'blur' }
|
{ required: true, message: this.$t('rules.inputTrainingName'), trigger: 'blur' }
|
||||||
],
|
],
|
||||||
trainingType: [
|
trainingType: [
|
||||||
{ required: true, message: this.$t('rules.inputTrainingType'), trigger: 'change' }
|
{ required: true, message: this.$t('rules.inputTrainingType'), trigger: 'change' }
|
||||||
],
|
],
|
||||||
operateType: [
|
operateType: [
|
||||||
{ required: true, message: this.$t('rules.inputOperationType'), trigger: 'change' }
|
{ required: true, message: this.$t('rules.inputOperationType'), trigger: 'change' }
|
||||||
],
|
],
|
||||||
skinCode: [
|
skinCode: [
|
||||||
{ required: true, message: this.$t('rules.inputSkinType'), trigger: 'change' }
|
{ required: true, message: this.$t('rules.inputSkinType'), trigger: 'change' }
|
||||||
],
|
],
|
||||||
minDuration: [
|
minDuration: [
|
||||||
{ required: true, message: this.$t('rules.inputMinDuration'), trigger: 'blur' }
|
{ required: true, message: this.$t('rules.inputMinDuration'), trigger: 'blur' }
|
||||||
],
|
],
|
||||||
maxDuration: [
|
maxDuration: [
|
||||||
{ required: true, message: this.$t('rules.inputMaxDuration'), trigger: 'blur' }
|
{ required: true, message: this.$t('rules.inputMaxDuration'), trigger: 'blur' }
|
||||||
],
|
],
|
||||||
trainingRemark: [
|
trainingRemark: [
|
||||||
{ required: true, max: 500, message: this.$t('rules.inputTrainingRemark'), trigger: 'blur' }
|
{ required: true, max: 500, message: this.$t('rules.inputTrainingRemark'), trigger: 'blur' }
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
return crules;
|
return crules;
|
||||||
},
|
},
|
||||||
title() {
|
title() {
|
||||||
if (this.type === 'ADD') {
|
if (this.type === 'ADD') {
|
||||||
return this.$t('lesson.createOperateRule');
|
return this.$t('lesson.createOperateRule');
|
||||||
} else {
|
} else {
|
||||||
return this.$t('lesson.editOperateRule');
|
return this.$t('lesson.editOperateRule');
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
mounted() {
|
|
||||||
this.init();
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
init() {
|
|
||||||
// 获取皮肤列表
|
|
||||||
this.skinCodeList = [];
|
|
||||||
getSkinCodeList().then(response => {
|
|
||||||
this.skinCodeList = 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 => {
|
|
||||||
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, skinCode: data.skinCode });
|
|
||||||
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,
|
|
||||||
skinCode: data.skinCode,
|
|
||||||
minDuration: data.minDuration,
|
|
||||||
maxDuration: data.maxDuration,
|
|
||||||
trainingRemark: this.repliceName(data.trainingRemark, this.placeholderList)
|
|
||||||
};
|
|
||||||
}else {
|
|
||||||
this.formModel = {
|
|
||||||
skinCode: this.$route.query.skinCode
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
repliceName(fieldValue, enumList) {
|
},
|
||||||
if (enumList && enumList.length > 0) {
|
mounted() {
|
||||||
for (let i = 0; i < enumList.length; i++) {
|
this.init();
|
||||||
if (fieldValue.includes(`{${enumList[i].id}}`)) {
|
},
|
||||||
fieldValue = fieldValue.replace(`{${enumList[i].id}}`, `{${enumList[i].name}}`);
|
methods: {
|
||||||
}
|
init() {
|
||||||
}
|
// 获取皮肤列表
|
||||||
return fieldValue;
|
this.skinCodeList = [];
|
||||||
}
|
getSkinCodeList().then(response => {
|
||||||
},
|
this.skinCodeList = response.data.map(item => {
|
||||||
changeList(val) {
|
const params = {};
|
||||||
// 获取操作占位列表
|
params.label = item.name;
|
||||||
getPlaceholderList({ trainingType: val, skinCode: '02' }).then(res => {
|
params.value = item.code;
|
||||||
this.placeholderList = res.data;
|
return params;
|
||||||
});
|
});
|
||||||
},
|
});
|
||||||
addTrainName(val) {
|
|
||||||
this.formModel.trainingName = `${this.formModel.trainingName}{${val.name}}`;
|
|
||||||
},
|
|
||||||
addTrainRemark(val) {
|
|
||||||
this.formModel.trainingRemark = `${this.formModel.trainingRemark}{${val.name}}`;
|
|
||||||
},
|
|
||||||
doSave() {
|
|
||||||
const self = this;
|
|
||||||
this.$refs.dataform.validateForm(() => {
|
|
||||||
if (self.type === 'ADD') {
|
|
||||||
self.create();
|
|
||||||
} else {
|
|
||||||
self.update();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
create() {
|
|
||||||
const self = this;
|
|
||||||
this.placeholderList.forEach(item => {
|
|
||||||
if (this.formModel.trainingName.includes(`{${item.name}}`)) {
|
|
||||||
const name = this.formModel.trainingName.replace(`{${item.name}}`, `{${item.id}}`);
|
|
||||||
this.formModel.trainingName = name;
|
|
||||||
}
|
|
||||||
if (this.formModel.trainingRemark.includes(`{${item.name}}`)) {
|
|
||||||
const remark = this.formModel.trainingRemark.replace(`{${item.name}}`, `{${item.id}}`);
|
|
||||||
this.formModel.trainingRemark = remark;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
this.loading = true;
|
// 获取实训类型
|
||||||
postTrainingRulesData(this.formModel).then(response => {
|
this.trainingTypeList = [];
|
||||||
self.loading = false;
|
this.$Dictionary.trainingType().then(list => {
|
||||||
self.$message.success(this.$t('lesson.createOperateSuccess'));
|
this.trainingTypeList = list.map(item => {
|
||||||
self.handleClose();
|
const params = {};
|
||||||
self.$emit('reloadTable');
|
params.label = item.name;
|
||||||
}).catch(error => {
|
params.value = item.code;
|
||||||
self.loading = false;
|
return params;
|
||||||
self.$message.error(`${this.$t('error.createOperateRuleFailed')}:${error.message}`);
|
});
|
||||||
});
|
});
|
||||||
},
|
// 获取实训操作类型
|
||||||
update() {
|
this.trainingOperateTypeMap = {};
|
||||||
const self = this;
|
this.$Dictionary.stationControl().then(list => {
|
||||||
this.placeholderList.forEach(item => {
|
this.trainingOperateTypeMap['01'] = list.map(item => {
|
||||||
if (this.formModel.trainingName.includes(`{${item.name}}`)) {
|
const params = {};
|
||||||
const name = this.formModel.trainingName.replace(`{${item.name}}`, `{${item.id}}`);
|
params.label = item.name;
|
||||||
this.formModel.trainingName = name;
|
params.value = item.code;
|
||||||
}
|
return params;
|
||||||
if (this.formModel.trainingRemark.includes(`{${item.name}}`)) {
|
}); // 控制权实训
|
||||||
const remark = this.formModel.trainingRemark.replace(`{${item.name}}`, `{${item.id}}`);
|
});
|
||||||
this.formModel.trainingRemark = remark;
|
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;
|
||||||
|
}); // 列车实训
|
||||||
|
});
|
||||||
|
|
||||||
this.loading = true;
|
},
|
||||||
putTrainingRulesData(this.formModel).then(response => {
|
async show(data) {
|
||||||
self.loading = false;
|
this.loading = false;
|
||||||
self.$message.success(this.$t('lesson.createOperateSuccess'));
|
this.dialogVisible = true;
|
||||||
self.handleClose();
|
if (data && data.id) {
|
||||||
self.$emit('reloadTable');
|
// 获取操作占位列表
|
||||||
}).catch(error => {
|
const res = await getPlaceholderList({ trainingType: data.trainingType, skinCode: data.skinCode });
|
||||||
self.loading = false;
|
this.placeholderList = res.data;
|
||||||
self.$message.error(`${this.$t('error.createOperateRuleFailed')}:${error.message}`);
|
this.formModel = {
|
||||||
});
|
id: data.id,
|
||||||
},
|
trainingName: this.repliceName(data.trainingName, this.placeholderList),
|
||||||
handleClose() {
|
trainingType: data.trainingType,
|
||||||
this.formModel = {
|
operateType: data.operateType,
|
||||||
trainingName: '',
|
productTypes: data.productTypes,
|
||||||
trainingType: '',
|
skinCode: data.skinCode,
|
||||||
operateType: '',
|
minDuration: data.minDuration,
|
||||||
skinCode: '',
|
maxDuration: data.maxDuration,
|
||||||
minDuration: '',
|
trainingRemark: this.repliceName(data.trainingRemark, this.placeholderList)
|
||||||
maxDuration: '',
|
};
|
||||||
trainingRemark: ''
|
} else {
|
||||||
};
|
this.formModel = {
|
||||||
this.$refs.dataform.resetForm();
|
skinCode: this.$route.query.skinCode
|
||||||
this.dialogVisible = false;
|
};
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
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, skinCode: '02' }).then(res => {
|
||||||
|
this.placeholderList = res.data;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
addTrainName(val) {
|
||||||
|
this.formModel.trainingName = `${this.formModel.trainingName}{${val.name}}`;
|
||||||
|
},
|
||||||
|
addTrainRemark(val) {
|
||||||
|
this.formModel.trainingRemark = `${this.formModel.trainingRemark}{${val.name}}`;
|
||||||
|
},
|
||||||
|
doSave() {
|
||||||
|
const self = this;
|
||||||
|
this.$refs.dataform.validateForm(() => {
|
||||||
|
if (self.type === 'ADD') {
|
||||||
|
self.create();
|
||||||
|
} else {
|
||||||
|
self.update();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
create() {
|
||||||
|
const self = this;
|
||||||
|
this.placeholderList.forEach(item => {
|
||||||
|
if (this.formModel.trainingName.includes(`{${item.name}}`)) {
|
||||||
|
const name = this.formModel.trainingName.replace(`{${item.name}}`, `{${item.id}}`);
|
||||||
|
this.formModel.trainingName = name;
|
||||||
|
}
|
||||||
|
if (this.formModel.trainingRemark.includes(`{${item.name}}`)) {
|
||||||
|
const remark = this.formModel.trainingRemark.replace(`{${item.name}}`, `{${item.id}}`);
|
||||||
|
this.formModel.trainingRemark = remark;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this.loading = true;
|
||||||
|
postTrainingRulesData(this.formModel).then(response => {
|
||||||
|
self.loading = false;
|
||||||
|
self.$message.success(this.$t('lesson.createOperateSuccess'));
|
||||||
|
self.handleClose();
|
||||||
|
self.$emit('reloadTable');
|
||||||
|
}).catch(error => {
|
||||||
|
self.loading = false;
|
||||||
|
self.$message.error(`${this.$t('error.createOperateRuleFailed')}:${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;
|
||||||
|
putTrainingRulesData(this.formModel).then(response => {
|
||||||
|
self.loading = false;
|
||||||
|
self.$message.success(this.$t('lesson.createOperateSuccess'));
|
||||||
|
self.handleClose();
|
||||||
|
self.$emit('reloadTable');
|
||||||
|
}).catch(error => {
|
||||||
|
self.loading = false;
|
||||||
|
self.$message.error(`${this.$t('error.createOperateRuleFailed')}:${error.message}`);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
handleClose() {
|
||||||
|
this.formModel = {
|
||||||
|
trainingName: '',
|
||||||
|
trainingType: '',
|
||||||
|
operateType: '',
|
||||||
|
skinCode: '',
|
||||||
|
minDuration: '',
|
||||||
|
maxDuration: '',
|
||||||
|
trainingRemark: ''
|
||||||
|
};
|
||||||
|
this.$refs.dataform.resetForm();
|
||||||
|
this.dialogVisible = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
@ -1,20 +1,26 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
<div style="height: 100%; overflow-y: auto;">
|
||||||
|
<!-- <div style="height: calc(100% - 80px); overflow-y: auto;"> -->
|
||||||
<QueryListPage ref="queryListPage" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" />
|
<QueryListPage ref="queryListPage" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" />
|
||||||
|
<!-- </div> -->
|
||||||
<training-edit ref="create" type="ADD" @reloadTable="reloadTable" />
|
<training-edit ref="create" type="ADD" @reloadTable="reloadTable" />
|
||||||
<training-edit ref="edit" type="EDIT" @reloadTable="reloadTable" />
|
<training-edit ref="edit" type="EDIT" @reloadTable="reloadTable" />
|
||||||
<add-batch ref="addBatch" @reloadTable="reloadTable" />
|
<add-batch ref="addBatch" @reloadTable="reloadTable" />
|
||||||
<save-as ref="saveAs" @reloadTable="reloadTable" />
|
<save-as ref="saveAs" @reloadTable="reloadTable" />
|
||||||
<div class="draft">
|
<div class="draft">
|
||||||
<el-button-group>
|
<el-button-group>
|
||||||
<el-button type="primary" @click="turnback">{{ $t('global.back') }}</el-button>
|
<el-button type="primary" @click="turnback">{{ $t('global.back') }}</el-button>
|
||||||
</el-button-group>
|
</el-button-group>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { getTrainingRulesList, deleteTrainingRulesData, getPlaceholderList } from '@/api/management/operation';
|
import {
|
||||||
|
getTrainingRulesList,
|
||||||
|
deleteTrainingRulesData,
|
||||||
|
getPlaceholderList
|
||||||
|
} from '@/api/management/operation';
|
||||||
import { getSkinCodeList } from '@/api/management/mapskin';
|
import { getSkinCodeList } from '@/api/management/mapskin';
|
||||||
import TrainingEdit from './addEdit';
|
import TrainingEdit from './addEdit';
|
||||||
import AddBatch from './addBatch';
|
import AddBatch from './addBatch';
|
||||||
@ -22,251 +28,301 @@ import SaveAs from './saveAs.vue';
|
|||||||
import { UrlConfig } from '@/router/index';
|
import { UrlConfig } from '@/router/index';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'TrainingRule',
|
name: 'TrainingRule',
|
||||||
components: {
|
components: {
|
||||||
TrainingEdit,
|
TrainingEdit,
|
||||||
AddBatch,
|
AddBatch,
|
||||||
SaveAs
|
SaveAs
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
placeholderMap: {},
|
placeholderMap: {},
|
||||||
trainingOperateTypeMap: {},
|
trainingOperateTypeMap: {},
|
||||||
trainingTypeList: [],
|
trainingTypeList: [],
|
||||||
skinCodeList: [],
|
skinCodeList: [],
|
||||||
totals: '',
|
totals: '',
|
||||||
pagerConfig: {
|
pagerConfig: {
|
||||||
pageSize: 'pageSize',
|
pageSize: 'pageSize',
|
||||||
pageIndex: 'pageNum'
|
pageIndex: 'pageNum'
|
||||||
},
|
},
|
||||||
queryForm: {
|
queryForm: {
|
||||||
labelWidth: '140px',
|
labelWidth: '140px',
|
||||||
reset: true,
|
reset: true,
|
||||||
queryObject: {
|
queryObject: {
|
||||||
trainingType: {
|
trainingType: {
|
||||||
type: 'select',
|
type: 'select',
|
||||||
label: this.$t('lesson.trainingType'),
|
label: this.$t('lesson.trainingType'),
|
||||||
config: {
|
config: {
|
||||||
data: []
|
data: []
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
trainingName: {
|
trainingName: {
|
||||||
type: 'text',
|
type: 'text',
|
||||||
label: this.$t('lesson.trainingName')
|
label: this.$t('lesson.trainingName')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
queryList: {
|
||||||
|
query: this.getList,
|
||||||
|
selectCheckShow: false,
|
||||||
|
indexShow: true,
|
||||||
|
columns: [
|
||||||
|
{
|
||||||
|
title: this.$t('lesson.trainingName'),
|
||||||
|
prop: 'trainingName',
|
||||||
|
type: 'replicText',
|
||||||
|
columnValue: row => {
|
||||||
|
return this.repliceName(
|
||||||
|
row.trainingName,
|
||||||
|
this.placeholderMap[row.trainingType]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: this.$t('lesson.skinType'),
|
||||||
|
prop: 'skinCode',
|
||||||
|
type: 'tag',
|
||||||
|
columnValue: row => {
|
||||||
|
return this.$convertField(row.skinCode, this.skinCodeList, [
|
||||||
|
'code',
|
||||||
|
'name'
|
||||||
|
]);
|
||||||
|
},
|
||||||
|
tagType: row => {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: this.$t('lesson.trainingType'),
|
||||||
|
prop: 'trainingType',
|
||||||
|
type: 'tag',
|
||||||
|
columnValue: row => {
|
||||||
|
return this.$convertField(
|
||||||
|
row.trainingType,
|
||||||
|
this.trainingTypeList,
|
||||||
|
['code', 'name']
|
||||||
|
);
|
||||||
|
},
|
||||||
|
tagType: row => {
|
||||||
|
return 'success';
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: this.$t('lesson.operationType'),
|
||||||
|
prop: 'operateType',
|
||||||
|
type: 'tag',
|
||||||
|
columnValue: row => {
|
||||||
|
return this.$convertField(
|
||||||
|
row.operateType,
|
||||||
|
this.trainingOperateTypeMap[row.trainingType],
|
||||||
|
['code', 'name']
|
||||||
|
);
|
||||||
|
},
|
||||||
|
tagType: row => {
|
||||||
|
return 'success';
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: this.$t('lesson.minDuration'),
|
||||||
|
prop: 'minDuration'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: this.$t('lesson.maxDuration'),
|
||||||
|
prop: 'maxDuration'
|
||||||
|
},
|
||||||
|
|
||||||
},
|
{
|
||||||
queryList: {
|
title: this.$t('lesson.trainingRemark'),
|
||||||
query: this.getList,
|
prop: 'trainingRemark',
|
||||||
selectCheckShow: false,
|
type: 'replicText',
|
||||||
indexShow: true,
|
columnValue: row => {
|
||||||
columns: [
|
return this.repliceName(
|
||||||
{
|
row.trainingRemark,
|
||||||
title: this.$t('lesson.trainingName'),
|
this.placeholderMap[row.trainingType]
|
||||||
prop: 'trainingName',
|
);
|
||||||
type: 'replicText',
|
}
|
||||||
columnValue: (row) => { return this.repliceName(row.trainingName, this.placeholderMap[row.trainingType]); }
|
},
|
||||||
},
|
{
|
||||||
{
|
type: 'button',
|
||||||
title: this.$t('lesson.skinType'),
|
title: this.$t('global.operate'),
|
||||||
prop: 'skinCode',
|
width: '250',
|
||||||
type: 'tag',
|
buttons: [
|
||||||
columnValue: (row) => { return this.$convertField(row.skinCode, this.skinCodeList, ['code', 'name']); },
|
{
|
||||||
tagType: (row) => { return ''; }
|
name: this.$t('lesson.stepDetail'),
|
||||||
},
|
handleClick: this.handleViewDetail
|
||||||
{
|
},
|
||||||
title: this.$t('lesson.trainingType'),
|
{
|
||||||
prop: 'trainingType',
|
name: this.$t('global.edit'),
|
||||||
type: 'tag',
|
handleClick: this.handleEdit
|
||||||
columnValue: (row) => { return this.$convertField(row.trainingType, this.trainingTypeList, ['code', 'name']); },
|
},
|
||||||
tagType: (row) => { return 'success'; }
|
{
|
||||||
},
|
name: this.$t('global.delete'),
|
||||||
{
|
handleClick: this.handleDelete,
|
||||||
title: this.$t('lesson.operationType'),
|
type: 'danger'
|
||||||
prop: 'operateType',
|
}
|
||||||
type: 'tag',
|
]
|
||||||
columnValue: (row) => { return this.$convertField(row.operateType, this.trainingOperateTypeMap[row.trainingType], ['code', 'name']); },
|
}
|
||||||
tagType: (row) => { return 'success'; }
|
],
|
||||||
},
|
actions: [
|
||||||
{
|
{ text: this.$t('global.add'), handler: this.handleAdd },
|
||||||
title: this.$t('lesson.minDuration'),
|
|
||||||
prop: 'minDuration'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: this.$t('lesson.maxDuration'),
|
|
||||||
prop: 'maxDuration'
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
|
||||||
title: this.$t('lesson.trainingRemark'),
|
|
||||||
prop: 'trainingRemark',
|
|
||||||
type: 'replicText',
|
|
||||||
columnValue: (row) => { return this.repliceName(row.trainingRemark, this.placeholderMap[row.trainingType]); }
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type: 'button',
|
|
||||||
title: this.$t('global.operate'),
|
|
||||||
width: '250',
|
|
||||||
buttons: [
|
|
||||||
{
|
|
||||||
name: this.$t('lesson.stepDetail'),
|
|
||||||
handleClick: this.handleViewDetail
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: this.$t('global.edit'),
|
|
||||||
handleClick: this.handleEdit
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: this.$t('global.delete'),
|
|
||||||
handleClick: this.handleDelete,
|
|
||||||
type: 'danger'
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
actions: [
|
|
||||||
{ text: this.$t('global.add'), handler: this.handleAdd },
|
|
||||||
{ text: this.$t('lesson.generation'), handler: this.handleBatchAdd },
|
{ text: this.$t('lesson.generation'), handler: this.handleBatchAdd },
|
||||||
{ text: this.$t('lesson.saveAs'), handler: this.handleSaveAs }
|
{ text: this.$t('lesson.saveAs'), handler: this.handleSaveAs }
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
currentModel: {}
|
currentModel: {}
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.init();
|
this.init();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
init() {
|
init() {
|
||||||
this.trainingOperateTypeMap = {};
|
this.trainingOperateTypeMap = {};
|
||||||
this.$Dictionary.stationControl().then(list => {
|
this.$Dictionary.stationControl().then(list => {
|
||||||
this.trainingOperateTypeMap['01'] = list; // 控制权实训
|
this.trainingOperateTypeMap['01'] = list; // 控制权实训
|
||||||
});
|
});
|
||||||
this.$Dictionary.signalOperation().then(list => {
|
this.$Dictionary.signalOperation().then(list => {
|
||||||
this.trainingOperateTypeMap['02'] = list; // 信号机实训
|
this.trainingOperateTypeMap['02'] = list; // 信号机实训
|
||||||
});
|
});
|
||||||
this.$Dictionary.switchOperation().then(list => {
|
this.$Dictionary.switchOperation().then(list => {
|
||||||
this.trainingOperateTypeMap['03'] = list; // 道岔实训
|
this.trainingOperateTypeMap['03'] = list; // 道岔实训
|
||||||
});
|
});
|
||||||
this.$Dictionary.sectionOperation().then(list => {
|
this.$Dictionary.sectionOperation().then(list => {
|
||||||
this.trainingOperateTypeMap['04'] = list; // 区段实训
|
this.trainingOperateTypeMap['04'] = list; // 区段实训
|
||||||
});
|
});
|
||||||
this.$Dictionary.stationStandOperation().then(list => {
|
this.$Dictionary.stationStandOperation().then(list => {
|
||||||
this.trainingOperateTypeMap['05'] = list; // 站台实训
|
this.trainingOperateTypeMap['05'] = list; // 站台实训
|
||||||
});
|
});
|
||||||
this.$Dictionary.trainPlanOperation().then(list => {
|
this.$Dictionary.trainPlanOperation().then(list => {
|
||||||
this.trainingOperateTypeMap['06'] = list; // 行车计划实训
|
this.trainingOperateTypeMap['06'] = list; // 行车计划实训
|
||||||
});
|
});
|
||||||
this.$Dictionary.trainOperation().then(list => {
|
this.$Dictionary.trainOperation().then(list => {
|
||||||
this.trainingOperateTypeMap['07'] = list; // 列车实训
|
this.trainingOperateTypeMap['07'] = list; // 列车实训
|
||||||
});
|
});
|
||||||
this.$Dictionary.limitOperation().then(list => {
|
this.$Dictionary.limitOperation().then(list => {
|
||||||
this.trainingOperateTypeMap['08'] = list; // 限速实训
|
this.trainingOperateTypeMap['08'] = list; // 限速实训
|
||||||
});
|
});
|
||||||
this.placeholderMap = {};
|
this.placeholderMap = {};
|
||||||
getPlaceholderList({ skinCode: '', trainingType: '' }).then(res => {
|
getPlaceholderList({ skinCode: '', trainingType: '' }).then(res => {
|
||||||
res.data.forEach(item => {
|
res.data.forEach(item => {
|
||||||
if (!this.placeholderMap[item.trainingType]) {
|
if (!this.placeholderMap[item.trainingType]) {
|
||||||
this.placeholderMap[item.trainingType] = [];
|
this.placeholderMap[item.trainingType] = [];
|
||||||
}
|
}
|
||||||
this.placeholderMap[item.trainingType].push(item);
|
this.placeholderMap[item.trainingType].push(item);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// 获取皮肤列表
|
// 获取皮肤列表
|
||||||
this.skinCodeList = [];
|
this.skinCodeList = [];
|
||||||
getSkinCodeList().then(response => {
|
getSkinCodeList().then(response => {
|
||||||
this.skinCodeList = response.data;
|
this.skinCodeList = response.data;
|
||||||
});
|
});
|
||||||
|
|
||||||
// 获取实训类型
|
// 获取实训类型
|
||||||
this.trainingTypeList = [];
|
this.trainingTypeList = [];
|
||||||
this.$Dictionary.trainingType().then(list => {
|
this.$Dictionary.trainingType().then(list => {
|
||||||
this.trainingTypeList = list;
|
this.trainingTypeList = list;
|
||||||
list.forEach(elem => {
|
list.forEach(elem => {
|
||||||
this.queryForm.queryObject.trainingType.config.data.push({ value: elem.code, label: elem.name });
|
this.queryForm.queryObject.trainingType.config.data.push({
|
||||||
});
|
value: elem.code,
|
||||||
});
|
label: elem.name
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
this.reloadTable();
|
this.reloadTable();
|
||||||
},
|
},
|
||||||
repliceName(fieldValue, enumList) {
|
repliceName(fieldValue, enumList) {
|
||||||
if (enumList && enumList.length > 0) {
|
if (enumList && enumList.length > 0) {
|
||||||
for (let i = 0; i < enumList.length; i++) {
|
for (let i = 0; i < enumList.length; i++) {
|
||||||
if (fieldValue.includes(`{${enumList[i].id}}`)) {
|
if (fieldValue.includes(`{${enumList[i].id}}`)) {
|
||||||
fieldValue = fieldValue.replace(`{${enumList[i].id}}`, `{${enumList[i].name}}`);
|
fieldValue = fieldValue.replace(
|
||||||
}
|
`{${enumList[i].id}}`,
|
||||||
}
|
`{${enumList[i].name}}`
|
||||||
return fieldValue;
|
);
|
||||||
} else if (!enumList) {
|
}
|
||||||
return fieldValue;
|
}
|
||||||
}
|
return fieldValue;
|
||||||
},
|
} else if (!enumList) {
|
||||||
// 选择实训类型下的操作类型 暂时不用
|
return fieldValue;
|
||||||
typeChoose(form) {
|
}
|
||||||
this.queryForm.queryObject.operateType.config.data = [];
|
},
|
||||||
if (form && form.trainingType) {
|
// 选择实训类型下的操作类型 暂时不用
|
||||||
form.operateType = '';
|
typeChoose(form) {
|
||||||
this.trainingOperateTypeMap[form.trainingType].forEach(elem => {
|
this.queryForm.queryObject.operateType.config.data = [];
|
||||||
this.queryForm.queryObject.operateType.config.data.push({ value: elem.code, label: elem.name });
|
if (form && form.trainingType) {
|
||||||
});
|
form.operateType = '';
|
||||||
}
|
this.trainingOperateTypeMap[form.trainingType].forEach(elem => {
|
||||||
},
|
this.queryForm.queryObject.operateType.config.data.push({
|
||||||
async getList(params) {
|
value: elem.code,
|
||||||
|
label: elem.name
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
async getList(params) {
|
||||||
params['mapId'] = this.$route.query.mapId;
|
params['mapId'] = this.$route.query.mapId;
|
||||||
const res = await getTrainingRulesList(params);
|
const res = await getTrainingRulesList(params);
|
||||||
this.totals = res.data.total;
|
this.totals = res.data.total;
|
||||||
return res;
|
return res;
|
||||||
},
|
},
|
||||||
handleViewDetail(index, row) {
|
handleViewDetail(index, row) {
|
||||||
this.$router.push({ path: `${UrlConfig.design.trainingRuleDetail}`, query: { id: row.id, type: row.trainingType, skinCode: row.skinCode } });
|
this.$router.push({
|
||||||
},
|
path: `${UrlConfig.design.trainingRuleDetail}`,
|
||||||
|
query: { id: row.id, type: row.trainingType, skinCode: row.skinCode }
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
handleEdit(index, row) {
|
handleEdit(index, row) {
|
||||||
this.$refs.edit.show(row);
|
this.$refs.edit.show(row);
|
||||||
},
|
},
|
||||||
|
|
||||||
handleAdd() {
|
handleAdd() {
|
||||||
this.$refs.create.show();
|
this.$refs.create.show();
|
||||||
},
|
},
|
||||||
|
|
||||||
handleBatchAdd() {
|
handleBatchAdd() {
|
||||||
this.$refs.addBatch.show(this.totals);
|
this.$refs.addBatch.show(this.totals);
|
||||||
},
|
},
|
||||||
|
|
||||||
handleSaveAs() {
|
handleSaveAs() {
|
||||||
this.$refs.saveAs.show();
|
this.$refs.saveAs.show();
|
||||||
},
|
},
|
||||||
|
|
||||||
handleDelete(index, row) {
|
handleDelete(index, row) {
|
||||||
this.$confirm(this.$t('lesson.wellDelTrainingRule'), this.$t('global.tips'), {
|
this.$confirm(
|
||||||
confirmButtonText: this.$t('global.confirm'),
|
this.$t('lesson.wellDelTrainingRule'),
|
||||||
cancelButtonText: this.$t('global.cancel'),
|
this.$t('global.tips'),
|
||||||
type: 'warning'
|
{
|
||||||
}).then(() => {
|
confirmButtonText: this.$t('global.confirm'),
|
||||||
deleteTrainingRulesData(row.id).then(response => {
|
cancelButtonText: this.$t('global.cancel'),
|
||||||
this.$message.success(this.$t('lesson.deleteSuccess'));
|
type: 'warning'
|
||||||
this.reloadTable();
|
}
|
||||||
}).catch(() => {
|
).then(() => {
|
||||||
this.reloadTable();
|
deleteTrainingRulesData(row.id)
|
||||||
this.$messageBox(this.$t('error.deleteFailed'));
|
.then(response => {
|
||||||
});
|
this.$message.success(this.$t('lesson.deleteSuccess'));
|
||||||
});
|
this.reloadTable();
|
||||||
},
|
})
|
||||||
turnback() {
|
.catch(() => {
|
||||||
this.$router.go(-1)
|
this.reloadTable();
|
||||||
|
this.$messageBox(this.$t('error.deleteFailed'));
|
||||||
|
});
|
||||||
|
});
|
||||||
},
|
},
|
||||||
reloadTable() {
|
turnback() {
|
||||||
this.queryList.reload();
|
this.$router.go(-1);
|
||||||
}
|
},
|
||||||
}
|
reloadTable() {
|
||||||
|
this.queryList.reload();
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
<style rel="stylesheet/scss" lang="scss" scoped>
|
<style rel="stylesheet/scss" lang="scss" scoped>
|
||||||
.draft {
|
.draft {
|
||||||
width: 400px;
|
width: 400px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
margin: 20px auto;
|
margin: 20px auto;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
@ -1,5 +1,12 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-dialog v-dialogDrag :title="title" :visible.sync="dialogVisible" width="25%" :before-close="handleClose" center>
|
<el-dialog
|
||||||
|
v-dialogDrag
|
||||||
|
:title="title"
|
||||||
|
:visible.sync="dialogVisible"
|
||||||
|
width="25%"
|
||||||
|
:before-close="handleClose"
|
||||||
|
center
|
||||||
|
>
|
||||||
<data-form ref="dataform" :form="form" :form-model="formModel" :rules="rules" />
|
<data-form ref="dataform" :form="form" :form-model="formModel" :rules="rules" />
|
||||||
<span slot="footer" class="dialog-footer">
|
<span slot="footer" class="dialog-footer">
|
||||||
<el-button v-loading="loading" type="primary" @click="doSave">{{ $t('global.confirm') }}</el-button>
|
<el-button v-loading="loading" type="primary" @click="doSave">{{ $t('global.confirm') }}</el-button>
|
||||||
@ -13,94 +20,118 @@ import { postOperateSaveAs } from '@/api/management/operation';
|
|||||||
import { getSkinCodeList } from '@/api/management/mapskin';
|
import { getSkinCodeList } from '@/api/management/mapskin';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'AddBatch',
|
name: 'AddBatch',
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
loading: false,
|
loading: false,
|
||||||
dialogVisible: false,
|
dialogVisible: false,
|
||||||
formModel: {
|
formModel: {
|
||||||
skinCodeFrom: '',
|
skinCodeFrom: '',
|
||||||
skinCodeTo: ''
|
skinCodeTo: ''
|
||||||
},
|
},
|
||||||
skinCodeList: []
|
skinCodeList: []
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
form() {
|
form() {
|
||||||
this.type === 'ADD';
|
this.type === 'ADD';
|
||||||
const form = {
|
const form = {
|
||||||
labelWidth: '120px',
|
labelWidth: '120px',
|
||||||
items: [
|
items: [
|
||||||
{ prop: 'skinCodeFrom', label: this.$t('lesson.skinTypeFrom'), type: 'select', required: true, options: this.skinCodeList },
|
{
|
||||||
{ prop: 'skinCodeTo', label: this.$t('lesson.skinTypeTo'), type: 'select', required: true, options: this.skinCodeList }
|
prop: 'skinCodeFrom',
|
||||||
]
|
label: this.$t('lesson.skinTypeFrom'),
|
||||||
};
|
type: 'select',
|
||||||
return form;
|
required: true,
|
||||||
},
|
options: this.skinCodeList
|
||||||
rules() {
|
},
|
||||||
const crules = {
|
{
|
||||||
skinCodeFrom: [
|
prop: 'skinCodeTo',
|
||||||
{ required: true, message: this.$t('rules.inputSkinType'), trigger: 'change' }
|
label: this.$t('lesson.skinTypeTo'),
|
||||||
],
|
type: 'select',
|
||||||
skinCodeTo: [
|
required: true,
|
||||||
{ required: true, message: this.$t('rules.inputSkinType'), trigger: 'change' }
|
options: this.skinCodeList
|
||||||
]
|
}
|
||||||
};
|
]
|
||||||
return crules;
|
};
|
||||||
},
|
return form;
|
||||||
title() {
|
},
|
||||||
return this.$t('lesson.copyLesson');
|
rules() {
|
||||||
}
|
const crules = {
|
||||||
},
|
skinCodeFrom: [
|
||||||
mounted() {
|
{
|
||||||
this.init();
|
required: true,
|
||||||
},
|
message: this.$t('rules.inputSkinType'),
|
||||||
methods: {
|
trigger: 'change'
|
||||||
init() {
|
}
|
||||||
// 获取皮肤列表
|
],
|
||||||
this.skinCodeList = [];
|
skinCodeTo: [
|
||||||
getSkinCodeList().then(response => {
|
{
|
||||||
this.skinCodeList = response.data.map(item => {
|
required: true,
|
||||||
const params = {};
|
message: this.$t('rules.inputSkinType'),
|
||||||
params.label = item.name;
|
trigger: 'change'
|
||||||
params.value = item.code;
|
}
|
||||||
return params;
|
]
|
||||||
});
|
};
|
||||||
});
|
return crules;
|
||||||
},
|
},
|
||||||
show() {
|
title() {
|
||||||
this.dialogVisible = true;
|
return this.$t('lesson.copyLesson');
|
||||||
},
|
}
|
||||||
doSave() {
|
},
|
||||||
const self = this;
|
mounted() {
|
||||||
this.$refs.dataform.validateForm(() => {
|
this.init();
|
||||||
if (this.formModel.skinCodeFrom != this.formModel.skinCodeTo) {
|
},
|
||||||
self.create();
|
methods: {
|
||||||
} else {
|
init() {
|
||||||
this.$alert(this.$t('lesson.countSkinCode'), this.$t('global.tips'), {
|
// 获取皮肤列表
|
||||||
confirmButtonText: this.$t('global.confirm'),
|
this.skinCodeList = [];
|
||||||
callback: () => { }
|
getSkinCodeList().then(response => {
|
||||||
});
|
this.skinCodeList = response.data.map(item => {
|
||||||
}
|
const params = {};
|
||||||
});
|
params.label = item.name;
|
||||||
},
|
params.value = item.code;
|
||||||
create() {
|
return params;
|
||||||
const self = this;
|
});
|
||||||
this.loading = true;
|
});
|
||||||
postOperateSaveAs(this.formModel.skinCodeFrom, this.formModel.skinCodeTo).then(response => {
|
},
|
||||||
self.loading = false;
|
show() {
|
||||||
self.$message.success(this.$t('lesson.batchCreateSuccess'));
|
this.dialogVisible = true;
|
||||||
self.handleClose();
|
},
|
||||||
self.$emit('reloadTable'); // 刷新列表
|
doSave() {
|
||||||
}).catch(error => {
|
const self = this;
|
||||||
self.loading = false;
|
this.$refs.dataform.validateForm(() => {
|
||||||
self.$message.error(`${this.$('error.batchCreateFailed')}:${error.message}`);
|
if (this.formModel.skinCodeFrom != this.formModel.skinCodeTo) {
|
||||||
});
|
self.create();
|
||||||
},
|
} else {
|
||||||
handleClose() {
|
this.$alert(this.$t('lesson.countSkinCode'), this.$t('global.tips'), {
|
||||||
this.$refs.dataform.resetForm();
|
confirmButtonText: this.$t('global.confirm'),
|
||||||
this.dialogVisible = false;
|
callback: () => {}
|
||||||
}
|
});
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
create() {
|
||||||
|
const self = this;
|
||||||
|
this.loading = true;
|
||||||
|
postOperateSaveAs(this.formModel.skinCodeFrom, this.formModel.skinCodeTo)
|
||||||
|
.then(response => {
|
||||||
|
self.loading = false;
|
||||||
|
self.$message.success(this.$t('lesson.batchCreateSuccess'));
|
||||||
|
self.handleClose();
|
||||||
|
self.$emit('reloadTable'); // 刷新列表
|
||||||
|
})
|
||||||
|
.catch(error => {
|
||||||
|
self.loading = false;
|
||||||
|
self.$message.error(
|
||||||
|
`${this.$('error.batchCreateFailed')}:${error.message}`
|
||||||
|
);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
handleClose() {
|
||||||
|
this.$refs.dataform.resetForm();
|
||||||
|
this.dialogVisible = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
<div style="height: 100%; overflow-y: auto;">
|
||||||
|
<!-- <div style="height: calc(100% - 80px); overflow-y: auto;"> -->
|
||||||
<QueryListPage ref="queryListPage" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" />
|
<QueryListPage ref="queryListPage" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" />
|
||||||
|
<!-- </div> -->
|
||||||
<training-draft
|
<training-draft
|
||||||
ref="draftTrain"
|
ref="draftTrain"
|
||||||
:skin-code-list="skinCodeList"
|
:skin-code-list="skinCodeList"
|
||||||
@ -27,253 +29,253 @@ import TrainingDraft from './draft';
|
|||||||
import localStore from 'storejs';
|
import localStore from 'storejs';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'TrainingGeneration',
|
name: 'TrainingGeneration',
|
||||||
components: {
|
components: {
|
||||||
TrainingDraft
|
TrainingDraft
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
skinCodeList: [],
|
skinCodeList: [],
|
||||||
trainingTypeList: [],
|
trainingTypeList: [],
|
||||||
prdTypeList: [],
|
prdTypeList: [],
|
||||||
trainingOperateTypeMap: {},
|
trainingOperateTypeMap: {},
|
||||||
pagerConfig: {
|
pagerConfig: {
|
||||||
pageSize: 'pageSize',
|
pageSize: 'pageSize',
|
||||||
pageIndex: 'pageNum'
|
pageIndex: 'pageNum'
|
||||||
},
|
},
|
||||||
queryForm: {
|
queryForm: {
|
||||||
labelWidth: '120px',
|
labelWidth: '120px',
|
||||||
queryObject: {
|
queryObject: {
|
||||||
prdCode: {
|
prdCode: {
|
||||||
type: 'select',
|
type: 'select',
|
||||||
label: this.$t('lesson.product'),
|
label: this.$t('lesson.product'),
|
||||||
change: this.prdChoose,
|
change: this.prdChoose,
|
||||||
config: {
|
config: {
|
||||||
data: []
|
data: []
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
type: {
|
type: {
|
||||||
type: 'select',
|
type: 'select',
|
||||||
label: this.$t('lesson.trainingType'),
|
label: this.$t('lesson.trainingType'),
|
||||||
change: this.typeChoose,
|
change: this.typeChoose,
|
||||||
config: {
|
config: {
|
||||||
data: []
|
data: []
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
operateType: {
|
operateType: {
|
||||||
type: 'select',
|
type: 'select',
|
||||||
label: this.$t('lesson.operationType'),
|
label: this.$t('lesson.operationType'),
|
||||||
config: {
|
config: {
|
||||||
data: []
|
data: []
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
/* generateType: {
|
/* generateType: {
|
||||||
type: 'select',
|
type: 'select',
|
||||||
label: this.$t('lesson.automaticOrManual'),
|
label: this.$t('lesson.automaticOrManual'),
|
||||||
config: {
|
config: {
|
||||||
data: [{ value: '02', label: this.$t('lesson.manual') }, { value: '01', label: this.$t('lesson.automatic') }]
|
data: [{ value: '02', label: this.$t('lesson.manual') }, { value: '01', label: this.$t('lesson.automatic') }]
|
||||||
}
|
}
|
||||||
},*/
|
},*/
|
||||||
name: {
|
name: {
|
||||||
type: 'text',
|
type: 'text',
|
||||||
label: this.$t('lesson.trainingName')
|
label: this.$t('lesson.trainingName')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
queryList: {
|
queryList: {
|
||||||
query: this.queryFunction,
|
query: this.queryFunction,
|
||||||
selectCheckShow: false,
|
selectCheckShow: false,
|
||||||
indexShow: true,
|
indexShow: true,
|
||||||
columns: [
|
columns: [
|
||||||
{
|
{
|
||||||
title: this.$t('lesson.trainingName'),
|
title: this.$t('lesson.trainingName'),
|
||||||
prop: 'name'
|
prop: 'name'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: this.$t('lesson.skinType'),
|
title: this.$t('lesson.skinType'),
|
||||||
prop: 'skinCode',
|
prop: 'skinCode',
|
||||||
type: 'tag',
|
type: 'tag',
|
||||||
columnValue: (row) => { return this.$convertField(row.skinCode, this.skinCodeList, ['code', 'name']); },
|
columnValue: (row) => { return this.$convertField(row.skinCode, this.skinCodeList, ['code', 'name']); },
|
||||||
tagType: (row) => { return ''; }
|
tagType: (row) => { return ''; }
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: this.$t('lesson.product'),
|
title: this.$t('lesson.product'),
|
||||||
prop: 'prdCode',
|
prop: 'prdCode',
|
||||||
type: 'tag',
|
type: 'tag',
|
||||||
columnValue: (row) => { return this.$convertField(row.prdCode, this.prdTypeList, ['code', 'name']); },
|
columnValue: (row) => { return this.$convertField(row.prdCode, this.prdTypeList, ['code', 'name']); },
|
||||||
tagType: (row) => { return 'success'; }
|
tagType: (row) => { return 'success'; }
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: this.$t('lesson.trainingType'),
|
title: this.$t('lesson.trainingType'),
|
||||||
prop: 'type',
|
prop: 'type',
|
||||||
type: 'tag',
|
type: 'tag',
|
||||||
columnValue: (row) => { return this.$convertField(row.type, this.trainingTypeList, ['code', 'name']); },
|
columnValue: (row) => { return this.$convertField(row.type, this.trainingTypeList, ['code', 'name']); },
|
||||||
tagType: (row) => { return 'success'; }
|
tagType: (row) => { return 'success'; }
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: this.$t('lesson.operationType'),
|
title: this.$t('lesson.operationType'),
|
||||||
prop: 'operateType',
|
prop: 'operateType',
|
||||||
type: 'tag',
|
type: 'tag',
|
||||||
columnValue: (row) => { return this.$convertField(row.operateType, this.trainingOperateTypeMap[row.type], ['code', 'name']); },
|
columnValue: (row) => { return this.$convertField(row.operateType, this.trainingOperateTypeMap[row.type], ['code', 'name']); },
|
||||||
tagType: (row) => { return 'success'; }
|
tagType: (row) => { return 'success'; }
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: this.$t('lesson.minDuration'),
|
title: this.$t('lesson.minDuration'),
|
||||||
prop: 'minDuration'
|
prop: 'minDuration'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: this.$t('lesson.maxDuration'),
|
title: this.$t('lesson.maxDuration'),
|
||||||
prop: 'maxDuration'
|
prop: 'maxDuration'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: this.$t('lesson.remarks'),
|
title: this.$t('lesson.remarks'),
|
||||||
prop: 'remarks'
|
prop: 'remarks'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: 'button',
|
type: 'button',
|
||||||
title: this.$t('global.operate'),
|
title: this.$t('global.operate'),
|
||||||
width: '250',
|
width: '250',
|
||||||
buttons: [
|
buttons: [
|
||||||
{
|
{
|
||||||
name: this.$t('lesson.demonstration'),
|
name: this.$t('lesson.demonstration'),
|
||||||
handleClick: this.demoDisplay,
|
handleClick: this.demoDisplay,
|
||||||
type: ''
|
type: ''
|
||||||
}
|
}
|
||||||
/* {
|
/* {
|
||||||
name: this.$t('lesson.trainingRecord'),
|
name: this.$t('lesson.trainingRecord'),
|
||||||
handleClick: this.trainingRecord,
|
handleClick: this.trainingRecord,
|
||||||
type: ''
|
type: ''
|
||||||
}*/
|
}*/
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
actions: [
|
actions: [
|
||||||
{ text: this.$t('lesson.generateTraining'), btnCode: 'employee_auto', handler: this.autoMaticTrainging },
|
{ text: this.$t('lesson.generateTraining'), btnCode: 'employee_auto', handler: this.autoMaticTrainging },
|
||||||
{ text: this.$t('lesson.updateTraining'), btnCode: 'employee_edit', handler: this.editTrainingByType, type: 'warning'},
|
{ text: this.$t('lesson.updateTraining'), btnCode: 'employee_edit', handler: this.editTrainingByType, type: 'warning'},
|
||||||
{ text: this.$t('lesson.deleteTraining'), btnCode: 'employee_delete', handler: this.delAutoMaticTrainging, type: 'danger'}
|
{ text: this.$t('lesson.deleteTraining'), btnCode: 'employee_delete', handler: this.delAutoMaticTrainging, type: 'danger'}
|
||||||
/* { text: this.$t('lesson.addTraining'), btnCode: 'employee_add', handler: this.addingTraining, type: 'primary' }*/
|
/* { text: this.$t('lesson.addTraining'), btnCode: 'employee_add', handler: this.addingTraining, type: 'primary' }*/
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|
||||||
currentModel: {}
|
currentModel: {}
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
async created() {
|
async created() {
|
||||||
await this.loadInitData();
|
await this.loadInitData();
|
||||||
const json = localStore.get(this.$route.path);
|
const json = localStore.get(this.$route.path);
|
||||||
json.type = '';
|
json.type = '';
|
||||||
json.prdCode = '';
|
json.prdCode = '';
|
||||||
json.operateType = '';
|
json.operateType = '';
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
async loadInitData() {
|
async loadInitData() {
|
||||||
this.skinCodeList = [];
|
this.skinCodeList = [];
|
||||||
this.queryForm.queryObject.prdCode.config.data = [];
|
this.queryForm.queryObject.prdCode.config.data = [];
|
||||||
getSkinCodeList().then(response => {
|
getSkinCodeList().then(response => {
|
||||||
this.skinCodeList = response.data;
|
this.skinCodeList = response.data;
|
||||||
});
|
});
|
||||||
getCommodityMapProduct(this.$route.params.skinCode).then((response) => {
|
getCommodityMapProduct(this.$route.params.skinCode).then((response) => {
|
||||||
const productList = response.data;
|
const productList = response.data;
|
||||||
if (productList && productList.length > 0) {
|
if (productList && productList.length > 0) {
|
||||||
productList.forEach(elem => {
|
productList.forEach(elem => {
|
||||||
// 过滤综合演练产品
|
// 过滤综合演练产品
|
||||||
if (elem.prdType != '03') {
|
if (elem.prdType != '03') {
|
||||||
this.queryForm.queryObject.prdCode.config.data.push({ value: elem.code, label: elem.name });
|
this.queryForm.queryObject.prdCode.config.data.push({ value: elem.code, label: elem.name });
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
this.prdTypeList = [];
|
this.prdTypeList = [];
|
||||||
getProductList({ pageSize: 500, pageNum: 1 }).then(res => {
|
getProductList({ pageSize: 500, pageNum: 1 }).then(res => {
|
||||||
const list = res.data.list;
|
const list = res.data.list;
|
||||||
if (list && list.length > 0) {
|
if (list && list.length > 0) {
|
||||||
this.prdTypeList = list.filter(elem => { return elem.prdType != '03'; });
|
this.prdTypeList = list.filter(elem => { return elem.prdType != '03'; });
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// 获取实训类型
|
// 获取实训类型
|
||||||
this.trainingTypeList = [];
|
this.trainingTypeList = [];
|
||||||
this.$Dictionary.trainingType().then(list => {
|
this.$Dictionary.trainingType().then(list => {
|
||||||
this.trainingTypeList = list;
|
this.trainingTypeList = list;
|
||||||
list.forEach(elem => {
|
list.forEach(elem => {
|
||||||
this.queryForm.queryObject.type.config.data.push({ value: elem.code, label: elem.name });
|
this.queryForm.queryObject.type.config.data.push({ value: elem.code, label: elem.name });
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
this.trainingOperateTypeMap = {};
|
this.trainingOperateTypeMap = {};
|
||||||
const list01 = await this.$Dictionary.stationControl();
|
const list01 = await this.$Dictionary.stationControl();
|
||||||
this.trainingOperateTypeMap['01'] = list01; // 控制权实训
|
this.trainingOperateTypeMap['01'] = list01; // 控制权实训
|
||||||
const list02 = await this.$Dictionary.signalOperation();
|
const list02 = await this.$Dictionary.signalOperation();
|
||||||
this.trainingOperateTypeMap['02'] = list02; // 信号机实训
|
this.trainingOperateTypeMap['02'] = list02; // 信号机实训
|
||||||
const list03 = await this.$Dictionary.switchOperation();
|
const list03 = await this.$Dictionary.switchOperation();
|
||||||
this.trainingOperateTypeMap['03'] = list03; // 道岔实训
|
this.trainingOperateTypeMap['03'] = list03; // 道岔实训
|
||||||
const list04 = await this.$Dictionary.sectionOperation();
|
const list04 = await this.$Dictionary.sectionOperation();
|
||||||
this.trainingOperateTypeMap['04'] = list04; // 区段实训
|
this.trainingOperateTypeMap['04'] = list04; // 区段实训
|
||||||
const list05 = await this.$Dictionary.stationStandOperation();
|
const list05 = await this.$Dictionary.stationStandOperation();
|
||||||
this.trainingOperateTypeMap['05'] = list05; // 站台实训
|
this.trainingOperateTypeMap['05'] = list05; // 站台实训
|
||||||
const list06 = await this.$Dictionary.trainPlanOperation();
|
const list06 = await this.$Dictionary.trainPlanOperation();
|
||||||
this.trainingOperateTypeMap['06'] = list06; // 行车计划实训
|
this.trainingOperateTypeMap['06'] = list06; // 行车计划实训
|
||||||
const list07 = await this.$Dictionary.trainOperation();
|
const list07 = await this.$Dictionary.trainOperation();
|
||||||
this.trainingOperateTypeMap['07'] = list07; // 列车实训
|
this.trainingOperateTypeMap['07'] = list07; // 列车实训
|
||||||
const list08 = await this.$Dictionary.limitOperation();
|
const list08 = await this.$Dictionary.limitOperation();
|
||||||
this.trainingOperateTypeMap['08'] = list08; // 限速实训
|
this.trainingOperateTypeMap['08'] = list08; // 限速实训
|
||||||
this.reloadTable();
|
this.reloadTable();
|
||||||
},
|
},
|
||||||
prdChoose(form) {
|
prdChoose(form) {
|
||||||
form.type = '';
|
form.type = '';
|
||||||
form.operateType = '';
|
form.operateType = '';
|
||||||
},
|
},
|
||||||
typeChoose(form) {
|
typeChoose(form) {
|
||||||
this.queryForm.queryObject.operateType.config.data = [];
|
this.queryForm.queryObject.operateType.config.data = [];
|
||||||
form.operateType = '';
|
form.operateType = '';
|
||||||
if (form && form.type) {
|
if (form && form.type) {
|
||||||
this.trainingOperateTypeMap[form.type].forEach(elem => {
|
this.trainingOperateTypeMap[form.type].forEach(elem => {
|
||||||
this.queryForm.queryObject.operateType.config.data.push({ value: elem.code, label: elem.name });
|
this.queryForm.queryObject.operateType.config.data.push({ value: elem.code, label: elem.name });
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
autoMaticTrainging() {
|
autoMaticTrainging() {
|
||||||
this.$refs.draftTrain.show({ event: '01', title: this.$t('lesson.automaticGenerationOfTraining') });
|
this.$refs.draftTrain.show({ event: '01', title: this.$t('lesson.automaticGenerationOfTraining') });
|
||||||
},
|
},
|
||||||
editTrainingByType() {
|
editTrainingByType() {
|
||||||
this.$refs.draftTrain.show({ event: '02', title: this.$t('lesson.modifyTrainingByCategory') });
|
this.$refs.draftTrain.show({ event: '02', title: this.$t('lesson.modifyTrainingByCategory') });
|
||||||
},
|
},
|
||||||
delAutoMaticTrainging() {
|
delAutoMaticTrainging() {
|
||||||
this.$refs.draftTrain.show({ event: '03', title: this.$t('lesson.deleteAutoGeneratedTraining') });
|
this.$refs.draftTrain.show({ event: '03', title: this.$t('lesson.deleteAutoGeneratedTraining') });
|
||||||
},
|
},
|
||||||
// addingTraining() {
|
// addingTraining() {
|
||||||
// this.$refs.draftTrain.show({ event: '04', title: this.$t('lesson.addTraining') });
|
// this.$refs.draftTrain.show({ event: '04', title: this.$t('lesson.addTraining') });
|
||||||
// },
|
// },
|
||||||
demoDisplay(index, node) {
|
demoDisplay(index, node) {
|
||||||
trainingNotify({ trainingId: node.id }).then(resp => {
|
trainingNotify({ trainingId: node.id }).then(resp => {
|
||||||
/** 区分演示和正式,需要在演示时设置lessonId为0*/
|
/** 区分演示和正式,需要在演示时设置lessonId为0*/
|
||||||
const query = { group: resp.data, trainingId: node.id, lessonId: 0 };
|
const query = { group: resp.data, trainingId: node.id, lessonId: 0 };
|
||||||
this.$router.push({ path: `${UrlConfig.display}/manage`, query: query });
|
this.$router.push({ path: `${UrlConfig.display}/manage`, query: query });
|
||||||
launchFullscreen();
|
launchFullscreen();
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
this.$messageBox(this.$t('error.createSimulationFailed') +error.message);
|
this.$messageBox(this.$t('error.createSimulationFailed') + error.message);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
reloadTable() {
|
reloadTable() {
|
||||||
this.queryList.reload();
|
this.queryList.reload();
|
||||||
},
|
},
|
||||||
turnback() {
|
turnback() {
|
||||||
this.$router.go(-1);
|
this.$router.go(-1);
|
||||||
},
|
},
|
||||||
trainingRecord(index, node) {
|
trainingRecord(index, node) {
|
||||||
trainingNotify({ trainingId: node.id }).then(resp => {
|
trainingNotify({ trainingId: node.id }).then(resp => {
|
||||||
this.group = resp.data;
|
this.group = resp.data;
|
||||||
this.$router.push({ path: `${UrlConfig.design.trainingRecord}/${node.id}/${node.name}`, query: { group: resp.data } });
|
this.$router.push({ path: `${UrlConfig.design.trainingRecord}/${node.id}/${node.name}`, query: { group: resp.data } });
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
this.$messageBox(`${this.$t('error.createSimulationFailed')}: ${error.message}`);
|
this.$messageBox(`${this.$t('error.createSimulationFailed')}: ${error.message}`);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
queryFunction(params) {
|
queryFunction(params) {
|
||||||
params['mapId'] = this.$route.query.mapId;
|
params['mapId'] = this.$route.query.mapId;
|
||||||
return pageQueryTraining(params);
|
return pageQueryTraining(params);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
<style rel="stylesheet/scss" lang="scss" scoped>
|
<style rel="stylesheet/scss" lang="scss" scoped>
|
||||||
|
Loading…
Reference in New Issue
Block a user