| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322 |
- <template>
- <el-dialog :title="title" :visible.sync="visible" v-if="visible" :before-close="handleClose"
- :close-on-click-modal="false" :close-on-press-escape="false" append-to-body width="75%">
- <el-card shadow="never">
- <ProductSearch @search="reload" ref="searchRef" />
- <ele-split-layout width="244px" allow-collapse :right-style="{ overflow: 'hidden' }">
- <div class="ele-border-lighter split-layout-right-content">
- <AssetTree ref="assetTreeRef" :id="categoryLevelId" @handleNodeClick="handleNodeClick" />
- </div>
- <!-- 表格 -->
- <template v-slot:content>
- <ele-pro-table ref="table" :columns="isLedger ? columns2 : columns" :datasource="datasource" row-key="id"
- height="calc(100vh - 350px)" class="dict-table" @cell-click="cellClick">
- <!-- 表头工具栏 -->
- <template v-slot:action="{ row }">
- <el-radio class="radio" v-model="radio" :label="row.id"><i></i></el-radio>
- </template>
- </ele-pro-table>
- </template>
- </ele-split-layout>
- </el-card>
- <div class="btns">
- <el-button type="primary" size="small" @click="selected">选择</el-button>
- <el-button size="small" @click="handleClose">关闭</el-button>
- </div>
- </el-dialog>
- </template>
- <script>
- import AssetTree from '@/components/AssetTree';
- import ProductSearch from './product-search.vue'
- import { getMaterialList } from '@/api/material/list.js';
- import { getAssetList } from '@/api/ledgerAssets/index'
- export default {
- components: { AssetTree, ProductSearch },
- props: {
- isLedger: {
- type: Boolean,
- default: false
- }
- },
- data() {
- return {
- visible: false,
- // 表格列配置
- columns: [
- {
- action: 'action',
- slot: 'action',
- align: 'center',
- label: '选择',
- fixed:'left'
- },
- {
- columnKey: 'index',
- type: 'index',
- width: 45,
- align: 'center',
- reserveSelection: true
- },
- {
- prop: 'code',
- label: '编码'
- },
- {
- prop: 'name',
- label: '名称',
- showOverflowTooltip: true
- },
- {
- prop: 'brandNum',
- label: '牌号'
- },
- {
- prop: 'modelType',
- label: '型号',
- align: 'center',
- showOverflowTooltip: true
- },
- {
- prop: 'specification',
- label: '规格',
- align: 'center',
- showOverflowTooltip: true
- },
- {
- prop: 'measuringUnit',
- label: '计量单位',
- showOverflowTooltip: true,
- minWidth: 90
- },
- {
- prop: 'weightUnit',
- label: '重量单位',
- showOverflowTooltip: true,
- minWidth: 90
- },
- {
- prop: 'roughWeight',
- label: '毛重',
- showOverflowTooltip: true,
- minWidth: 90
- },
- {
- prop: 'netWeight',
- label: '净重',
- showOverflowTooltip: true,
- minWidth: 90
- },
- {
- prop: 'packingUnit',
- align: 'center',
- label: '包装单位',
- showOverflowTooltip: true
- },
- {
- prop: 'categoryLevelPath',
- label: '分类',
- align: 'center',
- showOverflowTooltip: true
- },
-
- ],
- columns2: [
- {
- action: 'action',
- slot: 'action',
- align: 'center',
- label: '选择',
- fixed:'left'
- },
- {
- columnKey: 'index',
- type: 'index',
- label: '序号',
- width: 55,
- align: 'center',
- showOverflowTooltip: true,
- fixed: 'left'
- },
- {
- prop: 'fixCode',
- label: '固资编码',
- showOverflowTooltip: true,
- minWidth: 110
- },
- {
- prop: 'code',
- label: '编码'
- },
- {
- prop: 'name',
- label: '名称',
- showOverflowTooltip: true
- },
- {
- prop: 'codeNumber',
- label: '编号',
- showOverflowTooltip: true,
- minWidth: 110
- },
- {
- prop: 'category.modelType',
- label: '型号',
- showOverflowTooltip: true,
- minWidth: 110
- },
- {
- prop: 'category.specification',
- label: '规格',
- showOverflowTooltip: true,
- minWidth: 110
- },
- {
- prop: 'pathName',
- label: '位置',
- showOverflowTooltip: true,
- minWidth: 110,
- formatter: (_row) => {
- return _row.position[0].pathName;
- }
- },
- {
- prop: 'source',
- label: '生命周期',
- showOverflowTooltip: true,
- minWidth: 110
- },
-
- ],
- title: null,
- categoryLevelId: null,
- radio: null,
- idx: null,
- isCategory: true
- }
- },
- watch: {
- },
- methods: {
- /* 表格数据源 */
- datasource({ page, where, limit }) {
- let URL = this.isLedger ? getAssetList : getMaterialList
- if (this.isCategory) {
- return URL({
- ...where,
- pageNum: page,
- size: limit,
- categoryLevelId: this.categoryLevelId
- });
- } else {
- return URL({
- ...where,
- pageNum: page,
- size: limit,
- });
- }
- },
- handleNodeClick(data) {
- this.isCategory = true
- this.categoryLevelId = data.id;
- this.$refs.table.reload({ pageNum: 1, where: {} });
- this.$refs.searchRef.reset2()
- },
- /* 刷新表格 */
- reload(where) {
- this.isCategory = false
- this.$refs.table.reload({ pageNum: 1, where: where });
- },
- open(item, title, categoryLevelId, idx) {
- if (item) {
- this.title = title
- this.categoryLevelId = categoryLevelId
- this.idx = idx
- this.current = {
- id: item.categoryId,
- name: item.categoryName,
- code: item.categoryCode
- }
- this.radio = item.categoryId
- }
- this.visible = true
- },
- // 单击获取id
- cellClick(row) {
- this.current = row
- this.radio = row.id
- },
- handleClose() {
- this.visible = false
- this.current = null
- this.radio = ''
- },
- selected() {
- if (!this.current) {
- return this.$message.warning('请选择工作中心')
- }
- this.$emit('changeProduct', this.title, this.current, this.idx)
- 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;
- }
- }
- .pagination {
- text-align: right;
- padding: 10px 0;
- }
- .btns {
- text-align: center;
- padding: 10px 0;
- }
- .topsearch {
- margin-bottom: 15px;
- }
- </style>
|