123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407 |
- <template>
- <div>
- <basic-container v-show="!detailsOpen" class="page-crad">
- <el-row>
- <el-col :span="4">
- <avue-tree ref="treeRef" :option="treeOption" :data="treeData" @node-click="nodeClick" style="height:73vh;"
- @save="corpTypeVisible = true">
- </avue-tree>
- </el-col>
- <el-col :span="20">
- <avue-crud :option="option" :search.sync="search" v-model="form" :table-loading="loading" :data="dataList"
- ref="crud" :key="key" @on-load="onLoad" @search-change="searchChange" @refresh-change="refreshChange"
- :cell-style="cellStyle" @search-criteria-switch="searchCriteriaSwitch"
- @resetColumn="resetColumnTwo('crud', 'option', 'optionList', 268)"
- @saveColumn="saveColumnTwo('crud', 'option', 'optionList', 268)" :page.sync="page">
- <template slot-scope="{type,size,row,$index}" slot="menuLeft">
- <el-button type="warning" icon="el-icon-download" size="small" @click="outExport">导出</el-button>
- </template>
- <template slot-scope="{ row }" slot="storeInventory">
- <span style="color: #409EFF;cursor: pointer" @click.stop="storeInventoryOpen(row)">{{ row.storeInventory }}
- </span>
- </template>
- </avue-crud>
- </el-col>
- </el-row>
- </basic-container>
- </div>
- </template>
- <script>
- import { getList } from "@/api/tirePartsMall/inventory";
- import { getToken } from "@/util/auth";
- import { getCorpType } from "@/api/tirePartsMall/basicData/commodityInformation";
- export default {
- name: "index",
- data() {
- return {
- detailsOpen: false,
- treeData: [],
- loading: false,
- corpTypeVisible: false,
- search: {},
- form: {},
- dataList: [],
- detailData: {},
- params: {
- corpId: null,
- itemId: null
- },
- page: {
- pageSize: 20,
- currentPage: 1,
- total: 0,
- pageSizes: [10, 20, 30, 40, 50, 100, 200, 300, 400, 500]
- },
- key: 0,
- treeOption: {
- addBtn: false,
- menu: false,
- size: "small",
- props: {
- labelText: "标题",
- label: "title",
- value: "value",
- }
- },
- option: {},
- optionList: {
- viewBtn: false,
- editBtn: false,
- delBtn: false,
- addBtn: false,
- index: true,
- width: '100%',
- span: 8,
- border: true,
- menu: false,
- height: "auto",
- searchMenuPosition: "right",
- align: "center",
- size: "small",
- menuWidth: 140,
- searchSpan: 8,
- searchIcon: true,
- searchIndex: 2,
- highlightCurrentRow: true,
- dialogWidth: "70%",
- summaryText: "合计",
- showSummary: true,
- sumColumnList: [
- {
- name: 'balanceQuantity',
- type: 'sum',
- },
- {
- name: 'storeInventory',
- type: 'sum',
- },
- {
- name: 'inventoryAmount',
- type: 'sum',
- },
- ],
- column: [
- {
- label: '轮胎名称',
- prop: "cname",
- search: true,
- overHidden: true,
- },
- {
- label: '轮胎编码',
- prop: "code",
- search: true,
- overHidden: true,
- }, {
- label: '品牌',
- prop: "brandName",
- searchProp: "brandId",
- search: true,
- overHidden: true,
- type: 'select',
- props: {
- label: 'cname',
- value: 'id'
- },
- dicUrl: '/api/blade-sales-part/brandDesc/listAll',
- width: 100
- }, {
- label: '规格型号',
- prop: "typeno",
- search: true,
- overHidden: true,
- width: 100
- }, {
- label: '花纹',
- prop: "brandItem",
- overHidden: true,
- width: 100
- }, {
- label: '轮胎描述',
- prop: "productDescription",
- overHidden: true,
- width: 100
- }, {
- label: '分类',
- prop: "goodsTypeName",
- overHidden: true,
- width: 100
- }, {
- label: '仓库',
- prop: "storageName",
- searchProp: "storageId",
- search: true,
- overHidden: true,
- type: 'select',
- props: {
- label: 'cname',
- value: 'id'
- },
- dicUrl: '/api/blade-sales-part/storageDesc/listAll',
- width: 100
- }, {
- label: '库存数量',
- prop: "balanceQuantity",
- overHidden: true,
- width: 100
- }, {
- label: '库存单价',
- prop: "inventoryCostPrice",
- overHidden: true,
- width: 100
- }, {
- label: '批次',
- prop: "dot",
- overHidden: true,
- width: 100
- }, {
- label: '上架库存',
- prop: "storeInventory",
- overHidden: true,
- width: 100
- }, {
- label: '库存金额',
- prop: "inventoryAmount",
- overHidden: true,
- width: 100
- }, {
- label: '库存预警',
- prop: "inventoryAlert",
- overHidden: true,
- width: 100
- }, {
- label: '是否显示0库存',
- prop: "whether",
- overHidden: true,
- search: true,
- type: 'select',
- showColumn: false,
- hide: true,
- width: 120,
- searchLabelWidth: 120,
- dicData: [{
- "label": "是",
- "value": "1"
- }, {
- "label": "否",
- "value": "0"
- }]
- }]
- }
- }
- },
- async created() {
- this.option = await this.getColumnData(this.getColumnName(268), this.optionList);
- this.key++
- let i = 0;
- this.option.column.forEach(item => {
- if (item.search) i++
- })
- if (i % 3 !== 0) {
- const num = 3 - Number(i % 3)
- this.option.searchMenuSpan = num * 8;
- this.option.searchMenuPosition = "right";
- }
- this.getAllWorkDicts()
- },
- methods: {
- outExport() {
- let config = { params: { ...this.search } }
- if (config.params) {
- for (const propName of Object.keys(config.params)) {
- const value = config.params[propName];
- if (value !== null && typeof (value) !== "undefined") {
- if (value instanceof Array) {
- for (const key of Object.keys(value)) {
- let params = propName + '[' + key + ']';
- config.params[params] = value[key]
- }
- delete config.params[propName]
- }
- }
- }
- }
- const routeData = this.$router.resolve({
- path: '/api/blade-sales-part/stockDesc/stockExport', //跳转目标下载地址
- query: {
- ...config.params //括号内是要传递给新窗口的参数
- }
- })
- window.open(routeData.href.slice(1, routeData.href.length) + '&' + `${this.website.tokenHeader}=${getToken()}`);
- },
- check(row) {
- this.form = row
- this.detailsOpen = true
- },
- backToList(type) {
- this.form = {}
- this.detailsOpen = false
- if (type === 0) {
- this.detailData = {}
- }
- this.onLoad(this.page, this.search)
- },
- getAllWorkDicts() {
- getCorpType({ corpType: 'SP' }).then(res => {
- this.treeData = res.data.data;
- // this.findObject(this.option2.column, "parentId").dicData = res.data.data;
- });
- },
- nodeClick(data) {
- this.search.goodsTypeId = data.value
- this.page.currentPage = 1;
- this.onLoad(this.page, this.search);
- },
- //刷新
- refreshChange() {
- this.onLoad(this.page, this.search)
- },
- searchChange(params, done) {
- done();
- this.onLoad(this.page, params)
- },
- onLoad(page, params = {}) {
- params = {
- current: page.currentPage,
- size: page.pageSize,
- ...Object.assign(params, this.search)
- }
- this.loading = true
- getList(params).then(res => {
- this.dataList = res.data.data.records
- this.page.total = res.data.data.total
- this.loading = false
- }).finally(() => {
- this.loading = false
- })
- },
- searchCriteriaSwitch() {
- this.$refs.crud.getTableHeight();
- },
- cellStyle() {
- return "padding:0;height:40px;";
- },
- //点击可用库存打开
- storeInventoryOpen(row) {
- console.log(this.$store.getters.inventoryAccount);
- if (this.$store.getters.inventoryAccount) {
- this.$alert("明细账已存在,请保存关闭明细账再进行操作", "温馨提示", {
- confirmButtonText: "确定",
- type: "warning",
- callback: action => {
- console.log(action);
- }
- });
- } else {
- this.params.corpId = row.corpId
- this.params.itemId = row.goodsId
- this.params.storageId = row.storageId
- this.$router.$avueRouter.closeTag("/tirePartsMall/inventory/detail");
- this.$router.push({
- path: "/tirePartsMall/inventory/detail",
- query: {
- stockId: row.storageId,
- goodsId: row.goodsId
- },
- });
- }
- },
- //自定义列保存
- async saveColumnTwo(ref, option, optionBack, code) {
- /**
- * 已定义全局方法,直接使用,saveColumnData保存列数据方法,参数传值(表格名称,当前表格的option数据)
- * 已定义全局方法,直接使用,getColumnName方法用来获取枚举值,参数根据自己定义的code值获取中文名
- * 一定要执行异步操作,要等接口成功返回,才能执行下一行代码
- */
- const inSave = await this.saveColumnData(this.getColumnName(code), this[option]);
- if (inSave) {
- this.$message.success("保存成功");
- //关闭窗口
- this.$refs[ref].$refs.dialogColumn.columnBox = false;
- }
- },
- //自定义列重置
- async resetColumnTwo(ref, option, optionBack, code) {
- this[option] = this[optionBack];
- const inSave = await this.delColumnData(this.getColumnName(code), this[optionBack]);
- if (inSave) {
- this.$message.success("重置成功");
- this.$refs[ref].$refs.dialogColumn.columnBox = false;
- }
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .page-crad ::v-deep .basic-container__card {
- height: 94.2vh;
- }
- ::v-deep .el-form-item__error {
- display: none !important;
- }
- ::v-deep .el-input-group__append {
- padding: 0 0px !important;
- }
- .el-dialog ::v-deep .el-form-item__error {
- display: none !important;
- }
- .stat-td {
- text-align: center;
- position: relative;
- }
- .stat-img {
- width: 95%;
- height: 100px;
- }
- .stat-tip {
- position: absolute;
- left: 15px;
- top: 5px;
- .money {
- color: #fff;
- font-size: 28px;
- text-align: left;
- font-weight: 600;
- }
- .title {
- color: #fff;
- font-size: 14px;
- text-align: left;
- margin-top: 5px;
- margin-bottom: 0px;
- }
- }
- </style>
|