层级数据
This commit is contained in:
@@ -8,26 +8,8 @@
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<!-- <el-form-item label="发布人" prop="publishUserName">-->
|
||||
<!-- <el-input v-model="formData.publishUserName" placeholder="请输入发布人" clearable :style="{width: '100%'}">-->
|
||||
<!-- </el-input>-->
|
||||
<!-- </el-form-item>-->
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<!-- <el-col :span="6">-->
|
||||
<!-- <el-form-item label="文章类型" prop="type">-->
|
||||
<!-- <el-select v-model="formData.type" placeholder="请选择文章类型" clearable :style="{width: '100%'}">-->
|
||||
<!-- <el-option-->
|
||||
<!-- v-for="dict in articleTypeOptions"-->
|
||||
<!-- :key="dict.dictValue"-->
|
||||
<!-- :label="dict.dictLabel"-->
|
||||
<!-- :value="dict.dictValue"-->
|
||||
<!-- />-->
|
||||
<!-- </el-select>-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- </el-col>-->
|
||||
<el-col :span="8">
|
||||
<el-form-item label="是否顶置" prop="isTop">
|
||||
<el-radio-group v-model="formData.isTop">
|
||||
@@ -56,57 +38,70 @@
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row v-show="sistArticleTypeOption.length>0 && approveShow.sist">
|
||||
<el-col :span="6">
|
||||
<el-form-item label="信息网站">
|
||||
<el-select v-model="params.sistArticleType" @change="getSistApprove(params.sistArticleType)"
|
||||
placeholder="请选择文章类型" clearable :style="{width: '100%'}">
|
||||
<el-option
|
||||
v-for="dict in sistArticleTypeOption"
|
||||
:key="dict.dictCode"
|
||||
:label="dict.dictLabel"
|
||||
:value="dict.dictCode"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-row v-show="sistArticleTypeOption.length>0 && approveShow.sist">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="信息网站">
|
||||
<el-select v-model="params.sistArticleType" @change="getSistApprove(params.sistArticleType)"
|
||||
placeholder="请选择文章类型" clearable :style="{width: '100%'}">
|
||||
<el-option
|
||||
v-for="dict in sistArticleTypeOption"
|
||||
:key="dict.dictCode"
|
||||
:label="dict.dictLabel"
|
||||
:value="dict.dictCode"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="审批人">
|
||||
<el-select v-model="params.sistApprove" placeholder="请选择文章类型" clearable :style="{width: '100%'}">
|
||||
<el-option
|
||||
v-for="dict in sistApproveOption"
|
||||
:key="dict.userId"
|
||||
:label="dict.userName"
|
||||
:value="dict.userId"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row v-show="labArticleTypeOption.length>0 && approveShow.lab">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="实验室网站">
|
||||
<el-select v-model="params.labArticleType" placeholder="请选择文章类型"
|
||||
@change="getLabApprove(params.labArticleType)" clearable :style="{width: '100%'}">
|
||||
<el-option
|
||||
v-for="dict in labArticleTypeOption"
|
||||
:key="dict.dictCode"
|
||||
:label="dict.dictLabel"
|
||||
:value="dict.dictCode"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="审批人">
|
||||
<el-select v-model="params.labApprove" placeholder="请选择文章类型" clearable :style="{width: '100%'}">
|
||||
<el-option
|
||||
v-for="dict in labApproveOption"
|
||||
:key="dict.userId"
|
||||
:label="dict.userName"
|
||||
:value="dict.userId"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<el-form-item label="审批人">
|
||||
<el-select v-model="params.sistApprove" placeholder="请选择文章类型" clearable :style="{width: '100%'}">
|
||||
<el-option
|
||||
v-for="dict in sistApproveOption"
|
||||
:key="dict.userId"
|
||||
:label="dict.userName"
|
||||
:value="dict.userId"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row v-show="labArticleTypeOption.length>0 && approveShow.lab">
|
||||
<el-col :span="6">
|
||||
<el-form-item label="实验室网站">
|
||||
<el-select v-model="params.labArticleType" placeholder="请选择文章类型"
|
||||
@change="getLabApprove(params.labArticleType)" clearable :style="{width: '100%'}">
|
||||
<el-option
|
||||
v-for="dict in labArticleTypeOption"
|
||||
:key="dict.dictCode"
|
||||
:label="dict.dictLabel"
|
||||
:value="dict.dictCode"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<el-form-item label="审批人">
|
||||
<el-select v-model="params.labApprove" placeholder="请选择文章类型" clearable :style="{width: '100%'}">
|
||||
<el-option
|
||||
v-for="dict in labApproveOption"
|
||||
:key="dict.userId"
|
||||
:label="dict.userName"
|
||||
:value="dict.userId"
|
||||
/>
|
||||
</el-select>
|
||||
<el-col :span="12" v-show="imgurlShow">
|
||||
<el-form-item >
|
||||
<UploadFile v-model="formData.imgurl"
|
||||
file-type="image"
|
||||
:v-public="true"
|
||||
:v-data="false"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
@@ -130,21 +125,25 @@
|
||||
import Editor from '@/components/Editor';
|
||||
import {updateArticle, getArticle, drafts, getArticleType, getArticleApprove} from "@/api/sist/article";
|
||||
import {Message} from "element-ui";
|
||||
import UploadFile from '@/views/utils/uploadFile.vue';
|
||||
|
||||
export default {
|
||||
components: {
|
||||
Editor,
|
||||
UploadFile
|
||||
},
|
||||
props: [],
|
||||
data() {
|
||||
return {
|
||||
submit: 1,
|
||||
imgurlShow:false,
|
||||
formData: {
|
||||
id: null,
|
||||
title: null,
|
||||
isTop: null,
|
||||
isEnglish: null,
|
||||
content: "",
|
||||
imgurl:null,
|
||||
},
|
||||
approveShow: {
|
||||
sist: true,
|
||||
@@ -186,6 +185,11 @@ export default {
|
||||
message: '请选择是否显示',
|
||||
trigger: 'change'
|
||||
}],
|
||||
imgurl: [{
|
||||
required: true,
|
||||
message: '请选择是否显示',
|
||||
trigger: 'change'
|
||||
}],
|
||||
sitetype: [{
|
||||
required: true,
|
||||
message: '单选框组不能为空',
|
||||
@@ -244,7 +248,6 @@ export default {
|
||||
getArticleType().then(res => {
|
||||
let dictCodes = res.data
|
||||
let articleList = this.articleTypeOptions
|
||||
console.log(articleList, dictCodes);
|
||||
for (let i = 0; i < articleList.length; i++) {
|
||||
for (let j = 0; j < dictCodes.length; j++) {
|
||||
if (articleList[i].dictCode === dictCodes[j]) {
|
||||
@@ -262,58 +265,76 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
getSistApprove(dictCode) {
|
||||
this.judgeThumbnail(dictCode)
|
||||
getArticleApprove(dictCode).then(res => {
|
||||
this.sistApproveOption = res.data
|
||||
})
|
||||
|
||||
},
|
||||
getLabApprove(dictCode) {
|
||||
this.judgeThumbnail(dictCode)
|
||||
getArticleApprove(dictCode).then(res => {
|
||||
this.labApproveOption = res.data
|
||||
})
|
||||
},
|
||||
judgeThumbnail(dictCode){
|
||||
let articleList = this.articleTypeOptions
|
||||
for (let article of articleList) {
|
||||
if (dictCode === article.dictCode && article.attribute1 == 1){
|
||||
this.imgurlShow = true
|
||||
return
|
||||
}
|
||||
}
|
||||
},
|
||||
submitForm() {
|
||||
let that_ = this
|
||||
this.$refs['elForm'].validate(valid => {
|
||||
if (valid) {
|
||||
if ((this.params.sistArticleType === null || this.params.sistArticleType === "") && (this.params.labArticleType === null || this.params.labArticleType === "")) {
|
||||
if ((that_.params.sistArticleType === null || that_.params.sistArticleType === "") && (that_.params.labArticleType === null || that_.params.labArticleType === "")) {
|
||||
Message({
|
||||
message: "请至少选择一个网站发布文章",
|
||||
type: "error",
|
||||
})
|
||||
this.msgSuccess("请至少选择一个网站发布文章")
|
||||
return
|
||||
} else if ((this.params.sistArticleType === null || this.params.sistArticleType === "") && (this.params.labArticleType !== null || this.params.labArticleType !== "") && (this.formData.sistApprove === null || this.params.sistApprove === "")) {
|
||||
} else if ((that_.params.sistArticleType === null || that_.params.sistArticleType === "") && (that_.params.labArticleType !== null || that_.params.labArticleType !== "") && (that_.formData.sistApprove === null || that_.params.sistApprove === "")) {
|
||||
Message({
|
||||
message: "请选择信息网站的审批人",
|
||||
type: "error",
|
||||
})
|
||||
return
|
||||
} else if ((this.params.sistArticleType === null || this.params.sistArticleType === "") && (this.params.labArticleType != null || this.params.labArticleType !== "") && (this.params.labApprove === null || this.params.labApprove === "")) {
|
||||
} else if ((that_.params.sistArticleType === null || that_.params.sistArticleType === "") && (that_.params.labArticleType != null || that_.params.labArticleType !== "") && (that_.params.labApprove === null || that_.params.labApprove === "")) {
|
||||
Message({
|
||||
message: "请选择实验室网站的审批人",
|
||||
type: "error",
|
||||
})
|
||||
return
|
||||
}
|
||||
if (that_.imgurlShow&&(that_.formData.imgurl == ''||that_.formData.imgurl == null)){
|
||||
Message({
|
||||
message: "请选择缩略图",
|
||||
type: "error",
|
||||
})
|
||||
return;
|
||||
}
|
||||
}
|
||||
this.formData.params = this.params
|
||||
if (this.submit == 0) {
|
||||
that_.formData.params = that_.params
|
||||
if (that_.submit == 0) {
|
||||
Message({
|
||||
message: "您操作过快",
|
||||
type: "error",
|
||||
})
|
||||
} else {
|
||||
this.submit = 0
|
||||
this.loading = true;
|
||||
updateArticle(this.formData).then(response => {
|
||||
this.loading = false;
|
||||
that_.submit = 0
|
||||
that_.loading = true;
|
||||
// this.formData.imgurl = this.form.imgurl.url
|
||||
updateArticle(that_.formData).then(response => {
|
||||
that_.loading = false;
|
||||
if (response.code == 200) {
|
||||
this.msgSuccess("提交审批成功");
|
||||
this.submit = 1
|
||||
this.close();
|
||||
that_.msgSuccess("提交审批成功");
|
||||
that_.submit = 1
|
||||
that_.close();
|
||||
}
|
||||
}).catch(e => {
|
||||
this.submit = 1
|
||||
that_.submit = 1
|
||||
});
|
||||
}
|
||||
// TODO 提交表单
|
||||
|
||||
@@ -121,7 +121,11 @@
|
||||
<el-table-column label="是否置顶" align="center" prop="isTop" :formatter="isTopFormat"/>
|
||||
<el-table-column label="是否显示" align="center" prop="isView" :formatter="isViewFormat"/>
|
||||
<el-table-column label="查看次数" align="center" prop="viewCount"/>
|
||||
<el-table-column label="缩略图" align="center" prop="imgurl"/>
|
||||
<el-table-column label="缩略图" align="center" prop="imgurl">
|
||||
<template slot-scope="scope">
|
||||
<img style="width: 100%;" :src="scope.row.imgurl" alt="">
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="是否英文" align="center" prop="isEnglish" :formatter="isEnglishFormat"/>
|
||||
<el-table-column label="状态" align="center" prop="status" :formatter="statusFormat"/>
|
||||
<!-- <template slot-scope="scope">-->
|
||||
@@ -200,7 +204,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {listArticle, delArticle, exportArticle,offline} from "@/api/sist/article";
|
||||
import {listArticle, delArticle, exportArticle, offline} from "@/api/sist/article";
|
||||
import Editor from '@/components/Editor';
|
||||
import store from "@/store";
|
||||
|
||||
@@ -311,7 +315,7 @@ export default {
|
||||
this.statusOptions = response.data;
|
||||
});
|
||||
},
|
||||
activated(){
|
||||
activated() {
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
@@ -381,7 +385,7 @@ export default {
|
||||
handleApprova(row) {
|
||||
this.$router.push("/article/approve/" + row.id);
|
||||
},
|
||||
handleOffline(row){
|
||||
handleOffline(row) {
|
||||
let that_ = this
|
||||
this.$confirm('是否确认下线标题为:"' + row.title + '"的数据项?', "警告", {
|
||||
confirmButtonText: "确定",
|
||||
@@ -390,8 +394,8 @@ export default {
|
||||
}).then(function () {
|
||||
that_.loading = true;
|
||||
return offline(row.id);
|
||||
}).then(res=>{
|
||||
if (res.code==200){
|
||||
}).then(res => {
|
||||
if (res.code == 200) {
|
||||
this.msgSuccess("下线成功");
|
||||
this.getList()
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="缩略图" prop="status">
|
||||
<el-form-item label="缩略图" prop="attribute1">
|
||||
<el-select v-model="queryParams.attribute1" placeholder="数据状态" clearable size="small">
|
||||
<el-option
|
||||
v-for="dict in attribute1Options"
|
||||
@@ -20,7 +20,7 @@
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="网站类型" prop="status">
|
||||
<el-form-item label="网站类型" prop="attribute2">
|
||||
<el-select v-model="queryParams.attribute2" placeholder="数据状态" clearable size="small">
|
||||
<el-option
|
||||
v-for="dict in attribute2Options"
|
||||
@@ -30,16 +30,16 @@
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="状态" prop="status">
|
||||
<el-select v-model="queryParams.status" placeholder="数据状态" clearable size="small">
|
||||
<el-option
|
||||
v-for="dict in statusOptions"
|
||||
:key="dict.dictValue"
|
||||
:label="dict.dictLabel"
|
||||
:value="dict.dictValue"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="状态" prop="status">-->
|
||||
<!-- <el-select v-model="queryParams.status" placeholder="数据状态" clearable size="small">-->
|
||||
<!-- <el-option-->
|
||||
<!-- v-for="dict in statusOptions"-->
|
||||
<!-- :key="dict.dictValue"-->
|
||||
<!-- :label="dict.dictLabel"-->
|
||||
<!-- :value="dict.dictValue"-->
|
||||
<!-- />-->
|
||||
<!-- </el-select>-->
|
||||
<!-- </el-form-item>-->
|
||||
<el-form-item>
|
||||
<el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||
@@ -98,7 +98,7 @@
|
||||
<el-table-column label="网站类型" align="center" prop="attribute2" :formatter="attribute2Format" />
|
||||
<el-table-column label="类型名" align="center" prop="dictLabel" />
|
||||
<el-table-column label="类型排序" align="center" prop="dictSort" />
|
||||
<el-table-column label="状态" align="center" prop="status" :formatter="statusFormat" />
|
||||
<!-- <el-table-column label="状态" align="center" prop="status" :formatter="statusFormat" />-->
|
||||
<el-table-column label="缩略图" align="center" prop="attribute1" :formatter="attribute1Format" />
|
||||
<el-table-column label="备注" align="center" prop="remark" :show-overflow-tooltip="true" />
|
||||
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
|
||||
@@ -163,15 +163,15 @@
|
||||
>{{dict.dictLabel}}</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="状态" prop="status">
|
||||
<el-radio-group v-model="form.status">
|
||||
<el-radio
|
||||
v-for="dict in statusOptions"
|
||||
:key="dict.dictValue"
|
||||
:label="dict.dictValue"
|
||||
>{{dict.dictLabel}}</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="状态" prop="status">-->
|
||||
<!-- <el-radio-group v-model="form.status">-->
|
||||
<!-- <el-radio-->
|
||||
<!-- v-for="dict in statusOptions"-->
|
||||
<!-- :key="dict.dictValue"-->
|
||||
<!-- :label="dict.dictValue"-->
|
||||
<!-- >{{dict.dictLabel}}</el-radio>-->
|
||||
<!-- </el-radio-group>-->
|
||||
<!-- </el-form-item>-->
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容"></el-input>
|
||||
</el-form-item>
|
||||
@@ -327,6 +327,8 @@ export default {
|
||||
const dictCode = row.dictCode || this.ids
|
||||
getData(dictCode).then(response => {
|
||||
this.form = response.data;
|
||||
this.form.attribute1 +=""
|
||||
this.form.attribute2 +=""
|
||||
this.open = true;
|
||||
this.title = "修改文章类型";
|
||||
});
|
||||
|
||||
@@ -86,7 +86,7 @@
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="序号" type="index" align="center">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ ((queryParams.pageInfo.pageNum - 1) * queryParams.pageInfo.pageSize + scope.$index + 1)}}</span>
|
||||
<span>{{ ((queryParams.pageInfo.pageNum - 1) * queryParams.pageInfo.pageSize + scope.$index + 1)}}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="标题" align="center" prop="title" />
|
||||
@@ -330,7 +330,7 @@ export default {
|
||||
submitForm() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (valid) {
|
||||
this.form.imgurl = this.form.imgurl.url
|
||||
// this.form.imgurl = this.form.imgurl.url
|
||||
if (this.form.id != null) {
|
||||
updateBanner(this.form).then(response => {
|
||||
this.msgSuccess("修改成功");
|
||||
|
||||
285
ebts-ui/src/views/sist/dire/direData.vue
Normal file
285
ebts-ui/src/views/sist/dire/direData.vue
Normal file
@@ -0,0 +1,285 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form-item label="名称" prop="name">
|
||||
<el-input
|
||||
v-model="queryParams.name"
|
||||
placeholder="请输入名称"
|
||||
clearable
|
||||
size="small"
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="primary"
|
||||
plain
|
||||
icon="el-icon-plus"
|
||||
size="mini"
|
||||
@click="handleAdd"
|
||||
v-hasPermi="['test:emplee:add']"
|
||||
>新增</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table
|
||||
v-loading="loading"
|
||||
:data="empleeList"
|
||||
row-key="id"
|
||||
default-expand-all
|
||||
:tree-props="{children: 'children', hasChildren: 'hasChildren'}"
|
||||
>
|
||||
<el-table-column label="名称" align="center" prop="name" />
|
||||
<el-table-column label="层" align="center" prop="level" />
|
||||
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d} {h}:{m}:{s}') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="更新时间" align="center" prop="updateTime" width="180">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ parseTime(scope.row.updateTime, '{y}-{m}-{d} {h}:{m}:{s}') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-edit"
|
||||
@click="handleUpdate(scope.row)"
|
||||
v-hasPermi="['test:emplee:edit']"
|
||||
>修改</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
v-hasPermi="['test:emplee:remove']"
|
||||
>删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<!-- 添加或修改层级结构对话框 -->
|
||||
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||
<el-form-item label="上级" prop="pid">
|
||||
<treeselect v-model="form.pid" :options="empleeOptions" :normalizer="normalizer" placeholder="请选择父id" />
|
||||
</el-form-item>
|
||||
<el-form-item label="层" prop="level">
|
||||
<el-input v-model="form.level" placeholder="请输入层" />
|
||||
</el-form-item>
|
||||
<el-form-item label="名称" prop="name">
|
||||
<el-input v-model="form.name" placeholder="请输入名称" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listEmplee, getEmplee, delEmplee, addEmplee, updateEmplee, exportEmplee } from "@/api/test/emplee";
|
||||
import Treeselect from "@riophae/vue-treeselect";
|
||||
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
|
||||
|
||||
export default {
|
||||
name: "Emplee",
|
||||
components: {
|
||||
Treeselect
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
direId: this.$route.params && this.$route.params.direId,
|
||||
siteType: this.$route.params && this.$route.params.siteType,
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 层级结构表格数据
|
||||
empleeList: [],
|
||||
// 层级结构树选项
|
||||
empleeOptions: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 站点类型字典
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
type: null,
|
||||
name: null,
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {
|
||||
}
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
/** 查询层级结构列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
this.queryParams.type = this.direId
|
||||
this.queryParams.siteType = this.siteType
|
||||
listEmplee(this.queryParams).then(response => {
|
||||
this.loading = false;
|
||||
this.empleeList = this.handleTree(response.data, "id", "pid");
|
||||
});
|
||||
},
|
||||
/** 转换层级结构数据结构 */
|
||||
normalizer(node) {
|
||||
if (node.children && !node.children.length) {
|
||||
delete node.children;
|
||||
}
|
||||
return {
|
||||
id: node.id,
|
||||
label: node.name,
|
||||
children: node.children
|
||||
};
|
||||
},
|
||||
/** 查询部门下拉树结构 */
|
||||
getTreeselect() {
|
||||
listEmplee({type:this.direId,siteType:this.siteType,}).then(response => {
|
||||
console.log(response)
|
||||
this.empleeOptions = [];
|
||||
const data = { id: 0, name: '顶级节点', children: [] };
|
||||
if (response.code == 200){
|
||||
data.children = this.handleTree(response.data, "id", "pid");
|
||||
}
|
||||
this.empleeOptions.push(data);
|
||||
});
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
},
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.form = {
|
||||
id: null,
|
||||
siteType: null,
|
||||
pid: null,
|
||||
type: null,
|
||||
level: null,
|
||||
name: null,
|
||||
createBy: null,
|
||||
createTime: null,
|
||||
updateBy: null,
|
||||
updateTime: null
|
||||
};
|
||||
this.resetForm("form");
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.getList();
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
this.reset();
|
||||
this.getTreeselect();
|
||||
this.open = true;
|
||||
this.title = "添加层级结构";
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.reset();
|
||||
this.getTreeselect();
|
||||
if (row != null) {
|
||||
this.form.pid = row.id;
|
||||
}
|
||||
getEmplee(row.id).then(response => {
|
||||
this.form = response.data;
|
||||
this.open = true;
|
||||
this.title = "修改层级结构";
|
||||
});
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (valid) {
|
||||
this.form.type = this.direId
|
||||
this.form.siteType = this.siteType
|
||||
if (this.form.id != null) {
|
||||
updateEmplee(this.form).then(response => {
|
||||
this.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
} else {
|
||||
addEmplee(this.form).then(response => {
|
||||
this.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
this.$confirm('是否确认删除层级结构编号为"' + row.id + '"的数据项?', "警告", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
}).then(function() {
|
||||
return delEmplee(row.id);
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.msgSuccess("删除成功");
|
||||
})
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
|
||||
<!--<template>-->
|
||||
<!-- <div>-->
|
||||
<!-- {{ direId }}-->
|
||||
<!-- </div>-->
|
||||
<!--</template>-->
|
||||
|
||||
<!--<script>-->
|
||||
<!--export default {-->
|
||||
<!-- name: "direData",-->
|
||||
<!-- data() {-->
|
||||
<!-- return {-->
|
||||
<!-- direId: this.$route.params && this.$route.params.direId,-->
|
||||
<!-- }-->
|
||||
<!-- },-->
|
||||
<!-- created() {-->
|
||||
<!-- let direId = this.$route.params && this.$route.params.direId;-->
|
||||
<!-- console.log(direId)-->
|
||||
|
||||
<!-- }-->
|
||||
<!--}-->
|
||||
<!--</script>-->
|
||||
|
||||
<!--<style scoped>-->
|
||||
|
||||
<!--</style>-->
|
||||
@@ -1,10 +1,10 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form-item label="名录类型" prop="dictLabel">
|
||||
<el-form-item label="层级数据" prop="dictLabel">
|
||||
<el-input
|
||||
v-model="queryParams.dictLabel"
|
||||
placeholder="请输入名录类型"
|
||||
placeholder="请输入层级数据"
|
||||
clearable
|
||||
size="small"
|
||||
@keyup.enter.native="handleQuery"
|
||||
@@ -84,10 +84,16 @@
|
||||
|
||||
<el-table v-loading="loading" :data="dataList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="名录类型编码" align="center" prop="dictCode" />
|
||||
<!-- <el-table-column label="层级数据编码" align="center" prop="dictCode" />-->
|
||||
<el-table-column label="网站类型" align="center" prop="attribute2" :formatter="attribute2Format" />
|
||||
<el-table-column label="名录类型" align="center" prop="dictLabel" />
|
||||
<el-table-column label="名录类型排序" align="center" prop="dictSort" />
|
||||
<el-table-column label="层级数据" align="center" prop="dictLabel" >
|
||||
<template slot-scope="scope">
|
||||
<router-link :to="'/dire/data/' + scope.row.dictValue+'/'+scope.row.cssClass" class="link-type">
|
||||
<span>{{ scope.row.dictLabel }}</span>
|
||||
</router-link>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="层级数据排序" align="center" prop="dictSort" />
|
||||
<el-table-column label="状态" align="center" prop="status" :formatter="statusFormat" />
|
||||
<el-table-column label="备注" align="center" prop="remark" :show-overflow-tooltip="true" />
|
||||
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
|
||||
@@ -128,7 +134,7 @@
|
||||
<!-- 添加或修改参数配置对话框 -->
|
||||
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||
<el-form-item label="名录类型" prop="dictLabel">
|
||||
<el-form-item label="层级数据" prop="dictLabel">
|
||||
<el-input v-model="form.dictLabel" placeholder="请输入数据" />
|
||||
</el-form-item>
|
||||
<el-form-item label="显示排序" prop="dictSort">
|
||||
@@ -206,7 +212,7 @@ export default {
|
||||
// 表单校验
|
||||
rules: {
|
||||
dictLabel: [
|
||||
{ required: true, message: "名录类型不能为空", trigger: "blur" }
|
||||
{ required: true, message: "层级数据不能为空", trigger: "blur" }
|
||||
],
|
||||
attribute2: [
|
||||
{ required: true, message: "网站类型不能为空", trigger: "blur" }
|
||||
@@ -277,7 +283,7 @@ export default {
|
||||
handleAdd() {
|
||||
this.reset();
|
||||
this.open = true;
|
||||
this.title = "添加名录类型";
|
||||
this.title = "添加层级数据";
|
||||
this.form.dictType = this.queryParams.dictType;
|
||||
},
|
||||
// 多选框选中数据
|
||||
@@ -293,7 +299,7 @@ export default {
|
||||
getData(dictCode).then(response => {
|
||||
this.form = response.data;
|
||||
this.open = true;
|
||||
this.title = "修改名录类型";
|
||||
this.title = "修改层级数据";
|
||||
});
|
||||
},
|
||||
/** 提交按钮 */
|
||||
|
||||
Reference in New Issue
Block a user