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

pref:修改logo上传

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