From f828b1576669f6b4a301e8dec18b81ebbb5e5204 Mon Sep 17 00:00:00 2001
From: fuliqi <fuliqi@qq.com>
Date: 星期三, 08 一月 2025 10:16:09 +0800
Subject: [PATCH] 报备时间选不上、和一些回显问题

---
 src/views/system/report/index.vue |  711 +++++++++++++++++++++++++++++++++++++----------------------
 1 files changed, 447 insertions(+), 264 deletions(-)

diff --git a/src/views/system/report/index.vue b/src/views/system/report/index.vue
index f58d886..a7ad736 100644
--- a/src/views/system/report/index.vue
+++ b/src/views/system/report/index.vue
@@ -1,246 +1,269 @@
 <template>
   <div class="app-container">
-    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
-      <el-form-item label="杩愮淮浜哄憳" prop="peopleId">
-        <el-input
-          v-model="queryParams.peopleId"
-          placeholder="杩愮淮浜哄憳濮撳悕"
-          clearable
-          @keyup.enter.native="handleQuery"
-        />
-      </el-form-item>
-      <el-form-item label="鐐逛綅" prop="pointId">
-        <el-input
-          v-model="queryParams.pointId"
-          placeholder="鐐逛綅"
-          clearable
-          @keyup.enter.native="handleQuery"
-        />
+    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch">
+      <el-form-item label="鍏抽敭瀛�" prop="peopleId">
+        <el-input v-model="queryParams.keyword" placeholder="鐐逛綅鍚嶆悳绱�" clearable @keyup.enter.native="handleQuery" @clear="handleQuery"/>
       </el-form-item>
       <el-form-item label="鎶ュ绫诲瀷" prop="reportType">
-        <el-select
-          v-model="queryParams.reportType"
-          placeholder="鎶ュ绫诲瀷"
-          clearable
-        >
+        <el-select v-model="queryParams.reportType" @change="handleQuery" placeholder="鎶ュ绫诲瀷" clearable>
           <el-option label="浜嬪墠鎶ュ" value="浜嬪墠鎶ュ" />
           <el-option label="浜嬪悗鎶ュ" value="浜嬪悗鎶ュ" />
         </el-select>
       </el-form-item>
-      <el-form-item label="鎶ュ鏃堕棿">
-        <el-date-picker
-          v-model="daterangeCreateTime"
-          style="width: 240px"
-          value-format="yyyy-MM-dd"
-          type="daterange"
-          range-separator="-"
-          start-placeholder="寮�濮嬫棩鏈�"
-          end-placeholder="缁撴潫鏃ユ湡"
-        ></el-date-picker>
+      <el-form-item label="鏁呴殰绫诲瀷" prop="errorTypeList">
+        <el-select v-model="queryParams.errorTypeList" multiple @change="handleQuery" clearable>
+          <el-option v-for="dict in dict.type.report_error_type" :value="dict.value" :key="dict.value" :label="dict.label" />
+        </el-select>
+      </el-form-item>
+      <el-form-item label="瀹℃牳鐘舵��">
+        <el-select v-model="queryParams.status" @change="handleQuery" placeholder="瀹℃牳鐘舵��" clearable>
+          <el-option label="鍏ㄩ儴" value="" />
+          <el-option label="瀹℃牳涓�" :value="0" />
+          <el-option label="瀹℃牳鏈�氳繃" :value="2" />
+          <el-option label="瀹℃牳閫氳繃" :value="1" />
+        </el-select>
       </el-form-item>
       <el-form-item>
-        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">鎼滅储</el-button>
-        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">閲嶇疆</el-button>
+        <el-button type="primary" icon="el-icon-search" size="small" @click="handleQuery">鎼滅储</el-button>
+        <el-button icon="el-icon-refresh" size="small" @click="resetQuery">閲嶇疆</el-button>
       </el-form-item>
     </el-form>
 
     <el-row :gutter="10" class="mb8">
       <el-col :span="1.5">
-        <el-button
-          type="primary"
-          plain
-          icon="el-icon-plus"
-          size="mini"
-          @click="handleAdd"
-        >鏂板</el-button>
-      </el-col>
-<!--      <el-col :span="1.5">-->
-<!--        <el-button-->
-<!--          type="success"-->
-<!--          plain-->
-<!--          icon="el-icon-edit"-->
-<!--          size="mini"-->
-<!--          :disabled="single"-->
-<!--          @click="handleUpdate"-->
-<!--        >淇敼</el-button>-->
-<!--      </el-col>-->
-      <el-col :span="1.5">
-        <el-button
-          type="danger"
-          plain
-          icon="el-icon-delete"
-          size="mini"
-          :disabled="multiple"
-          @click="handleDelete"
-        >鍒犻櫎</el-button>
+        <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd"
+          v-hasPermi="['system:report:add']">鍗曟鎶ュ</el-button>
       </el-col>
       <el-col :span="1.5">
-        <el-button
-          type="warning"
-          plain
-          icon="el-icon-download"
-          size="mini"
-          @click="handleExport"
-        >瀵煎嚭</el-button>
+        <el-button type="success" plain icon="el-icon-upload" size="mini" @click="handleImport"
+                   v-hasPermi="['system:report:add']">鎵归噺鎶ュ</el-button>
+      </el-col>
+      <el-col :span="1.5">
+        <el-button type="danger" plain icon="el-icon-delete" size="mini" :disabled="multiple" @click="handleDelete"
+          v-hasPermi="['system:report:remove']">鍒犻櫎</el-button>
+      </el-col>
+      <el-col :span="1.5">
+        <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport"
+          v-hasPermi="['system:report:export']">瀵煎嚭</el-button>
       </el-col>
       <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
     </el-row>
 
     <el-table v-loading="loading" :data="reportList" @selection-change="handleSelectionChange">
+      <el-table-column type="expand">
+        <template slot-scope="scope">
+          <div class="info-container">
+            <div class="info-item">
+              <div class="info-label">鎶ュ鍐呭</div>
+              <div class="info-text" v-html="scope.row.reportContent"></div>
+            </div>
+            <div class="info-item">
+              <div class="info-label">鎶ュ鏉愭枡</div>
+              <div class="info-list">
+                <div style="margin-bottom: 8px" v-for="file in formatFileList(scope.row.reportMaterials)" :key="file">
+                  <el-link type="primary" @click="handleDownload(file)">
+                    {{file.match(/\/([^\/]*)$/)[1]}}
+                  </el-link>
+                </div>
+              </div>
+            </div>
+          </div>
+        </template>
+      </el-table-column>
       <el-table-column type="selection" width="55" align="center" />
-      <el-table-column label="杩愮淮鍗曚綅" align="center" prop="unitName" />
-      <el-table-column label="鎶ュ浜哄憳" align="center" prop="peopleName" />
-      <el-table-column label="鐐逛綅" align="center" prop="pointName" />
+      <el-table-column label="鎶ュ鍗曚綅" width="200" align="center" prop="unitName" />
+<!--      <el-table-column label="鎶ュ浜哄憳" align="center" prop="peopleName" />-->
+      <el-table-column label="鐐逛綅" width="250" align="center" prop="pointName" />
       <el-table-column label="鎶ュ绫诲瀷" align="center" prop="reportType" />
-      <el-table-column label="鎶ュ鍐呭" align="center" prop="reportContent" show-overflow-tooltip="true" />
-      <el-table-column label="涓婃姤鏉愭枡" align="center" prop="reportMaterials" show-overflow-tooltip="true">
+      <el-table-column label="鎶ュ鏃堕棿" width="200" align="center" prop="createTime" />
+      <el-table-column label="鏁呴殰绫诲瀷" width="250" align="center" prop="errorType" />
+      <el-table-column label="鏈夋晥鏃堕棿" width="250" align="center">
         <template slot-scope="scope">
-          <div v-for="(item, index) in scope.row.reportMaterials.split(',')" :key="index">{{ item.substring(item.lastIndexOf("/") + 1) }}</div>
+          {{scope.row.beginCreateTime}}鑷硔{scope.row.endCreateTime}}
         </template>
       </el-table-column>
-      <el-table-column label="鏁呴殰绫诲瀷" align="center" prop="errorType" />
-      <el-table-column label="瀹℃牳鏃堕棿" align="center" prop="auditingTime" width="180">
+      <el-table-column label="瀹℃牳缁撴灉" align="center" prop="status" :formatter="formatStatus" />
+      <el-table-column label="鎿嶄綔" fixed="right" width="250" align="center" class-name="small-padding fixed-width">
         <template slot-scope="scope">
-          <span>{{ parseTime(scope.row.auditingTime, '{y}-{m}-{d}') }}</span>
-        </template>
-      </el-table-column>
-      <el-table-column label="鎿嶄綔" align="center" class-name="small-padding fixed-width">
-        <template slot-scope="scope">
-<!--          <el-button-->
-<!--            size="mini"-->
-<!--            type="text"-->
-<!--            icon="el-icon-edit"-->
-<!--            @click="handleUpdate(scope.row)"-->
-<!--            v-hasPermi="['system:report:edit']"-->
-<!--          >淇敼</el-button>-->
-          <el-button
-            size="mini"
-            type="text"
-            icon="el-icon-edit"
-            @click="handleAuditing(scope.row)"
-            v-hasPermi="['system:report:audit']"
-            v-if="scope.row.status === 0"
-          >瀹℃牳</el-button>
-          <el-button
-            size="mini"
-            type="text"
-            icon="el-icon-delete"
-            @click="handleDelete(scope.row)"
-            v-hasPermi="['system:report:remove']"
-          >鍒犻櫎</el-button>
+          <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
+            v-hasPermi="['system:report:edit']" v-if="scope.row.status === 2 || scope.row.status === 0">淇敼</el-button>
+          <el-button size="mini" type="text" icon="el-icon-edit" @click="handleAuditing(scope.row)"
+            v-hasPermi="['system:report:auditing']" v-if="scope.row.status === 0 || scope.row.status === 2">瀹℃牳</el-button>
+          <el-button size="mini" type="text" icon="el-icon-s-check" @click="handleAuditingRecord(scope.row.id)"
+            v-hasPermi="['system:report:record']">瀹℃牳璁板綍</el-button>
+          <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
+            v-hasPermi="['system:report:remove']">鍒犻櫎</el-button>
         </template>
       </el-table-column>
     </el-table>
 
-    <pagination
-      v-show="total>0"
-      :total="total"
-      :page.sync="queryParams.pageNum"
-      :limit.sync="queryParams.pageSize"
-      @pagination="getList"
-    />
+    <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
+      @pagination="getList" />
 
     <!-- 娣诲姞鎴栦慨鏀规姤澶囧璇濇 -->
-    <el-dialog :title="title" :visible.sync="open" width="600px" append-to-body>
-      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
-        <el-form-item label="鐐逛綅" prop="pointId">
-          <el-select
-            v-model="form.pointId"
-            filterable
-            remote
-            reserve-keyword
-            placeholder="璇烽�夋嫨鐐逛綅"
-            :remote-method="remoteGetPoints"
-            :loading="selectLoading">
-            <el-option
-              v-for="item in pointList"
-              :key="item.id"
-              :label="item.value"
-              :value="item.id">
-            </el-option>
-          </el-select>
-        </el-form-item>
-        <el-form-item label="鎶ュ绫诲瀷" prop="reportType">
-          <el-select v-model="form.reportType">
-            <el-option label="浜嬪墠鎶ュ" value="浜嬪墠鎶ュ"/>
-            <el-option label="浜嬪悗鎶ュ" value="浜嬪悗鎶ュ"/>
-          </el-select>
-        </el-form-item>
-        <el-form-item label="鏁呴殰绫诲瀷" prop="errorType">
-          <el-select v-model="form.errorType">
-            <el-option label="甯傛斂鏂藉伐" value="甯傛斂鏂藉伐"/>
-            <el-option label="璁惧鏁呴殰" value="璁惧鏁呴殰"/>
-            <el-option label="璁惧閬楀け" value="璁惧閬楀け"/>
-          </el-select>
-        </el-form-item>
-        <el-form-item label="鏈夋晥鏃堕棿">
-          <el-date-picker
-            v-model="expirTime"
-            style="width: 240px"
-            value-format="yyyy-MM-dd"
-            type="daterange"
-            range-separator="-"
-            start-placeholder="鐢熸晥鏃ユ湡"
-            end-placeholder="澶辨晥鏃ユ湡"
-          ></el-date-picker>
-        </el-form-item>
-        <el-form-item label="鎶ュ鍐呭" prop="reportContent">
-          <editor v-model="form.reportContent" :min-height="192"/>
-        </el-form-item>
-        <el-form-item label="涓婃姤鏉愭枡" prop="reportMaterials">
-          <file-upload v-model="form.reportMaterials"/>
-        </el-form-item>
-      </el-form>
+    <el-dialog :title="title" :visible.sync="open" width="980px" :close-on-click-modal="false" append-to-body>
+      <div style="display: flex;flex-direction: row">
+        <div style="flex: 5">
+          <el-form ref="form" :model="form" :rules="rules" label-width="80px">
+            <el-form-item label="鐐逛綅" prop="pointId" v-if="addOrImport === 'add'">
+              <el-select v-model="form.pointId" @change="pointChange" filterable remote reserve-keyword placeholder="鍚嶇О/鍥芥爣鎼滅储鐐逛綅"
+                         :remote-method="remoteGetPoints" :loading="selectLoading">
+                <el-option v-for="item in pointList" :key="item.id" :label="item.value" :value="item.id">
+                </el-option>
+              </el-select>
+            </el-form-item>
+            <el-form-item label="鐐逛綅瀵煎叆" v-if="addOrImport === 'import'">
+              <el-upload accept=".xlsx, .xls" :limit="1" :action="url" drag :before-upload="beforeUpload" :file-list="fileList">
+                <i class="el-icon-upload"></i>
+                <div class="el-upload__text">
+                  灏嗘枃浠舵嫋鍒版澶勶紝鎴�<em>鐐瑰嚮涓婁紶</em>
+                </div>
+                <div class="el-upload__tip" slot="tip">
+                  <span>浠呭厑璁稿鍏ls銆亁lsx鏍煎紡鏂囦欢銆�</span>
+                  <el-link type="primary" :underline="false" style="font-size: 12px; vertical-align: baseline"
+                           @click="importTemplate">涓嬭浇妯℃澘</el-link>
+                </div>
+              </el-upload>
+            </el-form-item>
+            <el-form-item label="鎶ュ绫诲瀷" prop="reportType">
+              <el-select v-model="form.reportType">
+                <el-option label="浜嬪墠鎶ュ" value="浜嬪墠鎶ュ" />
+                <el-option label="浜嬪悗鎶ュ" value="浜嬪悗鎶ュ" />
+              </el-select>
+            </el-form-item>
+            <el-form-item label="鏁呴殰绫诲瀷" prop="errorTypeList">
+              <el-select v-model="form.errorTypeList" multiple>
+                <el-option v-for="dict in dict.type.report_error_type" :value="dict.value" :key="dict.value" :label="dict.label" />
+              </el-select>
+            </el-form-item>
+            <el-form-item label="鎶ュ鏃堕棿" prop="daterangeCreateTime">
+              <el-date-picker v-model="form.daterangeCreateTime"
+                              type="datetimerange"
+                              value-format="yyyy-MM-dd HH:mm:ss"
+                              format="yyyy-MM-dd HH:mm:ss"
+                              range-separator="-" start-placeholder="寮�濮嬫棩鏈�" end-placeholder="缁撴潫鏃ユ湡"
+                              ></el-date-picker>
+            </el-form-item>
+          </el-form>
+        </div>
+        <div style="flex: 5">
+          <el-form :rules="rules">
+            <el-form-item label="鎶ュ鍐呭" prop="reportContent">
+              <editor v-model="form.reportContent" :min-height="192" />
+            </el-form-item>
+            <el-form-item label="鎶ュ鏉愭枡" prop="reportMaterials">
+              <file-upload v-model="form.reportMaterials" :fileType='fileType' />
+            </el-form-item>
+          </el-form>
+        </div>
+      </div>
+
       <div slot="footer" class="dialog-footer">
-        <el-button type="primary" @click="submitForm">纭� 瀹�</el-button>
         <el-button @click="cancel">鍙� 娑�</el-button>
+        <el-button type="primary" @click="submitForm">鎻愪氦瀹℃牳</el-button>
       </div>
     </el-dialog>
 
+    <!-- 鏌ョ湅瀹℃牳璁板綍 -->
+    <el-dialog title="鎶ュ瀹℃牳璁板綍" :visible.sync="recordOpen" :close-on-click-modal="false" width="900px">
+      <div slot="footer" class="dialog-footer" style="max-height: 500px;overflow-y: auto;">
+        <div v-if="auditingRecordList && auditingRecordList.length > 0">
+          <el-timeline v-for="record in auditingRecordList" :key="record.id">
+            <el-timeline-item :timestamp="record.auditingTime" placement="top">
+              <el-card>
+                <el-descriptions title="鎻愪氦鏁版嵁" :column="3" border>
+                  <el-descriptions-item label="鐐逛綅" label-class-name="my-label" content-class-name="my-content">{{
+                      record.pointName }}</el-descriptions-item>
+                  <el-descriptions-item label="鎶ュ绫诲瀷">{{ record.reportType }}</el-descriptions-item>
+                  <el-descriptions-item label="瀹℃牳缁撴灉"><el-tag :type="record.result ? 'success' : 'danger'">{{ record.result ? "閫氳繃" : "鏈�氳繃" }}</el-tag></el-descriptions-item>
+                  <el-descriptions-item label="瀹℃牳鎰忚">{{ record.resultRemark ? record.resultRemark : "鏃�" }}</el-descriptions-item>
+                  <el-descriptions-item label="鎶ュ鍐呭">
+                    <div class="content" v-html="getHtmlContent(record.reportContent)"></div>
+                  </el-descriptions-item>
+                  <el-descriptions-item label="鎶ュ鏉愭枡">
+                    <el-link
+                      v-for="item in record.reportMaterials != null ? record.reportMaterials.split(',') : record.reportMaterials"
+                      :underline="false" type="primary" :key="item" @click="handleDownload(item)">
+                      {{ item.substring(item.lastIndexOf("/") + 1) }}
+                    </el-link>
+                  </el-descriptions-item>
+                </el-descriptions>
+              </el-card>
+            </el-timeline-item>
+          </el-timeline>
+        </div>
+        <div v-else>
+          <el-empty description="鏃犲鏍歌褰�"></el-empty>
+        </div>
+
+        <el-button type="primary" @click="recordOpen = false">鍏抽棴</el-button>
+      </div>
+    </el-dialog>
 
     <!-- 瀹℃牳鎶ュ -->
-    <el-dialog title="鎶ュ瀹℃牳" :visible.sync="auditingOpen" width="500px" append-to-body>
-      <el-form ref="form" :model="auditingForm" :rules="auditingRules" label-width="80px">
-        <el-form-item label="鐐逛綅">
-          <el-input v-model="auditingForm.pointName" disabled />
-        </el-form-item>
-        <el-form-item label="杩愮淮鍗曚綅">
-          <el-input v-model="auditingForm.unitName" disabled />
-        </el-form-item>
-        <el-form-item label="鎶ュ浜哄憳">
-          <el-input v-model="auditingForm.peopleName" disabled />
-        </el-form-item>
-        <el-form-item label="鎶ュ绫诲瀷">
-          <el-input v-model="auditingForm.reportType" disabled />
-        </el-form-item>
-        <el-form-item label="鏁呴殰绫诲瀷">
-          <el-input v-model="auditingForm.errorType" disabled />
-        </el-form-item>
-        <el-form-item label="鐢熸晥鏃堕棿">
-          <el-date-picker v-model="auditingForm.beginCreateTime" disabled />
-        </el-form-item>
-        <el-form-item label="澶辨晥鏃堕棿">
-          <el-date-picker v-model="auditingForm.endCreateTime" disabled />
-        </el-form-item>
-        <el-form-item label="鎶ュ鍐呭">
-          <el-input type="textarea" v-html="auditingForm.reportContent" disabled />
-        </el-form-item>
-        <el-form-item label="涓婃姤鏉愭枡">
-          <el-link v-for="item in auditingForm.reportMaterials != null ? auditingForm.reportMaterials.split(',') : auditingForm.reportMaterials" :underline="false" :key="item" @click="handleDownload(item)">{{ item.substring(item.lastIndexOf("/") + 1) }}</el-link>
-        </el-form-item>
-        <el-form-item label="瀹℃牳缁撴灉">
-          <el-radio-group v-model="auditingForm.status">
-            <el-radio :label="1">閫氳繃</el-radio>
-            <el-radio :label="2">椹冲洖</el-radio>
-          </el-radio-group>
-        </el-form-item>
-        <el-form-item label="瀹℃牳鎰忚" prop="suggest">
-          <el-input v-model="auditingForm.auditOpinion"/>
-        </el-form-item>
-      </el-form>
+    <el-dialog title="鎶ュ瀹℃牳" :visible.sync="auditingOpen" :close-on-click-modal="false" width="1100px" append-to-body>
+      <div style="display: flex;flex-direction: row">
+        <div style="flex: 6; border-right: 1px solid #d2d1d1; padding-right: 20px">
+          <el-form ref="form" :model="auditingForm" :rules="auditingRules" label-width="80px">
+          <el-form-item label="鐐逛綅">
+            <el-input v-model="auditingForm.pointName" disabled />
+          </el-form-item>
+          <el-form-item label="杩愮淮鍗曚綅">
+            <el-input v-model="auditingForm.unitName" disabled />
+          </el-form-item>
+          <el-form-item label="鎶ュ浜哄憳">
+            <el-input v-model="auditingForm.peopleName" disabled />
+          </el-form-item>
+          <el-form-item label="鎶ュ绫诲瀷">
+            <el-input v-model="auditingForm.reportType" disabled />
+          </el-form-item>
+          <el-form-item label="鏁呴殰绫诲瀷">
+            <el-input v-model="auditingForm.errorType" disabled />
+          </el-form-item>
+          <el-form-item label="鐢熸晥鏃堕棿">
+            <el-date-picker v-model="auditingForm.beginCreateTime" format="yyyy-MM-dd HH:mm:ss" disabled />
+          </el-form-item>
+          <el-form-item label="澶辨晥鏃堕棿">
+            <el-date-picker v-model="auditingForm.endCreateTime" format="yyyy-MM-dd HH:mm:ss" disabled />
+          </el-form-item>
+          <el-form-item label="瀹℃牳缁撴灉">
+            <el-radio-group v-model="auditingForm.auditingResult">
+              <el-radio :label="true">閫氳繃</el-radio>
+              <el-radio :label="false">椹冲洖</el-radio>
+            </el-radio-group>
+          </el-form-item>
+          <el-form-item label="瀹℃牳鎰忚" prop="auditOpinion">
+            <el-input v-model="auditingForm.auditOpinion" />
+          </el-form-item>
+        </el-form>
+        </div>
+        <div style="flex: 5; border-right: 1px solid #d2d1d1; padding-right: 20px; padding-left: 20px">
+          <div>鍚屼竴鎵规鍙风殑鎶ュ</div>
+          <div style="margin-top: 20px">
+            <el-checkbox-group v-if="togetherList && togetherList.length > 0" v-model="selectedTo">
+              <el-checkbox v-for="item in togetherList" :label="item.id">{{item.pointName}}</el-checkbox>
+            </el-checkbox-group>
+            <span v-else>鏃�</span>
+          </div>
+        </div>
+        <div style="flex: 5; padding-left: 20px">
+          <el-form>
+            <el-form-item label="鎶ュ鍐呭">
+              <span v-html="auditingForm.reportContent"></span>
+            </el-form-item>
+            <el-form-item label="鎶ュ鏉愭枡">
+              <el-link
+                v-for="item in auditingForm.reportMaterials != null ? auditingForm.reportMaterials.split(',') : auditingForm.reportMaterials"
+                :underline="false" type="primary" :key="item" @click="handleDownload(item)">{{ item.substring(item.lastIndexOf("/") + 1)
+                }}</el-link>
+            </el-form-item>
+          </el-form>
+        </div>
+      </div>
+
       <div slot="footer" class="dialog-footer">
-        <el-button type="primary" @click="auditingSubmit">纭� 瀹�</el-button>
         <el-button @click="auditingCancel">鍙� 娑�</el-button>
+        <el-button type="primary" @click="auditingSubmit">瀹� 鏍�</el-button>
       </div>
     </el-dialog>
 
@@ -248,13 +271,23 @@
 </template>
 
 <script>
-import { listReport, getReport, delReport, addReport, updateReport } from "@/api/platform/report";
+import { listReport, getReport, delReport, addReport, updateReport, auditing, audit, importReport, getTogether } from "@/api/platform/report";
 import { pointSelectData } from "@/api/platform/point";
 
 export default {
+  dicts: ['report_error_type'],
   name: "Report",
   data() {
     return {
+      // 閫変腑鐨勫悓涓�鎵规鍙锋姤澶�
+      selectedTo: [],
+      // 鍚屼竴鎵规鍙风殑鎶ュ
+      togetherList: [],
+      fileList: [],
+      url: process.env.VUE_APP_BASE_API + '/report/import',
+      addOrImport: 'add',
+      fileType: ["doc", "xls", "xlsx", "ppt", "txt", "pdf", "png", "jpg"],
+      auditingRecordList: [],
       // 鐐逛綅list
       pointList: [],
       // 閬僵灞�
@@ -277,35 +310,33 @@
       title: "",
       // 鏄惁鏄剧ず寮瑰嚭灞�
       open: false,
-      // 鏁呴殰绫诲瀷鏃堕棿鑼冨洿
-      daterangeCreateTime: [],
+      recordOpen: false,
       expirTime: [],
-      // 鏁呴殰绫诲瀷鏃堕棿鑼冨洿
-      daterangeAuditingTime: [],
       auditingOpen: false,
       auditingForm: {
         id: null,
         unitName: "",
         pointName: "",
         peopleName: "",
-        errorType: "",
+        errorTypeList: [],
         reportContent: "",
         auditing: "",
-        suggest: "",
+        auditOpinion: "",
         reportType: "",
         beginCreateTime: null,
-        endCreateTime: null
+        endCreateTime: null,
+        auditingResult: false,
+        daterangeCreateTime: []
       },
       // 鏌ヨ鍙傛暟
       queryParams: {
         pageNum: 1,
         pageSize: 10,
-        unitId: null,
-        peopleId: null,
-        pointId: null,
-        createTime: null,
-        auditingTime: null,
-        errorType: null
+        keyword: null,
+        errorType: null,
+        status: '',
+        reportType: null,
+        errorTypeList: []
       },
       // 琛ㄥ崟鍙傛暟
       form: {},
@@ -323,16 +354,17 @@
           { required: true, message: "鎶ュ鍐呭涓嶈兘涓虹┖", trigger: "blur" }
         ],
         reportMaterials: [
-          { required: true, message: "涓婃姤鏉愭枡涓嶈兘涓虹┖", trigger: "blur" }
+          { required: true, message: "鎶ュ鏉愭枡涓嶈兘涓虹┖", trigger: "blur" }
         ],
         reportType: [
           { required: true, message: "璇烽�夋嫨鎶ュ绫诲瀷", trigger: "blur" }
         ],
-        errorType: [
+        errorTypeList: [
           { required: true, message: "璇烽�夋嫨鏁呴殰绫诲瀷", trigger: "blur" }
         ],
-        expirTime: [
-          { required: true, message: "璇烽�夋嫨鏈夋晥鏃堕棿", trigger: "blur" }
+        // 鎶ュ鏃堕棿鑼冨洿
+        daterangeCreateTime: [
+          { required: true, message: "璇烽�夋嫨鎶ュ鏃堕棿", trigger: "blur" }
         ],
       }
     };
@@ -341,22 +373,57 @@
     this.getList();
   },
   methods: {
+    getHtmlContent(content) {
+      if (content) {
+        return content
+      } else {
+        return "鏃�"
+      }
+    },
+    formatStatus(item) {
+      if (item.result === 0) {
+        return '瀹℃牳涓�'
+      } else if (item.status === 1) {
+        return '閫氳繃'
+      } else if (item.status === 2) {
+        return '鏈�氳繃'
+      }
+    },
     auditingCancel() {
       this.auditingOpen = false
     },
+    // 鑾峰彇瀹℃牳璁板綍
+    handleAuditingRecord(reportId) {
+      auditing(reportId).then(res => {
+        this.auditingRecordList = res.data;
+        this.recordOpen = true
+      })
+    },
     handleAuditing(row) {
+      if (row.importBatchNumber) {
+        getTogether(row.importBatchNumber).then(res => {
+          this.togetherList = res.data;
+          if (this.togetherList && this.togetherList.length > 0) {
+            this.togetherList = this.togetherList.filter(item => item.id != row.id)
+            this.selectedTo = this.togetherList.map(item => item.id)
+          }
+        })
+      }
       this.auditingOpen = true;
-      this.auditingForm.id =row.id
-      this.auditingForm.pointId =row.pointId
-      this.auditingForm.pointName =row.pointName
-      this.auditingForm.unitName =row.unitName
-      this.auditingForm.peopleName =row.peopleName
-      this.auditingForm.errorType =row.errorType
-      this.auditingForm.reportContent =row.reportContent
-      this.auditingForm.reportType =row.reportType
-      this.auditingForm.endCreateTime =row.endCreateTime
-      this.auditingForm.beginCreateTime =row.beginCreateTime
-      this.auditingForm.reportMaterials =row.reportMaterials
+      this.auditingForm.id = row.id
+      this.auditingForm.pointId = row.pointId
+      this.auditingForm.pointName = row.pointName
+      this.auditingForm.unitName = row.unitName
+      this.auditingForm.peopleName = row.peopleName
+      this.auditingForm.errorType = row.errorType
+      this.auditingForm.reportContent = row.reportContent
+      this.auditingForm.reportType = row.reportType
+      this.auditingForm.endCreateTime = row.endCreateTime
+      this.auditingForm.beginCreateTime = row.beginCreateTime
+      this.auditingForm.reportMaterials = row.reportMaterials
+    },
+    pointChange(value) {
+      // this.remoteGetPoints(value)
     },
     // 杩滅▼鎼滅储鐐逛綅
     remoteGetPoints(query) {
@@ -376,16 +443,15 @@
     /** 鏌ヨ鎶ュ鍒楄〃 */
     getList() {
       this.loading = true;
-      if (null != this.daterangeCreateTime && '' != this.daterangeCreateTime) {
-        this.queryParams["beginCreateTime"] = this.daterangeCreateTime[0];
-        this.queryParams["endCreateTime"] = this.daterangeCreateTime[1];
-      }
-      if (null != this.daterangeAuditingTime && '' != this.daterangeAuditingTime) {
-        this.queryParams["beginAuditingTime"] = this.daterangeAuditingTime[0];
-        this.queryParams["endAuditingTime"] = this.daterangeAuditingTime[1];
-      }
+      // if (this.form.daterangeCreateTime && this.form.daterangeCreateTime.length > 0) {
+      //   this.queryParams["beginCreateTime"] = this.form.daterangeCreateTime[0];
+      //   this.queryParams["endCreateTime"] = this.form.daterangeCreateTime[1];
+      // } else {
+      //   this.queryParams["beginCreateTime"] = null;
+      //   this.queryParams["endCreateTime"] = null;
+      // }
       listReport(this.queryParams).then(response => {
-        this.reportList = response.data;
+        this.reportList = response.data.records;
         this.total = response.total;
         this.loading = false;
       });
@@ -398,6 +464,7 @@
     // 琛ㄥ崟閲嶇疆
     reset() {
       this.form = {
+        daterangeCreateTime: [],
         id: null,
         unitId: null,
         peopleId: null,
@@ -408,9 +475,9 @@
         reportContent: null,
         reportMaterials: null,
         deleted: null,
-        errorType: null
+        errorTypeList: [],
       };
-      this.resetForm("form");
+      // this.resetForm("form");
     },
     /** 鎼滅储鎸夐挳鎿嶄綔 */
     handleQuery() {
@@ -419,7 +486,6 @@
     },
     /** 閲嶇疆鎸夐挳鎿嶄綔 */
     resetQuery() {
-      this.daterangeCreateTime = [];
       this.daterangeAuditingTime = [];
       this.queryParams["beginCreateTime"] = null;
       this.queryParams["endCreateTime"] = null;
@@ -429,14 +495,26 @@
     // 澶氶�夋閫変腑鏁版嵁
     handleSelectionChange(selection) {
       this.ids = selection.map(item => item.id)
-      this.single = selection.length!==1
+      this.single = selection.length !== 1
       this.multiple = !selection.length
     },
     /** 鏂板鎸夐挳鎿嶄綔 */
     handleAdd() {
       this.reset();
+      this.addOrImport = 'add';
       this.open = true;
-      this.title = "娣诲姞鎶ュ";
+      this.title = "灏戦噺鎶ュ";
+    },
+    /** 瀵煎叆鎸夐挳鎿嶄綔 */
+    handleImport() {
+      this.reset();
+      this.addOrImport = 'import';
+      this.open = true;
+      this.title = "鎵归噺鎶ュ";
+    },
+    beforeUpload(file) {
+      this.fileList = [file];
+      return false;
     },
     /** 淇敼鎸夐挳鎿嶄綔 */
     handleUpdate(row) {
@@ -444,6 +522,9 @@
       const id = row.id || this.ids
       getReport(id).then(response => {
         this.form = response.data;
+        this.form.daterangeCreateTime = [this.form.beginCreateTime, this.form.endCreateTime]
+        this.remoteGetPoints(this.form.pointId)
+        this.addOrImport = 'add';
         this.open = true;
         this.title = "淇敼鎶ュ";
       });
@@ -451,50 +532,81 @@
     /** 瀹℃牳鎸夐挳鎿嶄綔 */
     auditingSubmit() {
       this.auditingForm.auditingTime = new Date();
-      updateReport(this.auditingForm).then(response => {
+      this.auditingForm.togetherList = this.selectedTo
+      audit(this.auditingForm).then(response => {
         this.$modal.msgSuccess("瀹℃牳鎴愬姛");
         this.auditingOpen = false
         this.getList();
-        this.auditingForm = {}
+        this.auditingForm = {
+          id: null,
+          unitName: "",
+          pointName: "",
+          peopleName: "",
+          errorTypeList: [],
+          reportContent: "",
+          auditing: "",
+          auditOpinion: "",
+          reportType: "",
+          beginCreateTime: null,
+          endCreateTime: null,
+          auditingResult: false,
+          daterangeCreateTime: []
+        }
       });
     },
     /** 鎻愪氦鎸夐挳 */
     submitForm() {
-
-      if (null != this.expirTime && '' != this.expirTime) {
-        this.form["beginCreateTime"] = this.expirTime[0];
-        this.form["endCreateTime"] = this.expirTime[1];
-      }
-
-      // todo 鍒ゆ柇鏄簨鍓嶆姤澶�
-
+      this.form.pointId = this.form.pointId ? this.form.pointId : this.form.serialNumber;
       this.$refs["form"].validate(valid => {
         if (valid) {
-          if (this.form.id != null) {
-            updateReport(this.form).then(response => {
-              this.$modal.msgSuccess("淇敼鎴愬姛");
-              this.open = false;
-              this.getList();
-            });
-          } else {
-            addReport(this.form).then(response => {
+          this.form.beginCreateTime = this.form.daterangeCreateTime[0]
+          this.form.endCreateTime = this.form.daterangeCreateTime[1]
+          if (this.addOrImport === 'import') {
+            let formData = new FormData();
+            formData.append("importPointId", this.fileList[0]);
+            formData.append("pointId", this.form.importPointId);
+            formData.append("reportType", this.form.reportType);
+            formData.append("errorTypeList", this.form.errorTypeList);
+            formData.append("reportContent", this.form.reportContent);
+            formData.append("reportMaterials", this.form.reportMaterials);
+            formData.append("beginCreateTimeStr", this.form.daterangeCreateTime[0]);
+            formData.append("endCreateTimeStr", this.form.daterangeCreateTime[1]);
+            importReport(formData).then(() => {
               this.$modal.msgSuccess("鎴愬姛鎻愪氦鎶ュ");
               this.open = false;
               this.getList();
             });
+          } else {
+            if (this.form.id != null) {
+              updateReport(this.form).then(() => {
+                this.$modal.msgSuccess("淇敼鎴愬姛");
+                this.open = false;
+                this.getList();
+              });
+            } else {
+              addReport(this.form).then(() => {
+                this.$modal.msgSuccess("鎴愬姛鎻愪氦鎶ュ");
+                this.open = false;
+                this.getList();
+              });
+            }
           }
         }
       });
     },
+    /** 涓嬭浇妯℃澘鎿嶄綔 */
+    importTemplate() {
+      this.download("report/importTemplate", {}, `鎶ュ-鐐逛綅瀵煎叆妯℃澘.xlsx`);
+    },
     /** 鍒犻櫎鎸夐挳鎿嶄綔 */
     handleDelete(row) {
       const ids = row.id || this.ids;
-      this.$modal.confirm('鏄惁纭鍒犻櫎鎶ュ缂栧彿涓�"' + ids + '"鐨勬暟鎹」锛�').then(function() {
+      this.$modal.confirm('鏄惁纭鍒犻櫎鎶ュ缂栧彿涓�"' + ids + '"鐨勬暟鎹」锛�').then(function () {
         return delReport(ids);
       }).then(() => {
         this.getList();
         this.$modal.msgSuccess("鍒犻櫎鎴愬姛");
-      }).catch(() => {});
+      }).catch(() => { });
     },
     /** 瀵煎嚭鎸夐挳鎿嶄綔 */
     handleExport() {
@@ -503,9 +615,80 @@
       }, `report_${new Date().getTime()}.xlsx`)
     },
     /** 涓嬭浇鎸夐挳鎿嶄綔 */
-    handleDownload (data) {
+    handleDownload(data) {
       this.$download.resource(data);
+    },
+
+    formatFileList(data) {
+      if (!data) return [];
+      return data.split(',').map(item => process.env.VUE_APP_BASE_API + item);
+    },
+    showFile(filePath) {
+      console.log(process.env.VUE_APP_BASE_API + filePath);
     }
   }
 };
 </script>
+
+<style lang="scss" scoped>
+.content {
+  height: 100px;
+  max-height: 300px;
+  overflow-y: auto;
+}
+
+.info-container {
+  width: 100%;
+  max-height: 400px;
+  overflow-y: scroll;
+}
+
+.info-item {
+  display: flex;
+  margin-bottom: 20px;
+
+  .info-label {
+    font-size: 14px;
+    font-weight: bold;
+    margin-right: 20px;
+  }
+
+  .info-text {
+    width: 30%;
+    padding: 20px;
+    border-radius: 10px;
+    border: 1px solid #c0c0c0;
+  }
+
+  .info-list {
+    width: 30%;
+
+    .list-item {
+      width: 100%;
+      border-radius: 5px;
+      border: 1px solid #c0c0c0;
+      padding: 10px 10px;
+      display: flex;
+      align-items: center;
+      margin-bottom: 10px;
+      cursor: pointer;
+
+      .item-icon {
+        flex-shrink: 0;
+        margin-right: 5px;
+      }
+
+      .item-text {
+        flex-grow: 1;
+        white-space: nowrap;
+        overflow: hidden;
+        text-overflow: ellipsis;
+      }
+
+      &:hover {
+        border-color: #1890ff;
+      }
+    }
+  }
+}
+</style>

--
Gitblit v1.8.0