| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507 |
- <template>
- <div>
- <user-search
- ref="searchRef"
- @search="reload"
- :networkCounts="networkCounts"
- >
- </user-search>
- <!-- 数据表格 -->
- <ele-pro-table
- ref="table"
- :columns="columns"
- :datasource="datasource"
- height="calc(100vh - 500px)"
- full-height="calc(100vh - 115px)"
- tool-class="ele-toolbar-form"
- cache-key="systemOrgUserTable"
- @select="selectChange"
- @select-all="changeSelectAll"
- >
- <!-- 表头工具栏 -->
- <template v-slot:toolbar>
- <el-button
- size="small"
- type="primary"
- icon="el-icon-plus"
- class="ele-btn-icon"
- @click="add"
- >
- 新建
- </el-button>
- <el-button
- size="small"
- type="primary"
- icon="el-icon-download"
- class="ele-btn-icon"
- @click="btnExport"
- >
- 导出
- </el-button>
- <el-button
- size="small"
- :disabled="checkRadioData.length == 0"
- icon="el-icon-set-up"
- class="ele-btn-icon"
- @click="allPrinting"
- >
- 打印条码
- </el-button>
- <el-button
- size="small"
- :disabled="checkRadioData.length == 0"
- icon="el-icon-thumb"
- class="ele-btn-icon"
- @click="moveTo(checkRadioData, 'person')"
- v-if="$hasPermission('main:substance:update')"
- >
- 设置片区负责人
- </el-button>
- <el-button
- size="small"
- :disabled="checkRadioData.length == 0"
- icon="el-icon-s-tools"
- class="ele-btn-icon"
- @click="batchSettings(1)"
- v-if="$hasPermission('main:substance:update')"
- >
- 设置权属部门
- </el-button>
- <el-button
- size="small"
- :disabled="checkRadioData.length == 0"
- icon="el-icon-setting"
- class="ele-btn-icon"
- @click="batchSettings(2)"
- v-if="$hasPermission('main:substance:update')"
- >
- 设置使用单位
- </el-button>
- </template>
- <!-- 编码列 -->
- <template v-slot:code="{ row }">
- <el-link type="primary" :underline="false" @click="details(row)">
- {{ row.code }}
- </el-link>
- </template>
- <!-- 牌号列 -->
- <template v-slot:brandNum="{ row }">
- <div>
- {{ row.category.brandNum }}
- </div>
- </template>
- <!-- 型号列 -->
- <template v-slot:modelType="{ row }">
- <div>
- {{ row.category.modelType }}
- </div>
- </template>
- <!-- 分类列 -->
- <template v-slot:categoryLevelPath="{ row }">
- <div>
- {{ row.category.categoryLevelPath }}
- </div>
- </template>
- <!-- 操作列 -->
- <template v-slot:action="{ row }">
- <el-link
- type="primary"
- :underline="false"
- icon="el-icon-edit"
- @click="goEdit(row)"
- >
- 编辑
- </el-link>
- </template>
- </ele-pro-table>
- <print ref="printRef"></print>
- <printSr ref="printSrRef"></printSr>
- <printTg ref="printTgRef"></printTg>
- <batchSetDialog ref="batchSetRef" @success="sucesstion" />
- <DialogMoveto ref="movetoRef" @success="sucesstion" />
- </div>
- </template>
- <script>
- import batchSetDialog from '@/views/ledgerAssets/equipment/components/batchSetDialog.vue';
- import DialogMoveto from '@/views/ledgerAssets/equipment/components/DialogMoveTo.vue';
- import print from '@/views/ledgerAssets/components/print.vue';
- import printSr from '@/views/ledgerAssets/components/printSr';
- import printTg from '@/views/ledgerAssets/components/printTg';
- import { getByCode } from '@/api/system/dictionary-data';
- import {
- businessStatus,
- networkStatus,
- sourceStatus
- } from '@/utils/dict/warehouse';
- import UserSearch from './user-search.vue';
- import { getAssetList, downloadAsset } from '@/api/ledgerAssets';
- import dictMixins from '@/mixins/dictMixins';
- import axios from 'axios';
- import {
- API_BASE_URL,
- TOKEN_HEADER_NAME,
- LAYOUT_PATH
- } from '@/config/setting';
- import { download } from '@/utils/file';
- import { getToken, setToken } from '@/utils/token-util';
- export default {
- components: {
- UserSearch,
- print,
- printSr,
- printTg,
- DialogMoveto,
- batchSetDialog
- },
- mixins: [dictMixins],
- props: {
- // 类别id
- categoryId: [Number, String],
- rootId: [Number, String]
- },
- data() {
- return {
- checkRadioData: [],
- QRvisible: false,
- networkStatus,
- businessStatus,
- assetLevel: [],
- isConsumer: false,
- networkCounts: {},
- // 表格列配置
- columns: [
- {
- width: 45,
- type: 'selection',
- columnKey: 'selection',
- align: 'center'
- },
- {
- columnKey: 'index',
- type: 'index',
- label: '序号',
- width: 55,
- align: 'center',
- showOverflowTooltip: true,
- fixed: 'left'
- },
- {
- columnKey: 'code',
- prop: 'code',
- slot: 'code',
- label: '编码',
- showOverflowTooltip: true,
- minWidth: 180
- },
- // {
- // columnKey: 'code',
- // prop: 'code',
- // label: '设备编码',
- // showOverflowTooltip: true,
- // minWidth: 110,
- // slot: 'code'
- // },
- {
- prop: 'category.name',
- label: '名称',
- showOverflowTooltip: true,
- minWidth: 110
- },
- {
- prop: 'fixCode',
- label: '固资编码',
- showOverflowTooltip: true,
- minWidth: 110
- },
- {
- prop: 'codeNumber',
- label: '编号',
- showOverflowTooltip: true,
- minWidth: 110
- },
- // {
- // prop: 'codeNumber',
- // label: '编号',
- // showOverflowTooltip: true,
- // minWidth: 110
- // },
- {
- prop: 'category.modelType',
- label: '型号',
- showOverflowTooltip: true,
- minWidth: 110
- },
- {
- prop: 'category.specification',
- label: '规格',
- showOverflowTooltip: true,
- minWidth: 110
- },
- {
- prop: 'postName',
- label: '使用单位',
- showOverflowTooltip: true,
- minWidth: 110
- },
- {
- prop: 'usePerson',
- label: '使用人',
- showOverflowTooltip: true,
- minWidth: 80
- },
- {
- prop: 'ownershipGroupName',
- label: '权属部门',
- showOverflowTooltip: true,
- minWidth: 110
- },
- {
- prop: 'chargePerson',
- label: '负责人',
- showOverflowTooltip: true,
- minWidth: 80
- },
- {
- prop: 'endTime',
- label: '有效期结束时间',
- showOverflowTooltip: true,
- minWidth: 150
- },
- {
- prop: 'source',
- label: '生命周期',
- showOverflowTooltip: true,
- minWidth: 110,
- formatter: (_row) => {
- return sourceStatus[_row.lifeCycle];
- }
- },
- {
- prop: 'level',
- label: '级别',
- showOverflowTooltip: true,
- minWidth: 110,
- formatter: (_row) => {
- if (_row.level) {
- return this.assetLevel.filter(
- (item) => item.id == _row.level
- )[0].name;
- } else {
- return '';
- }
- }
- },
- {
- prop: 'networkStatus',
- label: '网络状态',
- showOverflowTooltip: true,
- minWidth: 110,
- formatter: (_row) => {
- console.log('_row.networkStatus-------', _row.networkStatus);
- if (_row.networkStatus) {
- return this.networkStatus.filter(
- (item) => item.code == _row.networkStatus
- )[0].label;
- } else {
- return '离线';
- }
- }
- },
- {
- prop: 'status',
- label: '状态',
- showOverflowTooltip: true,
- minWidth: 110,
- formatter: (_row) => {
- if (_row.status) {
- return this.businessStatus.filter(
- (item) => item.code == _row.status
- )[0].label;
- } else {
- return '空闲';
- }
- }
- },
- {
- prop: 'pathName',
- label: '位置',
- showOverflowTooltip: true,
- minWidth: 110,
- formatter: (_row) => {
- const positionDetail =
- _row.position &&
- _row.position.length != 0 &&
- _row.position[0].detailPosition
- ? _row.position[0].detailPosition
- : '-';
- return _row.deviceLocationName
- ? _row.deviceLocationName + '-' + positionDetail
- : '';
- }
- },
- {
- columnKey: 'action',
- slot: 'action',
- label: '操作',
- minWidth: 100,
- fixed: 'right'
- }
- ]
- };
- },
- computed: {
- clientEnvironmentId() {
- return this.$store.state.user.info.clientEnvironmentId;
- }
- },
- created() {
- this.requestDict('生命周期');
- this.getAssetLevelOptions();
- },
- methods: {
- allPrinting() {
- if (this.clientEnvironmentId == 2) {
- this.$refs.printSrRef.open(this.checkRadioData);
- } else if (this.clientEnvironmentId == 3) {
- this.$refs.printTgRef.open(this.checkRadioData);
- } else {
- this.$refs.printRef.open(this.checkRadioData);
- }
- },
- // 全选
- changeSelectAll(arr) {
- console.log(arr);
- if (arr.length != 0) {
- this.checkRadioData = arr;
- } else {
- this.checkRadioData = [];
- }
- },
- selectChange(selection, row) {
- if (selection.length != 0) {
- this.checkRadioData = selection;
- } else {
- this.checkRadioData = [];
- }
- },
- // 获取资产级别下拉
- async getAssetLevelOptions() {
- let { data } = await getByCode('asset_level');
- this.assetLevel =
- data.length > 0
- ? data.map((item) => {
- return {
- name: Object.keys(item)[0],
- id: item[Object.keys(item)[0]]
- };
- })
- : [];
- },
- // 跳转到详情页
- add() {
- this.$router.push({
- path: '/ledgerAssets/office/edit'
- });
- },
- /* 表格数据源 */
- datasource({ page, limit, where, order }) {
- return getAssetList({
- ...where,
- ...order,
- pageNum: page,
- size: limit,
- categoryLevelId: this.categoryId,
- rootCategoryLevelId: this.rootId
- });
- },
- /* 刷新表格 */
- reload(where) {
- this.$refs.table.reload({ pageNum: 1, where: where });
- },
- // 刷新回调
- sucesstion(is) {
- console.log(is);
- if (is) {
- this.reload();
- }
- this.checkRadioData = [];
- },
- // 移动到
- moveTo(arr, type) {
- this.$refs.movetoRef.open(arr, this.current, type);
- },
- batchSettings(type) {
- let ids = this.checkRadioData.map((item) => {
- return item.id;
- });
- this.$refs.batchSetRef.open(type, ids);
- console.log(this.checkRadioData, 'checkRadioData 123');
- },
- allPrinting() {
- if (this.clientEnvironmentId == 2) {
- this.$refs.printSrRef.open(this.checkRadioData);
- } else if (this.clientEnvironmentId == 3) {
- this.$refs.printTgRef.open(this.checkRadioData);
- } else {
- this.$refs.printRef.open(this.checkRadioData);
- }
- },
- // 跳转到详情页
- details({ id, code }) {
- this.$router.push({
- path: '/ledgerAssets/office/detail',
- query: {
- id,
- code
- }
- });
- },
- // 跳转到编辑页
- goEdit({ id }) {
- this.$router.push({
- path: '/ledgerAssets/office/edit',
- query: {
- id
- }
- });
- },
- // 导出
- btnExport() {
- let params = {
- ...this.$refs.searchRef.where,
- exportType: 3,
- categoryLevelId: this.categoryId,
- rootCategoryLevelId: this.rootId
- };
- // downloadAsset(params, '模具台账导出数据');
- axios({
- url: `${API_BASE_URL}/main/asset/page/export`,
- method: 'post',
- responseType: 'blob',
- headers: {
- Authorization: getToken()
- },
- data: params
- }).then((res) => {
- download(res.data, '办公设备台账导出数据');
- });
- }
- },
- watch: {
- // 监听类别id变化
- categoryId() {
- this.reload();
- }
- }
- };
- </script>
- <style lang="scss" scoped>
- .ele-btn-icon {
- margin-left: 20px;
- }
- </style>
|