审查视图

src/views/technological/technological.vue 15.1 KB
小范 authored
1 2 3 4 5 6
<template>
    <el-container>
        <el-main>
            <!--检索条件-->
            <el-row class="toolbar" style="background-color: white;margin-bottom: 10px">
                <el-col :span="6">
小范 authored
7
                    <el-input v-model="queryinfo.name" placeholder="名称" style="width: 200px" clearable>
小范 authored
8 9 10 11
                        <template slot="prepend">名称</template>
                    </el-input>
                </el-col>
                <el-col :span="6">
小范 authored
12
                    <el-input v-model="queryinfo.key" placeholder="key-ID" style="width: 200px" clearable>
小范 authored
13 14 15 16 17 18
                        <template slot="prepend">key-ID</template>
                    </el-input>
                </el-col>

                <el-col :span="8">
                    <el-button type="primary" v-on:click="getList">查询</el-button>
小范 authored
19
                    <el-button type="success" v-on:click="toAddDialog">新增</el-button>
小范 authored
20 21 22 23 24 25 26 27 28 29

                </el-col>
            </el-row>
            <el-row>
                <template>
                    <el-table
                            v-loading="tableloading"
                            :data="tableData"
                            style="width: 100%"
                            :default-sort = "{prop: 'date', order: 'descending'}"
小范 authored
30
                            :header-cell-style="{background:'#6F8294',color:'#FFFFFF'}" size="small"
小范 authored
31 32 33
                    >
                        <el-table-column
                                prop="name"
小范 authored
34 35
                                label="名称"
                                width="160">
小范 authored
36 37 38 39 40 41 42
                        </el-table-column>
                        <el-table-column
                                prop="category"
                                label="类别">
                        </el-table-column>
                        <el-table-column
                                prop="key"
小范 authored
43 44
                                label="key-ID"
                        show-overflow-tooltip>
小范 authored
45 46 47
                        </el-table-column>
                        <el-table-column
                                prop="id"
小范 authored
48 49 50
                                label="id"
                                width="160"
                        show-overflow-tooltip>
小范 authored
51 52 53
                        </el-table-column>
                        <el-table-column
                                prop="deploymentTime"
小范 authored
54 55
                                label="时间"
                                width="160">
小范 authored
56 57 58 59 60
                        </el-table-column>
                        <el-table-column
                                prop="filePath"
                                label="文件路径">
                        </el-table-column>
小范 authored
61 62 63 64 65 66 67 68 69 70
                        <el-table-column
                                fixed="right"
                                label="操作"
                                width="280">
                            <template slot-scope="scope">
                                <el-button type="success" size="mini" @click="sendForm()">实例管理</el-button>
                                <el-button type="warning" size="mini" @click="remove(scope.$index,scope.row)">删除</el-button>
                                <el-button type="danger" size="mini" @click="removeDel(scope.$index,scope.row)">彻底删除</el-button>
                            </template>
                        </el-table-column>
小范 authored
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89
                    </el-table>
                </template>
            </el-row>
            <!--分页模块-->
            <el-row style="float: right;margin-top: 20px">
                <el-col>
                    <div class="block">
                        <el-pagination
                                @size-change="handleSizeChange"
                                @current-change="handleCurrentChange"
                                :current-page="queryinfo.pageNum"
                                :page-sizes="[10, 20, 30, 40]"
                                :page-size="queryinfo.pageSize"
                                layout="total, sizes, prev, pager, next, jumper"
                                :total="total">
                        </el-pagination>
                    </div>
                </el-col>
            </el-row>
小范 authored
90 91 92 93 94 95 96 97 98 99 100 101 102 103
<!--            新增弹框-->
            <el-dialog title="收货地址" :visible.sync="dialogFormVisible" style="margin-top: -60px" width="60%">
                <el-form :model="formInline" :rules="rules" ref="formInline">
                    <el-row>
                        <el-col :offset="2" :span="12">
                            <el-form-item label="" :label-width="formLabelWidth">
                                <el-upload
                                        class="upload-demo"
                                        drag
                                        :action="uploadPath"
                                        :headers="uploadHeaderObj"
                                        :on-success="handleUploadSuccess">
                                    <i class="el-icon-upload"></i>
                                    <div class="el-upload__text">将文件拖到此处,或<em>点击上传xml文件</em></div>
104
                                    <div class="el-upload__tip" slot="tip">只能上传xml文件,且不超过2MB</div>
小范 authored
105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163
                                </el-upload>
                            </el-form-item>
                        </el-col>
                    </el-row>
                    <el-row>
                        <el-col :span="10">
                            <el-form-item label="" :label-width="formLabelWidth">
                                <el-input v-model="formInline.filePath" disabled style="width: 220px">
                                    <template slot="prepend">路径</template>
                                </el-input>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="" :label-width="formLabelWidth"  prop="key">
                                <el-input v-model="formInline.key" style="width: 220px">
                                    <template slot="prepend">key</template>
                                </el-input>
                            </el-form-item>
                        </el-col>

                    </el-row>
                    <el-row>
                        <el-col :span="10">
                            <el-form-item label="" :label-width="formLabelWidth">
                                <el-input v-model="formInline.category" style="width: 220px">
                                    <template slot="prepend">类别</template>
                                </el-input>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="" :label-width="formLabelWidth" prop="name">
                                <el-input v-model="formInline.name " style="width: 220px">
                                    <template slot="prepend">名称</template>
                                </el-input>
                            </el-form-item>
                        </el-col>
                    </el-row>
                    <el-row>
                        <el-col :span="10">
                            <el-form-item label="" :label-width="formLabelWidth">
                                <el-input v-model="formInline.tenantId " style="width: 220px">
                                    <template slot="prepend">租户</template>
                                </el-input>
                            </el-form-item>
                        </el-col>
<!--                        <el-col :span="12">-->
<!--                            <el-form-item label="" :label-width="formLabelWidth">-->
<!--                                <el-input v-model="" style="width: 220px">-->
<!--                                    <template slot="prepend">其他</template>-->
<!--                                </el-input>-->
<!--                            </el-form-item>-->
<!--                        </el-col>-->
                    </el-row>
                </el-form>
                <div slot="footer" class="dialog-footer" align="center">
                    <el-button @click="dialogFormVisible = false">取 消</el-button>
                    <el-button type="primary" @click="trans_add">确 定</el-button>
                </div>
            </el-dialog>
小范 authored
164 165 166 167 168 169
        </el-main>
    </el-container>

</template>

<script>
小范 authored
170
    import {deployment, del,upload,create,uploadPath} from "../../api/technological";
小范 authored
171 172 173 174 175 176 177 178 179 180 181 182


    export default {
        name: "technological",
        data() {
            return{
                queryinfo:{
                    name:'',
                    key:'',
                    pageNum:1,
                    pageSize:10,
                },
小范 authored
183
                uploadPath:uploadPath,
小范 authored
184 185 186
                total:0,
                tableData: [],
                tableloading:false,
小范 authored
187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213
                formInline:{
                    filePath :'',
                    category:'',
                    key:'',
                    name:'',
                    tenantId:'',
                    variables: {},
                    // cascade:'true'
                },
                uploadHeaderObj: {
                    Authorization: window.sessionStorage.getItem("token"),
                },
                faceImageUrl:'',
                formLabelWidth: '120px',
                dialogFormVisible:false,
                rules: {
                    name: [
                        { required: true, message: '请输入名称', trigger: 'blur' },
                        // { min: 3, max: 5, message: '长度在 3 到 5 个字符', trigger: 'blur' }
                    ],
                    filePath : [
                        { required: true, message: '请上传文件', trigger: 'blur' }
                    ],
                    key : [
                        { required: true, message: '请输入部署key', trigger: 'blur' }
                    ],
                }
小范 authored
214 215
            }
        },
小范 authored
216 217 218
        mounted() {
            this.getList();
        },
小范 authored
219
        methods: {
小范 authored
220
小范 authored
221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239
            // 分页
            handleSizeChange(val) {
                this.queryinfo.pageSize= val
                this.getList()
            },
            handleCurrentChange(val) {
                this.queryinfo.pageNum  = val
                this.getList()
            },
            //查询
            getList() {
                const _this = this
                this.tableloading = true;
                deployment(this.queryinfo).then((response) => {
                    const res = response.data
                    if (res.code != '200') {
                        return _this.$message.error('获取消息收发记录,失败!')
                    }
                    // 获取列表数据
小范 authored
240
                    _this.tableData = res.data
小范 authored
241
                    // 获取列表的总记录数
小范 authored
242
                    _this.total = res.total
小范 authored
243
                    _this.$message.success('获取消息收发记录,成功!')
244
                    this.tableloading = false;
小范 authored
245 246 247 248
                }).catch(error => {
                    // 关闭加载
                    _this.$message.error(error.toString())
                    this.tableloading = false;
小范 authored
249
小范 authored
250 251
                })
            },
小范 authored
252 253 254
            //打开新增
            toAddDialog() {
                this.dialogFormVisible = true;
255 256 257 258 259 260 261 262 263
                this.formInline = {
                    filePath :'',
                        category:'',
                        key:'',
                        name:'',
                        tenantId:'',
                        variables: {},
                    // cascade:'true'
                }
小范 authored
264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301
            },
            //上传文件
            handleUploadSuccess: function(response, file, fileList){
                let res = response.data;
                if (response.code !== '200') {
                    // 关闭加载
                    return this.$message.error(response.msg);
                }
                this.$message.success(response.msg);
                this.formInline.filePath = res.relativePath

            },
            //新增功能
            trans_add() {
                // 进行表单的预验证
                this.$refs.formInline.validate(valid => {
                    // 未通过,表单预校验
                    if (!valid) return;
                    create(this.formInline).then((response) => {
                        let res = response.data;
                        // 添加失败
                        if (res.code !== '200') {
                            // 关闭加载
                            return this.$message.error(res.msg);
                            // 隐藏对话框
                            this.dialogFormVisible = false;
                        }
                        // 添加,成功
                        this.$message.success(res.msg);
                        // 隐藏对话框
                        this.dialogFormVisible = false;
                        // 刷新列表
                        this.getList();
                    }).catch(error => {
                        this.$message.error(error.toString());
                    });
                })
            },
小范 authored
302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341
            //删除
            remove(index,row){
                // 弹框询问是否删除?
                this.$confirm('此操作永久删除该消息收发记录, 是否继续?', '警告', {
                        confirmButtonText: '确定删除',
                        cancelButtonText: '取消',
                        type: 'warning'
                    }
                ).then(() => {
                    del({id:row.id,cascade:false}).then((response) => {
                        let res = response.data;
                        this.$message.success(res.msg);
                        this.getList();
                    }).catch(error => {
                        this.$message.error(res.msg);
                    });
                }).catch(() => {
                });
            },
            removeDel(index,row){
                // 弹框询问是否删除?
                this.$confirm('此操作永久删除该消息收发记录, 是否继续?', '警告', {
                        confirmButtonText: '确定删除',
                        cancelButtonText: '取消',
                        type: 'warning'
                    }
                ).then(() => {
                    del({id:row.id,cascade:true}).then((response) => {
                        let res = response.data;
                        this.$message.success(res.msg);
                        this.getList();
                    }).catch(error => {
                        this.$message.error(res.msg);
                    });
                }).catch(() => {
                });
            },
            sendForm(){
                this.$router.push({path:'/example',query:{processDefinitionKey:this.queryinfo.key}});
            }
小范 authored
342 343 344 345 346
        }
    }
</script>

<style scoped>
小范 authored
347 348 349 350 351 352 353 354 355
    .toolbar{
        height: 60px;
        background-color: white;
        /*line-height: 60px;*/
        vertical-align: middle;
        border-radius: 5px 5px 5px 5px;
        padding: 15px 0 0 20px;
        box-shadow: 0px 5px 5px #e5e8eb;
    }
小范 authored
356
</style>