Commit 14e0403b authored by daywrite's avatar daywrite

12.文档管理

parent 67306006
...@@ -26,22 +26,22 @@ function temp (t, tt) { ...@@ -26,22 +26,22 @@ function temp (t, tt) {
function term (t, tt, num) { function term (t, tt, num) {
let endStr = tt === '' ? `${t}` : `${t}-${tt}` let endStr = tt === '' ? `${t}` : `${t}-${tt}`
return { return {
[`getList${t}${tt}`]: { [`getList${t}${num}`]: {
url: `/vue/${type}/list-${endStr}?term=${num}` url: `/vue/${type}/list-${endStr}?term=${num}`
}, },
[`getNew${t}${tt}`]: { [`getNew${t}${num}`]: {
url: `/vue/${type}/get-new-${endStr}?term=${num}` url: `/vue/${type}/get-new-${endStr}?term=${num}`
}, },
[`getEdit${t}${tt}`]: { [`getEdit${t}${num}`]: {
url: `/vue/${type}/get-edit-${endStr}?term=${num}` url: `/vue/${type}/get-edit-${endStr}?term=${num}`
}, },
[`saveNew${t}${tt}`]: { [`saveNew${t}${num}`]: {
url: `/vue/${type}/save-new-${endStr}?term=${num}` url: `/vue/${type}/save-new-${endStr}?term=${num}`
}, },
[`saveEdit${t}${tt}`]: { [`saveEdit${t}${num}`]: {
url: `/vue/${type}/save-edit-${endStr}?term=${num}` url: `/vue/${type}/save-edit-${endStr}?term=${num}`
}, },
[`delete${t}${tt}`]: { [`delete${t}${num}`]: {
url: `/vue/${type}/delete-${endStr}?term=${num}` url: `/vue/${type}/delete-${endStr}?term=${num}`
} }
} }
...@@ -57,5 +57,7 @@ export default { ...@@ -57,5 +57,7 @@ export default {
...temp('department', 'position'), ...temp('department', 'position'),
...temp('role', ''), ...temp('role', ''),
...temp('rating', 'strategy'), ...temp('rating', 'strategy'),
...term('taxonomy', '', 6) ...term('taxonomy', '', 6),
...term('taxonomy', '', 7),
...temp('document', 'type')
} }
...@@ -204,12 +204,12 @@ ...@@ -204,12 +204,12 @@
}, },
{ {
name: '供应商分类', name: '供应商分类',
path: '/setting/taxonomy?term=6', path: '/setting/taxonomy/term/6',
icon: 'fa fa-fw fa-map-marker' icon: 'fa fa-fw fa-map-marker'
}, },
{ {
name: '文档管理', name: '文档管理',
path: '/setting/taxonomy?term=7', path: '/setting/taxonomy/term/7',
icon: 'fa fa-fw fa-paste' icon: 'fa fa-fw fa-paste'
}, },
{ {
......
<template>
<section>
<div class="content">
<search-header
ref="searchHeader"
:title="'文档分类'"
:add-title="'新建文档分类'"
@update:headerAdd="() => add()"
@update:headerClear="() => searchClear()">
</search-header>
<div class="page-body-content">
<el-alert title="" type="info">
<BreadCrumb name="文档分类"></BreadCrumb>
</el-alert>
<el-radio-group v-model="activeName" size="small" style="margin-top:20px;" @change="activeNameChange">
<el-radio-button label="文档类型"></el-radio-button>
<el-radio-button label="文档分类"></el-radio-button>
</el-radio-group>
<el-table :data="result.list" border stripe style="width: 100%;margin-top:20px;">
<el-table-column prop="title" align="center" label="文档分类">
</el-table-column>
<el-table-column prop="description" align="center" label="备注">
</el-table-column>
<el-table-column prop="sort" align="center" label="排序">
</el-table-column>
<el-table-column align="center" label="操作">
<template slot-scope="scope">
<el-button type="primary" size="mini" @click.prevent.stop="editEvent(scope.row)" :disabled="!scope.row.can_update"><i class="fa fa-edit animated"></i>编辑</el-button>
<el-button type="primary" size="mini" @click.prevent.stop="deleteEvent(scope.row.id)" :disabled="!scope.row.can_delete"><i class="fa fa-trash-o animated-hove"></i>删除</el-button>
</template>
</el-table-column>
</el-table>
<Pagenation
@update:pager="pager => {updatePage(pager)}"
:total="result.pagenation.totalcount">
</Pagenation>
</div>
</div>
<FormModal ref="formModal" :t="t" :tt="tt"></FormModal>
</section>
</template>
<script>
import SearchHeader from '../../common/searchHeader'
import BreadCrumb from '../BreadCrumb'
import FormModal from './modal'
import Pagenation from '../pagenation'
import {
requestAPI,
api
} from '@/lib/commonMixin'
export default {
name: 'implement_type_list',
components: {
SearchHeader,
BreadCrumb,
Pagenation,
FormModal
},
data () {
return {
activeName: '文档分类',
t: 'document',
tt: 'type',
pagenation: {
thispage: 1,
pagesize: 20
},
result: {
list: [],
pagenation: {
totalcount: 1,
thispage: 1,
pagesize: 20
}
}
}
},
created () {
this.getList()
},
methods: {
activeNameChange () {
if (this.activeName === '文档类型') {
this.$router.push({
path: '/setting/taxonomy/term/7'
})
} else {
this.$router.push({
path: '/setting/documnet-type'
})
}
},
getList (params) {
requestAPI(api[`getList${this.t}${this.tt}`], params)
.then((res) => {
this.result.list = res.list
this.result.pagenation = res.pagenation
})
},
updatePage (pager) {
let ret = Object.assign({
page: this.pagenation.thispage
}, {page: pager.thispage})
this.getList(ret)
},
_reload () {
this.getList({page: this.pagenation.thispage})
},
// 6.1新增
add () {
this.$refs.formModal.show()
},
// 6.2编辑
editEvent (item) {
this.$refs.formModal.show(item)
},
deleteEvent (id) {
let deleteTip = '删除'
this.$confirm(`${deleteTip}?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
requestAPI(api[`delete${this.t}${this.tt}`], { id })
.then((res) => {
this.$message.success(`${deleteTip}成功`)
this._reload()
})
}).catch(() => {
this.$message.info(`取消${deleteTip}`)
})
},
searchClear () {}
}
}
</script>
<style scoped>
</style>
<template>
<section class="ec-page-wrapper" style="overflow: hidden; padding-bottom: 0px;">
<el-form label-width="120px" ref="form" :rules="rules" :model="model" class="ec-create-form">
<el-form-item label="供应商分类" prop="title" class="ec-clear-left is-required">
<el-input
class="ec-input-normal"
size="mini"
v-model.trim="model.title">
</el-input>
</el-form-item>
<el-form-item label="部门:" prop="department_id" size="mini" class="ec-clear-left ec-form-item-lg is-required">
<el-select v-model="model.department_id" size="small" placeholder="请选择">
<el-option v-for="(option, optKey) in options['DocumentTypes[department_id]'].value"
:key="optKey"
:label="option.name"
:value="option.id"></el-option>
</el-select>
</el-form-item>
</el-form>
</section>
</template>
<script>
import {
requestAPI,
api
} from '@/lib/commonMixin'
export default {
name: 'implementForm',
props: {
model: Object,
t: String,
tt: String
},
components: {
},
data () {
return {
options: [],
rules: {
}
}
},
created () {
},
mounted () {
},
computed: {
},
methods: {
getNew () {
requestAPI(api[`getNew${this.t}${this.tt}`], {})
.then((res) => {
this.options = res.options
})
},
getEdit (id) {
return requestAPI(api[`getEdit${this.t}${this.tt}`], {id})
.then((res) => {
return res.model
})
},
_validate (cb) {
this.$refs['form'].validate((valid) => {
if (valid) {
cb && cb()
}
})
},
_resetFields () {
this.$refs['form'].resetFields()
}
}
}
</script>
<style lang="scss" scoped>
.ec-create-form .el-form-item {
width: 70%;
}
// .ec-create-form .el-form-item {
// width: 100%;
// }
</style>
<template>
<section>
<sidePopup ref="sidePopup" title="新建文档分类" :width="50" @update:close="() => btnClose()">
<Foom
ref="form"
:t="t"
:tt="tt"
:model="model">
</Foom>
<div class="mt20" style="margin-left: 150px;">
<el-button type="cancel" @click.stop.prevent="handleClose" size="mini">取 消</el-button>
<el-button type="confirm" @click.stop.prevent="save" size="mini">确 定</el-button>
</div>
</sidePopup>
</section>
</template>
<script>
import {
requestAPI,
api,
UTIL
} from '@/lib/commonMixin'
import Foom from './form'
import { setModule } from '@/lib/viewHelper'
export default {
props: {
t: String,
tt: String
},
components: {
Foom
},
data () {
return {
diaVis: false,
model: {
id: '',
title: '',
department_id: ''
}
}
},
methods: {
show (model) {
if (model) {
this.$refs.form.getEdit(model.id)
.then((_model) => {
UTIL.flatten(this.model, _model)
})
} else {
this.$refs.form.getNew()
}
this.$refs.sidePopup.show()
},
handleClose () {
this.$refs.sidePopup.close(() => {
this.$refs.form._resetFields()
})
},
btnClose () {
this.$refs.form._resetFields()
},
save () {
let _params = Object.assign({}, setModule(this.model, 'DocumentTypes'))
let _apiUrl = !this.model.id ? api[`saveNew${this.t}${this.tt}`] : api[`saveEdit${this.t}${this.tt}`]
!this.model.id && delete _params['DocumentTypes[id]']
this.$refs['form']._validate(() => {
requestAPI(Object.assign(_apiUrl, { method: 'POST' }), _params)
.then((res) => {
this.$refs.sidePopup.close(() => {
this.btnClose()
})
this.$message.success('操作成功')
this.$parent._reload()
}) // save
}) // validate
}
}
}
</script>
<style lang="scss" scoped>
</style>
...@@ -57,7 +57,7 @@ export default { ...@@ -57,7 +57,7 @@ export default {
data () { data () {
return { return {
t: 'taxonomy', t: 'taxonomy',
tt: '', tt: '6',
pagenation: { pagenation: {
thispage: 1, thispage: 1,
pagesize: 20 pagesize: 20
......
<template>
<section class="ec-page-wrapper" style="overflow: hidden; padding-bottom: 0px;">
<el-form label-width="120px" ref="form" :rules="rules" :model="model" class="ec-create-form">
<el-form-item label="供应商分类" prop="name" class="ec-clear-left is-required">
<el-input
class="ec-input-normal"
size="mini"
v-model.trim="model.name">
</el-input>
</el-form-item>
<el-form-item label="备注" prop="description" class="ec-clear-left ec-form-item-lg">
<el-input
class="ec-input-normal"
type="textarea"
size="mini"
:rows="3"
v-model.trim="model.description">
</el-input>
</el-form-item>
<el-form-item label="排序" prop="sort" class="ec-clear-left is-required">
<el-input
class="ec-input-normal"
size="mini"
v-model.trim="model.sort">
</el-input>
</el-form-item>
</el-form>
</section>
</template>
<script>
import {
requestAPI,
api
} from '@/lib/commonMixin'
export default {
name: 'implementForm',
props: {
model: Object,
t: String,
tt: String
},
components: {
},
data () {
return {
rules: {
}
}
},
created () {
},
mounted () {
},
computed: {
},
methods: {
getNew () {
requestAPI(api[`getNew${this.t}${this.tt}`], {})
.then((res) => {
this.model.sort = res.nextOrder
})
},
getEdit (id) {
return requestAPI(api[`getEdit${this.t}${this.tt}`], {id})
.then((res) => {
return res.model
})
},
_validate (cb) {
this.$refs['form'].validate((valid) => {
if (valid) {
cb && cb()
}
})
},
_resetFields () {
this.$refs['form'].resetFields()
}
}
}
</script>
<style lang="scss" scoped>
.ec-create-form .el-form-item {
width: 70%;
}
// .ec-create-form .el-form-item {
// width: 100%;
// }
</style>
<template>
<section>
<sidePopup ref="sidePopup" title="新建供应商分类" :width="50" @update:close="() => btnClose()">
<Foom
ref="form"
:t="t"
:tt="tt"
:model="model">
</Foom>
<div class="mt20" style="margin-left: 150px;">
<el-button type="cancel" @click.stop.prevent="handleClose" size="mini">取 消</el-button>
<el-button type="confirm" @click.stop.prevent="save" size="mini">确 定</el-button>
</div>
</sidePopup>
</section>
</template>
<script>
import {
requestAPI,
api,
UTIL
} from '@/lib/commonMixin'
import Foom from './form'
import { setModule } from '@/lib/viewHelper'
export default {
props: {
t: String,
tt: String
},
components: {
Foom
},
data () {
return {
diaVis: false,
model: {
id: '',
name: '',
sort: '',
description: ''
}
}
},
methods: {
show (model) {
if (model) {
this.$refs.form.getEdit(model.id)
.then((_model) => {
UTIL.flatten(this.model, _model)
})
} else {
this.$refs.form.getNew()
}
this.$refs.sidePopup.show()
},
handleClose () {
this.$refs.sidePopup.close(() => {
this.$refs.form._resetFields()
})
},
btnClose () {
this.$refs.form._resetFields()
},
save () {
let _params = Object.assign({}, setModule(this.model, 'TermTaxonomies'))
let _apiUrl = !this.model.id ? api[`saveNew${this.t}${this.tt}`] : api[`saveEdit${this.t}${this.tt}`]
!this.model.id && delete _params['TermTaxonomies[id]']
this.$refs['form']._validate(() => {
requestAPI(Object.assign(_apiUrl, { method: 'POST' }), _params)
.then((res) => {
this.$refs.sidePopup.close(() => {
this.btnClose()
})
this.$message.success('操作成功')
this.$parent._reload()
}) // save
}) // validate
}
}
}
</script>
<style lang="scss" scoped>
</style>
<template>
<section>
<div class="content">
<search-header
ref="searchHeader"
:title="'文档类型'"
:add-title="'新建文档类型'"
@update:headerAdd="() => add()"
@update:headerClear="() => searchClear()">
</search-header>
<div class="page-body-content">
<el-alert title="" type="info">
<BreadCrumb name="文档类型"></BreadCrumb>
</el-alert>
<el-radio-group v-model="activeName" size="small" style="margin-top:20px;" @change="activeNameChange">
<el-radio-button label="文档类型"></el-radio-button>
<el-radio-button label="文档分类"></el-radio-button>
</el-radio-group>
<el-table :data="result.list" border stripe style="width: 100%;margin-top:20px;">
<el-table-column prop="name" align="center" label="文档类型">
</el-table-column>
<el-table-column prop="description" align="center" label="备注">
</el-table-column>
<el-table-column prop="sort" align="center" label="排序">
</el-table-column>
<el-table-column align="center" label="操作">
<template slot-scope="scope">
<el-button type="primary" size="mini" @click.prevent.stop="editEvent(scope.row)" :disabled="!scope.row.can_update"><i class="fa fa-edit animated"></i>编辑</el-button>
<el-button type="primary" size="mini" @click.prevent.stop="deleteEvent(scope.row.id)" :disabled="!scope.row.can_delete"><i class="fa fa-trash-o animated-hove"></i>删除</el-button>
</template>
</el-table-column>
</el-table>
<Pagenation
@update:pager="pager => {updatePage(pager)}"
:total="result.pagenation.totalcount">
</Pagenation>
</div>
</div>
<FormModal ref="formModal" :t="t" :tt="tt"></FormModal>
</section>
</template>
<script>
import SearchHeader from '../../common/searchHeader'
import BreadCrumb from '../BreadCrumb'
import FormModal from './modal'
import Pagenation from '../pagenation'
import {
requestAPI,
api
} from '@/lib/commonMixin'
export default {
name: 'implement_type_list',
components: {
SearchHeader,
BreadCrumb,
Pagenation,
FormModal
},
data () {
return {
activeName: '文档类型',
t: 'taxonomy',
tt: '7',
pagenation: {
thispage: 1,
pagesize: 20
},
result: {
list: [],
pagenation: {
totalcount: 1,
thispage: 1,
pagesize: 20
}
}
}
},
created () {
this.getList()
},
methods: {
activeNameChange () {
if (this.activeName === '文档类型') {
this.$router.push({
path: '/setting/taxonomy/term/7'
})
} else {
this.$router.push({
path: '/setting/documnet-type'
})
}
},
getList (params) {
requestAPI(api[`getList${this.t}${this.tt}`], params)
.then((res) => {
this.result.list = res.list
this.result.pagenation = res.pagenation
})
},
updatePage (pager) {
let ret = Object.assign({
page: this.pagenation.thispage
}, {page: pager.thispage})
this.getList(ret)
},
_reload () {
this.getList({page: this.pagenation.thispage})
},
// 6.1新增
add () {
this.$refs.formModal.show()
},
// 6.2编辑
editEvent (item) {
this.$refs.formModal.show(item)
},
deleteEvent (id) {
let deleteTip = '删除'
this.$confirm(`${deleteTip}?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
requestAPI(api[`delete${this.t}${this.tt}`], { id })
.then((res) => {
this.$message.success(`${deleteTip}成功`)
this._reload()
})
}).catch(() => {
this.$message.info(`取消${deleteTip}`)
})
},
searchClear () {}
}
}
</script>
<style scoped>
</style>
...@@ -10,6 +10,8 @@ import ImplementPositionList from '../components/setting_list/department_positio ...@@ -10,6 +10,8 @@ import ImplementPositionList from '../components/setting_list/department_positio
import ImplementListRoleList from '../components/setting_list/list_role/list_role_list' import ImplementListRoleList from '../components/setting_list/list_role/list_role_list'
import ImplementRatingList from '../components/setting_list/rating_strategy/rating_strategy_list' import ImplementRatingList from '../components/setting_list/rating_strategy/rating_strategy_list'
import ImplementTaxonomyTerm6List from '../components/setting_list/taxonomy_term_6/taxonomy_term_6' import ImplementTaxonomyTerm6List from '../components/setting_list/taxonomy_term_6/taxonomy_term_6'
import ImplementTaxonomyTerm7List from '../components/setting_list/taxonomy_term_7/taxonomy_term_7'
import ImplementDocumentTypeList from '../components/setting_list/document_type/document_type_list'
const routes = [{ const routes = [{
path: '/setting', path: '/setting',
name: 'settingIndex', name: 'settingIndex',
...@@ -55,8 +57,16 @@ const routes = [{ ...@@ -55,8 +57,16 @@ const routes = [{
name: 'implementRatingList', name: 'implementRatingList',
component: ImplementRatingList component: ImplementRatingList
}, { }, {
path: '/setting/taxonomy', path: '/setting/taxonomy/term/6',
name: 'implementTaxonomyTerm6List', name: 'implementTaxonomyTerm6List',
component: ImplementTaxonomyTerm6List component: ImplementTaxonomyTerm6List
}, {
path: '/setting/taxonomy/term/7',
name: 'implementTaxonomyTerm7List',
component: ImplementTaxonomyTerm7List
}, {
path: '/setting/documnet-type',
name: 'ImplementDocumentTypeList',
component: ImplementDocumentTypeList
}] }]
export default routes export default routes
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 to comment