王震
2023-11-06 6afada5b2288dcad1edb2b7d6d05c6fac1195f8e
src/views/quality/finishedProductInspection/index.vue
@@ -16,19 +16,15 @@
   </div>
</template>
<script>
    import ttable from '@/views/common/ztt-table.vue'
    import * as fecha from 'element-ui/lib/utils/date'
   import finishedProductInspectionAdd from './finishedProductInspectionAdd'
   import finishedProductInspectionUp from './finishedProductInspectionUp'
   import finishedProductInspectionLook from './finishedProductInspectionLook'
    import { page } from '@/api/quality/finishedProduct'
   import finishedProductInspectionAdd from './finishedProduct-form'
    import { page,deletePro,exportExaminationProducts } from '@/api/quality/finishedProduct'
    import { transform } from '@/util/fileTransform'
   export default {
      components: {
         finishedProductInspectionAdd,
         finishedProductInspectionUp,
         finishedProductInspectionLook,
            ttable
      },
      data() {
@@ -155,10 +151,9 @@
                        fun: this.addOrUpdateHandle
                    },
                    {
                        text: '删除',
                    },
                    {
                        text: '导出',
                        type: 'primary',
                        fun: this.exportExcel
                    }
                    ],
                    operator: [{
@@ -178,73 +173,44 @@
                    minWidth: 100
                    },
                },
            searchData: {
               result: '',
               material: '',
            },
            // 主机工下拉框
            usernameOptions: [],
            inspectionTable: [],
            rowInfo: {},
            pageParams: {
               countSize: 10, //每页数量
               pageSize: 1, // 当前页码
               total: 0
            },
            showAddPage: false,
            showAdd: false,
            showLook: false,
            showUp: false,
            showDetail: false,
            addInspectionform: [{
               number: '',
               username: '',
               projectname: '',
               tracenumber: '',
               code: '',
               class: '',
               specificationmodel: '',
               unit: '',
               quantity: '',
               group: '',
               worker: '',
               machine: ''
            }],
            inspectionItems: [{
               project: '布隆迪',
               unit: '吨',
               standardVal: '8219384314',
               controlVal: '9823401',
               detectionVal: '11111',
               device: '',
               conclusion: '合格'
            }],
            inspectionResultForm: [{
               id: '274024',
               name: '111',
               inspecter: '111',
               conclusion: '',
               operation: ''
            }],
            finishedInsInfo: {}
         }
      },
      created() {
         this.init()
         // this.getInspectionTableData()
      },
      created() { },
      methods: {
            exportExcel(){
                console.log("============");
                let queryParam=this.$refs.finishedProduct.getQueryParam();
                delete queryParam.criteria
                console.log(queryParam);
                exportExaminationProducts(queryParam).then((res)=>{
                    transform(res)
                })
            },
         deleteHandle(row){
            console.log(row.id)
            this.$confirm('确认删除该数据吗?', '提示', {
            confirmButtonText: '确定',
            cancelButtonText: '取消',
            type: 'warning',
            }).then(()=>{
               deletePro(row.id).then(res=>{
                  if(res.data.code == 0){
                     this.$message.success("删除成功")
                  }else{
                     this.$message.error("删除失败")
                  }
                  this.getData()
               })
            })
         },
         // 新增 / 修改
         addOrUpdateHandle(row) {
            this.$router.push({
               name: 'finishedProductForm',
               query: { id: row == null ? null : row.id }
               query: {
                        id: row == null ? null : row.id,
                        resultVal: row == null ? null : row.result
                    }
            })
         },
            formatResult(row, column, cellValue){
@@ -259,61 +225,10 @@
            formatDateTime(row, column, cellValue) {
                return cellValue ? fecha.format(new Date(cellValue), 'yyyy-MM-dd') : ''
            },
            handleSelectionChange(){
            },
         // 每页条数改变时触发 选择一页显示多少行
         handleSizeChange(val) {
            console.log(`每页 ${val} 条`)
            this.currentPage = 1
            this.pageSize = val
            handleSelectionChange(){ },
         getData() {
            this.$refs.finishedProduct.getDataList()
         },
         // 当前页改变时触发 跳转其他页
         handleCurrentChange(val) {
            console.log(`当前页: ${val}`)
            this.currentPage = val
         },
         handleAddNew() {
            this.showAdd = true
         },
         // async getInspectionTableData() {
         //    const {
         //       data: {
         //          row,
         //          total
         //       }
         //    } = await this.$axios.get(this.$api.url.finishedInsListPage, {
         //       params: {
         //          ...this.pageParams,
         //          ...this.searchData
         //       }
         //    })
         //    this.inspectionTable = row
         //    this.pageParams.total = total
         // },
         goToDetail(row) {
            this.rowInfo = row
            this.showLook = true
         },
         goUp(row) {
            this.rowInfo = row
            this.showUp = true
         },
         async init() {
            // const {data} = await this.$axios.get(this.$api.url.finishedInspectUser)
            // this.usernameOptions = data
         },
         comBackMain(val) {
            this.showAdd = false
            this.showLook = false
            this.showUp = false
            this.init()
            // this.getInspectionTableData()
            if (val) {
               this.$parent.removeAllTab()
            }
         }
      }
   }