| | |
| | | </el-card> |
| | | </el-container> |
| | | </el-container> |
| | | <my-import |
| | | :import-setting="importSetting" |
| | | :dialog-show="importSetting.dialogShow" |
| | | :dialog-title="importSetting.dialogTitle" |
| | | /> |
| | | |
| | | </div> |
| | | </template> |
| | | |
| | |
| | | import MyButton from '@/components/myButton/myButton'; |
| | | import SettingIplatform from '@/utils/settingIplatform'; |
| | | import * as finsystenant from '@/api/baseSetting/finsystenant'; |
| | | import myImport from '@/views/components/myImport'; |
| | | import { getBaseUrl } from '@/utils/base'; |
| | | import { selectTenantWarehouse, getCategorySelectTree } from '@/api/baseSetting/finsystenant'; |
| | | import { selectTenantWarehouse, getCategorySelectTree, treeList } from '@/api/baseSetting/finsystenant'; |
| | | import { getDicts } from '@/api/system/dict/data'; |
| | | import { doExport } from '@/api/stock/ledger'; |
| | | |
| | | export default { |
| | | name: 'index', |
| | | components: { MyButton, MyTableV2, myImport }, |
| | | components: { MyButton, MyTableV2 }, |
| | | data() { |
| | | return { |
| | | // 搜索框 |
| | |
| | | }, |
| | | { |
| | | type: 'text', |
| | | dataIndex: 'name', |
| | | dataIndex: 'goodsTemplateName', |
| | | label: '物品名称', |
| | | placeholder: '请输入', |
| | | defaultValue: '', |
| | | }, |
| | | { |
| | | type: 'select', |
| | | dataIndex: 'modelsIds', |
| | | multiple: true, |
| | | dataIndex: 'categoryId', |
| | | label: '分类', |
| | | placeholder: '请选择', |
| | | defaultValue: '', |
| | |
| | | }, |
| | | { |
| | | type: 'select', |
| | | dataIndex: 'warehouseId', |
| | | dataIndex: 'costType', |
| | | label: '类别', |
| | | placeholder: '请选择', |
| | | defaultValue: '', |
| | |
| | | userPhone: null, |
| | | status: 1, |
| | | }, |
| | | // 导入 |
| | | importSetting: { |
| | | dialogTitle: '导入', |
| | | dialogShow: false, |
| | | fileSettings: { |
| | | data: {}, |
| | | uploadUrl: getBaseUrl() + '/pc/fin/sys/tenant/import', // 上传地址 |
| | | accept: '.xls', // 格式 |
| | | type: 'text', // 回显形式 |
| | | loading: false, // 导入效果 |
| | | }, |
| | | /* 模板下载 */ |
| | | templateSettings: { |
| | | templateName: '导入模板.xls', // 名称 |
| | | templateUrl: SettingIplatform.apiBaseURL + '/pc/fin/sys/tenant/getImportTemplate', // 下载地址 |
| | | }, |
| | | onSuccess: null, |
| | | }, |
| | | editSetting: { |
| | | title: '', |
| | | id: '', |
| | | orgId: '', |
| | | show: false, |
| | | }, |
| | | // 表格数据 |
| | | table: { |
| | | showIndex: true, // 是否显示序号 |
| | | expand: false, // 是否显示详情数据 |
| | | url: SettingIplatform.apiBaseURL + '/pc/fin/sys/tenant/select/list', // 请求地址 |
| | | url: SettingIplatform.apiBaseURL + '/pc/fin/warehouse/ledger/getList', // 请求地址 |
| | | // 工具条 |
| | | tools: { |
| | | columnsCtrl: { |
| | |
| | | show: false, |
| | | }, |
| | | // 自定义工具条按钮 |
| | | custom: [], |
| | | custom: [ |
| | | { |
| | | name: '导出', |
| | | icon: 'el-icon-download', |
| | | click: () => { |
| | | this.handleExport(); |
| | | }, |
| | | }, |
| | | ], |
| | | }, |
| | | // 列信息 |
| | | columns: [ |
| | | { title: '类型', field: 'name', align: 'left' }, |
| | | { title: '仓库', field: 'code', align: 'center' }, |
| | | { title: '分类', field: 'lv', align: 'center' }, |
| | | { title: '所属类别', field: 'lv', align: 'center' }, |
| | | { title: '物品名称', field: 'summary', align: 'left' }, |
| | | { title: '规格型号', field: 'summary', align: 'left' }, |
| | | { title: '单位', field: 'summary', align: 'left' }, |
| | | { title: '当前库存', field: 'summary', align: 'left' }, |
| | | { title: '机构', field: 'agencyName', align: 'center' }, |
| | | { title: '仓库', field: 'warehouseName', align: 'center' }, |
| | | { title: '分类', field: 'categoryName', align: 'center' }, |
| | | { title: '所属类别', field: 'costType', align: 'center' }, |
| | | { title: '物品名称', field: 'goodsTemplateName', align: 'left' }, |
| | | { title: '规格型号', field: 'baseGoodsModelsName', align: 'left' }, |
| | | { title: '单位', field: 'unit', align: 'left' }, |
| | | { title: '当前库存', field: 'kucun', align: 'left' }, |
| | | ], |
| | | paging: { |
| | | show: true, // 显示分页 |
| | |
| | | if (v.label == '仓库') { |
| | | v.options = res.map((item) => { |
| | | item.label = item.warehouseName; |
| | | item.vlaue = item.id; |
| | | item.value = item.id; |
| | | return item; |
| | | }); |
| | | } |
| | | }); |
| | | console.log('this.items', this.items); |
| | | }); |
| | | getDicts('GOODS_PRICE').then((res) => { |
| | | // 价值类型1A 2B 3C |
| | | this.items.forEach((v) => { |
| | | if (v.label == '类别') { |
| | | v.options = res.map((v) => { |
| | | v.label = v.dict_label; |
| | | v.value = v.dict_value; |
| | | if (v.dict_value == 'A') { |
| | | v.value = 1; |
| | | } else if (v.dict_value == 'B') { |
| | | v.value = 2; |
| | | } else { |
| | | v.value = 3; |
| | | } |
| | | return v; |
| | | }); |
| | | } |
| | | }); |
| | | }); |
| | | getCategorySelectTree().then((res) => { |
| | | treeList().then((res) => { |
| | | this.items.forEach((v) => { |
| | | if (v.label == '分类') { |
| | | v.options = res.map((item) => { |
| | | item.label = item.label; |
| | | item.vlaue = item.id; |
| | | item.label = item.categoryName; |
| | | item.value = item.id; |
| | | return item; |
| | | }); |
| | | } |
| | | }); |
| | | }); |
| | | }, |
| | | |
| | | // 导出 |
| | | handleExport() { |
| | | let loading = this.$loading({ |
| | | lock: true, |
| | | text: '导出中,请稍候...', |
| | | spinner: 'el-icon-loading', |
| | | background: 'rgba(0, 0, 0, 0.7)', |
| | | }); |
| | | // 判断总条数是否大于最大支持条数 |
| | | doExport({ ...this.filterFrom }) |
| | | .then((res) => { |
| | | const blob = new Blob([res], { type: 'application/vnd.ms-excel' }); |
| | | const fileName = `库存查询.xls`; |
| | | if ('download' in document.createElement('a')) { |
| | | // 非IE下载 |
| | | const elink = document.createElement('a'); |
| | | elink.download = fileName; |
| | | elink.style.display = 'none'; |
| | | elink.href = URL.createObjectURL(blob); |
| | | document.body.appendChild(elink); |
| | | elink.click(); |
| | | URL.revokeObjectURL(elink.href); |
| | | document.body.removeChild(elink); |
| | | } else { |
| | | // IE10+下载 |
| | | navigator.msSaveBlob(blob, fileName); |
| | | } |
| | | this.$message.success('导出成功!'); |
| | | loading.close(); |
| | | }) |
| | | .catch(() => { |
| | | loading.close(); |
| | | }); |
| | | }, |
| | | |
| | | // 查询table列表 |
| | | search(pageNum) { |
| | | if (pageNum != undefined) { |
| | |
| | | }, |
| | | fifterForm(params) { |
| | | this.filterFrom = Object.assign(this.filterFrom, params); |
| | | if (params.agencyId && params.agencyId.length) { |
| | | this.filterFrom.agencyId = params.agencyId[params.agencyId.length - 1]; |
| | | } |
| | | this.search(1); |
| | | }, |
| | | }, |