loulijun2021
2022-07-19 d71436544198b7b051115662fc9cf4b12ce0cda3
src/views/zlgl/gxjyxm.vue
@@ -11,12 +11,11 @@
        >
          <div class="elForm">
            <el-form-item label="项目编码" style=" display: flex;">
              <el-input v-model="form.defectcode" placeholder="请输入" style="width: 200px" />
              <el-input v-model="form.itemcode" placeholder="请输入" style="width: 200px" />
            </el-form-item>
            <el-form-item label="项目名称" style=" display: flex;">
              <el-input v-model="form.itemname" placeholder="请输入" style="width: 200px" />
            </el-form-item>
            <el-form-item label="项目描述" style=" display: flex;">
              <el-input v-model="form.itemdescr" style="width: 200px" placeholder="请输入" />
            </el-form-item>
@@ -55,31 +54,18 @@
            label="序号"
          />
          <el-table-column
            prop="org_code"
            label="组织编码"
            prop="code"
            label="项目代码"
            sortable="custom"
          />
          <el-table-column
            prop="org_name"
            label="组织名称"
            prop="name"
            label="项目名称"
            sortable="custom"
          />
          <el-table-column
            prop="description"
            label="组织类型"
            sortable="custom"
          >
            <template slot-scope="{row}">
              <div v-if="row.description==='F'">工厂</div>
              <div v-if="row.description==='D'">部门</div>
              <div v-if="row.description==='W'">车间</div>
              <div v-if="row.description==='K'">科室</div>
              <div v-if="row.description==='L'">生产线</div>
            </template>
          </el-table-column>
          <el-table-column
            prop="parentorg_name"
            label="上级单位"
            prop="descr"
            label="项目描述"
            sortable="custom"
          />
          <el-table-column
@@ -126,14 +112,14 @@
      @close="handleClose"
    >
      <el-form ref="dialogForm" inline :rules="dialogFormRules" :model="dialogForm" label-width="80px">
        <el-form-item label="项目类型" prop="OrgCode">
          <el-input v-model="dialogForm.OrgCode" :disabled="operation!=='add'" style="width: 200px" />
        <el-form-item label="项目编码" prop="checkitemcode">
          <el-input v-model="dialogForm.checkitemcode" :disabled="operation!=='add'" style="width: 200px" />
        </el-form-item>
        <el-form-item label="项目名称" prop="OrgName">
          <el-input v-model="dialogForm.OrgName" style="width: 200px" />
        <el-form-item label="项目名称" prop="checkitemname">
          <el-input v-model="dialogForm.checkitemname" style="width: 200px" />
        </el-form-item>
        <el-form-item label="项目描述" prop="OrgName">
          <el-input v-model="dialogForm.OrgName" type="textarea" style="width: 200px" />
        <el-form-item label="项目描述" prop="checkitemdescr">
          <el-input v-model="dialogForm.checkitemdescr" type="textarea" style="width: 200px" />
        </el-form-item>
      </el-form>
      <span slot="footer" class="dialog-footer">
@@ -150,7 +136,7 @@
import Pagination from '@/components/Pagination'
import { AddUpdateOrganization, DeleteOrganization, OrganizationSearch, PrentOrganization } from '@/api/jcsz'
import { getCookie } from '@/utils/auth'
import { DedectSearch } from '@/api/zlgl'
import { AddUpdateStepCheckItem, DedectSearch, DeleteStepCheckItem, StepCheckItemSearch } from '@/api/zlgl'
const SER_HZ = /^[\u4e00-\u9fa5]+$/
export default {
@@ -182,37 +168,23 @@
        page: 1, // 第几页
        rows: 20 // 每页多少条
      },
      OrgTypeArr: [
        { label: '工厂', value: 'F' },
        { label: '部门', value: 'D' },
        { label: '车间', value: 'W' },
        { label: '科室', value: 'K' },
        { label: '生产线', value: 'L' }
      ],
      total: 10,
      tableData: [],
      dialogVisible: false,
      dialogForm: {
        OrgType: '',
        OrgCode: '',
        OrgName: '',
        SupUnit: ''// 上级单位
        checkitemcode: '', // 工序检验项目编码
        checkitemname: '', // 工序检验项目名称
        checkitemdescr: '' // 工序检验项目描述
      },
      operation: '',
      dialogFormRules: {
        OrgType: [
          { required: true, message: '请输入选择类型', trigger: ['blur', 'change'] }
        ],
        OrgCode: [
        checkitemcode: [
          { required: true, validator: validateName, trigger: ['blur', 'change'] }
        ],
        OrgName: [
        checkitemname: [
          { required: true, message: '请输入名称', trigger: ['blur', 'change'] }
        ]
      }
    }
  },
  created() {
@@ -250,10 +222,9 @@
    },
    // 重置
    reset() {
      this.form.OrgCode = ''
      this.form.OrgName = ''
      this.form.OrgType = ''
      this.form.UserName = ''
      this.form.itemcode = ''
      this.form.itemname = ''
      this.form.itemdescr = ''
      this.getStepCheckItemSearch()
    },
@@ -268,9 +239,9 @@
      this.dialogVisible = true
      this.$nextTick(() => {
        this.dialogForm.OrgCode = row.org_code
        this.dialogForm.OrgName = row.org_name
        this.dialogForm.SupUnit = row.parent_id
        this.dialogForm.checkitemcode = row.code
        this.dialogForm.checkitemname = row.name
        this.dialogForm.checkitemdescr = row.descr
      })
    },
    // 删除按钮
@@ -280,7 +251,7 @@
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        DeleteOrganization({ orgid: row.code }).then(res => {
        DeleteStepCheckItem({ checkitemcode: row.code }).then(res => {
          if (res.code === '200') {
            this.$message.success('删除成功!')
            this.getStepCheckItemSearch()
@@ -292,10 +263,9 @@
    },
    // 对话框关闭事件
    handleClose() {
      this.dialogForm.OrgType = ''
      this.dialogForm.OrgCode = ''
      this.dialogForm.OrgName = ''
      this.dialogForm.SupUnit = ''
      this.dialogForm.checkitemcode = ''
      this.dialogForm.checkitemname = ''
      this.dialogForm.checkitemdescr = ''
      this.$refs.dialogForm.clearValidate()
    },
    // 对话框取消
@@ -307,12 +277,12 @@
      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')
            checkitemcode: this.dialogForm.checkitemcode,
            checkitemname: this.dialogForm.checkitemname,
            checkitemdescr: this.dialogForm.checkitemdescr,
            OperType: this.operation === 'add' ? 'Add' : 'Update'
          }
          AddUpdateOrganization(data).then(res => {
          AddUpdateStepCheckItem(data).then(res => {
            if (res.code === '200') {
              this.$message.success(this.operation === 'add' ? '添加成功!' : '修改成功!')
              this.dialogVisible = false