From 9eb85404a96658d83fc0168f306adabb8c1c992e Mon Sep 17 00:00:00 2001
From: quanyawei <401863037@qq.com>
Date: Tue, 14 Nov 2023 10:31:03 +0800
Subject: [PATCH] Merge branch 'feature_1.0'

---
 src/views/toCarryOutLegislativeReforms/reform/index.vue |  416 ++++++++++++++++++++++++++++++++++++----------------------
 1 files changed, 257 insertions(+), 159 deletions(-)

diff --git a/src/views/toCarryOutLegislativeReforms/reform/index.vue b/src/views/toCarryOutLegislativeReforms/reform/index.vue
index 5af2319..b443b7e 100644
--- a/src/views/toCarryOutLegislativeReforms/reform/index.vue
+++ b/src/views/toCarryOutLegislativeReforms/reform/index.vue
@@ -1,136 +1,76 @@
 <template>
   <div class="main">
     <div>
-      <searchBar v-if="searchType" :search-type="'reform'" @handleSearch="handleSearch" @handleAdd="handleOpenDialog(null,'add')" />
-      <newWorkOrder
-        v-if="centerDialogVisible"
-        ref="newWorkOrder"
-        :parent-form-data="parentFormData"
-        :title="title"
-        :page-state="pageState"
-        :visible.sync="centerDialogVisible"
-        @handleSubmit="newHandleSubmit"
-      />
+      <searchBar v-if="searchType" :search-type="'reform'" @handleSearch="handleSearchBut" @handleAdd="handleOpenDialog(null, 'add')" />
+      <newWorkOrder v-if="centerDialogVisible" ref="newWorkOrder" :parent-form-data="parentFormData" :title="title" :page-state="pageState" :visible.sync="centerDialogVisible" @handleSubmit="newHandleSubmit" />
       <div class="tab">
-        <el-table
-          size="mini"
-          :data="tableData"
-          border
-          max-height="680"
-          style="width: 100%"
-          :header-cell-style="{
-            color: '#101111', fontSize: '16px'
-          }"
-        >
-          <el-table-column
-            type="index"
-            label="������"
-            width="60px"
-            align="center"
-          />
-          <el-table-column
-            align="center"
-          >
+        <el-table size="mini" :data="tableData" border max-height="680" style="width: 100%" :header-cell-style="{
+            color: '#101111',
+            fontSize: '16px'
+          }">
+          <el-table-column type="index" label="������" width="60px" align="center" />
+          <el-table-column align="center">
             <template slot="header">
               <div>������</div>
               <div>������������</div>
             </template>
             <template slot-scope="scope">
-              <div> {{ scope.row.allocationNum }}</div>
-              <div> {{ scope.row.escalationTime }}</div>
-
+              <div>{{ scope.row.allocationNum }}</div>
+              <div>{{ scope.row.escalationTime }}</div>
             </template>
           </el-table-column>
-          <el-table-column
-            align="center"
-            prop="unitId"
-            label="������������"
-            :formatter="unitIdFormatter"
-          />
-          <el-table-column
-            align="center"
-            prop="polluteType"
-            label="������������"
-            width="120px"
-            :formatter="polluteTypeFormatter"
-          />
-          <el-table-column
-            align="center"
-          >
+          <el-table-column align="center" prop="unitId" label="������������" :formatter="unitIdFormatter" />
+          <el-table-column align="center" prop="polluteType" label="������������" width="120px" :formatter="polluteTypeFormatter" />
+          <el-table-column align="center">
             <template slot="header">
               <div>������������</div>
               <div>������������</div>
             </template>
             <template slot-scope="scope">
-              <div>  {{ dictObj.changeEnum[scope.row.changeType] }}</div>
-              <div v-show="scope.row.changeType && scope.row.changeType===2" :class="[Number(scope.row.residueDay) < 0 ? errorClass : '']">
+              <div>{{ dictObj.changeEnum[scope.row.changeType] }}</div>
+              <div v-show="scope.row.changeType && scope.row.changeType === 2" :class="[Number(scope.row.residueDay) < 0 ? errorClass : '']">
                 <span v-if="Number(scope.row.residueDay) < 0">
                   ������ {{ Math.abs(scope.row.residueDay) }}���
                 </span>
-                <span v-else>
-                  {{ scope.row.residueDay }}���
-                </span>
-
+                <span v-else> {{ scope.row.residueDay }}��� </span>
               </div>
             </template>
           </el-table-column>
-          <el-table-column
-            align="center"
-            prop="investigationType"
-            label="������������"
-            width="100px"
-            :formatter="investigationTypeFormatter"
-          />
-          <el-table-column
-            align="center"
-            prop="state"
-            width="100px"
-            label="������������"
-          >
+          <el-table-column align="center" prop="investigationType" label="������������" width="100px" :formatter="investigationTypeFormatter" />
+          <el-table-column align="center" prop="state" width="100px" label="������������">
             <template slot-scope="scope">
-              <el-tag v-if="scope.row.state===40" type="success">
+              <el-tag v-if="scope.row.state === 40" type="success">
                 {{ stateFormatter(scope.row) }}
               </el-tag>
-              <el-tag v-if="scope.row.state===50" type="danger">
+              <el-tag v-if="scope.row.state === 50" type="danger">
                 {{ stateFormatter(scope.row) }}
               </el-tag>
-              <el-tag v-if="scope.row.state===9" type="info">
+              <el-tag v-if="scope.row.state === 9" type="info">
                 {{ stateFormatter(scope.row) }}
               </el-tag>
-              <el-tag v-if="scope.row.state===20" type="warning">
+              <el-tag v-if="scope.row.state === 20" type="warning">
                 {{ stateFormatter(scope.row) }}
               </el-tag>
-              <el-tag v-if="scope.row.state===10" type="warning">
+              <el-tag v-if="scope.row.state === 10" type="warning">
                 {{ stateFormatter(scope.row) }}
               </el-tag>
-              <el-tag v-if="scope.row.state===30" type="warning">
+              <el-tag v-if="scope.row.state === 30" type="warning">
                 {{ stateFormatter(scope.row) }}
               </el-tag>
             </template>
           </el-table-column>
-          <el-table-column
-            align="center"
-            prop="isInvalid"
-            label="������������"
-            width="60px"
-            :formatter="isInvalidFormatter"
-          />
-          <el-table-column
-            align="center"
-          >
+          <el-table-column align="center" prop="isInvalid" label="������������" width="60px" :formatter="isInvalidFormatter" />
+          <el-table-column align="center">
             <template slot="header">
               <div>������������</div>
               <div>���������</div>
             </template>
             <template slot-scope="scope">
-              <div> {{ scope.row.escalationName }}</div>
-              <div> {{ updatUnitIdFormatter(scope.row) }}</div>
-
+              <div>{{ scope.row.escalationName }}</div>
+              <div>{{ updatUnitIdFormatter(scope.row) }}</div>
             </template>
           </el-table-column>
-          <el-table-column
-            align="center"
-          >
+          <el-table-column align="center">
             <template slot="header">
               <div>���������</div>
               <div>������������</div>
@@ -140,59 +80,105 @@
               <div>{{ scope.row.updateTime }}</div>
             </template>
           </el-table-column>
-          <el-table-column
-            align="center"
-            prop="createTime"
-            width="100px"
-            label="������"
-          >
+          <el-table-column align="center" prop="createTime" width="100px" label="������">
             <template slot-scope="scope">
-              <el-button type="text" size="medium" @click="openWorkOrdinDialog(scope.row,'detail')">������</el-button>
-              <el-button v-if="scope.row.state===9" type="text" size="medium" @click="handleOpenDialog(scope.row,'edit')">������</el-button>
-              <el-button v-if="scope.row.state>30&&scope.row.isInvalid===0" type="text" size="medium" @click="handleCancel(scope.row)">������</el-button>
-              <el-button v-if="scope.row.state===20" type="text" size="medium" @click="openWorkOrdinDialog(scope.row,'work')">������</el-button>
-              <el-button v-if="scope.row.state===30" type="text" size="medium" @click="openWorkOrdinDialog(scope.row,'approve')">������</el-button>
-              <el-button v-if="scope.row.state===20&&scope.row.changeType===2&&scope.row.applyState===0" type="text" size="medium" @click="openWorkOrdinDialog(scope.row,'delay')">������������</el-button>
+
+              <el-button type="text" size="medium" @click="openWorkOrdinDialog(scope.row, 'detail')">
+                ������
+              </el-button>
+              <el-button type="text" v-if="scope.row.isCode==='1'" size="medium" @click="openEditDialog(scope.row)">
+                ������������
+              </el-button>
+              <el-button v-if="scope.row.state === 9" type="text" size="medium" @click="handleOpenDialog(scope.row, 'edit')">
+                ������
+              </el-button>
+              <el-button v-if="scope.row.state > 30 && scope.row.isInvalid === 0" type="text" size="medium" @click="handleCancel(scope.row)">
+                ������
+              </el-button>
+              <el-button v-if="scope.row.state === 20" type="text" size="medium" @click="openWorkOrdinDialog(scope.row, 'work')">
+                ������
+              </el-button>
+              <el-button v-if="scope.row.state === 30 && scope.row.isApprove === 1" type="text" size="medium" @click="openWorkOrdinDialog(scope.row, 'approve')">
+                ������
+              </el-button>
+              <el-button v-if="
+                  scope.row.state === 20 &&
+                  scope.row.changeType === 2 &&
+                  scope.row.applyState === 0
+                " type="text" size="medium" @click="openWorkOrdinDialog(scope.row, 'delay')">
+                ������������
+              </el-button>
             </template>
           </el-table-column>
         </el-table>
       </div>
       <div class="pagina">
-        <el-pagination
-          background
-          :current-page="pagination.currentPage"
-          :page-sizes="pagination.pageSizes"
-          :page-size="pagination.PageSize"
-          :total="pagination.totalCount"
-          layout="sizes,prev, pager, next, jumper"
-          @size-change="handleSizeChange"
-          @current-change="handleCurrentChange"
-        />
+        <el-pagination background :current-page="pagination.currentPage" :page-sizes="pagination.pageSizes" :page-size="pagination.pageSize" :total="pagination.totalCount" layout="total, sizes, prev, pager, next, jumper" @size-change="handleSizeChange" @current-change="handleCurrentChange" />
       </div>
     </div>
     <workOrderInformation v-if="workOrdinDialogVisible" :dialog-data="dialogData" :visible.sync="workOrdinDialogVisible" @handeleSumit="handeleSumit" />
-    <el-dialog
-      title="������"
-      :visible.sync="dialogVisible"
-      width="600px"
-      :before-close="handleClose"
-      center
-    >
+    <el-dialog title="������" :visible.sync="dialogVisible" width="600px" :before-close="handleClose" center>
       <div>
         <el-form label-width="100px">
-          <el-form-item label="���������������" style="margin-right: 30px;">
-            <el-input
-              v-model="invalidReason"
-              type="textarea"
-              :autosize="{ minRows: 2, maxRows: 10}"
-              placeholder="���������������"
-            />
+          <el-form-item label="���������������" style="margin-right: 30px">
+            <el-input v-model="invalidReason" type="textarea" :autosize="{ minRows: 2, maxRows: 10 }" placeholder="���������������" />
           </el-form-item>
         </el-form>
       </div>
       <span slot="footer" class="dialog-footer">
         <el-button @click="handleClose">��� ���</el-button>
         <el-button type="primary" @click="handleInvalid">��� ���</el-button>
+      </span>
+    </el-dialog>
+    <el-dialog title="������" v-if="dialogEditVisible" :visible.sync="dialogEditVisible" width="800px" top='5vh' :before-close="handleClose" center>
+      <el-descriptions title="������������">
+        <template slot="extra">
+          <div>
+            {{ editEscalationUnitData.allocationNum}}
+          </div>
+        </template>
+        <el-descriptions-item label="������������" label-class-name="itemSpan">{{ editEscalationUnitData.escalationTime }}</el-descriptions-item>
+        <el-descriptions-item label="������������" label-class-name="itemSpan">{{ updataUnitIdFormatter }}</el-descriptions-item>
+        <el-descriptions-item label="������������" label-class-name="itemSpan">{{ polluteTypeeDITFormatter }}</el-descriptions-item>
+        <el-descriptions-item label="������������" label-class-name="itemSpan">{{ dictObj.changeEnum[editEscalationUnitData.changeType] }}</el-descriptions-item>
+        <el-descriptions-item label="������������" label-class-name="itemSpan">{{ editEscalationUnitData.changeDay || 0}} ���</el-descriptions-item>
+        <el-descriptions-item label="������������" label-class-name="itemSpan">{{ updataEscalationUnitIdFormatter }}</el-descriptions-item>
+        <el-descriptions-item label="���������" label-class-name="itemSpan">{{ editEscalationUnitData.escalationName }}</el-descriptions-item>
+        <el-descriptions-item label="������������" label-class-name="itemSpan">{{ editEscalationUnitData.pollutePosition }}</el-descriptions-item>
+      </el-descriptions>
+      <el-divider></el-divider>
+      <div>
+        <p class="editTile">������������</p>
+        <el-form :inline="true" class="demo-form-inline">
+          <el-form-item label="������������:">
+            <el-select v-model="formInEdit.unitId" size="small" clearable placeholder="���������">
+              <el-option v-for="item in unitList" :key="item.unitId" :label="item.unitName" :value="item.unitId" />
+            </el-select>
+          </el-form-item>
+          <el-form-item label="������������:">
+            <el-select v-model="formInEdit.polluteType" size="small" clearable placeholder="���������">
+              <el-option v-for="item in polluteList" :key="item.dataKey" :label="item.dataValue" :value="item.dataKey" />
+            </el-select>
+          </el-form-item>
+        </el-form>
+      </div>
+      <el-collapse>
+        <el-collapse-item title="������������" name="1">
+          <div class="block">
+            <el-timeline>
+              <el-timeline-item v-for="(activity, index) in operatingLog" :key="index" :color="'#0bbd87'" :timestamp="activity.createTime">
+                <div v-if="activity.content"> ���������: {{activity.userName}}</div>
+                <div v-if="activity.content"> ������������: {{activity.content}}</div>
+                <div v-if="activity.polluteType"> ������������: {{activity.polluteType}}</div>
+              </el-timeline-item>
+            </el-timeline>
+          </div>
+        </el-collapse-item>
+      </el-collapse>
+
+      <span slot="footer" class="dialog-footer">
+        <el-button @click="handleClose">��� ���</el-button>
+        <el-button type="primary" @click="handleEditChange">��� ���</el-button>
       </span>
     </el-dialog>
   </div>
@@ -222,8 +208,7 @@
         pageSize: 10
       },
       formData: {},
-      tableData: [
-      ],
+      tableData: [],
       dialogData: {
         title: '������',
         parentFormData: {},
@@ -233,6 +218,7 @@
       workOrdinDialogVisible: false,
       centerDialogVisible: false,
       dialogVisible: false,
+      dialogEditVisible: false,
       unitList: [],
       polluteList: [],
       Dic: JSON.parse(localStorage.getItem('dict')),
@@ -244,22 +230,106 @@
       title: '',
       searchData: {
         isInvalid: 0
-      }
+      },
+      editEscalationUnitData: {},
+      formInEdit: {
+        polluteType: '',
+        unitId: ''
+      },
+      operatingLog: []
     }
   },
-
+  computed: {
+    updataEscalationUnitIdFormatter: function () {
+      const data = this.unitList.find(
+        item =>
+          item && item.unitId === this.editEscalationUnitData.escalationUnitId
+      )
+      return data ? data.unitName : ''
+    },
+    updataUnitIdFormatter: function () {
+      const data = this.unitList.find(
+        item => item && item.unitId === this.editEscalationUnitData.unitId
+      )
+      return data ? data.unitName : ''
+    },
+    polluteTypeeDITFormatter: function () {
+      const data = this.polluteList.find(
+        item =>
+          item &&
+          parseInt(item.dataKey) === this.editEscalationUnitData.polluteType
+      )
+      return data ? data.dataValue : ''
+    }
+  },
   created() {
     this.handleSearch()
     this.getUnitList()
     this.getContaminateList()
   },
   methods: {
+    openEditDialog(row) {
+      this.editEscalationUnitData = row
+      this.dialogEditVisible = true
+      this.$request({
+        url: '/allocation/getLog',
+        method: 'get',
+        params: {
+          allocationNum: this.editEscalationUnitData.allocationNum
+        }
+      })
+        .then(res => {
+          this.operatingLog = res.data
+        })
+        .catch(err => {
+          this.$message.error(res.message)
+          console.log('������Region������')
+          console.log(err)
+        })
+    },
     handleCancel(row) {
       this.dialogVisible = true
       this.slectRow = row
     },
     handleClose() {
       this.dialogVisible = false
+      this.dialogEditVisible = false
+    },
+    handleEditChange() {
+      if (this.formInEdit.polluteType === '' && this.formInEdit.unitId === '') {
+        this.$message({
+          message: '���������������������',
+          type: 'error'
+        })
+        return
+      }
+      this.$request({
+        url: '/allocation/updataUnit',
+        method: 'get',
+        params: {
+          id: this.editEscalationUnitData.allocationId,
+          ...this.formInEdit
+        }
+      })
+        .then(res => {
+          if (res.code === 0) {
+            this.$message({
+              message: '������������',
+              type: 'success'
+            })
+            this.dialogEditVisible = false
+            this.formInEdit = {
+              polluteType: '',
+              unitId: ''
+            }
+            this.handleSearch()
+          }
+        })
+        .catch(err => {
+          this.$message.error(res.message)
+          console.log('������Region������')
+          console.log(err)
+        })
     },
     handleInvalid() {
       this.$request({
@@ -269,7 +339,7 @@
           id: this.slectRow.allocationId,
           invalidReason: this.invalidReason
         }
-      }).then((res) => {
+      }).then(res => {
         if (res.code === 0) {
           this.$message({
             message: '������������',
@@ -296,7 +366,7 @@
           params: {
             id: row.allocationId
           }
-        }).then((res) => {
+        }).then(res => {
           this.parentFormData = res.data
           console.log(this.parentFormData)
           this.centerDialogVisible = true
@@ -304,22 +374,27 @@
       }
     },
     updatUnitIdFormatter(val) {
-      const data = this.unitList.find(item => item && item.unitId === val.escalationUnitId)
+      const data = this.unitList.find(
+        item => item && item.unitId === val.escalationUnitId
+      )
       return data ? data.unitName : ''
     },
     unitIdFormatter(val) {
-      const data = this.unitList.find(item => item && item.unitId === val.unitId)
+      const data = this.unitList.find(
+        item => item && item.unitId === val.unitId
+      )
       return data ? data.unitName : ''
     },
     polluteTypeFormatter(val) {
-      const data = this.polluteList.find(item => item && parseInt(item.dataKey) === val.polluteType)
+      const data = this.polluteList.find(
+        item => item && parseInt(item.dataKey) === val.polluteType
+      )
       return data ? data.dataValue : ''
     },
     investigationTypeFormatter(val) {
       return this.dictObj.investigationEnum[val.investigationType]
     },
     stateFormatter(val) {
-      console.log('valval', val)
       return this.dictObj.allocationApproveEnum[val.state]
     },
     isInvalidFormatter(val) {
@@ -330,7 +405,7 @@
       this.$request({
         url: '/allocation/unit',
         method: 'get'
-      }).then((res) => {
+      }).then(res => {
         if (res.code === 0) {
           this.unitList = res.data
         } else {
@@ -342,7 +417,7 @@
       this.$request({
         url: '/allocation/contaminate',
         method: 'get'
-      }).then((res) => {
+      }).then(res => {
         if (res.code === 0) {
           this.polluteList = res.data
         } else {
@@ -368,7 +443,7 @@
         data: {
           ...obj
         }
-      }).then((res) => {
+      }).then(res => {
         if (res.code === 0) {
           this.centerDialogVisible = false
 
@@ -377,6 +452,18 @@
           this.$message.error(res.message)
         }
       })
+    },
+    handleSearchBut(obj) {
+      this.pagination = {
+        currentPage: 1,
+        // ������������������������������������������(���������������������������)
+        totalCount: 0,
+        // ������������������������������
+        pageSizes: [10, 20, 30, 40],
+        // ������������������������������������������
+        pageSize: 10
+      }
+      this.handleSearch(obj)
     },
     handleSearch(obj) {
       this.searchData.isInvalid = 0
@@ -388,9 +475,9 @@
         method: 'post',
         data: {
           ...this.searchData,
-          'page': this.pagination
+          page: this.pagination
         }
-      }).then((res) => {
+      }).then(res => {
         if (res.code === 0) {
           this.tableData = res.data.list
           this.pagination.totalCount = res.data.page.totalNum
@@ -403,7 +490,8 @@
     // ���������������������
     handleSizeChange(val) {
       // ���������������������������
-      this.pagination.PageSize = val
+      console.log('345')
+      this.pagination.pageSize = val
       // ���������������������������������������������������������������������������
       this.pagination.currentPage = 1
       this.handleSearch()
@@ -411,6 +499,7 @@
     // ���������������
     handleCurrentChange(val) {
       // ���������������������
+      console.log('123')
       this.pagination.currentPage = val
       this.handleSearch()
       // console.log(val)
@@ -422,7 +511,7 @@
         params: {
           id: row.allocationId
         }
-      }).then((res) => {
+      }).then(res => {
         this.parentFormData = res.data
         this.workOrdinDialogVisible = true
         if (type === 'work') {
@@ -463,17 +552,17 @@
 </script>
 
 <style scoped lang="scss">
-.main{
-    padding: 20px;
-    padding-top: 0px;
-    height: 100%;
-    overflow: overlay;
+.main {
+  padding: 20px;
+  padding-top: 0px;
+  height: 100%;
+  overflow: overlay;
 }
 .tab {
-    margin-top: 0px;
-   /deep/ .el-tag{
-      font-size: 16px;
-    }
+  margin-top: 0px;
+  /deep/ .el-tag {
+    font-size: 16px;
+  }
 }
 // /deep/ .el-table__body-wrapper {
 //     overflow: scroll;
@@ -481,22 +570,31 @@
 //     overflow-x: hidden;
 //     max-height: 400px;
 // }
-.pagina{
-    margin-top: 10px;
+.pagina {
+  margin-top: 10px;
 }
-/deep/ .el-table__row{
+/deep/ .el-table__row {
   font-size: 18px;
 }
 .el-pagination {
   padding: 0;
-  .el-select{
-    /deep/.el-input{
-      margin:0;
+  .el-select {
+    /deep/.el-input {
+      margin: 0;
     }
   }
-
 }
-.errorClass{
+.errorClass {
   color: red;
 }
+.editTile {
+  color: #303133;
+  font-size: 16px;
+  font-weight: 700;
+}
+/deep/.el-collapse-item__header {
+  color: #303133;
+  font-size: 16px;
+  font-weight: 700;
+}
 </style>

--
Gitblit v1.8.0