소스 검색

添加防疫增删改

caojunjie 3 년 전
부모
커밋
47242121f3
3개의 변경된 파일134개의 추가작업 그리고 11개의 파일을 삭제
  1. 3 0
      src/App.vue
  2. 24 0
      src/api/landTransportation/antiepidemic.js
  3. 107 11
      src/views/landTransportation/antiepidemic/index.vue

+ 3 - 0
src/App.vue

@@ -34,4 +34,7 @@ export default {
   color: #000000 !important;
   background-color: #fafafa !important;
 }
+.el-dialog__headerbtn {
+  top: 9px !important;
+}
 </style>

+ 24 - 0
src/api/landTransportation/antiepidemic.js

@@ -16,3 +16,27 @@ export function getAttachment(data) {
         params:data
     })
 }
+//修改附件
+export function enclosure(data) {
+    return request({
+        url: '/api/blade-land/ncp-check/file',
+        method: 'post',
+        data:data
+    })
+}
+// 保存防疫信息
+export function antiepidemicSave(data) {
+    return request({
+        url: '/api/blade-land/ncp-check/save',
+        method: 'post',
+        data
+    })
+}
+// 删除防疫信息
+export function remove(data) {
+    return request({
+        url: '/api/blade-land/ncp-check/remove',
+        method: 'post',
+        params:data
+    })
+}

+ 107 - 11
src/views/landTransportation/antiepidemic/index.vue

@@ -6,16 +6,21 @@
           :option="goodsOptionCrud"
           :table-loading="loading"
           :page.sync="page"
+          v-model="form"
           ref="crud"
+          @row-save="rowSave"
+          @row-del="rowDel"
           @on-load="onLoad"
           @resetColumn="resetColumn"
           @saveColumn="saveColumn"
+          @row-update="(form,index,done,loading)=>{rowSave(form,done)}"
           @search-change="searchChange"
           @search-criteria-switch="searchCriteriaSwitch">
         <template slot-scope="{row,index}" slot="menu">
           <el-button
               size="small"
               type="text"
+              icon="el-icon-picture-outline"
               @click="annexOpen(row, index)"
           >附 件
           </el-button>
@@ -24,6 +29,7 @@
       <el-dialog
           title="附件"
           :visible.sync="dialogVisible"
+          :close-on-click-modal="false"
           append-to-body
           width="80%">
 <!--        <c-upload-->
@@ -38,8 +44,12 @@
             class="hide"
             list-type="picture-card"
             :on-preview="handlePictureCardPreview"
+            :action="action"
             :file-list="orderList"
-            disabled>
+            :headers="headers"
+            :on-remove="onRemove"
+            :on-success="onSuccess"
+            >
           <i class="el-icon-plus"></i>
         </el-upload>
         <el-dialog :visible.sync="visible" append-to-body>
@@ -47,7 +57,7 @@
         </el-dialog>
         <span slot="footer" class="dialog-footer">
           <el-button @click="dialogVisible = false" size="small">取 消</el-button>
-<!--          <el-button type="primary" @click="saveAnnex" size="small" :disabled="form.status===4">保 存</el-button>-->
+          <el-button type="primary" @click="saveAnnex" size="small">保 存</el-button>
         </span>
       </el-dialog>
     </basic-container>
@@ -57,8 +67,12 @@
 <script>
 import {
   driverQueryCollection,
-  getAttachment
+  getAttachment,
+  enclosure, antiepidemicSave,remove
 } from "@/api/landTransportation/antiepidemic";
+import {getToken} from "@/util/auth";
+import {sharedDeletion} from "@/api/user";
+import {deleteDetails} from "@/api/basicData/configuration";
 
 export default {
   name: "index",
@@ -69,6 +83,8 @@ export default {
       key:0,
       form: {},
       orderList:[],
+      action: "/api/blade-resource/oss/endpoint/put-file",
+      headers: { "Blade-Auth": "Bearer " + getToken() },
       dialogVisible: false,
       loading: false,
       activeName:'',
@@ -84,11 +100,11 @@ export default {
       optionList: {
         stripe:true,
         index: true,
-        addBtn: false,
-        delBtn: false,
+        addBtn: true,
+        delBtn: true,
         cellBtn: false,
         cancelBtn: false,
-        editBtn: false,
+        // editBtn: false,
         addRowBtn: false,
         searchIcon: true,
         searchIndex: 2,
@@ -113,10 +129,31 @@ export default {
           search: true,
         },{
           label: '制单日期',
+          type: "date",
+          searchRange: true,
+          defaultTime: ['00:00:00', '23:59:59'],
+          format: "yyyy-MM-dd HH:mm:ss",
+          valueFormat: "yyyy-MM-dd HH:mm:ss",
           prop: 'createTime',
           overHidden: true,
+          display:false,
+          search: true,
           index: 3,
           width: 150
+        },{
+          label: '箱号一',
+          prop: 'ctnOne',
+          overHidden: true,
+          index: 4,
+          search: true,
+          width: 150
+        },{
+          label: '箱号二',
+          prop: 'ctnTwo',
+          overHidden: true,
+          index: 5,
+          search: true,
+          width: 150
         }
         ],
       },
@@ -136,6 +173,65 @@ export default {
     }
   },
   methods: {
+    //删除
+    rowDel(form,index){
+      this.$confirm("确定将选择数据删除?", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning"
+      }).then(() => {
+        return remove({ids:form.id});
+      }).then(() => {
+        this.$message({
+          type: "success",
+          message: "操作成功!"
+        });
+        this.page.currentPage = 1;
+        this.onLoad(this.page, {})
+      });
+    },
+    //新增
+    rowSave(form,done,loading){
+      // console.log(this.deepClone(this.form))
+      antiepidemicSave({
+        ...this.deepClone(this.form),
+        fileList:[]
+      }).then(res=>{
+        if (res.data.code === 200){
+          if (this.form.id){
+            this.$message.success("修改成功");
+          }else {
+            this.$message.success("新增成功");
+          }
+          this.onLoad(this.page, {})
+        }
+        done()
+      })
+    },
+    //保存修改附件
+    saveAnnex(){
+      enclosure(this.orderList).then(res=>{
+        if (res.data.code === 200){
+          this.$message.success("保存成功");
+          this.dialogVisible = false
+        }
+      })
+    },
+    onSuccess(response, file, fileList) {
+      this.orderList.push({
+        fileName:response.data.originalName,
+        url:response.data.link,
+        pid:this.form.id
+      })
+    },
+    onRemove(file, fileList) {
+      sharedDeletion('/api/blade-client/common-file/remove', file.id).then(res => {
+        if (res.data.success) {
+          this.$message.success("操作成功!");
+          this.orderList = fileList
+        }
+      });
+    },
     handlePictureCardPreview(file) {
       this.dialogImageUrl = file.url;
       this.visible = true;
@@ -166,9 +262,9 @@ export default {
     // 获得高度
     searchCriteriaSwitch(type) {
       if (type) {
-        this.goodsOptionCrud.height = this.goodsOptionCrud.height - 230
+        this.goodsOptionCrud.height = this.goodsOptionCrud.height - 51
       } else {
-        this.goodsOptionCrud.height = this.goodsOptionCrud.height + 230
+        this.goodsOptionCrud.height = this.goodsOptionCrud.height + 51
       }
       this.$refs.crud.getTableHeight()
     },
@@ -221,9 +317,9 @@ export default {
 </script>
 
 <style lang="scss" scoped>
-::v-deep .hide .el-upload--picture-card {
-  display: none;
-}
+//::v-deep .hide .el-upload--picture-card {
+//  display: none;
+//}
 .home-container {
   padding: 0px 5px 5px 5px;
   box-sizing: border-box;