yangfeng
2023-09-21 1ed83e98d5bc89f4e87b8ae6692eb31888e55579
src/components/makepager/CommonFormTableView.vue
@@ -50,10 +50,19 @@
                    v-model="scope.row[item.prop]"
                    placeholder="请选择"
                    size="mini"
                    style="width: 63%"
                    @change="selProductClick"
                    style="width: 80%"
                    @change="
                      (val) => {
                        selProductClick(val)
                      }
                    "
                  >
                    <el-option v-for="item in productNameOptions" :key="item.id" :label="item.name" :value="item">
                    <el-option
                      v-for="item in productNameOptions"
                      :key="item.id"
                      :label="item.name"
                      :value="{ value: item.id, label: item.name, amount: item.amount, unit: item.unit }"
                    >
                    </el-option>
                  </el-select>
                </div>
@@ -144,7 +153,7 @@
</template>
<script>
// import { getProductListFromGrpc, getProductList } from "@/api/productManage/product"
import { getProductList } from "@/api/product/product"
// import SelectCommonDialog from "@/views/other/commonDialog/SelectCommonDialog"
export default {
  name: "CommmonFormTableView",
@@ -182,10 +191,7 @@
        infomation: {}
      },
      productIndex: 0,
      productNameOptions: [
        { id: 1, name: "aaaaa" },
        { id: 2, name: "bbbbbbbbbb" }
      ],
      productNameOptions: [],
      selOptions: [
        { id: 1, name: "件" },
        { id: 2, name: "打" }
@@ -193,7 +199,7 @@
    }
  },
  created() {
    // this.getProductList()
    this.getProductList()
    this.tableList = this.productTableList
  },
  computed: {},
@@ -205,24 +211,29 @@
  methods: {
    // 产品名称
    async getProductList() {
      // let fn = this.sign == "purchase" ? getProductList : getProductListFromGrpc
      let fn
      await fn({
      await getProductList({
        page: 1,
        pageSize: 100
      }).then((res) => {
        console.log(res.data)
        if (res.data.code === 200) {
          if (res.data.data.list && res.data.data.list.length > 0) {
            this.productList = res.data.data.list
        // console.log(res.data)
        if (res.code === 200) {
          if (res.data && res.data.length > 0) {
            this.productNameOptions = res.data
          }
        }
      })
    },
    // 选择产品
    selProductClick(val) {
      console.log("aaa")
      console.log(val)
    selProductClick(item) {
      this.tableList.tableData.map((ite) => {
        if (ite.productName.label === item.label) {
          ite.productId = item.value
          ite.productName = item.label
          ite.amount = item.amount
          ite.unit = item.unit
        }
      })
      console.log(this.tableList.tableData)
    },
    // 选择单位
    selCommonClick(item) {