loulijun2021
2023-03-01 681afc864f0c37f2f41eaf852853d024aecb66fb
1.质检方案开发完成
已修改2个文件
339 ■■■■ 文件已修改
src/views/zlgl/zjfa.vue 322 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/zzmx/wlqd.vue 17 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/zlgl/zjfa.vue
@@ -124,7 +124,12 @@
            sortable="custom"
          >
            <template slot-scope="{row}">
              <div v-if="row.status==='Y'"><i class="el-icon-success" :style="{color:$store.state.settings.theme}" style="margin-right:5px" />是</div>
              <div v-if="row.status==='Y'"><i
                class="el-icon-success"
                :style="{color:$store.state.settings.theme}"
                style="margin-right:5px"
              />是
              </div>
              <div v-else-if="row.status==='N'"><i class="el-icon-info" style="margin-right: 5px" />否</div>
              <div v-else>/</div>
            </template>
@@ -135,7 +140,7 @@
            sortable="custom"
          >
            <template slot-scope="{row}">
              <div v-if="row.checktype">{{ checktypeArr.find(i=>i.code===row.checktype).name }}</div>
              <div v-if="row.checktype">{{ checktypeArr.find(i => i.code === row.checktype).name }}</div>
              <div v-else>/</div>
            </template>
          </el-table-column>
@@ -145,7 +150,7 @@
            sortable="custom"
          >
            <template slot-scope="{row}">
              <div v-if="row.sampmethod">{{ sampltypeArr.find(i=>i.code===row.sampmethod).name }}</div>
              <div v-if="row.sampmethod">{{ sampltypeArr.find(i => i.code === row.sampmethod).name }}</div>
              <div v-else>/</div>
            </template>
          </el-table-column>
@@ -155,7 +160,7 @@
            sortable="custom"
          >
            <template slot-scope="{row}">
              <div v-if="row.suitobject">{{ suitobjectArr.find(i=>i.code===row.suitobject).name }}</div>
              <div v-if="row.suitobject">{{ suitobjectArr.find(i => i.code === row.suitobject).name }}</div>
              <div v-else>/</div>
            </template>
          </el-table-column>
@@ -227,14 +232,15 @@
        <el-form-item label="质检方案编码" prop="qualityinsptcode">
          <el-input v-model="dialogForm.qualityinsptcode" :disabled="operation!=='add'" style="width: 200px" />
        </el-form-item>
        <el-form-item label="质检方案名称" prop="stepcheckitem_name">
          <el-input v-model="dialogForm.stepcheckitem_name" style="width: 200px" />
        <el-form-item label="质检方案名称" prop="qualityinsptname">
          <el-input v-model="dialogForm.qualityinsptname" style="width: 200px" />
        </el-form-item>
        <br>
        <el-form-item prop="status" label="有效状态">
          <el-select
            v-model="dialogForm.status"
            style="width: 200px"
            placeholder="请选择"
            :popper-append-to-body="false"
          >
@@ -264,21 +270,48 @@
          </el-radio-group>
        </el-form-item>
        <el-form-item v-if="dialogForm.sampmethod==='FIXED'" label="样本数量" prop="sampnum">
          <el-input v-model="dialogForm.sampnum" style="width: 200px" />
          <el-input v-model="dialogForm.sampnum" oninput="value=value.replace(/[^0-9]/g,'')" style="width: 200px" />
        </el-form-item>
        <el-form-item v-if="dialogForm.sampmethod==='SCARE'" label="抽检比例" prop="sampscale">
          <el-input v-model="dialogForm.sampscale" style="width: 180px" />
          <el-input v-model="dialogForm.sampscale" oninput="value=value.replace(/[^0-9]/g,'')" style="width: 180px" />
          %
        </el-form-item>
        <br>
        <el-form-item prop="suitobject" label="适用对象">
          <el-radio-group v-model="dialogForm.suitobject" style="width: 200px;">
          <el-radio-group v-model="dialogForm.suitobject" style="width: 200px;" @change="suitobjectChange">
            <el-radio label="PY">物料类别</el-radio>
            <el-radio label="P">物料</el-radio>
          </el-radio-group>
        </el-form-item>
        <el-form-item prop="suitpart" :label="dialogForm.suitobject==='P'?'适用物料':'适用物料类别'">
          <el-input v-model="dialogForm.suitpart" style="width: 200px;" />
        <el-form-item
          prop="suitpart"
          :label="dialogForm.suitobject==='Y'?'适用物料':'适用物料类别'"
        >
          <el-select
            v-model="dialogForm.suitpart"
            style="width: 200px"
            multiple
            filterable
            collapse-tags
            placeholder="请选择"
            :popper-append-to-body="false"
          >
            <el-option
              v-for="item in PartSelectArr"
              v-if="dialogForm.suitobject==='P'"
              :key="item.partcode"
              :label="item.partname"
              :value="item.partcode"
            />
            <el-option
              v-for="item in StockTypeSelectArr"
              v-if="dialogForm.suitobject==='PY'"
              :key="item.code"
              :label="item.name"
              :value="item.code"
            />
          </el-select>
        </el-form-item>
        <br>
        <el-form-item label="检验方案描述">
@@ -296,6 +329,7 @@
        </div>
        <div>质检列表:</div>
        <el-button
          v-if="operation!=='check'"
          v-waves
          type="primary"
          style="margin-left: 20px;"
@@ -306,7 +340,7 @@
      </div>
      <el-table
        ref="tableDataRef"
        ref="tableDataRef2"
        class="tableFixed"
        :data="checkitem"
        height="250"
@@ -391,7 +425,10 @@
                :value="item.code"
              />
            </el-select>
            <div v-if="row.isVisible===0">{{ CheckItemSelectAllArr.find(i => i.code === row.stepcheckitem_code).name }}</div>
            <div v-else>{{
              CheckItemSelectAllArr.find(i => i.code === row.stepcheckitem_code).name
            }}
            </div>
          </template>
        </el-table-column>
@@ -414,7 +451,7 @@
                :value="item.code"
              />
            </el-select>
            <div v-if="row.isVisible===0">{{ row.required === 'Y' ? '是' : '否' }}</div>
            <div v-else>{{ row.required === 'Y' ? '是' : '否' }}</div>
          </template>
        </el-table-column>
        <el-table-column
@@ -437,7 +474,7 @@
                :value="item.code"
              />
            </el-select>
            <div v-if="row.isVisible===0">{{ row.numberjudge === 'Y' ? '是' : '否' }}</div>
            <div v-else>{{ row.numberjudge === 'Y' ? '是' : '否' }}</div>
          </template>
        </el-table-column>
        <el-table-column
@@ -445,24 +482,31 @@
          label="单位"
        >
          <template slot-scope="{row}">
            <el-select
            <!--            <el-select-->
            <!--              v-if="row.isVisible===1"-->
            <!--              v-model="row.unit"-->
            <!--              filterable-->
            <!--              :disabled="row.numberjudge==='N'"-->
            <!--              placeholder="请选择"-->
            <!--            >-->
            <!--              <el-option-->
            <!--                v-for="item in UomSelectArr"-->
            <!--                :key="item.code"-->
            <!--                :label="item.name"-->
            <!--                :value="item.code"-->
            <!--              />-->
            <!--            </el-select>-->
            <!--            <div v-if="row.isVisible===0">{{-->
            <!--                row.numberjudge === 'Y' ? UomSelectArr.find(i => i.code === row.unit).name : '/'-->
            <!--              }}-->
            <!--            </div>-->
            <el-input
              v-if="row.isVisible===1"
              v-model="row.unit"
              filterable
              :disabled="row.numberjudge==='N'"
              placeholder="请选择"
            >
              <el-option
                v-for="item in UomSelectArr"
                :key="item.code"
                :label="item.name"
                :value="item.code"
              />
            </el-select>
            <div v-if="row.isVisible===0">{{
              row.numberjudge === 'Y' ? UomSelectArr.find(i => i.code === row.unit).name : '/'
            }}
            </div>
              :disabled="row.numberjudge==='N'"
            />
            <div v-else>{{ row.unit?row.unit:'/' }}</div>
          </template>
        </el-table-column>
        <el-table-column
@@ -491,7 +535,7 @@
              oninput="value=value.replace(/[^0-9]/g,'')"
              placeholder="请输入"
            />
            <div v-if="row.isVisible===0">{{ row.numberjudge === 'Y' ? row.decimalnum : '/' }}</div>
            <div v-else>{{ row.numberjudge === 'Y' ? row.decimalnum : '/' }}</div>
          </template>
        </el-table-column>
        <el-table-column
@@ -506,7 +550,7 @@
              oninput="value=value.replace(/[^0-9.]/g,'')"
              placeholder="请输入"
            />
            <div v-if="row.isVisible===0">{{ row.standvalue ? row.standvalue : '/' }}</div>
            <div v-else>{{ row.standvalue ? row.standvalue : '/' }}</div>
          </template>
        </el-table-column>
        <el-table-column
@@ -521,7 +565,7 @@
              oninput="value=value.replace(/[^0-9.]/g,'')"
              placeholder="请输入"
            />
            <div v-if="row.isVisible===0">{{ row.uppervalue ? row.uppervalue : '/' }}</div>
            <div v-else>{{ row.uppervalue ? row.uppervalue : '/' }}</div>
          </template>
        </el-table-column>
        <el-table-column
@@ -536,7 +580,7 @@
              oninput="value=value.replace(/[^0-9.]/g,'')"
              placeholder="请输入"
            />
            <div v-if="row.isVisible===0">{{ row.lowervalue ? row.lowervalue : '/' }}</div>
            <div v-else>{{ row.lowervalue ? row.lowervalue : '/' }}</div>
          </template>
        </el-table-column>
        <el-table-column
@@ -549,20 +593,21 @@
              v-model="row.stepcheckitem_desc"
              placeholder="请输入"
            />
            <div v-if="row.isVisible===0">{{ row.stepcheckitem_desc ? row.stepcheckitem_desc : '/' }}</div>
            <div v-else>{{ row.stepcheckitem_desc ? row.stepcheckitem_desc : '/' }}</div>
          </template>
        </el-table-column>
        <el-table-column
          v-if="operation!=='check'"
          label="操作"
          width="120"
          fixed="right"
        >
          <template slot-scope="{row}">
            <div class="operationClass">
              <el-button v-if="row.isVisible===0" v-waves type="text" @click="editZjlbRow(row)">编辑</el-button>
              <el-button v-if="row.isVisible===0" v-waves type="text" @click="delZjlbRow(row)">删除</el-button>
              <el-button v-if="row.isVisible===1" v-waves type="text" @click="saveZjlbRow(row)">保存</el-button>
              <el-button v-if="row.isVisible===1" v-waves type="text" @click="cancelZjlbRow(row)">取消</el-button>
              <el-button v-if="row.isVisible===1" v-waves type="text" @click="saveZjlbRow(row)">确认</el-button>
              <el-button v-if="row.isVisible===1&&isCancel" v-waves type="text" @click="cancelZjlbRow(row)">取消</el-button>
              <el-button v-if="row.isVisible!==1" v-waves type="text" @click="editZjlbRow(row)">编辑</el-button>
              <el-button v-if="row.isVisible!==1" v-waves type="text" @click="delZjlbRow(row)">删除</el-button>
            </div>
          </template>
        </el-table-column>
@@ -570,8 +615,16 @@
      <span slot="footer" class="dialog-footer">
        <div class="footerButton">
          <el-button v-waves @click="dialogVisibleCancel">取 消</el-button>
          <el-button v-waves type="primary" @click="dialogVisibleConfirm">确 定</el-button>
          <el-button v-if="operation!=='check'" v-waves @click="dialogVisibleCancel">取 消</el-button>
          <el-button
            v-if="operation!=='check'"
            v-waves
            :loading="$store.state.app.buttonIsDisabled"
            :disabled="$store.state.app.buttonIsDisabled"
            type="primary"
            @click="dialogVisibleConfirm"
          >保 存</el-button>
          <el-button v-if="operation==='check'" v-waves @click="dialogVisibleCancel">返 回</el-button>
        </div>
      </span>
    </el-dialog>
@@ -581,14 +634,16 @@
<script>
import Pagination from '@/components/Pagination'
import { AddUpdateOrganization, DeleteOrganization, OrganizationSearch, PrentOrganization } from '@/api/jcsz'
import { getCookie } from '@/utils/auth'
import { validateCode } from '@/utils/global'
import elDragDialog from '@/directive/el-drag-dialog'
import waves from '@/directive/waves'
import { UomSelect } from '@/api/zzmx'
import { QualityInspectionDelete, QualityInspectionSearch, StepCheckItemSelect } from '@/api/zlgl'
import { PartSelect, StockTypeSelect, UomSelect } from '@/api/zzmx'
import {
  QualityInspectionAddEditSave,
  QualityInspectionDelete,
  QualityInspectionSearch, QualityInspectionSeeEdit,
  StepCheckItemSelect
} from '@/api/zlgl'
export default {
  name: 'Zzjg',
@@ -609,7 +664,7 @@
        checktype: '', // 质检类型
        sampltype: '', // 抽样方式
        suitobject: '', // 适用对象
        prop: 'code', // 排序字段
        prop: 'lm_date', // 排序字段
        order: 'desc', // 排序字段
        page: 1, // 第几页
        rows: 20 // 每页多少条
@@ -634,14 +689,14 @@
      dialogVisible: false,
      dialogForm: {
        qualityinsptcode: '', // 质检方案编码
        stepcheckitem_name: '', // 质检方案名称
        qualityinsptname: '', // 质检方案名称
        status: 'Y', // 有效状态
        checktype: '', // 检验类型
        sampmethod: 'FIXED', // 抽检方式
        sampnum: '', // 样本数量
        sampscale: '', // 抽检比例
        suitobject: 'P', // 适用对象
        suitpart: '', // 适用物料
        suitpart: [], // 适用物料
        descr: '' // /描述
      },
      operation: '',
@@ -652,7 +707,7 @@
        qualityinsptcode: [
          { required: true, validator: validateCode, trigger: ['blur', 'change'] }
        ],
        stepcheckitem_name: [
        qualityinsptname: [
          { required: true, message: '请输入质检方案名称', trigger: ['blur', 'change'] }
        ],
        checktype: [
@@ -671,7 +726,7 @@
          { required: true, message: '请选择适用对象', trigger: ['blur', 'change'] }
        ],
        suitpart: [
          { required: true, message: '请输入适用物料', trigger: ['blur', 'change'] }
          { required: true, message: '请选择物料或物料类别', trigger: ['blur', 'change'] }
        ]
      },
      checkitem: [],
@@ -681,9 +736,13 @@
        { code: 'N', name: '否' }
      ],
      PartSelectArr: [], // 物料下拉数组
      StockTypeSelectArr: [], // 物料类别下拉数组
      UomSelectArr: [], // 单位下拉数组
      CheckItemSelectAllArr: [], // 检验项目(所有)
      CheckItemSelectArr: []// 检验项目
      CheckItemSelectArr: [], // 检验项目
      isCancel: true// 是否可取消
    }
  },
@@ -699,8 +758,10 @@
    handleRequest() {
      this.getQualityInspectionSearch().then(res => {
        if (res.code === '200') {
          this.getUomSelect()
          // this.getUomSelect()
          this.getStepCheckItemSelect()
          this.getPartSelect()
          this.getStockTypeSelect()
        }
      })
    },
@@ -711,6 +772,7 @@
      return { code: res.code }
    },
    // 排序改变时
    sortChange({ column, prop, order }) {
      if (order === 'descending') {
@@ -745,19 +807,72 @@
      this.dialogVisible = true
    },
    // 查看
    check(operation, row) {
    async check(operation, row) {
      this.operation = operation
      this.dialogVisible = true
    },
    // 修改按钮
    edit(operation, row) {
      this.operation = operation
      this.dialogVisible = true
      const { data: res } = await QualityInspectionSeeEdit({ qualityinsptcode: row.code })
      this.$nextTick(() => {
        this.dialogForm.qualityinsptcode = row.code
        this.dialogForm.qualityinsptname = row.name
        // this.dialogForm.SupUnit = row.parent_id
        this.dialogForm.status = row.status
        this.dialogForm.checktype = row.checktype
        this.dialogForm.sampmethod = row.sampmethod
        // this.dialogForm.sampscare =  row.sampscare
        if (this.dialogForm.sampmethod === 'FIXED') {
          this.dialogForm.sampnum = row.sampscare
        } else {
          this.dialogForm.sampscale = row.sampscare
        }
        this.dialogForm.suitobject = row.suitobject
        this.dialogForm.suitpart = row.suitpart.split(',')
        this.dialogForm.descr = row.descr
        this.checkitem = res
        this.$refs.tableDataRef2.doLayout()
      })
    },
    // 修改按钮
    async  edit(operation, row) {
      this.operation = operation
      this.dialogVisible = true
      const { data: res } = await QualityInspectionSeeEdit({ qualityinsptcode: row.code })
      const tempCodeArr = []
      res.forEach(i => {
        let number = Math.random() * Math.random()// 作为删除时的标识符
        number = number === 0 ? (10 + Math.random()) : number
        i.number = number
        i.isVisible = 0
        tempCodeArr.push(i.stepcheckitem_code)
      })
      this.CheckItemSelectArr = []
      this.CheckItemSelectAllArr.forEach(i => {
        if (!tempCodeArr.includes(i.code)) {
          this.CheckItemSelectArr.push(i)
        }
      })
      this.$nextTick(() => {
        this.dialogForm.qualityinsptcode = row.code
        this.dialogForm.qualityinsptname = row.name
        this.dialogForm.status = row.status
        this.dialogForm.checktype = row.checktype
        this.dialogForm.sampmethod = row.sampmethod
        if (this.dialogForm.sampmethod === 'FIXED') {
          this.dialogForm.sampnum = row.sampscare
        } else {
          this.dialogForm.sampscale = row.sampscare
        }
        this.dialogForm.suitobject = row.suitobject
        this.dialogForm.suitpart = row.suitpart.split(',')
        this.dialogForm.descr = row.descr
        this.checkitem = res
        // console.log(this.checkitem, 2)
        this.$refs.tableDataRef2.doLayout()
      })
    },
    // 删除按钮
@@ -780,10 +895,24 @@
        this.$message.info('已取消删除')
      })
    },
    // 物料下拉
    async getPartSelect() {
      const { data: res } = await PartSelect()
      this.PartSelectArr = res
    },
    // 物料类别下拉
    async getStockTypeSelect() {
      const { data: res } = await StockTypeSelect()
      this.StockTypeSelectArr = res
    },
    // 获取单位下拉接口
    async getUomSelect() {
      const { data: res } = await UomSelect()
      this.UomSelectArr = res
    },
    // 适用对象值改变是
    suitobjectChange() {
      this.dialogForm.suitpart = []
    },
    // 获取检验项目下拉接口
    async getStepCheckItemSelect() {
@@ -821,7 +950,7 @@
      let number = Math.random() * Math.random()// 作为删除时的标识符
      number = number === 0 ? (10 + Math.random()) : number
      this.checkitem.unshift({
      this.checkitem.push({
        number,
        isVisible: 1,
        // jyxmbm: '',
@@ -861,6 +990,8 @@
      }
      this.CheckItemSelectArr = this.CheckItemSelectArr.filter(i => i.code !== row.stepcheckitem_code)
      row.isVisible = 0
      this.isCancel = true
    },
    // 取消行
    cancelZjlbRow(row) {
@@ -871,25 +1002,27 @@
      if (this.checkitem.find(i => i.isVisible === 1)) {
        return this.$message.info('请先保存当前行数据!')
      }
      row.isVisible = 1
      this.isCancel = false
      const t = this.CheckItemSelectAllArr.find(i => i.code === row.stepcheckitem_code)
      this.CheckItemSelectArr.unshift(t)
      row.isVisible = 1
    },
    // 对话框关闭事件
    handleClose() {
      this.dialogForm = {
        qualityinsptcode: '',
        stepcheckitem_name: '',
        qualityinsptname: '',
        status: 'Y',
        checktype: '',
        sampmethod: 'FIXED',
        sampnum: '',
        sampscale: '',
        suitobject: 'P',
        suitpart: '',
        suitpart: [],
        descr: ''
      }
      this.isCancel = true
      this.checkitem = []
      this.$refs.dialogForm.clearValidate()
    },
@@ -902,23 +1035,50 @@
    dialogVisibleConfirm() {
      this.$refs.dialogForm.validate(valid => {
        if (valid) {
          console.log(this.dialogForm, 'dialogForm')
          console.log(this.checkitem, 'checkitem')
          // const data = {
          //   OrganCode: this.dialogForm.qualityinsptcode,
          //   OrganName: this.dialogForm.qualityinsptname,
          //   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.getQualityInspectionSearch()
          //   } else {
          //     this.$message.error(this.operation === 'add' ? '添加失败!' : '修改失败!')
          //   }
          // })
          if (this.checkitem.length < 1) {
            return this.$message.info('质检列表不能为空!')
          }
          const checkitem = []
          this.checkitem.forEach((item, index) => {
            checkitem.push({
              stepcheckitem_seq: index + 1,
              stepcheckitem_code: item.stepcheckitem_code,
              stepcheckitem_desc: item.stepcheckitem_desc,
              required: item.required,
              numberjudge: item.numberjudge,
              unit: item.unit,
              decimalnum: item.decimalnum,
              standvalue: item.standvalue,
              uppervalue: item.uppervalue,
              lowervalue: item.lowervalue
            })
          })
          const data = {
            qualityinsptcode: this.dialogForm.qualityinsptcode,
            qualityinsptname: this.dialogForm.qualityinsptname,
            status: this.dialogForm.status,
            checktype: this.dialogForm.checktype,
            sampmethod: this.dialogForm.sampmethod,
            sampscare: this.dialogForm.sampnum ? this.dialogForm.sampnum : this.dialogForm.sampscale,
            suitobject: this.dialogForm.suitobject,
            suitpart: this.dialogForm.suitpart.join(','),
            type: this.operation === 'add' ? 'Add' : 'Update',
            descr: this.dialogForm.descr,
            checkitem
          }
          this.$store.state.app.buttonIsDisabled = true
          QualityInspectionAddEditSave(data).then(res => {
            if (res.code === '200') {
              this.$message.success(this.operation === 'add' ? '保存成功!' : '修改成功!')
              this.dialogVisible = false
              this.getQualityInspectionSearch()
              this.$store.state.app.buttonIsDisabled = false
            } else {
              this.$message.error(this.operation === 'add' ? '保存失败!' : '修改失败!')
            }
          })
        }
      })
    },
src/views/zzmx/wlqd.vue
@@ -213,20 +213,21 @@
          >
            <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('preview',row)"
                  />
                </el-tooltip>
                <el-tooltip class="item" effect="dark" content="编辑" placement="top">
                  <i :style="{color:$store.state.settings.theme}" class="el-icon-edit-outline" @click="edit('edit',row)" />
                </el-tooltip>
                <el-tooltip v-del-tab-index class="item" effect="dark" content="删除" placement="top">
                  <i :style="{color:$store.state.settings.theme}" class="el-icon-delete" @click="del(row)" />
                </el-tooltip>
                <el-tooltip class="item" effect="dark" content="预览" placement="top">
                  <i
                    class="el-icon-view"
                    :style="{color:$store.state.settings.theme}"
                    style="margin-left:15px;cursor: pointer;"
                    @click="edit('preview',row)"
                  />
                </el-tooltip>
              </div>
            </template>
          </el-table-column>