Merge branch 'master' of http://192.168.31.40:10101/r/Demay_New
commit
c8c073997c
@ -0,0 +1,126 @@
|
||||
<template>
|
||||
<el-dialog
|
||||
title="同步数据"
|
||||
:visible.sync="showVisible"
|
||||
width="30%"
|
||||
:before-close="handleClose"
|
||||
>
|
||||
<div>
|
||||
<el-select ref="select" collapse-tags filterable default-first-option v-model="storeId" clearable @clear="getData" placeholder="请选择门店" @change="getData">
|
||||
<el-option v-for="item in options" :key="item.id" :label="item.label" :value="item.id">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="handleCancel" size='mini'>取 消</el-button>
|
||||
<el-button type="primary" @click="handleConfirm" :loading='loading' size='mini'>确 定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { organizations,allStores,totalData } from "@/api/storeManage.js";
|
||||
export default {
|
||||
watch:{
|
||||
showVisible:{
|
||||
handler(show){
|
||||
if(show){
|
||||
this.storeId = ''
|
||||
this.form = {}
|
||||
this.init()
|
||||
}
|
||||
},
|
||||
immediate:true
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
loading:false,
|
||||
showVisible:false,
|
||||
storeId:"",
|
||||
options:[],
|
||||
form:{},
|
||||
};
|
||||
},
|
||||
methods:{
|
||||
handleConfirm(){
|
||||
if(!this.form.maximumAmount){
|
||||
return this.$message({
|
||||
type: "info",
|
||||
message: "请先选择门店",
|
||||
});
|
||||
}else{
|
||||
this.$emit('getData',null,this.storeId,true)
|
||||
this.$emit('updataStore')
|
||||
sessionStorage.setItem('formData',JSON.stringify(this.form))
|
||||
this.handleCancel()
|
||||
// this.loading = true
|
||||
// totalData( this.form ).then(res=>{
|
||||
// if(res.code == '000000'){
|
||||
// this.loading = false
|
||||
// this.$message.success({ message: "操作成功" });
|
||||
// this.handleCancel()
|
||||
// }else{
|
||||
// this.loading = false
|
||||
// }
|
||||
// })
|
||||
}
|
||||
},
|
||||
handleCancel(){
|
||||
this.showVisible = false
|
||||
this.form = {}
|
||||
this.storeId = ''
|
||||
},
|
||||
handleClose(done){
|
||||
this.storeId = ''
|
||||
done();
|
||||
},
|
||||
getData(id){
|
||||
if(id){
|
||||
// 拿到店名
|
||||
let storeName = this.options[this.options.findIndex(item=>item.id === id)].storeName
|
||||
this.form = { toreIds:id+'|'+storeName }
|
||||
this.getOtherStore(id)
|
||||
}else{
|
||||
this.form = {}
|
||||
}
|
||||
},
|
||||
// 获取其他门店数据
|
||||
getOtherStore(id){
|
||||
allStores({ storeId:id }).then(res=>{
|
||||
if(res.code == '000000'){
|
||||
let params = {}
|
||||
res.rows.forEach((item)=>{
|
||||
if(!params[item.paramentName]){
|
||||
params[item.paramentName] = item.paramentValue+'|'+item.remark
|
||||
}
|
||||
})
|
||||
this.form = Object.assign({...params},this.form)
|
||||
}
|
||||
})
|
||||
},
|
||||
// 初始化门店
|
||||
init(){
|
||||
organizations({ pageSize: 999 }).then((res) => {
|
||||
if (res.code == "000000") {
|
||||
res.rows.forEach((item) => {
|
||||
item.label = item.storeNum + "-" + item.storeName;
|
||||
});
|
||||
this.options = res.rows;
|
||||
} else {
|
||||
this.$alert(res.message, "提示", {
|
||||
confirmButtonText: "确定",
|
||||
confirmButtonClass: "confirmbtnFalses",
|
||||
type: "warning",
|
||||
center: true,
|
||||
callback: (action) => {},
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
</style>
|
||||
Loading…
Reference in New Issue