flat: 6.5 改版

This commit is contained in:
Apcallover
2024-06-05 14:47:10 +08:00
parent b2fabc9000
commit 892bf6ed84
22 changed files with 4201 additions and 1376 deletions

View File

@@ -1,34 +0,0 @@
<template>
<el-drawer
size="70%"
append-to-body
:title="title"
:visible.sync="drawer"
:wrapperClosable="false"
:close-on-click-modal="false"
:close-on-press-escape="false"
@closed="closed"
>
</el-drawer>
</template>
<script>
export default {
data() {
return {
drawer: false,
title: '服务详情'
}
},
methods: {
onLoad() {
this.drawer = true;
},
closed() {
}
}
}
</script>

View File

@@ -0,0 +1,423 @@
<template>
<!-- 新建分组模板 -->
<el-dialog
:title="title"
append-to-body
:visible.sync="box"
:close-on-click-modal="false"
:close-on-press-escape="false"
@closed="closed"
width="70%"
>
<el-form
:model="form"
@submit.native.prevent
:rules="rules"
ref="groups"
label-position="right"
label-width="100px"
>
<el-collapse v-model="activeNames">
<el-collapse-item title="分组信息" name="1">
<el-form-item style="width: 400px" label="分组名称" prop="groupName">
<el-input v-model="form.groupName" placeholder="请输入 分组名称" size="small" :disabled="loading"
maxlength="40"
show-word-limit></el-input>
</el-form-item>
<el-form-item style="width: 400px" label="分组排序" prop="sort">
<el-input type="number" v-model="form.sort" min="0" placeholder="请输入 分组名称"
size="small"></el-input>
</el-form-item>
</el-collapse-item>
<el-collapse-item title="服务信息" name="2">
<div class="scroll-row">
<el-card class="card-row" shadow="hover" v-for="(item, index) in serveAll" :key="index">
<div :class="`card-row-name ${selectServer.id === item.id && 'color-blue'}`" @click="changeCard(item)">
{{ item.name }}
</div>
<div class="del-btn" @click="delServer(item)">
<i style="font-size: 18px" class="el-icon-circle-close"></i>
</div>
</el-card>
<el-card class="card-row card-add" shadow="hover">
<div class="card-row-name" @click="changeCard(null)">添加<i
class="el-icon-circle-plus-outline"></i></div>
</el-card>
</div>
<div class="car-content" v-if="selectShow">
<el-form-item style="width: 400px" label="服务名称" prop="name">
<el-input v-model="serveForm.name" placeholder="请输入 服务名称" size="small"></el-input>
</el-form-item>
<!-- <el-form-item style="width: 400px" label="机构名称" prop="companyName">-->
<!-- <el-input v-model="serveForm.companyName" placeholder="请输入 机构名称" size="small"></el-input>-->
<!-- </el-form-item>-->
<el-form-item label="服务场景" prop="serveLabels">
<tag-select v-model="serveForm.serveLabels" :prop="{ label: 'name', value: 'name' }" :data="workDataList">
</tag-select>
</el-form-item>
<el-form-item label="政策指南" prop="policyIds">
<el-cascader
style="width: 100%"
size="small"
v-model="serveForm.policyIds"
:options="listAllPolicyTree"
:props="{ expandTrigger: 'hover', multiple: true, label: 'name', value: 'value', children: 'child'}"
@change="handleChange"
filterable
></el-cascader>
</el-form-item>
<el-form-item label="重点人群" prop="talentsGroupId">
<el-select style="width: 100%" v-model="serveForm.talentsGroupId" multiple filterable
placeholder="请输入 重点人群">
<el-option
v-for="item in talentsList"
:key="item.id"
:label="item.groupName"
:value="item.id">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="备注" prop="remarks">
<el-input type="textarea" v-model="serveForm.remarks" placeholder="请输入 备注"
size="small"></el-input>
</el-form-item>
</div>
</el-collapse-item>
</el-collapse>
</el-form>
<div slot="footer" style="text-align:right">
<el-button
type="primary"
size="mini"
icon="el-icon-check"
@click="handleSubmit"
:loading="loading"
>提交
</el-button>
<el-button size="mini" icon="el-icon-circle-close" @click=" box = false" :loading="loading">取消</el-button>
</div>
</el-dialog>
</template>
<script>
import {saveGroupServeInfo, updateDept, updateGroupServeInfo} from "@/api/tenant/serve";
import {deepClone} from "@/util/util";
const prefix = 'custom-'
const initRule = {
groupName: [
{
required: true,
whitespace: true,
message: "请填写分组名称",
trigger: "change",
},
],
}
const initFormValue = {
groupName: "",
sort: 0,
}
const initServeForm = {
companyName: '',
name: '',
serveLabels: [],
policyIds: [],
talentsGroupId: [],
remarks: '',
}
export default {
props: {
treeData: {
type: Array,
default: [],
},
listAllPolicyTree: {
type: Array,
default: [],
},
data: {
type: Array,
default: [],
},
worktypeDic: {
type: Object,
default: {},
},
talentsList: {
type: Array,
default: [],
}
},
data() {
return {
type: "",
title: "",
groupId: "",
loading: false,
box: false,
form: Object.assign({}, initFormValue),
serveForm: Object.assign({}, initServeForm),
rules: Object.assign({}, initRule),
activeNames: ['1', '2'],
serveAll: [],
selectServer: {},
selectShow: false,
selectLabelNameTypes: [],
tempWorkType: [],
tabDataSource: [],
editData: null,
customNum: 1,
};
},
created() {
console.log('watch', this.data)
},
computed: {
workDataList() {
let rel = deepClone(this.data)
for (let i = 0; i < this.tempWorkType.length; i++) {
const key = this.tempWorkType[i];
if (key && !this.worktypeDic.hasOwnProperty(key)) {
rel.push({name: key});
}
}
return rel
},
},
methods: {
closed() {
this.form = {
groupName: "",
};
if (this.$refs.groups) {
this.$refs.groups.resetFields();
}
this.loading = false;
},
openDialog(type, data) {
this.type = type;
if (this.type === "add") {
this.title = "新建分组";
this.form.groupName = '';
// this.form.sort = 0;
this.serveAll = []
this.editData = null
this.box = true;
} else if (this.type === "edit") {
this.title = "编辑分组";
this.groupId = data.id;
this.form.groupName = data.groupName;
// this.form.sort = data.sort;
this.serveAll = data.children
this.editData = data
this.box = true;
}
this.selectShow = false
this.selectServer = {}
this.serveForm = Object.assign({}, initServeForm)
this.customNum = 1
},
async handleSubmit() {
if (this.selectServer.id) {
let copyForm = deepClone(this.serveForm)
let serve = {
...this.selectServer,
...copyForm,
policyIds: copyForm.policyIds ? copyForm.policyIds.join(',') : '',
talentsGroupId: copyForm.talentsGroupId ? copyForm.talentsGroupId.join(',') : '',
serveLabels: copyForm.serveLabels ? copyForm.serveLabels.map((item) => item.name).join(',') : '',
}
if (this.tabDataSource.find((item) => item.id === serve.id)) {
this.tabDataSource = this.tabDataSource.map((item) => {
if (item.id === serve.id) {
return deepClone(serve)
}
return item
})
} else {
this.tabDataSource = [...this.tabDataSource.filter((item) => item.id !== serve.id), deepClone(serve)]
}
}
const serveAll = deepClone(this.serveAll)
const tabDataSource = deepClone(this.tabDataSource)
// prefix
const customList = tabDataSource.filter((item) => /^custom-/ig.test(item.id))
// 替换数据
for (let i = 0; i < tabDataSource.length; i++) {
for (let j = 0; j < serveAll.length; j++) {
if (serveAll[j].id === tabDataSource[i].id) {
serveAll[j] = tabDataSource[i]
break
}
}
}
serveAll.forEach((item) => {
if (/^custom-/ig.test(item.id)) {
delete item.id
}
})
let params, resData
switch (true) {
case this.type === 'add' :
params = {
...this.form,
children: serveAll
}
if (this.form.groupName) {
this.loading = true;
resData = await saveGroupServeInfo(params)
} else {
this.$message.error('请输入分组名称');
}
break
case this.type === 'edit' :
params = {
...this.editData,
...this.form,
children: serveAll
}
if (this.form.groupName) {
this.loading = true;
resData = await updateGroupServeInfo(params)
} else {
this.$message.error('请输入分组名称');
}
}
if (resData.data.code === 200) {
this.$message.success('操作成功!');
this.loading = false;
this.$emit("refresh");
this.box = false;
} else {
this.loading = false;
this.$message.success('操作失败!');
}
},
changeCard(data) {
// 校验
if (this.selectServer.id) {
let copyForm = deepClone(this.serveForm)
let serve = {
...this.selectServer,
...copyForm,
policyIds: copyForm.policyIds ? copyForm.policyIds.join(',') : '',
talentsGroupId: copyForm.talentsGroupId ? copyForm.talentsGroupId.join(',') : '',
serveLabels: copyForm.serveLabels ? copyForm.serveLabels.map((item) => item.name).join(',') : '',
}
if (this.tabDataSource.find((item) => item.id === serve.id)) {
this.tabDataSource = this.tabDataSource.map((item) => {
if (item.id === serve.id) {
return deepClone(serve)
}
return item
})
} else {
this.tabDataSource = [...this.tabDataSource.filter((item) => item.id !== serve.id), deepClone(serve)]
}
}
// 新增
if (!data) {
const fm = {
...Object.assign({}, initServeForm),
name: `自定义服务名${this.customNum}`,
id: `${prefix}${this.customNum}`
}
this.selectShow = true
this.selectServer = fm
this.serveForm = fm
this.tempWorkType = []
this.customNum++
this.serveAll = [...this.serveAll, deepClone(fm)]
this.tabDataSource.push(fm)
return
}
// 回填
let source = deepClone(data)
if (this.tabDataSource.find((item) => item.id === data.id)) {
source = deepClone(this.tabDataSource.filter((item) => (item.id === data.id))[0])
} else {
this.tabDataSource.push(data)
}
this.selectShow = true
this.selectServer = source
this.tempWorkType = source.serveLabels ? source.serveLabels.split(",") : [];
this.serveForm.talentsGroupId = source.talentsGroupId ? source.talentsGroupId.split(',') : []
this.serveForm.serveLabels = source.serveLabels ? source.serveLabels.split(',').map((item) => ({name: item})) : []
const policyIds = this.treeIteration(this.listAllPolicyTree, source.policyIds.split(','))
this.serveForm.policyIds = policyIds
// this.serveForm.companyName = source.companyName
this.serveForm.name = source.name
this.serveForm.remarks = source.remarks
this.serveForm.id = source.id
},
delServer(data) {
this.serveAll = this.serveAll.filter((item) => item.id !== data.id)
this.tabDataSource = this.tabDataSource.filter((item) => item.id !== data.id)
},
handleChange(policy) {
console.log(policy)
this.serveForm.policyIds = policy
},
treeIteration(tree, ids) {
if (!(tree.length && ids.length)) return;
let arr = []
tree.forEach((treeItem) => {
treeItem.child.forEach((item) => {
if (ids.some((id) => item.value === id)) {
arr.push([treeItem.value, item.value])
}
})
})
return arr;
},
},
watch: {}
};
</script>
<style scoped>
.color-blue {
color: blue;
}
.scroll-row {
overflow-x: scroll;
width: 100%;
height: fit-content;
display: -webkit-box;
padding: 10px;
margin-bottom: 10px;
}
.card-row {
width: fit-content;
margin-right: 10px;
display: flex;
align-content: center;
justify-content: center;
text-align: center;
position: relative;
}
.del-btn {
position: absolute;
right: 0;
top: 0;
}
.card-row-name {
width: 100%;
height: 100%;
}
.card-add {
color: #e5e5e5;
}
.car-content {
}
</style>

View File

@@ -1,146 +0,0 @@
<template>
<!-- 新建分组模板 -->
<el-dialog
:title="title"
append-to-body
:visible.sync="box"
:close-on-click-modal="false"
:close-on-press-escape="false"
@closed="closed"
width="555px"
>
<el-form
:model="form"
@submit.native.prevent
:rules="rules"
ref="groups"
label-position="right"
label-width="100px"
>
<el-form-item label="分组名称" prop="groupName">
<el-input v-model="form.groupName" placeholder="请输入 分组名称" size="small" :disabled="loading" maxlength="40" show-word-limit></el-input>
</el-form-item>
</el-form>
<div slot="footer" style="text-align:right">
<el-button
type="primary"
size="mini"
icon="el-icon-check"
@click="handleSubmit"
:loading="loading"
>提交</el-button>
<el-button size="mini" icon="el-icon-circle-close" @click=" box = false" :loading="loading">取消</el-button>
</div>
</el-dialog>
</template>
<script>
import { addDept, updateDept } from "@/api/tenant/serve";
export default {
data() {
return {
type: "",
title: "",
groupId: "",
loading: false,
box: false,
form: {
groupName: "",
},
rules: {
groupName: [
{
required: true,
whitespace: true,
message: "请填写分组名称",
trigger: "blur",
},
],
},
};
},
watch: {},
computed: {},
methods: {
closed() {
this.form = {
groupName: "",
};
if (this.$refs.groups) {
this.$refs.groups.resetFields();
}
this.loading = false;
},
openDialog(type, data) {
this.type = type;
if (this.type === "add") {
this.title = "新建分组";
this.box = true;
} else if (this.type === "edit") {
this.title = "编辑分组";
this.groupId = data.id;
this.form.groupName = data.groupName;
this.box = true;
}
},
handleSubmit() {
if(this.form.groupName){
this.$refs.groups.validate(valid=>{
if(valid){
if (this.type === "add") {
//提交新建分组接口
this.loading = true;
addDept({
groupName: this.form.groupName,
}).then(
() => {
this.$message({
type: "success",
message: "操作成功!",
});
this.box = false;
this.$emit("refresh");
this.loading = false;
},
(error) => {
window.console.log(error);
this.loading = false;
}
);
} else if (this.type == "edit") {
//提交编辑分组接口
this.loading = true;
updateDept({
id: this.groupId,
groupName: this.form.groupName,
}).then(
() => {
this.$message({
type: "success",
message: "操作成功!",
});
this.box = false;
this.$emit("refresh");
this.loading = false;
},
(error) => {
window.console.log(error);
this.loading = false;
}
);
}
}
else{
this.$message.error('请输入分组名称');
}
})
}
},
},
};
</script>
<style>
</style>

View File

@@ -1,290 +0,0 @@
<template>
<basic-container>
<jl-go-back></jl-go-back>
<el-row>
<el-col :span="12">
<avue-form :option="formOption" v-model="form" @submit="handleSubmit" ref="form">
<template slot="policyFileUrl">
<div class="policyFileUrlWrapper">
<div class="uploadWrapperAb">
<el-upload
action="#"
ref="upload"
:show-file-list="false"
:http-request="allUpload"
:multiple="false"
>
<el-button size="small" type="primary">点击上传</el-button>
</el-upload>
</div>
<avue-input disabled v-model="policyFileUrl" placeholder="点击上传文件"></avue-input>
</div>
</template>
</avue-form>
</el-col>
<el-col :span="12">
<Tinymce v-model="form.note" ref="tinymce" style="height: 100%;"></Tinymce>
</el-col>
</el-row>
</basic-container>
</template>
<script>
import 'quill/dist/quill.core.css'
import 'quill/dist/quill.snow.css'
import 'quill/dist/quill.bubble.css'
import {quillEditor} from "vue-quill-editor";
import {addNews, getNewsDetail, editNews} from "@/api/manage/news"
import {putFile} from "@/api/resource/oss";
import Tinymce from "@/components/Tinymce";
import {getClassifyDic} from '@/api/help/article/classify'
const toolbarItems = [
["bold", "italic", "underline", "strike"], // 加粗 斜体 下划线 删除线
["blockquote", "code-block"], // 引用 代码块
[{header: 1}, {header: 2}], // 1、2 级标题
[{list: "ordered"}, {list: "bullet"}], // 有序、无序列表
[{script: "sub"}, {script: "super"}], // 上标/下标
[{indent: "-1"}, {indent: "+1"}], // 缩进
// [{'direction': 'rtl'}], // 文本方向
[{size: ["small", false, "large", "huge"]}], // 字体大小
[{header: [1, 2, 3, 4, 5, 6, false]}], // 标题
[{color: []}, {background: []}], // 字体颜色、字体背景颜色
[{font: []}], // 字体种类
[{align: []}], // 对齐方式
["clean"], // 清除文本格式
["image"], // 链接、图片、视频
]
export default {
components: {quillEditor, Tinymce},
props: {
id: Number,
type: String
},
mounted() {
this.onload()
},
data() {
return {
policyFileUrl: '',
putFile,
imageUrl: '',
ruleForm: {
content: null,
},
form: {
note: ''
},
description: '',
formOption: {
// labelWidth:120,
column: [
{
"label": "服务时间",
"span": 24,
labelWidth: 100,
"prop": "createTime",
"rules": [
{
"required": true,
"message": "请输入服务时间"
}
]
},
{
"label": "服务发起人",
"span": 24,
labelWidth: 100,
"prop": "fromName",
"rules": [
{
"required": true,
"message": "请输入服务发起人"
}
]
},
{
"label": "服务对象",
"span": 24,
labelWidth: 100,
"prop": "toName",
"rules": [
{
"required": true,
"message": "请输入服务对象"
}
]
},
{
"label": "服务主题",
"span": 24,
labelWidth: 100,
"prop": "serveTheme",
"rules": [
{
"required": true,
"message": "请输入服务主题"
}
]
},
{
"label": "服务内容",
"span": 24,
labelWidth: 100,
"prop": "serveContent",
"rules": [
{
"required": true,
"message": "请输入服务内容"
}
]
},
{
"label": "备注1",
"span": 24,
labelWidth: 100,
"prop": "bak1",
"rules": [
{
"required": true,
"message": "请输入备注1"
}
]
},
{
label: "政策文件地址",
prop: "policyFileUrl",
span: 24,
labelWidth: 120,
hide: true,
slot: true,
formslot: true,
showWordLimit: true,
},
]
},
editorOption: {
modules: {
toolbar: {
container: toolbarItems,
handlers: {
'image': function (value) {
if (value) {
document.querySelector('.avatar-uploader input').click()
} else {
this.quill.format('image', false);
}
}
}
},//工具菜单栏配置
},
placeholder: "请在这里编写文章内容", //提示
readyOnly: false, //是否只读
theme: "snow", //主题 snow/bubble
syntax: true, //语法检测
},
};
},
methods: {
// 值发生变化
onEditorChange(editor) {
this.content = editor.html;
},
handleSubmit(form, done) {
// this.form['note'] = this.$refs.tinymce.getContent()
if (this.form.note.length > 64 * 512) {
this.$message.error('文章内容不能超过64KB');
done()
} else {
if (this.type == 'add') {
addNews(
this.form.articleTitle,
this.form.headPic,
this.form.articleSrc,
this.form.articleSrcUrl,
this.form.author,
this.form.description,
this.form.note,
this.form.type
).then(() => {
this.$message.success('添加成功');
this.$router.go(-1);
})
} else if (this.type == 'edit') {
editNews(
this.id,
this.form.articleTitle,
this.form.headPic,
this.form.articleSrc,
this.form.articleSrcUrl,
this.form.author,
this.form.description,
this.form.note,
this.form.type
).then(() => {
this.$message.success('修改成功');
done()
})
}
}
},
/*上传图片*/
handleAvatarSuccess(res) {
let quill = this.$refs.QuillEditor.quill
let length = quill.getSelection().index;//获取光标所在位置
quill.insertEmbed(length, 'image', res.data.link)
quill.setSelection(length + 1)//光标后移一位
},
beforeAvatarUpload(file) {
const isJPG = ["image/png", "image/jpeg", "image/svg+xml", "image/gif"].indexOf(file.type) != -1;
const isLt2M = file.size / 1024 / 1024 < 2;
if (!isJPG) {
this.$message.error('上传图片格式不正确');
}
if (!isLt2M) {
this.$message.error('上传图片大小不能超过 2MB!');
}
return isJPG && isLt2M;
},
onload() {
if (this.id && this.type == 'edit') {
getNewsDetail(this.id).then(res => {
this.form = res.data.data;
this.description = this.form.description;
})
}
},
},
};
</script>
<style>
.avatar-uploader {
width: 0;
height: 0;
display: none;
}
.ql-editor {
height: 400px;
}
.policyFileUrlWrapper {
position: relative;
}
.uploadWrapperAb {
position: absolute;
right: 0px;
z-index: 99;
}
</style>

View File

@@ -333,7 +333,7 @@ export default {
}, 1000),
leftSearch() {
this.leftPages.currentPage = 1
this.getLeftUserList('serve')
this.getLeftUserList('serveCopy')
console.log('leftpages:', this.leftPages)
},
leftCurrentPageChange(current) {
@@ -373,7 +373,7 @@ export default {
}
},
groupNameChange() {
this.getLeftUserList('serve')
this.getLeftUserList('serveCopy')
},
async pushPostAndUser() {
this.pushState = true

View File

@@ -1,110 +0,0 @@
<template>
<!-- 转移分组模板 -->
<el-dialog
:title="title"
append-to-body
:visible.sync="box"
:close-on-click-modal="false"
:close-on-press-escape="false"
@closed="closed"
width="555px"
>
<avue-form ref="groups" :option="option" v-model="form" @submit="handleSubmit">
<template slot="menuForm" slot-scope="{disabled}">
<!-- <el-button type="primary" icon="el-icon-check" @click="copy" :disabled="formLoading">提交</el-button> -->
<el-button icon="el-icon-circle-close" @click="box = false" :loading="disabled">取消</el-button>
</template>
</avue-form>
</el-dialog>
</template>
<script>
import { transferDept } from "@/api/tenant/serve";
export default {
props: {
ids: String,
},
data() {
return {
title: "",
groupId: "",
box: false,
form: {},
option: {
menuPosition: "right",
menuBtn: true,
submitBtn: true,
emptyBtn: false,
column: [
{
label: "所属分组",
prop: "groupId",
type: "tree",
span: 24,
display: true,
dicUrl: `/api/jobslink-api/tenant/talents/group/listAll`,
dicMethod: "get",
dicFormatter: (res) => {
return res.data.list; //返回字典的层级结构
},
props: {
label: "groupName",
value: "id",
},
rules: [
{
required: true,
whitespace: true,
message: "请选择分组",
trigger: "change",
},
],
placeholder: "请选择分组",
},
],
},
};
},
computed: {},
methods: {
closed() {
this.form = {};
if (this.$refs.groups) {
this.$refs.groups.init();
this.$refs.groups.clearValidate();
this.$refs.groups.resetForm();
}
},
openDialog() {
this.title = "转移分组";
this.box = true;
if (this.$refs.groups) {
this.$refs.groups.init();
this.$refs.groups.clearValidate();
this.$refs.groups.resetForm();
}
},
handleSubmit(form, done) {
//提交转移分组接口
transferDept(this.form.groupId, this.ids).then(
() => {
this.box = false;
this.$message({
type: "success",
message: "操作成功!",
});
this.$emit("refresh");
done();
},
(error) => {
window.console.log(error);
done();
}
);
},
},
};
</script>
<style>
</style>

File diff suppressed because it is too large Load Diff