Browse Source

reactor:随手拍新增地图位置标点查看;

zhangchong 4 months ago
parent
commit
661ce732d1

+ 98 - 1
src/api/snapshot/info.ts

@@ -3,6 +3,17 @@
  * @description 随手拍-信息公开
  * @description 随手拍-信息公开
  */
  */
 import request from '@/utils/request';
 import request from '@/utils/request';
+/**
+ * @description 获取随手拍公告列表基础数据
+ * @param {object} params
+ */
+export const getSnapshotBulletinBaseData = (params?: object) =>{
+	return request({
+		url: `/api/v1/SnapshotBulletin/bulletin/addbasedata`,
+		method: 'get',
+		params
+	});
+}
 /**
 /**
  * @description 获取随手拍公告列表
  * @description 获取随手拍公告列表
  * @param {object} params
  * @param {object} params
@@ -13,4 +24,90 @@ export const getSnapshotBulletinList = (params: object) =>{
 		method: 'get',
 		method: 'get',
 		params
 		params
 	});
 	});
-	}
+}
+/**
+ * @description 新增修改公告基础信息
+ * @param {object} params
+ */
+export const editSnapshotBulletinBase = (params: object) =>{
+	return request({
+		url: `/api/v1/SnapshotBulletin/bulletin/addbasedata`,
+		method: 'get',
+		params
+	});
+}
+/**
+ * @description 新增公告
+ * @param {object} data
+ */
+export const addSnapshotBulletin = (data: object) =>{
+	return request({
+		url: `/api/v1/SnapshotBulletin/bulletin/add`,
+		method: 'post',
+		data
+	});
+}
+/**
+ * @description 获取公告详情
+ * @param {string} id
+ */
+export const getSnapshotBulletinDetail = (id: string) =>{
+	return request({
+		url: `/api/v1/SnapshotBulletin/bulletin/entity/${id}`,
+		method: 'get'
+	});
+}
+/**
+ * @description 删除公告
+ * @param {string} id
+ */
+export const delSnapshotBulletin = (id: string) =>{
+	return request({
+		url: `/api/v1/SnapshotBulletin/bulletin/del/${id}`,
+		method: 'get'
+	});
+}
+/**
+ * @description 修改公告
+ * @param {object} data
+ */
+export const editSnapshotBulletin = (data: object) =>{
+	return request({
+		url: `/api/v1/SnapshotBulletin/bulletin/update`,
+		method: 'post',
+		data
+	});
+}
+/**
+ * @description 提交公告
+ * @param {object} params
+ */
+export const submitSnapshotBulletin = (params: object) =>{
+	return request({
+		url: `/api/v1/SnapshotBulletin/bulletin/commit`,
+		method: 'get',
+		params
+	});
+}
+/**
+ * @description 公告审核
+ * @param {object} data
+ */
+export const auditSnapshotBulletin = (data: object) =>{
+	return request({
+		url: `/api/v1/SnapshotBulletin/bulletin/examine`,
+		method: 'post',
+		data
+	});
+}
+/**
+ * @description 上架或者下架公告
+ * @param {object} data
+ */
+export const shelfSnapshotBulletin = (data: object) =>{
+	return request({
+		url: `/api/v1/SnapshotBulletin/bulletin-arrive`,
+		method: 'post',
+		data
+	});
+}

+ 228 - 0
src/views/snapshot/info/sspConfig/components/Config-add.vue

@@ -0,0 +1,228 @@
+<template>
+	<el-dialog v-model="state.dialogVisible" width="70%" draggable title="新增随手拍信息配置" @close="close">
+		<el-form :model="state.ruleForm" label-width="110px" ref="ruleFormRef" v-loading="loading" scroll-to-error>
+				<el-row :gutter="10">
+					<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12">
+						<el-form-item label="公告类型" prop="bulletinObj" :rules="[{ required: true, message: '请选择公告类型', trigger: 'change' }]">
+							<el-select
+								v-model="state.ruleForm.bulletinObj"
+								placeholder="请选择公告类型"
+								value-key="dicDataValue"
+								class="w100"
+								@change="
+									(e) => {
+										state.ruleForm.bulletinTypeId = e.dicDataValue;
+										state.ruleForm.bulletinTypeName = e.dicDataName;
+									}
+								"
+							>
+								<el-option v-for="item in bulletinTypeOptions" :value="item" :key="item.dicDataValue" :label="item.dicDataName" />
+							</el-select>
+						</el-form-item>
+					</el-col>
+					<el-col :xs="24" :sm="24" :md="12" :lg="12" :xl="12">
+						<el-form-item label="公告标题" prop="title" :rules="[{ required: true, message: '请填写公告标题', trigger: 'blur' }]">
+							<el-input v-model="state.ruleForm.title" placeholder="请填写公告标题" clearable show-word-limit maxlength="200"></el-input>
+						</el-form-item>
+					</el-col>
+					<el-col :xs="24" :sm="24" :md="12" :lg="12" :xl="12">
+						<el-form-item label="失效时间" prop="loseEfficacyTime" :rules="[{ required: true, message: '请选择失效时间', trigger: 'change' }]">
+							<el-date-picker
+								v-model="state.ruleForm.loseEfficacyTime"
+								type="datetime"
+								placeholder="请选择失效时间"
+								value-format="YYYY-MM-DD[T]HH:mm:ss"
+								class="w100"
+								:disabled-date="disabledDate"
+								popper-class="no-atTheMoment"
+							/>
+						</el-form-item>
+					</el-col>
+					<el-col :xs="24" :sm="24" :md="12" :lg="12" :xl="12">
+						<el-form-item label="来源单位" prop="sourceOrgId" :rules="[{ required: true, message: '请选择来源单位', trigger: 'change' }]">
+							<el-cascader
+								:options="orgsOptions"
+								filterable
+								:props="{ value: 'id', label: 'name', emitPath: false, checkStrictly: true }"
+								placeholder="请选择来源单位"
+								class="w100"
+								v-model="state.ruleForm.sourceOrgId"
+								ref="orgRef"
+								@change="changeOrg"
+							>
+							</el-cascader>
+						</el-form-item>
+					</el-col>
+					<el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
+						<el-form-item label="公告范围" prop="pushRangesArray" :rules="[{ required: true, message: '请选择公告范围', trigger: 'change' }]">
+							<el-checkbox-group v-model="state.ruleForm.pushRangesArray">
+								<el-checkbox :value="item" v-for="item in pushRangesOptions" :key="item.dicDataValue">{{ item.dicDataName }}</el-checkbox>
+							</el-checkbox-group>
+						</el-form-item>
+					</el-col>
+					<el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
+						<el-form-item label="公告位置" prop="displayLocationArr" :rules="[{ required: false, message: '请选择公告位置', trigger: 'change' }]">
+							<el-checkbox-group v-model="state.ruleForm.displayLocationArr">
+								<el-checkbox :value="item" v-for="item in bulletinDisplayLocation" :key="item.dicDataValue">{{ item.dicDataName }}</el-checkbox>
+							</el-checkbox-group>
+						</el-form-item>
+					</el-col>
+					<el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
+						<el-form-item label="公告内容" prop="content" :rules="[{ required: true, message: '请填写公告内容', trigger: 'blur' }]">
+							<editor v-model:get-html="state.ruleForm.content" placeholder="请填写公告内容" height="450px" />
+						</el-form-item>
+					</el-col>
+				</el-row>
+		</el-form>
+		<template #footer>
+			<span class="dialog-footer">
+				<el-button @click="closeDialog" class="default-button">取 消</el-button>
+				<el-button type="primary" @click="onSubmit(ruleFormRef)" :loading="loading">确 定</el-button>
+			</span>
+		</template>
+	</el-dialog>
+</template>
+
+<script setup lang="tsx" name="noticeDetail">
+import { reactive, ref, defineAsyncComponent, computed, unref, FunctionalComponent } from 'vue';
+import { bulletinAdd, bulletinAddBaseData, circularAdd, circularAddBaseData, getAllUsers } from '@/api/auxiliary/notice';
+import { throttle } from '@/utils/tools';
+import { CheckboxValueType, ElMessage, FormInstance } from 'element-plus';
+import { disabledDate } from '@/utils/constants';
+import { ElCheckbox } from 'element-plus';
+// 引入组件
+const Editor = defineAsyncComponent(() => import('@/components/Editor/index.vue')); // 富文本编辑器
+// 定义子组件向父组件传值/事件
+const emit = defineEmits(['updateList']);
+// 定义变量内容
+const state = reactive<any>({
+	dialogVisible: false,
+	ruleForm: {
+		isMustRead: false, // 是否必须阅读
+		displayLocationArr:[],
+	},
+	searchContent: '', // 搜索内容
+});
+let loading = ref<boolean>(false); // 加载状态
+// 打开弹窗
+const ruleFormRef = ref<RefType>();
+
+const bulletinTypeOptions = ref<EmptyArrayType>([]); // 公告类型
+const pushRangesOptions = ref<EmptyArrayType>([]); // 公告范围
+const orgsOptions = ref<EmptyArrayType>([]); // 来源单位
+const userTables = ref<EmptyArrayType>([]); // 通知对象 个人
+const bulletinDisplayLocation = ref<EmptyArrayType>([]); // 公告位置
+const openDialog = async (type: string) => {
+	loading.value = true;
+	state.dialogVisible = true;
+
+
+	try {
+		const [responseAnnounce] = await Promise.all([bulletinAddBaseData()]);
+		bulletinTypeOptions.value = responseAnnounce.result?.bulletinType ?? [];
+		pushRangesOptions.value = responseAnnounce.result?.pushRanges ?? [];
+		orgsOptions.value = responseAnnounce.result?.orgsOptions ?? [];
+		bulletinDisplayLocation.value = responseAnnounce.result?.bulletinDisplayLocation ?? [];
+		loading.value = false;
+	} catch (error) {
+		console.log(error);
+		loading.value = true;
+	}
+};
+const orgRef = ref<RefType>(); //来源单位
+const changeOrg = () => {
+	const currentNode = orgRef.value.getCheckedNodes();
+	state.ruleForm.sourceOrgName = currentNode[0].label;
+};
+
+type SelectionCellProps = {
+	value: boolean;
+	intermediate?: boolean;
+	onChange: (value: CheckboxValueType) => void;
+};
+
+const SelectionCell: FunctionalComponent<SelectionCellProps> = ({ value, intermediate = false, onChange }) => {
+	return <ElCheckbox onChange={onChange} modelValue={value} indeterminate={intermediate} />;
+};
+const tables = computed({
+	get() {
+		// 注意: filter() 不会改变原始数组。
+		// 模糊搜索
+		if (!state.searchContent) return userTables.value;
+		// filter() 方法创建一个新的数组,新数组中的元素是通过检查指定数组中符合条件的所有元素。
+		// 注意: filter() 不会对空数组进行检测。
+		return userTables.value.filter((data: any) => {
+			// some() 方法用于检测数组中的元素是否满足指定条件;
+			// some() 方法会依次执行数组的每个元素:
+			// 如果有一个元素满足条件,则表达式返回true , 剩余的元素不会再执行检测;
+			// 如果没有满足条件的元素,则返回false。
+			// 注意: some() 不会对空数组进行检测。
+			// 注意: some() 不会改变原始数组。
+			return Object.keys(data).some((key) => {
+				// indexOf() 返回某个指定的字符在某个字符串中首次出现的位置,如果没有找到就返回-1;
+				// 该方法对大小写敏感!所以之前需要toLowerCase()方法将所有查询到内容变为小写。
+				return String(data[key]).toLowerCase().indexOf(state.searchContent) > -1;
+			});
+		});
+	},
+	set(val) {
+		// userTables.value = val;
+	},
+});
+
+// 保存
+const onSubmit = throttle(async (formEl: FormInstance | undefined) => {
+	if (!formEl) return;
+	await formEl.validate((valid: boolean) => {
+		if (!valid) return;
+		loading.value = true;
+
+		const pushRanges = state.ruleForm.pushRangesArray.map((item: any) => {
+			return {
+				key: item.dicDataValue,
+				value: item.dicDataName,
+			};
+		});
+		const displayLocation = state.ruleForm.displayLocationArr.map((item: any) => {
+			return {
+				key: item.dicDataValue,
+				value: item.dicDataName,
+			};
+		});
+		const bulletinRequest = {
+			title: state.ruleForm.title,
+			content: state.ruleForm.content,
+			bulletinTypeId: state.ruleForm.bulletinTypeId,
+			bulletinTypeName: state.ruleForm.bulletinTypeName,
+			loseEfficacyTime: state.ruleForm.loseEfficacyTime,
+			sourceOrgId: state.ruleForm.sourceOrgId,
+			sourceOrgName: state.ruleForm.sourceOrgName,
+			pushRanges,
+			displayLocation
+		};
+		bulletinAdd(bulletinRequest)
+			.then(() => {
+				loading.value = false;
+				closeDialog();
+				emit('updateList');
+				ElMessage.success('操作成功');
+			})
+			.catch(() => {
+				loading.value = false;
+			});
+	});
+}, 300);
+// 关闭弹窗
+const closeDialog = () => {
+	state.dialogVisible = false;
+};
+const close = () => {
+	ruleFormRef.value?.clearValidate();
+	ruleFormRef.value?.resetFields();
+};
+// 暴露变量
+defineExpose({
+	openDialog,
+	closeDialog,
+});
+</script>

+ 13 - 3
src/views/snapshot/info/sspConfig/index.vue

@@ -118,7 +118,7 @@
 <script lang="tsx" setup name="snapshotInfoSspConfig">
 <script lang="tsx" setup name="snapshotInfoSspConfig">
 import { defineAsyncComponent, onMounted, reactive, ref } from 'vue';
 import { defineAsyncComponent, onMounted, reactive, ref } from 'vue';
 import { ElMessageBox, FormInstance } from 'element-plus';
 import { ElMessageBox, FormInstance } from 'element-plus';
-import { getSnapshotBulletinList } from '@/api/snapshot/info';
+import { getSnapshotBulletinBaseData, getSnapshotBulletinList } from '@/api/snapshot/info';
 import { useRouter } from 'vue-router';
 import { useRouter } from 'vue-router';
 import { defaultTimeStartEnd, shortcuts } from '@/utils/constants';
 import { defaultTimeStartEnd, shortcuts } from '@/utils/constants';
 
 
@@ -226,7 +226,7 @@ const gridOptions = reactive<any>({
 			width: 100,
 			width: 100,
 		},
 		},
 		{
 		{
-			field: 'guiderReadPackAmountTxt',
+			field: 'bulletinStateText',
 			title: '审批状态',
 			title: '审批状态',
 			width: 100,
 			width: 100,
 		},
 		},
@@ -333,14 +333,24 @@ const router = useRouter();
 const onDetail = (row: any) => {
 const onDetail = (row: any) => {
 	router.push({
 	router.push({
 		name: 'auxiliaryNoticeDetail',
 		name: 'auxiliaryNoticeDetail',
-		params: {
+		query: {
 			id: row.id,
 			id: row.id,
 			tagsViewName: row.name,
 			tagsViewName: row.name,
 		},
 		},
 	});
 	});
 };
 };
+// 获取基础信息
+const getBaseInfo = async () => {
+	try {
+		const { result } = await getSnapshotBulletinBaseData();
+		console.log(result)
+	}catch (e){
+		console.log(e)
+	}
+};
 // 页面加载时
 // 页面加载时
 onMounted(() => {
 onMounted(() => {
 	queryList();
 	queryList();
+	getBaseInfo();
 });
 });
 </script>
 </script>