loulijun2021
2023-05-30 c4cbb29fd3dd2f43da4f9af9967936edb86d1dcc
src/views/reportManager/logisticsCheck.vue
@@ -17,7 +17,7 @@
            <el-form-item label="检验类型" style=" display: flex;">
              <!--              <el-input v-model="form.checktypecode" placeholder="请输入" style="width: 200px" />-->
              <el-select v-model="form.style" style="width: 200px" placeholder="请选择">
              <el-select v-model="form.checktypecode" style="width: 200px" placeholder="请选择">
                <el-option
                  v-for="item in checktypeArr"
                  :key="item.code"
@@ -120,16 +120,37 @@
            fixed
            label="序号"
          />
          <!--          <el-table-column-->
          <!--            prop="check_type"-->
          <!--            label="检验类型"-->
          <!--            width="160"-->
          <!--            sortable="custom"-->
          <!--          >-->
          <!--            <template slot-scope="{row}">-->
          <!--              <div>{{ checktypeArr.find(i=>i.code===row.check_type).name }}</div>-->
          <!--            </template>-->
          <!--          </el-table-column> -->
          <el-table-column
            prop="wo_code"
            prop="check_typename"
            label="检验类型"
            width="160"
            width="110"
            sortable="custom"
          />
          <el-table-column
            prop="sampmethod"
            label="抽样方式"
            width="110"
            sortable="custom"
          >
            <template slot-scope="{row}">
              <div v-if="row.sampmethod==='FIXED'">固时抽检</div>
              <div v-if="row.sampmethod==='SCARE'">比例抽检</div>
            </template>
          </el-table-column>
          <el-table-column
            prop="partcode"
            label="物料编码"
            width="160"
            width="110"
            show-tooltip-when-overflow
            sortable="custom"
          />
@@ -142,7 +163,7 @@
          />
          <el-table-column
            prop="partspec"
            label="产品规格"
            label="规格型号"
            width="120"
            show-tooltip-when-overflow
            sortable="custom"
@@ -158,67 +179,74 @@
            width="110"
            show-tooltip-when-overflow
            sortable="custom"
          />
          >
            <template slot-scope="{row}">
              <div v-if="row.hbatchno">{{ row.hbatchno }}</div>
              <div v-else>/</div>
            </template>
          </el-table-column>
          <el-table-column
            prop="hbarcode"
            label="条码编号"
            width="110"
            width="160"
            show-tooltip-when-overflow
            sortable="custom"
          />
          <el-table-column
            prop="customer_name"
            label="往来单位"
            width="160"
            min-width="160"
            show-tooltip-when-overflow
            sortable="custom"
          />
          <el-table-column
            prop="plan_qty"
            label="任务数量"
            width="110"
            show-tooltip-when-overflow
            sortable="custom"
          />
          <el-table-column
            prop="repair_qty"
            label="维修数量"
            width="110"
            show-tooltip-when-overflow
            sortable="custom"
          />
          <el-table-column
            prop="bad_qty"
            label="报废数量"
            width="110"
            sortable="custom"
          />
          <el-table-column
            prop="defect_code"
            label="缺陷代码"
            width="110"
            show-tooltip-when-overflow
            sortable="custom"
          />
          <el-table-column
            prop="defect_name"
            label="批次条码"
            width="110"
            show-tooltip-when-overflow
            sortable="custom"
          />
          <el-table-column
            prop="lm_user"
            label="检验人员"
            prop="username"
            label="质检人员"
            width="110"
            sortable="custom"
          />
          <el-table-column
            prop="lm_date"
            label="检验时间"
            label="质检时间"
            width="160"
            sortable="custom"
          />
          <el-table-column
            prop="check_result"
            label="检验结果"
            width="110"
            sortable="custom"
          >
            <template slot-scope="{row}">
              <div v-if="row.check_result==='OK'" style="display: flex;align-items: center">
                <i class="el-icon-success" :style="{color:$store.state.settings.theme}" style="margin-right: 2px" />
                合格
              </div>
              <div v-if="row.check_result==='NG'" style="display: flex;align-items: center">
                <i class="el-icon-error" style="color: red;margin-right: 2px" />
                不合格
              </div>
            </template>
          </el-table-column>
          <el-table-column
            label="检验明细"
            width="120"
            fixed="right"
          >
            <template slot-scope="{row}">
              <div class="operationClass">
                <el-tooltip class="item" effect="dark" content="查看" placement="top">
                  <i
                    class="el-icon-view"
                    :style="{color:$store.state.settings.theme}"
                    style="margin-right:15px;cursor: pointer;"
                    @click="edit('edit',row)"
                  />
                </el-tooltip>
              </div>
            </template>
          </el-table-column>
        </el-table>
      </div>
@@ -236,24 +264,157 @@
    <el-dialog
      v-el-drag-dialog
      :title="operation==='add'?'新增':'人员明细'"
      :title="operation==='add'?'新增':'检验明细'"
      :visible.sync="dialogVisible"
      width="800px"
      width="1100px"
      :close-on-click-modal="false"
      top="15vh"
      @closed="handleClose"
      @close="handleClose"
    >
      <div style="height: 300px;width: 100%;background-color: aliceblue;padding:20px">
        <el-tag
          v-for="tag in tagArr"
          :key="tag.name"
          type="success"
          style="margin-right: 15px;min-width: 80px;text-align: center"
      <el-table
        ref="tableDataRef2"
        class="tableFixed"
        :data="dialogTableData"
        height="500"
        style="height:500px"
        border
        :row-class-name="tableRowClassName"
        highlight-current-row
        :header-cell-style="this.$headerCellStyle"
        :cell-style="this.$cellStyle"
      >
        <el-table-column
          prop="checkitem_seq"
          width="50"
          fixed
          label="序号"
        />
        <el-table-column
          prop="checkitem_name"
          min-width="120"
          fixed
          show-tooltip-when-overflow
          label="检验项目"
        />
        <el-table-column
          prop="standvalue"
          label="标准要求"
          fixed
          min-width="120"
          show-tooltip-when-overflow
        >
          {{ tag }}
        </el-tag>
      </div>
          <template slot-scope="{row}">
            <!--        ~当三个值都有    -->
            <div v-if="row.standvalue&&row.uppervalue&&row.lowervalue">{{ row.standvalue }}({{
              row.lowervalue
            }}~{{ row.uppervalue }})
            </div>
            <!--            ~当只有标准值和上限值时  -->
            <div v-else-if="row.standvalue&&row.uppervalue">{{ row.standvalue }}(~{{ row.uppervalue }})</div>
            <!--            ~当只有标准值和下限值时-->
            <div v-else-if="row.standvalue&&row.lowervalue">{{ row.standvalue }}({{ row.lowervalue }}~)</div>
            <!--            ~当只有上限值和下限值时-->
            <div v-else-if="row.uppervalue&&row.lowervalue">({{ row.lowervalue }}~{{ row.uppervalue }})</div>
            <!--            ~当只有标准值时     -->
            <div v-else-if="row.standvalue">{{ row.standvalue }}</div>
            <!--            ~当只有上限值时       -->
            <div v-else-if="row.uppervalue">(~{{ row.uppervalue }})</div>
            <!--            ~当只有下限值时      -->
            <div v-else-if="row.lowervalue">({{ row.lowervalue }}~)</div>
            <div v-else>/</div>
          </template>
        </el-table-column>
        <el-table-column
          v-for="(item,index) in dialogTableArrayCol"
          :key="index+dialogTableData"
          :prop="(index+1)+'/'+ dialogTableNumberCol"
          :label="'第'+(index+1)+'件'"
          show-tooltip-when-overflow
          min-width="100"
        >
          <template slot-scope="{row}">
            <div style="display: flex;align-items: center">
              <i
                :class="row.check_result==='OK'?'el-icon-success':'el-icon-error'"
                :style="{color:row.check_result==='OK'?$store.state.settings.theme:'red'}"
                style="margin-right: 2px"
              />
              {{ row[(index + 1) + '/' + dialogTableNumberCol] }}
            </div>
            <!--            &lt;!&ndash;        ~当三个值都有    &ndash;&gt;-->
            <!--            <div v-if="row.standvalue&&row.uppervalue&&row.lowervalue&&parseFloat(row[(index + 1) + '/' + dialogTableNumberCol])>=parseFloat(row.lowervalue)&&parseFloat(row[(index + 1) + '/' + dialogTableNumberCol])<=parseFloat(row.uppervalue)">-->
            <!--              &lt;!&ndash;            <div v-if="row[(index + 1) + '/' + dialogTableNumberCol]>=row.lowervalue&&row[(index + 1) + '/' + dialogTableNumberCol]<=row.uppervalue">&ndash;&gt;-->
            <!--              <div style="display: flex;align-items: center">-->
            <!--                <i class="el-icon-success" :style="{color:$store.state.settings.theme}" style="margin-right: 2px" />-->
            <!--                {{ row[(index + 1) + '/' + dialogTableNumberCol] }}-->
            <!--              </div>-->
            <!--            </div>-->
            <!--            &lt;!&ndash;            ~当只有标准值和上限值时  &ndash;&gt;-->
            <!--            <div v-else-if="row.standvalue&&row.uppervalue&&row.lowervalue===''&&parseFloat(row[(index + 1) + '/' + dialogTableNumberCol])<=parseFloat(row.uppervalue)">-->
            <!--              <div style="display: flex;align-items: center">-->
            <!--                <i class="el-icon-success" :style="{color:$store.state.settings.theme}" style="margin-right: 2px" />-->
            <!--                {{ row[(index + 1) + '/' + dialogTableNumberCol] }}-->
            <!--              </div>-->
            <!--            </div>-->
            <!--            &lt;!&ndash;            ~当只有标准值和下限值时&ndash;&gt;-->
            <!--            <div v-else-if="row.standvalue&&row.lowervalue&&row.uppervalue===''&&parseFloat(row[(index + 1) + '/' + dialogTableNumberCol])>=parseFloat(row.lowervalue)">-->
            <!--              <div style="display: flex;align-items: center">-->
            <!--                <i class="el-icon-success" :style="{color:$store.state.settings.theme}" style="margin-right: 2px" />-->
            <!--                {{ row[(index + 1) + '/' + dialogTableNumberCol] }}-->
            <!--              </div>-->
            <!--            </div>-->
            <!--            &lt;!&ndash;            ~当只有上限值和下限值时&ndash;&gt;-->
            <!--            <div v-else-if="row.uppervalue&&row.lowervalue&&row.standvalue===''&&parseFloat(row[(index + 1) + '/' + dialogTableNumberCol])>=parseFloat(row.lowervalue)&&parseFloat(row[(index + 1) + '/' + dialogTableNumberCol])<=parseFloat(row.uppervalue)">-->
            <!--              <div style="display: flex;align-items: center">-->
            <!--                <i class="el-icon-success" :style="{color:$store.state.settings.theme}" style="margin-right: 2px" />-->
            <!--                {{ row[(index + 1) + '/' + dialogTableNumberCol] }}-->
            <!--              </div>-->
            <!--            </div>-->
            <!--            &lt;!&ndash;            ~当只有标准值时     &ndash;&gt;-->
            <!--            <div v-else-if="row.standvalue&&row.uppervalue===''&&row.lowervalue===''&&parseFloat(row[(index + 1) + '/' + dialogTableNumberCol])===parseFloat(row.standvalue)">-->
            <!--              <div style="display: flex;align-items: center">-->
            <!--                <i class="el-icon-success" :style="{color:$store.state.settings.theme}" style="margin-right: 2px" />-->
            <!--                {{ row[(index + 1) + '/' + dialogTableNumberCol] }}-->
            <!--              </div>-->
            <!--            </div>-->
            <!--            &lt;!&ndash;            ~当只有上限值时       &ndash;&gt;-->
            <!--            <div v-else-if="row.uppervalue&&row.lowervalue===''&&row.standvalue===''&&parseFloat(row[(index + 1) + '/' + dialogTableNumberCol])<=parseFloat(row.uppervalue)">-->
            <!--              <div style="display: flex;align-items: center">-->
            <!--                <i class="el-icon-success" :style="{color:$store.state.settings.theme}" style="margin-right: 2px" />-->
            <!--                {{ row[(index + 1) + '/' + dialogTableNumberCol] }}-->
            <!--              </div>-->
            <!--            </div>-->
            <!--            &lt;!&ndash;            ~当只有下限值时      &ndash;&gt;-->
            <!--            <div v-else-if="row.lowervalue&& row.uppervalue===''&&row.standvalue===''&&parseFloat(row[(index + 1) + '/' + dialogTableNumberCol])>=parseFloat(row.lowervalue)">-->
            <!--              <div style="display: flex;align-items: center">-->
            <!--                <i class="el-icon-success" :style="{color:$store.state.settings.theme}" style="margin-right: 2px" />-->
            <!--                {{ row[(index + 1) + '/' + dialogTableNumberCol] }}-->
            <!--              </div></div>-->
            <!--            <div v-else>-->
            <!--              <div style="display: flex;align-items: center">-->
            <!--                <i class="el-icon-error" style="color: red;margin-right: 2px" />-->
            <!--                {{ row[(index + 1) + '/' + dialogTableNumberCol] }}-->
            <!--              </div>-->
            <!--            </div>-->
          </template>
        </el-table-column>
      </el-table>
      <span slot="footer" class="dialog-footer">
        <div class="footerButton">
          <el-button v-waves @click="dialogVisible=false">返 回</el-button>
@@ -263,30 +424,20 @@
      </span>
    </el-dialog>
    <!--导入组件-->
    <import-picker
      ref="importPickerFunc"
      class="importPickerClass"
      :shows.sync="shows"
      :title="title_value"
      :colos="colos"
      :code="code"
    />
  </div>
</template>
<script>
import Pagination from '@/components/Pagination'
import { getCookie } from '@/utils/auth'
import ImportPicker from '@/components/ImportPicker'
import { handleDatetime, validateCode } from '@/utils/global'
import { handleDatetime } from '@/utils/global'
import {
  GroupSalaryReportSearchUser, MaintenanceDetailsReportExcelSearch, LogisticsCheckSearch
  MaintenanceDetailsReportExcelSearch, LogisticsCheckSearch, LogisticsCheckSubSearch
} from '@/api/reportManager'
import elDragDialog from '@/directive/el-drag-dialog'
import waves from '@/directive/waves'
import { MesOrderStepReportSelectUserGroup } from '@/api/produceManager'
import { PurchSupplierSelect } from '@/api/basicInfo'
export default {
  name: 'Zzjg',
@@ -327,40 +478,15 @@
      total: 10,
      tableData: [],
      dialogVisible: false,
      tagArr: [], //
      dialogForm: {
        OrgType: '',
        OrgCode: '',
        OrgName: '',
        SupUnit: ''// 上级单位
      },
      operation: '',
      dialogFormRules: {
        OrgType: [
          { required: true, message: '请输入选择类型', trigger: ['blur', 'change'] }
        ],
        OrgCode: [
          { required: true, validator: validateCode, trigger: ['blur', 'change'] }
        ],
        OrgName: [
          { required: true, message: '请输入名称', trigger: ['blur', 'change'] }
        ]
      },
      title_value: '数据导入 / 点检部位',
      code: '4',
      shows: false
      dialogTableData: [],
      dialogTableNumberCol: 0, // 对话框动态的列数
      dialogTableArrayCol: []// 对话框动态的数组
    }
  },
  watch: {
    shows() {
      if (!this.shows) {
        this.getLogisticsCheckSearch()
      }
    }
  },
  created() {
    this.handleRequest()
  },
@@ -446,14 +572,7 @@
    search() {
      this.getLogisticsCheckSearch()
    },
    // 导入按钮
    upload() {
      this.shows = true
      this.$refs.importPickerFunc.newDataFunc()
    },
    colos() {
      this.shows = false
    },
    // 重置
    reset() {
      this.form.checktypecode = ''
@@ -469,77 +588,42 @@
    },
    // 新增按钮
    add(operation) {
      this.operation = operation
      this.dialogVisible = true
    },
    // add(operation) {
    //   this.operation = operation
    //   this.dialogVisible = true
    // },
    // 修改按钮
    async edit(operation, row) {
      this.operation = operation
      this.dialogVisible = true
      const { data: res } = await LogisticsCheckSubSearch({ checkid: row.id })
      this.dialogTableData = res
      const res = await GroupSalaryReportSearchUser({ id: row.id })
      this.tagArr = res.data.map(r => r.checkuser)
      // 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.getLogisticsCheckSearch()
      //     }
      //   })
      // }).catch(() => {
      //   this.$message.info('已取消删除')
      // })
      this.dialogTableData.forEach((item, index) => {
        for (const it in item) {
          if (it.indexOf('/') !== -1) {
            const i = it.split('/')[1]
            this.dialogTableNumberCol = i
          }
        }
      })
      this.dialogTableArrayCol = []
      for (let i = 0; i < this.dialogTableNumberCol; i++) {
        this.dialogTableArrayCol.push(i)
      }
      this.$nextTick(() => {
        this.$refs.tableDataRef2.doLayout()
      })
    },
    // 对话框关闭事件
    handleClose() {
      this.dialogForm.OrgType = ''
      this.dialogForm.OrgCode = ''
      this.dialogForm.OrgName = ''
      this.dialogForm.SupUnit = ''
      this.$refs.dialogForm.clearValidate()
      this.dialogTableData = []
    },
    // 对话框取消
    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.getLogisticsCheckSearch()
          //   } else {
          //     this.$message.error(this.operation === 'add' ? '添加失败!' : '修改失败!')
          //   }
          // })
        }
      })
    },
    // 获取页面高度
    getHeight() {
@@ -647,6 +731,7 @@
::v-deep .el-table__body-wrapper {
  background-color: #f8f8fa;
  z-index:2
}
::v-deep .el-table__body .el-table__row.hover-row td {
@@ -677,11 +762,12 @@
  justify-content: center;
}
.tableFixed{
  ::v-deep .el-table__fixed-right{
.tableFixed {
  ::v-deep .el-table__fixed-right {
    height: 100% !important;
  }
  ::v-deep .el-table__fixed{
  ::v-deep .el-table__fixed {
    height: 100% !important;
  }
}