Browse Source

Gen上下移动

suochencheng 7 years ago
parent
commit
ff440d3664

File diff suppressed because it is too large
+ 250 - 250
src/main/vue/package-lock.json


+ 42 - 3
src/main/vue/src/pages/GenCode.vue

@@ -106,8 +106,10 @@
                                     <el-checkbox v-model="row.autoIncrease"></el-checkbox>
                                 </template>
                             </el-table-column>
-                            <el-table-column width="60" align="center">
-                                <template slot-scope="{ row, column, $index }" v-if="$index>1">
+                            <el-table-column width="130" align="center">
+                                <template slot-scope="{ row, column, $index }" v-if="$index>1||formData.dataBaseType!='Mysql'">
+                                    <el-button @click="moveUp($index)" size="small" type="text">上移</el-button>
+                                    <el-button @click="moveDown($index)" size="small" type="text">下移</el-button>
                                     <el-button @click="removeField($index)" size="small" type="text">删除</el-button>
                                 </template>
                             </el-table-column>
@@ -502,7 +504,7 @@ export default {
             });
         },
         removeField(i) {
-            if (this.fields.length > 1) {
+            if (this.fields.length > 0) {
                 this.fields.splice(i, 1);
             }
         },
@@ -578,6 +580,43 @@ export default {
             }
         },
 
+        moveUp(i) {
+            if (i > 0) {
+
+                var tempFields = [...this.fields];
+                var tempField = tempFields[i - 1];
+
+
+                tempFields[i - 1] = tempFields[i];
+                tempFields[i] = tempField;
+
+                this.fields = tempFields;
+
+
+
+            }
+        },
+
+        moveDown(i) {
+            if (this.fields.length - 1 > i) {
+
+                var tempFields = [...this.fields];
+
+                var tempField = tempFields[i + 1];
+
+
+                tempFields[i + 1] = tempFields[i];
+                tempFields[i] = tempField;
+
+                this.fields = tempFields;
+
+
+
+            }
+
+        },
+
+
     }
 }
 </script>

+ 154 - 136
src/main/vue/src/pages/TestAaa.vue

@@ -1,42 +1,60 @@
 <template>
     <div>
-        <el-form :model="formData" :rules="rules" ref="form" label-width="80px" label-position="right" size="small" style="max-width: 500px;">
-            <el-form-item prop="testName" label="名称">
+        <el-form :model="formData" :rules="rules" ref="form" label-width="120px" label-position="right" size="small"
+                 style="max-width: 500px;">
+                                                                                                                                                                                                                                                                 <el-form-item prop="imageUrl" label="图片">
+                 <single-upload v-model="formData.imageUrl" :disabled="'imageUrl'==subColumn"></single-upload>
+             </el-form-item>
+                                                                                                                                                                                                                                                                                                        <el-form-item prop="testName" label="名称">
                 <template>
-                    <el-select v-model="formData.testName" clearable placeholder="请选择" :disabled="'testName'==subColumn">
-                        <el-option v-for="item in testNameOptions" :key="item.value" :label="item.label" :value="item.value">
+                    <el-select v-model="formData.testName" clearable  placeholder="请选择" :disabled="'testName'==subColumn">
+                        <el-option
+                                v-for="item in testNameOptions"
+                                :key="item.value"
+                                :label="item.label"
+                                :value="item.value">
                         </el-option>
                     </el-select>
                 </template>
             </el-form-item>
-            <el-form-item prop="remark" label="嗯嗯">
+                                                                                                                                                                                                                                                                                                                                                <el-form-item prop="remark" label="嗯嗯">
                 <template>
-                    <el-select v-model="formData.remark" clearable placeholder="请选择" :disabled="'remark'==subColumn">
-                        <el-option v-for="item in remarkOptions" :key="item.value" :label="item.label" :value="item.value">
+                    <el-select v-model="formData.remark" clearable  placeholder="请选择" :disabled="'remark'==subColumn">
+                        <el-option
+                                v-for="item in remarkOptions"
+                                :key="item.value"
+                                :label="item.label"
+                                :value="item.value">
                         </el-option>
                     </el-select>
                 </template>
             </el-form-item>
-            <el-form-item prop="imageUrl" label="图片">
-                <single-upload v-model="formData.imageUrl" :disabled="'imageUrl'==subColumn"></single-upload>
+                                                                                                                                                                                                                                                                                                                                                                    <el-form-item prop="multiSelect" label="多选">
+                <template>
+                    <el-select v-model="formData.multiSelect" multiple clearable placeholder="请选择" :disabled="'multiSelect'==subColumn">
+                        <el-option
+                                v-for="item in multiSelectOptions"
+                                :key="item.value"
+                                :label="item.label"
+                                :value="item.value">
+                        </el-option>
+                    </el-select>
+                </template>
             </el-form-item>
-            <el-form-item prop="testTime" label="时间">
+                                                                                                                                                                                                                                                                                    <el-form-item prop="testTime" label="时间">
                 <template>
                     <div class="block">
-                        <el-date-picker v-model="formData.testTime" type="date" value-format="timestamp" placeholder="选择日期" :disabled="'testTime'==subColumn">
+                        <el-date-picker
+                                v-model="formData.testTime"
+                                type="date"
+                                value-format="timestamp"
+                                placeholder="选择日期"
+                                :disabled="'testTime'==subColumn">
                         </el-date-picker>
                     </div>
                 </template>
             </el-form-item>
-            <el-form-item prop="multiSelect" label="多选">
-                <template>
-                    <el-select v-model="formData.multiSelect" multiple clearable placeholder="请选择" :disabled="'multiSelect'==subColumn">
-                        <el-option v-for="item in multiSelectOptions" :key="item.value" :label="item.label" :value="item.value">
-                        </el-option>
-                    </el-select>
-                </template>
-            </el-form-item>
-            <el-form-item>
+                                                                                                                                                                                                                                                <el-form-item>
                 <el-button @click="onSave" :loading="$store.state.fetchingData" type="primary">保存</el-button>
                 <el-button @click="onDelete" v-if="formData.id" type="danger">删除</el-button>
                 <el-button @click="$router.go(-1)">取消</el-button>
@@ -45,144 +63,144 @@
     </div>
 </template>
 <script>
-import formValidator from '../formValidator'
-
-export default {
-    created() {
-        if (this.$route.query.column) {
-            this.subColumn = this.$route.query.column.split(',')[1];
-            this.subValue = this.$route.query.column.split(',')[0];
-        }
-
-        if (this.$route.query.id) {
-            this.$http.get({
-                url: '/testAaa/getOne',
-                data: {
-                    id: this.$route.query.id
-                }
-            }).then(res => {
-                if (res.success) {
+    import formValidator from '../formValidator'
 
+    export default {
+        created() {
+            if (this.$route.query.column) {
+                this.subColumn = this.$route.query.column.split(',')[1];
+                this.subValue = this.$route.query.column.split(',')[0];
+            }
 
-                    if (res.data.multiSelect) {
-                        res.data.multiSelect = res.data.multiSelect.split(',');
-                    } else {
-                        res.data.multiSelect = [];
+            if (this.$route.query.id) {
+                this.$http.get({
+                    url: '/testAaa/getOne',
+                    data: {
+                        id: this.$route.query.id
                     }
+                }).then(res => {
+                    if (res.success) {
 
+                                                                                                                                                                                                                                                                                                                        
+                                if(res.data.multiSelect){
+                                    res.data.multiSelect = res.data.multiSelect.split(',');
+                                }else{
+                                    res.data.multiSelect = [];
+                                }
 
-                    this.formData = res.data;
+                                                                                                        
+                        this.formData = res.data;
 
                     if (this.$route.query.column) {
                         this.formData[this.subColumn] = this.subValue;
                     }
-                }
-            })
-        } else {
-            if (this.$route.query.column) {
-                this.formData[this.subColumn] = this.subValue;
-            }
-        }
-
-
-
-
-        this.$http.get({
-            url: '/testBbb/all'
-        }).then(res => {
-            if (res.success) {
-
-                if (res.data.length > 0) {
-                    res.data.forEach(item => {
-                        this.remarkOptions.push({ label: item.nameAaa, value: item.nameAaa });
-                    })
+                    }
+                })
+            }else {
+                if (this.$route.query.column) {
+                    this.formData[this.subColumn] = this.subValue;
                 }
             }
-        });
-
-
 
-        this.$http.get({
-            url: '/testBbb/all'
-        }).then(res => {
-            if (res.success) {
-
-                if (res.data.length > 0) {
-                    res.data.forEach(item => {
-                        this.multiSelectOptions.push({ label: item.nameCcc, value: item.nameCcc });
-                    })
-                }
-            }
-        });
-    },
-    data() {
-        return {
-            saving: false,
-            formData: {},
-            rules: {
-                testName:
+                                                                                                                                                                                                    
+
+
+                        this.$http.get({
+                        url:'/testBbb/all'
+                        }).then(res => {
+                        if (res.success) {
+
+                        if (res.data.length > 0) {
+                        res.data.forEach(item => {
+                        this.remarkOptions.push({label: item.nameAaa, value:item.nameAaa});
+                        })
+                        }
+                        }
+                        });
+                                                                                    
+
+
+                        this.$http.get({
+                        url:'/testBbb/all'
+                        }).then(res => {
+                        if (res.success) {
+
+                        if (res.data.length > 0) {
+                        res.data.forEach(item => {
+                        this.multiSelectOptions.push({label: item.nameCcc, value:item.nameCcc});
+                        })
+                        }
+                        }
+                        });
+                                                                                    },
+        data() {
+            return {
+                saving: false,
+                formData: {},
+                rules: {
+                                                                                                                                    testName:
                     [
-                        { required: true, message: '请输入 名称', trigger: 'blur' },
-                    ],
-                remark:
+                                                {required: true, message: '请输入 名称', trigger: 'blur'},
+                                                                    ],
+                                                                remark:
                     [
-                        { required: true, message: '请输入 嗯嗯', trigger: 'blur' },
-                    ],
-                multiSelect:
+                                                {required: true, message: '请输入 嗯嗯', trigger: 'blur'},
+                                                                    ],
+                                                                multiSelect:
                     [
-                        { required: true, message: '请输入 多选', trigger: 'blur' },
-                    ],
-            },
-            testNameOptions: [{ label: '??', value: '??' }, { label: '??', value: '??' }, { label: '??', value: '??' }],
-            remarkOptions: [],
-            multiSelectOptions: [],
-            subColumn: '',
+                                                {required: true, message: '请输入 多选', trigger: 'blur'},
+                                                                    ],
+                                                                },
+                                                testNameOptions:[{ label: '??', value: '??' }, { label: '??', value: '??' },{ label: '??', value: '??' }],
+                                            remarkOptions:[],
+                                            multiSelectOptions:[],
+                                        subColumn: '',
             subValue: '',
         }
-    },
-    methods: {
-        onSave() {
-            this.$refs.form.validate((valid) => {
-                if (valid) {
-                    this.submit();
-                } else {
-                    return false;
-                }
-            });
         },
-        submit() {
-            var data = JSON.parse(JSON.stringify(this.formData));
-            this.$http.post({
-                url: this.formData.id ? '/testAaa/update' : '/testAaa/save',
-                data: data
-            }).then(res => {
-                if (res.success) {
-                    this.$message.success('成功');
-                    this.$router.go(-1);
-                } else {
-                    this.$message.warning('失败')
-                }
-            });
-        },
-        onDelete() {
-            this.$alert('删除将无法恢复,确认要删除么?', '警告', { type: 'error' }).then(() => {
-                return this.$http.post({
+        methods: {
+            onSave() {
+                this.$refs.form.validate((valid) => {
+                    if (valid) {
+                        this.submit();
+                    } else {
+                        return false;
+                    }
+                });
+            },
+            submit() {
+                var data = JSON.parse(JSON.stringify(this.formData));
+                this.$http.post({
+                    url: this.formData.id ? '/testAaa/update' : '/testAaa/save',
+                    data: data
+                }).then(res => {
+                    if (res.success) {
+                        this.$message.success('成功');
+                        this.$router.go(-1);
+                    } else {
+                        this.$message.warning('失败')
+                    }
+                });
+            },
+            onDelete() {
+                this.$alert('删除将无法恢复,确认要删除么?', '警告', { type: 'error' }).then(() => {
+                    return this.$http.post({
                     url: '/testAaa/del',
                     data: { id: this.formData.id }
+                    })
+                }).then(() => {
+                    this.$message.success('删除成功');
+                    this.$router.go(-1);
+                }).catch(action => {
+                    if (action === 'cancel') {
+                        this.$message.info('删除取消');
+                    } else {
+                        this.$message.error('删除失败');
+                    }
                 })
-            }).then(() => {
-                this.$message.success('删除成功');
-                this.$router.go(-1);
-            }).catch(action => {
-                if (action === 'cancel') {
-                    this.$message.info('删除取消');
-                } else {
-                    this.$message.error('删除失败');
-                }
-            })
-        },
+            },
+        }
     }
-}
 </script>
 <style lang="less" scoped>
 </style>

+ 28 - 28
src/main/vue/src/pages/TestAaas.vue

@@ -51,6 +51,17 @@
                                 min-width="100">
                         </el-table-column>
                                                                                             
+                                            <el-table-column
+                                v-if="isColumnShow('imageUrl')"
+                                prop="imageUrl"
+                                label="图片"
+                                min-width="100">
+                            <template slot-scope="{row}">
+                                <img :src="row.imageUrl" @click="showImg(row.imageUrl)" style="width: 100px;height: 100px;vertical-align: middle;" />
+                            </template>
+
+                        </el-table-column>
+                                                                    
                                             <el-table-column
                                 v-if="isColumnShow('testName')"
                                 prop="testName"
@@ -66,16 +77,12 @@
                         </el-table-column>
                                                                 
                                             <el-table-column
-                                v-if="isColumnShow('imageUrl')"
-                                prop="imageUrl"
-                                label="图片"
+                                v-if="isColumnShow('multiSelect')"
+                                prop="multiSelect"
+                                label="多选"
                                 min-width="100">
-                            <template slot-scope="{row}">
-                                <img :src="row.imageUrl" @click="showImg(row.imageUrl)" style="width: 100px;height: 100px;vertical-align: middle;" />
-                            </template>
-
                         </el-table-column>
-                                                                    
+                                                                
                                             <el-table-column
                                 v-if="isColumnShow('testTime')"
                                 prop="testTime"
@@ -83,13 +90,6 @@
                                 :formatter="DateFormatter"
                                 min-width="100">
                         </el-table-column>
-                                                                
-                                            <el-table-column
-                                v-if="isColumnShow('multiSelect')"
-                                prop="multiSelect"
-                                label="多选"
-                                min-width="100">
-                        </el-table-column>
                                                             <el-table-column
                     label="操作"
                     align="center"
@@ -240,6 +240,11 @@
                                 show: true
                             },
                                                                                                                                             {
+                                label: '图片',
+                                value: 'imageUrl',
+                                show: true
+                            },
+                                                                                                {
                                 label: '名称',
                                 value: 'testName',
                                 show: true
@@ -250,19 +255,14 @@
                                 show: true
                             },
                                                                                                 {
-                                label: '图片',
-                                value: 'imageUrl',
+                                label: '多选',
+                                value: 'multiSelect',
                                 show: true
                             },
                                                                                                 {
                                 label: '时间',
                                 value: 'testTime',
                                 show: true
-                            },
-                                                                                                {
-                                label: '多选',
-                                value: 'multiSelect',
-                                show: true
                             },
                                                             ],
                 multipleMode: false,
@@ -277,6 +277,10 @@
                                 value: 'id'
                             },
                                                                                                                                             {
+                                label: '图片',
+                                value: 'image_url'
+                            },
+                                                                                                {
                                 label: '名称',
                                 value: 'test_name'
                             },
@@ -285,16 +289,12 @@
                                 value: 'remark'
                             },
                                                                                                 {
-                                label: '图片',
-                                value: 'image_url'
+                                label: '多选',
+                                value: 'multi_select'
                             },
                                                                                                 {
                                 label: '时间',
                                 value: 'test_time'
-                            },
-                                                                                                {
-                                label: '多选',
-                                value: 'multi_select'
                             },
                                                             ],
                 advancedQuerySearchKey: '',

Some files were not shown because too many files changed in this diff