From 131bc7a32291a13e5e9d379c4978e02795e6b3dc Mon Sep 17 00:00:00 2001
From: zouyu <2723363702@qq.com>
Date: 星期五, 10 十一月 2023 09:56:11 +0800
Subject: [PATCH] 参数
---
vue.config.js | 2
src/views/technology/routing/routing-form.vue | 23 +++
src/views/common/param-mergeTemplate.vue | 346 +++++++++++++++++++++++++++----------------------
3 files changed, 213 insertions(+), 158 deletions(-)
diff --git a/src/views/common/param-mergeTemplate.vue b/src/views/common/param-mergeTemplate.vue
index 74c50c2..63c4c4c 100644
--- a/src/views/common/param-mergeTemplate.vue
+++ b/src/views/common/param-mergeTemplate.vue
@@ -1,138 +1,174 @@
<template>
- <div>
- <avue-crud
- ref="crud"
- class="l-mes"
- rowKey="oneId"
- :data="tableData"
- :option="option"
- :span-method="spanMethod"
- :page="page"
- :table-loading="loading"
- >
- <template slot="code" slot-scope="scope">
- <avue-text-ellipsis use-tooltip :text="scope.row.code" :height="40" :width="100">
- <small slot="more">...</small>
- </avue-text-ellipsis>
- </template>
+ <div>
+ <avue-crud ref="crud" class="l-mes" rowKey="oneId" :data="tableData" :option="option" :span-method="spanMethod"
+ :page="page" :table-loading="loading">
+ <template slot="code" slot-scope="scope">
+ <avue-text-ellipsis use-tooltip :text="scope.row.code" :height="40" :width="100">
+ <small slot="more">...</small>
+ </avue-text-ellipsis>
+ </template>
<template slot="paramValue" slot-scope="scope">
<el-input @blur="checkType(scope.row)" :disabled="routingTemplateId!=null" :placeholder="'璇疯緭鍏�'+scope.row.paramType" v-model="scope.row.paramValue"/>
</template>
</avue-crud>
- </div>
+ <!-- <el-table :data="tableData" ref="commonTree" :span-method="objectSpanMethod" border row-key="id" style="width: 100%">
+ <el-table-column prop="code" label="缂栫爜"></el-table-column>
+ <el-table-column prop="paramItem" label="涓�绾�"></el-table-column>
+ <el-table-column prop="paramItemTwo" label="浜岀骇"></el-table-column>
+ <el-table-column prop="paramItemThree" label="涓夌骇"></el-table-column>
+ <el-table-column prop="paramType" label="绫诲瀷"></el-table-column>
+ <el-table-column prop="paramValue" label="鍊�"></el-table-column>
+ <el-table-column prop="unit" label="鍗曚綅"></el-table-column>
+ </el-table> -->
+ </div>
</template>
<script>
export default {
- props:{
- option:{
- type: Object,
- default: ()=>{
- return {
- height: 600,
- loadingText: "鍔犺浇涓�...",
- columnBtn: false,
- index: true,
- indexLabel: '搴忓彿',
- menu: false,
- menuAlign: 'center',
- editBtn: false,
- delBtn: false,
- addBtn: false,
- border: true,
- size: 'small',
- refreshBtn: false,
- align: 'center',
- column: [
- {
- label: '鍙傛暟缂栧彿',
- prop: 'code',
- slot: true
+ // props: ["tableTreeData"],
+ data() {
+ return {
+ checkType(row) {
+ if (row.paramType == '鏁板�兼牸寮�') {
+ let val = row.paramValue
+ const reg = /^[0-9]*$/
+ if (!reg.test(val)) {
+ row.paramValue = ''
+ this.$message.warning("璇疯緭鍏ユ暟鍊兼牸寮忕殑鏁版嵁锛�")
+ }
+ }
},
- {
- label: '鍙傛暟椤�',
- prop: 'paramItem',
- },
- {
- label: '浜岀骇鍙傛暟',
- prop: 'paramItemTwo',
- },
- {
- label: '涓夌骇鍙傛暟',
- prop: 'paramItemThree',
- },
- {
- label: '鍙傛暟绫诲瀷',
- prop: 'paramType',
- formslot: true,
- rules: [{
- required: true,
- message: "璇烽�夋嫨鍙傛暟绫诲瀷",
- trigger: "change"
- }]
- },
- {
- label: '鍊�',
- prop: 'paramValue',
- slot: true,
- formslot: true,
- labelslot: true
- }, {
- label: '鍗曚綅',
- prop: 'unit',
- rules: [{
- required: true,
- message: "鍗曚綅涓嶈兘涓虹┖",
- trigger: "blur"
- }]
- },]
- }
- }
- },
- tableData:{
- type: Array,
- default: () => {
- return []
- },
- required: true
- },
- loading:{
- type: Boolean,
- default: false
- },
- page:{
- type: Object,
- default:()=>{
- return {
- total: 10,
- currentPage: 1,
- pageSize: 10
- }
- }
- },
- spanArr:{
- type: Array,
- default: ()=>{
- return [{
- prop: 'code',
- span: []
- }, {
- prop: 'paramItem',
- span: []
- }, {
- prop: 'paramItemTwo',
- span: []
- }]
- }
- },
- routingTemplateId:{
- type: String,
- default: ()=>{
- return ''
- }
- }
+ mergeObj: {},
+ mergeArr: ['code','paramItem', 'paramItemTwo',],
+ tableData: [],
+ // routingTemplateId: null
+ }
},
- created(){
+ props: {
+ option: {
+ type: Object,
+ default: () => {
+ return {
+ height: 600,
+ loadingText: "鍔犺浇涓�...",
+ columnBtn: false,
+ index: true,
+ indexLabel: '搴忓彿',
+ menu: false,
+ menuAlign: 'center',
+ editBtn: false,
+ delBtn: false,
+ addBtn: false,
+ border: true,
+ size: 'small',
+ refreshBtn: false,
+ align: 'center',
+ column: [
+ {
+ label: '鍙傛暟缂栧彿',
+ prop: 'code',
+ slot: true
+ },
+ {
+ label: '鍙傛暟椤�',
+ prop: 'paramItem',
+ },
+ {
+ label: '浜岀骇鍙傛暟',
+ prop: 'paramItemTwo',
+ },
+ {
+ label: '涓夌骇鍙傛暟',
+ prop: 'paramItemThree',
+ },
+ {
+ label: '鍙傛暟绫诲瀷',
+ prop: 'paramType',
+ formslot: true,
+ rules: [{
+ required: true,
+ message: "璇烽�夋嫨鍙傛暟绫诲瀷",
+ trigger: "change"
+ }]
+ },
+ {
+ label: '鍊�',
+ prop: 'paramValue',
+ slot: true,
+ formslot: true,
+ labelslot: true
+ }, {
+ label: '鍗曚綅',
+ prop: 'unit',
+ rules: [{
+ required: true,
+ message: "鍗曚綅涓嶈兘涓虹┖",
+ trigger: "blur"
+ }]
+ },]
+ }
+ }
+ },
+ tableTreeData: {
+ type: Array,
+ default: () => {
+ return []
+ },
+ required: true
+ },
+ loading: {
+ type: Boolean,
+ default: false
+ },
+ page: {
+ type: Object,
+ default: () => {
+ return {
+ total: 10,
+ currentPage: 1,
+ pageSize: 10
+ }
+ }
+ },
+ spanArr: {
+ type: Array,
+ default: () => {
+ return [{
+ prop: 'code',
+ span: []
+ }, {
+ prop: 'paramItem',
+ span: []
+ }, {
+ prop: 'paramItemTwo',
+ span: []
+ }]
+ }
+ },
+ routingTemplateId: {
+ type: String,
+ default: () => {
+ return ''
+ }
+ }
+ },
+ watch:{
+ tableTreeData:{
+ handler(old,newval){
+ console.log(this.tableTreeData);
+ this.tableData=JSON.parse(JSON.stringify(this.tableTreeData))
+ // this.getSpanArr(this.tableData);
+ this.rowSort()
+ this.rowCalc()
+ },
+ deep: true
+ }
+ },
+ created() {
+ // this.$nextTick(() => {
+ // this.$refs.crud.doLayout()
+ // })
+ this.tableData=JSON.parse(JSON.stringify(this.tableTreeData))
this.rowSort()
this.rowCalc()
},
@@ -158,7 +194,7 @@
//鍔ㄦ�佸悎骞舵柟娉�
rowCalc() {
this.spanArr.forEach((ele, index) => {
- let parent
+ let parent = null
if (index !== 0) parent = this.spanArr[ele.parent || index - 1].span
ele.span = this.rowSpan(ele.prop, parent)
})
@@ -168,17 +204,17 @@
this.spanArr.forEach((ele, index) => {
let key = ele.prop
this.tableData = this.tableData.sort((a, b) => {
- let flag = true;
- for (let i = 0; i < index; i++) {
- let prop = this.spanArr[i].prop
- flag = flag && a[prop] == b[prop]
- }
- if (flag) {
- if (a[key] < b[key]) { return 1; }
- else if (a[key] > b[key]) { return -1; }
+ let flag = true;
+ for (let i = 0; i < index; i++) {
+ let prop = this.spanArr[i].prop
+ flag = flag && a[prop] == b[prop]
+ }
+ if (flag) {
+ if (a[key] < b[key]) { return 1; }
+ else if (a[key] > b[key]) { return -1; }
+ return 0;
+ }
return 0;
- }
- return 0;
})
})
},
@@ -187,21 +223,21 @@
let position = 0;
this.tableData.forEach((item, index) => {
if (index === 0) {
- list.push(1)
- let position = 0;
- } else {
- if (this.tableData[index][key] === this.tableData[index - 1][key]) {
- if (parent && parent[index] !== 0) {
list.push(1)
- position = index
+ let position = 0;
+ } else {
+ if (this.tableData[index][key] === this.tableData[index - 1][key]) {
+ if (parent && parent[index] !== 0) {
+ list.push(1)
+ position = index
+ } else {
+ list[position] += 1;
+ list.push(0)
+ }
} else {
- list[position] += 1;
- list.push(0)
+ list.push(1)
+ position = index
}
- } else {
- list.push(1)
- position = index
- }
}
})
return list
@@ -210,12 +246,12 @@
for (let i = 0; i < this.spanArr.length; i++) {
const ele = this.spanArr[i]
if (column.property == ele.prop) {
- const _row = ele.span[rowIndex];
- const _col = _row > 0 ? 1 : 0;
- return {
- rowspan: _row,
- colspan: _col
- }
+ const _row = ele.span[rowIndex];
+ const _col = _row > 0 ? 1 : 0;
+ return {
+ rowspan: _row,
+ colspan: _col
+ }
}
}
}
@@ -224,7 +260,7 @@
</script>
<style>
- .avue-crud__menu{
+.avue-crud__menu {
display: none;
- }
+}
</style>
\ No newline at end of file
diff --git a/src/views/technology/routing/routing-form.vue b/src/views/technology/routing/routing-form.vue
index 723de44..e4d0294 100644
--- a/src/views/technology/routing/routing-form.vue
+++ b/src/views/technology/routing/routing-form.vue
@@ -564,16 +564,26 @@
</el-button>
</div>
</div>
+ <div>
+ <!-- <paramMergeTemplate :key="isShowTree" :tableTreeData="paramData" :routingTemplateId="routingTemplateId"/> -->
+ <component
+ :is="paramMergeTemplate"
+ :key="isShowTree"
+ :tableTreeData="paramData"
+ :routingTemplateId="routingTemplateId"
+ ></component>
+ </div>
<!-- <paramMergeTemplate
:tableData="paramData"
:page="{}"
>
</paramMergeTemplate> -->
- <component
+ <!-- <component
:is="paramMergeTemplate"
+ :key="isShowTree"
:tableData="paramData"
:routingTemplateId="routingTemplateId"
- ></component>
+ ></component> -->
<!-- <el-table :data="paramData" class="l-mes" height="600">
<el-table-column
label="鍙傛暟椤�"
@@ -700,6 +710,7 @@
return {
paramMergeTemplate: '',
itemKey: '',
+ isShowTree: false,
typeOptions: [],
paramTemplateSelArr: [],
paramTemplateSelCol: 'operationTemplateNo',
@@ -1073,6 +1084,13 @@
},
// 鍙傛暟闆嗘ā鏉跨偣鍑讳簨浠�
templateRowClick(row) {
+ if(this.isShowTree){
+ this.isShowTree=false
+ }else{
+ this.isShowTree=true
+ }
+ console.log(this.isShowTree);
+ this.paramData=[]
this.getRoutingTemplateParam(row.id)
},
// 鏍规嵁宸ヨ壓銆佸伐搴廼d銆佹ā鏉縤d鍘昏幏鍙栨ā鏉夸笅鐨勫弬鏁�
@@ -1085,6 +1103,7 @@
})
).then((response) => {
if (response.data.data.length > 0) {
+ this.paramData = []
this.paramData = response.data.data
this.paramMergeTemplate = 'paramMergeTemplate'
} else {
diff --git a/vue.config.js b/vue.config.js
index 2921129..e436b9e 100644
--- a/vue.config.js
+++ b/vue.config.js
@@ -3,7 +3,7 @@
* https://cli.vuejs.org/zh/config/
*/
//const url = 'http://ztt-gateway:9999'
-const url = 'http://192.168.0.15:9999'
+const url = 'http://ztt-gateway:9999'
const localUrl = 'http://localhost:8089'
//const localUrl = 'http://10.88.15.95:8089'
const CompressionWebpackPlugin = require('compression-webpack-plugin')
--
Gitblit v1.9.3