master
lion 1 year ago
parent 62081d00ff
commit d67ccfe548

@ -3,5 +3,5 @@ ENV='development'
# base api
VUE_APP_BASE_API=http://sstt-dangan.ali251.langye.net
VUE_APP_UPLOAD_API=http://sstt-dangan.ali251.langye.net
VUE_APP_UPLOAD_API=http://sstt-dangan.ali251.langye.net/api/admin/upload-file
VUE_APP_PREVIEW_API=http://view.ali251.langye.net:8012/onlinePreview

@ -3,5 +3,5 @@ ENV = 'production'
# base api
VUE_APP_BASE_API = http://sstt-dangan.ali251.langye.net
VUE_APP_UPLOAD_API =http://sstt-dangan.ali251.langye.net
VUE_APP_UPLOAD_API =http://sstt-dangan.ali251.langye.net/api/admin/upload-file
VUE_APP_PREVIEW_API=http://view.ali251.langye.net:8012/onlinePreview

@ -1,4 +1,7 @@
let base = {
let base = {
isNull(p){
return p == '' || p == undefined || p == null || p == 'undefined' || p == 'null';
},
isPhone(val) {
return /^[1][3,4,5,6,7,8,9][0-9]{9}$/.test(val)
},

@ -59,8 +59,7 @@
name: '',
table_name: 'catalogs',
page: 1,
page_size: 999,
page_size: 999,
},
list: [],
table_item: [{

@ -0,0 +1,274 @@
<template>
<div>
<xy-dialog ref="dialog" :width="60" :is-show.sync="isShow" :type="'form'" :title="'档案信息'" :form="form"
:rules='rules' @submit="submit">
<template v-slot:title>
<div class="xy-table-item">
<div class="xy-table-item-label" style="font-weight: bold">
<span style="color: red;font-weight: bold;padding-right: 4px;">*</span>标题
</div>
<div class="xy-table-item-content">
<el-input placeholder="请输入标题" style="width:100%" v-model="form.title"></el-input>
</div>
</div>
</template>
<template v-slot:date>
<div class="xy-table-item">
<div class="xy-table-item-label" style="font-weight: bold">
<span style="color: red;font-weight: bold;padding-right: 4px;"></span>发布日期
</div>
<div class="xy-table-item-content">
<el-date-picker v-model="form.date" style="width:100%" format="yyyy-MM-dd" value-format="yyyy-MM-dd"
type="date" placeholder="选择日期">
</el-date-picker>
</div>
</div>
</template>
<template v-slot:catalog_id>
<div class="xy-table-item">
<div class="xy-table-item-label" style="font-weight: bold">
<span style="color: red;font-weight: bold;padding-right: 4px;">*</span>所属目录
</div>
<div class="xy-table-item-content" style="height:150px;overflow: scroll;">
<el-tree v-if="isShow" :default-checked-keys="checkArr" :check-strictly="true" @check="getSelectedNodes"
:data="catalogList" show-checkbox default-expand-all node-key="id" ref="tree" highlight-current
:props="defaultProps">
</el-tree>
</div>
</div>
</template>
<template v-slot:files>
<div class="xy-table-item">
<div class="xy-table-item-label" style="font-weight: bold">
<span style="color: red;font-weight: bold;padding-right: 4px;"></span>附件
</div>
<div class="xy-table-item-content">
<el-upload :action="action" class='upload-demo' multiple :file-list="filesList" ref="pictureUpload"
:auto-upload="true" :data="uploadOther" :on-success="handlesuccess"
:on-remove="handleRemove">
<el-button size="small" type="primary">点击上传</el-button>
</el-upload>
</div>
</div>
</template>
<template v-slot:content>
<div class="xy-table-item">
<div class="xy-table-item-label" style="font-weight: bold">
<span style="color: red;font-weight: bold;padding-right: 4px;"></span>内容
</div>
<div class="xy-table-item-content">
<my-tinymce v-if="showTinymce" @input="saveContent" :value="form.content"></my-tinymce>
</div>
</div>
</template>
</xy-dialog>
</div>
</template>
<script>
import {
save,
show,
index
} from "@/api/system/baseForm.js"
import {
deepCopy,
isNull
} from "@/utils";
import {
getToken
} from '@/utils/auth'
export default {
components: {
},
data() {
return {
isShow: false,
id: '',
showTinymce: false,
catalogList: [],
checkArr: [],
defaultProps: {
children: 'children',
label: 'name'
},
table_name: 'records',
uploadOther: {
token: ""
},
action: `${process.env.VUE_APP_UPLOAD_API}`,
filesList: [],
form: {
title: '',
date: '',
catalog_id: '',
catalog_name: '',
files: [],
content: '',
},
rules: {
title: [{
required: true,
message: '请输入标题'
}],
// catalog_id: [{
// required: true,
// message: ''
// }],
}
}
},
created() {
this.uploadOther.token = getToken();
this.getCatalogList()
},
methods: {
async getCatalogList() {
const res = await index({
page_size: 999,
page: 1,
sort_type: 'ASC',
sort_name: 'sort',
table_name: 'catalogs',
})
if (res.data.length > 0) {
this.catalogList = this.base.buildTree(res.data)
}
},
getSelectedNodes(data, node) {
console.log("data", data)
this.$refs.tree.setCheckedKeys([]); //
this.$refs.tree.setCheckedNodes([data]); //
this.form.catalog_name = data.name
this.form.catalog_id = data.id
this.$forceUpdate()
},
handleRemove(file, fileList) {
this.filesList = fileList
},
handlesuccess(response, file, fileList) {
this.filesList = fileList
},
saveContent(e) {
this.form.content = e
},
submit() {
if (this.id) {
this.form.id = this.id
} else {
this.form.id = ''
}
if(this.base.isNull(this.form.catalog_id)){
this.$Message.warning("请选择所属目录")
return
}
let _files = []
if (this.filesList.length > 0) {
for (var h of this.filesList) {
if (h.response) {
_files.push(h.response.id)
} else {
_files.push(h.id)
}
}
this.form.files = _files
} else {
this.form.files = []
}
console.log("this.form", this.form)
// return
save({
table_name: this.table_name,
...this.form
}).then(res => {
this.$message({
type: 'success',
message: '授权成功'
})
this.isShow = false
this.$emit('refresh')
})
},
getDetail() {
show({
id: this.id,
table_name: this.table_name,
}).then(res => {
this.form = this.base.requestToForm(res,this.form)
this.checkArr = res.catalog_id ? [res.catalog_id] : []
if(res.files_upload_details && res.files_upload_details.length>0){
this.filesList = []
res.files_upload_details.map(item=>{
this.filesList.push({
name:item.original_name,
id:item.id,
url:item.url
})
})
}
this.showTinymce = true
console.log("this.form", this.form)
})
}
},
watch: {
isShow(newVal) {
if (newVal) {
if (this.type === 'editor') {
this.getDetail()
} else {
this.showTinymce = true
}
} else {
this.id = ''
this.showTinymce = false
this.checkArr = []
this.filesList = []
this.form = {
title: '',
date: '',
catalog_id: '',
catalog_name: '',
files: [],
content: '',
}
this.$refs['dialog'].reset()
}
},
}
}
</script>
<style scoped lang="scss">
::v-deep .title,
::v-deep .date,
::v-deep .catalog_id,
::v-deep .content,
::v-deep .files,
{
flex-basis: 100%;
}
::v-deep .catalog_id .xy-table-item {
align-items: flex-start;
}
::v-deep .xy-table-item-content {
width: calc(100% - 140px);
}
::v-deep .el-checkbox__input .el-checkbox__inner {
border-radius: 50%;
}
</style>

@ -0,0 +1,212 @@
<template>
<div>
<div>
<div ref="lxHeader">
<lx-header icon="md-apps" :text="$route.meta.title" style="margin-bottom: 10px; border: 0px; margin-top: 15px">
<div slot="content">
<div class="searchwrap" style="display: flex;align-items: center;">
<div>
<el-input v-model="select.name" placeholder="请输入名称"></el-input>
</div>
<div>
<el-button type="primary" size="small" @click="select.page=1,getList()"></el-button>
</div>
<div>
<el-button type="primary" size="small" @click="editIndex('add')"></el-button>
</div>
</div>
</div>
</lx-header>
</div>
</div>
<div class="catalog">
<div class="catalog_left">
<el-tree @node-click="getSelectedNodes" :data="catalogList" default-expand-all node-key="id" ref="tree"
highlight-current :props="defaultProps">
</el-tree>
</div>
<div class="catalog_right">
<xy-table :list="list" :total="total" @pageIndexChange="pageIndexChange" @pageSizeChange="pageSizeChange"
:table-item="table_item">
<template v-slot:btns>
<el-table-column align='center' label="操作" width="240" header-align="center">
<template slot-scope="scope">
<!-- <el-button type="primary" size="small" @click="editIndex('child',scope.row.id,scope.row.name)"></el-button> -->
<el-button type="primary" size="small" @click="editIndex('editor',scope.row.id)"></el-button>
<el-popconfirm style="margin:0 10px" @confirm="deleteList(scope.row.id)" title="确定删除吗?">
<el-button type="danger" size="small" slot="reference">删除</el-button>
</el-popconfirm>
</template>
</el-table-column>
</template>
</xy-table>
</div>
</div>
<add-record ref="addRecord" @refresh="getList"></add-record>
</div>
</template>
<script>
import addRecord from './components/addRecord.vue';
import {
index,
destroy
} from "@/api/system/baseForm.js"
export default {
components: {
addRecord
},
data() {
return {
select: {
title: '',
table_name: 'records',
page: 1,
page_size: 10,
catalog_id: ''
},
total: 0,
list: [],
defaultProps: {
children: 'children',
label: 'name'
},
catalogList: [],
table_item: [{
type: 'index',
width: 50
}, {
prop: 'title',
label: '标题',
align: 'left',
},
// {
// prop: 'catalog_name',
// label: '',
// align: 'left',
// },
{
prop: 'date',
label: '发布日期',
align: 'center',
width: 120
}
]
}
},
created() {
//
this.getCatalogList()
this.getList()
},
methods: {
async getCatalogList() {
const res = await index({
page_size: 999,
page: 1,
sort_type: 'ASC',
sort_name: 'sort',
table_name: 'catalogs'
})
if (res.data.length > 0) {
this.catalogList = this.base.buildTree(res.data)
}
},
getSelectedNodes(data, node, self) {
node.expanded = true
this.select.catalog_id = data.id
this.select.page = 1
this.getList()
},
editIndex(type, id, pName) {
if (type == 'editor') {
this.$refs.addRecord.id = id
}
this.$refs.addRecord.type = type
this.$refs.addRecord.isShow = true
},
pageIndexChange(e) {
this.select.page = e
this.getList()
},
pageSizeChange(e) {
this.select.page_size = e
this.select.page = 1
this.getList()
},
async getList() {
const res = await index({
page_size: this.select.page_size,
page: this.select.page,
table_name: this.select.table_name,
filter: [{
"key": "title",
"op": "like",
"value": this.select.title
}, {
key: 'catalog_id',
op: 'eq',
value: this.select.catalog_id
}]
})
this.list = res.data
this.total = res.total
},
deleteList(id) {
var that = this;
destroy({
id: id,
table_name: this.select.table_name
}).then(response => {
this.$Message.success('操作成功');
this.getList()
}).catch(error => {
console.log(error)
reject(error)
})
},
}
}
</script>
<style lang="scss" scoped>
.searchwrap {
display: flex;
align-items: center;
&>div {
display: flex;
align-items: center;
margin-right: 10px;
span {
min-width: 70px;
}
}
}
.catalog {
display: flex;
// align-items: center;
justify-content: space-between;
&_left {
width: 30%;
background: #fff;
padding:10px;
}
&_right {
width: 68%
}
}
</style>

@ -25,7 +25,7 @@ module.exports = {
* Detail: https://cli.vuejs.org/config/#publicpath
*/
publicPath: process.env.ENV === 'staging' ? '/admin_test' : '/admin',
outputDir: '/Users/mac/Documents/朗业/2024/s-四世同堂-档案/sstt_dangan/public',
outputDir: '/Users/mac/Documents/朗业/2024/s-四世同堂-档案/sstt_dangan/public/admin',
assetsDir: 'static',
css: {
loaderOptions: { // 向 CSS 相关的 loader 传递选项

Loading…
Cancel
Save