|
@@ -7,48 +7,30 @@
|
|
|
@close="onClose"
|
|
|
>
|
|
|
<div>
|
|
|
- <el-table
|
|
|
- ref="multipleTable"
|
|
|
- :data="productsList"
|
|
|
- tooltip-effect="dark"
|
|
|
- style="width: 100%"
|
|
|
- @selection-change="handleSelectionChange"
|
|
|
- >
|
|
|
- <el-table-column
|
|
|
- type="selection"
|
|
|
- width="55">
|
|
|
- </el-table-column>
|
|
|
- <el-table-column
|
|
|
- label="商品名称"
|
|
|
- width="260">
|
|
|
- <template slot-scope="scope">{{ scope.row.itemname }}</template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column
|
|
|
- label="商品编号"
|
|
|
- width="260">
|
|
|
- <template slot-scope="scope">{{ scope.row.itemno }}</template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column
|
|
|
- label="商品型号"
|
|
|
- width="260">
|
|
|
- <template slot-scope="scope">{{ scope.row.model }}</template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column
|
|
|
- label="商品规格"
|
|
|
- >
|
|
|
- <template slot-scope="scope">{{ scope.row.spec }}</template>
|
|
|
- </el-table-column>
|
|
|
- </el-table>
|
|
|
- <div style="margin-top: 20px">
|
|
|
- <el-button type="primary" @click="onSubmit">确定</el-button>
|
|
|
- <el-button @click="toggleSelection()">取消选择</el-button>
|
|
|
- </div>
|
|
|
+ <tablelayout :layout="tablecols" :data="productsList" :custom="true" :checkbox="true" height="calc(100vh - 452px)" @checkboxCallBack="checkboxCallBack">
|
|
|
+ <template v-slot:customcol="scope">
|
|
|
+ <div v-if="scope.column.columnname === 'province'">
|
|
|
+ <span>{{scope.column.data.province}} - {{scope.column.data.city}} - {{scope.column.data.county}}</span>
|
|
|
+ </div>
|
|
|
+ <p v-else>{{scope.column.data[scope.column.columnname]}}</p>
|
|
|
+ </template>
|
|
|
+
|
|
|
+ </tablelayout>
|
|
|
+
|
|
|
+ </div>
|
|
|
+ <div>
|
|
|
+ <p style="margin-top: 2%">已选{{selected}}个商品,共{{total}}个商品</p>
|
|
|
+ </div>
|
|
|
+ <div class="dialog-footer">
|
|
|
+ <el-button size="small" @click="drawer = false" class="normal-btn-width">取消</el-button>
|
|
|
+ <el-button size="small" type="primary" @click="onSubmit" class="normal-btn-width btn-primary">确定</el-button>
|
|
|
</div>
|
|
|
</el-dialog>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
+import tablelayout from '@/components/table/index2'
|
|
|
export default {
|
|
|
name: "add",
|
|
|
props:["plm_technicalinfoid"],
|
|
@@ -66,21 +48,31 @@ export default {
|
|
|
},
|
|
|
productsList:[],
|
|
|
multipleSelection: [],
|
|
|
+ tablecols:[],
|
|
|
+ tableHieght:420,
|
|
|
+ selected:0,
|
|
|
+ total:0
|
|
|
}
|
|
|
},
|
|
|
+ components:{
|
|
|
+ tablelayout
|
|
|
+ },
|
|
|
mounted() {
|
|
|
|
|
|
+ },
|
|
|
+ created() {
|
|
|
+ this.tablecols = this.tool.tabelCol(this.$route.name).relationProductTable.tablecols
|
|
|
},
|
|
|
methods: {
|
|
|
onShow(){
|
|
|
this.drawer = true
|
|
|
- this.queryProducts()
|
|
|
+ this.productsData()
|
|
|
},
|
|
|
onClose(){
|
|
|
this.drawer = false
|
|
|
this.form.itemid=''
|
|
|
},
|
|
|
- async queryProducts(){
|
|
|
+ async productsData(){
|
|
|
const res = await this.$api.requested({
|
|
|
"id": 20220923140602,
|
|
|
"content": {
|
|
@@ -91,18 +83,13 @@ export default {
|
|
|
})
|
|
|
console.log(res)
|
|
|
this.productsList = res.data
|
|
|
+ this.total = res.total
|
|
|
},
|
|
|
- toggleSelection(rows) {
|
|
|
- if (rows) {
|
|
|
- rows.forEach(row => {
|
|
|
- this.$refs.multipleTable.toggleRowSelection(row);
|
|
|
- });
|
|
|
- } else {
|
|
|
- this.$refs.multipleTable.clearSelection();
|
|
|
- }
|
|
|
- },
|
|
|
- handleSelectionChange(val) {
|
|
|
+ checkboxCallBack(val){
|
|
|
+ console.log(val)
|
|
|
this.multipleSelection = val;
|
|
|
+ this.selected = val.length
|
|
|
+
|
|
|
},
|
|
|
async onSubmit(){
|
|
|
console.log(this.multipleSelection)
|