小小儁爺
2024-08-08 d20654ba067e5c0621d4d7d95915cbe47a10fe87
src/views/reportManager/defectDetailList.vue
@@ -14,16 +14,29 @@
          style="display: flex;"
        >
          <div class="elForm">
            <el-form-item label="生产车间" style="display: flex;">
              <el-select v-model="form.wkshopcode" style="width: 200px" placeholder="请选择">
                <el-option
                  v-for="item in WorkShopArr"
                  :key="item.code"
                  :label="item.name"
                  :value="item.code"
                />
              </el-select>
            </el-form-item>
            <el-form-item label="销售单号" style=" display: flex;">
              <el-input v-model="form.saleordercode" placeholder="请输入" style="width: 200px" />
            </el-form-item>
            <el-form-item label="工单编号" style=" display: flex;">
              <el-input v-model="form.wocode" placeholder="请输入" style="width: 200px" />
            </el-form-item>
            <el-form-item label="产品编码" style=" display: flex;">
              <el-input v-model="form.partcode" placeholder="请输入" style="width: 200px" />
            </el-form-item>
            <el-form-item label="产品名称" style=" display: flex;">
            <el-form-item v-show="isExpandForm" label="产品名称" style=" display: flex;">
              <el-input v-model="form.partname" style="width: 200px" placeholder="请输入" />
            </el-form-item>
            <el-form-item label="规格型号" style=" display: flex;">
            <el-form-item v-show="isExpandForm" label="规格型号" style=" display: flex;">
              <el-input v-model="form.partspec" style="width: 200px" placeholder="请输入" />
            </el-form-item>
            <el-form-item v-show="isExpandForm" label="工序名称" style=" display: flex;">
@@ -103,6 +116,11 @@
            label="序号"
          />
          <el-table-column
            prop="saleOrderCode"
            label="销售单号"
            width="160"
            sortable="custom"
          />       <el-table-column
            prop="wo_code"
            label="工单编号"
            width="160"
@@ -111,26 +129,38 @@
          <el-table-column
            prop="partcode"
            label="产品编码"
            width="160"
            width="110"
            show-tooltip-when-overflow
            sortable="custom"
          />
          <el-table-column
            prop="partname"
            label="产品名称"
            width="160"
            width="110"
            show-tooltip-when-overflow
            sortable="custom"
          />
          <el-table-column
            prop="partspec"
            label="产品规格"
            width="160"
            width="110"
            show-tooltip-when-overflow
            sortable="custom"
          >
            <template slot-scope="{row}">
              <div v-if="row.partspec">{{ row.partspec }}</div>
              <div v-else>/</div>
            </template>
          </el-table-column>
          <el-table-column
            prop="wkshp_name"
            label="生产车间"
            width="110"
            show-tooltip-when-overflow
            sortable="custom"
          >
            <template slot-scope="{row}">
              <div v-if="row.wkshp_name">{{ row.wkshp_name }}</div>
              <div v-else>/</div>
            </template>
          </el-table-column>
@@ -157,6 +187,18 @@
          <el-table-column
            prop="defect_qty"
            label="不良数量"
            width="110"
            sortable="custom"
          />
          <el-table-column
            prop="defect_pendqty"
            label="不良待处理"
            width="120"
            sortable="custom"
          />
          <el-table-column
            prop="bad_qty"
            label="报废数量"
            width="110"
            sortable="custom"
          />
@@ -265,9 +307,10 @@
import { MesOrderStepReportSelectUserGroup } from '@/api/produceManager'
import elDragDialog from '@/directive/el-drag-dialog'
import waves from '@/directive/waves'
import { WorkShopSelect } from '@/api/deviceManager'
export default {
  name: 'Zzjg',
  name: 'DefectDetailList',
  components: {
    Pagination, ImportPicker
  },
@@ -279,6 +322,8 @@
      mainHeight: 0,
      tableHeight: 0,
      form: {
        saleordercode: '',
        wkshopcode: this.$store.state.settings.orgType === 'W' ? getCookie('stu_torgcode') : '', // 所属车间
        wocode: '', // 工单编号
        partcode: '', // 产品编码
        partname: '', // 产品名称
@@ -293,6 +338,7 @@
        page: 1, // 第几页
        rows: 20 // 每页多少条
      },
      WorkShopArr: [],
      // groupArr: [],
      total: 10,
      tableData: [],
@@ -341,10 +387,16 @@
  methods: {
    handleRequest() {
      this.getDefectDetailsReportSearch().then(res => {
        // if (res.code === '200') {
        if (res.code === '200') {
        //   this.getMesOrderStepReportSelectUserGroup()
        // }
          this.getWorkShopSelect()
        }
      })
    },
    // 获取所属车间下拉
    async getWorkShopSelect() {
      const { data: res } = await WorkShopSelect()
      this.WorkShopArr = res
    },
    async getDefectDetailsReportSearch() {
      let tempDate = this.form.reportdate
@@ -352,6 +404,7 @@
        tempDate = handleDatetime(tempDate[0]) + '~' + handleDatetime(tempDate[1])
      }
      const data = {
        saleordercode: this.form.saleordercode,
        wocode: this.form.wocode,
        partcode: this.form.partcode,
        partname: this.form.partname,
@@ -360,6 +413,7 @@
        defectcode: this.form.defectcode,
        defectname: this.form.defectname,
        reportname: this.form.reportname,
        wkshopcode: this.form.wkshopcode,
        reportdate: tempDate,
        prop: this.form.prop,
        order: this.form.order,
@@ -398,6 +452,7 @@
      }
      const data = {
        saleordercode: this.form.saleordercode,
        wocode: this.form.wocode,
        partcode: this.form.partcode,
        partname: this.form.partname,
@@ -406,6 +461,7 @@
        defectcode: this.form.defectcode,
        defectname: this.form.defectname,
        reportname: this.form.reportname,
        wkshopcode: this.form.wkshopcode,
        reportdate: tempDate
      }
@@ -426,6 +482,7 @@
    },
    // 重置
    reset() {
      this.form.saleordercode = ''
      this.form.wocode = ''
      this.form.partcode = ''
      this.form.partname = ''
@@ -435,81 +492,8 @@
      this.form.defectname = ''
      this.form.reportname = ''
      this.form.reportdate = ''
      this.form.wkshopcode = this.$store.state.settings.orgType === 'W' ? getCookie('stu_torgcode') : '' // 所属车间
      this.getDefectDetailsReportSearch()
    },
    // 新增按钮
    add(operation) {
      this.operation = operation
      this.dialogVisible = true
    },
    // 修改按钮
    async edit(operation, row) {
      this.operation = operation
      this.dialogVisible = true
      const res = await GroupSalaryReportSearchUser({ id: row.id })
      this.tagArr = res.data.map(r => r.reportname)
      // this.tagArr = ['楼李俊', '张三', '李四']
      // this.$nextTick(() => {
      //   this.dialogForm.OrgCode = row.org_code
      //   this.dialogForm.OrgName = row.org_name
      //   this.dialogForm.SupUnit = row.parent_id
      // })
    },
    // 删除按钮
    async del(row) {
      // this.$confirm('是否确认删除?', '提示', {
      //   confirmButtonText: '确定',
      //   cancelButtonText: '取消',
      //   type: 'warning'
      // }).then(() => {
      //   DeleteOrganization({ orgid: row.code }).then(res => {
      //     if (res.code === '200') {
      //       this.$message.success('删除成功!')
      //       if (this.form.page > 1 && this.tableData.length === 1) {
      //         this.form.page--
      //       }
      //       this.getDefectDetailsReportSearch()
      //     }
      //   })
      // }).catch(() => {
      //   this.$message.info('已取消删除')
      // })
    },
    // 对话框关闭事件
    handleClose() {
      this.dialogForm.OrgType = ''
      this.dialogForm.OrgCode = ''
      this.dialogForm.OrgName = ''
      this.dialogForm.SupUnit = ''
      this.$refs.dialogForm.clearValidate()
    },
    // 对话框取消
    dialogVisibleCancel() {
      this.dialogVisible = false
    },
    // 对话框确认
    dialogVisibleConfirm() {
      this.$refs.dialogForm.validate(valid => {
        if (valid) {
          const data = {
            OrganCode: this.dialogForm.OrgCode,
            OrganName: this.dialogForm.OrgName,
            OperType: this.operation === 'add' ? 'Add' : 'Update',
            Operator: getCookie('admin')
          }
          // AddUpdateOrganization(data).then(res => {
          //   if (res.code === '200') {
          //     this.$message.success(this.operation === 'add' ? '添加成功!' : '修改成功!')
          //     this.dialogVisible = false
          //     this.getDefectDetailsReportSearch()
          //   } else {
          //     this.$message.error(this.operation === 'add' ? '添加失败!' : '修改失败!')
          //   }
          // })
        }
      })
    },
    // 获取页面高度
    getHeight() {