From 36395626eb1ae2e6400cb45ab652f675209c6640 Mon Sep 17 00:00:00 2001
From: Fixiaobai <fixiaobai@163.com>
Date: 星期五, 03 十一月 2023 10:28:47 +0800
Subject: [PATCH] modified: src/views/basic/param/index.vue modified: src/views/basic/param/param-form.vue
---
src/views/basic/param/index.vue | 135 ++++++++++++++++++++++++++++++--------------
src/views/basic/param/param-form.vue | 4
node_modules.zip | 0
3 files changed, 93 insertions(+), 46 deletions(-)
diff --git a/node_modules.zip b/node_modules.zip
new file mode 100644
index 0000000..81c7d52
--- /dev/null
+++ b/node_modules.zip
Binary files differ
diff --git a/src/views/basic/param/index.vue b/src/views/basic/param/index.vue
index 217e2ef..c9bffc1 100644
--- a/src/views/basic/param/index.vue
+++ b/src/views/basic/param/index.vue
@@ -35,7 +35,7 @@
</el-row>
<el-row style="padding-top: 20px;">
<!-- 琛ㄦ牸鏁版嵁鍖�-->
- <el-table height="480" style="width: 100%;" :data="table.data" row-key="id"
+ <el-table height="480" style="width: 100%;" :data="table.data" row-key="id"
:tree-props="{ children: 'children', hasChildren: 'hasChildren' }">
<el-table-column type="index" label="搴忓彿" width="50">
</el-table-column>
@@ -43,26 +43,41 @@
<el-table-column prop="parameterItem" label="鍙傛暟椤�"></el-table-column>
<el-table-column prop="type" label="鍙傛暟绫诲瀷">
<template slot-scope="scope">
- <el-col v-show="scope.row.bianJi===false">{{ scope.row.type }}</el-col>
+ <el-col v-show="scope.row.bianJi === false">{{ scope.row.type }}</el-col>
<el-col v-show="scope.row.bianJi">
- 111
- <!-- <el-select v-model="scope.row.type" filterable placeholder="璇烽�夋嫨鍙傛暟绫诲瀷" style="width:100%"
- @change="changeType">
- <el-option v-for="(item, index) in this.typeOptions" :label="item.label" :value="item.value"
- :key="item.value">
+ <el-select @change="changeType(scope.row)" v-model="scope.row.type" placeholder="璇烽�夋嫨">
+ <el-option v-for="item in optionType" :key="item.id" :label="item.label" :value="item.label">
</el-option>
- </el-select> -->
+ </el-select>
</el-col>
</template>
</el-table-column>
- <el-table-column prop="parameterFormat" label="鍙傛暟鏍煎紡"></el-table-column>
+ <el-table-column prop="parameterFormat" label="鍙傛暟鏍煎紡">
+ <template slot-scope="scope">
+ <el-col v-if="scope.row.bianJi === false">
+ {{ scope.row.parameterFormat }}
+ </el-col>
+ <el-col style="margin-bottom: 0 !important;" v-if="scope.row.bianJi">
+ <el-col v-if="scope.row.isSelect === false">
+ <el-input v-model="scope.row.parameterFormat" placeholder="鍙傛暟鏍煎紡"></el-input>
+ </el-col>
+ <el-col v-if="scope.row.isSelect">
+ <el-select v-model="scope.row.dict" filterable placeholder="璇烽�夋嫨鏁版嵁瀛楀吀" style="width:100%">
+ <el-option v-for="(item, index) in dictOptions" :label="item.description" :value="item.type"
+ :key="index">
+ </el-option>
+ </el-select>
+ </el-col>
+ </el-col>
+ </template>
+ </el-table-column>
<el-table-column prop="unit" label="鍗曚綅"></el-table-column>
<el-table-column prop="code" label="鎿嶄綔">
<template slot-scope="scope">
<el-row style=" display: flex;width: 100%;">
<el-col><el-button type="text">鍒犻櫎</el-button></el-col>
<el-col v-if="scope.row.isBianji">
- <el-button @click="bianji(scope.row)" type="text">{{ scope.row.bianJiBtn }}</el-button>
+ <el-button @click="bianji(scope.row)" type="text">{{ scope.row.bianJiBtn }}</el-button>
</el-col>
</el-row>
</template>
@@ -89,6 +104,8 @@
export default {
data() {
return {
+ dictOptions: [],
+ optionType: [],
isExpandAll: false,
// 閲嶆柊娓叉煋琛ㄦ牸鐘舵��
refreshTable: true,
@@ -263,16 +280,40 @@
...mapGetters(['permissions'])
},
created() {
+ this.getDictOptions()
this.getParamType()
this.getData()
},
methods: {
- changeType(){},
- bianji(row){
- // this.$set(row.bianJi,false,true)
- row.bianJi=true
- row.bianJiBtn='淇濆瓨'
- console.log(row)
+ // 鑾峰彇鎵�鏈夊瓧鍏�
+ getDictOptions() {
+ fetchList(
+ Object.assign({
+ current: 1,
+ size: 200
+ })
+ ).then((response) => {
+ if (response.data.code === 0) {
+ this.dictOptions = response.data.data.records
+ }
+ })
+ },
+ changeType(row) {
+ if(row.type==='涓嬫媺閫夐」'){
+ row.isSelect=true
+ }else{
+ row.isSelect=false
+ }
+ },
+ bianji(row) {
+ if (!row.bianJi) {
+ row.bianJi = true
+ row.bianJiBtn = '淇濆瓨'
+ } else {
+ row.bianJi = false
+ row.isSelect=false
+ row.bianJiBtn = '缂栬緫'
+ }
},
isExpandAllClick() {
// console.log(1111);
@@ -297,34 +338,39 @@
fetchList(param).then((res) => {
console.log(res.data);
this.table.total = res.data.data.total
- this.table.data = res.data.data.records
- let datas=JSON.parse(JSON.stringify(this.table.data))
- datas.forEach(l => {
- l.bianJi = false
- if (l.children.length < 1) {
- l.isBianji = true
- l.bianJiBtn='缂栬緫'
- }
- if (l.children.length > 0) {
- l.isBianji = false
- l.children.forEach(c => {
- c.bianji = false
- if (c.children.length < 1) {
- c.isBianji = true
- c.bianJiBtn='缂栬緫'
- } else {
- l.isBianji = false
- c.children.forEach(cc => {
- cc.bianJi = false
- cc.isBianji = true
- c.bianJiBtn='缂栬緫'
- })
- }
- })
- }
- })
- this.table.data=datas
- console.log(this.table.data);
+ // this.table.data = res.data.data.records
+ this.$nextTick(() => {
+ let datas = JSON.parse(JSON.stringify(res.data.data.records))
+ datas.forEach(l => {
+ l.bianJi = false
+ l.isSelect=false
+ if (l.children.length < 1) {
+ l.isBianji = true
+ l.bianJiBtn = '缂栬緫'
+ } else {
+ l.isBianji = false
+ l.children.forEach(c => {
+ c.isSelect=false
+ c.bianji = false
+ if (c.children.length < 1) {
+ c.isBianji = true
+ c.bianJiBtn = '缂栬緫'
+ } else {
+ l.isBianji = false
+ c.children.forEach(cc => {
+ cc.isSelect=false
+ cc.bianJi = false
+ cc.isBianji = true
+ cc.bianJiBtn = '缂栬緫'
+ })
+ }
+ })
+ }
+ })
+ console.log("test==>", datas);
+ this.table.data = datas
+ console.log(this.table.data);
+ });
})
},
// 鏂板 / 淇敼
@@ -339,6 +385,7 @@
remote('technology_param').then((response) => {
if (response.data.code === 0) {
this.typeOptions = response.data.data
+ this.optionType = response.data.data
}
})
},
diff --git a/src/views/basic/param/param-form.vue b/src/views/basic/param/param-form.vue
index e7a113e..9245101 100644
--- a/src/views/basic/param/param-form.vue
+++ b/src/views/basic/param/param-form.vue
@@ -19,7 +19,7 @@
</el-option>
</el-select>
</el-form-item>
- <!-- <el-form-item label="鍙傛暟绫诲瀷" prop="type">
+ <el-form-item label="鍙傛暟绫诲瀷" prop="type">
<el-select
v-model="dataForm.type"
filterable
@@ -64,7 +64,7 @@
</el-form-item>
<el-form-item label="鍗曚綅" prop="unit">
<el-input v-model="dataForm.unit" placeholder="鍗曚綅"></el-input>
- </el-form-item> -->
+ </el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="visible = false">鍙栨秷</el-button>
--
Gitblit v1.9.3