Commit d6ef12fa authored by “yiyousong”'s avatar “yiyousong”

pref:修改logo上传

parent 0aca1c24
...@@ -46,7 +46,8 @@ ...@@ -46,7 +46,8 @@
"vue-resource": "^1.5.2", "vue-resource": "^1.5.2",
"vue-router": "^3.3.4", "vue-router": "^3.3.4",
"vuedraggable": "^2.23.2", "vuedraggable": "^2.23.2",
"vuex": "^3.4.0" "vuex": "^3.4.0",
"vuex-persistedstate": "^4.1.0"
}, },
"devDependencies": { "devDependencies": {
"@ant-design/colors": "^4.0.1", "@ant-design/colors": "^4.0.1",
......
...@@ -90,6 +90,22 @@ export default { ...@@ -90,6 +90,22 @@ export default {
popContainer() { popContainer() {
return document.getElementById("popContainer"); return document.getElementById("popContainer");
}, },
// 刷新保存
// readVueXData() {
// window.addEventListener("beforeunload", () => {
// sessionStorage.setItem("store", JSON.stringify(this.$store.state));
// });
// if (sessionStorage.getItem("store")) {
// this.$store.replaceState(
// Object.assign(
// {},
// this.$store.state,
// JSON.parse(sessionStorage.getItem("store"))
// )
// );
// sessionStorage.removeItem("store");
// }
// },
}, },
}; };
</script> </script>
......
<template> <template>
<div class="previe-modal" v-if="Visible" @click="Visible = false"> <div class="previe-modal" v-if="Visible" @click="Visible = false">
<img @click.stop v-if="previeData.type === 'img'" :src="previeData.url" /> <img @click.stop v-if="previewData.type === 'img'" :src="previewData.url" />
<video <video
@click.stop @click.stop
v-else v-else
:src="previeData.url" :src="previewData.url"
autoplay autoplay
muted muted
controls controls
...@@ -16,14 +16,14 @@ ...@@ -16,14 +16,14 @@
<script> <script>
export default { export default {
props: { props: {
previeData: { previewData: {
type: Object, type: Object,
required: true, required: true,
default: () => { default: () => {
return {}; return {};
}, },
}, },
previeVisible: { previewVisible: {
type: Boolean, type: Boolean,
required: true, required: true,
default: false, default: false,
...@@ -32,10 +32,10 @@ export default { ...@@ -32,10 +32,10 @@ export default {
computed: { computed: {
Visible: { Visible: {
get() { get() {
return this.previeVisible; return this.previewVisible;
}, },
set(val) { set(val) {
this.$emit("update:previeVisible", val); this.$emit("update:previewVisible", val);
}, },
}, },
}, },
......
...@@ -44,11 +44,17 @@ ...@@ -44,11 +44,17 @@
</a-col> </a-col>
<a-col :span="8"> <a-col :span="8">
<a-form-model-item label="所属部门" prop="belongDept"> <a-form-model-item label="所属部门" prop="belongDept">
<a-select v-model="baseform.belongDept" placeholder="请选择部门"> <a-select
showSearch
v-model="baseform.belongDept"
optionFilterProp="label"
placeholder="请选择部门"
>
<a-select-option <a-select-option
v-for="v in deptData" v-for="v in deptData"
:key="v.id" :key="v.id"
:value="v.name" :value="v.name"
:label="v.name"
> >
{{ v.name }}</a-select-option {{ v.name }}</a-select-option
> >
...@@ -183,7 +189,7 @@ ...@@ -183,7 +189,7 @@
placeholder="请选择事项类型" placeholder="请选择事项类型"
> >
<a-select-option <a-select-option
v-for="v in eventTypeShowItem" v-for="v in matterDict.eventTypeShow"
:key="v" :key="v"
:value="v" :value="v"
>{{ v }}</a-select-option >{{ v }}</a-select-option
...@@ -227,7 +233,7 @@ ...@@ -227,7 +233,7 @@
placeholder="请选择行使层级" placeholder="请选择行使层级"
> >
<a-select-option <a-select-option
v-for="v in performHierarchyShowItem" v-for="v in matterDict.performHierarchyShow"
:key="v" :key="v"
:value="v" :value="v"
>{{ v }}</a-select-option >{{ v }}</a-select-option
...@@ -238,9 +244,12 @@ ...@@ -238,9 +244,12 @@
<a-col :span="8"> <a-col :span="8">
<a-form-model-item label="主题类型" prop="type"> <a-form-model-item label="主题类型" prop="type">
<a-select v-model="baseform.type" placeholder="请选择主题类型"> <a-select v-model="baseform.type" placeholder="请选择主题类型">
<a-select-option v-for="v in typeItem" :key="v" :value="v">{{ <a-select-option
v v-for="v in matterDict.type"
}}</a-select-option> :key="v"
:value="v"
>{{ v }}</a-select-option
>
</a-select> </a-select>
</a-form-model-item> </a-form-model-item>
</a-col> </a-col>
...@@ -291,9 +300,14 @@ ...@@ -291,9 +300,14 @@
</template> </template>
<script> <script>
import { mapGetters } from "vuex";
import local from "@/utils/local";
import { getDeptList } from "@/services/dept";
import { saveAddMatter } from "@/services/matter";
export default { export default {
data() { data() {
return { return {
siteId: local.getLocal("siteId"), // 站点id
labelCol: { span: 5 }, labelCol: { span: 5 },
wrapperCol: { span: 19 }, wrapperCol: { span: 19 },
isTimely: undefined, isTimely: undefined,
...@@ -301,7 +315,7 @@ export default { ...@@ -301,7 +315,7 @@ export default {
isLinked: undefined, isLinked: undefined,
onlineTypeItem: [], // 网办类型选项 onlineTypeItem: [], // 网办类型选项
eventTypeShowItem: [], // 事项类型选项 eventTypeShowItem: [], // 事项类型选项
jointInfoShowItem: [], // 连机构选项 jointInfoShowItem: [], // 连机构选项
performHierarchyShowItem: [], // 形式层级选项 performHierarchyShowItem: [], // 形式层级选项
certification: [], // 认证点击选项 certification: [], // 认证点击选项
typeItem: [], // 主题类型选项 typeItem: [], // 主题类型选项
...@@ -341,11 +355,36 @@ export default { ...@@ -341,11 +355,36 @@ export default {
}, },
}; };
}, },
computed: {
...mapGetters("site", ["matterDict"]),
},
created() {
console.log(this.matterDict);
this.getDeptListData();
},
methods: { methods: {
// 获取部门列表 // 获取部门列表
async getDeptListData() {
let res = await getDeptList({ siteId: this.siteId, page: 1, size: -1 });
let { code, data } = res.data;
if (code === 1) {
this.deptData = data.data;
}
},
handleOk() { handleOk() {
console.log(1); this.$refs.form.validate(async (valid) => {
if (valid) {
let res = await saveAddMatter({
siteId: this.siteId,
...this.baseform,
});
let { code, msg } = res.data;
if (code === 1) {
this.$message.success(msg);
this.handleReset();
}
}
});
}, },
handleReset() { handleReset() {
this.$refs.form.resetFields(); this.$refs.form.resetFields();
......
...@@ -67,6 +67,17 @@ ...@@ -67,6 +67,17 @@
<template slot="deptName" slot-scope="text"> <template slot="deptName" slot-scope="text">
{{ text.deptName ? text.deptName : "--" }} {{ text.deptName ? text.deptName : "--" }}
</template> </template>
<!-- 事项名称 -->
<template slot="matterName" slot-scope="text">
<a-tooltip placement="top">
<template slot="title">
{{ text.matterName }}
</template>
<div class="matter-name">{{ text.matterName }}</div>
</a-tooltip>
<a-tag v-if="text.source === 0" color="green"> 一体化添加 </a-tag>
<a-tag v-else color="blue"> 手动添加 </a-tag>
</template>
<!-- 到现场次数 --> <!-- 到现场次数 -->
<template slot="num" slot-scope="text"> <template slot="num" slot-scope="text">
<span v-if="text.windowToTheSceneNum">{{ <span v-if="text.windowToTheSceneNum">{{
...@@ -143,6 +154,18 @@ ...@@ -143,6 +154,18 @@
<template slot="deptName" slot-scope="text"> <template slot="deptName" slot-scope="text">
{{ text.deptName ? text.deptName : "--" }} {{ text.deptName ? text.deptName : "--" }}
</template> </template>
<!-- 事项名称 -->
<template slot="matterName" slot-scope="text">
<a-tooltip placement="top">
<template slot="title">
{{ text.matterName }}
</template>
<div class="matter-name">{{ text.matterName }}</div>
</a-tooltip>
<a-tag v-if="text.source === 0" color="green"> 一体化添加 </a-tag>
<a-tag v-else color="blue"> 手动添加 </a-tag>
</template>
<!-- 操作 -->
<template slot="action" slot-scope="text"> <template slot="action" slot-scope="text">
<a href="javascript:;" class="jion" @click="handleIn(text.id)" <a href="javascript:;" class="jion" @click="handleIn(text.id)"
>加入</a >加入</a
...@@ -171,6 +194,7 @@ import { ...@@ -171,6 +194,7 @@ import {
import { getBusinessMatterList, delBusinessMatter } from "@/services/business"; import { getBusinessMatterList, delBusinessMatter } from "@/services/business";
// import { getDeptList } from "@/services/dept"; // import { getDeptList } from "@/services/dept";
import local from "@/utils/local"; import local from "@/utils/local";
import { mapMutations } from "vuex";
const leftColumns = [ const leftColumns = [
{ {
title: "序号", title: "序号",
...@@ -186,8 +210,11 @@ const leftColumns = [ ...@@ -186,8 +210,11 @@ const leftColumns = [
}, },
{ {
title: "事项名称", title: "事项名称",
ellipsis: true, // ellipsis: true,
dataIndex: "matterName", align: "left",
scopedSlots: {
customRender: "matterName",
},
}, },
{ {
title: "到现场次数", title: "到现场次数",
...@@ -219,8 +246,11 @@ const rightColumns = [ ...@@ -219,8 +246,11 @@ const rightColumns = [
}, },
{ {
title: "事项名称", title: "事项名称",
ellipsis: true, // ellipsis: true,
dataIndex: "matterName", align: "left",
scopedSlots: {
customRender: "matterName",
},
}, },
{ {
title: "操作", title: "操作",
...@@ -266,6 +296,7 @@ export default { ...@@ -266,6 +296,7 @@ export default {
}, },
methods: { methods: {
...mapMutations("site", ["SET_matterDict"]),
// 获取站点事项 // 获取站点事项
async getMatterSiteData(search = {}) { async getMatterSiteData(search = {}) {
this.leftLoading = true; this.leftLoading = true;
...@@ -295,13 +326,14 @@ export default { ...@@ -295,13 +326,14 @@ export default {
matterName: this.searchRightVal, matterName: this.searchRightVal,
...search, ...search,
}); });
let { pageInfo, data } = res.data.data; let { pageInfo, data, dict } = res.data.data;
if (!data.length && this.rightCurrent > 1) { if (!data.length && this.rightCurrent > 1) {
this.rightCurrent -= 1; this.rightCurrent -= 1;
this.getMatterListData(); this.getMatterListData();
} }
this.matterDataList = data; this.matterDataList = data;
this.rightTotal = pageInfo.totalResult; this.rightTotal = pageInfo.totalResult;
this.SET_matterDict(dict);
this.rightLoading = false; this.rightLoading = false;
}, },
// 左边搜索 // 左边搜索
...@@ -505,6 +537,12 @@ export default { ...@@ -505,6 +537,12 @@ export default {
margin-right: 19px; margin-right: 19px;
} }
} }
.matter-name {
margin-bottom: 10px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
} }
.header-bottom { .header-bottom {
display: flex; display: flex;
......
...@@ -9,7 +9,9 @@ ...@@ -9,7 +9,9 @@
> >
<div slot="footer"> <div slot="footer">
<a-button @click="resetForm">重置</a-button> <a-button @click="resetForm">重置</a-button>
<a-button type="primary" @click="handleOk">确定</a-button> <a-button :loading="loading" type="primary" @click="handleOk"
>确定</a-button
>
</div> </div>
<div class="content"> <div class="content">
<a-form-model <a-form-model
...@@ -156,6 +158,20 @@ ...@@ -156,6 +158,20 @@
</a-form-model-item> </a-form-model-item>
<a-form-model-item label="中心Logo" prop="logoPath"> <a-form-model-item label="中心Logo" prop="logoPath">
<a-upload <a-upload
:action="api + 'base/file/commonupload'"
list-type="picture-card"
:file-list="fileList"
@preview="handlePreview"
@change="handleChange"
:accept="accept"
>
<div v-if="fileList.length < 1">
<a-icon type="plus" />
<div class="ant-upload-text">上传图片</div>
</div>
</a-upload>
<!-- <a-upload
name="file" name="file"
list-type="picture-card" list-type="picture-card"
class="avatar-uploader" class="avatar-uploader"
...@@ -174,7 +190,7 @@ ...@@ -174,7 +190,7 @@
<a-icon :type="loading ? 'loading' : 'plus'" /> <a-icon :type="loading ? 'loading' : 'plus'" />
<div class="ant-upload-text">上传图片</div> <div class="ant-upload-text">上传图片</div>
</div> </div>
</a-upload> </a-upload> -->
</a-form-model-item> </a-form-model-item>
<div class="color_title">办公信息</div> <div class="color_title">办公信息</div>
...@@ -255,6 +271,11 @@ ...@@ -255,6 +271,11 @@
</a-form-model> </a-form-model>
</div> </div>
</a-modal> </a-modal>
<!-- 预览 -->
<PrevieModal
:previewData="previewData"
:previewVisible.sync="previewVisible"
></PrevieModal>
</div> </div>
</template> </template>
<script> <script>
...@@ -262,6 +283,7 @@ import { modelList, siteSave } from "@/services/basicsetFun"; ...@@ -262,6 +283,7 @@ import { modelList, siteSave } from "@/services/basicsetFun";
import YCheckbox from "@/components/ycheckbox/YCheckbox.vue"; import YCheckbox from "@/components/ycheckbox/YCheckbox.vue";
// import options from "@/utils/city"; // import options from "@/utils/city";
import { regionData } from "element-china-area-data"; import { regionData } from "element-china-area-data";
import PrevieModal from "@/components/PrevieModal.vue";
export default { export default {
props: { props: {
formVisible: { formVisible: {
...@@ -283,6 +305,7 @@ export default { ...@@ -283,6 +305,7 @@ export default {
}, },
components: { components: {
YCheckbox, YCheckbox,
PrevieModal,
}, },
data() { data() {
// 验证手机号码 // 验证手机号码
...@@ -310,6 +333,8 @@ export default { ...@@ -310,6 +333,8 @@ export default {
api: process.env.VUE_APP_API_BASE_URL + "/", api: process.env.VUE_APP_API_BASE_URL + "/",
accept: "image/jpeg,image/png", // 上传类型 accept: "image/jpeg,image/png", // 上传类型
loading: false, loading: false,
previewData: {}, // 预览logo信息
previewVisible: false,
options: regionData, // 地区级联数据 options: regionData, // 地区级联数据
tablename: "", //接口名称 tablename: "", //接口名称
modelIds: [], // 板块数据 modelIds: [], // 板块数据
...@@ -356,6 +381,7 @@ export default { ...@@ -356,6 +381,7 @@ export default {
}, //表单提交数据 }, //表单提交数据
indeterminate: true, indeterminate: true,
checkAll: false, checkAll: false,
fileList: [],
formRules: { formRules: {
siteName: [ siteName: [
{ {
...@@ -556,6 +582,7 @@ export default { ...@@ -556,6 +582,7 @@ export default {
}, },
// 关闭对话框 // 关闭对话框
closeModal() { closeModal() {
this.fileList = [];
this.$refs.ruleForm.resetFields(); this.$refs.ruleForm.resetFields();
this.Visible = false; this.Visible = false;
}, },
...@@ -581,12 +608,23 @@ export default { ...@@ -581,12 +608,23 @@ export default {
this.formInfo.amWorkEndTime = String(this.formInfo.amWorkEndTime); this.formInfo.amWorkEndTime = String(this.formInfo.amWorkEndTime);
this.formInfo.pmWorkStartTime = String(this.formInfo.pmWorkStartTime); this.formInfo.pmWorkStartTime = String(this.formInfo.pmWorkStartTime);
this.formInfo.pmWorkEndTime = String(this.formInfo.pmWorkEndTime); this.formInfo.pmWorkEndTime = String(this.formInfo.pmWorkEndTime);
if (this.formInfo.logoPath) {
this.fileList = [
{
uid: -1,
status: "done",
name: this.formInfo.logoPath,
url: this.api + this.formInfo.logoPath,
url2: this.formInfo.logoPath,
},
];
}
}, },
// 保存 // 保存
handleOk() { handleOk() {
console.log(this.formInfo);
this.$refs.ruleForm.validate(async (valid) => { this.$refs.ruleForm.validate(async (valid) => {
if (valid) { if (valid) {
this.loading = true;
let res = await siteSave({ let res = await siteSave({
...this.formInfo, ...this.formInfo,
...this.areaInfo, ...this.areaInfo,
...@@ -597,8 +635,10 @@ export default { ...@@ -597,8 +635,10 @@ export default {
modelIds: this.formInfo.modelIds.join(","), modelIds: this.formInfo.modelIds.join(","),
}); });
let { code, msg } = res.data; let { code, msg } = res.data;
this.loading = false;
if (code === 1) { if (code === 1) {
this.$message.success(msg); this.$message.success(msg);
this.fileList = [];
this.Visible = false; this.Visible = false;
this.$parent.getSiteList({ areaID: this.areaInfo.areaID }); this.$parent.getSiteList({ areaID: this.areaInfo.areaID });
} }
...@@ -619,19 +659,42 @@ export default { ...@@ -619,19 +659,42 @@ export default {
return isJpgOrPng && isLt2M; return isJpgOrPng && isLt2M;
}, },
// 上传图片 // 上传图片
handleChange(info) { handleChange({ fileList }) {
if (info.file.status === "uploading") { this.fileList = fileList.map((v) => {
this.loading = true; if (v.response) {
return; v.url2 = v.response.url;
} v.url = this.api + v.response.url;
if (info.file.status === "done") { }
this.formInfo.logoPath = info.file.response.url; return v;
this.loading = false; });
if (this.fileList[0]) {
this.formInfo.logoPath = this.fileList[0].url2;
} else {
this.formInfo.logoPath = "";
} }
// if (info.file.status === "uploading") {
// this.loading = true;
// return;
// }
// if (info.file.status === "done") {
// this.formInfo.logoPath = info.file.response.url;
// this.loading = false;
// }
}, },
// 预览logo
handlePreview(info) {
this.previewData = {
type: "img",
url: info.url,
};
this.previewVisible = true;
},
// 删除logo
// handleRemove() {
// this.formInfo.logoPath = "";
// },
// 地址 // 地址
oncityChange(val) { oncityChange(val) {
console.log(val);
[ [
this.formInfo.proCode, this.formInfo.proCode,
this.formInfo.cityCode, this.formInfo.cityCode,
......
import Vue from 'vue' import Vue from "vue";
import Vuex from 'vuex' import Vuex from "vuex";
import modules from './modules' import modules from "./modules";
import createPersistedState from "vuex-persistedstate";
Vue.use(Vuex) Vue.use(Vuex);
const store = new Vuex.Store({modules}) const store = new Vuex.Store({
modules,
// 持久化插件
plugins: [
createPersistedState({
storage: window.sessionStorage,
}),
],
});
export default store export default store;
...@@ -5,6 +5,7 @@ export default { ...@@ -5,6 +5,7 @@ export default {
imageResolution: [], // 皮肤设置分辨率 imageResolution: [], // 皮肤设置分辨率
SiteTree: [], // 站点树 SiteTree: [], // 站点树
appTemplate: [], // 应用模板属性 appTemplate: [], // 应用模板属性
matterDict: {}, // 事项字典
}, },
getters: { getters: {
SiteTree(state) { SiteTree(state) {
...@@ -13,11 +14,17 @@ export default { ...@@ -13,11 +14,17 @@ export default {
appTemplate(state) { appTemplate(state) {
return state.appTemplate; return state.appTemplate;
}, },
matterDict(state) {
return state.matterDict;
},
}, },
mutations: { mutations: {
SET_appTemplate(state, appTemplate) { SET_appTemplate(state, appTemplate) {
state.appTemplate = appTemplate; state.appTemplate = appTemplate;
}, },
SET_matterDict(state, matterDict) {
state.matterDict = matterDict;
},
SET_SITE_ID(state, newId) { SET_SITE_ID(state, newId) {
state.siteId = newId; state.siteId = newId;
}, },
......
...@@ -9735,6 +9735,11 @@ shell-quote@^1.6.1: ...@@ -9735,6 +9735,11 @@ shell-quote@^1.6.1:
resolved "https://registry.npm.taobao.org/shell-quote/download/shell-quote-1.7.2.tgz" resolved "https://registry.npm.taobao.org/shell-quote/download/shell-quote-1.7.2.tgz"
integrity sha1-Z6fQLHbJ2iT5nSCAj8re0ODgS+I= integrity sha1-Z6fQLHbJ2iT5nSCAj8re0ODgS+I=
shvl@^2.0.3:
version "2.0.3"
resolved "https://registry.npmmirror.com/shvl/-/shvl-2.0.3.tgz#eb4bd37644f5684bba1fc52c3010c96fb5e6afd1"
integrity sha512-V7C6S9Hlol6SzOJPnQ7qzOVEWUQImt3BNmmzh40wObhla3XOYMe4gGiYzLrJd5TFa+cI2f9LKIRJTTKZSTbWgw==
side-channel@^1.0.4: side-channel@^1.0.4:
version "1.0.4" version "1.0.4"
resolved "https://registry.npmmirror.com/side-channel/-/side-channel-1.0.4.tgz" resolved "https://registry.npmmirror.com/side-channel/-/side-channel-1.0.4.tgz"
...@@ -11186,6 +11191,14 @@ vuepress@^1.5.2: ...@@ -11186,6 +11191,14 @@ vuepress@^1.5.2:
opencollective-postinstall "^2.0.2" opencollective-postinstall "^2.0.2"
update-notifier "^4.0.0" update-notifier "^4.0.0"
vuex-persistedstate@^4.1.0:
version "4.1.0"
resolved "https://registry.npmmirror.com/vuex-persistedstate/-/vuex-persistedstate-4.1.0.tgz#127165f85f5b4534fb3170a5d3a8be9811bd2a53"
integrity sha512-3SkEj4NqwM69ikJdFVw6gObeB0NHyspRYMYkR/EbhR0hbvAKyR5gksVhtAfY1UYuWUOCCA0QNGwv9pOwdj+XUQ==
dependencies:
deepmerge "^4.2.2"
shvl "^2.0.3"
vuex@^3.4.0: vuex@^3.4.0:
version "3.4.0" version "3.4.0"
resolved "https://registry.npm.taobao.org/vuex/download/vuex-3.4.0.tgz" resolved "https://registry.npm.taobao.org/vuex/download/vuex-3.4.0.tgz"
......
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