修改出库清单
This commit is contained in:
parent
db22e3e0ab
commit
2536daaa0c
@ -9,6 +9,62 @@ export default {
|
||||
get: async function (params) {
|
||||
return await http.post(this.url, params);
|
||||
},
|
||||
},
|
||||
field:{
|
||||
url: `${config.API_URL}/out.stock.field.select.list`,
|
||||
name: "销售出库清单检索",
|
||||
post: async function (params) {
|
||||
return await http.post(this.url, params);
|
||||
},
|
||||
},
|
||||
stockImport:{
|
||||
url: `${config.API_URL}/out.stock.import.list`,
|
||||
name: "导入的出货清单列表",
|
||||
get: async function (params) {
|
||||
return await http.post(this.url, params);
|
||||
},
|
||||
},
|
||||
deleteImport:{
|
||||
url: `${config.API_URL}/out.stock.import.delete`,
|
||||
name: "批量删除出货清单",
|
||||
post: async function (params) {
|
||||
return await http.post(this.url, params);
|
||||
},
|
||||
},
|
||||
stockBom:{
|
||||
url: `${config.API_URL}/out.stock.import.mes.info`,
|
||||
name: "出货清单对应物料BOM列表信息",
|
||||
get: async function (params) {
|
||||
return await http.post(this.url, params);
|
||||
},
|
||||
},
|
||||
deleteBom:{
|
||||
url: `${config.API_URL}/out.stock.import.mes.info.delete`,
|
||||
name: "批量删除MES BOM明细",
|
||||
post: async function (params) {
|
||||
return await http.post(this.url, params);
|
||||
},
|
||||
},
|
||||
bomField:{
|
||||
url: `${config.API_URL}/out.stock.bom.import.list`,
|
||||
name: "bom清单检索",
|
||||
post: async function (params) {
|
||||
return await http.post(this.url, params);
|
||||
},
|
||||
},
|
||||
template:{
|
||||
url: `${config.API_URL}/shipping.list.import.template`,
|
||||
name: "出货清单导入模版",
|
||||
post: async function (params) {
|
||||
return await http.get(this.url,params,{responseType: 'arraybuffer'});
|
||||
}
|
||||
},
|
||||
import:{
|
||||
url: `${config.API_URL}/out.stock.import`,
|
||||
name: "出货清单导入",
|
||||
post: async function (params) {
|
||||
return await http.post(this.url,params,{'Content-Type': 'multipart/form-data'});
|
||||
}
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
@ -36,6 +36,7 @@
|
||||
<div class="el-upload__tip">
|
||||
<span class="tip">
|
||||
<!--如果数据导入中途业务出错,请不要刷新页面,修改后继续点击导入-->
|
||||
<slot name="cover"></slot>
|
||||
</span>
|
||||
<span class="btn">
|
||||
<slot name="download"></slot>
|
||||
@ -49,7 +50,7 @@
|
||||
<div class="deleteErr" @click="errorClick"><el-icon class="icon"><el-icon-Close/></el-icon></div>
|
||||
<el-scrollbar max-height="120px">
|
||||
<div v-for="em in errorList" :key="em">
|
||||
<div class="name" v-html="em.msg"></div>
|
||||
<div :class="em.status==0?'text danger':'text success'" v-html="em.msg"></div>
|
||||
</div>
|
||||
</el-scrollbar>
|
||||
</div>
|
||||
@ -111,11 +112,11 @@ export default {
|
||||
},
|
||||
methods:{
|
||||
getWsResult(res){
|
||||
if(res.data && (res.data.type == 4 || res.data.type == 5 || res.data.type == 10 || res.data.type == 17 || res.data.type == 18 || res.data.type == 27 || res.data.type == 28 || res.data.type == 31 || res.data.type == 42 || res.data.type == 44)){
|
||||
if(res.data && (res.data.type == 4 || res.data.type == 5 || res.data.type == 10 || res.data.type == 17 || res.data.type == 18 || res.data.type == 27 || res.data.type == 28 || res.data.type == 31 || res.data.type == 42 || res.data.type == 44 || res.data.type == 45)){
|
||||
if(this.type == res.data.type){
|
||||
this.importInfo = res.data;
|
||||
this.progressShow = true;
|
||||
if(res.data.status == 0){
|
||||
if(res.data.status == 0 || res.data.status == 1){
|
||||
this.errorShow = true;
|
||||
let text = res.data;
|
||||
this.errorList.push(text);
|
||||
@ -249,10 +250,16 @@ export default {
|
||||
border-radius: 6px;
|
||||
background: var(--el-color-danger-light-9);
|
||||
position: relative;
|
||||
.name{
|
||||
color: var(--el-color-danger);
|
||||
::v-deep .text{
|
||||
font-size: 12px;
|
||||
line-height: 20px;
|
||||
text-align: left;
|
||||
}
|
||||
.danger{
|
||||
color: var(--el-color-danger);
|
||||
}
|
||||
.success{
|
||||
color: var(--el-color-success);
|
||||
}
|
||||
.deleteErr{
|
||||
position: absolute;
|
||||
|
||||
199
src/views/shipment/shipmentList/bom.vue
Normal file
199
src/views/shipment/shipmentList/bom.vue
Normal file
@ -0,0 +1,199 @@
|
||||
<template>
|
||||
<el-container class="mainBox mainBoxHeaderNoBorder">
|
||||
<el-main class="nopadding">
|
||||
<div class="searchMain">
|
||||
<scTableSearch ref="scSearch" :searchList="list.column" :paramsData="params" :searchShow="searchShow" @fetchSelectData="getSelectData" @changeHeaderData="getHeaderData"></scTableSearch>
|
||||
|
||||
<div class="searchItem searchBtn" v-if="searchHeaderShow">
|
||||
<el-button :size="size" :icon="searchShow?'el-icon-ArrowUpBold':'el-icon-ArrowDownBold'" @click="searchShowClick">{{searchShow?'收起':'更多'}}</el-button>
|
||||
<el-button :size="size" type="primary" icon="el-icon-search" @click="upSearch">查询</el-button>
|
||||
<el-button :size="size" type="info" icon="el-icon-RefreshRight" @click="reset">重置</el-button>
|
||||
<el-button type="danger" v-auth="'deleteOutStockImportMesInfo'" plain :size="size" icon="el-icon-Delete" :disabled="selection.length==0" @click="batch_del"></el-button>
|
||||
</div>
|
||||
</div>
|
||||
<scTable ref="table" :apiObj="list.apiObj" :column="list.column" row-key="id" stripe border :size="size" @selection-change="selectionChange" @columnBack="columnBack">
|
||||
<el-table-column type="selection" align="center" width="40"></el-table-column>
|
||||
<template #logo="scope">
|
||||
<el-image class="logoCell" :src="scope.row.logo" preview-teleported :preview-src-list="[scope.row.logo]" fit="contain">
|
||||
<template #error>
|
||||
<div class="image-slot" style="text-align: center;font-size: 20px;">
|
||||
<el-icon><el-icon-Picture /></el-icon>
|
||||
</div>
|
||||
</template>
|
||||
</el-image>
|
||||
</template>
|
||||
</scTable>
|
||||
</el-main>
|
||||
</el-container>
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
import {eventBus} from "@/utils/eventBus";
|
||||
|
||||
export default {
|
||||
name:"",
|
||||
components: {
|
||||
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
size:'small',
|
||||
dialog: {
|
||||
save: false,
|
||||
show: false,
|
||||
},
|
||||
list: {
|
||||
apiObj: this.$API.shipment.out.stockBom,
|
||||
column: [],
|
||||
},
|
||||
selection: [],
|
||||
exportShow:false,
|
||||
searchShow:false,
|
||||
searchHeaderShow:false,
|
||||
filterMap:{
|
||||
data:{}
|
||||
},
|
||||
params: {},
|
||||
}
|
||||
},
|
||||
provide(){
|
||||
return{
|
||||
filterUploadClick:this.filterClick,
|
||||
filterUploadParams:this.filterParams,
|
||||
filterTagClose:this.tagClose,
|
||||
filterModelParams:this.filterModelParams,
|
||||
}
|
||||
},
|
||||
watch:{
|
||||
'list.column':{
|
||||
handler(val){
|
||||
this.searchHeaderShow = val.length>0 && val.some(em=>em.is_search);
|
||||
},
|
||||
immediate:false,
|
||||
deep:true
|
||||
}
|
||||
},
|
||||
computed:{
|
||||
filterModelParams(){
|
||||
return this.filterMap
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
/** 检索开始 */
|
||||
columnBack(val){
|
||||
this.list.column = val;
|
||||
},
|
||||
async filterClick(item) {
|
||||
let {data, params} = item;
|
||||
let filterParams = Object.assign(this.params,params);
|
||||
this.filterMap.data = filterParams;
|
||||
let searchParams = this.$TOOL.objCopy(this.params);
|
||||
searchParams.field = ""
|
||||
if (typeof data.prop === 'string') {
|
||||
searchParams.field = data.prop;
|
||||
} else {
|
||||
searchParams.field = data.prop[0];
|
||||
}
|
||||
if (data.search_type == 'select' || data.search_type == 'checkbox') {
|
||||
await this.getField(data,searchParams);
|
||||
}
|
||||
},
|
||||
filterParams(params){
|
||||
let filterParams = Object.assign(this.params,params);
|
||||
this.filterMap.data = filterParams;
|
||||
this.upSearch();
|
||||
},
|
||||
tagClose(params){
|
||||
let filterParams = Object.assign(this.params,params);
|
||||
this.filterMap.data = filterParams;
|
||||
},
|
||||
searchShowClick(){
|
||||
this.searchShow = !this.searchShow;
|
||||
eventBus.$emit('close-all-popovers');
|
||||
},
|
||||
getHeaderData(params){
|
||||
this.params = params;
|
||||
this.filterMap.data = params;
|
||||
},
|
||||
async getSelectData(item) {
|
||||
let {data, params} = item;
|
||||
this.params = params; // 列表需要的参数
|
||||
this.filterMap.data = params; // 表头组件需要转 才能传的参数
|
||||
let searchParams = this.$TOOL.objCopy(params);
|
||||
searchParams.field = ""
|
||||
if (typeof data.prop === 'string') {
|
||||
searchParams.field = data.prop;
|
||||
} else {
|
||||
searchParams.field = data.prop[0];
|
||||
}
|
||||
if (data.search_type == 'select' || data.search_type == 'checkbox') {
|
||||
await this.getField(data,searchParams)
|
||||
}
|
||||
},
|
||||
async getField(data,searchParams) {
|
||||
const res = await this.$API.shipment.out.bomField.post(searchParams);
|
||||
if (res.code == 200) {
|
||||
if (res.data && res.data.length > 0) {
|
||||
res.data.forEach(item => {
|
||||
item.label = item[data.prop];
|
||||
item.value = item[data.prop];
|
||||
})
|
||||
}
|
||||
this.list.column.forEach(item => {
|
||||
if (item.prop == data.prop) {
|
||||
item.data = res.data;
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
/** 检索结束 */
|
||||
|
||||
// 删除
|
||||
batch_del(){
|
||||
this.$confirm(`确定删除选中 ${this.selection.length} 项吗?`, '提示', {
|
||||
type: 'warning'
|
||||
}).then(async () => {
|
||||
const reqData = {ids: this.selection.map(em=>em.id)};
|
||||
const res = await this.$API.shipment.out.deleteBom.post(reqData);
|
||||
if(res.code == 200){
|
||||
this.$refs.table.refresh()
|
||||
this.$message.success("删除成功")
|
||||
}else{
|
||||
await this.$alert(res.message, "提示", {type: 'error'})
|
||||
}
|
||||
}).catch(()=>{})
|
||||
},
|
||||
//表格选择后回调事件
|
||||
selectionChange(selection){
|
||||
this.selection = selection;
|
||||
},
|
||||
upSearch(){
|
||||
this.$refs.table.upData(this.params);
|
||||
},
|
||||
reset(){
|
||||
this.params = {};
|
||||
this.filterMap.data = {};
|
||||
this.$refs.scSearch.reload();
|
||||
eventBus.$emit('reset-popovers');
|
||||
this.$refs.table.reload();
|
||||
},
|
||||
handleSaveSuccess(){
|
||||
this.$refs.table.refresh();
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.mainBox{
|
||||
padding: 0;
|
||||
}
|
||||
.logoCell{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
height: 20px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
</style>
|
||||
@ -1,329 +1,46 @@
|
||||
<template>
|
||||
<el-container class="mainBox mainBoxHeaderNoBorder">
|
||||
<el-main class="nopadding">
|
||||
<div class="searchMain">
|
||||
<scTableSearch ref="scSearch" :searchList="list.column" :paramsData="params" :searchShow="searchShow" @fetchSelectData="getSelectData" @changeHeaderData="getHeaderData"></scTableSearch>
|
||||
<el-main class="tabsMain">
|
||||
<el-tabs tab-position="top" class="tabsPadding" v-model="tabsTrue" @tab-change="tabsChange">
|
||||
<el-tab-pane label="出货清单" name="list">
|
||||
<list v-if="tabsTrue == 'list'"></list>
|
||||
</el-tab-pane>
|
||||
|
||||
<div class="searchItem searchBtn" v-if="searchHeaderShow">
|
||||
<el-button :size="size" :icon="searchShow?'el-icon-ArrowUpBold':'el-icon-ArrowDownBold'" @click="searchShowClick">{{searchShow?'收起':'更多'}}</el-button>
|
||||
<el-button :size="size" type="primary" icon="el-icon-search" @click="upSearch">查询</el-button>
|
||||
<el-button :size="size" type="info" icon="el-icon-RefreshRight" @click="reset">重置</el-button>
|
||||
</div>
|
||||
</div>
|
||||
<scTable ref="table" :apiObj="list.apiObj" :column="list.column" row-key="id" stripe border :size="size" @selection-change="selectionChange" @columnBack="columnBack">
|
||||
<el-table-column type="selection" align="center" width="40"></el-table-column>
|
||||
<template #logo="scope">
|
||||
<el-image class="logoCell" :src="scope.row.logo" preview-teleported :preview-src-list="[scope.row.logo]" fit="contain">
|
||||
<template #error>
|
||||
<div class="image-slot" style="text-align: center;font-size: 20px;">
|
||||
<el-icon><el-icon-Picture /></el-icon>
|
||||
</div>
|
||||
</template>
|
||||
</el-image>
|
||||
</template>
|
||||
<template #active_status="scope">
|
||||
<el-switch :size="size" v-model="scope.row.active_status" @change="changeSwitch($event, scope.row)" :loading="scope.row.$switch_status" :active-value="true" :inactive-value="false"></el-switch>
|
||||
</template>
|
||||
<el-table-column label="操作" fixed="right" align="center" width="150">
|
||||
<template #default="scope">
|
||||
<el-dropdown>
|
||||
<el-button class="noBorderBtn" icon="el-icon-more" :size="size"></el-button>
|
||||
<template #dropdown>
|
||||
<el-dropdown-menu>
|
||||
<el-dropdown-item @click="table_show(scope.row, 'see')" icon="sc-icon-See">查看详情</el-dropdown-item>
|
||||
<el-dropdown-item @click="table_edit(scope.row, 'edit')" icon="sc-icon-Edit">编辑公司</el-dropdown-item>
|
||||
<el-dropdown-item icon="sc-icon-AbilityAuthorization" @click="table_empower(scope.row)" divided>功能授权</el-dropdown-item>
|
||||
<el-dropdown-item icon="sc-icon-DataAuthorization">数据授权</el-dropdown-item>
|
||||
<el-dropdown-item icon="sc-icon-UserList" @click="table_user_ist(scope.row)" divided>用户列表</el-dropdown-item>
|
||||
<el-dropdown-item @click="table_del(scope.row, 'delete')" icon="sc-icon-Delete">删除公司</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</template>
|
||||
</el-dropdown>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</scTable>
|
||||
<el-tab-pane label="BOM清单" name="bom">
|
||||
<bom v-if="tabsTrue == 'bom'"></bom>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
</el-main>
|
||||
</el-container>
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
import {eventBus} from "@/utils/eventBus";
|
||||
import list from './list'
|
||||
import bom from './bom'
|
||||
|
||||
export default {
|
||||
name:"shipmentList",
|
||||
name: 'shipmentList',
|
||||
components: {
|
||||
|
||||
list,
|
||||
bom
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
size:'small',
|
||||
dialog: {
|
||||
save: false,
|
||||
show: false,
|
||||
},
|
||||
list: {
|
||||
apiObj: this.$API.shipment.out.list,
|
||||
column: [],
|
||||
},
|
||||
selection: [],
|
||||
exportShow:false,
|
||||
searchShow:false,
|
||||
searchHeaderShow:false,
|
||||
filterMap:{
|
||||
data:{}
|
||||
},
|
||||
params: {},
|
||||
tabsTrue:'list',
|
||||
|
||||
routerList: this.$store.state.global.docsRouter,
|
||||
shareList: this.$store.state.global.shareRouter,
|
||||
}
|
||||
},
|
||||
provide(){
|
||||
return{
|
||||
filterUploadClick:this.filterClick,
|
||||
filterUploadParams:this.filterParams,
|
||||
filterTagClose:this.tagClose,
|
||||
filterModelParams:this.filterModelParams,
|
||||
}
|
||||
},
|
||||
watch:{
|
||||
'list.column':{
|
||||
handler(val){
|
||||
this.searchHeaderShow = val.length>0 && val.some(em=>em.is_search);
|
||||
},
|
||||
immediate:false,
|
||||
deep:true
|
||||
}
|
||||
},
|
||||
computed:{
|
||||
filterModelParams(){
|
||||
return this.filterMap
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
/** 检索开始 */
|
||||
columnBack(val){
|
||||
val.forEach(item=>{
|
||||
if(item.prop === "repair_status"){
|
||||
item.data = this.setMap.statusList;
|
||||
tabsChange(){
|
||||
let arrList = [{name:'我的文档',id:''}];
|
||||
this.$store.commit("SET_docs_router", arrList);
|
||||
this.$store.commit("SET_share_router", arrList);
|
||||
}
|
||||
})
|
||||
this.list.column = val;
|
||||
},
|
||||
async filterClick(item) {
|
||||
let {data, params} = item;
|
||||
let filterParams = Object.assign(this.params,params);
|
||||
this.filterMap.data = filterParams;
|
||||
let searchParams = this.$TOOL.objCopy(this.params);
|
||||
searchParams.field = ""
|
||||
if (typeof data.prop === 'string') {
|
||||
searchParams.field = data.prop;
|
||||
} else {
|
||||
searchParams.field = data.prop[0];
|
||||
}
|
||||
if (data.search_type == 'select' || data.search_type == 'checkbox') {
|
||||
await this.getField(data,searchParams);
|
||||
}
|
||||
},
|
||||
filterParams(params){
|
||||
let filterParams = Object.assign(this.params,params);
|
||||
this.filterMap.data = filterParams;
|
||||
this.upSearch();
|
||||
},
|
||||
tagClose(params){
|
||||
let filterParams = Object.assign(this.params,params);
|
||||
this.filterMap.data = filterParams;
|
||||
},
|
||||
searchShowClick(){
|
||||
this.searchShow = !this.searchShow;
|
||||
eventBus.$emit('close-all-popovers');
|
||||
},
|
||||
getHeaderData(params){
|
||||
this.params = params;
|
||||
this.filterMap.data = params;
|
||||
},
|
||||
async getSelectData(item) {
|
||||
let {data, params} = item;
|
||||
this.params = params; // 列表需要的参数
|
||||
this.filterMap.data = params; // 表头组件需要转 才能传的参数
|
||||
let searchParams = this.$TOOL.objCopy(params);
|
||||
searchParams.field = ""
|
||||
if (typeof data.prop === 'string') {
|
||||
searchParams.field = data.prop;
|
||||
} else {
|
||||
searchParams.field = data.prop[0];
|
||||
}
|
||||
if (data.search_type == 'select' || data.search_type == 'checkbox') {
|
||||
await this.getField(data,searchParams)
|
||||
}
|
||||
},
|
||||
async getField(data,searchParams) {
|
||||
const res = await this.$API.orders.order.out.field.post(searchParams);
|
||||
if (res.code == 200) {
|
||||
if (res.data && res.data.length > 0) {
|
||||
res.data.forEach(item => {
|
||||
if (data.prop === 'repair_status') {
|
||||
this.setMap.statusList.forEach(em => {
|
||||
if (em.value === item[data.prop]) {
|
||||
item.label = em.label;
|
||||
item.value = em.value;
|
||||
}
|
||||
})
|
||||
} else {
|
||||
item.label = item[data.prop];
|
||||
item.value = item[data.prop];
|
||||
}
|
||||
})
|
||||
}
|
||||
this.list.column.forEach(item => {
|
||||
if (item.prop == data.prop) {
|
||||
item.data = res.data;
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
/** 检索结束 */
|
||||
|
||||
//添加
|
||||
add(){
|
||||
this.dialog.save = true;
|
||||
this.$nextTick(() => {
|
||||
this.$refs.saveDialog.open()
|
||||
})
|
||||
},
|
||||
|
||||
// 批量导入
|
||||
importFile(){
|
||||
this.$nextTick(()=>{
|
||||
this.$refs.scImport.importFile();
|
||||
})
|
||||
},
|
||||
async importTemplate() {
|
||||
const res = await this.$API.orders.order.maintenance.template.post();
|
||||
const blob = new Blob([res]);
|
||||
const text = new Date().getTime();
|
||||
const eLink = document.createElement('a');
|
||||
eLink.download = "维保导入模版_"+text+'.xlsx';
|
||||
eLink.style.display = 'none';
|
||||
eLink.href = URL.createObjectURL(blob);
|
||||
document.body.appendChild(eLink);
|
||||
eLink.click();
|
||||
URL.revokeObjectURL(eLink.href);
|
||||
document.body.removeChild(eLink);
|
||||
},
|
||||
async importUpload(params) {
|
||||
const res = await this.$API.orders.order.maintenance.import.post(params);
|
||||
if(res.code == 200){
|
||||
this.$message.success('上传成功,开始导入数据');
|
||||
}
|
||||
},
|
||||
importSuccess(){
|
||||
this.$refs.table.refresh()
|
||||
},
|
||||
|
||||
//编辑
|
||||
table_edit(row){
|
||||
this.dialog.save = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs.saveDialog.open('edit').setData(row)
|
||||
})
|
||||
},
|
||||
//查看
|
||||
table_show(row){
|
||||
this.dialog.show = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs.showDialog.open('show').setData(row);
|
||||
})
|
||||
},
|
||||
//删除
|
||||
async table_del(row){
|
||||
this.$confirm(`确定删除 ${row.name} 吗?`, '提示', {
|
||||
type: 'warning'
|
||||
}).then(async () => {
|
||||
const reqData = {id: row.id};
|
||||
const res = await this.$API.system.company.delete.post(reqData);
|
||||
if(res.code == 200){
|
||||
this.$refs.table.refresh()
|
||||
this.$message.success("删除成功")
|
||||
}else{
|
||||
await this.$alert(res.message, "提示", {type: 'error'})
|
||||
}
|
||||
}).catch(()=>{})
|
||||
},
|
||||
// 功能授权
|
||||
table_empower(row){
|
||||
this.$router.push({
|
||||
path: '/setting/company/add-permission',
|
||||
query: {
|
||||
id: row.id,
|
||||
name:row.name
|
||||
}
|
||||
})
|
||||
},
|
||||
// 公司用户列表
|
||||
table_user_ist(row){
|
||||
this.$router.push({
|
||||
path: '/setting/user/company-user-list',
|
||||
query: {
|
||||
id: row.id,
|
||||
name:row.name
|
||||
}
|
||||
})
|
||||
},
|
||||
//表格选择后回调事件
|
||||
selectionChange(selection){
|
||||
this.selection = selection;
|
||||
},
|
||||
// 状态
|
||||
changeSwitch(val, row) {
|
||||
row.$switch_yx = true;
|
||||
setTimeout(async () => {
|
||||
let params = {
|
||||
id: row.id,
|
||||
status: row.active_status,
|
||||
};
|
||||
const res = await this.$API.system.company.status.post(params);
|
||||
if(res.code !=200){
|
||||
row.active_status = !row.active_status;
|
||||
}
|
||||
delete row.$switch_status;
|
||||
delete row.$switch_yx;
|
||||
}, 500);
|
||||
},
|
||||
// 下载导出
|
||||
exportChangeShow(params){
|
||||
if(params.type == 11){
|
||||
this.exportShow = params.status==0?true:false
|
||||
}
|
||||
},
|
||||
async exportData() {
|
||||
if(this.exportShow) return
|
||||
const res = await this.$API.orders.order.maintenance.export.post(this.params);
|
||||
if(res.code == 200){
|
||||
this.$message.success('开始导出');
|
||||
}
|
||||
},
|
||||
upSearch(){
|
||||
this.$refs.table.upData(this.params);
|
||||
},
|
||||
reset(){
|
||||
this.params = {};
|
||||
this.filterMap.data = {};
|
||||
this.$refs.scSearch.reload();
|
||||
eventBus.$emit('reset-popovers');
|
||||
this.$refs.table.reload();
|
||||
},
|
||||
handleSaveSuccess(){
|
||||
this.$refs.table.refresh();
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.logoCell{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
height: 20px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
265
src/views/shipment/shipmentList/list.vue
Normal file
265
src/views/shipment/shipmentList/list.vue
Normal file
@ -0,0 +1,265 @@
|
||||
<template>
|
||||
<el-container class="mainBox mainBoxHeaderNoBorder">
|
||||
<el-main class="nopadding">
|
||||
<div class="searchMain">
|
||||
<scTableSearch ref="scSearch" :searchList="list.column" :paramsData="params" :searchShow="searchShow" @fetchSelectData="getSelectData" @changeHeaderData="getHeaderData"></scTableSearch>
|
||||
|
||||
<div class="searchItem searchBtn" v-if="searchHeaderShow">
|
||||
<el-button :size="size" :icon="searchShow?'el-icon-ArrowUpBold':'el-icon-ArrowDownBold'" @click="searchShowClick">{{searchShow?'收起':'更多'}}</el-button>
|
||||
<el-button :size="size" type="primary" icon="el-icon-search" @click="upSearch">查询</el-button>
|
||||
<el-button :size="size" type="info" icon="el-icon-RefreshRight" @click="reset">重置</el-button>
|
||||
<el-button type="danger" v-auth="'deleteOutStockImport'" plain :size="size" icon="el-icon-Delete" :disabled="selection.length==0" @click="batch_del"></el-button>
|
||||
<scImport ref="scImport" :size="size" type="45" :httpDisabled="httpDisabled" title="批量导入出货清单" @parentParams="importUpload" @importSuccess="importSuccess">
|
||||
<template #header>
|
||||
<el-button v-auth="'outStockImport'" type="primary" :size="size" plain @click="importFile" style="margin-right: 12px;">批量导入</el-button>
|
||||
</template>
|
||||
<template #cover>
|
||||
<el-checkbox v-model="importParams.is_save_repeat" :label="true">覆盖重复数据</el-checkbox>
|
||||
</template>
|
||||
<template #download>
|
||||
<div v-auth="'shippingListImportTemplate'" @click="importTemplate">下载导入模版</div>
|
||||
</template>
|
||||
</scImport>
|
||||
</div>
|
||||
</div>
|
||||
<scTable ref="table" :apiObj="list.apiObj" :column="list.column" row-key="id" stripe border :size="size" @selection-change="selectionChange" @columnBack="columnBack">
|
||||
<el-table-column type="selection" align="center" width="40"></el-table-column>
|
||||
<template #logo="scope">
|
||||
<el-image class="logoCell" :src="scope.row.logo" preview-teleported :preview-src-list="[scope.row.logo]" fit="contain">
|
||||
<template #error>
|
||||
<div class="image-slot" style="text-align: center;font-size: 20px;">
|
||||
<el-icon><el-icon-Picture /></el-icon>
|
||||
</div>
|
||||
</template>
|
||||
</el-image>
|
||||
</template>
|
||||
</scTable>
|
||||
</el-main>
|
||||
</el-container>
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
import {eventBus} from "@/utils/eventBus";
|
||||
|
||||
export default {
|
||||
name:"",
|
||||
components: {
|
||||
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
size:'small',
|
||||
httpDisabled:false,
|
||||
dialog: {
|
||||
save: false,
|
||||
show: false,
|
||||
},
|
||||
list: {
|
||||
apiObj: this.$API.shipment.out.stockImport,
|
||||
column: [],
|
||||
},
|
||||
selection: [],
|
||||
exportShow:false,
|
||||
searchShow:false,
|
||||
searchHeaderShow:false,
|
||||
filterMap:{
|
||||
data:{}
|
||||
},
|
||||
params: {},
|
||||
importParams:{
|
||||
is_save_repeat:false
|
||||
}
|
||||
}
|
||||
},
|
||||
provide(){
|
||||
return{
|
||||
filterUploadClick:this.filterClick,
|
||||
filterUploadParams:this.filterParams,
|
||||
filterTagClose:this.tagClose,
|
||||
filterModelParams:this.filterModelParams,
|
||||
}
|
||||
},
|
||||
watch:{
|
||||
'list.column':{
|
||||
handler(val){
|
||||
this.searchHeaderShow = val.length>0 && val.some(em=>em.is_search);
|
||||
},
|
||||
immediate:false,
|
||||
deep:true
|
||||
}
|
||||
},
|
||||
computed:{
|
||||
filterModelParams(){
|
||||
return this.filterMap
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
/** 检索开始 */
|
||||
columnBack(val){
|
||||
this.list.column = val;
|
||||
},
|
||||
async filterClick(item) {
|
||||
let {data, params} = item;
|
||||
let filterParams = Object.assign(this.params,params);
|
||||
this.filterMap.data = filterParams;
|
||||
let searchParams = this.$TOOL.objCopy(this.params);
|
||||
searchParams.field = ""
|
||||
if (typeof data.prop === 'string') {
|
||||
searchParams.field = data.prop;
|
||||
} else {
|
||||
searchParams.field = data.prop[0];
|
||||
}
|
||||
if (data.search_type == 'select' || data.search_type == 'checkbox') {
|
||||
await this.getField(data,searchParams);
|
||||
}
|
||||
},
|
||||
filterParams(params){
|
||||
let filterParams = Object.assign(this.params,params);
|
||||
this.filterMap.data = filterParams;
|
||||
this.upSearch();
|
||||
},
|
||||
tagClose(params){
|
||||
let filterParams = Object.assign(this.params,params);
|
||||
this.filterMap.data = filterParams;
|
||||
},
|
||||
searchShowClick(){
|
||||
this.searchShow = !this.searchShow;
|
||||
eventBus.$emit('close-all-popovers');
|
||||
},
|
||||
getHeaderData(params){
|
||||
this.params = params;
|
||||
this.filterMap.data = params;
|
||||
},
|
||||
async getSelectData(item) {
|
||||
let {data, params} = item;
|
||||
this.params = params; // 列表需要的参数
|
||||
this.filterMap.data = params; // 表头组件需要转 才能传的参数
|
||||
let searchParams = this.$TOOL.objCopy(params);
|
||||
searchParams.field = ""
|
||||
if (typeof data.prop === 'string') {
|
||||
searchParams.field = data.prop;
|
||||
} else {
|
||||
searchParams.field = data.prop[0];
|
||||
}
|
||||
if (data.search_type == 'select' || data.search_type == 'checkbox') {
|
||||
await this.getField(data,searchParams)
|
||||
}
|
||||
},
|
||||
async getField(data,searchParams) {
|
||||
const res = await this.$API.shipment.out.field.post(searchParams);
|
||||
if (res.code == 200) {
|
||||
if (res.data && res.data.length > 0) {
|
||||
res.data.forEach(item => {
|
||||
item.label = item[data.prop];
|
||||
item.value = item[data.prop];
|
||||
})
|
||||
}
|
||||
this.list.column.forEach(item => {
|
||||
if (item.prop == data.prop) {
|
||||
item.data = res.data;
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
/** 检索结束 */
|
||||
|
||||
//添加
|
||||
add(){
|
||||
this.dialog.save = true;
|
||||
this.$nextTick(() => {
|
||||
this.$refs.saveDialog.open()
|
||||
})
|
||||
},
|
||||
|
||||
// 批量导入
|
||||
importFile(){
|
||||
this.$nextTick(()=>{
|
||||
this.$refs.scImport.importFile();
|
||||
})
|
||||
},
|
||||
async importTemplate() {
|
||||
const res = await this.$API.shipment.out.template.post();
|
||||
const blob = new Blob([res]);
|
||||
const text = new Date().getTime();
|
||||
const eLink = document.createElement('a');
|
||||
eLink.download = "清单导入模版_"+text+'.xlsx';
|
||||
eLink.style.display = 'none';
|
||||
eLink.href = URL.createObjectURL(blob);
|
||||
document.body.appendChild(eLink);
|
||||
eLink.click();
|
||||
URL.revokeObjectURL(eLink.href);
|
||||
document.body.removeChild(eLink);
|
||||
},
|
||||
async importUpload(params) {
|
||||
const updateOrAppend = (formData, key, value) => {
|
||||
let found = false;
|
||||
for (let [k] of formData.entries()) {
|
||||
if (k === key) {
|
||||
formData.set(k, value); // 替换已存在的值
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
formData.append(key, value); // 如果没有找到,则添加新项
|
||||
}
|
||||
};
|
||||
updateOrAppend(params, 'is_save_repeat', this.importParams.is_save_repeat);
|
||||
|
||||
const res = await this.$API.shipment.out.import.post(params);
|
||||
if(res.code == 200){
|
||||
this.$message.success('上传成功,开始导入数据');
|
||||
}
|
||||
},
|
||||
importSuccess(){
|
||||
this.$refs.table.refresh()
|
||||
},
|
||||
// 删除
|
||||
batch_del(){
|
||||
this.$confirm(`确定删除选中 ${this.selection.length} 项吗?`, '提示', {
|
||||
type: 'warning'
|
||||
}).then(async () => {
|
||||
const reqData = {ids: this.selection.map(em=>em.id)};
|
||||
const res = await this.$API.shipment.out.deleteImport.post(reqData);
|
||||
if(res.code == 200){
|
||||
this.$refs.table.refresh()
|
||||
this.$message.success("删除成功")
|
||||
}else{
|
||||
await this.$alert(res.message, "提示", {type: 'error'})
|
||||
}
|
||||
}).catch(()=>{})
|
||||
},
|
||||
//表格选择后回调事件
|
||||
selectionChange(selection){
|
||||
this.selection = selection;
|
||||
},
|
||||
upSearch(){
|
||||
this.$refs.table.upData(this.params);
|
||||
},
|
||||
reset(){
|
||||
this.params = {};
|
||||
this.filterMap.data = {};
|
||||
this.$refs.scSearch.reload();
|
||||
eventBus.$emit('reset-popovers');
|
||||
this.$refs.table.reload();
|
||||
},
|
||||
handleSaveSuccess(){
|
||||
this.$refs.table.refresh();
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.mainBox{
|
||||
padding: 0;
|
||||
}
|
||||
.logoCell{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
height: 20px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
</style>
|
||||
Loading…
Reference in New Issue
Block a user