mirror of
https://gitee.com/hzchunfen/erp.git
synced 2025-11-30 22:20:45 +00:00
商品添加导出、时间筛选
This commit is contained in:
parent
c95efcdc15
commit
74b42969b7
@ -10,6 +10,20 @@
|
||||
<span>商品编码:</span>
|
||||
<el-input v-model="searchForm.external_sku_id" clearable></el-input>
|
||||
</div>
|
||||
<div class="row">
|
||||
<span>创建时间:</span>
|
||||
<el-date-picker
|
||||
v-model="filterTime"
|
||||
type="datetimerange"
|
||||
range-separator="至"
|
||||
start-placeholder="开始时间"
|
||||
end-placeholder="结束时间"
|
||||
format="yyyy-MM-dd"
|
||||
value-format="yyyy-MM-dd"
|
||||
clearable
|
||||
style="width: 250px;">
|
||||
</el-date-picker>
|
||||
</div>
|
||||
<div class="row">
|
||||
<el-button type="primary" @click="handleChoose(1)" icon="el-icon-search">筛选</el-button>
|
||||
</div>
|
||||
@ -21,9 +35,10 @@
|
||||
<el-upload ref="myUpload" action="/api/combination/goods" :multiple="false" name="combinationGoods"
|
||||
:show-file-list="false" :on-success="uploadSuccess" :before-upload="beforeUpload"
|
||||
:on-error="uploadError" style="display:inline-block;margin: 0 15px 0 0;">
|
||||
<el-button type="warning" icon="el-icon-upload2">组合商品导入</el-button>
|
||||
<el-button type="primary" plain icon="el-icon-upload2">组合商品导入</el-button>
|
||||
</el-upload>
|
||||
<el-button type="primary" plain @click="addGoodsCombination" icon="el-icon-plus" v-if="is_admin">新增组合商品</el-button>
|
||||
<el-button type="primary" @click="addGoodsCombination" icon="el-icon-plus" v-if="is_admin">新增组合商品</el-button>
|
||||
<el-button type="warning" @click="handleExport" icon="el-icon-download">数据导出</el-button>
|
||||
</div>
|
||||
|
||||
<el-table v-loading="loading" ref="multipleTable" :data="tableData" class="table" tooltip-effect="dark" border
|
||||
@ -36,7 +51,7 @@
|
||||
<div>
|
||||
<p>{{ scope.row.title }}</p>
|
||||
<p>{{ scope.row.external_sku_id }}</p>
|
||||
<p>{{ scope.row.updated_at }}</p>
|
||||
<p>{{ scope.row.created_at }}</p>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
@ -149,7 +164,8 @@
|
||||
},
|
||||
skus: [],
|
||||
is_admin: false,
|
||||
remoteLoading: false
|
||||
remoteLoading: false,
|
||||
filterTime: []
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
@ -180,7 +196,9 @@
|
||||
this.searchForm = {
|
||||
...this.searchForm,
|
||||
page: this.current_page,
|
||||
per_page: this.per_page
|
||||
per_page: this.per_page,
|
||||
create_time_start: this.filterTime ? this.filterTime[0] : '',
|
||||
create_time_end: this.filterTime ? this.filterTime[1] : ''
|
||||
}
|
||||
this.getList(this.searchForm)
|
||||
},
|
||||
@ -265,6 +283,21 @@
|
||||
type: "error"
|
||||
});
|
||||
this.loadingModule.close()
|
||||
},
|
||||
handleExport() {
|
||||
let params = {
|
||||
exportType: 'goods_combination',
|
||||
external_sku_id: this.searchForm.external_sku_id,
|
||||
sku_title: this.searchForm.sku_title,
|
||||
create_time_start: this.filterTime ? this.filterTime[0] : '',
|
||||
create_time_end: this.filterTime ? this.filterTime[1] : ''
|
||||
}
|
||||
window.open("/goods_skus/export?" + this.objectToQueryString(params))
|
||||
},
|
||||
objectToQueryString(obj) {
|
||||
return Object.keys(obj)
|
||||
.map(key => encodeURIComponent(key) + '=' + (obj[key] ? encodeURIComponent(obj[key]) : ''))
|
||||
.join('&');
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
|
||||
@ -38,6 +38,20 @@
|
||||
</el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
<div class="row">
|
||||
<span>创建时间:</span>
|
||||
<el-date-picker
|
||||
v-model="filterTime"
|
||||
type="datetimerange"
|
||||
range-separator="至"
|
||||
start-placeholder="开始时间"
|
||||
end-placeholder="结束时间"
|
||||
format="yyyy-MM-dd"
|
||||
value-format="yyyy-MM-dd"
|
||||
clearable
|
||||
style="width: 250px;">
|
||||
</el-date-picker>
|
||||
</div>
|
||||
<!-- <div class="row">
|
||||
<el-select v-model="form.keyword_type" style="width: 80px;margin-right: 5px;">
|
||||
<el-option v-for="item in options3" :key="item.value" :label="item.label" :value="item.value">
|
||||
@ -76,8 +90,9 @@
|
||||
</el-upload> -->
|
||||
<el-button type="primary" @click="petchEditStock" icon="el-icon-edit" :disabled="!chooseList.length">批量更新在售库存</el-button>
|
||||
<el-button type="primary" v-if="is_admin" @click="addNewgoods" icon="el-icon-plus">新增商品</el-button>
|
||||
<el-button type="primary" v-if="is_admin" plain @click="handleImport" icon="el-icon-upload2">在售库存导入</el-button>
|
||||
<el-button type="warning" @click="handleExport" icon="el-icon-download">表格导出</el-button>
|
||||
<el-button type="primary" plain v-if="is_admin" @click="handleImport" icon="el-icon-upload2">在售库存导入</el-button>
|
||||
<el-button type="warning" @click="handleTypeExport" icon="el-icon-download">选择类型导出</el-button>
|
||||
<el-button type="warning" @click="handleExport" icon="el-icon-download">数据导出</el-button>
|
||||
<!-- <el-button type="primary" plain @click="onCount">库存盘点</el-button> -->
|
||||
</div>
|
||||
</div>
|
||||
@ -94,7 +109,7 @@
|
||||
<div>
|
||||
<div class="tit">{{ scope.row.name }}</div>
|
||||
<p>{{ scope.row.external_sku_id }}</p>
|
||||
<p>{{ scope.row.updated_at }}</p>
|
||||
<p>{{ scope.row.created_at }}</p>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@ -399,7 +414,7 @@
|
||||
</div>
|
||||
<div class="import-right">
|
||||
<el-button size="medium" type="text">
|
||||
<a :href="`http://erp.chutang66.com/goods/import/template`">下载模板</a>
|
||||
<a :href="`/goods/import/template`">下载模板</a>
|
||||
</el-button>
|
||||
</div>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
@ -447,7 +462,7 @@
|
||||
<script>
|
||||
import axios from 'axios'
|
||||
import { goods_types, Brand_goods_types } from '@/api/rankingData.js'
|
||||
import { goods, update, singleUpdate, getStockNum, updateSaleStock } from '@/api/goods'
|
||||
import { goods, update, singleUpdate, getStockNum, updateSaleStock, goodsSkuExport } from '@/api/goods'
|
||||
import { orderRest } from "@/api/shop"
|
||||
import Treeselect from '@riophae/vue-treeselect'
|
||||
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
|
||||
@ -554,7 +569,8 @@
|
||||
is_admin: false,
|
||||
showAdd: false,
|
||||
showEdit: false,
|
||||
curId: 0
|
||||
curId: 0,
|
||||
filterTime: []
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
@ -626,7 +642,8 @@
|
||||
// 返回对象
|
||||
return _newPar
|
||||
}
|
||||
newObj.type_id = newObj.type_id || ''
|
||||
newObj.create_time_start = this.filterTime ? this.filterTime[0] : ''
|
||||
newObj.create_time_end = this.filterTime ? this.filterTime[1] : ''
|
||||
goods(newObj).then((res) => {
|
||||
this.tableData = res.data.data
|
||||
this.tableData = this.tableData.map((item) => {
|
||||
@ -663,7 +680,7 @@
|
||||
})
|
||||
},
|
||||
// 导出商品按钮
|
||||
handleExport() {
|
||||
handleTypeExport() {
|
||||
this.Tableexport = true
|
||||
},
|
||||
// 订单重置计数
|
||||
@ -722,6 +739,26 @@
|
||||
this.stock = false
|
||||
},
|
||||
|
||||
handleExport() {
|
||||
let params = {
|
||||
exportType: 'goods_sku',
|
||||
external_sku_id: this.form.external_sku_id,
|
||||
goods_title: this.form.goods_title,
|
||||
type_id: this.form.type_id || '',
|
||||
status: this.form.status,
|
||||
keyword_type: 'stock',
|
||||
create_time_start: this.filterTime ? this.filterTime[0] : '',
|
||||
create_time_end: this.filterTime ? this.filterTime[1] : ''
|
||||
}
|
||||
window.open("/goods_skus/export?" + this.objectToQueryString(params))
|
||||
},
|
||||
|
||||
objectToQueryString(obj) {
|
||||
return Object.keys(obj)
|
||||
.map(key => encodeURIComponent(key) + '=' + (obj[key] ? encodeURIComponent(obj[key]) : ''))
|
||||
.join('&');
|
||||
},
|
||||
|
||||
// 点击上新or库存盘点后确认
|
||||
onSubmit() {
|
||||
//判断点击的是上新,再发送上新请求
|
||||
|
||||
@ -308,7 +308,7 @@ export default {
|
||||
|
||||
.add {
|
||||
cursor: pointer;
|
||||
font-size: 20px;
|
||||
font-size: 16px;
|
||||
color: #606266;
|
||||
}
|
||||
|
||||
|
||||
@ -5,14 +5,14 @@
|
||||
<el-button type="primary" icon="el-icon-plus" @click="dialogVisible2 = true">新增</el-button>
|
||||
</div>
|
||||
<el-table v-loading="loading" :data="tableList" style="width: 100%" border>
|
||||
<el-table-column prop="id" label="ID"> </el-table-column>
|
||||
<el-table-column prop="name" label="角色名称"> </el-table-column>
|
||||
<el-table-column prop="id" label="ID" width="100" align="center" />
|
||||
<el-table-column prop="name" label="角色名称" width="200" align="center" />
|
||||
<el-table-column label="权限内容">
|
||||
<template slot-scope="scope">
|
||||
<span v-for="item in scope.row.permissions" :key="item.id">{{ item.name }} </span>
|
||||
<span v-for="item in scope.row.permissions" :key="item.id">{{ item.name }}<span style="color: #333;"> | </span></span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作">
|
||||
<el-table-column label="操作" width="200" align="center">
|
||||
<template slot-scope="scope">
|
||||
<el-button type="primary" @click="onEdit(scope.row)" icon="el-icon-edit">编辑权限</el-button>
|
||||
</template>
|
||||
@ -22,8 +22,16 @@
|
||||
|
||||
<!-- 点击编辑弹出权限框 -->
|
||||
<el-dialog title="编辑权限" :visible.sync="dialogVisible" width="30%" :close-on-click-modal="false">
|
||||
<el-tree v-if="isShowtree" :data="Role_Permission" show-checkbox :default-expand-all="false" node-key="id"
|
||||
ref="tree" highlight-current :props="defaultProps" :default-checked-keys="chekedKeys"
|
||||
<el-tree
|
||||
v-if="isShowtree"
|
||||
:data="Role_Permission"
|
||||
show-checkbox
|
||||
:default-expand-all="false"
|
||||
node-key="id"
|
||||
ref="tree"
|
||||
highlight-current
|
||||
:props="defaultProps"
|
||||
:default-checked-keys="chekedKeys"
|
||||
v-model="permissionIds">
|
||||
</el-tree>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
@ -33,7 +41,6 @@
|
||||
</el-dialog>
|
||||
|
||||
<el-dialog title="新增角色" :visible.sync="dialogVisible2" width="30%" :close-on-click-modal="false">
|
||||
<div>
|
||||
<el-form label-width="80px">
|
||||
<el-form-item label="角色名称">
|
||||
<el-input v-model="newrole"></el-input>
|
||||
@ -43,9 +50,7 @@
|
||||
<el-button type="primary" @click="onSubmit">确认</el-button>
|
||||
</div>
|
||||
</el-form>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@ -67,87 +72,83 @@ export default {
|
||||
Role_Permission: [], //权限列表数据
|
||||
defaultProps: {
|
||||
children: "children",
|
||||
label: "name",
|
||||
label: "name"
|
||||
},
|
||||
isShowtree: false,
|
||||
chekedKeys: [],
|
||||
};
|
||||
chekedKeys: []
|
||||
}
|
||||
},
|
||||
|
||||
mounted() {
|
||||
this.getroleList();
|
||||
this.getJurisdiction();
|
||||
this.getroleList()
|
||||
this.getJurisdiction()
|
||||
},
|
||||
methods: {
|
||||
//角色表单数据请求
|
||||
getroleList() {
|
||||
roleList().then((res) => {
|
||||
this.tableList = res.data.data;
|
||||
});
|
||||
this.loading = false;
|
||||
this.tableList = res.data.data
|
||||
})
|
||||
this.loading = false
|
||||
},
|
||||
|
||||
//角色权限数据请求
|
||||
getJurisdiction() {
|
||||
jurisdiction().then((res) => {
|
||||
this.Role_Permission = res.data.data;
|
||||
});
|
||||
this.Role_Permission = res.data.data
|
||||
})
|
||||
},
|
||||
|
||||
// 点击新增
|
||||
onSubmit() {
|
||||
let roleName = {
|
||||
name: this.newrole,
|
||||
};
|
||||
name: this.newrole
|
||||
}
|
||||
roleAdd(roleName).then((res) => {
|
||||
this.dialogVisible2 = false;
|
||||
this.getroleList();
|
||||
this.getroleList()
|
||||
if (res.status == 201) {
|
||||
this.$message({
|
||||
message: "角色添加成功!",
|
||||
type: "success",
|
||||
});
|
||||
type: "success"
|
||||
})
|
||||
}
|
||||
});
|
||||
})
|
||||
},
|
||||
|
||||
// 点击编辑
|
||||
onEdit(row) {
|
||||
this.id = row.id;
|
||||
this.id = row.id
|
||||
let arr = row.permissions.map((item) => {
|
||||
return item.id;
|
||||
});
|
||||
this.chekedKeys = arr;
|
||||
this.dialogVisible = true;
|
||||
this.isShowtree = true;
|
||||
return item.id
|
||||
})
|
||||
this.chekedKeys = arr
|
||||
this.dialogVisible = true
|
||||
this.isShowtree = true
|
||||
},
|
||||
|
||||
// 点击取消
|
||||
cancel() {
|
||||
this.dialogVisible = false;
|
||||
this.isShowtree = false;
|
||||
this.dialogVisible = false
|
||||
this.isShowtree = false
|
||||
},
|
||||
|
||||
//编辑权限确认
|
||||
getCheckedKeys() {
|
||||
let id = this.id; //选中角色的ID
|
||||
this.permissionIds = this.$refs.tree.getCheckedKeys(); //选中权限的ID
|
||||
let id = this.id //选中角色的ID
|
||||
this.permissionIds = this.$refs.tree.getCheckedKeys() //选中权限的ID
|
||||
this.allpermissionIds = {
|
||||
permissionIds: this.permissionIds,
|
||||
};
|
||||
permissionIds: this.permissionIds
|
||||
}
|
||||
jurisdictionEdit(id, this.allpermissionIds).then((res) => {
|
||||
if (res.status === 200) {
|
||||
this.dialogVisible = false;
|
||||
this.getroleList();
|
||||
this.$message({
|
||||
message: "权限修改成功!",
|
||||
type: "success",
|
||||
});
|
||||
this.dialogVisible = false
|
||||
this.getroleList()
|
||||
this.$message({ message: "权限修改成功!", type: "success" })
|
||||
}
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user