王震
2023-11-30 ea23138f302e72249d414a01410b1e5e97327904
src/views/quality/Packaging_ledger/index.vue
@@ -4,17 +4,17 @@
        <el-row>
            <el-col :span="11">
            <ttable
        :table="table"
        :isShowHide="true"
        :prelang="prelang"
        :options="options"
        ref="processconfiguration"
        >
            :table="table"
            :isShowHide="true"
            :prelang="prelang"
            :ajaxFun="ajaxFun"
            :options="options"
            @handleSelectionChange="handleCurrentChange"
            ref="processconfiguration"
            >
        <template #toolbar></template>
            </ttable>
            </el-col>
            <el-col :span="13" style="padding-left: 10px">
                <el-card>
                <div slot="header">
@@ -32,31 +32,21 @@
                    </el-button> -->
                    </el-col>
                    <el-col :span="2">
                    <!-- <el-button
                    <el-button
                        style="float: right; padding: 3px 0"
                        type="text"
                        :disabled="isSubmit"
                        v-thinclick="`dataFormTestStandardParam`"
                        v-if="editable"
                        @click="addpreserve"
                        >保存
                    </el-button> -->
                    </el-button>
                    </el-col>
                    <el-col :span="2">
                    <!-- <el-button
                    <el-button
                        style="float: right; padding: 3px 0"
                        type="text"
                        @click="relateOperationParam()"
                        v-if="editable"
                        >添加
                    </el-button> -->
                    </el-button>
                    </el-col>
                </el-row>
                <el-row>
                    <!-- <span style="font-weight:500" v-if="testNo.length > 0"
                    >您当前选择的检测标准编号是:<span style="color:#066EFF">{{
                        testNo
                    }}</span></span
                    > -->
                </el-row>
                </div>
                <el-table
@@ -77,80 +67,31 @@
                align="center"
                width="50"
              />
              <!-- <el-table-column
                label="是否引用工艺参数"
                prop="isReference"
                align="center"
              >
                <template slot-scope="scope">
                  <el-select
                    v-model="scope.row.isReference"
                    placeholder="请选择"
                    style="width: 100%;"
                  >
                    <el-option
                      v-for="(item, index) in referenceOptions"
                      :key="index"
                      :label="item.label"
                      :value="item.value"
                    >
                    </el-option>
                  </el-select>
                </template>
              </el-table-column>
              <el-table-column label="是否抽检" prop="isCheck" align="center">
                <template slot-scope="scope">
                  <el-select
                    v-model="scope.row.isCheck"
                    placeholder="请选择"
                    style="width: 100%;"
                  >
                    <el-option
                      v-for="(item, index) in isCheckOptions"
                      :key="index"
                      :label="item.label"
                      :value="item.value"
                    >
                    </el-option>
                  </el-select>
                </template>
              </el-table-column>
              <el-table-column
                label="线芯"
                prop="wireCore"
                align="center"
                width="60"
              >
                <template slot-scope="scope">
                  <el-input v-model="scope.row.wireCore"></el-input>
                </template>
              </el-table-column> -->
              <el-table-column label="参数编号" prop="code" align="center" />
              <el-table-column
                label="参数项"
                prop="parameterItem"
                label="产品"
                prop="product"
                align="center"
              />
              <el-table-column
                label="要求范围"
                prop="referenceValue"
                label="产品编号"
                prop="productNo"
                align="center"
              >
              </el-table-column>
              <el-table-column
                label="默认值"
                prop="defaultValue"
                label="规格型号"
                prop="specs"
                align="center"
              >
              </el-table-column>
              <el-table-column
                label="参数项类型"
                prop="paramType"
                label="单位"
                prop="unit"
                align="center"
              >
              </el-table-column>
              <el-table-column
                label="参数格式"
                label="数量"
                prop="parameterFormat"
                align="center"
                width="80"
@@ -158,36 +99,53 @@
                <template slot-scope="scope">
                  <el-input v-model="scope.row.parameterFormat"></el-input>
                </template>
              </el-table-column><el-table-column
                label="测试方法"
                prop="purpose"
                align="center"
                width="80"
              >
              </el-table-column>
              <el-table-column
                label="测试目的"
                prop="method"
                align="center"
                width="80"
              >
              </el-table-column>
              <el-table-column label="单位" prop="unit" align="center" />
              <el-table-column
                fixed="right"
                label="操作"
                align="center"
                width="80">
                <template slot-scope="scope">
                  <el-button @click="deleteadd(scope.row)"  size="small">删除</el-button>
                </template>
              </el-table-column>
            </el-table>
                </el-card>
            </el-col>
        </el-row>
        <!-- 新增 -->
        <packfrom
        :currshowlist.sync="addOrUpdateVisible"
        >
        </packfrom>
        <packfromadd
        :currshowlist.sync="increase"
        :packageBoxIddata ="packageBoxId"
        @handleSelectionChange = "preserve"
        >
        </packfromadd>
        </basic-container>
    </div>
</template>
<script>
import { pagedata,dropById,list,saveList,deledata} from '@/api/quality/Packaging_ledger'
import ttable from '@/views/common/ztt-table.vue'
import packfrom from './pack-from.vue'
import packfromadd from './pack-fromadd.vue'
export default {
    data(){
        return {
          goid:'',
          testStandardParams: [],
          packageBoxId:{},
            prelang: 'operation',
            dataListLoading: false,
            ajaxFun: pagedata,
            increase:false,
            addOrUpdateVisible:false,
            options: {
                height: 300, // 默认高度-为了表头固定
                stripe: true, // 是否为斑马纹 table
@@ -195,7 +153,8 @@
                border: true, // 是否有纵向边框
                lazy: false, // 是否需要懒加载
                fit: true, // 列的宽度是否自撑开
                multiSelect: true, //
                multiSelect: false, //
                isEdit:false,
                seqNo: true,
                isShowHide: true, // 是否显示显影按钮
                isRefresh: true, // 是否显示刷新按钮
@@ -209,49 +168,41 @@
                data: [],
                // 标题
                column: [
                {
                  minWidth: 'code',
                  prop: 'state',
                  label: '状态',
                  sort: true,
                  isTrue: true,
                  isSearch: true,
                  searchInfoType: 'text'
                },
                  {
                    minWidth: '140',
                    prop: 'oo',
                    label: '订单编号',
                    prop: 'packageNo',
                    label: '包装编号',
                    isTrue: true,
                    isSearch: true,
                    searchInfoType: 'text',
                  },{
                    minWidth: '140',
                    prop: 'materhhooial',
                    label: '质量追溯号',
                    prop: 'createUser',
                    label: '创建人',
                    isTrue: true,
                    isSearch: true,
                    searchInfoType: 'text',
                  },{
                    minWidth: '140',
                    prop: 'contractNo',
                    label: '合同号',
                    isTrue: true,
                    isSearch: true,
                    searchInfoType: 'text',
                  },
                  {
                    minWidth: '140',
                    prop: 'mateuurial',
                    label: '产品名称',
                    isTrue: true,
                    isSearch: true,
                    searchInfoType: 'text',
                  },
                  {
                    minWidth: '140',
                    prop: 'materoiial',
                    label: '规格型号',
                    isTrue: true,
                    isSearch: true,
                    searchInfoType: 'text',
                  },
                  {
                    minWidth: '140',
                    prop: 'matperoial',
                    label: '单位',
                    isTrue: true,
                    isSearch: true,
                    searchInfoType: 'text',
                  },
                  {
                    minWidth: '140',
                    prop: 'materpial',
                    label: '数量',
                    prop: 'updateUser',
                    label: '更新人',
                    isTrue: true,
                    isSearch: true,
                    searchInfoType: 'text',
@@ -259,8 +210,18 @@
                  {
                    minWidth: '130',
                    width: '150',
                    prop: 'dealTime',
                    label: '入库时间',
                    prop: 'updateTime',
                    label: '更新日期',
                    sort: true,
                    isTrue: true,
                    isSearch: true,
                    searchInfoType: 'datetimerange',
                },
                {
                    minWidth: '130',
                    width: '150',
                    prop: 'createTime',
                    label: '创建日期',
                    sort: true,
                    isTrue: true,
                    isSearch: true,
@@ -268,20 +229,107 @@
                },
                ],
                toolbar: [
                  {
                    text: 'xxx',
                    type: 'primary',
                  },
                    {
                      text: '新增',
                      type: 'primary',
                      fun: this.addOrUpdateHandle
                    },
                ],
                operator: [
                    {
                      text: '删除',
                      icon: 'el-icon-delete',
                      type: 'text',
                      size: 'small',
                      fun: this.deleteHandle
                    },{
                      text: 'xx',
                      icon: 'el-icon-delete',
                      type: 'text',
                      size: 'small',
                      // fun: this.deleteHandle
                    }
                  ],
                  operatorConfig: {
                    fixed: 'right',
                    label: '操作',
                    width: 120,
                    minWidth: 120
                  }
            },
       }
    },
    medthods: {},
//     computed: {
//     ...mapGetters(['permissions'])
//   },
    components: {
    ttable
        ttable,
        packfrom,
        packfromadd
        },
        watch: {
          // renovate() {
          //   if (this.innerVisible = false) {
          //     this.$nextTick(() => {
          //       this.getData()
          //     })
          //   }
          // }
      },
    methods: {
       // 获取数据列表
      getData() {
        this.$refs.processconfiguration.refreshData()
      },
      //add
      addOrUpdateHandle(){
        this.addOrUpdateVisible = true
      },
      //删除
      deleteHandle(row){
        dropById({id:row.id}).then((res) =>{
          this.getData()
          this.$message.error('删除成功')
        })
      },
      handleCurrentChange(row){
        console.log(row,"id");
        this.packageBoxId = {
          packageBoxId:row[0].id
        }
        this.goid = row[0].id
        list({packageBoxId:row[0].id}).then((res) =>{
          console.log(res,"nihaoa");
          this.testStandardParams = res.data.data
        })
      },
      //详情添加
      relateOperationParam(){
        this.increase = true
      },
      preserve(datalist){
        console.log(datalist);
        this.testStandardParams = datalist
      },
      addpreserve(){
        console.log(this.testStandardParams,"保存数据");
         this.testStandardParams.forEach(el => {
              el.packageBoxId =this.goid
         });
        console.log(this.testStandardParams,"niaho");
        saveList(this.testStandardParams).then((res) =>{
          console.log(res,"保存的");
          this.$message.success('保存成功')
          this.testStandardParams
        })
      },
      deleteadd(row){
          console.log(row,"");
          deledata({id:row.id}).then((res)=>{
          this.$message.success('删除成功')
          this.testStandardParams
          })
      }
    },
    computed: {
  },
}
</script>