fast(型号):优化代码结构并移除系统配置脚本、解决型号列表选择型号报错问题,打包屏蔽console和debugger

- 移除 public/index.html 中的系统配置脚本引用
- 删除 public/systenConfig.js 文件
- 优化多个组件中的代码结构,移除未使用的变量和注释
- 解决型号列表选择系列报错问题和不显示问题
- 在 vue.config.js 中添加生产环境下的屏蔽console和debugger
This commit is contained in:
fhysy 2025-05-27 14:17:38 +08:00
parent fccb5033a7
commit 07948ec07c
14 changed files with 292 additions and 334 deletions

View File

@ -225,7 +225,6 @@
</div> </div>
</body> </body>
<!-- 全局系统配置(区分系统) --> <!-- 全局系统配置(区分系统) -->
<script src="./systenConfig.js"></script>
<% if (process.env.VUE_APP_ENV === 'drprod' ) { %> <% if (process.env.VUE_APP_ENV === 'drprod' ) { %>
<script> <script>
// 获取loader-wrapper元素 // 获取loader-wrapper元素

View File

@ -1,3 +0,0 @@
window._SYSTEMCONFIG = {}
window._SYSTEMCONFIG['logoURL'] = '@/assets/logo/drgy/logo.png'
window._SYSTEMCONFIG['systemName'] = '数字用电管理系统'

View File

@ -85,7 +85,7 @@ export default {
} }
}, },
created() { created() {
console.log(this.avatar) // console.log(this.avatar)
}, },
methods: { methods: {
getIotFileUrl, getIotFileUrl,

View File

@ -1,9 +1,9 @@
<template> <template>
<div :class="[classObj,themeClass1]" class="app-wrapper" :style="{'--current-color': theme}"> <div :class="[classObj,themeClass1]" :style="{'--current-color': theme}" class="app-wrapper">
<div v-if="device==='mobile'&&sidebar.opened" class="drawer-bg" @click="handleClickOutside"/> <div v-if="device==='mobile'&&sidebar.opened" class="drawer-bg" @click="handleClickOutside"/>
<sidebar class="sidebar-container" /> <sidebar class="sidebar-container" />
<div :class="{hasTagsView:needTagsView}" class="main-container"> <div :class="{hasTagsView:needTagsView}" class="main-container">
<div :class="{'fixed-header':fixedHeader}" id="navbar-top" :style="navbarShow() ? 'display: none;' : ''"> <div id="navbar-top" :class="{'fixed-header':fixedHeader}" :style="navbarShow() ? 'display: none;' : ''">
<navbar /> <navbar />
<tags-view v-if="needTagsView" /> <tags-view v-if="needTagsView" />
</div> </div>
@ -44,12 +44,12 @@ export default {
fixedHeader: state => state.settings.fixedHeader fixedHeader: state => state.settings.fixedHeader
}), }),
classObj() { classObj() {
console.log({ // console.log({
hideSidebar: !this.sidebar.opened, // hideSidebar: !this.sidebar.opened,
openSidebar: this.sidebar.opened, // openSidebar: this.sidebar.opened,
withoutAnimation: this.sidebar.withoutAnimation, // withoutAnimation: this.sidebar.withoutAnimation,
mobile: this.device === 'mobile' // mobile: this.device === 'mobile'
}) // })
return { return {
hideSidebar: !this.sidebar.opened, hideSidebar: !this.sidebar.opened,
openSidebar: this.sidebar.opened, openSidebar: this.sidebar.opened,

View File

@ -119,7 +119,6 @@ const attribute = {
commit('SET_GROUP_LIST', data.groupList) commit('SET_GROUP_LIST', data.groupList)
commit('SET_FUNCTION_LIST', data.functionList) commit('SET_FUNCTION_LIST', data.functionList)
commit('SET_EVENT_LIST', data.eventList) commit('SET_EVENT_LIST', data.eventList)
console.log('res:', state, data)
}, },
// 新增 属性 // 新增 属性
AddAttribute({ commit, state }, attr) { AddAttribute({ commit, state }, attr) {

View File

@ -973,7 +973,6 @@ export default {
}, },
// //
resuleClick() { resuleClick() {
debugger;
switch (this.selectResult.tableType) { switch (this.selectResult.tableType) {
case "vendor": case "vendor":
this.form.vendorId = this.selectResult.vendorId; this.form.vendorId = this.selectResult.vendorId;

View File

@ -171,7 +171,7 @@
<el-form-item label="厂商编码:" prop="vendorCode"> <el-form-item label="厂商编码:" prop="vendorCode">
<el-input <el-input
v-model="form.vendorCode" v-model="form.vendorCode"
:disabled="form.vendorId !== null && form.vendorId !== undefault" :disabled="form.vendorId !== null && form.vendorId !== undefined"
placeholder="请输入厂商编码" placeholder="请输入厂商编码"
/> />
</el-form-item> </el-form-item>

View File

@ -6,18 +6,9 @@
>新增</el-button >新增</el-button
> >
</el-col> </el-col>
<!-- <el-col :span="1.5">-->
<!-- <el-button-->
<!-- icon="el-icon-s-platform"-->
<!-- size="mini"-->
<!-- type="primary"-->
<!-- @click="handleParams"-->
<!-- >物模型</el-button-->
<!-- >-->
<!-- </el-col>-->
</el-row> </el-row>
<el-table v-loading="loading" :data="functionList" height="300px"> <el-table v-loading="loading" :data="attrList" height="300px">
<el-table-column align="center" label="序号" type="index" width="75" /> <el-table-column align="center" label="序号" type="index" width="75" />
<el-table-column align="left" label="参数名称" prop="funName" /> <el-table-column align="left" label="参数名称" prop="funName" />
<el-table-column align="left" label="标识符" prop="funKey" /> <el-table-column align="left" label="标识符" prop="funKey" />
@ -43,7 +34,6 @@
</template> </template>
</el-table-column> </el-table-column>
<!-- <el-table-column label="属性" align="left" prop="funObj" /> -->
<el-table-column <el-table-column
v-if="isOption" v-if="isOption"
align="center" align="center"
@ -80,172 +70,154 @@
/> />
<!-- 添加或修改功能定义对话框 --> <!-- 添加或修改功能定义对话框 -->
<el-dialog :close-on-click-modal="false" :title="title" :visible.sync="attributeopen" class="eldialog-wrap" width="550px"> <!-- <el-dialog :close-on-click-modal="false" :title="title" :visible.sync="attributeopen" class="eldialog-wrap" width="550px">-->
<el-form <!-- <el-form-->
ref="form" <!-- ref="form"-->
:model="form" <!-- :model="form"-->
:rules="rules" <!-- :rules="rules"-->
label-width="100px" <!-- label-width="100px"-->
style="padding: 20px 20px 0px 20px" <!-- style="padding: 20px 20px 0px 20px"-->
> <!-- >-->
<el-form-item label="参数名称:" prop="funName"> <!-- <el-form-item label="参数名称:" prop="funName">-->
<el-input v-model="form.funName" placeholder="请输入参数名称" /> <!-- <el-input v-model="form.funName" placeholder="请输入参数名称" />-->
</el-form-item> <!-- </el-form-item>-->
<el-form-item label="标识符:" prop="funKey"> <!-- <el-form-item label="标识符:" prop="funKey">-->
<el-input <!-- <el-input-->
v-model="form.funKey" <!-- v-model="form.funKey"-->
:disabled="tempType === 'update'" <!-- :disabled="tempType === 'update'"-->
placeholder="请输入标识符" <!-- placeholder="请输入标识符"-->
/> <!-- />-->
</el-form-item> <!-- </el-form-item>-->
<el-form-item label="数据类型:" prop="funDataType"> <!-- <el-form-item label="数据类型:" prop="funDataType">-->
<el-select <!-- <el-select-->
v-model="form.funDataType" <!-- v-model="form.funDataType"-->
placeholder="请选择数据类型" <!-- placeholder="请选择数据类型"-->
@change="funDataTypeChange" <!-- @change="funDataTypeChange"-->
> <!-- >-->
<el-option <!-- <el-option-->
v-for="(dice, value) in funDataTypeOption" <!-- v-for="(dice, value) in funDataTypeOption"-->
:key="value" <!-- :key="value"-->
:label="dice" <!-- :label="dice"-->
:value="value" <!-- :value="value"-->
/> <!-- />-->
</el-select> <!-- </el-select>-->
</el-form-item> <!-- </el-form-item>-->
<el-form-item <!-- <el-form-item-->
v-if="form.funDataType === 'FLOAT'" <!-- v-if="form.funDataType === 'FLOAT'"-->
label="保留小数位:" <!-- label="保留小数位:"-->
prop="funValAcc" <!-- prop="funValAcc"-->
> <!-- >-->
<el-input <!-- <el-input-->
v-model="form.funValAcc" <!-- v-model="form.funValAcc"-->
onkeyup="value=value.replace(/[^\d]/g,'')" <!-- onkeyup="value=value.replace(/[^\d]/g,'')"-->
></el-input> <!-- ></el-input>-->
</el-form-item> <!-- </el-form-item>-->
<el-form-item label="传输类型:" prop="funRwType"> <!-- <el-form-item label="传输类型:" prop="funRwType">-->
<el-select v-model="form.funRwType" placeholder="请选择传输类型"> <!-- <el-select v-model="form.funRwType" placeholder="请选择传输类型">-->
<el-option <!-- <el-option-->
v-for="(dice, value) in funRwTypeOption" <!-- v-for="(dice, value) in funRwTypeOption"-->
:key="value" <!-- :key="value"-->
:label="dice" <!-- :label="dice"-->
:value="value" <!-- :value="value"-->
/> <!-- />-->
</el-select> <!-- </el-select>-->
</el-form-item> <!-- </el-form-item>-->
<el-form-item label="计量单位:" prop="unitName"> <!-- <el-form-item label="计量单位:" prop="unitName">-->
<el-input v-model="form.unitName" placeholder="请输入计量单位" /> <!-- <el-input v-model="form.unitName" placeholder="请输入计量单位" />-->
</el-form-item> <!-- </el-form-item>-->
<div class="item-title-wrap">数据校验</div> <!-- <div class="item-title-wrap">数据校验</div>-->
<div class="custom-wrap"> <!-- <div class="custom-wrap">-->
<el-button <!-- <el-button-->
v-if="form.funValidType === 'ENUM'" <!-- v-if="form.funValidType === 'ENUM'"-->
size="mini" <!-- size="mini"-->
style="position: absolute; top: 460px; left: 40px" <!-- style="position: absolute; top: 460px; left: 40px"-->
@click="addJsonObj" <!-- @click="addJsonObj"-->
>添加数值</el-button <!-- >添加数值</el-button-->
> <!-- >-->
<el-form-item <!-- <el-form-item-->
:style="form.funValidType === 'ENUM' ? 'height: 80px;' : ''" <!-- :style="form.funValidType === 'ENUM' ? 'height: 80px;' : ''"-->
label="校验方式:" <!-- label="校验方式:"-->
prop="funValidType" <!-- prop="funValidType"-->
> <!-- >-->
<el-select <!-- <el-select-->
v-model="form.funValidType" <!-- v-model="form.funValidType"-->
placeholder="请选择校验方式" <!-- placeholder="请选择校验方式"-->
@change="funValidTypeChange" <!-- @change="funValidTypeChange"-->
> <!-- >-->
<el-option <!-- <el-option-->
v-for="(dice, value) in funValidTypeOption" <!-- v-for="(dice, value) in funValidTypeOption"-->
v-show=" <!-- v-show="-->
!( <!-- !(-->
(form.funDataType === 'TEXT' && value === 'RANGE') || <!-- (form.funDataType === 'TEXT' && value === 'RANGE') ||-->
(form.funDataType !== 'TEXT' && value === 'LENGTH') || <!-- (form.funDataType !== 'TEXT' && value === 'LENGTH') ||-->
(form.funDataType === 'BOOL' && value === 'RANGE') || <!-- (form.funDataType === 'BOOL' && value === 'RANGE') ||-->
(form.funDataType === 'BOOL' && value === 'LENGTH') <!-- (form.funDataType === 'BOOL' && value === 'LENGTH')-->
) <!-- )-->
" <!-- "-->
:key="value" <!-- :key="value"-->
:label="dice" <!-- :label="dice"-->
:value="value" <!-- :value="value"-->
/> <!-- />-->
</el-select> <!-- </el-select>-->
</el-form-item> <!-- </el-form-item>-->
<div v-if="form.funValidType === 'ENUM'" class="enumTypeDiv"> <!-- <div v-if="form.funValidType === 'ENUM'" class="enumTypeDiv">-->
<div class="enum-item"> <!-- <div class="enum-item">-->
<json-editor <!-- <json-editor-->
ref="jsonEditors" <!-- ref="jsonEditors"-->
:jsonString="form.funObj" <!-- :jsonString="form.funObj"-->
@event="jsonEvent" <!-- @event="jsonEvent"-->
/> <!-- />-->
</div> <!-- </div>-->
</div> <!-- </div>-->
<el-row <!-- <el-row-->
v-if="form.funValidType === 'RANGE' || form.funValidType === 'LENGTH'" <!-- v-if="form.funValidType === 'RANGE' || form.funValidType === 'LENGTH'"-->
:gutter="10" <!-- :gutter="10"-->
class="max-min-row" <!-- class="max-min-row"-->
> <!-- >-->
<el-col :span="12"> <!-- <el-col :span="12">-->
<el-form-item label prop="funValMin"> <!-- <el-form-item label prop="funValMin">-->
<el-input v-model="form.funValMin" placeholder="最小值" /> <!-- <el-input v-model="form.funValMin" placeholder="最小值" />-->
</el-form-item> <!-- </el-form-item>-->
</el-col> <!-- </el-col>-->
<el-col :span="12"> <!-- <el-col :span="12">-->
<el-input disabled placeholder="最小值" /> <!-- <el-input disabled placeholder="最小值" />-->
</el-col> <!-- </el-col>-->
</el-row> <!-- </el-row>-->
<el-row <!-- <el-row-->
v-if="form.funValidType === 'RANGE' || form.funValidType === 'LENGTH'" <!-- v-if="form.funValidType === 'RANGE' || form.funValidType === 'LENGTH'"-->
:gutter="10" <!-- :gutter="10"-->
class="max-min-row" <!-- class="max-min-row"-->
> <!-- >-->
<el-col :span="12"> <!-- <el-col :span="12">-->
<el-form-item label prop="funValMax"> <!-- <el-form-item label prop="funValMax">-->
<el-input v-model="form.funValMax" placeholder="最大值" /> <!-- <el-input v-model="form.funValMax" placeholder="最大值" />-->
</el-form-item> <!-- </el-form-item>-->
</el-col> <!-- </el-col>-->
<el-col :span="12"> <!-- <el-col :span="12">-->
<el-input disabled placeholder="最大值" /> <!-- <el-input disabled placeholder="最大值" />-->
</el-col> <!-- </el-col>-->
</el-row> <!-- </el-row>-->
</div> <!-- </div>-->
</el-form> <!-- </el-form>-->
<div class="form-button-div"> <!-- <div class="form-button-div">-->
<el-button size="mini" type="primary" @click="submitForm">保存</el-button> <!-- <el-button size="mini" type="primary" @click="submitForm">保存</el-button>-->
<el-button size="mini" @click="cancel">取消</el-button> <!-- <el-button size="mini" @click="cancel">取消</el-button>-->
</div> <!-- </div>-->
</el-dialog>
<!-- <el-dialog-->
<!-- :visible.sync="paramsOpen"-->
<!-- class="params-eldialog"-->
<!-- title="物模型"-->
<!-- top="5vh"-->
<!-- width="800px"-->
<!-- >-->
<!-- <params-json-wrap-->
<!-- v-if="paramsOpen === true"-->
<!-- :other="{-->
<!-- action: '',-->
<!-- prodPK: sourceId,-->
<!-- cmdKey: '',-->
<!-- }"-->
<!-- :paramsList="functionList"-->
<!-- ></params-json-wrap>-->
<!-- </el-dialog>--> <!-- </el-dialog>-->
</div> </div>
</template> </template>
<script> <script>
import { mapGetters } from "vuex";
import JsonEditor from "./jsonEditor.vue"; import JsonEditor from "./jsonEditor.vue";
import ParamsJsonWrap from "./paramsJson";
const funDataTypeOption = { const funDataTypeOption = {
INT32: "整数型", INT32: "整数型",
FLOAT: "浮点型", FLOAT: "浮点型",
@ -269,7 +241,6 @@ export default {
name: "CustomParams", name: "CustomParams",
components: { components: {
JsonEditor, JsonEditor,
ParamsJsonWrap,
}, },
props: { props: {
sourceId: { sourceId: {
@ -286,23 +257,16 @@ export default {
funDataTypeOption, funDataTypeOption,
funRwTypeOption, funRwTypeOption,
funValidTypeOption, funValidTypeOption,
paramsOpen: false,
// //
loading: true, loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
// //
total: 0, total: 0,
// //
functionList: [], attrList: [],
// //
title: "", title: "",
// //
attributeopen: false, // attributeopen: false,
// //
queryParams: {}, queryParams: {},
// //
@ -319,6 +283,15 @@ export default {
tempType: "", tempType: "",
}; };
}, },
computed: {
...mapGetters(["attributeList"]),
},
watch: {
attributeList(newVal, oldVal) {
//
this.getList()
}
},
created() { created() {
this.getList(); this.getList();
}, },
@ -346,11 +319,11 @@ export default {
/** 查询功能定义列表 */ /** 查询功能定义列表 */
getList() { getList() {
this.loading = true this.loading = true
this.functionList = [] this.attrList = []
setTimeout(() => { setTimeout(() => {
this.$store.dispatch("GetAttributeList").then((res) => { this.$store.dispatch("GetAttributeList").then((res) => {
console.log('666', res) console.log('666', res)
this.functionList = res this.attrList = res
this.$forceUpdate() this.$forceUpdate()
this.loading = false this.loading = false
}); });
@ -358,81 +331,71 @@ export default {
}, },
setList(list) { setList(list) {
this.loading = true this.loading = true
this.functionList = [] this.attrList = []
setTimeout(() => { setTimeout(() => {
this.functionList = list this.attrList = list
this.$forceUpdate() this.$forceUpdate()
this.loading = false this.loading = false
}, 50) }, 50)
}, },
// // //
cancel() { // cancel() {
this.attributeopen = false; // this.attributeopen = false;
this.reset(); // this.reset();
}, // },
// //
reset() { // reset() {
this.form = { // this.form = {
sourceId: this.sourceId, // sourceId: this.sourceId,
mainId: undefined, // mainId: undefined,
funName: undefined, // funName: undefined,
funKey: undefined, // funKey: undefined,
funDataType: undefined, // funDataType: undefined,
funValAcc: undefined, // funValAcc: undefined,
funRwType: undefined, // funRwType: undefined,
funValidType: undefined, // funValidType: undefined,
funValMin: undefined, // funValMin: undefined,
funValMax: undefined, // funValMax: undefined,
funObj: {}, // funObj: {},
unitName: "", // unitName: "",
}; // };
this.resetForm("form"); // this.resetForm("form");
}, // },
handleParams() {
this.$emit('handleClick', { type: 'param', idx: 0 })
},
/** 新增按钮操作 */ /** 新增按钮操作 */
handleAdd() { handleAdd() {
this.$emit('handleClick', { type: 'add', idx: 0 }) this.$emit('handleClick', { type: 'add', idx: 0 })
}, },
handleCope(row) {
this.reset();
const funId = row.funId
this.tempType = "create";
this.title = "复制自定义参数";
this.form = row;
},
/** 修改按钮操作 */ /** 修改按钮操作 */
handleUpdate(row, idx, type) { handleUpdate(row, idx, type) {
this.$emit('handleClick', { 'type': type, 'idx': idx }) this.$emit('handleClick', { 'type': type, 'idx': idx })
}, },
/** 提交按钮 */ // /** */
submitForm: function () { // submitForm: function () {
this.$refs["form"].validate((valid) => { // this.$refs["form"].validate((valid) => {
if (valid) { // if (valid) {
// // //
} // }
}); // });
}, // },
/** 删除按钮操作 */ // /** */
handleDelete(row, idx) { // handleDelete(row, idx) {
var that = this // var that = this
this.$confirm( // this.$confirm(
// '"' + funIds + '"?', // // '"' + funIds + '"?',
"是否删除该选项", // "",
"警告", // "",
{ // {
confirmButtonText: "确定", // confirmButtonText: "",
cancelButtonText: "取消", // cancelButtonText: "",
type: "warning", // type: "warning",
} // }
) // )
.then(() => { // .then(() => {
// // //
that.$store.dispatch('DeleteAttribute', idx) // that.$store.dispatch('DeleteAttribute', idx)
that.$emit('handleClick', { 'type': 'list' }) // that.$emit('handleClick', { 'type': 'list' })
}) // })
}, // },
}, },
}; };
</script> </script>

View File

@ -136,6 +136,17 @@ export default {
} }
}; };
}, },
computed: {
eventsList() {
return this.$store.state.attribute.eventList;
}
},
watch: {
eventsList(newVal, oldVal) {
//
this.getList();
}
},
created() { created() {
this.getList(); this.getList();
}, },

View File

@ -265,7 +265,7 @@ export default {
}, },
functionList: { functionList: {
type: Array, type: Array,
default: [] default: () => []
} }
}, },
data() { data() {

View File

@ -12,7 +12,7 @@
</el-col> </el-col>
</el-row> </el-row>
<el-table v-loading="loading" :data="functionList" height="300px"> <el-table v-loading="loading" :data="functionsList" height="300px">
<el-table-column align="center" label="序号" type="index" width="75" /> <el-table-column align="center" label="序号" type="index" width="75" />
<el-table-column align="left" label="功能名称" prop="name" /> <el-table-column align="left" label="功能名称" prop="name" />
<el-table-column align="left" label="标识符" prop="id" /> <el-table-column align="left" label="标识符" prop="id" />
@ -42,7 +42,7 @@
@click="handleMoveUp(scope.$index)" @click="handleMoveUp(scope.$index)"
>上移</el-button> >上移</el-button>
<el-button <el-button
:disabled="scope.$index === functionList.length - 1" :disabled="scope.$index === functionsList.length - 1"
icon="el-icon-arrow-down" icon="el-icon-arrow-down"
size="mini" size="mini"
type="text" type="text"
@ -69,7 +69,7 @@
<function-form-model <function-form-model
ref="functionForm" ref="functionForm"
:functionList="functionList" :functionList="functionsList"
:paramIdx="functionFormObj.paramIdx" :paramIdx="functionFormObj.paramIdx"
:row="functionFormObj.functionForm" :row="functionFormObj.functionForm"
:tempType="functionFormObj.modelType" :tempType="functionFormObj.modelType"
@ -82,6 +82,7 @@
<script> <script>
import functionFormModel from "@/views/profile/attribute/functionFormModel"; import functionFormModel from "@/views/profile/attribute/functionFormModel";
import { mapGetters } from "vuex";
export default { export default {
name: "FunctionView", name: "FunctionView",
@ -104,7 +105,7 @@ export default {
// //
loading: true, loading: true,
// //
functionList: [], functionsList: [],
// //
title: "", title: "",
// //
@ -123,6 +124,15 @@ export default {
} }
}; };
}, },
computed: {
...mapGetters(["functionList"]),
},
watch: {
functionList(newVal, oldVal) {
//
this.getList()
}
},
created() { created() {
this.getList(); this.getList();
}, },
@ -139,10 +149,10 @@ export default {
/** 查询功能定义列表 */ /** 查询功能定义列表 */
getList() { getList() {
this.loading = true; this.loading = true;
this.functionList = []; this.functionsList = [];
setTimeout(() => { setTimeout(() => {
this.$store.dispatch("GetFunctionList").then(res => { this.$store.dispatch("GetFunctionList").then(res => {
this.functionList = res; this.functionsList = res;
this.$forceUpdate(); this.$forceUpdate();
this.loading = false; this.loading = false;
}); });
@ -150,9 +160,9 @@ export default {
}, },
setList(list) { setList(list) {
this.loading = true; this.loading = true;
this.functionList = []; this.functionsList = [];
setTimeout(() => { setTimeout(() => {
this.functionList = list; this.functionsList = list;
this.$forceUpdate(); this.$forceUpdate();
this.loading = false; this.loading = false;
}, 50); }, 50);
@ -207,12 +217,12 @@ export default {
if (index === 0) return; // if (index === 0) return; //
// //
const temp = this.functionList[index]; const temp = this.functionsList[index];
this.$set(this.functionList, index, this.functionList[index - 1]); this.$set(this.functionsList, index, this.functionsList[index - 1]);
this.$set(this.functionList, index - 1, temp); this.$set(this.functionsList, index - 1, temp);
// store // store
this.$store.dispatch("UpdateFunctionList", this.functionList).then(() => { this.$store.dispatch("UpdateFunctionList", this.functionsList).then(() => {
this.$message({ this.$message({
type: 'success', type: 'success',
message: '上移成功!' message: '上移成功!'
@ -229,15 +239,15 @@ export default {
* @param {Number} index 当前功能索引 * @param {Number} index 当前功能索引
*/ */
handleMoveDown(index) { handleMoveDown(index) {
if (index === this.functionList.length - 1) return; // if (index === this.functionsList.length - 1) return; //
// //
const temp = this.functionList[index]; const temp = this.functionsList[index];
this.$set(this.functionList, index, this.functionList[index + 1]); this.$set(this.functionsList, index, this.functionsList[index + 1]);
this.$set(this.functionList, index + 1, temp); this.$set(this.functionsList, index + 1, temp);
// store // store
this.$store.dispatch("UpdateFunctionList", this.functionList).then(() => { this.$store.dispatch("UpdateFunctionList", this.functionsList).then(() => {
this.$message({ this.$message({
type: 'success', type: 'success',
message: '下移成功!' message: '下移成功!'

View File

@ -184,18 +184,6 @@ export default {
this.getList(); this.getList();
}, },
methods: { methods: {
//
getCmdById(row) {
// getCmdFun({
// cmdId: row.cmdId,
// sourceId: this.sourceId
// }).then(res => {
// this.selectCmdInfo = row;
// this.paramsList = res.data;
// this.cmdParamTitle = `${row.cmdName}--`;
// this.paramsOpen = true;
// });
},
/** 重置按钮操作 */ /** 重置按钮操作 */
resetQuery() { resetQuery() {
this.resetForm("queryForm"); this.resetForm("queryForm");

View File

@ -47,8 +47,6 @@ import attributeView from "./attributeView";
import groupView from "./groupView"; import groupView from "./groupView";
import FunctionView from "./functionView"; import FunctionView from "./functionView";
import EventView from "./eventView"; import EventView from "./eventView";
// this.$store.state.tagsView.visitedViews
// this.$store.dispatch("Login", this.loginForm)
export default { export default {
components: { FunctionView, attributeView, groupView, EventView }, components: { FunctionView, attributeView, groupView, EventView },
props: { props: {
@ -138,42 +136,6 @@ export default {
break; break;
} }
}, },
functionEvent(data) {
switch (data.type) {
case "add":
// add
this.$emit("handleEvent", {
type: data.type,
title: "新增参数",
component: "functionForm",
paramIdx: null
});
break;
case "update":
this.$emit("handleEvent", {
type: data.type,
title: "修改参数",
component: "functionForm",
paramIdx: data.idx,
row: data.row
});
break;
case "list":
this.$refs.functionref.getList();
break;
case "param":
this.$emit("handleEvent", {
type: data.type,
title: "物模型",
component: "paramsJson",
paramIdx: null
});
break;
}
},
forceUpdate(component) { forceUpdate(component) {
if (component === "groupForm") { if (component === "groupForm") {
this.$refs.groupref && this.$refs.groupref.getList(); this.$refs.groupref && this.$refs.groupref.getList();
@ -185,14 +147,28 @@ export default {
}, },
forceUpdateList(component) { forceUpdateList(component) {
let arttributeList = [], let arttributeList = [],
groupList = []; groupList = [],
functionList = [],
eventList = [];
try { try {
arttributeList = JSON.parse(this.arttributeList); let json = JSON.parse(this.arttributeList);
// if (json.properties) {
arttributeList = json.properties;
groupList = JSON.parse(this.groupList); groupList = JSON.parse(this.groupList);
functionList = json.functions;
eventList = json.events;
// } else {
// arttributeList = json;
// groupList = JSON.parse(this.groupList);
// functionList = json.functions;
// eventList = json.events;
// }
} catch (error) { } catch (error) {
(arttributeList = []), (groupList = []); arttributeList = [];
console.log(error); groupList = [];
functionList = [];
eventList = [];
} }
if (component === "groupForm") { if (component === "groupForm") {
@ -216,27 +192,24 @@ export default {
try { try {
let json = JSON.parse(this.arttributeList); let json = JSON.parse(this.arttributeList);
if (json.properties) { // if (json.properties) {
arttributeList = json.properties; arttributeList = json.properties;
groupList = JSON.parse(this.groupList); groupList = JSON.parse(this.groupList);
functionList = json.functions; functionList = json.functions;
eventList = json.events; eventList = json.events;
} else { // } else {
arttributeList = json; // arttributeList = json;
groupList = JSON.parse(this.groupList); // groupList = JSON.parse(this.groupList);
functionList = json.functions; // functionList = json.functions;
eventList = json.events; // eventList = json.events;
} // }
} catch (error) { } catch (error) {
arttributeList = []; arttributeList = [];
groupList = []; groupList = [];
functionList = []; functionList = [];
eventList = []; eventList = [];
console.log(error);
} }
console.log(arttributeList, groupList);
this.$store.dispatch("InitAttributeAndGroup", { this.$store.dispatch("InitAttributeAndGroup", {
attrList: arttributeList, attrList: arttributeList,
groupList: groupList, groupList: groupList,

View File

@ -134,6 +134,25 @@ module.exports = {
from: path.resolve(__dirname, './public/robots.txt'), //防爬虫文件 from: path.resolve(__dirname, './public/robots.txt'), //防爬虫文件
to: './', //到根目录下 to: './', //到根目录下
} }
if (process.env.NODE_ENV === 'production' || process.env.NODE_ENV === 'drprod' || process.env.NODE_ENV === 'drgyprod' || process.env.NODE_ENV === 'ccprod') {
config.optimization.minimizer('terser').tap(args => {
args[0].terserOptions = {
compress: {
// 注释console.*
drop_console: true,
// remove debugger
drop_debugger: true,
// 移除特定的 console 方法
pure_funcs: ['console.log', 'console.info', 'console.debug']
},
format: {
comments: false
}
};
args[0].extractComments = false;
return args;
});
}
} }
) )
} }