| | |
| | | <template> |
| | | <basic-container> |
| | | <el-tabs v-model="activeTab" @tab-click="handleTabChange"> |
| | | <el-tab-pane v-for="tab in filteredTabs" :key="tab.name" :label="`${tab.label} (${tab.count})`" :name="tab.name"> |
| | | <el-tab-pane |
| | | v-for="tab in filteredTabs" |
| | | :key="tab.name" |
| | | :label="`${tab.label} (${tab.count})`" |
| | | :name="tab.name" |
| | | > |
| | | <basic-main-content> |
| | | <!-- 查询条件筛选栏 --> |
| | | <div class="filter-bar"> |
| | | <el-input v-model="filters.keyword" placeholder="请输入关键字" class="filter-item" clearable |
| | | @keyup.enter="handleSearch" /> |
| | | <el-select v-model="filters.department" placeholder="请选择所属单位" class="filter-item" clearable> |
| | | <el-option v-for="item in departments" :key="item.value" :label="item.label" :value="item.value" /> |
| | | <el-input |
| | | v-model="filters.keyword" |
| | | placeholder="请输入关键字" |
| | | class="filter-item" |
| | | clearable |
| | | @keyup.enter="handleSearch" |
| | | /> |
| | | <el-select |
| | | v-model="filters.department" |
| | | placeholder="请选择所属单位" |
| | | class="filter-item" |
| | | clearable |
| | | > |
| | | <el-option |
| | | v-for="item in departments" |
| | | :key="item.value" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | /> |
| | | </el-select> |
| | | <el-select v-model="filters.type" placeholder="请选择工单类型" class="filter-item" clearable> |
| | | <el-option v-for="item in types" :key="item.value" :label="item.label" :value="item.value" /> |
| | | <el-select |
| | | v-model="filters.type" |
| | | placeholder="请选择工单类型" |
| | | class="filter-item" |
| | | clearable |
| | | > |
| | | <el-option |
| | | v-for="item in types" |
| | | :key="item.value" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | /> |
| | | </el-select> |
| | | <el-date-picker v-model="filters.dateRange" type="daterange" class="filter-item" range-separator="至" |
| | | start-placeholder="开始日期" end-placeholder="结束日期" :default-value="datePickerDefaultVal"> |
| | | <el-date-picker |
| | | v-model="filters.dateRange" |
| | | type="daterange" |
| | | class="filter-item" |
| | | range-separator="至" |
| | | start-placeholder="开始日期" |
| | | end-placeholder="结束日期" |
| | | :default-value="datePickerDefaultVal" |
| | | > |
| | | </el-date-picker> |
| | | <el-select v-model="filters.status" placeholder="请选择状态" class="filter-item" clearable> |
| | | <el-option v-for="item in statuses" :key="item.value" :label="item.label" :value="item.value" /> |
| | | <el-select |
| | | v-model="filters.status" |
| | | placeholder="请选择状态" |
| | | class="filter-item" |
| | | clearable |
| | | > |
| | | <el-option |
| | | v-for="item in statuses" |
| | | :key="item.value" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | /> |
| | | </el-select> |
| | | <el-select v-model="filters.algorithm" placeholder="请选择关联算法" class="filter-item" clearable> |
| | | <el-option v-for="item in algorithms" :key="item.dict_key" :label="item.dict_value" |
| | | :value="item.dict_key" /> |
| | | <el-select |
| | | v-model="filters.algorithm" |
| | | placeholder="请选择关联算法" |
| | | class="filter-item" |
| | | clearable |
| | | > |
| | | <el-option |
| | | v-for="item in algorithms" |
| | | :key="item.dict_key" |
| | | :label="item.dict_value" |
| | | :value="item.dict_key" |
| | | /> |
| | | </el-select> |
| | | <el-select v-model="filters.isReview" placeholder="请选择复核状态" class="filter-item" clearable> |
| | | <el-option v-for="item in reviewStatuses" :key="item.value" :label="item.label" :value="item.value" /> |
| | | <el-select |
| | | v-if="!hidereviewBtn" |
| | | v-model="filters.isReview" |
| | | placeholder="请选择复核状态" |
| | | class="filter-item" |
| | | clearable |
| | | > |
| | | <el-option |
| | | v-for="item in reviewStatuses" |
| | | :key="item.value" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | /> |
| | | </el-select> |
| | | <el-button type="primary" icon="el-icon-search" @click="handleSearch">搜索</el-button> |
| | | <el-button icon="el-icon-refresh" @click="handleReset">清空</el-button> |
| | | </div> |
| | | |
| | | <!-- 表格部分 --> |
| | | <avue-crud class="ztzf-public-general-avue-crud" ref="avueCrud" v-model="tableData" :option="option" |
| | | :data="tableData" v-model:page="page" @size-change="sizeChange" @current-change="handleCurrentChange" |
| | | @refresh-change="refreshChange" :table-loading="loading" @selection-change="handleSelectionChange" @cell-click="handleCellClick" |
| | | :permission="permissionList" v-if="activeTab === tab.name"> |
| | | <avue-crud |
| | | class="ztzf-public-general-avue-crud" |
| | | ref="avueCrud" |
| | | v-model="tableData" |
| | | :option="option" |
| | | :data="tableData" |
| | | v-model:page="page" |
| | | @size-change="sizeChange" |
| | | @current-change="handleCurrentChange" |
| | | @refresh-change="refreshChange" |
| | | :table-loading="loading" |
| | | @selection-change="handleSelectionChange" |
| | | @cell-click="handleCellClick" |
| | | :permission="permissionList" |
| | | v-if="activeTab === tab.name" |
| | | > |
| | | <template #menu-left> |
| | | <el-button v-if="(activeTab === 'all' || activeTab === 'myTickets') && permissionList.addBtn" |
| | | type="primary" icon="el-icon-plus" @click="handleAdd">新建工单</el-button> |
| | | <el-button v-if="activeTab === 'pending' && permissionList.reviewBtn" type="success" icon="el-icon-check" |
| | | @click="openReviewDialog">批量审核</el-button> |
| | | <el-button v-if="permissionList.exportBtn" type="success" plain icon="el-icon-download" |
| | | @click="exportData">导出</el-button> |
| | | <el-button |
| | | v-if="(activeTab === 'all' || activeTab === 'myTickets') && permissionList.addBtn" |
| | | type="primary" |
| | | icon="el-icon-plus" |
| | | @click="handleAdd" |
| | | >新建工单</el-button |
| | | > |
| | | <el-button |
| | | v-if="activeTab === 'pending' && permissionList.reviewBtn" |
| | | type="success" |
| | | icon="el-icon-check" |
| | | @click="openReviewDialog" |
| | | >批量审核</el-button |
| | | > |
| | | <el-button |
| | | v-if="permissionList.exportBtn" |
| | | type="success" |
| | | plain |
| | | icon="el-icon-download" |
| | | @click="exportData" |
| | | >导出</el-button |
| | | > |
| | | </template> |
| | | <template #menu="{ row }"> |
| | | <template v-if="row.status === -1"> |
| | | <el-button type="text" icon="el-icon-edit" @click="handleEdit(row)">编辑</el-button> |
| | | <el-button type="text" icon="el-icon-delete" class="danger-button" |
| | | @click="handleDelete(row)">删除</el-button> |
| | | <el-button |
| | | type="text" |
| | | icon="el-icon-delete" |
| | | class="danger-button" |
| | | @click="handleDelete(row)" |
| | | >删除</el-button |
| | | > |
| | | </template> |
| | | |
| | | <template v-else> |
| | | <el-button type="text" icon="el-icon-view" @click="handleViewDetail(row)">详情</el-button> |
| | | <el-button type="text" icon="el-icon-view" @click="handleViewDetail(row)" |
| | | >详情</el-button |
| | | > |
| | | </template> |
| | | |
| | | <template v-if="permission.tickets_repeat_review"> |
| | | <el-button v-if="row.status === 4 && row.isReview !== 1" type="text" icon="el-icon-check" |
| | | @click="reCheck(row)">复核</el-button> |
| | | <el-button |
| | | v-if="row.status === 4 && row.isReview !== 1" |
| | | type="text" |
| | | icon="el-icon-check" |
| | | @click="reCheck(row)" |
| | | >复核</el-button |
| | | > |
| | | </template> |
| | | |
| | | </template> |
| | | <template #status="{ row }"> |
| | | <span :style="getStatusTagType(row.status) ? 'color:' + getStatusTagType(row.status) : ''"> |
| | | <span |
| | | :style="getStatusTagType(row.status) ? 'color:' + getStatusTagType(row.status) : ''" |
| | | > |
| | | {{ mapStatus(row.status) }} |
| | | </span> |
| | | </template> |
| | |
| | | </el-tabs> |
| | | |
| | | <!-- 新建工单对话框 --> |
| | | <el-dialog v-model="dialogVisible" v-if="dialogVisible" title="新建工单" width="70%" :close-on-click-modal="false" |
| | | @close="resetForm"> |
| | | <el-form :model="form" :rules="rules" ref="form" label-width="90px" class="create-ticket-form"> |
| | | <el-dialog |
| | | v-model="dialogVisible" |
| | | v-if="dialogVisible" |
| | | title="新建工单" |
| | | width="70%" |
| | | :close-on-click-modal="false" |
| | | @close="resetForm" |
| | | > |
| | | <el-form |
| | | :model="form" |
| | | :rules="rules" |
| | | ref="form" |
| | | label-width="90px" |
| | | class="create-ticket-form" |
| | | > |
| | | <div class="form-section"> |
| | | <el-row :gutter="16"> |
| | | <el-col :span="12"> |
| | |
| | | <el-col :span="12"> |
| | | <el-form-item label="工单类型" prop="type"> |
| | | <el-select v-model="form.type" placeholder="请选择工单类型" class="full-width"> |
| | | <el-option v-for="item in types" :key="item.value" :label="item.label" :value="item.value" /> |
| | | <el-option |
| | | v-for="item in types" |
| | | :key="item.value" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | |
| | | <el-row :gutter="16"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="所属部门" prop="department"> |
| | | <el-select v-model="form.department" placeholder="请选择所属部门" @change="handleDepartmentChange" |
| | | class="full-width"> |
| | | <el-option v-for="dept in departments" :key="dept.value" :label="dept.label" :value="dept.value" /> |
| | | <el-select |
| | | v-model="form.department" |
| | | placeholder="请选择所属部门" |
| | | @change="handleDepartmentChange" |
| | | class="full-width" |
| | | > |
| | | <el-option |
| | | v-for="dept in departments" |
| | | :key="dept.value" |
| | | :label="dept.label" |
| | | :value="dept.value" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="处理人员" prop="handler"> |
| | | <el-select v-model="form.handler" placeholder="请先选择所属部门" :disabled="!form.department" |
| | | class="full-width"> |
| | | <el-option v-for="user in availableHandlers" :key="user.id" :label="user.name" :value="user.id" /> |
| | | <el-select |
| | | v-model="form.handler" |
| | | placeholder="请先选择所属部门" |
| | | :disabled="!form.department" |
| | | class="full-width" |
| | | > |
| | | <el-option |
| | | v-for="user in availableHandlers" |
| | | :key="user.id" |
| | | :label="user.name" |
| | | :value="user.id" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | |
| | | <el-row :gutter="16"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="关联算法" prop="algorithm"> |
| | | <el-select v-model="form.algorithm" multiple placeholder="请选择关联算法" class="full-width"> |
| | | <el-option v-for="item in algorithms" :key="item.value" :label="item.label" :value="item.value" /> |
| | | <el-select |
| | | v-model="form.algorithm" |
| | | multiple |
| | | placeholder="请选择关联算法" |
| | | class="full-width" |
| | | > |
| | | <el-option |
| | | v-for="item in algorithms" |
| | | :key="item.value" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="选择位置" prop="location"> |
| | | <div class="location-wrapper"> |
| | | <avue-input-map v-model="form.location" :clearable="false" :params="mapParams" |
| | | @change="handleLocationChange" type="button"> |
| | | <avue-input-map |
| | | v-model="form.location" |
| | | :clearable="false" |
| | | :params="mapParams" |
| | | @change="handleLocationChange" |
| | | type="button" |
| | | > |
| | | <el-button type="primary" plain class="map-button"> |
| | | <i class="el-icon-map-location"></i> 地图选点 |
| | | </el-button> |
| | |
| | | <el-row :gutter="16"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="工单内容" prop="content"> |
| | | <el-input type="textarea" v-model="form.content" :rows="4" placeholder="请输入工单内容描述"></el-input> |
| | | <el-input |
| | | type="textarea" |
| | | v-model="form.content" |
| | | :rows="4" |
| | | placeholder="请输入工单内容描述" |
| | | ></el-input> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="附件图片" prop="photos" required class="upload-wrapper"> |
| | | <el-upload v-if="createoredit === 1" ref="upload" :action="'#'" :auto-upload="false" |
| | | list-type="picture-card" :on-change="handleFileChange" :on-remove="handleUploadRemove" |
| | | :before-upload="beforeUpload" :file-list="form.photos" :limit="1" accept="image/*" |
| | | class="create-upload"> |
| | | <el-upload |
| | | v-if="createoredit === 1" |
| | | ref="upload" |
| | | :action="'#'" |
| | | :auto-upload="false" |
| | | list-type="picture-card" |
| | | :on-change="handleFileChange" |
| | | :on-remove="handleUploadRemove" |
| | | :before-upload="beforeUpload" |
| | | :file-list="form.photos" |
| | | :limit="1" |
| | | accept="image/*" |
| | | class="create-upload" |
| | | > |
| | | <template v-if="form.photos.length < 1"> |
| | | <!-- <i class="el-icon-plus">+</i> --> |
| | | <div class="el-icon-plus"> |
| | |
| | | </div> |
| | | </template> |
| | | </el-upload> |
| | | <el-upload v-else ref="upload" :action="'#'" :auto-upload="false" list-type="picture-card" |
| | | :on-change="handleFileChange" :on-remove="handleUploadRemove" :before-upload="beforeUpload" |
| | | :file-list="popupShowImage(form.photos)" :limit="1" accept="image/*" class="create-upload"> |
| | | <el-upload |
| | | v-else |
| | | ref="upload" |
| | | :action="'#'" |
| | | :auto-upload="false" |
| | | list-type="picture-card" |
| | | :on-change="handleFileChange" |
| | | :on-remove="handleUploadRemove" |
| | | :before-upload="beforeUpload" |
| | | :file-list="popupShowImage(form.photos)" |
| | | :limit="1" |
| | | accept="image/*" |
| | | class="create-upload" |
| | | > |
| | | <template v-if="form.photos.length < 1"> |
| | | |
| | | <div class="el-icon-plus"> |
| | | <span>+</span> |
| | | </div> |
| | |
| | | <template #footer> |
| | | <div class="dialog-footer"> |
| | | <el-button type="danger" :loading="submitLoading" @click="submitForm">发布</el-button> |
| | | <el-button type="infoprimary" plain :loading="draftLoading" @click="saveDraft">存草稿</el-button> |
| | | <el-button type="infoprimary" plain :loading="draftLoading" @click="saveDraft" |
| | | >存草稿</el-button |
| | | > |
| | | <el-button @click="dialogVisible = false">取 消</el-button> |
| | | </div> |
| | | </template> |
| | |
| | | <el-dialog v-model="detailVisible" title="工单详情" width="80%" append-to-body> |
| | | <div class="detail-container"> |
| | | <div class="detail-top-title"> |
| | | <div class="event-title-center event-orderNumber">{{ currentDetail.orderNumber || '工单编号' }}</div> |
| | | <div class="event-title-center event-orderNumber"> |
| | | {{ currentDetail.orderNumber || '工单编号' }} |
| | | </div> |
| | | <div class="event-title-center">{{ currentDetail.orderName || '事件名称' }}</div> |
| | | </div> |
| | | <div v-if="totalTime" class="event-total-time"> |
| | | 总耗时:{{ totalTime }} |
| | | </div> |
| | | <div v-if="totalTime" class="event-total-time">总耗时:{{ totalTime }}</div> |
| | | <!-- 工单状态流程 --> |
| | | <div class="custom-steps-container"> |
| | | <!-- 标题行 --> |
| | | <div class="steps-titles"> |
| | | <div v-for="(status, index) in stepStatusList" :key="index" :class="{ |
| | | 'step-title': true, |
| | | active: index <= stepStatusList.indexOf(String(currentDetail.status)), |
| | | }"> |
| | | <div |
| | | v-for="(status, index) in stepStatusList" |
| | | :key="index" |
| | | :class="{ |
| | | 'step-title': true, |
| | | active: index <= stepStatusList.indexOf(String(currentDetail.status)), |
| | | }" |
| | | > |
| | | {{ mapStatus(status) }} |
| | | </div> |
| | | </div> |
| | |
| | | {{ getStepHandler(status) }} |
| | | </span> |
| | | <div class="step-description" v-if="getStepTime(status)"> |
| | | <span class="step-timer"> |
| | | 耗时:{{ getStepTime(status) }} |
| | | </span> |
| | | <span class="step-timer"> 耗时:{{ getStepTime(status) }} </span> |
| | | </div> |
| | | <div class="step-description"> |
| | | {{ getStepCreateTime(status) }} |
| | |
| | | <el-table-column prop="label1" label="基本信息" width="150"> |
| | | <template #default="{ row }"> |
| | | <!-- 添加必填星号的标签 --> |
| | | <span v-if="currentDetail.status === 0 && row.label1 === '工单名称'" class="required-label"> |
| | | <span |
| | | v-if="currentDetail.status === 0 && row.label1 === '工单名称'" |
| | | class="required-label" |
| | | > |
| | | <span class="required-star">*</span>{{ row.label1 }} |
| | | </span> |
| | | <span v-else>{{ row.label1 }}</span> |
| | |
| | | </el-table-column> |
| | | <el-table-column> |
| | | <template #default="{ row }"> |
| | | <template v-if=" |
| | | currentDetail.status === 0 && |
| | | row.label1 === '工单名称' && |
| | | hasProcessingBtnPermission() |
| | | "> |
| | | <el-input v-model="currentDetail.orderName" placeholder="请输入工单名称" class="required-input" /> |
| | | <template |
| | | v-if=" |
| | | currentDetail.status === 0 && |
| | | row.label1 === '工单名称' && |
| | | hasProcessingBtnPermission() |
| | | " |
| | | > |
| | | <el-input |
| | | v-model="currentDetail.orderName" |
| | | placeholder="请输入工单名称" |
| | | class="required-input" |
| | | /> |
| | | </template> |
| | | <template v-else>{{ row.value1 }}</template> |
| | | </template> |
| | |
| | | <el-table-column prop="label2" label="基本信息" width="150"> |
| | | <template #default="{ row }"> |
| | | <!-- 添加必填星号的标签 --> |
| | | <span v-if=" |
| | | currentDetail.status === 0 && |
| | | (row.label2 === '工单类型' || row.label2 === '工单内容') |
| | | " class="required-label"> |
| | | <span |
| | | v-if=" |
| | | currentDetail.status === 0 && |
| | | (row.label2 === '工单类型' || row.label2 === '工单内容') |
| | | " |
| | | class="required-label" |
| | | > |
| | | <span class="required-star">*</span>{{ row.label2 }} |
| | | </span> |
| | | <span v-else>{{ row.label2 }}</span> |
| | |
| | | <el-table-column> |
| | | <template #default="{ row }"> |
| | | <!-- 修改工单类型和工单内容的显示 --> |
| | | <template v-if=" |
| | | currentDetail.status === 0 && |
| | | row.label2 === '工单类型' && |
| | | hasProcessingBtnPermission() |
| | | "> |
| | | <el-select v-model="currentDetail.type" placeholder="请选择工单类型" class="required-input"> |
| | | <el-option v-for="item in types" :key="item.value" :label="item.label" :value="item.value" /> |
| | | <template |
| | | v-if=" |
| | | currentDetail.status === 0 && |
| | | row.label2 === '工单类型' && |
| | | hasProcessingBtnPermission() |
| | | " |
| | | > |
| | | <el-select |
| | | v-model="currentDetail.type" |
| | | placeholder="请选择工单类型" |
| | | class="required-input" |
| | | > |
| | | <el-option |
| | | v-for="item in types" |
| | | :key="item.value" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | /> |
| | | </el-select> |
| | | </template> |
| | | <template v-else-if=" |
| | | currentDetail.status === 0 && |
| | | row.label2 === '工单内容' && |
| | | hasProcessingBtnPermission() |
| | | "> |
| | | <el-input type="textarea" v-model="currentDetail.content" placeholder="请输入工单内容" |
| | | class="required-input" /> |
| | | <template |
| | | v-else-if=" |
| | | currentDetail.status === 0 && |
| | | row.label2 === '工单内容' && |
| | | hasProcessingBtnPermission() |
| | | " |
| | | > |
| | | <el-input |
| | | type="textarea" |
| | | v-model="currentDetail.content" |
| | | placeholder="请输入工单内容" |
| | | class="required-input" |
| | | /> |
| | | </template> |
| | | <template v-else>{{ row.value2 }}</template> |
| | | </template> |
| | |
| | | </div> |
| | | <!-- 处理中状态显示输入框 --> |
| | | <template v-if="currentDetail.status === 3 && hasProcessedAndOverBtnPermission()"> |
| | | <el-input type="textarea" v-model="currentDetail.processingDetail" placeholder="请输入事件处理详情" :rows="4" |
| | | style="width: 100%; margin-bottom: 10px" /> |
| | | <el-input |
| | | type="textarea" |
| | | v-model="currentDetail.processingDetail" |
| | | placeholder="请输入事件处理详情" |
| | | :rows="4" |
| | | style="width: 100%; margin-bottom: 10px" |
| | | /> |
| | | </template> |
| | | <!-- 已完成和已完结状态显示只读文本 --> |
| | | <template v-else> |
| | |
| | | </template> |
| | | <template v-else> 上传图片 </template> |
| | | </div> |
| | | <el-upload v-if="hasProcessedAndOverBtnPermission()" ref="upload" :action="'#'" :auto-upload="false" |
| | | list-type="picture-card" :on-change="handleFileChange" :on-remove="handleUploadRemove" |
| | | :before-upload="beforeUpload" :file-list="currentDetail.photos || []" :limit="1" accept="image/*" |
| | | class="detail-upload"> |
| | | <el-upload |
| | | v-if="hasProcessedAndOverBtnPermission()" |
| | | ref="upload" |
| | | :action="'#'" |
| | | :auto-upload="false" |
| | | list-type="picture-card" |
| | | :on-change="handleFileChange" |
| | | :on-remove="handleUploadRemove" |
| | | :before-upload="beforeUpload" |
| | | :file-list="currentDetail.photos || []" |
| | | :limit="1" |
| | | accept="image/*" |
| | | class="detail-upload" |
| | | > |
| | | <template v-if="!currentDetail.photos || currentDetail.photos.length < 1"> |
| | | <!-- <i class="el-icon-plus">+</i> --> |
| | | <div class="el-icon-plus"> |
| | |
| | | <div class="media-section"> |
| | | <el-row :gutter="20"> |
| | | <el-col :span="1"> |
| | | <div class="leftBtn" :class="currentIndex === 0 ? 'disableds' : ''" @click="leftClick"> |
| | | < </div> |
| | | <div |
| | | class="leftBtn" |
| | | :class="currentIndex === 0 ? 'disableds' : ''" |
| | | @click="leftClick" |
| | | > |
| | | < |
| | | </div> |
| | | </el-col> |
| | | <el-col :span="11"> |
| | | <div class="media-box"> |
| | | <div class="media-title">事件图片</div> |
| | | <div class="media-content"> |
| | | <el-image v-if="currentDetail.mediaUrl" :src="getThumbUrl(currentDetail.mediaUrl)" |
| | | :preview-src-list="[getPreviewUrl(currentDetail.mediaUrl)]" fit="contain" |
| | | style="width: 700px; height: 520px; cursor: pointer"> |
| | | <el-image |
| | | v-if="currentDetail.mediaUrl" |
| | | :src="getThumbUrl(currentDetail.mediaUrl)" |
| | | :preview-src-list="[getPreviewUrl(currentDetail.mediaUrl)]" |
| | | fit="contain" |
| | | style="width: 700px; height: 520px; cursor: pointer" |
| | | > |
| | | <template #placeholder> |
| | | <div class="image-placeholder"> |
| | | <i class="el-icon-picture-outline"></i> |
| | |
| | | <template v-if="currentDetail.status === 4"> |
| | | <div class="media-title">工单处理图片</div> |
| | | <div class="media-content"> |
| | | <el-image v-if="currentDetail.updatePhotoUrl" :src="getThumbUrl(currentDetail.updatePhotoUrl)" |
| | | :preview-src-list="[getPreviewUrl(currentDetail.updatePhotoUrl)]" fit="fill"> |
| | | <el-image |
| | | v-if="currentDetail.updatePhotoUrl" |
| | | :src="getThumbUrl(currentDetail.updatePhotoUrl)" |
| | | :preview-src-list="[getPreviewUrl(currentDetail.updatePhotoUrl)]" |
| | | fit="fill" |
| | | > |
| | | <template #placeholder> |
| | | <div class="image-placeholder"> |
| | | <i class="el-icon-picture-outline"></i> |
| | |
| | | </div> |
| | | </el-col> |
| | | <el-col :span="1"> |
| | | <div :class="currentIndex === tableData.length - 1 ? 'disableds' : ''" class="leftBtn" |
| | | @click="rightClick">> |
| | | <div |
| | | :class="currentIndex === tableData.length - 1 ? 'disableds' : ''" |
| | | class="leftBtn" |
| | | @click="rightClick" |
| | | > |
| | | > |
| | | </div> |
| | | </el-col> |
| | | </el-row> |
| | |
| | | <div class="dialog-footer"> |
| | | <template v-if="currentDetail.status === 2"> |
| | | <!-- 待审核 --> |
| | | <el-button v-if="hasReviewBtnPermission()" type="primary" :loading="approveLoading" |
| | | @click="approveTicket">通过</el-button> |
| | | <el-button v-if="hasReviewBtnPermission()" type="danger" :loading="rejectLoading" |
| | | @click="rejectTicket">不通过</el-button> |
| | | <el-button |
| | | v-if="hasReviewBtnPermission()" |
| | | type="primary" |
| | | :loading="approveLoading" |
| | | @click="approveTicket" |
| | | >通过</el-button |
| | | > |
| | | <el-button |
| | | v-if="hasReviewBtnPermission()" |
| | | type="danger" |
| | | :loading="rejectLoading" |
| | | @click="rejectTicket" |
| | | >不通过</el-button |
| | | > |
| | | <el-button @click="detailVisible = false">取消</el-button> |
| | | </template> |
| | | <template v-else-if="currentDetail.status === 0"> |
| | | <el-button v-if="hasProcessingBtnPermission()" type="primary" :loading="dispatchLoading" |
| | | @click="approveAndDispatch">受理</el-button> |
| | | <el-button v-if="hasProcessingBtnPermission()" type="danger" :loading="rejectLoading" |
| | | @click="rejectTicket">不受理</el-button> |
| | | <el-button |
| | | v-if="hasProcessingBtnPermission()" |
| | | type="primary" |
| | | :loading="dispatchLoading" |
| | | @click="approveAndDispatch" |
| | | >受理</el-button |
| | | > |
| | | <el-button |
| | | v-if="hasProcessingBtnPermission()" |
| | | type="danger" |
| | | :loading="rejectLoading" |
| | | @click="rejectTicket" |
| | | >不受理</el-button |
| | | > |
| | | <el-button @click="detailVisible = false">取消</el-button> |
| | | </template> |
| | | <template v-if="currentDetail.status === 3"> |
| | | <!-- 处理中 --> |
| | | <el-button v-if="hasProcessedAndOverBtnPermission()" type="primary" :loading="completeLoading" |
| | | @click="completeTicket">完成工单</el-button> |
| | | <el-button |
| | | v-if="hasProcessedAndOverBtnPermission()" |
| | | type="primary" |
| | | :loading="completeLoading" |
| | | @click="completeTicket" |
| | | >完成工单</el-button |
| | | > |
| | | <el-button @click="detailVisible = false">取消</el-button> |
| | | </template> |
| | | <template v-else-if="currentDetail.status === 4"> |
| | |
| | | </el-dialog> |
| | | |
| | | <!-- 派发工单对话框 --> |
| | | <el-dialog v-model="dispatchDialogVisible" title="派发工单" width="40%" :close-on-click-modal="false"> |
| | | <el-dialog |
| | | v-model="dispatchDialogVisible" |
| | | title="派发工单" |
| | | width="40%" |
| | | :close-on-click-modal="false" |
| | | > |
| | | <el-form :model="dispatchForm" :rules="dispatchRules" ref="dispatchForm" label-width="100px"> |
| | | <el-form-item label="选择部门" prop="department"> |
| | | <el-select v-model="dispatchForm.department" placeholder="请选择部门" @change="handleDispatchDepartmentChange"> |
| | | <el-option v-for="dept in departments" :key="dept.value" :label="dept.label" :value="dept.value" /> |
| | | <el-select |
| | | v-model="dispatchForm.department" |
| | | placeholder="请选择部门" |
| | | @change="handleDispatchDepartmentChange" |
| | | > |
| | | <el-option |
| | | v-for="dept in departments" |
| | | :key="dept.value" |
| | | :label="dept.label" |
| | | :value="dept.value" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="选择处理人" prop="handler"> |
| | | <el-select v-model="dispatchForm.handler" placeholder="请选择处理人" :disabled="!dispatchForm.department"> |
| | | <el-option v-for="user in availableDispatchHandlers" :key="user.id" :label="user.name" :value="user.id" /> |
| | | <el-select |
| | | v-model="dispatchForm.handler" |
| | | placeholder="请选择处理人" |
| | | :disabled="!dispatchForm.department" |
| | | > |
| | | <el-option |
| | | v-for="user in availableDispatchHandlers" |
| | | :key="user.id" |
| | | :label="user.name" |
| | | :value="user.id" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-form> |
| | | <template #footer> |
| | | <el-button @click="dispatchDialogVisible = false">取消</el-button> |
| | | <el-button type="primary" :loading="dispatchLoading" @click="submitDispatch">确认派发</el-button> |
| | | <el-button type="primary" :loading="dispatchLoading" @click="submitDispatch" |
| | | >确认派发</el-button |
| | | > |
| | | </template> |
| | | </el-dialog> |
| | | |
| | | <!-- 添加在其他 dialog 组件之后 --> |
| | | <el-dialog v-model="reviewDialogVisible" title="批量审核" width="1100" append-to-body custom-class="review-dialog" |
| | | @close="cancleBatchReject"> |
| | | <el-dialog |
| | | v-model="reviewDialogVisible" |
| | | title="批量审核" |
| | | width="1100" |
| | | append-to-body |
| | | custom-class="review-dialog" |
| | | @close="cancleBatchReject" |
| | | > |
| | | <div class="review-container"> |
| | | <div class="review-image-wrapper"> |
| | | <!-- 修改左右箭头的显示条件 --> |
| | | <div v-if="selections.length > 1 && currentReviewImage" class="arrow-button left" @click="handlePrevImage"> |
| | | <div |
| | | v-if="selections.length > 1 && currentReviewImage" |
| | | class="arrow-button left" |
| | | @click="handlePrevImage" |
| | | > |
| | | <i class="el-icon-arrow-left"></i> |
| | | </div> |
| | | |
| | |
| | | <!-- <el-image v-if="currentReviewImage" :src="getThumbUrl(currentReviewImage)" fit="fill" |
| | | :preview-src-list="getImageList()" :initial-index="currentImageIndex - 1" class="preview-image" |
| | | style="cursor: pointer"> --> |
| | | <el-image v-if="currentReviewImage" :src="getPreviewUrl(currentReviewImage)" fit="fill" |
| | | :initial-index="currentImageIndex - 1" class="preview-image" style="cursor: pointer"> |
| | | <el-image |
| | | v-if="currentReviewImage" |
| | | :src="getPreviewUrl(currentReviewImage)" |
| | | fit="fill" |
| | | :initial-index="currentImageIndex - 1" |
| | | class="preview-image" |
| | | style="cursor: pointer" |
| | | > |
| | | <template #error> |
| | | <div class="image-error"> |
| | | <i class="el-icon-picture-outline"></i> |
| | |
| | | </div> |
| | | |
| | | <!-- 修改右箭头的显示条件 --> |
| | | <div v-if="selections.length > 1 && currentReviewImage" class="arrow-button right" @click="handleNextImage"> |
| | | <div |
| | | v-if="selections.length > 1 && currentReviewImage" |
| | | class="arrow-button right" |
| | | @click="handleNextImage" |
| | | > |
| | | <i class="el-icon-arrow-right"></i> |
| | | </div> |
| | | </div> |
| | | |
| | | <!-- 修改分页器的显示条件 --> |
| | | <div class="review-pagination" v-if="selections.length > 1 && currentReviewImage"> |
| | | <el-pagination small layout="prev, pager, next" hide-on-single-page :total="selections.length" |
| | | :current-page="currentImageIndex" :page-size="1" @current-change="handleImagePageChange"> |
| | | <el-pagination |
| | | small |
| | | layout="prev, pager, next" |
| | | hide-on-single-page |
| | | :total="selections.length" |
| | | :current-page="currentImageIndex" |
| | | :page-size="1" |
| | | @current-change="handleImagePageChange" |
| | | > |
| | | </el-pagination> |
| | | </div> |
| | | </div> |
| | |
| | | |
| | | <!-- 复核弹出层 --> |
| | | |
| | | <el-dialog v-model="reCheckDialog" title="工单复核" width="30%" append-to-body custom-class="re-check-dialog" |
| | | @close="reCheckDialog = false"> |
| | | <el-dialog |
| | | v-model="reCheckDialog" |
| | | title="工单复核" |
| | | width="30%" |
| | | append-to-body |
| | | custom-class="re-check-dialog" |
| | | @close="reCheckDialog = false" |
| | | > |
| | | <div class="dialog-footer"> |
| | | <el-button type="primary" @click="reCheckConfirm(1)">人工复核</el-button> |
| | | <el-button type="primary" @click="reCheckConfirm(2)">无人机复核</el-button> |
| | |
| | | </template> |
| | | |
| | | <script> |
| | | import { getSmallImg, getShowImg } from '@/utils/util' |
| | | import { ElMessageBox, ElLoading } from 'element-plus' |
| | | import { calculateDefaultRange } from '@/utils/util' |
| | | import { gcj02ToWgs84, wgs84ToGcj02 } from '@/utils/coordinateTransformation' |
| | | import _ from 'lodash' |
| | | import { getSmallImg, getShowImg } from '@/utils/util'; |
| | | import { ElMessageBox, ElLoading } from 'element-plus'; |
| | | import { calculateDefaultRange } from '@/utils/util'; |
| | | import { gcj02ToWgs84, wgs84ToGcj02 } from '@/utils/coordinateTransformation'; |
| | | import _ from 'lodash'; |
| | | import { |
| | | getList, |
| | | createTicket, |
| | |
| | | getStepInfo, |
| | | getReviewById, |
| | | getCreateEventJob, |
| | | } from '@/api/tickets/ticket' |
| | | import { export_json_to_excel } from '@/utils/exportExcel' |
| | | import geoJson from '@/assets/geoJson.json' |
| | | import { mapGetters } from 'vuex' |
| | | import { getAdcodeObj } from '@/utils/disposeData' |
| | | import getBaseConfig from '@/buildConfig/config' |
| | | const { envName } = getBaseConfig() |
| | | function regExp (label, name) { |
| | | var reg = new RegExp(label + '=([^&]*)(&|$)', 'g') |
| | | return name.match(reg)[0].split('=')[1] |
| | | } from '@/api/tickets/ticket'; |
| | | import { export_json_to_excel } from '@/utils/exportExcel'; |
| | | import geoJson from '@/assets/geoJson.json'; |
| | | import { mapGetters } from 'vuex'; |
| | | import { getAdcodeObj } from '@/utils/disposeData'; |
| | | import getBaseConfig from '@/buildConfig/config'; |
| | | const { envName, hidereviewBtn } = getBaseConfig(); |
| | | function regExp(label, name) { |
| | | var reg = new RegExp(label + '=([^&]*)(&|$)', 'g'); |
| | | return name.match(reg)[0].split('=')[1]; |
| | | } |
| | | |
| | | export default { |
| | | name: 'TicketPage', |
| | | data () { |
| | | data() { |
| | | return { |
| | | hidereviewBtn, |
| | | currentIndex: null, // 当前显示的数据索引 |
| | | submitLoading: false, // 新增loading状态 |
| | | draftLoading: false, |
| | |
| | | { label: '处理人', prop: 'handler', width: 100 }, |
| | | { |
| | | slot: true, |
| | | hide: envName === 'jiangwu'? true : false, |
| | | label: '复核状态', |
| | | prop: 'isReview', |
| | | width: 90, |
| | |
| | | required: true, |
| | | validator: (rule, value, callback) => { |
| | | if (!value || value.length < 2) { |
| | | callback(new Error('请选择位置信息')) |
| | | callback(new Error('请选择位置信息')); |
| | | } else if (!value[0] || !value[1]) { |
| | | callback(new Error('请选择位置信息')) |
| | | callback(new Error('请选择位置信息')); |
| | | } else { |
| | | callback() |
| | | callback(); |
| | | } |
| | | }, |
| | | trigger: 'change' |
| | | trigger: 'change', |
| | | }, |
| | | ], |
| | | photos: [ |
| | | { |
| | | validator: (rule, value, callback) => { |
| | | if (!this.form.photos || this.form.photos.length === 0) { |
| | | callback(new Error('请上传工单图片')) |
| | | callback(new Error('请上传工单图片')); |
| | | } else { |
| | | callback() |
| | | callback(); |
| | | } |
| | | }, |
| | | trigger: 'change', |
| | |
| | | |
| | | // 复核弹窗 |
| | | reCheckDialog: false, |
| | | } |
| | | }; |
| | | }, |
| | | created () { |
| | | this.inputMapShowDefaultCenter = null |
| | | created() { |
| | | this.inputMapShowDefaultCenter = null; |
| | | |
| | | this.loadAMapScripts() |
| | | this.fetchDropdownData() |
| | | console.log('permission.tickets_processing_btn', this.permission.tickets_processing_btn) |
| | | console.log('permission', this.permission.tickets_tab_pending) |
| | | this.loadAMapScripts(); |
| | | this.fetchDropdownData(); |
| | | console.log('permission.tickets_processing_btn', this.permission.tickets_processing_btn); |
| | | console.log('permission', this.permission.tickets_tab_pending); |
| | | }, |
| | | |
| | | mounted () { |
| | | const href = this.$route.href |
| | | mounted() { |
| | | const href = this.$route.href; |
| | | if (this.$route?.query?.status !== undefined && this.$route?.query?.status !== null) { |
| | | this.filters.status = this.$route?.query?.status + '' |
| | | this.$router.replace({}) |
| | | this.filters.status = this.$route?.query?.status + ''; |
| | | this.$router.replace({}); |
| | | } |
| | | |
| | | let curQueryParams = {} |
| | | let curQueryParams = {}; |
| | | |
| | | if (href.indexOf('?') != -1 && href.split('?').length > 0) { |
| | | curQueryParams = href |
| | | .split('?')[1] |
| | | .split('&') |
| | | .reduce((pre, cur) => { |
| | | let newArr = cur.split('=') |
| | | let newArr = cur.split('='); |
| | | |
| | | pre[newArr[0]] = newArr[1] |
| | | pre[newArr[0]] = newArr[1]; |
| | | |
| | | return pre |
| | | }, {}) |
| | | return pre; |
| | | }, {}); |
| | | |
| | | const { orderNumber = undefined, day = undefined } = curQueryParams |
| | | const { orderNumber = undefined, day = undefined } = curQueryParams; |
| | | |
| | | // 日历传值 |
| | | if (day) { |
| | | const date = new Date(day + 'T00:00:00+08:00') |
| | | const dateArray = [date, date] |
| | | const date = new Date(day + 'T00:00:00+08:00'); |
| | | const dateArray = [date, date]; |
| | | const handler = { |
| | | get (target, prop) { |
| | | get(target, prop) { |
| | | if (typeof prop === 'string' && /^\d+$/.test(prop)) { |
| | | const index = parseInt(prop) |
| | | const dateObj = target[index] |
| | | return dateObj.toDateString() + ' 00:00:00 GMT+0800 (中国标准时间)' |
| | | const index = parseInt(prop); |
| | | const dateObj = target[index]; |
| | | return dateObj.toDateString() + ' 00:00:00 GMT+0800 (中国标准时间)'; |
| | | } |
| | | return Reflect.get(target, prop) |
| | | return Reflect.get(target, prop); |
| | | }, |
| | | } |
| | | }; |
| | | |
| | | const proxyArray = new Proxy(dateArray, handler) |
| | | this.filters.dateRange = proxyArray |
| | | const proxyArray = new Proxy(dateArray, handler); |
| | | this.filters.dateRange = proxyArray; |
| | | } |
| | | |
| | | if (orderNumber) { |
| | | this.filters.keyword = orderNumber |
| | | this.filters.keyword = orderNumber; |
| | | |
| | | this.$nextTick(() => { |
| | | this.isShowInfo = true |
| | | }) |
| | | this.isShowInfo = true; |
| | | }); |
| | | } |
| | | } |
| | | |
| | | this.fetchTabCounts() // 新增:初始化时获取 tab 数据 |
| | | this.fetchTableData() |
| | | this.fetchTabCounts(); // 新增:初始化时获取 tab 数据 |
| | | this.fetchTableData(); |
| | | }, |
| | | computed: { |
| | | firstRowData () { |
| | | return this.tableData.length > 0 ? this.tableData[0] : null |
| | | firstRowData() { |
| | | return this.tableData.length > 0 ? this.tableData[0] : null; |
| | | }, |
| | | availableHandlers () { |
| | | return this.form.department ? this.departmentUsers[this.form.department] || [] : [] |
| | | availableHandlers() { |
| | | return this.form.department ? this.departmentUsers[this.form.department] || [] : []; |
| | | }, |
| | | availableDispatchHandlers () { |
| | | availableDispatchHandlers() { |
| | | return this.dispatchForm.department |
| | | ? this.departmentUsers[this.dispatchForm.department] || [] |
| | | : [] |
| | | : []; |
| | | }, |
| | | detailTableData () { |
| | | detailTableData() { |
| | | return [ |
| | | { |
| | | label: '工单名称', |
| | |
| | | editable: this.currentDetail.status === 0, |
| | | type: 'textarea', |
| | | }, |
| | | ] |
| | | ]; |
| | | }, |
| | | detailFields () { |
| | | detailFields() { |
| | | return [ |
| | | { |
| | | label: '工单名称', |
| | |
| | | editable: this.currentDetail.status === 0, |
| | | type: 'textarea', |
| | | }, |
| | | ] |
| | | ]; |
| | | }, |
| | | formattedDetailFields () { |
| | | formattedDetailFields() { |
| | | const fields = [ |
| | | { label: '工单名称', value: this.currentDetail.orderName }, |
| | | { |
| | |
| | | { label: '发起单位', value: this.currentDetail.department }, |
| | | { label: '发起任务时间', value: this.currentDetail.startTime }, |
| | | { label: '工单内容', value: this.currentDetail.content }, |
| | | ] |
| | | ]; |
| | | |
| | | // 将字段分成两列 |
| | | const formattedFields = [] |
| | | const formattedFields = []; |
| | | for (let i = 0; i < fields.length; i += 2) { |
| | | formattedFields.push({ |
| | | label1: fields[i]?.label || '', |
| | | value1: fields[i]?.value || '暂无数据', |
| | | label2: fields[i + 1]?.label || '', |
| | | value2: fields[i + 1]?.value || '暂无数据', |
| | | }) |
| | | }); |
| | | } |
| | | return formattedFields |
| | | return formattedFields; |
| | | }, |
| | | dynamicFixedStatuses () { |
| | | dynamicFixedStatuses() { |
| | | // 直接使用接口返回的 stepInfos |
| | | return this.stepInfos.map(step => String(step.status)) |
| | | return this.stepInfos.map(step => String(step.status)); |
| | | }, |
| | | ...mapGetters(['userInfo', 'permission']), |
| | | // 动态过滤tabs,保证isShow为true/false |
| | | filteredTabs () { |
| | | filteredTabs() { |
| | | // 统一处理权限,undefined视为false |
| | | const tabStatus = this.permission?.tickets_tab_status === true |
| | | const tabPending = this.permission?.tickets_tab_pending === true |
| | | const tabMyTickets = this.permission?.tickets_tab_mytickets === true |
| | | const tabStatus = this.permission?.tickets_tab_status === true; |
| | | const tabPending = this.permission?.tickets_tab_pending === true; |
| | | const tabMyTickets = this.permission?.tickets_tab_mytickets === true; |
| | | return this.tabs |
| | | .map(tab => { |
| | | if (tab.name === 'all') { |
| | | return { ...tab, isShow: true } |
| | | return { ...tab, isShow: true }; |
| | | } |
| | | if (tab.name === 'pending') { |
| | | return { ...tab, isShow: tabPending } |
| | | return { ...tab, isShow: tabPending }; |
| | | } |
| | | if (['processing', 'inProgress', 'completed', 'closed'].includes(tab.name)) { |
| | | return { ...tab, isShow: tabStatus } |
| | | return { ...tab, isShow: tabStatus }; |
| | | } |
| | | if (tab.name === 'myTickets') { |
| | | return { ...tab, isShow: tabMyTickets } |
| | | return { ...tab, isShow: tabMyTickets }; |
| | | } |
| | | return { ...tab, isShow: false } |
| | | return { ...tab, isShow: false }; |
| | | }) |
| | | .filter(tab => tab.isShow) |
| | | .filter(tab => tab.isShow); |
| | | }, |
| | | permissionList () { |
| | | permissionList() { |
| | | // 可根据实际后端权限key调整 |
| | | return { |
| | | addBtn: this.validData(this.permission.tickets_add, false), |
| | | delBtn: this.validData(this.permission.tickets_delete, false), |
| | | exportBtn: this.validData(this.permission.tickets_export, false), |
| | | reviewBtn: this.validData(this.permission.tickets_review, false), |
| | | } |
| | | }; |
| | | }, |
| | | stepStatusList () { |
| | | stepStatusList() { |
| | | // “我发起的工单”tab用默认流程,其它tab用接口返回的stepInfos |
| | | if (this.activeTab === 'myTickets') { |
| | | if (this.workType === 1) { |
| | | return ['3', '4'] |
| | | return ['3', '4']; |
| | | } |
| | | return this.fixedStatuses |
| | | return this.fixedStatuses; |
| | | } |
| | | |
| | | // 其它tab直接用接口返回的stepInfos |
| | | return this.stepInfos.map(step => String(step.status)) |
| | | return this.stepInfos.map(step => String(step.status)); |
| | | }, |
| | | |
| | | showIsReviewText () { |
| | | showIsReviewText() { |
| | | return row => { |
| | | if (['4'].includes(String(row.status))) return row.isReview === 1 ? '是' : '否' |
| | | if (['4'].includes(String(row.status))) return row.isReview === 1 ? '是' : '否'; |
| | | |
| | | return '/' |
| | | } |
| | | return '/'; |
| | | }; |
| | | }, |
| | | |
| | | popupShowImage () { |
| | | return (list) => { |
| | | |
| | | popupShowImage() { |
| | | return list => { |
| | | return list.map(item => ({ |
| | | ...item, |
| | | url: getShowImg(item.url) |
| | | })) |
| | | } |
| | | } |
| | | url: getShowImg(item.url), |
| | | })); |
| | | }; |
| | | }, |
| | | }, |
| | | |
| | | methods: { |
| | | handleCellClick(row, column) { |
| | | console.log(row,column.no) |
| | | console.log(row, column.no); |
| | | if (column.no === 2) { |
| | | navigator.clipboard.writeText(row.orderNumber).then(() => { |
| | | this.$message.success('复制工单编号成功') |
| | | }) |
| | | this.$message.success('复制工单编号成功'); |
| | | }); |
| | | } else if (column.no === 3) { |
| | | navigator.clipboard.writeText(row.orderName).then(() => { |
| | | this.$message.success('复制工单名称成功') |
| | | }) |
| | | this.$message.success('复制工单名称成功'); |
| | | }); |
| | | } else if (column.no === 4) { |
| | | navigator.clipboard.writeText(row.department).then(() => { |
| | | this.$message.success('复制所属单位成功') |
| | | }) |
| | | this.$message.success('复制所属单位成功'); |
| | | }); |
| | | } |
| | | }, |
| | | // 左切换 |
| | | leftClick () { |
| | | if (this.tableData.length === 0) return |
| | | this.currentIndex = Math.max(0, this.currentIndex - 1) |
| | | this.updateCurrentDetail() |
| | | leftClick() { |
| | | if (this.tableData.length === 0) return; |
| | | this.currentIndex = Math.max(0, this.currentIndex - 1); |
| | | this.updateCurrentDetail(); |
| | | }, |
| | | // 右切换 |
| | | rightClick () { |
| | | if (this.tableData.length === 0) return |
| | | this.currentIndex = Math.min(this.tableData.length - 1, this.currentIndex + 1) |
| | | this.updateCurrentDetail() |
| | | rightClick() { |
| | | if (this.tableData.length === 0) return; |
| | | this.currentIndex = Math.min(this.tableData.length - 1, this.currentIndex + 1); |
| | | this.updateCurrentDetail(); |
| | | }, |
| | | // 更新当前详情 |
| | | updateCurrentDetail () { |
| | | this.currentDetail = this.tableData[this.currentIndex] |
| | | this.currentDetail.mediaUrl = this.currentDetail.photo_url |
| | | this.currentDetail.updatePhotoUrl = this.currentDetail.update_photo_url |
| | | this.currentDetail.processingDetail = this.currentDetail.content |
| | | this.handleViewDetail(this.currentDetail) |
| | | updateCurrentDetail() { |
| | | this.currentDetail = this.tableData[this.currentIndex]; |
| | | this.currentDetail.mediaUrl = this.currentDetail.photo_url; |
| | | this.currentDetail.updatePhotoUrl = this.currentDetail.update_photo_url; |
| | | this.currentDetail.processingDetail = this.currentDetail.content; |
| | | this.handleViewDetail(this.currentDetail); |
| | | |
| | | // 如果使用地图组件,需要更新地图标记 |
| | | this.$nextTick(() => { |
| | | if (this.$refs.MapContainer && this.currentDetail.location) { |
| | | this.$refs.MapContainer.initAddEntity('point', this.currentDetail.location) |
| | | this.$refs.MapContainer.initAddEntity('point', this.currentDetail.location); |
| | | } |
| | | }) |
| | | }); |
| | | }, |
| | | async loadAMapScripts () { |
| | | async loadAMapScripts() { |
| | | try { |
| | | const areaCode = this.userInfo.detail.areaCode |
| | | const subAreaCode = areaCode ? areaCode.substring(0, 6) : '' |
| | | const adcodeObj = getAdcodeObj(geoJson, 'adcode', subAreaCode) |
| | | const areaCode = this.userInfo.detail.areaCode; |
| | | const subAreaCode = areaCode ? areaCode.substring(0, 6) : ''; |
| | | const adcodeObj = getAdcodeObj(geoJson, 'adcode', subAreaCode); |
| | | |
| | | console.log('区域代码:', subAreaCode) |
| | | console.log('区域代码:', subAreaCode); |
| | | |
| | | // 直接从返回对象中获取正确的路径 |
| | | const center = adcodeObj?.payload?.objects?.collection?.geometries?.[0]?.properties?.center |
| | | const center = adcodeObj?.payload?.objects?.collection?.geometries?.[0]?.properties?.center; |
| | | |
| | | if (Array.isArray(center) && center.length === 2) { |
| | | this.inputMapShowDefaultCenter = center |
| | | this.inputMapShowDefaultCenter = center; |
| | | } else { |
| | | // 如果找不到中心点,尝试使用 bbox 的中心点 |
| | | const bbox = adcodeObj?.payload?.bbox |
| | | const bbox = adcodeObj?.payload?.bbox; |
| | | if (Array.isArray(bbox) && bbox.length === 4) { |
| | | const centerX = (bbox[0] + bbox[2]) / 2 |
| | | const centerY = (bbox[1] + bbox[3]) / 2 |
| | | this.inputMapShowDefaultCenter = [centerX, centerY] |
| | | const centerX = (bbox[0] + bbox[2]) / 2; |
| | | const centerY = (bbox[1] + bbox[3]) / 2; |
| | | this.inputMapShowDefaultCenter = [centerX, centerY]; |
| | | } else { |
| | | this.inputMapShowDefaultCenter = [115.861365, 28.621311] |
| | | this.inputMapShowDefaultCenter = [115.861365, 28.621311]; |
| | | } |
| | | } |
| | | this.mapParams.center = [...this.inputMapShowDefaultCenter] |
| | | this.mapParams.center = [...this.inputMapShowDefaultCenter]; |
| | | |
| | | this.mapLoaded = true |
| | | this.mapLoaded = true; |
| | | } catch (error) { |
| | | this.$message.error('地图加载失败,请检查网络或API Key配置') |
| | | this.$message.error('地图加载失败,请检查网络或API Key配置'); |
| | | } |
| | | }, |
| | | async handleBatchApprove () { |
| | | async handleBatchApprove() { |
| | | try { |
| | | if (this.selections.length === 0) { |
| | | this.$message.warning('没有选中的工单') |
| | | return |
| | | this.$message.warning('没有选中的工单'); |
| | | return; |
| | | } |
| | | |
| | | const currentItem = this.selections[this.currentImageIndex - 1] |
| | | const currentItem = this.selections[this.currentImageIndex - 1]; |
| | | if (!currentItem) { |
| | | this.$message.warning('当前工单数据无效') |
| | | return |
| | | this.$message.warning('当前工单数据无效'); |
| | | return; |
| | | } |
| | | |
| | | await this.$confirm('确认审核通过当前工单?', '提示', { |
| | | confirmButtonText: '确定', |
| | | cancelButtonText: '取消', |
| | | type: 'warning', |
| | | }) |
| | | }); |
| | | |
| | | const data = { |
| | | id: currentItem.id, |
| | |
| | | isPass: 0, |
| | | eventNum: currentItem.orderNumber, |
| | | eventName: currentItem.orderName, |
| | | } |
| | | }; |
| | | |
| | | const response = await flowEvent(data) |
| | | const response = await flowEvent(data); |
| | | if (response.data.code === 0) { |
| | | this.$message.success('工单审核通过') |
| | | this.$message.success('工单审核通过'); |
| | | |
| | | // 创建新的数组而不是修改原数组 |
| | | const newSelections = [...this.selections] |
| | | newSelections.splice(this.currentImageIndex - 1, 1) |
| | | this.selections = newSelections |
| | | const newSelections = [...this.selections]; |
| | | newSelections.splice(this.currentImageIndex - 1, 1); |
| | | this.selections = newSelections; |
| | | |
| | | // 修正索引并更新图片 |
| | | if (this.selections.length > 0) { |
| | | if (this.currentImageIndex > this.selections.length) { |
| | | this.currentImageIndex = this.selections.length |
| | | this.currentImageIndex = this.selections.length; |
| | | } |
| | | this.updateCurrentReviewImage() |
| | | this.updateCurrentReviewImage(); |
| | | } else { |
| | | this.reviewDialogVisible = false |
| | | this.currentImageIndex = 1 |
| | | this.currentReviewImage = '' |
| | | this.reviewDialogVisible = false; |
| | | this.currentImageIndex = 1; |
| | | this.currentReviewImage = ''; |
| | | } |
| | | |
| | | // 刷新表格数据 |
| | | this.fetchTableData() |
| | | this.fetchTableData(); |
| | | } else { |
| | | throw new Error(response.data.msg || '审核失败') |
| | | throw new Error(response.data.msg || '审核失败'); |
| | | } |
| | | } catch (error) { |
| | | if (error === 'cancel') return |
| | | this.$message.error(error.message || '审核失败,请稍后重试') |
| | | if (error === 'cancel') return; |
| | | this.$message.error(error.message || '审核失败,请稍后重试'); |
| | | } |
| | | }, |
| | | async fetchDropdownData () { |
| | | async fetchDropdownData() { |
| | | try { |
| | | const response = await getTicketInfo() |
| | | const { dept_data, event_type, ai_type } = response.data.data |
| | | const response = await getTicketInfo(); |
| | | const { dept_data, event_type, ai_type } = response.data.data; |
| | | |
| | | this.departments = dept_data.map(item => ({ |
| | | label: item.dept_name, |
| | | value: item.id, |
| | | })) |
| | | })); |
| | | |
| | | this.departmentUsers = dept_data.reduce((acc, dept) => { |
| | | acc[dept.id] = dept.user_data || [] |
| | | return acc |
| | | }, {}) |
| | | acc[dept.id] = dept.user_data || []; |
| | | return acc; |
| | | }, {}); |
| | | |
| | | this.types = Object.entries(event_type).map(([key, value]) => ({ |
| | | label: value, |
| | | value: key, |
| | | })) |
| | | })); |
| | | |
| | | const columnType = this.findObject(this.option.column, 'type') |
| | | columnType.dicData = this.types |
| | | const columnType = this.findObject(this.option.column, 'type'); |
| | | columnType.dicData = this.types; |
| | | |
| | | // 确保算法数据的映射一致 |
| | | this.algorithms = |
| | |
| | | // 同时添加 label 和 value 以兼容两处使用 |
| | | label: item.dict_value, |
| | | value: item.dict_key, |
| | | })) || [] |
| | | })) || []; |
| | | |
| | | // 构建用户ID和名称的映射关系 |
| | | this.userNameToIdMap = {} |
| | | this.userNameToIdMap = {}; |
| | | dept_data.forEach(dept => { |
| | | (dept.user_data || []).forEach(user => { |
| | | this.userNameToIdMap[user.name] = user.id |
| | | }) |
| | | }) |
| | | this.userNameToIdMap[user.name] = user.id; |
| | | }); |
| | | }); |
| | | } catch (error) { |
| | | this.$message.error('加载下拉框数据失败') |
| | | this.$message.error('加载下拉框数据失败'); |
| | | } |
| | | }, |
| | | |
| | | async fetchTableData () { |
| | | if (this.isFetching) return |
| | | this.isFetching = true |
| | | this.loading = true |
| | | async fetchTableData() { |
| | | if (this.isFetching) return; |
| | | this.isFetching = true; |
| | | this.loading = true; |
| | | try { |
| | | const currentTab = this.tabs.find(tab => tab.name === this.activeTab) |
| | | const currentTab = this.tabs.find(tab => tab.name === this.activeTab); |
| | | const params = { |
| | | word_order_type: this.filters.type || undefined, |
| | | status: |
| | | currentTab?.name === 'myTickets' |
| | | ? undefined |
| | | : this.filters.status !== '' |
| | | ? Number(this.filters.status) |
| | | : currentTab?.value, |
| | | ? Number(this.filters.status) |
| | | : currentTab?.value, |
| | | event_name: this.filters.keyword || undefined, |
| | | dept_id: this.filters.department || undefined, |
| | | start_date: this.filters.dateRange?.[0] |
| | |
| | | |
| | | user_id: currentTab?.name === 'myTickets' ? this.userInfo.user_id : undefined, |
| | | is_review: this.filters.isReview === '' ? undefined : this.filters.isReview, // 添加复核状态查询参数 |
| | | } |
| | | }; |
| | | |
| | | const response = await getList(params) |
| | | const response = await getList(params); |
| | | if (!response?.data?.data?.records) { |
| | | throw new Error('接口返回数据格式不正确') |
| | | throw new Error('接口返回数据格式不正确'); |
| | | } |
| | | |
| | | const { total, records } = response.data.data |
| | | let filteredRecords = records |
| | | const { total, records } = response.data.data; |
| | | let filteredRecords = records; |
| | | |
| | | // 如果是"我发起的"tab,过滤数据 |
| | | // if (currentTab?.name === 'myTickets') { |
| | |
| | | // } |
| | | |
| | | this.tableData = filteredRecords.map(item => { |
| | | const longitude = Number(item.longitude) || 0 |
| | | const latitude = Number(item.latitude) || 0 |
| | | const longitude = Number(item.longitude) || 0; |
| | | const latitude = Number(item.latitude) || 0; |
| | | return { |
| | | id: item.id, |
| | | orderNumber: item.event_num, // 修改这里:优先使用 event_num |
| | |
| | | job_name: item.job_name || '', |
| | | job_create_time: item.job_create_time || '', |
| | | isReview: item.is_review, // 添加复核状态字段映射 |
| | | } |
| | | }) |
| | | }; |
| | | }); |
| | | |
| | | // 更新总数显示 |
| | | this.page.total = total || 0 |
| | | this.page.total = total || 0; |
| | | |
| | | // 是否弹出详情页 |
| | | if (this.isShowInfo) { |
| | | this.handleViewDetail(this.firstRowData) |
| | | this.isShowInfo = false // 生效一次 |
| | | this.handleViewDetail(this.firstRowData); |
| | | this.isShowInfo = false; // 生效一次 |
| | | } |
| | | await this.fetchTabCounts() |
| | | await this.fetchTabCounts(); |
| | | } catch (error) { |
| | | this.$message.error(error.message || '获取数据失败') |
| | | this.tableData = [] |
| | | this.page.total = 0 |
| | | this.$message.error(error.message || '获取数据失败'); |
| | | this.tableData = []; |
| | | this.page.total = 0; |
| | | } finally { |
| | | this.loading = false |
| | | this.isFetching = false |
| | | this.loading = false; |
| | | this.isFetching = false; |
| | | } |
| | | }, |
| | | |
| | | async submitForm () { |
| | | if (this.submitLoading) return // 防止重复提交 |
| | | this.submitLoading = true |
| | | async submitForm() { |
| | | if (this.submitLoading) return; // 防止重复提交 |
| | | this.submitLoading = true; |
| | | try { |
| | | // 提交时需要完整验证 |
| | | await this.$refs.form.validate() |
| | | await this.$refs.form.validate(); |
| | | |
| | | // 验证位置信息 |
| | | if (!this.form.location || this.form.location.length < 2) { |
| | | this.$message.warning('请在地图上选择位置') |
| | | return |
| | | this.$message.warning('请在地图上选择位置'); |
| | | return; |
| | | } |
| | | |
| | | // 修改图片验证逻辑 |
| | | if (!this.form.photos || this.form.photos.length === 0) { |
| | | this.$message.warning('请上传工单图片') |
| | | return |
| | | this.$message.warning('请上传工单图片'); |
| | | return; |
| | | } |
| | | |
| | | let [lng, lat] = this.disposeLocation(true, this.form) |
| | | let [lng, lat] = this.disposeLocation(true, this.form); |
| | | |
| | | const submitData = { |
| | | eventName: this.form.name, |
| | |
| | | updateUser: this.form.handler, |
| | | createDept: this.form.department, |
| | | isDraft: 0, |
| | | } |
| | | }; |
| | | |
| | | if (this.form.id) { |
| | | submitData.id = this.form.id |
| | | submitData.id = this.form.id; |
| | | } |
| | | |
| | | // 修改获取文件的逻辑 |
| | | let file = null |
| | | const photoInfo = this.form.photos[0] |
| | | let file = null; |
| | | const photoInfo = this.form.photos[0]; |
| | | |
| | | if (photoInfo.raw) { |
| | | // 如果有新上传的文件,使用新文件 |
| | | file = photoInfo.raw |
| | | file = photoInfo.raw; |
| | | } else if (photoInfo.existingUrl) { |
| | | // 如果是已存在的图片,将URL添加到提交数据中 |
| | | submitData.photoUrl = photoInfo.existingUrl |
| | | submitData.photoUrl = photoInfo.existingUrl; |
| | | } else { |
| | | this.$message.warning('图片文件无效,请重新上传') |
| | | return |
| | | this.$message.warning('图片文件无效,请重新上传'); |
| | | return; |
| | | } |
| | | |
| | | const response = await createTicket(submitData, file) |
| | | const response = await createTicket(submitData, file); |
| | | if (response.data.code === 0) { |
| | | this.$message.success('工单创建成功') |
| | | this.dialogVisible = false |
| | | this.fetchTableData() |
| | | this.$message.success('工单创建成功'); |
| | | this.dialogVisible = false; |
| | | this.fetchTableData(); |
| | | } else { |
| | | throw new Error(response.data.msg || '创建失败') |
| | | throw new Error(response.data.msg || '创建失败'); |
| | | } |
| | | } catch (error) { |
| | | if (error.message.includes('验证未通过')) { |
| | | this.$message.warning('请填写完整的工单信息') |
| | | this.$message.warning('请填写完整的工单信息'); |
| | | } else { |
| | | this.$message.error(error.message || '工单创建失败,请稍后重试') |
| | | this.$message.error(error.message || '工单创建失败,请稍后重试'); |
| | | } |
| | | } finally { |
| | | this.submitLoading = false |
| | | this.submitLoading = false; |
| | | } |
| | | }, |
| | | |
| | | async saveDraft () { |
| | | if (this.draftLoading) return // 防止重复提交 |
| | | this.draftLoading = true |
| | | async saveDraft() { |
| | | if (this.draftLoading) return; // 防止重复提交 |
| | | this.draftLoading = true; |
| | | try { |
| | | let handlerValue = this.form.handler |
| | | let handlerValue = this.form.handler; |
| | | if (!handlerValue || handlerValue === '未分配') { |
| | | handlerValue = undefined |
| | | handlerValue = undefined; |
| | | } |
| | | |
| | | // 验证位置信息 |
| | | if (!this.form.location || this.form.location.length < 2 || !this.form.location[0] || !this.form.location[1]) { |
| | | this.$message.warning('请在地图上选择位置') |
| | | return |
| | | if ( |
| | | !this.form.location || |
| | | this.form.location.length < 2 || |
| | | !this.form.location[0] || |
| | | !this.form.location[1] |
| | | ) { |
| | | this.$message.warning('请在地图上选择位置'); |
| | | return; |
| | | } |
| | | |
| | | |
| | | let [lng, lat] = this.disposeLocation(true, this.form) |
| | | let [lng, lat] = this.disposeLocation(true, this.form); |
| | | |
| | | const submitData = { |
| | | id: this.form.id, |
| | |
| | | updateUser: handlerValue, |
| | | createDept: this.form.department || undefined, |
| | | isDraft: 1, |
| | | } |
| | | }; |
| | | |
| | | // 草稿时也至少需要工单名称 |
| | | if (!submitData.eventName) { |
| | | this.$message.warning('请输入工单名称') |
| | | return |
| | | this.$message.warning('请输入工单名称'); |
| | | return; |
| | | } |
| | | |
| | | // 过滤掉所有 undefined 的字段 |
| | | Object.keys(submitData).forEach( |
| | | key => submitData[key] === undefined && delete submitData[key] |
| | | ) |
| | | ); |
| | | |
| | | let file = null |
| | | let file = null; |
| | | if (this.form.photos && this.form.photos.length > 0) { |
| | | file = this.form.photos[0].raw |
| | | file = this.form.photos[0].raw; |
| | | } |
| | | |
| | | const response = await createTicket(submitData, file) |
| | | const response = await createTicket(submitData, file); |
| | | if (response.data.code === 0) { |
| | | this.$message.success('草稿保存成功') |
| | | this.dialogVisible = false |
| | | this.form = { |
| | | this.$message.success('草稿保存成功'); |
| | | this.dialogVisible = false; |
| | | (this.form = { |
| | | name: '', |
| | | type: '', |
| | | department: '', |
| | |
| | | address: '', |
| | | photos: [], |
| | | content: '', // 新增字段,用于存储后端返回的 content |
| | | }, |
| | | this.fetchTableData() |
| | | }), |
| | | this.fetchTableData(); |
| | | } else { |
| | | throw new Error(response.data.msg || '保存失败') |
| | | throw new Error(response.data.msg || '保存失败'); |
| | | } |
| | | } catch (error) { |
| | | this.$message.error(error.message || '保存草稿失败,请稍后重试') |
| | | this.$message.error(error.message || '保存草稿失败,请稍后重试'); |
| | | } finally { |
| | | this.draftLoading = false |
| | | this.draftLoading = false; |
| | | } |
| | | }, |
| | | |
| | | handleLocationChange (val) { |
| | | let locationValue = val.value |
| | | handleLocationChange(val) { |
| | | let locationValue = val.value; |
| | | if (locationValue && locationValue.length >= 2) { |
| | | // 兼容第三项为地址 |
| | | const [lng, lat] = gcj02ToWgs84(locationValue[0], locationValue[1]) |
| | | this.form.location = [Number(lng), Number(lat), locationValue[2] || '',] |
| | | this.form.address = locationValue[2] || '' |
| | | const [lng, lat] = gcj02ToWgs84(locationValue[0], locationValue[1]); |
| | | this.form.location = [Number(lng), Number(lat), locationValue[2] || '']; |
| | | this.form.address = locationValue[2] || ''; |
| | | } else { |
| | | this.form.location = [] |
| | | this.form.address = '' |
| | | this.form.location = []; |
| | | this.form.address = ''; |
| | | } |
| | | }, |
| | | |
| | | formatDate (date) { |
| | | if (!date) return undefined |
| | | const d = new Date(date) |
| | | formatDate(date) { |
| | | if (!date) return undefined; |
| | | const d = new Date(date); |
| | | return `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, '0')}-${String( |
| | | d.getDate() |
| | | ).padStart(2, '0')} 00:00:00` |
| | | ).padStart(2, '0')} 00:00:00`; |
| | | }, |
| | | |
| | | mapStatus (status) { |
| | | mapStatus(status) { |
| | | const statusTextMap = { |
| | | '-1': '草稿', // 添加草稿状态 |
| | | 2: '待审核', |
| | | 0: '待处理', |
| | | 3: '处理中', |
| | | 4: '已完成', |
| | | } |
| | | return statusTextMap[status] || '未知状态' |
| | | }; |
| | | return statusTextMap[status] || '未知状态'; |
| | | }, |
| | | |
| | | getStatusTagType (status) { |
| | | getStatusTagType(status) { |
| | | // 草稿不加颜色 |
| | | if (status === -1 || status === '-1') return '' |
| | | if (status === -1 || status === '-1') return ''; |
| | | // 状态颜色映射 |
| | | const colorMap = { |
| | | 0: '#FF7411', // 待处理-淡红 |
| | | 3: '#FFC300', // 处理中-更淡红 |
| | | 2: '#FF472F', // 待审核-橙色 |
| | | 4: '#0291A1', // 已完成-淡蓝 |
| | | } |
| | | return colorMap[String(status)] || '' |
| | | }; |
| | | return colorMap[String(status)] || ''; |
| | | }, |
| | | |
| | | async fetchTabCounts () { |
| | | async fetchTabCounts() { |
| | | try { |
| | | // 判断是否有部门筛选 |
| | | let params = {} |
| | | let params = {}; |
| | | if (this.filters.department) { |
| | | params.deptId = this.filters.department |
| | | params.deptId = this.filters.department; |
| | | } |
| | | const response = await getstatusCount(params) |
| | | const { statusCount, totalCount, userCount } = response.data.data |
| | | const response = await getstatusCount(params); |
| | | const { statusCount, totalCount, userCount } = response.data.data; |
| | | this.tabs.forEach(tab => { |
| | | if (tab.name === 'all') { |
| | | tab.count = totalCount || 0 // 总工单数 |
| | | tab.count = totalCount || 0; // 总工单数 |
| | | } else if (tab.name === 'myTickets') { |
| | | tab.count = userCount || 0 // 我发起的工单数 |
| | | tab.count = userCount || 0; // 我发起的工单数 |
| | | } else { |
| | | tab.count = statusCount[String(tab.value)] || 0 // 根据状态值映射 |
| | | tab.count = statusCount[String(tab.value)] || 0; // 根据状态值映射 |
| | | } |
| | | }) |
| | | }); |
| | | } catch (error) { |
| | | this.$message.error('获取 tab 数据失败') |
| | | this.$message.error('获取 tab 数据失败'); |
| | | } |
| | | }, |
| | | |
| | | handleTabChange (tab) { |
| | | this.activeTab = tab.props?.name || tab.name |
| | | handleTabChange(tab) { |
| | | this.activeTab = tab.props?.name || tab.name; |
| | | |
| | | const isReview = this.findObject(this.option.column, 'isReview') |
| | | const isReview = this.findObject(this.option.column, 'isReview'); |
| | | // 根据条件切换显隐 |
| | | isReview.hide = !['all', 'completed', 'myTickets'].includes(this.activeTab) |
| | | |
| | | this.handleReset() |
| | | this.page.currentPage = 1 |
| | | this.fetchTableData() |
| | | this.fetchTabCounts() // 切换 tab 时重新获取数据 |
| | | if (envName === 'jiangwu') { |
| | | isReview.hide = true; |
| | | } else { |
| | | isReview.hide = !['all', 'completed', 'myTickets'].includes(this.activeTab); |
| | | } |
| | | |
| | | this.handleReset(); |
| | | this.page.currentPage = 1; |
| | | this.fetchTableData(); |
| | | this.fetchTabCounts(); // 切换 tab 时重新获取数据 |
| | | }, |
| | | |
| | | handleSearch () { |
| | | this.page.currentPage = 1 |
| | | this.fetchTableData() |
| | | this.fetchTabCounts() |
| | | handleSearch() { |
| | | this.page.currentPage = 1; |
| | | this.fetchTableData(); |
| | | this.fetchTabCounts(); |
| | | }, |
| | | |
| | | handleReset () { |
| | | handleReset() { |
| | | this.filters = { |
| | | keyword: '', |
| | | department: '', |
| | |
| | | status: '', |
| | | algorithm: '', // 重置时清空算法筛选 |
| | | isReview: '', // 重置时清空复核状态 |
| | | } |
| | | this.page.currentPage = 1 |
| | | this.fetchTableData() |
| | | }; |
| | | this.page.currentPage = 1; |
| | | this.fetchTableData(); |
| | | }, |
| | | |
| | | async handleCurrentChange (val) { |
| | | |
| | | |
| | | async handleCurrentChange(val) { |
| | | // 先更新页码 |
| | | this.page.currentPage = val |
| | | this.page.currentPage = val; |
| | | // 等待 DOM 更新后再请求数据 |
| | | await this.$nextTick() |
| | | await this.fetchTableData() |
| | | await this.$nextTick(); |
| | | await this.fetchTableData(); |
| | | }, |
| | | |
| | | async sizeChange (val) { |
| | | |
| | | this.page.pageSize = val |
| | | this.page.currentPage = 1 // 重置到第一页 |
| | | await this.$nextTick() |
| | | await this.fetchTableData() |
| | | async sizeChange(val) { |
| | | this.page.pageSize = val; |
| | | this.page.currentPage = 1; // 重置到第一页 |
| | | await this.$nextTick(); |
| | | await this.fetchTableData(); |
| | | }, |
| | | |
| | | handleAdd () { |
| | | this.createoredit = 1 |
| | | this.dialogVisible = true |
| | | this.mapParams.center = [...this.inputMapShowDefaultCenter] |
| | | this.form.location = [] |
| | | handleAdd() { |
| | | this.createoredit = 1; |
| | | this.dialogVisible = true; |
| | | this.mapParams.center = [...this.inputMapShowDefaultCenter]; |
| | | this.form.location = []; |
| | | }, |
| | | |
| | | resetForm () { |
| | | resetForm() { |
| | | this.form = { |
| | | name: '', |
| | | type: '', |
| | |
| | | content: '', |
| | | photos: [], |
| | | content: '', // 新增字段,用于存储后端返回的 content |
| | | } |
| | | }; |
| | | if (this.$refs.form) { |
| | | this.$refs.form.resetFields() |
| | | this.$refs.form.resetFields(); |
| | | } |
| | | }, |
| | | |
| | | formatLocation (location) { |
| | | formatLocation(location) { |
| | | if (!Array.isArray(location)) { |
| | | return '未知位置' |
| | | return '未知位置'; |
| | | } |
| | | return `${location[0].toFixed(6)}, ${location[1].toFixed(6)}` |
| | | return `${location[0].toFixed(6)}, ${location[1].toFixed(6)}`; |
| | | }, |
| | | |
| | | async handleViewDetail (row) { |
| | | |
| | | async handleViewDetail(row) { |
| | | // 找到当前行在tableData中的索引 |
| | | this.currentIndex = this.tableData.findIndex(item => item.id === row.id) |
| | | this.currentIndex = this.tableData.findIndex(item => item.id === row.id); |
| | | // 先设置workType,直接从row读取 |
| | | this.workType = row.work_type !== undefined ? Number(row.work_type) : 0 |
| | | this.workType = row.work_type !== undefined ? Number(row.work_type) : 0; |
| | | |
| | | // 重置上传组件的文件列表 |
| | | this.$nextTick(() => { |
| | | if (this.$refs.MapContainer && this.$refs.MapContainer.initAddEntity) { |
| | | this.$refs.MapContainer.initAddEntity('point', this.currentDetail.location) |
| | | this.$refs.MapContainer.initAddEntity('point', this.currentDetail.location); |
| | | } |
| | | }) |
| | | }); |
| | | |
| | | const detailData = { |
| | | ...row, |
| | |
| | | updatePhotoUrl: row.update_photo_url || '', |
| | | photos: [], |
| | | job_name: row.job_name || '', // 新增 |
| | | } |
| | | }; |
| | | |
| | | let stepArr = [] |
| | | let stepArr = []; |
| | | try { |
| | | const stepResponse = await getStepInfo(row.orderNumber) |
| | | const stepResponse = await getStepInfo(row.orderNumber); |
| | | const steps = Array.isArray(stepResponse.data.data) |
| | | ? stepResponse.data.data |
| | | : stepResponse.data.data?.steps || [] |
| | | const finishedStep = steps.find(s => String(s.status) === '4') |
| | | this.totalTime = finishedStep && finishedStep.total_time ? finishedStep.total_time : '' |
| | | : stepResponse.data.data?.steps || []; |
| | | const finishedStep = steps.find(s => String(s.status) === '4'); |
| | | this.totalTime = finishedStep && finishedStep.total_time ? finishedStep.total_time : ''; |
| | | if (this.activeTab !== 'myTickets') { |
| | | this.stepInfos = steps.map(step => ({ |
| | | status: String(step.status), |
| | | name: step.name, |
| | | time: step.time, |
| | | create_time: step.create_time, |
| | | })) |
| | | })); |
| | | } else { |
| | | const statusArr = this.workType === 1 ? ['3', '4'] : this.fixedStatuses |
| | | const statusArr = this.workType === 1 ? ['3', '4'] : this.fixedStatuses; |
| | | this.stepInfos = statusArr.map(status => { |
| | | const step = steps.find(s => String(s.status) === String(status)) |
| | | const step = steps.find(s => String(s.status) === String(status)); |
| | | return { |
| | | status, |
| | | name: step ? step.name : '', |
| | | time: step ? step.time : null, |
| | | create_time: step ? step.create_time : null, |
| | | } |
| | | }) |
| | | }; |
| | | }); |
| | | } |
| | | this.currentDetail.status = row.status |
| | | |
| | | |
| | | this.currentDetail.status = row.status; |
| | | } catch (error) { |
| | | if (this.activeTab === 'myTickets') { |
| | | const statusArr = this.workType === 1 ? ['3', '4'] : this.fixedStatuses |
| | | const statusArr = this.workType === 1 ? ['3', '4'] : this.fixedStatuses; |
| | | this.stepInfos = statusArr.map(status => ({ |
| | | status, |
| | | name: status === row.status ? row.handler || '未分配' : '未处理', |
| | | time: status === row.status ? row.startTime || '未知时间' : null, |
| | | })) |
| | | })); |
| | | } else { |
| | | this.stepInfos = [] |
| | | this.stepInfos = []; |
| | | } |
| | | } |
| | | console.log(detailData, 'detailDatadetailDatadetailData') |
| | | console.log(detailData, 'detailDatadetailDatadetailData'); |
| | | this.currentDetail = { |
| | | ...detailData, |
| | | address: null, |
| | | latAndLon: _.round(detailData.location[0], 6) + ',' + _.round(detailData.location[1], 6) |
| | | } |
| | | latAndLon: _.round(detailData.location[0], 6) + ',' + _.round(detailData.location[1], 6), |
| | | }; |
| | | |
| | | console.log('this.currentDetail', this.currentDetail) |
| | | this.detailVisible = true |
| | | console.log('this.currentDetail', this.currentDetail); |
| | | this.detailVisible = true; |
| | | this.$nextTick(() => { |
| | | if (this.$refs.MapContainer && this.$refs.MapContainer.initAddEntity) { |
| | | this.$refs.MapContainer.initAddEntity('point', this.currentDetail.location) |
| | | this.$refs.MapContainer.initAddEntity('point', this.currentDetail.location); |
| | | } |
| | | }) |
| | | }); |
| | | }, |
| | | |
| | | getStepHandler (status) { |
| | | const step = this.stepInfos.find(step => step.status === status) |
| | | return step ? step.name : '' |
| | | getStepHandler(status) { |
| | | const step = this.stepInfos.find(step => step.status === status); |
| | | return step ? step.name : ''; |
| | | }, |
| | | |
| | | getStepTime (status) { |
| | | const step = this.stepInfos.find(step => step.status === status) |
| | | getStepTime(status) { |
| | | const step = this.stepInfos.find(step => step.status === status); |
| | | // 如果 step 不存在或 step.time 为 0,返回 false |
| | | return step && step.time && step.time !== '0' ? step.time : false |
| | | return step && step.time && step.time !== '0' ? step.time : false; |
| | | }, |
| | | getStepCreateTime (status) { |
| | | const step = this.stepInfos.find(step => step.status === status) |
| | | return step ? step.create_time : null |
| | | getStepCreateTime(status) { |
| | | const step = this.stepInfos.find(step => step.status === status); |
| | | return step ? step.create_time : null; |
| | | }, |
| | | getActiveStep () { |
| | | getActiveStep() { |
| | | // 步骤索引适配 |
| | | const arr = this.stepStatusList |
| | | const index = arr.indexOf(String(this.currentDetail.status)) |
| | | return index !== -1 ? index + 2 : 1 |
| | | const arr = this.stepStatusList; |
| | | const index = arr.indexOf(String(this.currentDetail.status)); |
| | | return index !== -1 ? index + 2 : 1; |
| | | }, |
| | | |
| | | openMap () { |
| | | const areaCode = this.userInfo.detail.areaCode |
| | | const subAreaCode = areaCode ? areaCode.substring(0, 6) : '' |
| | | getAdcodeObj(geoJson, 'adcode', subAreaCode) |
| | | this.$message.info('地图选址功能暂未实现') |
| | | openMap() { |
| | | const areaCode = this.userInfo.detail.areaCode; |
| | | const subAreaCode = areaCode ? areaCode.substring(0, 6) : ''; |
| | | getAdcodeObj(geoJson, 'adcode', subAreaCode); |
| | | this.$message.info('地图选址功能暂未实现'); |
| | | }, |
| | | |
| | | handlePreview (file) { |
| | | this.$message.info(`预览图片:${file.name}`) |
| | | handlePreview(file) { |
| | | this.$message.info(`预览图片:${file.name}`); |
| | | }, |
| | | |
| | | handleRemove (file) { |
| | | this.$message.info(`移除图片:${file.name}`) |
| | | handleRemove(file) { |
| | | this.$message.info(`移除图片:${file.name}`); |
| | | }, |
| | | |
| | | refreshChange () { |
| | | if (this.isFetching) return |
| | | this.fetchTableData() |
| | | refreshChange() { |
| | | if (this.isFetching) return; |
| | | this.fetchTableData(); |
| | | }, |
| | | |
| | | onLoad () { |
| | | if (this.isFetching) return |
| | | this.fetchTableData() |
| | | onLoad() { |
| | | if (this.isFetching) return; |
| | | this.fetchTableData(); |
| | | }, |
| | | |
| | | async exportData () { |
| | | async exportData() { |
| | | try { |
| | | this.loading = true |
| | | let exportData = [] |
| | | this.loading = true; |
| | | let exportData = []; |
| | | |
| | | // 如果有选中的数据,则导出选中的数据 |
| | | if (this.selections.length > 0) { |
| | | exportData = this.selections.map(item => this.formatExportItem(item)) |
| | | exportData = this.selections.map(item => this.formatExportItem(item)); |
| | | } else { |
| | | // 没有选中数据时,导出当前页面的数据 |
| | | exportData = this.tableData.map(item => this.formatExportItem(item)) |
| | | exportData = this.tableData.map(item => this.formatExportItem(item)); |
| | | } |
| | | |
| | | if (exportData.length === 0) { |
| | | this.$message.warning('没有数据可供导出') |
| | | return |
| | | this.$message.warning('没有数据可供导出'); |
| | | return; |
| | | } |
| | | |
| | | const headers = [ |
| | |
| | | '经纬度', |
| | | '创建人', |
| | | '处理人', |
| | | '工单状态' |
| | | ] |
| | | '工单状态', |
| | | ]; |
| | | |
| | | export_json_to_excel(headers, exportData, '工单数据') |
| | | this.$message.success('数据导出成功') |
| | | export_json_to_excel(headers, exportData, '工单数据'); |
| | | this.$message.success('数据导出成功'); |
| | | } catch (error) { |
| | | console.error('导出失败:', error) |
| | | this.$message.error(error.message || '导出失败,请稍后重试') |
| | | console.error('导出失败:', error); |
| | | this.$message.error(error.message || '导出失败,请稍后重试'); |
| | | } finally { |
| | | this.loading = false |
| | | this.loading = false; |
| | | } |
| | | }, |
| | | |
| | | formatExportItem (item) { |
| | | const longitude = Number(item.longitude) || Number(item.location?.[0]) || 0 |
| | | const latitude = Number(item.latitude) || Number(item.location?.[1]) || 0 |
| | | formatExportItem(item) { |
| | | const longitude = Number(item.longitude) || Number(item.location?.[0]) || 0; |
| | | const latitude = Number(item.latitude) || Number(item.location?.[1]) || 0; |
| | | |
| | | return { |
| | | 工单编号: item.orderNumber || item.event_num || '', |
| | |
| | | 发起时间: item.startTime || item.create_time || '', |
| | | 关联算法: item.aiType || item.ai_types || '', |
| | | 工单内容: item.address || item.content || '', |
| | | 工单类型: this.types.find(t => t.value === (item.type || item.work_order_type_dict_key))?.label || '', |
| | | 经纬度: (!isNaN(longitude) && !isNaN(latitude)) |
| | | ? `${longitude.toFixed(6)}, ${latitude.toFixed(6)}` |
| | | : '', |
| | | 工单类型: |
| | | this.types.find(t => t.value === (item.type || item.work_order_type_dict_key))?.label || |
| | | '', |
| | | 经纬度: |
| | | !isNaN(longitude) && !isNaN(latitude) |
| | | ? `${longitude.toFixed(6)}, ${latitude.toFixed(6)}` |
| | | : '', |
| | | 创建人: item.creator || item.create_user || '', |
| | | 处理人: item.handler || item.update_user || '', |
| | | 工单状态: this.mapStatus(Number(item.status || 0)) |
| | | } |
| | | 工单状态: this.mapStatus(Number(item.status || 0)), |
| | | }; |
| | | }, |
| | | |
| | | handleDepartmentChange (deptId) { |
| | | this.form.handler = '' |
| | | handleDepartmentChange(deptId) { |
| | | this.form.handler = ''; |
| | | }, |
| | | |
| | | handleDispatchDepartmentChange (deptId) { |
| | | this.dispatchForm.handler = '' // 清空处理人选择 |
| | | handleDispatchDepartmentChange(deptId) { |
| | | this.dispatchForm.handler = ''; // 清空处理人选择 |
| | | }, |
| | | |
| | | // 文件改变时的钩子 |
| | | handleFileChange (file, fileList) { |
| | | handleFileChange(file, fileList) { |
| | | // 保持最新的文件列表 |
| | | this.form.photos = fileList.map(item => ({ |
| | | ...item, |
| | | existingUrl: item.url && !item.raw ? item.url : null, // 标记已存在的图片URL |
| | | })) |
| | | this.currentDetail.photos = this.form.photos |
| | | })); |
| | | this.currentDetail.photos = this.form.photos; |
| | | }, |
| | | |
| | | // 文件移除时的钩子 |
| | | handleUploadRemove (file, fileList) { |
| | | this.form.photos = fileList |
| | | this.currentDetail.photos = fileList |
| | | handleUploadRemove(file, fileList) { |
| | | this.form.photos = fileList; |
| | | this.currentDetail.photos = fileList; |
| | | }, |
| | | |
| | | // 上传前的验证 |
| | | beforeUpload (file) { |
| | | const isImage = file.type.includes('image') |
| | | const isLt5M = file.size / 1024 / 1024 < 5 |
| | | beforeUpload(file) { |
| | | const isImage = file.type.includes('image'); |
| | | const isLt5M = file.size / 1024 / 1024 < 5; |
| | | |
| | | if (!isImage) { |
| | | this.$message.error('只能上传图片文件!') |
| | | return false |
| | | this.$message.error('只能上传图片文件!'); |
| | | return false; |
| | | } |
| | | if (!isLt5M) { |
| | | this.$message.error('图片大小不能超过5MB!') |
| | | return false |
| | | this.$message.error('图片大小不能超过5MB!'); |
| | | return false; |
| | | } |
| | | return true |
| | | return true; |
| | | }, |
| | | |
| | | async approveTicket () { |
| | | if (this.approveLoading) return |
| | | this.approveLoading = true |
| | | async approveTicket() { |
| | | if (this.approveLoading) return; |
| | | this.approveLoading = true; |
| | | try { |
| | | const data = { |
| | | id: this.currentDetail.id, |
| | | status: this.currentDetail.status, |
| | | isPass: 0, // 0 表示通过 |
| | | eventNum: this.currentDetail.orderNumber, |
| | | } |
| | | }; |
| | | |
| | | const file = this.currentDetail.file || null // 如果没有文件,则为 null |
| | | const file = this.currentDetail.file || null; // 如果没有文件,则为 null |
| | | |
| | | const response = await flowEvent(data, file) |
| | | const response = await flowEvent(data, file); |
| | | if (response.data.code === 0) { |
| | | this.$message.success('工单已通过') |
| | | this.detailVisible = false |
| | | this.fetchTableData() |
| | | this.$message.success('工单已通过'); |
| | | this.detailVisible = false; |
| | | this.fetchTableData(); |
| | | } else { |
| | | throw new Error(response.data.msg || '操作失败') |
| | | throw new Error(response.data.msg || '操作失败'); |
| | | } |
| | | } catch (error) { |
| | | this.$message.error(error.message || '操作失败,请稍后重试') |
| | | this.$message.error(error.message || '操作失败,请稍后重试'); |
| | | } finally { |
| | | this.approveLoading = false |
| | | this.approveLoading = false; |
| | | } |
| | | }, |
| | | async rejectTicket () { |
| | | if (this.rejectLoading) return |
| | | this.rejectLoading = true |
| | | async rejectTicket() { |
| | | if (this.rejectLoading) return; |
| | | this.rejectLoading = true; |
| | | try { |
| | | const data = { |
| | | id: this.currentDetail.id, |
| | | status: this.currentDetail.status, |
| | | isPass: 1, // 1 表示不通过 |
| | | } |
| | | }; |
| | | |
| | | const response = await flowEvent(data) |
| | | const response = await flowEvent(data); |
| | | if (response.data.code === 0) { |
| | | this.$message.success('工单未通过') |
| | | this.detailVisible = false |
| | | this.fetchTableData() |
| | | this.$message.success('工单未通过'); |
| | | this.detailVisible = false; |
| | | this.fetchTableData(); |
| | | } else { |
| | | throw new Error(response.data.msg || '操作失败') |
| | | throw new Error(response.data.msg || '操作失败'); |
| | | } |
| | | } catch (error) { |
| | | this.$message.error(error.message || '操作失败,请稍后重试') |
| | | this.$message.error(error.message || '操作失败,请稍后重试'); |
| | | } finally { |
| | | this.rejectLoading = false |
| | | this.rejectLoading = false; |
| | | } |
| | | }, |
| | | async submitProcessing () { |
| | | async submitProcessing() { |
| | | if (this.currentDetail.status !== 3) { |
| | | this.$message.warning('只有处理中状态的工单可以提交处理详情') |
| | | return |
| | | this.$message.warning('只有处理中状态的工单可以提交处理详情'); |
| | | return; |
| | | } |
| | | |
| | | try { |
| | |
| | | id: this.currentDetail.id, // 当前工单 ID |
| | | status: this.currentDetail.status, // 当前工单状态 |
| | | processing_details: this.currentDetail.processingDetail, // 事件处理详情 |
| | | } |
| | | }; |
| | | |
| | | // 如果有图片,添加 file 参数 |
| | | const file = this.currentDetail.photos?.[0]?.raw || null |
| | | const file = this.currentDetail.photos?.[0]?.raw || null; |
| | | |
| | | const response = await flowEvent(data, file) |
| | | const response = await flowEvent(data, file); |
| | | if (response.data.code === 0) { |
| | | this.$message.success('处理详情提交成功') |
| | | this.detailVisible = false |
| | | this.fetchTableData() |
| | | this.$message.success('处理详情提交成功'); |
| | | this.detailVisible = false; |
| | | this.fetchTableData(); |
| | | } else { |
| | | throw new Error(response.data.msg || '提交失败') |
| | | throw new Error(response.data.msg || '提交失败'); |
| | | } |
| | | } catch (error) { |
| | | console.error('处理详情提交失败:', error) |
| | | this.$message.error(error.message || '提交失败,请稍后重试') |
| | | console.error('处理详情提交失败:', error); |
| | | this.$message.error(error.message || '提交失败,请稍后重试'); |
| | | } |
| | | }, |
| | | markAsCompleted () { |
| | | this.$message.success('工单已标记为完成') |
| | | markAsCompleted() { |
| | | this.$message.success('工单已标记为完成'); |
| | | }, |
| | | async completeTicket () { |
| | | if (this.completeLoading) return |
| | | this.completeLoading = true |
| | | async completeTicket() { |
| | | if (this.completeLoading) return; |
| | | this.completeLoading = true; |
| | | try { |
| | | if (!this.currentDetail.processingDetail) { |
| | | this.$message.warning('请先填写事件处理详情') |
| | | return |
| | | this.$message.warning('请先填写事件处理详情'); |
| | | return; |
| | | } |
| | | // 检查图片上传 |
| | | if (!this.currentDetail.photos || this.currentDetail.photos.length === 0) { |
| | | this.$message.warning('请选择上传图片') |
| | | this.completeLoading = false |
| | | return |
| | | this.$message.warning('请选择上传图片'); |
| | | this.completeLoading = false; |
| | | return; |
| | | } |
| | | |
| | | const data = { |
| | |
| | | status: this.currentDetail.status, |
| | | processingDetails: this.currentDetail.processingDetail, |
| | | eventNum: this.currentDetail.orderNumber, |
| | | } |
| | | }; |
| | | |
| | | // 如果有上传的图片,添加到请求中 |
| | | const file = this.currentDetail.photos?.[0]?.raw || null |
| | | const file = this.currentDetail.photos?.[0]?.raw || null; |
| | | |
| | | const response = await flowEvent(data, file) |
| | | const response = await flowEvent(data, file); |
| | | |
| | | if (response.data.code === 0) { |
| | | this.$message.success('工单已完成') |
| | | this.detailVisible = false |
| | | this.fetchTableData() // 刷新列表数据 |
| | | this.$message.success('工单已完成'); |
| | | this.detailVisible = false; |
| | | this.fetchTableData(); // 刷新列表数据 |
| | | } else { |
| | | throw new Error(response.data.msg || '操作失败') |
| | | throw new Error(response.data.msg || '操作失败'); |
| | | } |
| | | } catch (error) { |
| | | console.error('完成工单失败:', error) |
| | | this.$message.error(error.message || '操作失败,请稍后重试') |
| | | console.error('完成工单失败:', error); |
| | | this.$message.error(error.message || '操作失败,请稍后重试'); |
| | | } finally { |
| | | this.completeLoading = false |
| | | this.completeLoading = false; |
| | | } |
| | | }, |
| | | async approveAndDispatch () { |
| | | if (this.dispatchLoading) return |
| | | async approveAndDispatch() { |
| | | if (this.dispatchLoading) return; |
| | | |
| | | // 添加必填项检查 |
| | | if (!this.currentDetail.orderName || !this.currentDetail.orderName.trim()) { |
| | | this.$message.warning('请填写工单名称') |
| | | return |
| | | this.$message.warning('请填写工单名称'); |
| | | return; |
| | | } |
| | | if (!this.currentDetail.type) { |
| | | this.$message.warning('请选择工单类型') |
| | | return |
| | | this.$message.warning('请选择工单类型'); |
| | | return; |
| | | } |
| | | if (!this.currentDetail.content || !this.currentDetail.content.trim()) { |
| | | this.$message.warning('请填写工单内容') |
| | | return |
| | | this.$message.warning('请填写工单内容'); |
| | | return; |
| | | } |
| | | |
| | | // 通过验证后,打开派发对话框 |
| | | this.dispatchDialogVisible = true |
| | | this.dispatchDialogVisible = true; |
| | | }, |
| | | hasProcessingBtnPermission () { |
| | | hasProcessingBtnPermission() { |
| | | // undefined 或 false 都返回 false,只有 true 返回 true |
| | | // console.log('权限检查:', this.permission) |
| | | return this.permission && this.permission.tickets_processing_btn === true |
| | | return this.permission && this.permission.tickets_processing_btn === true; |
| | | }, |
| | | hasProcessedAndOverBtnPermission () { |
| | | hasProcessedAndOverBtnPermission() { |
| | | // undefined 或 false 都返回 false,只有 true 返回 true |
| | | //console.log('权限检查:', this.permission) |
| | | return this.permission && this.permission.tickets_view_processedAndOver === true |
| | | return this.permission && this.permission.tickets_view_processedAndOver === true; |
| | | }, |
| | | hasReviewBtnPermission () { |
| | | hasReviewBtnPermission() { |
| | | // undefined 或 false 都返回 false,只有 true 返回 true |
| | | // console.log('权限检查:', this.permission) |
| | | return this.permission && this.permission.tickets_review_btn === true |
| | | return this.permission && this.permission.tickets_review_btn === true; |
| | | }, |
| | | async submitDispatch () { |
| | | if (this.dispatchLoading) return |
| | | async submitDispatch() { |
| | | if (this.dispatchLoading) return; |
| | | if (!this.currentDetail.orderName || !this.currentDetail.orderName.trim()) { |
| | | this.$message.warning('请填写工单名称') |
| | | return |
| | | this.$message.warning('请填写工单名称'); |
| | | return; |
| | | } |
| | | if (!this.currentDetail.type) { |
| | | this.$message.warning('请选择工单类型') |
| | | return |
| | | this.$message.warning('请选择工单类型'); |
| | | return; |
| | | } |
| | | if (!this.currentDetail.content || !this.currentDetail.content.trim()) { |
| | | this.$message.warning('请填写工单内容') |
| | | return |
| | | this.$message.warning('请填写工单内容'); |
| | | return; |
| | | } |
| | | if (!this.dispatchForm.department) { |
| | | this.$message.warning('请选择部门') |
| | | return |
| | | this.$message.warning('请选择部门'); |
| | | return; |
| | | } |
| | | if (!this.dispatchForm.handler) { |
| | | this.$message.warning('请选择处理人') |
| | | return |
| | | this.$message.warning('请选择处理人'); |
| | | return; |
| | | } |
| | | this.dispatchLoading = true |
| | | this.dispatchLoading = true; |
| | | this.$refs.dispatchForm.validate(async valid => { |
| | | if (valid) { |
| | | try { |
| | |
| | | content: this.currentDetail.content, // 使用 content 替代原来的 remark |
| | | createDept: this.dispatchForm.department, // 派发部门 ID |
| | | updateUser: this.dispatchForm.handler, // 处理人 ID |
| | | } |
| | | }; |
| | | |
| | | const file = this.currentDetail.file || null // 如果没有文件,则为 null |
| | | const file = this.currentDetail.file || null; // 如果没有文件,则为 null |
| | | |
| | | const response = await flowEvent(data, file) |
| | | const response = await flowEvent(data, file); |
| | | if (response.data.code === 0) { |
| | | this.$message.success('工单已成功派发') |
| | | this.dispatchDialogVisible = false |
| | | this.detailVisible = false |
| | | this.fetchTableData() |
| | | this.$message.success('工单已成功派发'); |
| | | this.dispatchDialogVisible = false; |
| | | this.detailVisible = false; |
| | | this.fetchTableData(); |
| | | } else { |
| | | throw new Error(response.data.msg || '派发失败') |
| | | throw new Error(response.data.msg || '派发失败'); |
| | | } |
| | | } catch (error) { |
| | | console.error('派发失败:', error) |
| | | this.$message.error(error.message || '派发失败,请稍后重试') |
| | | console.error('派发失败:', error); |
| | | this.$message.error(error.message || '派发失败,请稍后重试'); |
| | | } finally { |
| | | this.dispatchLoading = false |
| | | this.dispatchLoading = false; |
| | | } |
| | | } else { |
| | | this.dispatchLoading = false |
| | | this.dispatchLoading = false; |
| | | } |
| | | }) |
| | | }); |
| | | }, |
| | | async finalizeTicket () { |
| | | if (this.finalizeLoading) return |
| | | this.finalizeLoading = true |
| | | async finalizeTicket() { |
| | | if (this.finalizeLoading) return; |
| | | this.finalizeLoading = true; |
| | | try { |
| | | // 检查是否上传了图片 |
| | | if (!this.currentDetail.photos || !this.currentDetail.photos.length) { |
| | | this.$message.warning('请上传事件处理照片,或飞行任务结束核验工单是否完结') |
| | | return |
| | | this.$message.warning('请上传事件处理照片,或飞行任务结束核验工单是否完结'); |
| | | return; |
| | | } |
| | | |
| | | const data = { |
| | | id: this.currentDetail.id, |
| | | status: this.currentDetail.status, |
| | | eventNum: this.currentDetail.orderNumber, |
| | | } |
| | | }; |
| | | |
| | | const file = this.currentDetail.photos[0].raw |
| | | const file = this.currentDetail.photos[0].raw; |
| | | |
| | | const response = await flowEvent(data, file) |
| | | const response = await flowEvent(data, file); |
| | | |
| | | if (response.data.code === 0) { |
| | | this.$message.success('工单已完结') |
| | | this.detailVisible = false |
| | | this.fetchTableData() |
| | | this.$message.success('工单已完结'); |
| | | this.detailVisible = false; |
| | | this.fetchTableData(); |
| | | } else { |
| | | throw new Error(response.data.msg || '操作失败') |
| | | throw new Error(response.data.msg || '操作失败'); |
| | | } |
| | | } catch (error) { |
| | | console.error('完结工单失败:', error) |
| | | this.$message.error(error.message || '操作失败,请稍后重试') |
| | | console.error('完结工单失败:', error); |
| | | this.$message.error(error.message || '操作失败,请稍后重试'); |
| | | } finally { |
| | | this.finalizeLoading = false |
| | | this.finalizeLoading = false; |
| | | } |
| | | }, |
| | | |
| | | // 添加编辑方法 |
| | | handleEdit (row) { |
| | | this.createoredit = 2 |
| | | console.log('编辑原始数据:', row) |
| | | handleEdit(row) { |
| | | this.createoredit = 2; |
| | | console.log('编辑原始数据:', row); |
| | | |
| | | // 尝试从row.dept_id或通过部门名称查找对应的部门ID |
| | | let deptId = row.dept_id // 优先使用原始数据中的dept_id |
| | | let deptId = row.dept_id; // 优先使用原始数据中的dept_id |
| | | |
| | | // 如果没有dept_id,则通过部门名称查找 |
| | | if (!deptId) { |
| | | // 输出所有可用的部门数据用于调试 |
| | | console.log('可用部门列表:', this.departments) |
| | | console.log('当前部门名称:', row.department) |
| | | console.log('可用部门列表:', this.departments); |
| | | console.log('当前部门名称:', row.department); |
| | | |
| | | const deptInfo = this.departments.find( |
| | | dept => dept.label && dept.label.trim() === row.department.trim() |
| | | ) |
| | | deptId = deptInfo?.value |
| | | ); |
| | | deptId = deptInfo?.value; |
| | | } |
| | | |
| | | // 获取工单类型值 - 从types中找到匹配的值 |
| | | const typeValue = |
| | | this.types.find(t => t.label === row.type)?.value || row.work_order_type_dict_key |
| | | this.types.find(t => t.label === row.type)?.value || row.work_order_type_dict_key; |
| | | |
| | | // 获取处理人ID - 使用userNameToIdMap映射 |
| | | const handlerId = this.userNameToIdMap[row.handler] || row.handler |
| | | const handlerId = this.userNameToIdMap[row.handler] || row.handler; |
| | | |
| | | console.log('数据映射:', { |
| | | 部门名称: row.department, |
| | |
| | | 处理人ID: handlerId, |
| | | 原始工单类型: row.type, |
| | | 映射后类型值: typeValue, |
| | | }) |
| | | }); |
| | | |
| | | // 修改算法数组的处理逻辑 |
| | | let algorithmArr = [] |
| | | let algorithmArr = []; |
| | | if (Array.isArray(row.aiType)) { |
| | | algorithmArr = row.aiType |
| | | algorithmArr = row.aiType; |
| | | } else if (typeof row.aiType === 'string' && row.aiType) { |
| | | // 首先尝试将字符串按照逗号或顿号分割 |
| | | algorithmArr = row.aiType.split(/[,、]/).map(item => item.trim()) |
| | | algorithmArr = row.aiType.split(/[,、]/).map(item => item.trim()); |
| | | } |
| | | |
| | | // 确保算法值与选项匹配 |
| | |
| | | if (typeof item === 'string') { |
| | | const matchedAlgorithm = this.algorithms.find( |
| | | algo => algo.dict_value === item || algo.dict_key === item |
| | | ) |
| | | return matchedAlgorithm ? matchedAlgorithm.dict_key : item |
| | | ); |
| | | return matchedAlgorithm ? matchedAlgorithm.dict_key : item; |
| | | } |
| | | return item |
| | | return item; |
| | | }) |
| | | .filter(Boolean) // 过滤掉无效值 |
| | | .filter(Boolean); // 过滤掉无效值 |
| | | |
| | | console.log('算法处理:', { |
| | | 原始值: row.aiType, |
| | | 分割后: algorithmArr, |
| | | }) |
| | | }); |
| | | |
| | | this.form = { |
| | | id: row.id, |
| | |
| | | address: row.address || '', |
| | | content: row.content, |
| | | photos: [], |
| | | }; |
| | | |
| | | } |
| | | |
| | | let curLocation = [] |
| | | let curLocation = []; |
| | | |
| | | if (Array.isArray(row.location) && row.location.length >= 2) { |
| | | let [lng, lat] = this.disposeLocation(false, row) |
| | | let [lng, lat] = this.disposeLocation(false, row); |
| | | |
| | | curLocation = [lng, lat, row.location[2] || row.address || ''] |
| | | curLocation = [lng, lat, row.location[2] || row.address || '']; |
| | | } |
| | | |
| | | this.form.location = curLocation |
| | | this.form.address = this.form.location[2] || '' |
| | | this.form.location = curLocation; |
| | | this.form.address = this.form.location[2] || ''; |
| | | // 设置地图中心点 |
| | | if (Array.isArray(this.form.location) && this.form.location.length >= 2) { |
| | | this.mapParams.center = [Number(this.form.location[0]), Number(this.form.location[1])] |
| | | this.mapParams.center = [Number(this.form.location[0]), Number(this.form.location[1])]; |
| | | } else { |
| | | this.mapParams.center = [...this.inputMapShowDefaultCenter] |
| | | this.mapParams.center = [...this.inputMapShowDefaultCenter]; |
| | | } |
| | | // 如果有图片,添加到表单中 |
| | | if (row.photo_url) { |
| | |
| | | raw: null, // 初始化为null |
| | | existingUrl: row.photo_url, // 保存原始URL,用于区分是否为已存在的图片 |
| | | }, |
| | | ] |
| | | ]; |
| | | } |
| | | |
| | | // 调试输出 |
| | |
| | | 原始算法值: row.aiType, |
| | | 处理后算法值: algorithmArr, |
| | | 表单数据: this.form, |
| | | }) |
| | | }); |
| | | |
| | | this.dialogVisible = true |
| | | this.dialogVisible = true; |
| | | }, |
| | | |
| | | // 添加删除方法 |
| | | handleDelete (row) { |
| | | handleDelete(row) { |
| | | this.$confirm('确认删除该工单?', '提示', { |
| | | confirmButtonText: '确定', |
| | | cancelButtonText: '取消', |
| | |
| | | id: row.id, |
| | | status: 0, |
| | | isDelete: 1, |
| | | }) |
| | | }); |
| | | |
| | | if (response.data.code === 0) { |
| | | this.$message.success('删除成功') |
| | | this.fetchTableData() |
| | | this.$message.success('删除成功'); |
| | | this.fetchTableData(); |
| | | } else { |
| | | throw new Error(response.data.msg || '删除失败') |
| | | throw new Error(response.data.msg || '删除失败'); |
| | | } |
| | | } catch (error) { |
| | | console.error('删除失败:', error) |
| | | this.$message.error(error.message || '删除失败,请稍后重试') |
| | | console.error('删除失败:', error); |
| | | this.$message.error(error.message || '删除失败,请稍后重试'); |
| | | } |
| | | }) |
| | | .catch(() => { }) |
| | | .catch(() => {}); |
| | | }, |
| | | |
| | | // 添加选择变化处理方法 |
| | | handleSelectionChange (selection) { |
| | | |
| | | this.selections = selection |
| | | console.log('已选择的行:', selection) |
| | | handleSelectionChange(selection) { |
| | | this.selections = selection; |
| | | console.log('已选择的行:', selection); |
| | | }, |
| | | |
| | | // 添加全选方法 |
| | | handleSelectAll (val) { |
| | | this.$refs.avueCrud.toggleSelection(val) |
| | | handleSelectAll(val) { |
| | | this.$refs.avueCrud.toggleSelection(val); |
| | | }, |
| | | |
| | | // 添加单行选择方法 |
| | | handleSelect (selection, row) { |
| | | console.log('选中行变化:', selection, row) |
| | | handleSelect(selection, row) { |
| | | console.log('选中行变化:', selection, row); |
| | | }, |
| | | |
| | | // 如果需要手动选中某些行 |
| | | setSelection (rows) { |
| | | setSelection(rows) { |
| | | this.$nextTick(() => { |
| | | rows.forEach(row => { |
| | | this.$refs.avueCrud.toggleSelection(row, true) |
| | | }) |
| | | }) |
| | | this.$refs.avueCrud.toggleSelection(row, true); |
| | | }); |
| | | }); |
| | | }, |
| | | |
| | | // 清空选择 |
| | | clearSelection () { |
| | | this.$refs.avueCrud.clearSelection() |
| | | clearSelection() { |
| | | this.$refs.avueCrud.clearSelection(); |
| | | }, |
| | | |
| | | // 打开审核对话框 |
| | | openReviewDialog () { |
| | | openReviewDialog() { |
| | | if (this.selections.length === 0) { |
| | | this.$message.warning('请先选择要审核的工单') |
| | | return |
| | | this.$message.warning('请先选择要审核的工单'); |
| | | return; |
| | | } |
| | | this.currentImageIndex = 1 |
| | | this.updateCurrentReviewImage() |
| | | this.reviewDialogVisible = true |
| | | this.currentImageIndex = 1; |
| | | this.updateCurrentReviewImage(); |
| | | this.reviewDialogVisible = true; |
| | | }, |
| | | |
| | | // 更新当前审核图片 |
| | | updateCurrentReviewImage () { |
| | | updateCurrentReviewImage() { |
| | | // 修正索引范围 |
| | | if (!this.selections || this.selections.length === 0) { |
| | | this.currentReviewImage = '' |
| | | this.currentImageIndex = 1 |
| | | return |
| | | this.currentReviewImage = ''; |
| | | this.currentImageIndex = 1; |
| | | return; |
| | | } |
| | | // 如果当前索引超出范围,自动回退到最后一张 |
| | | if (this.currentImageIndex > this.selections.length) { |
| | | this.currentImageIndex = this.selections.length |
| | | this.currentImageIndex = this.selections.length; |
| | | } |
| | | if (this.currentImageIndex < 1) { |
| | | this.currentImageIndex = 1 |
| | | this.currentImageIndex = 1; |
| | | } |
| | | const index = this.currentImageIndex - 1 |
| | | const index = this.currentImageIndex - 1; |
| | | if (index >= 0 && index < this.selections.length) { |
| | | const currentItem = this.selections[index] |
| | | this.currentReviewImage = currentItem.photo_url || '' |
| | | const currentItem = this.selections[index]; |
| | | this.currentReviewImage = currentItem.photo_url || ''; |
| | | } else { |
| | | this.currentReviewImage = '' |
| | | this.currentReviewImage = ''; |
| | | } |
| | | }, |
| | | |
| | | // 处理图片分页变化 |
| | | handleImagePageChange (page) { |
| | | handleImagePageChange(page) { |
| | | if (page > 0 && page <= this.selections.length) { |
| | | this.currentImageIndex = page |
| | | this.updateCurrentReviewImage() |
| | | this.currentImageIndex = page; |
| | | this.updateCurrentReviewImage(); |
| | | } |
| | | }, |
| | | |
| | | // 批量审核通过 |
| | | async handleBatchApprove () { |
| | | async handleBatchApprove() { |
| | | try { |
| | | if (this.selections.length === 0) { |
| | | this.$message.warning('没有选中的工单') |
| | | return |
| | | this.$message.warning('没有选中的工单'); |
| | | return; |
| | | } |
| | | |
| | | const currentItem = this.selections[this.currentImageIndex - 1] |
| | | const currentItem = this.selections[this.currentImageIndex - 1]; |
| | | if (!currentItem) { |
| | | this.$message.warning('当前工单数据无效') |
| | | return |
| | | this.$message.warning('当前工单数据无效'); |
| | | return; |
| | | } |
| | | |
| | | await this.$confirm('确认审核通过当前工单?', '提示', { |
| | | confirmButtonText: '确定', |
| | | cancelButtonText: '取消', |
| | | type: 'warning', |
| | | }) |
| | | }); |
| | | |
| | | const data = { |
| | | id: currentItem.id, |
| | | status: currentItem.status, |
| | | isPass: 0, |
| | | eventNum: currentItem.orderNumber, |
| | | } |
| | | console.log('删除前:', this.selections) |
| | | const response = await flowEvent(data) |
| | | }; |
| | | console.log('删除前:', this.selections); |
| | | const response = await flowEvent(data); |
| | | if (response.data.code === 0) { |
| | | this.$message.success('工单审核通过') |
| | | this.$message.success('工单审核通过'); |
| | | |
| | | // 创建新的数组而不是修改原数组 |
| | | const newSelections = [...this.selections] |
| | | newSelections.splice(this.currentImageIndex - 1, 1) |
| | | const newSelections = [...this.selections]; |
| | | newSelections.splice(this.currentImageIndex - 1, 1); |
| | | |
| | | // 修正索引并更新图片 |
| | | if (newSelections.length > 0) { |
| | | if (this.currentImageIndex > this.selections.length) { |
| | | this.currentImageIndex = this.selections.length |
| | | this.currentImageIndex = this.selections.length; |
| | | } |
| | | this.updateCurrentReviewImage() |
| | | this.updateCurrentReviewImage(); |
| | | } else { |
| | | this.reviewDialogVisible = false |
| | | this.currentImageIndex = 1 |
| | | this.currentReviewImage = '' |
| | | this.fetchTableData() |
| | | this.reviewDialogVisible = false; |
| | | this.currentImageIndex = 1; |
| | | this.currentReviewImage = ''; |
| | | this.fetchTableData(); |
| | | } |
| | | |
| | | // 刷新表格数据 |
| | | // this.fetchTableData(); |
| | | this.selections = newSelections |
| | | this.selections = newSelections; |
| | | } else { |
| | | throw new Error(response.data.msg || '审核失败') |
| | | throw new Error(response.data.msg || '审核失败'); |
| | | } |
| | | } catch (error) { |
| | | if (error === 'cancel') return |
| | | this.$message.error(error.message || '审核失败,请稍后重试') |
| | | if (error === 'cancel') return; |
| | | this.$message.error(error.message || '审核失败,请稍后重试'); |
| | | } |
| | | }, |
| | | |
| | | cancleBatchReject () { |
| | | this.reviewDialogVisible = false |
| | | this.selections = [] |
| | | this.currentImageIndex = 1 |
| | | this.currentReviewImage = '' |
| | | this.fetchTableData() |
| | | cancleBatchReject() { |
| | | this.reviewDialogVisible = false; |
| | | this.selections = []; |
| | | this.currentImageIndex = 1; |
| | | this.currentReviewImage = ''; |
| | | this.fetchTableData(); |
| | | }, |
| | | // 批量审核不通过 |
| | | async handleBatchReject () { |
| | | async handleBatchReject() { |
| | | try { |
| | | if (this.selections.length === 0) { |
| | | this.$message.warning('没有选中的工单') |
| | | return |
| | | this.$message.warning('没有选中的工单'); |
| | | return; |
| | | } |
| | | |
| | | const currentItem = this.selections[this.currentImageIndex - 1] |
| | | const currentItem = this.selections[this.currentImageIndex - 1]; |
| | | if (!currentItem) { |
| | | this.$message.warning('当前工单数据无效') |
| | | return |
| | | this.$message.warning('当前工单数据无效'); |
| | | return; |
| | | } |
| | | |
| | | await this.$confirm('确认该工单审核不通过?', '提示', { |
| | | confirmButtonText: '确定', |
| | | cancelButtonText: '取消', |
| | | type: 'warning', |
| | | }) |
| | | }); |
| | | |
| | | const data = { |
| | | id: currentItem.id, |
| | |
| | | isPass: 1, |
| | | eventNum: currentItem.orderNumber, |
| | | eventName: currentItem.orderName, |
| | | } |
| | | }; |
| | | |
| | | const response = await flowEvent(data) |
| | | const response = await flowEvent(data); |
| | | if (response.data.code === 0) { |
| | | this.$message.success('工单审核不通过') |
| | | this.$message.success('工单审核不通过'); |
| | | |
| | | // 创建新的数组而不是修改原数组 |
| | | const newSelections = [...this.selections] |
| | | newSelections.splice(this.currentImageIndex - 1, 1) |
| | | this.selections = newSelections |
| | | const newSelections = [...this.selections]; |
| | | newSelections.splice(this.currentImageIndex - 1, 1); |
| | | this.selections = newSelections; |
| | | |
| | | // 修正索引并更新图片 |
| | | if (this.selections.length > 0) { |
| | | if (this.currentImageIndex > this.selections.length) { |
| | | this.currentImageIndex = this.selections.length |
| | | this.currentImageIndex = this.selections.length; |
| | | } |
| | | this.updateCurrentReviewImage() |
| | | this.updateCurrentReviewImage(); |
| | | } else { |
| | | this.reviewDialogVisible = false |
| | | this.currentImageIndex = 1 |
| | | this.currentReviewImage = '' |
| | | this.fetchTableData() |
| | | this.reviewDialogVisible = false; |
| | | this.currentImageIndex = 1; |
| | | this.currentReviewImage = ''; |
| | | this.fetchTableData(); |
| | | } |
| | | |
| | | // 刷新表格数据 |
| | | // this.fetchTableData(); |
| | | } else { |
| | | throw new Error(response.data.msg || '驳回失败') |
| | | throw new Error(response.data.msg || '驳回失败'); |
| | | } |
| | | } catch (error) { |
| | | if (error === 'cancel') return |
| | | this.$message.error(error.message || '驳回失败,请稍后重试') |
| | | if (error === 'cancel') return; |
| | | this.$message.error(error.message || '驳回失败,请稍后重试'); |
| | | } |
| | | }, |
| | | |
| | | // 获取所有图片列表用于预览 |
| | | getImageList () { |
| | | return this.selections.map(item => this.getPreviewUrl(item.photo_url)).filter(url => url) // 过滤掉空值 |
| | | getImageList() { |
| | | return this.selections.map(item => this.getPreviewUrl(item.photo_url)).filter(url => url); // 过滤掉空值 |
| | | }, |
| | | |
| | | // 处理图片点击 |
| | | handleImageClick () { |
| | | handleImageClick() { |
| | | // 图片点击事件由 el-image 的预览功能处理 |
| | | }, |
| | | |
| | | // 处理上一张图片 |
| | | handlePrevImage () { |
| | | handlePrevImage() { |
| | | if (this.currentImageIndex > 1) { |
| | | this.currentImageIndex-- |
| | | this.updateCurrentReviewImage() |
| | | this.currentImageIndex--; |
| | | this.updateCurrentReviewImage(); |
| | | } |
| | | }, |
| | | |
| | | // 处理下一张图片 |
| | | handleNextImage () { |
| | | handleNextImage() { |
| | | if (this.currentImageIndex < this.selections.length) { |
| | | this.currentImageIndex++ |
| | | this.updateCurrentReviewImage() |
| | | this.currentImageIndex++; |
| | | this.updateCurrentReviewImage(); |
| | | } |
| | | }, |
| | | |
| | |
| | | * @param {string} url 原图地址 |
| | | * @returns {string} 缩略图地址 |
| | | */ |
| | | getThumbUrl (url) { |
| | | if (!url) return '' |
| | | const lastDot = url.lastIndexOf('.') |
| | | if (lastDot === -1) return url |
| | | return url.slice(0, lastDot) + '_small' + url.slice(lastDot) |
| | | getThumbUrl(url) { |
| | | if (!url) return ''; |
| | | const lastDot = url.lastIndexOf('.'); |
| | | if (lastDot === -1) return url; |
| | | return url.slice(0, lastDot) + '_small' + url.slice(lastDot); |
| | | }, |
| | | |
| | | // 添加新方法:获取预览图地址 |
| | | getPreviewUrl (url) { |
| | | if (!url) return '' |
| | | const lastDot = url.lastIndexOf('.') |
| | | if (lastDot === -1) return url |
| | | return url.slice(0, lastDot) + '_show' + url.slice(lastDot) |
| | | getPreviewUrl(url) { |
| | | if (!url) return ''; |
| | | const lastDot = url.lastIndexOf('.'); |
| | | if (lastDot === -1) return url; |
| | | return url.slice(0, lastDot) + '_show' + url.slice(lastDot); |
| | | }, |
| | | |
| | | /** |
| | | * 坐标转换方法处理 |
| | | * @param goWgs84 是否由国测转换到84,默认false----由84转换到国测 |
| | | */ |
| | | disposeLocation (goWgs84 = false, data) { |
| | | let lng = '', lat = '' |
| | | disposeLocation(goWgs84 = false, data) { |
| | | let lng = '', |
| | | lat = ''; |
| | | |
| | | if (Array.isArray(data.location) && data.location.length > 0) { |
| | | if (goWgs84) { |
| | | lng = data.location?.[0] ? String(data.location[0]) : undefined |
| | | lat = data.location?.[1] ? String(data.location[1]) : undefined |
| | | lng = data.location?.[0] ? String(data.location[0]) : undefined; |
| | | lat = data.location?.[1] ? String(data.location[1]) : undefined; |
| | | |
| | | if (lng && lat) { |
| | | [lng, lat] = gcj02ToWgs84(Number(lng), Number(lat)) |
| | | [lng, lat] = gcj02ToWgs84(Number(lng), Number(lat)); |
| | | } |
| | | } else { |
| | | lng = Number(data.location[0]) |
| | | lat = Number(data.location[1]) |
| | | lng = Number(data.location[0]); |
| | | lat = Number(data.location[1]); |
| | | |
| | | if (lng && lat) { |
| | | [lng, lat] = wgs84ToGcj02(Number(lng), Number(lat)) |
| | | [lng, lat] = wgs84ToGcj02(Number(lng), Number(lat)); |
| | | } |
| | | } |
| | | } |
| | | |
| | | return [String(lng), String(lat)] |
| | | return [String(lng), String(lat)]; |
| | | }, |
| | | |
| | | // 复核按钮 |
| | | reCheck (row) { |
| | | this.reCheckData = row |
| | | this.reCheckDialog = true |
| | | reCheck(row) { |
| | | this.reCheckData = row; |
| | | this.reCheckDialog = true; |
| | | }, |
| | | |
| | | // 复核确认框按钮事件 |
| | | reCheckConfirm (key) { |
| | | const that = this |
| | | reCheckConfirm(key) { |
| | | const that = this; |
| | | if (key == 1) { |
| | | getReviewById(that.reCheckData.id).then(res => { |
| | | that.reCheckDialog = false |
| | | that.page.currentPage = 1 |
| | | that.fetchTableData() |
| | | that.fetchTabCounts() |
| | | }) |
| | | that.reCheckDialog = false; |
| | | that.page.currentPage = 1; |
| | | that.fetchTableData(); |
| | | that.fetchTabCounts(); |
| | | }); |
| | | } else { |
| | | const loading = ElLoading.service({ |
| | | lock: true, |
| | | text: '复核任务创建中……', |
| | | background: 'rgba(0, 0, 0, 0.7)', |
| | | }) |
| | | }); |
| | | |
| | | function closeConfirm () { |
| | | that.reCheckDialog = false |
| | | that.page.currentPage = 1 |
| | | that.fetchTableData() |
| | | that.fetchTabCounts() |
| | | loading.close() |
| | | function closeConfirm() { |
| | | that.reCheckDialog = false; |
| | | that.page.currentPage = 1; |
| | | that.fetchTableData(); |
| | | that.fetchTabCounts(); |
| | | loading.close(); |
| | | } |
| | | |
| | | // 获取时间的接口 |
| | |
| | | type: 'warning', |
| | | }) |
| | | .then(() => { |
| | | closeConfirm() |
| | | closeConfirm(); |
| | | }) |
| | | .catch(() => { |
| | | closeConfirm() |
| | | }) |
| | | closeConfirm(); |
| | | }); |
| | | }) |
| | | .catch(() => { |
| | | closeConfirm() |
| | | }) |
| | | closeConfirm(); |
| | | }); |
| | | } |
| | | }, |
| | | }, |
| | | } |
| | | }; |
| | | </script> |
| | | |
| | | <style lang="scss" scoped> |
| | |
| | | } |
| | | |
| | | .uploadImg { |
| | | margin-bottom: 32px |
| | | margin-bottom: 32px; |
| | | } |
| | | |
| | | .tableCss { |
| | | width: 100%; |
| | | margin-bottom: 20px |
| | | margin-bottom: 20px; |
| | | } |
| | | |
| | | .step-timer { |
| | |
| | | text-align: center; |
| | | color: #666; |
| | | font-size: 15px; |
| | | margin-bottom: 12px |
| | | margin-bottom: 12px; |
| | | } |
| | | |
| | | .action-bar { |
| | |
| | | padding-top: 16px; |
| | | border-top: 1px solid #ebeef5; |
| | | |
| | | .el-button+.el-button { |
| | | .el-button + .el-button { |
| | | margin-left: 12px; |
| | | } |
| | | |
| | |
| | | background-color: #fff; |
| | | |
| | | :deep(.el-pagination) { |
| | | |
| | | .btn-prev, |
| | | .btn-next { |
| | | display: none; |