소스 검색

-修复了窗口中图片不显示的问题

jiangbiao 2 년 전
부모
커밋
49c79ecf67

+ 37 - 16
master/src/main/java/com/ruoyi/project/production/controller/TFivesChangeRecordController.java

@@ -26,8 +26,7 @@ import java.util.List;
  */
 @RestController
 @RequestMapping("/production/record")
-public class TFivesChangeRecordController extends BaseController
-{
+public class TFivesChangeRecordController extends BaseController {
     @Autowired
     private ITFivesChangeRecordService tFivesChangeRecordService;
     @Autowired
@@ -38,8 +37,7 @@ public class TFivesChangeRecordController extends BaseController
      */
     @PreAuthorize("@ss.hasPermi('production:record:list')")
     @GetMapping("/list")
-    public TableDataInfo list(TFivesChangeRecord tFivesChangeRecord)
-    {
+    public TableDataInfo list(TFivesChangeRecord tFivesChangeRecord) {
         startPage();
         List<TFivesChangeRecord> list = tFivesChangeRecordService.selectTFivesChangeRecordList(tFivesChangeRecord);
         return getDataTable(list);
@@ -51,8 +49,7 @@ public class TFivesChangeRecordController extends BaseController
     @PreAuthorize("@ss.hasPermi('production:record:export')")
     @Log(title = "区域检查整改记录", businessType = BusinessType.EXPORT)
     @GetMapping("/export")
-    public AjaxResult export(TFivesChangeRecord tFivesChangeRecord)
-    {
+    public AjaxResult export(TFivesChangeRecord tFivesChangeRecord) {
         List<TFivesChangeRecord> list = tFivesChangeRecordService.selectTFivesChangeRecordList(tFivesChangeRecord);
         ExcelUtil<TFivesChangeRecord> util = new ExcelUtil<TFivesChangeRecord>(TFivesChangeRecord.class);
         return util.exportExcel(list, "record");
@@ -63,8 +60,7 @@ public class TFivesChangeRecordController extends BaseController
      */
     @PreAuthorize("@ss.hasPermi('production:record:query')")
     @GetMapping(value = "/{id}")
-    public AjaxResult getInfo(@PathVariable("id") Long id)
-    {
+    public AjaxResult getInfo(@PathVariable("id") Long id) {
         return AjaxResult.success(tFivesChangeRecordService.selectTFivesChangeRecordById(id));
     }
 
@@ -74,8 +70,7 @@ public class TFivesChangeRecordController extends BaseController
     @PreAuthorize("@ss.hasPermi('production:record:add')")
     @Log(title = "区域检查整改记录", businessType = BusinessType.INSERT)
     @PostMapping
-    public AjaxResult add(@RequestBody TFivesChangeRecord tFivesChangeRecord)
-    {
+    public AjaxResult add(@RequestBody TFivesChangeRecord tFivesChangeRecord) {
         tFivesChangeRecord.setCreatedate(new Date());
         tFivesChangeRecord.setCreaterCode(String.valueOf(getUserId()));
         tFivesChangeRecord.setCheckerId(String.valueOf(getUserId()));
@@ -89,19 +84,46 @@ public class TFivesChangeRecordController extends BaseController
     @PreAuthorize("@ss.hasPermi('production:record:edit')")
     @Log(title = "区域检查整改记录", businessType = BusinessType.UPDATE)
     @PutMapping
-    public AjaxResult edit(@RequestBody TFivesChangeRecord tFivesChangeRecord)
-    {
-        if (StringUtils.isNotEmpty(tFivesChangeRecord.getchangeFile())) {
+    public AjaxResult edit(@RequestBody TFivesChangeRecord tFivesChangeRecord) {
+        tFivesChangeRecord.setUpdatedate(new Date());
+        tFivesChangeRecord.setUpdaterCode(getUserId().toString());
+        return toAjax(tFivesChangeRecordService.updateTFivesChangeRecord(tFivesChangeRecord));
+    }
+
+    @PreAuthorize("@ss.hasPermi('production:record:edit')")
+    @Log(title = "区域检查整改记录", businessType = BusinessType.UPDATE)
+    @PutMapping("/change")
+    public AjaxResult change(@RequestBody TFivesChangeRecord tFivesChangeRecord) {
+        if (StringUtils.isNotEmpty(tFivesChangeRecord.getChangeFile())) {
             TFivesRecordDetails tFivesRecordDetails = new TFivesRecordDetails();
             tFivesRecordDetails.setRecordId(tFivesChangeRecord.getId());
             tFivesRecordDetails.setChangeContent(tFivesChangeRecord.getChangeContent());
             tFivesRecordDetails.setChangeDate(tFivesChangeRecord.getChangeDate());
             tFivesRecordDetails.setChangeResult(tFivesChangeRecord.getChangeResult());
-            tFivesRecordDetails.setFileId(tFivesChangeRecord.getchangeFile());
+            tFivesRecordDetails.setFileId(tFivesChangeRecord.getChangeFile());
             tFivesRecordDetails.setCreatedate(new Date());
             tFivesRecordDetails.setCreaterCode(getUserId().toString());
             tFivesRecordDetailsService.insertTFivesRecordDetails(tFivesRecordDetails);
+            tFivesChangeRecord.setUpdatedate(new Date());
+            tFivesChangeRecord.setUpdaterCode(getUserId().toString());
+            return toAjax(tFivesChangeRecordService.updateTFivesChangeRecord(tFivesChangeRecord));
+        } else {
+            return AjaxResult.error("请上传整改后的图片!");
         }
+    }
+
+    @PreAuthorize("@ss.hasPermi('production:record:approve')")
+    @Log(title = "区域检查整改记录", businessType = BusinessType.UPDATE)
+    @PutMapping("/approve")
+    public AjaxResult approve(@RequestBody TFivesRecordDetails tFivesRecordDetails) {
+        tFivesRecordDetails.setUpdatedate(new Date());
+        tFivesRecordDetails.setUpdaterCode(getUserId().toString());
+        tFivesRecordDetailsService.updateTFivesRecordDetails(tFivesRecordDetails);
+        TFivesChangeRecord tFivesChangeRecord = new TFivesChangeRecord();
+        tFivesChangeRecord.setChangeResult(tFivesRecordDetails.getChangeResult());
+        tFivesChangeRecord.setId(tFivesRecordDetails.getRecordId());
+        tFivesChangeRecord.setUpdatedate(new Date());
+        tFivesChangeRecord.setUpdaterCode(getUserId().toString());
         return toAjax(tFivesChangeRecordService.updateTFivesChangeRecord(tFivesChangeRecord));
     }
 
@@ -111,8 +133,7 @@ public class TFivesChangeRecordController extends BaseController
     @PreAuthorize("@ss.hasPermi('production:record:remove')")
     @Log(title = "区域检查整改记录", businessType = BusinessType.DELETE)
     @DeleteMapping("/{ids}")
-    public AjaxResult remove(@PathVariable Long[] ids)
-    {
+    public AjaxResult remove(@PathVariable Long[] ids) {
         return toAjax(tFivesChangeRecordService.deleteTFivesChangeRecordByIds(ids));
     }
 }

+ 3 - 3
master/src/main/java/com/ruoyi/project/production/domain/TFivesChangeRecord.java

@@ -212,12 +212,12 @@ public class TFivesChangeRecord extends BaseEntity
     {
         return changeContent;
     }
-    public void setchangeFile(String changeFile)
+    public void setChangeFile(String changeFile)
     {
         this.changeFile = changeFile;
     }
 
-    public String getchangeFile()
+    public String getChangeFile()
     {
         return changeFile;
     }
@@ -308,7 +308,7 @@ public class TFivesChangeRecord extends BaseEntity
             .append("checkFile", getCheckFile())
             .append("changeDate", getChangeDate())
             .append("changeContent", getChangeContent())
-            .append("changeFile", getchangeFile())
+            .append("changeFile", getChangeFile())
             .append("changeResult", getChangeResult())
             .append("delFlag", getDelFlag())
             .append("createrCode", getCreaterCode())

+ 19 - 1
ui/src/api/production/record.js

@@ -35,6 +35,24 @@ export function updateRecord(data) {
   })
 }
 
+// 修改区域检查整改记录
+export function approveRecord(data) {
+  return request({
+    url: '/production/record/approve',
+    method: 'put',
+    data: data
+  })
+}
+
+// 修改区域检查整改记录
+export function changeRecord(data) {
+  return request({
+    url: '/production/record/change',
+    method: 'put',
+    data: data
+  })
+}
+
 // 删除区域检查整改记录
 export function delRecord(id) {
   return request({
@@ -50,4 +68,4 @@ export function exportRecord(query) {
     method: 'get',
     params: query
   })
-}
+}

+ 3 - 0
ui/src/views/production/inspection/index.vue

@@ -307,6 +307,9 @@
             </el-option>
           </el-select>
         </el-form-item>
+        <el-form-item label="备注" prop="remarks">
+          <el-input type="textarea" v-model="form.remarks" placeholder="请输入备注"/>
+        </el-form-item>
       </el-form>
       <div slot="footer" class="dialog-footer">
         <el-button type="primary" @click="submitForm">确 定</el-button>

+ 94 - 29
ui/src/views/production/record/index.vue

@@ -170,14 +170,15 @@
             @click="openDetail(scope.row.id)"
             v-hasPermi="['production:record:edit']"
           >整改记录
-          </el-button><el-button
-          size="mini"
-          type="text"
-          icon="el-icon-edit"
-          @click="handleUpdate(scope.row)"
-          v-hasPermi="['production:inspection:edit']"
-        >修改
-        </el-button>
+          </el-button>
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-edit"
+            @click="handleUpdate(scope.row)"
+            v-hasPermi="['production:inspection:edit']"
+          >修改
+          </el-button>
           <el-button
             size="mini"
             type="text"
@@ -213,7 +214,7 @@
     <el-dialog :title="title" :visible.sync="open" width="600px" append-to-body>
       <el-form ref="form" :model="form" :rules="rules" label-width="110px">
         <el-form-item label="区域序号" prop="regionOrder">
-          <el-select v-model="form.regionOrder" filterable  clearable placeholder="请选择区域序号"
+          <el-select v-model="form.regionOrder" filterable clearable placeholder="请选择区域序号"
                      style="width: 100%" @change="selectChange">
             <el-option v-for="region in regionList"
                        :key="region.orderNo"
@@ -224,7 +225,7 @@
         <el-form-item label="位置" prop="position">
           <el-input v-model="form.position" disabled placeholder="请输入位置"/>
         </el-form-item>
-        <el-form-item label="区域负责人"  prop="owner">
+        <el-form-item label="区域负责人" prop="owner">
           <el-input v-model="form.owner" disabled placeholder="请输入区域负责人"/>
         </el-form-item>
         <el-form-item label="检查日期" prop="checkDate">
@@ -249,6 +250,7 @@
             :disabled="file.isUploading"
             :on-progress="handleFileDocProgress"
             :on-success="handleFileDocSuccess"
+            :on-remove="handleRemove"
             :auto-upload="true"
             :limit="4"
             :on-exceed="exceedFile"
@@ -291,6 +293,7 @@
             :disabled="file.isUploading"
             :on-progress="handleFileDocProgress"
             :on-success="handleFileDocSuccess2"
+            :on-remove="handleRemove"
             :auto-upload="true"
             :limit="4"
             :on-exceed="exceedFile"
@@ -302,12 +305,9 @@
             <i class="el-icon-plus"></i>
           </el-upload>
         </el-form-item>
-        <el-form-item label="整改结果" prop="changeResult">
-          <el-input v-model="form.changeResult" placeholder="请输入整改结果"/>
-        </el-form-item>
       </el-form>
       <div slot="footer" class="dialog-footer">
-        <el-button type="primary" @click="submitForm">确 定</el-button>
+        <el-button type="primary" @click="changeRecord">确 定</el-button>
         <el-button @click="cancel">取 消</el-button>
       </div>
     </el-dialog>
@@ -320,7 +320,6 @@
             icon="el-icon-plus"
             size="mini"
             @click="handleChange"
-            v-hasPermi="['production:details:add']"
           >添加整改记录
           </el-button>
         </el-col>
@@ -344,7 +343,29 @@
           </template>
         </el-table-column>
         <el-table-column label="整改内容" align="center" prop="changeContent" :show-overflow-tooltip="true"/>
-        <el-table-column label="整改结果" align="center" prop="changeResult" :show-overflow-tooltip="true"/>
+        <el-table-column label="整改结果" align="center" prop="changeResult" :show-overflow-tooltip="true">
+          <template slot-scope="scope">
+            <div v-if="scope.row.changeResult==null">
+              <el-button
+                size="mini"
+                type="text"
+                icon="el-icon-tickets"
+                @click="checkRecord(scope.row,'合格')"
+                v-hasPermi="['production:record:approve']"
+              >合格
+              </el-button>
+              <el-button
+                size="mini"
+                type="text"
+                icon="el-icon-tickets"
+                @click="checkRecord(scope.row,'不合格')"
+                v-hasPermi="['production:record:approve']"
+              >不合格
+              </el-button>
+            </div>
+            <div v-else>{{ scope.row.changeResult }}</div>
+          </template>
+        </el-table-column>
       </el-table>
     </el-dialog>
 
@@ -390,7 +411,7 @@ import {
   addRecord,
   updateRecord,
   exportRecord,
-  importTemplate
+  importTemplate, approveRecord, changeRecord
 } from "@/api/production/record";
 import {treeselect} from "@/api/system/dept";
 import {getToken} from "@/utils/auth";
@@ -513,9 +534,6 @@ export default {
         changeContent: [
           {required: true, message: "请输入整改内容", trigger: "blur"}
         ],
-        changeResult: [
-          {required: true, message: "请输入整改结果", trigger: "blur"}
-        ]
       }
     };
   },
@@ -535,6 +553,43 @@ export default {
     this.getRegion();
   },
   methods: {
+    checkRecord(row, result) {
+      console.log(row)
+      approveRecord({id: row.id, recordId: row.recordId, changeResult: result}).then(res => {
+        this.getDetailList(row.recordId);
+        this.getList();
+      })
+    },
+    handleRemove(file, fileList){
+      console.log(this.fileIds,this.personFiles)
+      console.log(file)
+      if(file.response.data!=null){
+        if (this.fileIds.indexOf(file.response.data)>=0){
+          this.fileIds.splice(this.fileIds.indexOf(file.response.data),1)
+        }
+      }
+      console.log(this.fileIds,this.personFiles)
+    },
+    changeRecord(row, result) {
+      this.$refs["form"].validate(valid => {
+        if (valid) {
+          if (this.fileIds != []) {
+            this.form.checkFile = this.fileIds.join(',');
+          }
+          if (this.changeFileIds != []) {
+            this.form.changeFile = this.changeFileIds.join(',');
+          }
+          changeRecord(this.form).then(response => {
+            this.msgSuccess("修改成功");
+            this.open = false;
+            this.changeOpen = false;
+            this.getList();
+            this.getDetailList(this.form.id);
+          });
+
+        }
+      });
+    },
     // 文件超出个数限制时的钩子
     exceedFile(files, fileList) {
       this.$message.warning(
@@ -546,23 +601,23 @@ export default {
         this.regionList = res.data;
       })
     },
-    selectChange(event){
-      this.form.position=this.regionList.find((o) => o.orderNo === event).position
-      this.form.owner=this.regionList.find((o) => o.orderNo === event).personLiable
+    selectChange(event) {
+      this.form.position = this.regionList.find((o) => o.orderNo === event).position
+      this.form.owner = this.regionList.find((o) => o.orderNo === event).personLiable
     },
     openDetail(id) {
       this.detail.recordId = id;
       this.detail.open = true;
       this.getDetailList(id);
     },
-    getDetailList(id){
+    getDetailList(id) {
       listDetails({recordId: id}).then(response => {
         this.detailsList = response.rows;
       });
     },
     openFile(fileIds, title) {
       this.file.title = title;
-      this.file.file=null;
+      this.file.file = null;
       this.file.open = true;
       this.srcList = [];
       let ids = fileIds.split(',');
@@ -667,6 +722,16 @@ export default {
       const id = row.id || this.ids
       getRecord(id).then(response => {
         this.form = response.data;
+        if (this.form.checkFile!=null){
+          let ids = this.form.checkFile.split(',')
+          for (const id of ids) {
+            getFile(id).then(res=>{
+              let item = {url: process.env.VUE_APP_BASE_API +res.data.url,response: {msg: res.data.url,data:id} }
+              this.fileList.push(item)
+              this.fileIds.push(id)
+            })
+          }
+        }
         this.open = true;
         this.title = "修改区域检查整改记录";
       });
@@ -678,10 +743,10 @@ export default {
       this.reset();
       getRecord(this.detail.recordId).then(response => {
         this.form = response.data;
-        this.form.changeContent='';
-        this.form.changeFile='';
-        this.form.changeResult='';
-        this.form.changeDate='';
+        this.form.changeContent = '';
+        this.form.changeFile = '';
+        this.form.changeResult = '';
+        this.form.changeDate = '';
         this.changeOpen = true;
         this.title = "添加区域检查整改记录";
       });

+ 40 - 1
ui/src/views/production/region/index.vue

@@ -184,12 +184,13 @@
             :disabled="file.isUploading"
             :on-progress="handleFileDocProgress"
             :on-success="handleFileDocSuccess2"
+            :on-remove="handleRemove"
             :auto-upload="true"
             accept=".jpg,.png"
             :multiple="true"
             :limit="4"
             :on-exceed="exceedFile"
-            :file-list="fileList"
+            :file-list="userFileList"
             list-type="picture-card"
           >
             <i class="el-icon-plus"></i>
@@ -215,6 +216,7 @@
             :disabled="file.isUploading"
             :on-progress="handleFileDocProgress"
             :on-success="handleFileDocSuccess"
+            :on-remove="handleRemove"
             :auto-upload="true"
             accept=".jpg,.png"
             :multiple="true"
@@ -342,6 +344,7 @@ export default {
         url: process.env.VUE_APP_BASE_API + "/production/region/importData"
       },
       fileList: [],
+      userFileList: [],
       file: {
         file: "",
         open: false,
@@ -468,6 +471,19 @@ export default {
     handleFileDocSuccess(response, file, fileList) {
       this.fileIds.push(response.data);
     },
+    handleRemove(file, fileList){
+      console.log(this.fileIds,this.personFiles)
+      console.log(file)
+      if(file.response.data!=null){
+        if (this.fileIds.indexOf(file.response.data)>=0){
+          this.fileIds.splice(this.fileIds.indexOf(file.response.data),1)
+        }
+        if (this.personFiles.indexOf(file.response.data)>=0){
+          this.personFiles.splice(this.personFiles.indexOf(file.response.data),1)
+        }
+      }
+      console.log(this.fileIds,this.personFiles)
+    },
     //附件上传成功处理
     handleFileDocSuccess2(response, file, fileList) {
       this.personFiles.push(response.data);
@@ -538,6 +554,7 @@ export default {
       this.fileIds = [];
       this.personFiles = [];
       this.fileList = [];
+      this.userFileList = [];
       this.open = true;
       this.title = "添加区域列台账";
     },
@@ -547,11 +564,33 @@ export default {
       this.fileIds = [];
       this.personFiles = [];
       this.fileList = [];
+      this.userFileList = [];
       const id = row.id || this.ids
       getRegion(id).then(response => {
         this.form = response.data;
         if (this.form.staffId != null)
           this.form.staffId = this.form.staffId.split(",");
+        if (this.form.fileId!=null){
+          let ids = this.form.fileId.split(',')
+          for (const id of ids) {
+            getFile(id).then(res=>{
+              let item = {url: process.env.VUE_APP_BASE_API +res.data.url,response: {msg: res.data.url,data:id} }
+              this.fileList.push(item)
+              this.fileIds.push(id)
+            })
+          }
+        }
+        if (this.form.personFile!=null){
+          let ids = this.form.personFile.split(',')
+          for (const id of ids) {
+            getFile(id).then(res=>{
+              let item = {url: process.env.VUE_APP_BASE_API +res.data.url,response: {msg: res.data.url,data:id} }
+              this.userFileList.push(item)
+              this.personFiles.push(id)
+            })
+          }
+        }
+        console.log(this.fileIds,this.personFiles)
         this.open = true;
         this.title = "修改区域列台账";
       });