|
|
@@ -10,45 +10,56 @@
|
|
|
>
|
|
|
<div>
|
|
|
<el-row>
|
|
|
- <el-col :span="24" class="topsearch">
|
|
|
- <el-form >
|
|
|
- <el-row>
|
|
|
- <el-col :span="6">
|
|
|
- <el-input
|
|
|
- v-model="searchKey"
|
|
|
- placeholder="输入设备编码或名称"
|
|
|
- size="small"
|
|
|
- ></el-input>
|
|
|
- </el-col>
|
|
|
- <el-col :span="6" style="margin-left:10px">
|
|
|
- <el-button type="primary" size="small" @click="searchByKeyWords">搜索</el-button>
|
|
|
- <el-button size="small" @click="reset">重置</el-button>
|
|
|
- </el-col>
|
|
|
- </el-row>
|
|
|
- </el-form>
|
|
|
- </el-col>
|
|
|
+ <el-col :span="24" class="topsearch">
|
|
|
+ <el-form>
|
|
|
+ <el-row>
|
|
|
+ <el-col :span="6">
|
|
|
+ <el-input
|
|
|
+ v-model.trim="searchKey"
|
|
|
+ placeholder="输入设备编码或名称"
|
|
|
+ size="small"
|
|
|
+ ></el-input>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="6" style="margin-left: 10px">
|
|
|
+ <el-button type="primary" size="small" @click="searchByKeyWords"
|
|
|
+ >搜索</el-button
|
|
|
+ >
|
|
|
+ <el-button size="small" @click="reset">重置</el-button>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ </el-form>
|
|
|
+ </el-col>
|
|
|
<el-col :span="6" class="tree_col">
|
|
|
<AssetTree
|
|
|
@handleNodeClick="handleNodeClick"
|
|
|
@setRootId="setRootId"
|
|
|
- :type="'5'"
|
|
|
- :paramsType="'type'"
|
|
|
+ id="1"
|
|
|
ref="treeList"
|
|
|
/>
|
|
|
</el-col>
|
|
|
<el-col :span="18" class="table_col">
|
|
|
<el-table
|
|
|
:data="tableData"
|
|
|
+ ref="tableRef"
|
|
|
height="450"
|
|
|
@row-click="single"
|
|
|
>
|
|
|
- <el-table-column label="物品编码" prop="code" width="200"></el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ label="物品编码"
|
|
|
+ prop="code"
|
|
|
+ width="200"
|
|
|
+ ></el-table-column>
|
|
|
<el-table-column label="物品名称" prop="name"></el-table-column>
|
|
|
- <el-table-column label="牌号" prop="classificationUrl"></el-table-column>
|
|
|
+ <el-table-column label="牌号" prop="brandNum"></el-table-column>
|
|
|
<el-table-column label="选择" align="center">
|
|
|
- <template slot-scope="scope">
|
|
|
- <el-radio class="radio" v-model="radio" :label="scope.row.id"><i></i></el-radio>
|
|
|
- </template>
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-radio
|
|
|
+ class="radio"
|
|
|
+ v-model="selectedRow.id"
|
|
|
+ :label="scope.row.id"
|
|
|
+ ><i></i
|
|
|
+ ></el-radio>
|
|
|
+ </template>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
|
<div class="pagination">
|
|
|
@@ -58,7 +69,7 @@
|
|
|
:total="total"
|
|
|
:page-sizes="[5, 10, 20, 50, 100]"
|
|
|
:page-size="pagination.size"
|
|
|
- :current-page.sync="pagination.page"
|
|
|
+ :current-page.sync="pagination.pageNum"
|
|
|
@current-change="handleCurrent"
|
|
|
@size-change="handleSize"
|
|
|
>
|
|
|
@@ -76,95 +87,122 @@
|
|
|
|
|
|
<script>
|
|
|
import AssetTree from '@/components/AssetTree';
|
|
|
-export default {
|
|
|
- components: {
|
|
|
- AssetTree
|
|
|
- },
|
|
|
- data () {
|
|
|
- return {
|
|
|
- materialdialog: false,
|
|
|
- tableData: [
|
|
|
- {id:1,name:'122',model:'型号1'},
|
|
|
- {id:2,name:'222',model:'型号2'}
|
|
|
- ],
|
|
|
- pagination: {
|
|
|
- page: 1,
|
|
|
- size: 10
|
|
|
+ import { getList } from '@/api/classifyManage/itemInformation';
|
|
|
+ export default {
|
|
|
+ components: {
|
|
|
+ AssetTree
|
|
|
+ },
|
|
|
+ data () {
|
|
|
+ return {
|
|
|
+ materialdialog: false,
|
|
|
+ tableData: [],
|
|
|
+ pagination: {
|
|
|
+ pageNum: 1,
|
|
|
+ size: 10
|
|
|
+ },
|
|
|
+ total: 0,
|
|
|
+ searchKey: null,
|
|
|
+ current: null,
|
|
|
+ rootId: null,
|
|
|
+ selectedRow: {},
|
|
|
+ radio: '',
|
|
|
+ memoId: ''
|
|
|
+ };
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ open (categoryId) {
|
|
|
+ this.memoId = categoryId;
|
|
|
+ this.materialdialog = true;
|
|
|
+ },
|
|
|
+ handleNodeClick (info) {
|
|
|
+ this.current = info;
|
|
|
+ this._getList();
|
|
|
+ },
|
|
|
+ // 获取根节点id
|
|
|
+ setRootId (id) {
|
|
|
+ this.rootId = id;
|
|
|
+ },
|
|
|
+ handleClose () {
|
|
|
+ this.materialdialog = false;
|
|
|
+ this.selectedRow = {};
|
|
|
},
|
|
|
- total: 0,
|
|
|
- searchKey:null,
|
|
|
- current:null,
|
|
|
- rootId:null,
|
|
|
- radio: '',
|
|
|
- }
|
|
|
- },
|
|
|
- watch: {
|
|
|
|
|
|
- },
|
|
|
- methods: {
|
|
|
- open(){
|
|
|
- this.materialdialog = true
|
|
|
- },
|
|
|
- handleNodeClick (info) {
|
|
|
- this.current = info
|
|
|
- },
|
|
|
- // 获取根节点id
|
|
|
- setRootId(id){
|
|
|
- this.rootId = id
|
|
|
- },
|
|
|
- handleClose () {
|
|
|
- this.materialdialog = false
|
|
|
- this.radio = ''
|
|
|
- },
|
|
|
+ handleCurrent (page) {
|
|
|
+ this.pagination.pageNum = page;
|
|
|
+ this._getList();
|
|
|
+ },
|
|
|
+ handleSize (size) {
|
|
|
+ this.pagination.pageNum = 1;
|
|
|
+ this.pagination.size = size;
|
|
|
+ this._getList();
|
|
|
+ },
|
|
|
+ async _getList () {
|
|
|
+ const res = await getList({
|
|
|
+ ...this.pagination,
|
|
|
+ searchKey: this.searchKey,
|
|
|
+ categoryLevelId: this.current.id
|
|
|
+ });
|
|
|
+ this.total = res.count;
|
|
|
+ this.tableData = res.list;
|
|
|
|
|
|
- handleCurrent (page) {
|
|
|
- this.pagination.page = page
|
|
|
- },
|
|
|
- handleSize (size) {
|
|
|
- this.pagination.page = 1
|
|
|
- this.pagination.size = size
|
|
|
- },
|
|
|
- // 弹窗 - 按关键字搜索
|
|
|
- searchByKeyWords () {
|
|
|
+ if (!this.current.id) {
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.$refs.tableRef.setCurrentRow(
|
|
|
+ this.tableData.find((i) => i.id == this.memoId)
|
|
|
+ );
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 弹窗 - 按关键字搜索
|
|
|
+ searchByKeyWords () {
|
|
|
+ this.pagination.pageNum = 1;
|
|
|
+ this._getList();
|
|
|
+ },
|
|
|
+ // 重置
|
|
|
+ reset () {
|
|
|
+ this.searchKey = '';
|
|
|
+ this.pagination.pageNum = 1;
|
|
|
+ this._getList();
|
|
|
+ },
|
|
|
+ // 单击获取id
|
|
|
+ single (row) {
|
|
|
+ this.selectedRow = row;
|
|
|
+ },
|
|
|
+ selected () {
|
|
|
+ if (!this.selectedRow.id) {
|
|
|
+ return this.$message.error('请选择物料!');
|
|
|
+ }
|
|
|
|
|
|
- },
|
|
|
- // 重置
|
|
|
- reset(){
|
|
|
- },
|
|
|
- // 单击获取id
|
|
|
- single (row) {
|
|
|
- this.radio = row.id;
|
|
|
- },
|
|
|
- selected(){
|
|
|
-
|
|
|
- }
|
|
|
- }
|
|
|
-}
|
|
|
+ this.$emit('success', this.selectedRow);
|
|
|
+ this.handleClose();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ };
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
-.tree_col {
|
|
|
- border: 1px solid #eee;
|
|
|
- padding: 10px 0;
|
|
|
- box-sizing: border-box;
|
|
|
- height: 500px;
|
|
|
- overflow: auto;
|
|
|
-}
|
|
|
-.table_col {
|
|
|
- padding-left: 10px;
|
|
|
- ::v-deep .el-table th.el-table__cell {
|
|
|
- background: #f2f2f2;
|
|
|
+ .tree_col {
|
|
|
+ border: 1px solid #eee;
|
|
|
+ padding: 10px 0;
|
|
|
+ box-sizing: border-box;
|
|
|
+ height: 500px;
|
|
|
+ overflow: auto;
|
|
|
+ }
|
|
|
+ .table_col {
|
|
|
+ padding-left: 10px;
|
|
|
+ ::v-deep .el-table th.el-table__cell {
|
|
|
+ background: #f2f2f2;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .pagination {
|
|
|
+ text-align: right;
|
|
|
+ padding: 10px 0;
|
|
|
+ }
|
|
|
+ .btns {
|
|
|
+ text-align: center;
|
|
|
+ padding: 10px 0;
|
|
|
+ }
|
|
|
+ .topsearch {
|
|
|
+ margin-bottom: 15px;
|
|
|
}
|
|
|
-}
|
|
|
-.pagination {
|
|
|
- text-align: right;
|
|
|
- padding: 10px 0;
|
|
|
-}
|
|
|
-.btns {
|
|
|
- text-align: center;
|
|
|
- padding: 10px 0;
|
|
|
-}
|
|
|
-.topsearch{
|
|
|
- margin-bottom:15px;
|
|
|
-}
|
|
|
</style>
|