|
@@ -7,6 +7,7 @@ import { getStrDictOptions } from '@/utils/dict'
|
|
|
import * as DeptApi from '@/api/system/dept'
|
|
import * as DeptApi from '@/api/system/dept'
|
|
|
import { IotRdDailyReportApi } from '@/api/pms/iotrddailyreport'
|
|
import { IotRdDailyReportApi } from '@/api/pms/iotrddailyreport'
|
|
|
import { formatT } from '@/utils/formatTime'
|
|
import { formatT } from '@/utils/formatTime'
|
|
|
|
|
+import { defaultProps, handleTree } from '@/utils/tree'
|
|
|
|
|
|
|
|
const user = useUserStore().getUser
|
|
const user = useUserStore().getUser
|
|
|
|
|
|
|
@@ -53,6 +54,8 @@ interface Form {
|
|
|
externalRental: string
|
|
externalRental: string
|
|
|
malfunction: string
|
|
malfunction: string
|
|
|
otherNptReason: string
|
|
otherNptReason: string
|
|
|
|
|
+ createTime: number
|
|
|
|
|
+ constructionBrief: string
|
|
|
[key: (typeof NON_PROD_FIELDS)[number]['key']]: any
|
|
[key: (typeof NON_PROD_FIELDS)[number]['key']]: any
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -100,6 +103,8 @@ function handleRowValidate(key: string) {
|
|
|
|
|
|
|
|
const rules: FormRules = {
|
|
const rules: FormRules = {
|
|
|
deptId: [{ required: true, message: '请选择施工队伍', trigger: ['blur', 'change'] }],
|
|
deptId: [{ required: true, message: '请选择施工队伍', trigger: ['blur', 'change'] }],
|
|
|
|
|
+ createTime: [{ required: true, message: '请选择施工日期', trigger: ['blur', 'change'] }],
|
|
|
|
|
+ constructionBrief: [{ required: true, message: '请输入施工简报', trigger: ['blur', 'change'] }],
|
|
|
timeRange: [
|
|
timeRange: [
|
|
|
{ required: true, message: '请选择时间节点', trigger: ['blur', 'change'], type: 'array' }
|
|
{ required: true, message: '请选择时间节点', trigger: ['blur', 'change'], type: 'array' }
|
|
|
],
|
|
],
|
|
@@ -121,17 +126,36 @@ interface UserOptions {
|
|
|
|
|
|
|
|
const userOptions = ref<UserOptions[]>([])
|
|
const userOptions = ref<UserOptions[]>([])
|
|
|
|
|
|
|
|
-const deptOptions = ref<UserOptions[]>([])
|
|
|
|
|
|
|
+const deptLoading = ref(false)
|
|
|
|
|
+const deptOptions = ref<any[]>([])
|
|
|
|
|
|
|
|
const submitterNames = ref('')
|
|
const submitterNames = ref('')
|
|
|
|
|
|
|
|
async function loadDept() {
|
|
async function loadDept() {
|
|
|
- const res = await DeptApi.specifiedSimpleDepts(deptId)
|
|
|
|
|
- deptOptions.value = res.map((item: any) => ({
|
|
|
|
|
- label: item.name,
|
|
|
|
|
- value: item.id,
|
|
|
|
|
- raw: item
|
|
|
|
|
- }))
|
|
|
|
|
|
|
+ deptLoading.value = true
|
|
|
|
|
+ try {
|
|
|
|
|
+ function sortTreeBySort(treeNodes: Tree[]) {
|
|
|
|
|
+ if (!treeNodes || !Array.isArray(treeNodes)) return treeNodes
|
|
|
|
|
+ const sortedNodes = [...treeNodes].sort((a, b) => {
|
|
|
|
|
+ const sortA = a.sort != null ? a.sort : 999999
|
|
|
|
|
+ const sortB = b.sort != null ? b.sort : 999999
|
|
|
|
|
+ return sortA - sortB
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
|
|
+ sortedNodes.forEach((node) => {
|
|
|
|
|
+ if (node.children && Array.isArray(node.children)) {
|
|
|
|
|
+ node.children = sortTreeBySort(node.children)
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ return sortedNodes
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ const depts = await DeptApi.specifiedSimpleDepts(deptId)
|
|
|
|
|
+ deptOptions.value = sortTreeBySort(handleTree(depts))
|
|
|
|
|
+ } catch (error) {
|
|
|
|
|
+ } finally {
|
|
|
|
|
+ deptLoading.value = false
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
async function loadUserOptions() {
|
|
async function loadUserOptions() {
|
|
@@ -249,12 +273,25 @@ async function submitForm() {
|
|
|
>
|
|
>
|
|
|
<div class="grid grid-cols-2 gap-x-8">
|
|
<div class="grid grid-cols-2 gap-x-8">
|
|
|
<el-form-item label="施工队伍" prop="deptId">
|
|
<el-form-item label="施工队伍" prop="deptId">
|
|
|
- <el-select
|
|
|
|
|
|
|
+ <el-tree-select
|
|
|
v-model="form.deptId"
|
|
v-model="form.deptId"
|
|
|
- :options="deptOptions"
|
|
|
|
|
|
|
+ :data="deptOptions"
|
|
|
|
|
+ :props="defaultProps"
|
|
|
|
|
+ check-strictly
|
|
|
|
|
+ node-key="id"
|
|
|
filterable
|
|
filterable
|
|
|
|
|
+ class="w-full"
|
|
|
placeholder="请选择施工队伍"
|
|
placeholder="请选择施工队伍"
|
|
|
|
|
+ />
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ <el-form-item label="施工日期" prop="createTime">
|
|
|
|
|
+ <el-date-picker
|
|
|
|
|
+ v-model="form.createTime"
|
|
|
|
|
+ type="datetime"
|
|
|
clearable
|
|
clearable
|
|
|
|
|
+ class="w-full!"
|
|
|
|
|
+ placeholder="请选择施工日期"
|
|
|
|
|
+ value-format="x"
|
|
|
/>
|
|
/>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
<el-form-item label="施工地点" prop="location">
|
|
<el-form-item label="施工地点" prop="location">
|
|
@@ -354,6 +391,17 @@ async function submitForm() {
|
|
|
placeholder="请输入故障情况"
|
|
placeholder="请输入故障情况"
|
|
|
/>
|
|
/>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
|
|
+ <el-form-item class="col-span-2" label="施工简报" prop="constructionBrief">
|
|
|
|
|
+ <el-input
|
|
|
|
|
+ v-model="form.constructionBrief"
|
|
|
|
|
+ type="textarea"
|
|
|
|
|
+ :autosize="{ minRows: 2 }"
|
|
|
|
|
+ show-word-limit
|
|
|
|
|
+ resize="none"
|
|
|
|
|
+ :maxlength="1000"
|
|
|
|
|
+ placeholder="请输入施工简报"
|
|
|
|
|
+ />
|
|
|
|
|
+ </el-form-item>
|
|
|
</div>
|
|
</div>
|
|
|
<el-divider class="m-0! mb-3! border-2! border-[var(--el-color-primary)]!" />
|
|
<el-divider class="m-0! mb-3! border-2! border-[var(--el-color-primary)]!" />
|
|
|
<h3 class="text-lg font-bold text-gray-800 mb-6 flex items-center gap-2">
|
|
<h3 class="text-lg font-bold text-gray-800 mb-6 flex items-center gap-2">
|