| | |
| | | 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> |
| | |
| | | </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", |
| | |
| | | infomation: {} |
| | | }, |
| | | productIndex: 0, |
| | | productNameOptions: [ |
| | | { id: 1, name: "aaaaa" }, |
| | | { id: 2, name: "bbbbbbbbbb" } |
| | | ], |
| | | productNameOptions: [], |
| | | selOptions: [ |
| | | { id: 1, name: "件" }, |
| | | { id: 2, name: "打" } |
| | |
| | | } |
| | | }, |
| | | created() { |
| | | // this.getProductList() |
| | | this.getProductList() |
| | | this.tableList = this.productTableList |
| | | }, |
| | | computed: {}, |
| | |
| | | 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) { |