| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199 |
- <template>
- <div>
- <dryArea-search @search="reload" ref="searchRef"> </dryArea-search>
- <!-- 数据表格 -->
- <ele-pro-table
- ref="table"
- :columns="columns"
- :datasource="datasource"
- height="calc(100vh - 375px)"
- full-height="calc(100vh - 116px)"
- tool-class="ele-toolbar-form"
- cache-key="systemOrgUserTable"
- >
- <!-- 表头工具栏 -->
- <template v-slot:toolbar>
- <!-- <el-button
- size="small"
- type="primary"
- icon="el-icon-plus"
- class="ele-btn-icon"
- @click="openEdit()"
- >
- 新增
- </el-button> -->
- </template>
- <!-- 编码列 -->
- <template v-slot:status="{ row }">
- <!-- 0空闲1占用 -->
- {{ row.status == 0 ? '空闲' : row.status == 1 ? '占用' : '' }}
- </template>
- <template v-slot:action="{ row }">
- <el-link
- type="primary"
- :underline="false"
- icon="el-icon-edit"
- @click="openEdit(row)"
- >
- 编辑
- </el-link>
- <el-popconfirm
- class="ele-action"
- title="确定要删除此干燥区吗?"
- @confirm="remove(row)"
- >
- <template v-slot:reference>
- <el-link type="danger" :underline="false" icon="el-icon-delete">
- 删除
- </el-link>
- </template>
- </el-popconfirm>
- </template>
- </ele-pro-table>
- <user-edit
- :visible.sync="showEdit"
- :rootId="rootId"
- :data="current"
- @done="reload"
- ref="userEdit"
- />
- </div>
- </template>
- <script>
- import dryAreaSearch from './dryArea-search.vue';
- import {
- getAssetList,
- downloadAsset,
- getNetworkCount,
- batchDel
- } from '@/api/ledgerAssets';
- import { getList, removeItem } from '@/api/ledgerAssets/dryArea';
- import dictMixins from '@/mixins/dictMixins';
- import UserEdit from './user-edit.vue';
- export default {
- mixins: [dictMixins],
- components: { dryAreaSearch, UserEdit },
- props: {
- // 类别id
- categoryId: [Number, String],
- rootId: [Number, String]
- },
- data() {
- return {
- // 当前编辑数据
- current: null,
- // 是否显示编辑弹窗
- showEdit: false,
- // 表格列配置
- columns: [
- {
- columnKey: 'index',
- type: 'index',
- label: '序号',
- width: 55,
- align: 'center',
- showOverflowTooltip: true,
- fixed: 'left'
- },
- {
- prop: 'code',
- label: '干燥区编码',
- showOverflowTooltip: true,
- minWidth: 110
- },
- {
- prop: 'name',
- label: '干燥区名称',
- showOverflowTooltip: true,
- minWidth: 110
- },
- {
- prop: 'codeNumber',
- label: '编号',
- showOverflowTooltip: true,
- minWidth: 110
- },
- {
- prop: 'specification',
- label: '规格',
- showOverflowTooltip: true,
- minWidth: 110
- },
- {
- prop: 'region',
- label: '位置',
- showOverflowTooltip: true,
- minWidth: 110
- },
- {
- prop: 'status',
- label: '状态',
- showOverflowTooltip: true,
- minWidth: 110,
- slot: 'status'
- },
- {
- label: '操作',
- prop: 'action',
- slot: 'action',
- action: 'action'
- }
- ]
- };
- },
- created() {
- this.requestDict('角度');
- },
- methods: {
- /* 表格数据源 */
- datasource({ page, limit, where }) {
- return getAssetList({
- ...where,
- pageNum: page,
- size: limit,
- categoryLevelId: this.categoryId,
- rootCategoryLevelId: this.rootId
- });
- },
- /* 刷新表格 */
- reload(where) {
- this.$refs.table.reload({ pageNum: 1, where: where });
- },
- /* 打开编辑弹窗 */
- openEdit(row) {
- this.current = row;
- this.showEdit = true;
- this.$refs.userEdit.$refs.form &&
- this.$refs.userEdit.$refs.form.clearValidate();
- },
- /* 删除 */
- remove(row) {
- const loading = this.$loading({ lock: true });
- removeItem([row.id])
- .then((msg) => {
- loading.close();
- this.$message.success(msg);
- this.reload();
- })
- .catch((e) => {
- loading.close();
- });
- }
- },
- watch: {
- // 监听类别id变化
- categoryId() {
- this.reload();
- }
- }
- };
- </script>
|