From d7bb04a5461b7eb8beb422108a21696b21126e71 Mon Sep 17 00:00:00 2001
From: zouyu <2723363702@qq.com>
Date: 星期五, 10 十一月 2023 13:26:39 +0800
Subject: [PATCH] 	modified:   src/views/basic/template/index.vue 	modified:   src/views/common/param-mergeTemplate.vue 	modified:   src/views/technology/routing/routing-form.vue

---
 src/views/common/param-mergeTemplate.vue |   97 +++++++++++++++++++++++++-----------------------
 1 files changed, 51 insertions(+), 46 deletions(-)

diff --git a/src/views/common/param-mergeTemplate.vue b/src/views/common/param-mergeTemplate.vue
index 63c4c4c..209593c 100644
--- a/src/views/common/param-mergeTemplate.vue
+++ b/src/views/common/param-mergeTemplate.vue
@@ -3,58 +3,59 @@
         <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">
+                <avue-text-ellipsis use-tooltip :text="scope.row.code" :height="textEllipsisHeight" :width="textEllipsisWidth">
                     <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"/>
+                <el-input @blur="checkType(scope.row)" :disabled="routingTemplateId!=null || !scope.row.isUpdate" :placeholder="'璇疯緭鍏�'+scope.row.paramType" v-model="scope.row.paramValue"/>
+            </template>
+            <template slot="menu" slot-scope="scope">
+                <el-button type="text" v-if="scope.row.isUpdate && isModel" size="mini" 
+                @click="handleParamSave(scope.$index, scope.row)">淇濆瓨</el-button>
+                <el-button type="text" v-if="!scope.row.isUpdate && isModel" size="mini"
+                @click="handleParamEdit(scope.$index, scope.row)">缂栬緫</el-button>
+                <el-button type="text" size="mini" v-if="isModel"
+                @click.stop="handleParamInsert(scope.row)">鎻掑叆</el-button>
+                <el-button type='text' :disabled="routingTemplateId!=null"
+                @click.stop="handleParamDelete(scope.row, scope.index)">鍒犻櫎</el-button>
             </template>
         </avue-crud>
-        <!-- <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: ["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("璇疯緭鍏ユ暟鍊兼牸寮忕殑鏁版嵁锛�")
-                    }
-                }
-            },
-            mergeObj: {},
-            mergeArr: ['code','paramItem', 'paramItemTwo',],
-            tableData: [],
-            // routingTemplateId: null
-        }
-    },
     props: {
+        //鏄惁涓哄弬鏁版ā鏉�
+        isModel:{
+            type: Boolean,
+            default:()=>{
+                return false
+            }
+        },
+        textEllipsisWidth:{
+            type: Number,
+            default:()=>{
+                return 100
+            }
+        },
+        textEllipsisHeight:{
+            type: Number,
+            default:()=>{
+                return 40
+            }
+        },
         option: {
             type: Object,
             default: () => {
                 return {
                     height: 600,
-                    loadingText: "鍔犺浇涓�...",
                     columnBtn: false,
                     index: true,
                     indexLabel: '搴忓彿',
-                    menu: false,
+                    menu: true,
+                    menuWidth: 100,
                     menuAlign: 'center',
                     editBtn: false,
                     delBtn: false,
@@ -148,36 +149,40 @@
         routingTemplateId: {
             type: String,
             default: () => {
-                return ''
+                return null
             }
-        }
+        },
+        handleParamDelete:{
+            type: Function
+        },
+        handleParamEdit:{
+            type: Function
+        },
+        handleParamInsert:{
+            type: Function
+        },
+        handleParamSave:{
+            type: Function
+        },
     },
     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()
+                this.tableData=JSON.parse(JSON.stringify(this.tableTreeData))
+                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()
     },
-    beforeDestroy(){
-        console.log("閿�姣佸墠");
-    },
     data(){
         return {
-            
+            tableData: [],
         }
     },
     methods:{

--
Gitblit v1.9.3