小妖怪 6 сар өмнө
parent
commit
b80c506a12

+ 1 - 1
src/benyun/utils/auth.ts

@@ -6,7 +6,7 @@ const ExpiresInKey = 'AdminOMS-Expires-In'
 
 export function getToken() {
   if(process.env.NODE_ENV === 'development'){
-    return 'eyJhbGciOiJIUzUxMiJ9.eyJ1c2VyX2lkIjoxLCJ1c2VyX2tleSI6ImUzZTI5NzZlLTczNTEtNGJhYS1iODQ4LTM4OWY2ODkwN2VjNyIsInVzZXJuYW1lIjoiYWRtaW4ifQ.xC_g1BHPdbQPTl44sQn7yC-xGcLsbQx8NSotA186b9K1IrVzHdIp_ChTYmcBEhak8JeU5oGHYcNG2YVAJfL1CQ'
+    return 'eyJhbGciOiJIUzUxMiJ9.eyJ1c2VyX2lkIjoxLCJ1c2VyX2tleSI6ImQzYmQyMjQyLWEyZjktNDU5MC1hNTM0LTE0NjI2MjY2NGNhMyIsInVzZXJuYW1lIjoiYWRtaW4ifQ.x7TydRDIx1BXI_34cyeEHGXW5LDV50F9KkWIJw6BNgCL6aq-DFqDlEM0S5zeW2Sp3Kgg-hYmRj3RO2t3KBjovg'
   }else{
     return Cookies.get(TokenKey)
   }

+ 83 - 126
src/views/packing/setupPacking/components/openLogModal.vue

@@ -1,154 +1,111 @@
 <template>
-  <vxe-modal v-model="value" id="openLogModal" title="操作日志" width="50%" height="60%" min-width="460" min-height="320" show-zoom resize transfer :show-footer="!hideBtn" v-loading="load">
-    <by-table :propConfig="config" ref="table" > 
+  <vxe-modal
+    v-model="value"
+    id="openLogModal"
+    title="操作日志"
+    width="50%"
+    height="60%"
+    min-width="460"
+    min-height="320"
+    show-zoom
+    resize
+    transfer
+    :show-footer="!hideBtn"
+    v-loading="load"
+  >
+    <by-table :propConfig="config" ref="table">
       <!-- <template v-slot:num="{row}">
         <vxe-input v-model="row.num" v-if="row.splitNum > 0" placeholder="请输入" type="integer" @input="onChangeRow(row)"></vxe-input>
       </template> -->
     </by-table>
     <template #footer>
-      <div class="btn">
-        <el-button plain size="small" @click="value = false">取消</el-button>
-        <el-button type="primary" size="small" @click="btn">确定</el-button>
+      <div class="page">
+        <el-pagination
+          v-if="page.total > 0"
+          @size-change="handleSizeChange"
+          @current-change="handleCurrentChange"
+          :current-page="page.pageNo"
+          :page-size="page.pageSize"
+          :layout="'total, sizes, prev, pager, next, jumper'"
+          :total="page.total"
+        ></el-pagination>
       </div>
+      <!-- <div class="btn">
+        <el-button plain size="small" @click="value = false">取消</el-button>
+      </div> -->
     </template>
   </vxe-modal>
 </template>
 
 <script lang="ts">
 import { Component, Prop, Vue, Watch } from "vue-property-decorator";
-import { splitQtyQuery,split } from '@/api/omsOrder'
-@Component({components:{}})
-export default class SplitModel extends Vue {
-  value=false;
-  load=false;
-  billData:any=null;
-  hideBtn=false;
-  data:Array<any>=[]
-  config:any={
-    attr:{
-      size:'small',
-      seq:true
+@Component({ components: {} })
+export default class openLogModal extends Vue {
+  value = false;
+  load = false;
+  billData: any = null;
+  hideBtn = false;
+  data: Array<any> = [];
+  page: any = {
+    pageNo: 1, //当前页
+    pageSize: 10, //每页条数
+    total: 0, //总条数
+  };
+  config: any = {
+    attr: {
+      size: "small",
+      align: "center",
+      seq: true,
     },
-    columns:[{
-      title:'操作内容',
-      field:'name',
-      width:200
-    },{
-      title:'操作人',
-      field:'price',
-      width:200
-    },{
-      title:'创建时间',
-      field:'qty',
-      width:200
-    }]
-  }
+    columns: [
+      {
+        title: "操作内容",
+        field: "content",
+      },
+      {
+        title: "操作人",
+        field: "userName",
+      },
+      {
+        title: "创建时间",
+        field: "createTime",
+      },
+    ],
+  };
 
-  setShow(v:boolean){
+  setShow(v: boolean) {
     this.hideBtn = false;
+    console.log("数据111111111========", v);
     this.value = v;
   }
-  setData(data:any){
-    if(data){
-      this.billData = data;
-      this.data = [];
-      if(data.items) {
-        for(const item of data.items){
-          item.splitNum = item.qty - item.splitQty
-          this.data.push(item)
-        }
-      }
-      // this.getSplitNum(data);
-    }else{
-      this.billData = null;
-      this.data = [];
-    }
-    this.$nextTick(()=>{
-      let height = (document.getElementById('split-table') as any).parentNode.offsetHeight;
-      this.config.attr.height=height - 36;
-      if(this.$refs.table){
+  setValue(data: any) {
+    this.$nextTick(() => {
+      // const data = localStorage.getItem("logLsit");
+      // console.log("数据111111111datas========", JSON.parse(data)||null);
+      this.data=data.reverse();
+      this.page.total=data.length
+      // let height = (document.getElementById('openLogModal') as any).parentNode.offsetHeight;
+      // this.config.attr.height=height - 36;
+      if (this.$refs.table) {
         (this.$refs.table as any).setConfig(this.config);
         (this.$refs.table as any).setValue(this.data);
       }
-    })
-  }
-//获取可拆分数量
-  getSplitNum(v:any){
-    if(!v) return;
-    let data = v.items?v.items:[];
-    if(data.length == 0) return;
-    this.load = true;
-    splitQtyQuery({id:v.id}).then((res:any) => {
-      this.load = false;
-      if(res.data){
-        let j = 0;
-        for(const item of data){
-          let n = Number(res.data[item.id]);
-          if(n){
-            item.splitNum = item.qty - n;
-          }else{
-            item.splitNum = item.qty;
-          }
-          this.data.push(item)
-          if(item.splitNum == 0){
-            j++
-          }
-        }
-        if(j == this.data.length){
-          this.hideBtn = true
-        }
-        (this.$refs.table as any).setValue(this.data);
-      }
-    }).catch((err:any) => {
-      this.load = false
-    })
+    });
   }
-
-  btn(){
-    let data = (this.$refs.table as any).getValue();
-    let info:Array<any>=[];
-    if(data.length == 0){
-      this.$message('未有数据不能执行此操作!')
-      return
-    }
-    for(const item of data){
-      if(Number(item.num) > 0){
-        info.push({
-          qty:Number(item.num),
-          orderItemId:item.id
-        })
-      }
-    }
-    if(info.length == 0){
-      this.$message('请设置拆分数量!')
-      return
-    }
-    this.load = true;
-    split({
-      id:this.billData.id,
-      splitInfos:info
-    }).then((res:any) => {
-      this.load = false;
-      this.$message({
-        message:'拆分成功!',
-        type:'success'
-      })
-      this.$emit('handleSuccess');
-      this.value = false;
-    }).catch(() => {
-      this.load = false
-    })
+  handleSizeChange(v: number) {
+    this.page.pageSize = v;
   }
-
-  onChangeRow(row:any){
-    if(Number(row.splitNum) < Number(row.num)){
-      this.$message('拆分数量不能大于可拆分数量!');
-      row.num = 0;
-      this.$forceUpdate()
-    }
+  handleCurrentChange(v: number) {
+    this.page.pageNo = v;
   }
 }
 </script>
 <style lang="scss" scoped>
-
+.page {
+  width: 100%;
+  display: flex;
+  justify-content: flex-end;
+  padding: 8px;
+  box-sizing: border-box;
+}
 </style>

+ 45 - 16
src/views/packing/setupPacking/index.vue

@@ -7,48 +7,77 @@
         <el-input
           class="textarea"
           type="textarea"
-          v-model="form.desc"
+          v-model="form.content"
           placeholder="请输入内容"
           maxlength="300"
           show-word-limit
         ></el-input>
       </el-form-item>
       <el-form-item>
-        <el-button type="primary" >保存日志</el-button>
-        <el-button @click="onSubmit">操作日志</el-button>
+        <el-button type="primary" @click="saveLog()">保存日志</el-button>
+        <el-button @click="lookeLog()">操作日志</el-button>
       </el-form-item>
     </el-form>
     <!-- 操作日志 -->
-    <openLogModal ref="openLogModal" />
+    <openLogModal ref="openLogModal" :data="data" />
   </div>
 </template>
   
   <script lang="ts">
 import openLogModal from "./components/openLogModal.vue"; //拆分
 import { Component, Prop, Vue, Watch } from "vue-property-decorator";
-import { splitQtyQuery,split } from '@/api/omsOrder'
-@Component({components:{openLogModal}})
+
+@Component({ components: { openLogModal } })
 export default class packing extends Vue {
-    form={
-        desc:''
-    }
-    onSubmit(){
-        (this.$refs.openLogModal as any).setShow(true);
+  form = {
+    userName: (this as any).$store.getters.userInfo.userName,
+    content: "",
+    createTime: "",
+  };
+  index = 0;
+  data: Array<any> = [];
+  saveLog() {
+    const now = new Date();
+    this.form.createTime = now.toLocaleString();
+
+    if (this.form.content) {
+      this.$message({
+        message: "保存日志成功!",
+        type: "success",
+      });
+      // const aa=this.form
+      this.index++;
+      console.log("this.index========", this.index);
+      // if()
+      let from = JSON.stringify(this.form);
+      this.data.push(JSON.parse(from));
+      localStorage.setItem('logLsit', JSON.stringify(this.data));
+      console.log("提交的数据========", this.data);
+    } else {
+      this.$message({
+        message: "输入内容不能为空!",
+        type: "warning",
+      });
     }
   }
-
+  lookeLog() {
+    (this.$refs.openLogModal as any).setShow(true);
+    (this.$refs.openLogModal as any).setValue(this.data);
+  }
+}
 </script>
   
-  <style lang="scss" scoped>
+  <style lang="scss" >
 .print-count {
   padding: 16px;
   width: 100%;
   height: 100%;
   overflow-y: hidden;
 }
-
+.textarea textarea {
+  height: 400px !important;
+}
 .el-textarea__inner {
-  padding: 30px 10px;
-  height: 400px;
+  height: 400px !important;
 }
 </style>