pull/1/head
Dragon 1 year ago
parent 8755666c5d
commit e27b8239e9

@ -0,0 +1 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1711356174084" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="6298" xmlns:xlink="http://www.w3.org/1999/xlink" width="48" height="48"><path d="M608 112a16 16 0 0 1 16 16v48A16 16 0 0 1 608 192L192 192.064V832h640V416a16 16 0 0 1 16-16H896a16 16 0 0 1 16 16v464a32 32 0 0 1-32 32H144a32 32 0 0 1-32-32V144a32 32 0 0 1 32-32H608z m236.16 11.328a16 16 0 0 1 22.592 0l33.92 33.92a16 16 0 0 1 0 22.656l-452.48 452.48a16 16 0 0 1-22.656 0l-33.92-33.92a16 16 0 0 1 0-22.592z" p-id="6299" fill="#666666"></path></svg>

After

Width:  |  Height:  |  Size: 697 B

@ -61,7 +61,7 @@ const saveHandler = debounce(() => {
</div> </div>
</template> </template>
<style lang="less"> <style lang="less" scoped>
.title{ .title{
font-size: 18px; font-size: 18px;
font-family: PingFang SC, PingFang SC-Medium; font-family: PingFang SC, PingFang SC-Medium;

@ -560,21 +560,9 @@ function getPercent(pictureid: string) {
</div> </div>
</div> </div>
<div class="info-header">
<div class="left_box">
<div class="title">
填报信息
</div>
<SvgIcon size="12" name="collapse" />
</div>
<div class="right_box" @click="showActionsModal">
自定义设置
<SvgIcon size="16" name="pencil" />
</div>
</div>
<n-tabs type="line" animated> <n-tabs type="line" animated>
<n-tab-pane name="task-info" tab="任务信息"> <n-tab-pane name="task-info" tab="任务信息">
<TaskTable :data="taskDetailInfo" :task-table-data="taskTableData" /> <TaskTable :data="taskDetailInfo" :task-table-data="taskTableData" @show-modal="showActionsModal" />
</n-tab-pane> </n-tab-pane>
<n-tab-pane name="picture-info" tab="图片信息"> <n-tab-pane name="picture-info" tab="图片信息">
<PictureTable :data="taskDetailInfo" /> <PictureTable :data="taskDetailInfo" />
@ -822,36 +810,5 @@ function getPercent(pictureid: string) {
} }
} }
} }
.info-header {
display: flex;
padding: 16px 0px;
align-items: center;
justify-content: space-between;
.left_box {
display: flex;
align-items: center;
.title {
display: flex;
align-items: center;
margin-right: 8px;
&:before {
content: "";
width: 4px;
height: 18px;
background: #507afd;
border-radius: 3px;
display: inline-block;
margin-right: 10px;
}
}
}
.right_box {
display: flex;
align-items: center;
cursor: pointer;
}
}
} }
</style> </style>

@ -1,33 +1,91 @@
<script lang="ts" setup> <script lang="ts" setup>
import { onMounted } from "vue"; defineProps({
const props = defineProps({
data: { data: {
type: Object as PropType<any>, type: Object as PropType<any>,
required: true, required: true,
}, },
taskTableData: { taskTableData: {
type: Array, type: Array as any,
default: () => [[]], default: () => [[]],
}, },
});
onMounted(()=>{
console.log(props.taskTableData,'taskTableData')
}) })
const emit = defineEmits(['showModal'])
function showActionsModal() {
emit('showModal')
}
</script> </script>
<template> <template>
<div class="info-header">
<div class="left_box">
<div class="title">
填报信息
</div>
</div>
<div class="right_box" @click="showActionsModal">
自定义设置
<SvgIcon class="icon" size="16" name="edit" />
</div>
</div>
<table class="description"> <table class="description">
<tr v-for="(item, index) in taskTableData" :key="index"> <tr v-for="(item, index) in taskTableData" :key="index">
<th v-if="item&&item[0]">{{ item[0]["label"] }}</th> <th v-if="item && item[0]">
<td v-if="item&&item[0]">{{ item[0]["value"] }}</td> {{ item[0].label }}
<th v-if="item&&item.length>1">{{ item[1]["label"] }}</th> </th>
<td v-if="item&&item.length>1">{{ item[1]["value"] }}</td> <td v-if="item && item[0]" :class="item.blue ? 'blue' : ''">
{{ item[0].value }}
</td>
<th v-if="item && item.length > 1">
{{ item[1].label }}
</th>
<td v-if="item && item.length > 1" :class="item.blue ? 'blue' : ''">
{{ item[1].value }}
</td>
</tr> </tr>
</table> </table>
</template> </template>
<style lang="less" scoped> <style lang="less" scoped>
.info-header {
display: flex;
padding: 6px 0 15px 0;
align-items: center;
justify-content: space-between;
.left_box {
display: flex;
align-items: center;
.title {
display: flex;
align-items: center;
font-size: 16px;
font-family: PingFang SC, PingFang SC-Medium;
font-weight: 500;
color: #333333;
&:before {
content: "";
width: 4px;
height: 12px;
background: #507afd;
border-radius: 3px;
display: inline-block;
margin-right: 10px;
}
}
}
.right_box {
display: flex;
align-items: center;
cursor: pointer;
font-size: 14px;
font-family: PingFang SC, PingFang SC-Regular;
color: #666666;
.icon{
margin-left: 7px
}
}
}
.description { .description {
width: 100%; width: 100%;
font-size: 14px; font-size: 14px;
@ -37,10 +95,18 @@ th {
width: 20%; width: 20%;
background-color: #fafafa; background-color: #fafafa;
color: #666666; color: #666666;
font-size: 14px;
font-family: PingFang SC, PingFang SC-Regular;
font-weight: 400;
line-height: 22px;
} }
td { td {
width: 30%; width: 30%;
font-size: 14px;
font-family: PingFang SC, PingFang SC-Regular;
font-weight: 400;
color: #666666;
} }
th, th,

@ -1,8 +1,8 @@
<script lang="ts" setup> <script lang="ts" setup>
import { getAllfieldList, getfieldList, savefield } from "@/api/home/filter"; import { defineEmits, defineProps, onMounted, ref } from 'vue'
import { ReportInfoConfig } from "@/config/workorder"; import { getAllfieldList, getfieldList, savefield } from '@/api/home/filter'
import { useUser } from "@/store/modules/user"; import { ReportInfoConfig } from '@/config/workorder'
import { defineEmits, defineProps, onMounted, ref } from "vue"; import { useUser } from '@/store/modules/user'
const props = defineProps({ const props = defineProps({
reviewType: { reviewType: {
@ -10,138 +10,139 @@ const props = defineProps({
default: () => 3, default: () => 3,
require: true, require: true,
}, },
}); })
const emit = defineEmits(['onOk'])
onMounted(async () => { onMounted(async () => {
const userStore = useUser(); const userStore = useUser()
const userInfo = userStore.getUserInfo; const userInfo = userStore.getUserInfo
let res; let res
res = await getAllfieldList(props.reviewType); // res = await getAllfieldList(props.reviewType) //
const allList = res.data; const allList = res.data
res = await getfieldList(props.reviewType, userInfo.id); // res = await getfieldList(props.reviewType, userInfo.id) //
const useList = res.data; const useList = res.data
/** /**
* name 标题 * name 标题
* id 键值 * id 键值
* fix 是否默认 * fix 是否默认
* checked 是否选中 * checked 是否选中
*/ */
const userFieldFixed = useList.userFieldFixed?.split(","); const userFieldFixed = useList.userFieldFixed?.split(',')
const userFieldUnFixed = useList.userFieldUnFixed?.split(","); const userFieldUnFixed = useList.userFieldUnFixed?.split(',')
allList.map((v) => { allList.map((v) => {
let item = { const item = {
name: v.fieldDesc, name: v.fieldDesc,
id: v.name, id: v.name,
fix: v.isrequired == 2, fix: v.isrequired == 2,
checked: checked:
v.isrequired == 2 || v.isrequired == 2
Boolean(userFieldFixed?.find(v2=>v2==v.name)) || || Boolean(userFieldFixed?.find(v2 => v2 == v.name))
Boolean(userFieldUnFixed?.find(v2=>v2==v.name)) || Boolean(userFieldUnFixed?.find(v2 => v2 == v.name)),
}; }
offList.value.push(item); offList.value.push(item)
}); })
}); })
const offList = ref<any[]>([]); const offList = ref<any[]>([])
function generatList() { function generatList() {
const keys = Object.keys(ReportInfoConfig); const keys = Object.keys(ReportInfoConfig)
const hideList: object[] = []; const hideList: object[] = []
for (const key of keys) { for (const key of keys) {
const name = ReportInfoConfig[key]?.label; const name = ReportInfoConfig[key]?.label
const isDefault = ReportInfoConfig[key]?.isDefault; const isDefault = ReportInfoConfig[key]?.isDefault
// Y // Y
if (!isDefault) { if (!isDefault) {
hideList.push({ hideList.push({
id: key, id: key,
name: name || "未配置", name: name || '未配置',
fix: isDefault, fix: isDefault,
checked: ReportInfoConfig[key].isDefault, checked: ReportInfoConfig[key].isDefault,
}); })
} }
} }
const fixedList = generateDefaultList(); const fixedList = generateDefaultList()
hideList.unshift(...fixedList); hideList.unshift(...fixedList)
offList.value = hideList; offList.value = hideList
return { hideList }; return { hideList }
} }
function generateDefaultList() { function generateDefaultList() {
return Object.keys(ReportInfoConfig).reduce((acc, key) => { return Object.keys(ReportInfoConfig).reduce((acc, key) => {
const { label, isDefault } = ReportInfoConfig[key]; const { label, isDefault } = ReportInfoConfig[key]
if (isDefault) { if (isDefault) {
const config = { const config = {
id: key, id: key,
name: label || "未配置", name: label || '未配置',
fix: true, fix: true,
checked: true, checked: true,
};
return [...acc, config];
} else {
return acc;
} }
}, []); return [...acc, config]
}
else {
return acc
}
}, [])
} }
const show = ref(false); const show = ref(false)
const checkAll = ref(false); const checkAll = ref(false)
function showModal() { function showModal() {
show.value = true; show.value = true
} }
function closeModal() { function closeModal() {
show.value = false; show.value = false
} }
const emit = defineEmits(["onOk"]);
async function handleSumbit(e: MouseEvent) { async function handleSumbit(e: MouseEvent) {
const userStore = useUser(); const userStore = useUser()
const userInfo = userStore.getUserInfo; const userInfo = userStore.getUserInfo
let userField = ""; let userField = ''
offList.value.map((v) => { offList.value.map((v) => {
if (v.checked) { if (v.checked)
userField += `${v.id},`; userField += `${v.id},`
} })
}); userField = userField.slice(0, userField.length - 1)
userField = userField.slice(0, userField.length - 1); savefield(props.reviewType, userInfo.id, userField)
savefield(props.reviewType, userInfo.id, userField); e.preventDefault()
e.preventDefault(); closeModal()
closeModal(); emit('onOk')
emit("onOk");
} }
defineExpose({ defineExpose({
showModal, showModal,
}); })
// generatList(); // generatList();
const selectIds = ref<string[]>([]); const selectIds = ref<string[]>([])
function onCheckAllChange(value) { function onCheckAllChange(value) {
const ids: string[] = []; const ids: string[] = []
for (const item of offList.value) { for (const item of offList.value) {
if (!item.fix) { if (!item.fix) {
item.checked = value; item.checked = value
ids.push(item.id); ids.push(item.id)
} }
} }
selectIds.value = value ? ids : []; selectIds.value = value ? ids : []
} }
function onCheckChange(checked: any, item: any) { function onCheckChange(checked: any, item: any) {
const index = selectIds.value.indexOf(item.id); const index = selectIds.value.indexOf(item.id)
item.checked = checked; item.checked = checked
if (index === -1 && checked) selectIds.value.push(item.id); if (index === -1 && checked)
else selectIds.value.splice(index, 1); selectIds.value.push(item.id)
else selectIds.value.splice(index, 1)
} }
</script> </script>
@ -198,7 +199,9 @@ function onCheckChange(checked: any, item: any) {
</div> </div>
<template #footer> <template #footer>
<div class="wrapper-footer"> <div class="wrapper-footer">
<n-button type="info" @click="handleSumbit"> </n-button> <n-button type="info" @click="handleSumbit">
确认
</n-button>
<n-button secondary style="margin-left: 15px" @click="closeModal"> <n-button secondary style="margin-left: 15px" @click="closeModal">
取消 取消
</n-button> </n-button>

Loading…
Cancel
Save