Commit 5d7f9995 by YuleiLan

模版管理。

parent 0818ce00
Showing with 51 additions and 42 deletions
...@@ -2,10 +2,10 @@ ...@@ -2,10 +2,10 @@
<div class="app-container"> <div class="app-container">
<el-card class="box-card"> <el-card class="box-card">
<el-form ref="listQuery" :model="listQuery" :inline="true"> <el-form ref="listQuery" :model="listQuery" :inline="true">
<el-form-item label="分类名称"> <el-form-item label="模版名称">
<el-input <el-input
v-model="listQuery.name" v-model="listQuery.name"
placeholder="请输入分类名称" placeholder="请输入模版名称"
clearable clearable
size="small" size="small"
style="width: 240px" style="width: 240px"
...@@ -49,16 +49,13 @@ ...@@ -49,16 +49,13 @@
</el-col> --> </el-col> -->
</el-row> </el-row>
<el-table v-loading="loading" border :data="classifyList" @selection-change="handleSelectionChange"> <el-table v-loading="loading" border :data="tplList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" /> <el-table-column type="selection" width="55" align="center" />
<el-table-column label="ID" prop="id" width="120" /> <el-table-column label="ID" prop="id" width="120" />
<el-table-column label="名称" prop="name" :show-overflow-tooltip="true" width="150" /> <el-table-column label="名称" prop="name" :show-overflow-tooltip="true" width="150" />
<el-table-column label="创建者" prop="create_name" :show-overflow-tooltip="true" width="150" /> <el-table-column label="创建者" prop="create_name" :show-overflow-tooltip="true" width="150" />
<el-table-column label="创建时间" align="center" prop="create_time" width="180"> <el-table-column label="创建时间" align="center" prop="create_time" width="180" />
<template slot-scope="scope"> <el-table-column label="更新时间" align="center" prop="update_time" width="180" />
<span>{{ parseTime(scope.row.create_time) }}</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button <el-button
...@@ -106,7 +103,7 @@ ...@@ -106,7 +103,7 @@
upload upload
generate-code generate-code
generate-json generate-json
:advance-fields="['blank', 'editor', 'cascader']" :advance-fields="['editor', 'cascader']"
> >
<template slot="action" /> <template slot="action" />
</fm-making-form> </fm-making-form>
...@@ -127,11 +124,12 @@ ...@@ -127,11 +124,12 @@
import Vue from 'vue' import Vue from 'vue'
import { import {
createClassify, templateList,
classifyList, createTemplate,
updateClassify, templateDetails,
deleteClassify editTemplate,
} from '@/api/process/admin/classify' deleteTemplate
} from '@/api/process/admin/template'
// 表单设计 // 表单设计
import { import {
...@@ -165,18 +163,23 @@ export default { ...@@ -165,18 +163,23 @@ export default {
// 是否显示弹出层 // 是否显示弹出层
open: false, open: false,
// 查询参数 // 查询参数
classifyList: [], tplList: [],
listQuery: { listQuery: {
page: 1, page: 1,
per_page: 10 per_page: 10
}, },
ruleForm: { ruleForm: {
id: undefined, id: undefined,
name: '' name: '',
remarks: '',
form_structure: ''
}, },
rules: { rules: {
name: [ name: [
{ required: true, message: '请输入流程分类', trigger: 'blur' } { required: true, message: '请输入模版名称', trigger: 'blur' }
],
form_structure: [
{ required: true, message: '请设计模版', trigger: 'blur' }
] ]
} }
} }
...@@ -190,8 +193,9 @@ export default { ...@@ -190,8 +193,9 @@ export default {
this.loading = true this.loading = true
this.listQuery.page = this.queryParams.pageIndex this.listQuery.page = this.queryParams.pageIndex
this.listQuery.per_page = this.queryParams.pageSize this.listQuery.per_page = this.queryParams.pageSize
classifyList(this.listQuery).then(response => { templateList(this.listQuery).then(response => {
this.classifyList = response.data.data this.tplList = response.data.data
console.log(this.tplList)
this.queryParams.pageIndex = response.data.page this.queryParams.pageIndex = response.data.page
this.queryParams.pageSize = response.data.per_page this.queryParams.pageSize = response.data.per_page
this.total = response.data.total_count this.total = response.data.total_count
...@@ -201,45 +205,51 @@ export default { ...@@ -201,45 +205,51 @@ export default {
handleCreate() { handleCreate() {
this.ruleForm = { this.ruleForm = {
id: undefined, id: undefined,
name: '' name: '',
remarks: '',
form_structure: ''
} }
this.dialogFormVisibleName = 1 this.dialogFormVisibleName = 1
this.open = true this.open = true
this.$nextTick(() => {
this.$refs.makingform.handleClear()
})
}, },
handleEdit(row) { handleEdit(row) {
this.ruleForm.id = row.id templateDetails({
this.ruleForm.name = row.name template_id: row.id
this.open = true }).then(response => {
this.ruleForm = {
id: response.data.id,
name: response.data.name,
remarks: response.data.remarks,
form_structure: response.data.remarks
}
this.dialogFormVisibleName = 2 this.dialogFormVisibleName = 2
this.open = true
this.$nextTick(() => {
this.$refs.makingform.setJSON(response.data.form_structure)
})
})
}, },
submitForm(formName) { submitForm(formName) {
this.handleSave(this.$refs.makingform.getJSON())
this.$refs[formName].validate((valid) => { this.$refs[formName].validate((valid) => {
if (valid) { if (valid) {
createClassify(this.ruleForm).then(response => { createTemplate(this.ruleForm).then(response => {
if (response !== undefined) {
this.getList() this.getList()
this.$message({
type: 'success',
message: '分类已增加!'
})
this.open = false this.open = false
}
}) })
} }
}) })
}, },
editForm(formName) { editForm(formName) {
this.handleSave(this.$refs.makingform.getJSON())
this.$refs[formName].validate((valid) => { this.$refs[formName].validate((valid) => {
if (valid) { if (valid) {
updateClassify(this.ruleForm).then(response => { editTemplate(this.ruleForm).then(response => {
if (response !== undefined) {
this.getList() this.getList()
this.$message({
type: 'success',
message: '分类已更新!'
})
this.open = false this.open = false
}
}) })
} }
}) })
...@@ -255,14 +265,14 @@ export default { ...@@ -255,14 +265,14 @@ export default {
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
deleteClassify({ deleteTemplate({
classifyId: row.id templateId: row.id
}).then(response => { }).then(response => {
if (response !== undefined) { if (response !== undefined) {
this.getList() this.getList()
this.$message({ this.$message({
type: 'success', type: 'success',
message: '分类已删除!' message: '模版已删除!'
}) })
} }
}) })
...@@ -275,8 +285,7 @@ export default { ...@@ -275,8 +285,7 @@ export default {
}, },
handleSelectionChange() {}, handleSelectionChange() {},
handleSave(values) { handleSave(values) {
var jsonValue = JSON.parse(values) if (values.list.length > 0) {
if (jsonValue.list.length > 0) {
this.ruleForm.form_structure = values this.ruleForm.form_structure = values
} else { } else {
this.ruleForm.form_structure = '' this.ruleForm.form_structure = ''
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment