chen 2 лет назад
Родитель
Сommit
f44dc5f746

+ 1 - 1
src/option/productBatch/product.js

@@ -9,7 +9,7 @@ export default {
   cancelBtn: false,
   deleteBtn: false,
   menuWidth: 100,
-  menu: false,
+  menu: true,
   column: [
     {
       label: "产品二维码",

+ 29 - 10
src/option/productRework/productReworkReport.js

@@ -15,48 +15,67 @@ export default {
   addBtn:false,
   editBtn:false,
   delBtn:false,
-  column: [
-    {
+  column: {
+  factoryId:{
+      label: "所属工厂",
+      prop: "factoryId",
+      search: getStore({ name: 'userInfo' }).user_category==1,
+      hide: getStore({ name: 'userInfo' }).user_category!=1,
+      display: getStore({ name: 'userInfo' }).user_category==1,
+      type: "tree",
+      cascader: [getStore({ name: 'userInfo' }).user_category==1?'clientId':'',getStore({ name: 'userInfo' }).user_category==1?'productModelId':''],
+      dicUrl: "/api/pl-factory/factory/select",
+      props: {
+        label: "name",
+        value: "id",
+      },
+      rules: [{
+        required: true,
+        message: "请选择所属工厂",
+        trigger: "blur"
+      }]
+    },
+    createPersonName:{
       label: "上报人",
       prop: "createPersonName",
       type: "input",
       addDisplay: false,
       editDisplay: false,
     },
-    {
+    createTime:{
       label: "上报日期",
       prop: "createTime",
       type: "input",
       addDisplay: false,
       editDisplay: false,
     },
-    {
+    reworkPersonName:{
       label: "维修人",
       prop: "reworkPersonName",
       type: "input",
     },
-    {
+    reworkDate:{
       label: "维修时间",
       prop: "reworkDate",
       type: "input",
     },
-    {
+    auditPersonName:{
       label: "审核人",
       prop: "auditPersonName",
       type: "input",
     },
-    {
+    auditDate:{
       label: "审核时间",
       prop: "auditDate",
       type: "input",
     },
-    {
+    qrCode:{
       label: "产品二维码",
       prop: "qrCode",
       type: "input",
       search: true,
     },
-    {
+    status:{
       label: "状态",
       prop: "status",
       addDisplay: false,
@@ -67,5 +86,5 @@ export default {
       props:{label:"dictValue",value:"dictKey"},
       search: true,
     },
-  ]
+  }
 }

+ 15 - 0
src/views/productBatch/productBatch.vue

@@ -40,6 +40,16 @@
                     <el-input v-model="row.qrCode"
                               :disabled="row.id"></el-input>
                   </template>
+                  <template #menu="{row,index,size}">
+                    <el-popconfirm title="确认删除入库产品数据么?" @confirm="delDetail(index)">
+                      <template #reference>
+                        <el-button  v-if="index>0"
+                                  :size="size"
+                                  type="primary"
+                                  text>删除</el-button>
+                      </template>
+                    </el-popconfirm>
+                  </template>
                   <!-- <template slot-scope="{row,index}" slot="menu">
                     <el-button v-if="row.$cellEdit"
                               text
@@ -238,6 +248,7 @@
         });
       },
       beforeOpen(done, type) {
+        this.optionSub.menu = false;
         if (["edit", "view"].includes(type)) {
           getDetail(this.form.id).then(res => {
             this.form = res.data.data;
@@ -252,12 +263,16 @@
           });
         }
         if (["add"].includes(type)) {
+          this.optionSub.menu = true;
           if(!this.form.details){
             this.form.details = [{"$cellEdit":true},{"$cellEdit":true},{"$cellEdit":true},{"$cellEdit":true},{"$cellEdit":true},{"$cellEdit":true},{"$cellEdit":true}]
           }
         }
         done();
       },
+      delDetail(index){
+			  this.form.details.splice(index,1)
+      },
       searchReset() {
         this.query = {};
         this.onLoad(this.page);

+ 242 - 0
src/views/productRework/productInvalid.vue

@@ -0,0 +1,242 @@
+<template>
+  <basic-container>
+    <avue-crud :option="option"
+               v-model:search="search"
+               v-model:page="page"
+               v-model="form"
+               :table-loading="loading"
+               :data="data"
+               :permission="permissionList"
+               :before-open="beforeOpen"
+               ref="crud"
+               @row-update="rowUpdate"
+               @row-save="rowSave"
+               @row-del="rowDel"
+               @search-change="searchChange"
+               @search-reset="searchReset"
+               @selection-change="selectionChange"
+               @current-change="currentChange"
+               @size-change="sizeChange"
+               @refresh-change="refreshChange"
+               @on-load="onLoad">
+      <template #menu-left>
+        <!-- <el-button type="danger"
+                   icon="el-icon-delete"
+                   plain
+                   v-if="permission.productRework_delete"
+                   @click="handleDelete">删 除
+        </el-button> -->
+        <el-button type="warning"
+                   plain
+                   icon="el-icon-download"
+                   @click="handleExport">导 出
+        </el-button>
+      </template>
+    </avue-crud>
+  </basic-container>
+</template>
+
+<script>
+  import {getList, getDetail, add, update, remove} from "@/api/productRework/productRework";
+  import option from "@/option/productRework/productReworkReport";
+  import {mapGetters} from "vuex";
+  import {exportBlob} from "@/api/common";
+  import {getToken} from '@/utils/auth';
+  import {downloadXls} from "@/utils/util";
+  import {dateNow} from "@/utils/date";
+  import NProgress from 'nprogress';
+  import 'nprogress/nprogress.css';
+
+  export default {
+    data() {
+      return {
+        form: {},
+        query: {},
+        search: {},
+        loading: true,
+        page: {
+          pageSize: 10,
+          currentPage: 1,
+          total: 0
+        },
+        selectionList: [],
+        option: option,
+        data: []
+      };
+    },
+    computed: {
+      ...mapGetters(["permission"]),
+      permissionList() {
+        return {
+          addBtn: this.validData(this.permission.productRework_add, false),
+          viewBtn: this.validData(this.permission.productRework_view, false),
+          delBtn: this.validData(this.permission.productRework_delete, false),
+          editBtn: this.validData(this.permission.productRework_edit, false)
+        };
+      },
+      ids() {
+        let ids = [];
+        this.selectionList.forEach(ele => {
+          ids.push(ele.id);
+        });
+        return ids.join(",");
+      }
+    },
+    methods: {
+      rowSave(row, done, loading) {
+        add(row).then(() => {
+          this.onLoad(this.page);
+          this.$message({
+            type: "success",
+            message: "操作成功!"
+          });
+          done();
+        }, error => {
+          loading();
+          window.console.log(error);
+        });
+      },
+      rowUpdate(row, index, done, loading) {
+        update(row).then(() => {
+          this.onLoad(this.page);
+          this.$message({
+            type: "success",
+            message: "操作成功!"
+          });
+          done();
+        }, error => {
+          loading();
+          console.log(error);
+        });
+      },
+      rowDel(row) {
+        this.$confirm("确定将选择数据删除?", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning"
+        })
+          .then(() => {
+            return remove(row.id);
+          })
+          .then(() => {
+            this.onLoad(this.page);
+            this.$message({
+              type: "success",
+              message: "操作成功!"
+            });
+          });
+      },
+      handleDelete() {
+        if (this.selectionList.length === 0) {
+          this.$message.warning("请选择至少一条数据");
+          return;
+        }
+        this.$confirm("确定将选择数据删除?", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning"
+        })
+          .then(() => {
+            return remove(this.ids);
+          })
+          .then(() => {
+            this.onLoad(this.page);
+            this.$message({
+              type: "success",
+              message: "操作成功!"
+            });
+            this.$refs.crud.toggleSelection();
+          });
+      },
+      handleExport() {
+        let downloadUrl = `/pl-productRework/productRework/export-productRework?${this.website.tokenHeader}=${getToken()}`;
+        const {
+            qrCode,
+            productName,
+            productModel,
+            createTime,
+            status,
+        } = this.query;
+        let values = {
+            qrCode_: qrCode,
+            status: -1,
+        };
+        this.query.status=-1
+        this.$confirm("是否导出数据?", "提示", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning"
+        }).then(() => {
+          NProgress.start();
+          exportBlob(downloadUrl, this.query).then(res => {
+            downloadXls(res.data, `产品返修表${dateNow()}.xlsx`);
+            NProgress.done();
+          })
+        });
+      },
+      beforeOpen(done, type) {
+        if (["edit", "view"].includes(type)) {
+          getDetail(this.form.id).then(res => {
+            this.form = res.data.data;
+          });
+        }
+        done();
+      },
+      searchReset() {
+        this.query = {};
+        this.onLoad(this.page);
+      },
+      searchChange(params, done) {
+        this.query = params;
+        this.page.currentPage = 1;
+        this.onLoad(this.page, params);
+        done();
+      },
+      selectionChange(list) {
+        this.selectionList = list;
+      },
+      selectionClear() {
+        this.selectionList = [];
+        this.$refs.crud.toggleSelection();
+      },
+      currentChange(currentPage){
+        this.page.currentPage = currentPage;
+      },
+      sizeChange(pageSize){
+        this.page.pageSize = pageSize;
+      },
+      refreshChange() {
+        this.onLoad(this.page, this.query);
+      },
+      onLoad(page, params = {}) {
+        this.option.column.status.search=false;
+        this.loading = true;
+
+        const {
+          qrCode,
+          productName,
+          productModel,
+          createTime,
+          status,
+        } = this.query;
+
+        let values = {
+            qrCode: qrCode,
+            status: -1,
+        };
+        this.query.status=-1
+
+        getList(page.currentPage, page.pageSize, this.query).then(res => {
+          const data = res.data.data;
+          this.page.total = data.total;
+          this.data = data.records;
+          this.loading = false;
+          this.selectionClear();
+        });
+      }
+    }
+  };
+</script>
+
+<style>
+</style>

+ 14 - 8
src/views/productRework/productReworkReport.vue

@@ -151,15 +151,18 @@
       handleExport() {
         let downloadUrl = `/pl-productRework/productRework/export-productRework?${this.website.tokenHeader}=${getToken()}`;
         const {
-            qrCode,
-            productName,
-            productModel,
-            createTime,
-            status,
+          factoryId,
+          qrCode,
+          productName,
+          productModel,
+          createTime,
+          status,
         } = this.query;
+
         let values = {
-            qrCode_: qrCode,
-            status: status,
+            factoryId_equal: factoryId,
+            qrCode: qrCode,
+            status_equal: status,
         };
         this.$confirm("是否导出数据?", "提示", {
           confirmButtonText: "确定",
@@ -208,9 +211,11 @@
         this.onLoad(this.page, this.query);
       },
       onLoad(page, params = {}) {
+        this.option.column.status.search=true;
         this.loading = true;
 
         const {
+          factoryId,
           qrCode,
           productName,
           productModel,
@@ -219,8 +224,9 @@
         } = this.query;
 
         let values = {
+            factoryId_equal: factoryId,
             qrCode: qrCode,
-            status: status,
+            status_equal: status,
         };
 
         getList(page.currentPage, page.pageSize, values).then(res => {

+ 1 - 0
src/views/system/user.vue

@@ -593,6 +593,7 @@ export default {
                     { label: "生产组", value: 2 },
                     { label: "检测组", value: 3 },
                     { label: "维修组", value: 4 },
+                    { label: "客户组", value: 5 },
                   ],
                 },
             ],