guoyuji
2024-02-27 37532f5802eae207940b8bd9812ee0b4ca308d65
north-glass-erp/northglass-erp/src/views/sd/product/SelectProduct.vue
@@ -15,14 +15,14 @@
//监听玻璃类型改变
let productList = ref([])
let date=ref(['',''])
productGlassTypeStore.GlassType=['','']
let props = defineProps({
  rowIndex:{}
})
let glassType = ref([])
watch(productGlassTypeStore,(newVal,oldVal) => {
})
const getProduct = () => {
  request.post(`/product/1/100/${productGlassTypeStore.GlassType}`,filterData.value).then((res) => {
    if(res.code==200){
@@ -144,7 +144,28 @@
    ElMessage.warning(res.msg)
  }
})
//删除与编辑方法
const getTableRow =  (row,type) => {
  switch (type) {
    case 'edit': {
      router.push({path:'/main/product/createProduct',query:{id:row.id}})
      break
    }
    case 'delete': {
      request.post(`/product/deleteProductById/${row.id}`).then((res) => {
        if(res.code==200){
          //router.push("/main/product/selectProduct")
          router.go(0)
          ElMessage.success('删除成功')
        }else{
          ElMessage.warning(res.msg)
        }
      })
      break
    }
  }
}
@@ -184,8 +205,9 @@
  },
  columns:[
    {type:'expand',fixed:"left",slots: { content:'content' },width: 60},
    {type: 'seq',fixed:"left", title: '自序', width: 80 },
    {title: '操作', width: 110, slots: { default: 'button_slot' },fixed:"left"},
    {field:'state',title: '审核', width: 40, slots: { default: 'state' }},
    {type: 'seq',fixed:"left", title: '自序', width: 80 },
    {field: 'id', title: '编号',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: false},
    {field: 'productName', title: '名称',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: false},
    {field: 'basicGlassType.typeName', title: '所属类别',filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: false},
@@ -250,8 +272,13 @@
  })
}
let emit = defineEmits([
    'getProductRow'
])
const emitParent = (row) => {
  emit('getProductRow', row)
}
/*后端返回结果多层嵌套展示*/
@@ -341,7 +368,7 @@
        <ul class="expand-wrapper">
          <li  v-for="(item,index) in gridOptions.columns" v-show="item.field!=undefined ">
            <span style="font-weight: bold">{{item.title+':  '}}</span>
            <span v-if="hasDecimal(item.field)">{{ row[item.field.split('.')[0]][item.field.split('.')[1]] }}</span>
            <span v-if="hasDecimal(item.field)">{{ row[item.field] }}</span>
            <span v-else>{{ row[item.field] }}</span>
          </li>
@@ -349,9 +376,16 @@
      </template>
      <!--左边固定显示的插槽-->
      <template #button_slot="{ row }">
      <template #button_slot="{ row }" v-if="!props.rowIndex">
        <el-button @click="getTableRow(row,'edit')" link type="primary" size="small">编辑</el-button>
        <el-button @click="getTableRow(row,'delete')" link type="primary" size="small">删除</el-button>
        <el-popconfirm @confirm="getTableRow(row,'delete')" title="确认删除产品?">
          <template #reference>
            <el-button  link type="primary" size="small">删除</el-button>
          </template>
        </el-popconfirm>
      </template>
      <template #button_slot="{ row }" v-else>
        <el-button @click="emitParent(row)" link type="primary" size="small">添加</el-button>
      </template>
      <template #num1_filter="{ column, $panel }">
@@ -361,7 +395,9 @@
          </div>
        </div>
      </template>
      <template #state="{ row,column}">
        <el-checkbox @click.native.prevent   :checked="row[column.field]===1"/>
      </template>
    </vxe-grid>