first commit
This commit is contained in:
@@ -0,0 +1,200 @@
|
||||
<!--#
|
||||
layout("/layouts/platform.html"){
|
||||
#-->
|
||||
|
||||
<div id="app" v-cloak>
|
||||
<guava ref="guava">
|
||||
|
||||
<el-card shadow="never">
|
||||
<div class="btn-group tool-button mt5">
|
||||
<el-input placeholder="请输入内容" v-model="pageForm.searchKeyword" clearable @keyup.enter.native="doSearch">
|
||||
<el-select v-model="pageForm.searchName" slot="prepend" placeholder="查询类型" style="width: 120px;">
|
||||
<el-option label="内容" value="content"></el-option>
|
||||
</el-select>
|
||||
</el-input>
|
||||
</div>
|
||||
<div class="btn-group tool-button mt5">
|
||||
<el-select v-model="pageForm.category" clearable placeholder="所属类别">
|
||||
<el-option v-for="item in categoryList" :label="item" :value="item"></el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
|
||||
<div class="btn-group tool-button mt5">
|
||||
<el-button type="primary" icon="el-icon-search" @click="doSearch">搜索</el-button>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="pull-right offscreen-right mt5">
|
||||
<el-button type="primary" @click="openAdd">
|
||||
<i class="ti-plus"></i>
|
||||
新增内容
|
||||
</el-button>
|
||||
</div>
|
||||
|
||||
</el-card>
|
||||
|
||||
|
||||
<el-card shadow="never" class="mt10">
|
||||
<table-tool label="类别列表" :app="this"></table-tool>
|
||||
<el-table :data="tableData" :size="tableSize" style="width: 100%">
|
||||
<el-table-column type="index" label="序号" width="80px"></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="column.sortable"
|
||||
>
|
||||
|
||||
</el-table-column>
|
||||
<el-table-column align="center" header-align="center" label="操作" width="250">
|
||||
<template scope="{row}">
|
||||
<el-button size="mini" type="primary" @click="openEdit(row)">编辑</el-button>
|
||||
<el-button size="mini" type="danger" @click="doDelete(row.id)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!--#include("/layouts/pagination.html"){}#-->
|
||||
</el-card>
|
||||
|
||||
</guava>
|
||||
|
||||
<el-dialog
|
||||
title=""
|
||||
:visible.sync="dialogVisible"
|
||||
width="40%"
|
||||
:close-on-click-modal="false">
|
||||
|
||||
<el-form :model="formData" :rules="rules" ref="ruleForm" label-width="120px">
|
||||
<el-form-item label="编码" prop="contentCode">
|
||||
<el-input v-model="formData.contentCode" maxlength="30" placeholder="编码"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="内容" prop="content">
|
||||
<el-input v-model="formData.content" maxlength="30" placeholder="内容"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="折旧年限(年)" prop="depreciationYear">
|
||||
<el-input v-model="formData.depreciationYear" maxlength="30" placeholder="折旧年限(年)"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="所属类别" prop="content">
|
||||
<el-select v-model="formData.category" clearable placeholder="所属类别" style="width: 100%">
|
||||
<el-option v-for="item in categoryList" :label="item" :value="item"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||
<el-button type="primary" @click="formData.id?doEdit():doAdd()">确 定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var vue = new Vue({
|
||||
el: '#app',
|
||||
mixins: [initTableMixins],
|
||||
data() {
|
||||
return {
|
||||
tableColumns: [
|
||||
{prop: 'contentCode', label: '编码'},
|
||||
{prop: 'content', label: '内容'},
|
||||
{prop: 'category', label: '所属类别'},
|
||||
{prop: 'depreciationYear', label: '折旧年限(年)'},
|
||||
],
|
||||
dialogVisible: false,
|
||||
categoryList: ['房屋及构筑物', '通用设备', '专用设备', '家具、用具及装具'],
|
||||
pageForm: {
|
||||
searchName: 'content'
|
||||
},
|
||||
rules: {
|
||||
contentCode: [{required: true, message: '请输入编码', trigger: ['change', 'blur']}],
|
||||
content: [{required: true, message: '请输入内容', trigger: ['change', 'blur']}],
|
||||
category: [{required: true, message: '请选择所属类别', trigger: ['change', 'blur']}],
|
||||
depreciationYear: [{required: true, message: '请输入折旧年限', trigger: ['change', 'blur']}],
|
||||
},
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
openEdit(row) {
|
||||
const data = clone(row)
|
||||
this.formData = data
|
||||
this.$set(this.formData, "oldContentCode", data.contentCode)
|
||||
this.$set(this.formData, "oldDepreciationYear", data.depreciationYear)
|
||||
this.dialogVisible = true
|
||||
},
|
||||
openAdd() {
|
||||
this.formData = {}
|
||||
if (this.$refs['ruleForm']) {
|
||||
this.$refs['ruleForm'].resetFields()
|
||||
}
|
||||
this.dialogVisible = true
|
||||
},
|
||||
async doDelete(id) {
|
||||
const confirm = await this.$confirm('确定删除吗?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
})
|
||||
if (confirm === 'confirm') {
|
||||
const resp = await $.post(loc() + '/doDelete', {id})
|
||||
if (resp.code === 0) {
|
||||
this.$notify.success(resp.msg)
|
||||
this.doSearch()
|
||||
}
|
||||
}
|
||||
},
|
||||
async doEdit() {
|
||||
const valid = await this.$refs['ruleForm'].validate()
|
||||
if (valid) {
|
||||
let resp = {}
|
||||
if (this.formData.oldDepreciationYear !== this.formData.depreciationYear) {
|
||||
const confirm = await this.$confirm('修改了折旧年限将会同步修改资产的折旧到期时间!是否修改?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
})
|
||||
if (confirm === 'confirm') {
|
||||
resp = await $.post(loc() + "/doEdit", this.formData)
|
||||
}
|
||||
}
|
||||
resp = await $.post(loc() + "/doEdit", this.formData)
|
||||
if (resp.code === 0) {
|
||||
this.notifySuccess(resp.msg)
|
||||
this.doSearch()
|
||||
this.dialogVisible = false
|
||||
} else {
|
||||
this.notifyError(resp.msg)
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
},
|
||||
async doAdd() {
|
||||
const valid = await this.$refs['ruleForm'].validate()
|
||||
if (valid) {
|
||||
const resp = await $.post(loc() + "/doAdd", this.formData)
|
||||
if (resp.code === 0) {
|
||||
this.notifySuccess(resp.msg)
|
||||
this.doSearch()
|
||||
this.dialogVisible = false
|
||||
} else {
|
||||
this.notifyError(resp.msg)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
},
|
||||
async created() {
|
||||
this.pageData()
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
<!--#
|
||||
}
|
||||
#-->
|
||||
Reference in New Issue
Block a user