168 lines
6.7 KiB
HTML
168 lines
6.7 KiB
HTML
<!--#
|
|
layout("/layouts/platform.html"){
|
|
#-->
|
|
|
|
<style>
|
|
|
|
</style>
|
|
<div id="app" v-cloak>
|
|
<guava>
|
|
<el-card shadow="never">
|
|
<div class="btn-group tool-button">
|
|
<el-input placeholder="请输入内容" clearable v-model="pageForm.searchKeyword"
|
|
@keyup.enter.native="doSearch">
|
|
<el-select v-model="pageForm.searchName" slot="prepend" placeholder="查询类型"
|
|
style="width: 80px;">
|
|
<el-option label="名称" value="manuscriptTypeName"></el-option>
|
|
<el-option label="编码" value="manuscriptTypeCode"></el-option>
|
|
</el-select>
|
|
</el-input>
|
|
</div>
|
|
<div class="btn-group tool-button">
|
|
<el-button type="primary" icon="el-icon-search" @click="doSearch"></el-button>
|
|
</div>
|
|
|
|
<div class="pull-right offscreen-right">
|
|
<el-button type="primary" icon="el-icon-plus" @click="openAdd">添加类型</el-button>
|
|
</div>
|
|
</el-card>
|
|
|
|
<el-card shadow="never" class="mt20">
|
|
<el-table :data="tableData" style="width: 100%" row-key="id" @sort-change="pageOrder"
|
|
>
|
|
<el-table-column align="center" header-align="center" label="序号" width="120px">
|
|
<template scope="scope">
|
|
<span>{{scope.$index+(pageForm.pageNumber - 1) * pageForm.pageSize + 1}} </span>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column
|
|
align="center"
|
|
header-align="center"
|
|
v-for="column in tableColumns"
|
|
show-overflow-tooltip
|
|
:label="column.label"
|
|
:prop="column.prop"
|
|
sortable
|
|
></el-table-column>
|
|
<el-table-column align="center" header-align="center" label="操作" fixed="right"
|
|
width="300px">
|
|
<template slot-scope="{row}">
|
|
<el-button size="mini" @click="openEdit(row)">编辑
|
|
</el-button>
|
|
<el-button type="danger" size="mini" @click="doDelete(row.id)">删除
|
|
</el-button>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table>
|
|
<!--#include("/layouts/pagination.html"){}#-->
|
|
</el-card>
|
|
</guava>
|
|
|
|
<el-dialog :title="title" :visible.sync="DialogVisible" :close-on-click-modal="false" width="40%">
|
|
<el-form :model="formData" ref="addForm" :rules="formRules"
|
|
label-width="100px">
|
|
<el-form-item label="类型编号" prop="manuscriptTypeCode">
|
|
<el-input type="text" v-model="formData.manuscriptTypeCode" maxlength="50"
|
|
placeholder="类型编号"></el-input>
|
|
</el-form-item>
|
|
<el-form-item label="类型名称" prop="manuscriptTypeName">
|
|
<el-input type="text" v-model="formData.manuscriptTypeName" maxlength="50"
|
|
placeholder="请填写类型名称"></el-input>
|
|
</el-form-item>
|
|
</el-form>
|
|
|
|
<span slot="footer" class="dialog-footer">
|
|
<el-button @click="DialogVisible = false">取 消</el-button>
|
|
<el-button type="primary" :disabled="subDis" @click="operation">确 定</el-button>
|
|
</span>
|
|
</el-dialog>
|
|
</div>
|
|
|
|
<script>
|
|
var vue = new Vue({
|
|
el: '#app',
|
|
mixins: [initTableMixins],
|
|
data() {
|
|
return {
|
|
title: "",
|
|
subDis: false,
|
|
DialogVisible: false,
|
|
pageForm: {
|
|
searchName: 'manuscriptTypeName'
|
|
},
|
|
tableColumns: [
|
|
{prop: 'manuscriptTypeCode', label: '类型编号'},
|
|
{prop: 'manuscriptTypeName', label: '类型名称'}
|
|
],
|
|
formRules: {
|
|
manuscriptTypeName: [{required: true, message: '必选', trigger: ['blur', 'change']}],
|
|
manuscriptTypeCode: [{required: true, message: '必选', trigger: ['blur', 'change']}],
|
|
},
|
|
}
|
|
},
|
|
components: {},
|
|
methods: {
|
|
openEdit(data) {
|
|
this.title = "编辑类型"
|
|
this.formData = data
|
|
this.DialogVisible = true;
|
|
},
|
|
openAdd() {
|
|
this.title = "添加类型"
|
|
this.formData = {}
|
|
this.DialogVisible = true;
|
|
if (this.$refs['addForm']) {
|
|
this.$refs['addForm'].resetFields()
|
|
}
|
|
},
|
|
async operation() {
|
|
let method = this.formData.id ? "/doEdit" : "/doAdd"
|
|
this.$refs["addForm"].validate(async (valid) => {
|
|
if (valid) {
|
|
const loading = this.$loading({
|
|
lock: true,
|
|
text: '正在提交...',
|
|
spinner: 'el-icon-loading',
|
|
background: COVER_LAYER_COLOR
|
|
});
|
|
const resp = await $.post(loc() + method, {manuscriptType: JSON.stringify(this.formData)})
|
|
loading.close()
|
|
if(resp.code===0){
|
|
this.DialogVisible = false;
|
|
this.$notify.success({title: '成功', message: resp.msg});
|
|
this.pageData();
|
|
}else{
|
|
this.notifyWarning(resp.msg)
|
|
}
|
|
}
|
|
});
|
|
},
|
|
async doDelete(id) {
|
|
let self = this
|
|
this.$confirm('确定要删除吗?', '提示', {
|
|
confirmButtonText: '确定',
|
|
cancelButtonText: '取消',
|
|
type: 'warning',
|
|
callback: async (a, b) => {
|
|
if ("confirm" === a) {
|
|
const resp = await $.get(loc() + "/doDelete", {id: id})
|
|
if(resp.code===0){
|
|
self.notifySuccess(resp.msg)
|
|
self.pageData()
|
|
}else{
|
|
self.notifyWarning(resp.msg)
|
|
}
|
|
}
|
|
}
|
|
});
|
|
},
|
|
},
|
|
async created() {
|
|
this.pageData()
|
|
}
|
|
})
|
|
</script>
|
|
<!--#
|
|
}
|
|
#-->
|