update:图纸管理界面
This commit is contained in:
218
src/views/DrawingPaper.vue
Normal file
218
src/views/DrawingPaper.vue
Normal file
@@ -0,0 +1,218 @@
|
|||||||
|
<template>
|
||||||
|
<a-form layout="inline" :model="form">
|
||||||
|
<a-form-item>
|
||||||
|
<a-input v-model:value="form.acceptId" />
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item>
|
||||||
|
<a-button @click="getDrawingPapers()">获取项目图纸</a-button>
|
||||||
|
</a-form-item>
|
||||||
|
</a-form>
|
||||||
|
<div class="tool-bar">
|
||||||
|
<a-space>
|
||||||
|
<a-button>重新加盖二维码</a-button>
|
||||||
|
<a-button>修改合格状态</a-button>
|
||||||
|
<a-button>合格图纸盖章</a-button>
|
||||||
|
</a-space>
|
||||||
|
</div>
|
||||||
|
<a-table :dataSource="drawingPapers" :columns="columns" size="small">
|
||||||
|
<template #DrawPaper="{ record}">
|
||||||
|
<a-checkbox
|
||||||
|
v-if="record.checkBox"
|
||||||
|
v-model:checked="selectIds[record.id]"
|
||||||
|
@change="e => onChange(record, e)"
|
||||||
|
></a-checkbox>
|
||||||
|
{{ record.DrawPaper }}
|
||||||
|
</template>
|
||||||
|
<template #tags="{ record }">
|
||||||
|
<span v-for="tag in record.tags" :key="tag">
|
||||||
|
<a-tag
|
||||||
|
:v-if="tag.show || tag.value == true"
|
||||||
|
:color="
|
||||||
|
tag.value == true
|
||||||
|
? 'success'
|
||||||
|
: tag.value == false
|
||||||
|
? 'error'
|
||||||
|
: 'default'
|
||||||
|
"
|
||||||
|
>
|
||||||
|
<template #icon>
|
||||||
|
<check-circle-outlined v-if="tag.value == true" />
|
||||||
|
<close-circle-outlined v-else-if="tag.value == false" />
|
||||||
|
<exclamation-circle-outlined v-else />
|
||||||
|
</template>
|
||||||
|
{{ tag.text }}
|
||||||
|
</a-tag>
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
</a-table>
|
||||||
|
</template>
|
||||||
|
<style></style>
|
||||||
|
<script>
|
||||||
|
import { ref } from "@vue/runtime-core";
|
||||||
|
import { get } from "@/services/http";
|
||||||
|
import {
|
||||||
|
CheckCircleOutlined,
|
||||||
|
CloseCircleOutlined,
|
||||||
|
ExclamationCircleOutlined
|
||||||
|
} from "@ant-design/icons-vue";
|
||||||
|
export default {
|
||||||
|
components: {
|
||||||
|
CheckCircleOutlined,
|
||||||
|
CloseCircleOutlined,
|
||||||
|
ExclamationCircleOutlined
|
||||||
|
},
|
||||||
|
setup() {
|
||||||
|
let rawResult;
|
||||||
|
const selectIds = ref({});
|
||||||
|
const columns = ref([
|
||||||
|
{
|
||||||
|
title: "专业",
|
||||||
|
dataIndex: "SpecialtyName",
|
||||||
|
width: 100
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "单体",
|
||||||
|
dataIndex: "SubPrjName",
|
||||||
|
width: 100
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "审查阶段",
|
||||||
|
dataIndex: "StageName",
|
||||||
|
width: 140
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "图纸",
|
||||||
|
dataIndex: "DrawPaper",
|
||||||
|
slots: { customRender: "DrawPaper" }
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "状态",
|
||||||
|
key: "tags",
|
||||||
|
slots: { customRender: "tags" }
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "操作",
|
||||||
|
key: "action"
|
||||||
|
}
|
||||||
|
]);
|
||||||
|
const drawingPapers = ref([]);
|
||||||
|
const form = ref({
|
||||||
|
acceptId: 0
|
||||||
|
});
|
||||||
|
const getDrawingPapers = async () => {
|
||||||
|
var res = await get("/api2/repair/GetDrawingPapers", {
|
||||||
|
acceptId: form.value.acceptId
|
||||||
|
});
|
||||||
|
if (res.errorCode == 0) {
|
||||||
|
rawResult = res.data;
|
||||||
|
var { table } = groupDrawingPaper(rawResult);
|
||||||
|
drawingPapers.value = table;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
function groupDrawingPaper(drawingPapers) {
|
||||||
|
var group = {};
|
||||||
|
var spFilter = {};
|
||||||
|
var singFilter = {};
|
||||||
|
var stageFilter = {};
|
||||||
|
|
||||||
|
for (const dp of drawingPapers) {
|
||||||
|
var spId = dp.SpecialtyId;
|
||||||
|
group[spId] = group[spId] || {
|
||||||
|
key: `${spId}`,
|
||||||
|
SpecialtyName: dp.SpecialtyName,
|
||||||
|
SpecialtyId: spId,
|
||||||
|
children: {}
|
||||||
|
};
|
||||||
|
spFilter[spId] = spFilter[spId] || {
|
||||||
|
text: dp.SpecialtyName,
|
||||||
|
value: spId
|
||||||
|
};
|
||||||
|
|
||||||
|
var singId = dp.Public_ProjectSingleId;
|
||||||
|
group[spId].children[singId] = group[spId].children[singId] || {
|
||||||
|
key: `${spId}${singId}`,
|
||||||
|
SubPrjName: dp.SubPrjName,
|
||||||
|
Public_ProjectSingleId: singId,
|
||||||
|
children: {}
|
||||||
|
};
|
||||||
|
singFilter[singId] = singFilter[singId] || {
|
||||||
|
text: dp.SubPrjName,
|
||||||
|
value: singId
|
||||||
|
};
|
||||||
|
var stageNumber = dp.StageNumber;
|
||||||
|
group[spId].children[singId].children[stageNumber] = group[spId]
|
||||||
|
.children[singId].children[stageNumber] || {
|
||||||
|
key: `${spId}${singId}${stageNumber}`,
|
||||||
|
StageNumber: stageNumber,
|
||||||
|
StageName: `${stageNumber}审`,
|
||||||
|
children: []
|
||||||
|
};
|
||||||
|
stageFilter[stageNumber] = stageFilter[stageNumber] || {
|
||||||
|
text: `${stageNumber}审`,
|
||||||
|
value: stageNumber
|
||||||
|
};
|
||||||
|
var tags = [
|
||||||
|
{ text: "二维码", value: dp.IsQRCoded },
|
||||||
|
{
|
||||||
|
text: "合格",
|
||||||
|
value: dp.IsQualified
|
||||||
|
},
|
||||||
|
{
|
||||||
|
text: "盖章",
|
||||||
|
value: dp.IsSignature
|
||||||
|
}
|
||||||
|
];
|
||||||
|
if (dp.OriginalFileName.endsWith("pdf")) {
|
||||||
|
tags.shift();
|
||||||
|
}
|
||||||
|
if (dp.DefaultSpecailtyId != dp.SpecialtyId) {
|
||||||
|
tags.push({
|
||||||
|
text: "相关专业",
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
}
|
||||||
|
group[spId].children[singId].children[stageNumber].children.push({
|
||||||
|
key: `${spId}${singId}${stageNumber}${dp.Id}`,
|
||||||
|
id: dp.Id,
|
||||||
|
SpecialtyId: spId,
|
||||||
|
Public_ProjectSingleId: singId,
|
||||||
|
StageNumber: stageNumber,
|
||||||
|
DrawPaper: `${dp.DrawNum}-${dp.DrawName}`,
|
||||||
|
checkBox: true,
|
||||||
|
WebFileName: dp.WebFileName,
|
||||||
|
tags //展示标签 合格,不合格, 二维码 相关专业,盖章未盖章
|
||||||
|
});
|
||||||
|
}
|
||||||
|
var table = Object.values(group).map(sp => {
|
||||||
|
var single = Object.values(sp.children);
|
||||||
|
single.map(s => (s.children = Object.values(s.children)));
|
||||||
|
sp.children = single;
|
||||||
|
return sp;
|
||||||
|
});
|
||||||
|
return { table, spFilter, singFilter, stageFilter };
|
||||||
|
}
|
||||||
|
var isFileGroup = true;
|
||||||
|
function onChange(record, e) {
|
||||||
|
var checked = e.target.checked;
|
||||||
|
if (isFileGroup) {
|
||||||
|
//对同一组的record一起处理
|
||||||
|
var ids = rawResult
|
||||||
|
.filter(d => d.WebFileName === record.WebFileName)
|
||||||
|
.map(d => d.Id);
|
||||||
|
ids.forEach(id => {
|
||||||
|
selectIds.value[id] = checked;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
drawingPapers,
|
||||||
|
getDrawingPapers,
|
||||||
|
columns,
|
||||||
|
form,
|
||||||
|
selectIds,
|
||||||
|
onChange
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
||||||
Reference in New Issue
Block a user