客户管理功能代码提交
							parent
							
								
									3c83f74caa
								
							
						
					
					
						commit
						43187b1482
					
				| @ -0,0 +1,91 @@ | ||||
| import axios from '@/utils/request' | ||||
| 
 | ||||
| export function getPlatform(query) { | ||||
|     return axios({ | ||||
|         url: "/udiwms/platform/list", | ||||
|         method: "get", | ||||
|         params: query | ||||
|     }); | ||||
| } | ||||
| 
 | ||||
| export function updatePlatform(data) { | ||||
|     return axios({ | ||||
|         url: "/udiwms/platform/update", | ||||
|         method: "post", | ||||
|         data: data | ||||
|     }); | ||||
| } | ||||
| 
 | ||||
| export function deletePlatform(data) { | ||||
|     return axios({ | ||||
|         url: "/udiwms/platform/remove", | ||||
|         method: "post", | ||||
|         data: data | ||||
|     }); | ||||
| } | ||||
| 
 | ||||
| export function linkPlatform(query) { | ||||
|     return axios({ | ||||
|         url: "/udiwms/platform/link", | ||||
|         method: "post", | ||||
|         data: query | ||||
|     }); | ||||
| } | ||||
| 
 | ||||
| //查询往来单位和自助平台关联数据
 | ||||
| export function getLinkPlatformList(query) { | ||||
|     return axios({ | ||||
|         url: "/udiwms/platform/getLinkPlatformList", | ||||
|         method: "get", | ||||
|         params: query | ||||
|     }); | ||||
| } | ||||
| 
 | ||||
| //解绑往来单位字典和自助平台
 | ||||
| export function unbindPlatform(query) { | ||||
|     return axios({ | ||||
|         url: "/udiwms/platform/unbind", | ||||
|         method: "post", | ||||
|         params: query | ||||
|     }); | ||||
| } | ||||
| 
 | ||||
| export function getTargetActions(query) { | ||||
|     return axios({ | ||||
|         url: "/udiwms/platform/getTargetActions", | ||||
|         method: "get", | ||||
|         params: query | ||||
|     }); | ||||
| } | ||||
| 
 | ||||
| export function getTargetInv(query) { | ||||
|     return axios({ | ||||
|         url: "/udiwms/platform/getTargetInv", | ||||
|         method: "get", | ||||
|         params: query | ||||
|     }); | ||||
| } | ||||
| 
 | ||||
| export function getTargetSubInv(query) { | ||||
|     return axios({ | ||||
|         url: "/udiwms/platform/getTargetSubInv", | ||||
|         method: "get", | ||||
|         params: query | ||||
|     }); | ||||
| } | ||||
| 
 | ||||
| export function testPlatformConnection(query) { | ||||
|     return axios({ | ||||
|         url: "/udiwms/platform/testPlatformConnection", | ||||
|         method: "get", | ||||
|         params: query | ||||
|     }) | ||||
| } | ||||
| 
 | ||||
| export function testUserInfo(data) { | ||||
|     return axios({ | ||||
|         url: "/udiwms/platform/testUserInfo", | ||||
|         method: "post", | ||||
|         data: data | ||||
|     }); | ||||
| } | ||||
| @ -0,0 +1,44 @@ | ||||
| import axios from '@/utils/request' | ||||
| 
 | ||||
| export function getUnitMaintain(query) { | ||||
|     return axios({ | ||||
|         url: "/warehouse/unitMaintain/filter", | ||||
|         method: "get", | ||||
|         params: query | ||||
|     }); | ||||
| } | ||||
| 
 | ||||
| export function combine(query) { | ||||
|     return axios({ | ||||
|         url: "/udiwms/basic/unit/maintain/combine", | ||||
|         method: "post", | ||||
|         data: query | ||||
|     }); | ||||
| } | ||||
| 
 | ||||
| export function deleteUnitMaintain(query) { | ||||
|     return axios({ | ||||
|         url: "/warehouse/unitMaintain/delete", | ||||
|         method: "post", | ||||
|         data: query | ||||
|     }); | ||||
| } | ||||
| 
 | ||||
| export function addUnit(query) { | ||||
|     return axios({ | ||||
|         url: "/warehouse/unitMaintain/add", | ||||
|         method: "post", | ||||
|         data: query | ||||
|     }); | ||||
| } | ||||
| 
 | ||||
| export function modifyUnit(query) { | ||||
|     return axios({ | ||||
|         url: "/warehouse/unitMaintain/modify", | ||||
|         method: "post", | ||||
|         data: query | ||||
|     }); | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| @ -0,0 +1,189 @@ | ||||
| <template> | ||||
|   <div> | ||||
|     <el-card> | ||||
|       <el-form :model="query" label-width="100px" size="mini"> | ||||
|         <el-row> | ||||
|           <el-col :span="6"> | ||||
|             <el-form-item label="自助平台名称" class="query-form-item"> | ||||
|               <el-input v-model="query.key" style="width: 100%;" placeholder="请输入自助平台名称" clearable="true"></el-input> | ||||
|             </el-form-item> | ||||
|           </el-col> | ||||
|           <el-col :span="6"> | ||||
|             <el-form-item> | ||||
|               <el-button-group> | ||||
|                 <el-button type="primary" icon="el-icon-refresh" @click="onReset"></el-button> | ||||
|                 <el-button type="primary" icon="search" @click="search">查询</el-button> | ||||
|               </el-button-group> | ||||
|             </el-form-item> | ||||
|           </el-col> | ||||
|         </el-row> | ||||
|       </el-form> | ||||
| 
 | ||||
|       <el-table v-loading="loading" :data="list" border  style="width: 100%" @row-click="handleSelectionChange"> | ||||
|         <el-table-column label="序号" type="index" fixed></el-table-column> | ||||
|         <el-table-column label="自助平台名称" prop="name" fixed></el-table-column> | ||||
|         <el-table-column label="往来单位编码" prop="unitId" fixed></el-table-column> | ||||
|         <el-table-column label="往来单位名称" prop="corpName" fixed></el-table-column> | ||||
|         <el-table-column label="操作" fixed="right"> | ||||
|           <template slot-scope="scope"> | ||||
|             <el-button type="text" size="small" @click.native.stop="handleModifyClick(scope.row)">编辑</el-button> | ||||
|           </template> | ||||
|         </el-table-column> | ||||
|       </el-table> | ||||
| 
 | ||||
|       <pagination | ||||
|           v-show="total>0" | ||||
|           :total="total" | ||||
|           :limit.sync="query.limit" | ||||
|           :page.sync="query.page" | ||||
|           @pagination="handleCurrentChange" | ||||
|       ></pagination> | ||||
|     </el-card> | ||||
| 
 | ||||
| 
 | ||||
|       <el-card> | ||||
|         <el-table :data="delectList" border highlight-current-row style="width: 100%"> | ||||
|           <el-table-column label="本地单据" prop="sourceName" fixed></el-table-column> | ||||
|           <el-table-column label="目标部门" prop="invName" fixed></el-table-column> | ||||
|           <el-table-column label="目标仓库" prop="invSubName" fixed></el-table-column> | ||||
|           <el-table-column label="目标单据类型" prop="targetName" fixed></el-table-column> | ||||
|         </el-table> | ||||
| 
 | ||||
|         <pagination | ||||
|             v-show="delectTotal>0" | ||||
|             :total="delectTotal" | ||||
|             :limit.sync="delectQuery.limit" | ||||
|             :page.sync="delectQuery.page" | ||||
|             @pagination="handleCurrentChange" | ||||
|         ></pagination> | ||||
|       </el-card> | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
|       <el-dialog | ||||
|           title="关联医院客户" | ||||
|           :visible.sync="editLoginVisible" | ||||
|           v-if="editLoginVisible" | ||||
|           :close-on-click-modal="false" | ||||
|           :close-on-press-escape="false" | ||||
|           width="60%" | ||||
|       > | ||||
|         <bindPlatformModel | ||||
|             :editQuery="editLogin" | ||||
|             :closeDialog="closeDialog" | ||||
|         ></bindPlatformModel> | ||||
|       </el-dialog> | ||||
| 
 | ||||
|   </div> | ||||
| </template> | ||||
| 
 | ||||
| <script> | ||||
| import { | ||||
|   addUnit, | ||||
|   modifyUnit | ||||
| } from "@/api/userManage/unitMaintain"; | ||||
| import {getBasicUnitMaintains, getPlatFormDelect} from "@/api/basic/basicUnitMaintain"; | ||||
| import { | ||||
|   getPlatform, | ||||
|   linkPlatform, | ||||
|   getLinkPlatformList, | ||||
|   unbindPlatform, | ||||
|   getTargetActions, | ||||
|   getTargetInv, | ||||
|   getTargetSubInv, | ||||
|   testUserInfo | ||||
| } from "@/api/userManage/platform"; | ||||
| import {getBussinessType} from "../../api/basic/bussinessType"; | ||||
| import {isBlank} from "@/utils/strUtil"; | ||||
| import bindPlatformModel from "@/views/userManage/bindPlatformModel"; | ||||
| 
 | ||||
| export default { | ||||
|   data() { | ||||
|     return { | ||||
|       query: { | ||||
|         key: "", | ||||
|         coryType: null, | ||||
|         page: 1, | ||||
|         limit: 20 | ||||
|       }, | ||||
|       delectQuery: { | ||||
|         page: 1, | ||||
|         limit: 20 | ||||
|       }, | ||||
|       editLogin: {}, | ||||
|       loading: false, | ||||
|       editLoginVisible: false, | ||||
| 
 | ||||
|       checked: false, | ||||
|       list: [], | ||||
|       delectList: [], | ||||
|       total: 0, | ||||
|       delectTotal:0, | ||||
|       editType: 0, | ||||
|     }; | ||||
|   }, | ||||
|   components: {bindPlatformModel}, | ||||
|   methods: { | ||||
|     onReset() { | ||||
|       this.$router.push({ | ||||
|         path: "" | ||||
|       }); | ||||
|       this.query = { | ||||
|         key: "", | ||||
|         coryType: null, | ||||
|         customerId: this.$store.getters.customerId, | ||||
|         page: 1, | ||||
|         limit: 20 | ||||
|       }; | ||||
|       this.getList(); | ||||
|     }, | ||||
|     search() { | ||||
|       this.query.page = 1; | ||||
|       this.getList(); | ||||
|     }, | ||||
|     getList() { | ||||
|       this.loading = true; | ||||
|       getLinkPlatformList(this.query).then((res) => { | ||||
|         this.loading = false; | ||||
|         this.list = res.data.list || []; | ||||
|         this.total = res.data.total || 0; | ||||
|       }).catch(() => { | ||||
|         this.loading = false; | ||||
|         this.list = []; | ||||
|       }); | ||||
|     }, | ||||
|     handleCurrentChange(val) { | ||||
|       this.query.page = val; | ||||
|       this.getList(); | ||||
|     }, | ||||
|     handleModifyClick(row) { | ||||
|       this.editLoginVisible = true; | ||||
|       this.editLogin = row; | ||||
|     }, | ||||
|     handleAddClick() { | ||||
|       this.editLoginVisible = true; | ||||
|     }, | ||||
|     //获取详情列表 | ||||
|     getPlatFormDelect(platformId) { | ||||
|       this.delectQuery.platformId=platformId | ||||
|       getPlatFormDelect(this.delectQuery).then((res) => { | ||||
|         this.delectList = res.data.list || []; | ||||
|         this.delectTotal = res.data.total || 0; | ||||
|       }).catch((error) => { | ||||
|         this.$message.error(error.message); | ||||
|       }); | ||||
|     }, | ||||
|     handleSelectionChange(row){ | ||||
|       this.getPlatFormDelect(row.platformId) | ||||
|     } | ||||
|   }, | ||||
|   created() { | ||||
|     this.getList(); | ||||
|   } | ||||
| }; | ||||
| 
 | ||||
| </script> | ||||
| 
 | ||||
| <style> | ||||
| 
 | ||||
| </style> | ||||
| @ -0,0 +1,288 @@ | ||||
| <template> | ||||
|   <div> | ||||
|     <el-form :model="editLogin" label-width="120px" ref="editLogin"> | ||||
|       <el-row :gutter="20" class="el-row" type="flex"> | ||||
|         <el-col :span="15" class="el-col" type="flex"> | ||||
|           <div class="text item"> | ||||
|             <el-form-item label="本地单据类型" prop="sourceAction"> | ||||
|               <el-select | ||||
|                   v-model="editLogin.sourceAction" | ||||
|                   style="width: 100%" | ||||
|                   placeholder="请选择本地单据类型" | ||||
|               > | ||||
|                 <el-option | ||||
|                     v-for="item in bussinessTypes" | ||||
|                     :key="item.action" | ||||
|                     :label="item.name" | ||||
|                     :value="item.action" | ||||
|                 > | ||||
|                 </el-option> | ||||
|               </el-select> | ||||
|             </el-form-item> | ||||
|           </div> | ||||
|         </el-col> | ||||
|       </el-row> | ||||
|       <el-row :gutter="20" class="el-row" type="flex"> | ||||
|         <el-col :span="15" class="el-col" type="flex"> | ||||
|           <div class="text item"> | ||||
|             <el-form-item label="目标部门" prop="invCode"> | ||||
|               <el-select v-model="editLogin.invCode" | ||||
|                          style="width: 100%;" | ||||
|                          placeholder="目标部门信息" | ||||
|                          @change="locInvChange" | ||||
|               > | ||||
|                 <el-option | ||||
|                     v-for="item in targetInvs" | ||||
|                     :key="item.name" | ||||
|                     :label="item.name" | ||||
|                     :value="item.code"> | ||||
|                   <span style="float: left">{{ item.name }}</span> | ||||
|                 </el-option> | ||||
|               </el-select> | ||||
|             </el-form-item> | ||||
|           </div> | ||||
|         </el-col> | ||||
|       </el-row> | ||||
| 
 | ||||
|       <el-row :gutter="20" class="el-row" type="flex"> | ||||
|         <el-col :span="15" class="el-col" type="flex"> | ||||
|           <div class="text item"> | ||||
|             <el-form-item label="目标仓库" prop="invSubCode"> | ||||
|               <el-select v-model="editLogin.invSubCode" placeholder="目标仓库信息" | ||||
|                          style="width: 100%;" @change="locSubInvChange" filterable | ||||
|               > | ||||
|                 <el-option | ||||
|                     v-for="item in targetSubInvs" | ||||
|                     :key="item.name" | ||||
|                     :label="item.name" | ||||
|                     :value="item.code"> | ||||
|                   <span style="float: left">{{ item.name }}</span> | ||||
|                 </el-option> | ||||
|               </el-select> | ||||
|             </el-form-item> | ||||
|           </div> | ||||
|         </el-col> | ||||
|       </el-row> | ||||
| 
 | ||||
|       <el-row :gutter="20" class="el-row" type="flex"> | ||||
|         <el-col :span="15" class="el-col" type="flex"> | ||||
|           <div class="text item"> | ||||
|             <el-form-item label="目标单据类型" prop="targetAction"> | ||||
|               <el-select | ||||
|                   v-model="editLogin.targetAction" | ||||
|                   style="width: 100%" | ||||
|                   filterable | ||||
|                   placeholder="请选择目标单据类型" | ||||
|                   @change="targetActionChange" | ||||
|               > | ||||
|                 <el-option | ||||
|                     v-for="item in targetActions" | ||||
|                     :key="item.action" | ||||
|                     :label="item.name" | ||||
|                     :value="item.action" | ||||
|                 > | ||||
|                 </el-option> | ||||
|               </el-select> | ||||
|             </el-form-item> | ||||
|           </div> | ||||
|         </el-col> | ||||
|       </el-row> | ||||
|     </el-form> | ||||
| 
 | ||||
|     <div slot="footer" class="dialog-footer"> | ||||
|       <el-button @click.native.stop="cancelDialog" size="small">取消</el-button> | ||||
|       <el-button type="primary" size="small" @click.native="linkSubmit()">提交</el-button> | ||||
|     </div> | ||||
|   </div> | ||||
| </template> | ||||
| 
 | ||||
| <script> | ||||
| import { | ||||
|   getLinkPlatformList, | ||||
|   getPlatform, | ||||
|   getTargetActions, | ||||
|   getTargetInv, | ||||
|   getTargetSubInv, linkPlatform, testUserInfo, unbindPlatform | ||||
| } from "@/api/userManage/platform"; | ||||
| import { | ||||
|   getBasicUnitMaintains, | ||||
|   getBasicUnitMaintains2, | ||||
|   getCorpLists, | ||||
|   selectCorpList | ||||
| } from "@/api/basic/basicUnitMaintain"; | ||||
| import {getBussinessType} from "@/api/basic/bussinessType"; | ||||
| import {addUnit, modifyUnit} from "@/api/userManage/unitMaintain"; | ||||
| import {isBlank} from "@/utils/strUtil"; | ||||
| 
 | ||||
| export default { | ||||
|   name:'bindPlatformEditModel', | ||||
|   props: { | ||||
|     closeDialog: { | ||||
|       type: Function, | ||||
|       required: true, | ||||
|     }, | ||||
|     editQuery: { | ||||
|       type: Object, | ||||
|       required: true, | ||||
|     }, | ||||
|     formQuery: { | ||||
|       type: Object, | ||||
|       required: true, | ||||
|     }, | ||||
|   }, | ||||
|   data() { | ||||
|     return { | ||||
|       editLogin: { | ||||
|         id: null, | ||||
|         unitId: null, | ||||
|         name: null, | ||||
|         corpName: null, | ||||
|         platformId: null, | ||||
|         platformUsername: null, | ||||
|         platformPassword: null, | ||||
|         appid: null, | ||||
|         appKey: null, | ||||
|         sceretKey: null, | ||||
|         sourceAction: null, | ||||
|         targetAction: null, | ||||
|         platformList: [], | ||||
|         invCode: "", | ||||
|         invSubCode: "", | ||||
|       }, | ||||
|       editDialogVisible: false, | ||||
|       corpNamesList: [], | ||||
|       curPlatformId: "", | ||||
|       targetPlatformEdit: true, //目标平台启用编辑 | ||||
|       editPlatformQuery: { | ||||
|         unitId: null, | ||||
|         name: null, | ||||
|         host: null | ||||
|       }, | ||||
|       platformList: [], | ||||
|       bussinessTypes: [], | ||||
|       targetActions: [], | ||||
|       targetInvs: [], | ||||
|       targetSubInvs: [], | ||||
| 
 | ||||
|     }; | ||||
|   }, | ||||
| 
 | ||||
|   methods: { | ||||
|     getLocalBussinessType() { | ||||
|       let tQuery = {}; | ||||
|       getBussinessType(tQuery).then((res) => { | ||||
|         this.bussinessTypes = res.data.list || []; | ||||
|       }).catch((error) => { | ||||
|         this.$message.error(error.message); | ||||
|       }); | ||||
|     }, | ||||
|     getTargetInv() { | ||||
|       this.targetActions = []; | ||||
|       let query = { | ||||
|         platformId: this.editLogin.platformId, | ||||
|         apiKey: this.editLogin.apiKey, | ||||
|         apiSecret: this.editLogin.secretKey, | ||||
|       }; | ||||
|       getTargetInv(query).then((res) => { | ||||
|         this.targetInvs = res.data || []; | ||||
|       }).catch((error) => { | ||||
|         this.$message.error("获取自助平台单据类型失败"); | ||||
|       }); | ||||
|     }, | ||||
|     locInvChange() { | ||||
|       this.editLogin.invName = this.targetInvs.find(item => item.code == this.editLogin.invCode).name | ||||
|       this.editLogin.invSubCode=null | ||||
|       this.editLogin.targetAction=null | ||||
|       this.getTargetSubInv(); | ||||
|     }, | ||||
|     getTargetSubInv() { | ||||
|       this.targetActions = []; | ||||
|       let query = { | ||||
|         invCode: this.editLogin.invCode, | ||||
|         platformId: this.editLogin.platformId, | ||||
|         apiKey: this.editLogin.apiKey, | ||||
|         apiSecret: this.editLogin.secretKey, | ||||
|       }; | ||||
|       getTargetSubInv(query).then((res) => { | ||||
|         this.targetSubInvs = res.data || []; | ||||
|       }).catch((error) => { | ||||
|         this.$message.error("获取自助平台单据类型失败"); | ||||
|       }); | ||||
|     }, | ||||
|     locSubInvChange() { | ||||
|       this.editLogin.invSubName = this.targetSubInvs.find(item => item.code == this.editLogin.invSubCode).name | ||||
|       this.editLogin.targetAction=null | ||||
|       this.getTargetActions(); | ||||
|     }, | ||||
|     getTargetActions() { | ||||
|       this.targetActions = []; | ||||
|       let query = { | ||||
|         platformId: this.editLogin.platformId, | ||||
|         invSubCode: this.editLogin.invSubCode, | ||||
|         apiKey: this.editLogin.apiKey, | ||||
|         apiSecret: this.editLogin.secretKey, | ||||
|       }; | ||||
|       getTargetActions(query).then((res) => { | ||||
|         this.targetActions = res.data || []; | ||||
|       }).catch((error) => { | ||||
|         this.$message.error("获取自助平台单据类型失败"); | ||||
|       }); | ||||
|     }, | ||||
|     targetActionChange() { | ||||
|       this.editLogin.targetName = this.targetActions.find(item => item.action == this.editLogin.targetAction).name | ||||
|     }, | ||||
|     linkSubmit() { | ||||
|       linkPlatform(this.editLogin) | ||||
|           .then((response) => { | ||||
|             if (response.code == 20000) { | ||||
|               this.$message({ | ||||
|                 type: "success", | ||||
|                 message: "关联成功" | ||||
|               }); | ||||
|               this.cancelDialog(); | ||||
|             } else { | ||||
|               this.$message.error(response.message); | ||||
|             } | ||||
|           }) | ||||
|           .catch(() => { | ||||
|           }); | ||||
|     }, | ||||
|     cancelDialog() { | ||||
|       this.closeDialog(); | ||||
|     } | ||||
|   }, | ||||
|   created() { | ||||
|     debugger | ||||
|     if(this.formQuery==1){ | ||||
|       this.editLogin.platformId = this.editQuery.platformId; | ||||
|       this.editLogin.appid = this.editQuery.appid; | ||||
|       this.editLogin.apiKey = this.editQuery.apiKey; | ||||
|       this.editLogin.secretKey = this.editQuery.secretKey; | ||||
|       this.editLogin.unitId = this.editQuery.unitId; | ||||
|       this.editLogin.customerId = this.editQuery.platformId | ||||
|       this.getLocalBussinessType() | ||||
|       this.getTargetInv() | ||||
|     }else{ | ||||
|       this.editLogin.id = this.editQuery.id; | ||||
|       this.editLogin.platformId = this.editQuery.platformId; | ||||
|       this.editLogin.appid = this.editQuery.appid; | ||||
|       this.editLogin.apiKey = this.editQuery.apiKey; | ||||
|       this.editLogin.secretKey = this.editQuery.secretKey; | ||||
|       this.editLogin.unitId = this.editQuery.unitId; | ||||
|       this.editLogin.customerId = this.editQuery.platformId | ||||
|       this.editLogin.sourceAction = this.editQuery.sourceAction | ||||
|       this.editLogin.invCode = this.editQuery.invCode | ||||
|       this.editLogin.invSubCode = this.editQuery.invSubCode | ||||
|       this.editLogin.targetAction = this.editQuery.targetAction | ||||
|       this.getLocalBussinessType() | ||||
|       this.getTargetInv() | ||||
|       this.getTargetSubInv(); | ||||
|       this.getTargetActions(); | ||||
|     } | ||||
|   } | ||||
| }; | ||||
| </script> | ||||
| 
 | ||||
| <style scoped> | ||||
| 
 | ||||
| </style> | ||||
| @ -0,0 +1,323 @@ | ||||
| <template> | ||||
|   <div> | ||||
|     <el-form :model="editLogin" label-width="120px" ref="editLogin" :rules="platformRules"> | ||||
|       <el-card> | ||||
|         <el-row :gutter="20" class="el-row" type="flex"> | ||||
|           <el-col :span="10" class="el-col" type="flex"> | ||||
|             <div class="text item"> | ||||
|               <el-form-item label="客户名称" prop="unitId"> | ||||
|                 <el-select | ||||
|                     v-model="editLogin.unitId" | ||||
|                     style="width: 100%" | ||||
|                     filterable | ||||
|                     :disabled="editDialogVisible" | ||||
|                     placeholder="请选择客户" | ||||
|                 > | ||||
|                   <el-option | ||||
|                       v-for="item in corpNamesList" | ||||
|                       :key="item.erpId" | ||||
|                       :label="item.name" | ||||
|                       :value="item.erpId" | ||||
|                   > | ||||
|                   </el-option> | ||||
|                 </el-select> | ||||
|               </el-form-item> | ||||
|             </div> | ||||
|           </el-col> | ||||
|           <el-col :span="10" class="el-col" type="flex"> | ||||
|             <div class="edit-text"> | ||||
|               <el-form-item label="自助平台名称" prop="platformId"> | ||||
|                 <el-input v-model="editLogin.name" :disabled="true" style="width: 100%" size="small"></el-input> | ||||
|               </el-form-item> | ||||
|             </div> | ||||
|           </el-col> | ||||
|         </el-row> | ||||
| 
 | ||||
| 
 | ||||
|         <el-row :gutter="20" class="el-row" type="flex"> | ||||
|           <el-col :span="10" class="el-col" type="flex"> | ||||
|             <div class="text item"> | ||||
|               <el-form-item label="账号" prop="platformUsername"> | ||||
|                 <el-input | ||||
|                     v-model="editLogin.platformUsername" | ||||
|                     placeholder="请输入账号" | ||||
|                     style="width: 100%" | ||||
|                     size="small" | ||||
|                 ></el-input> | ||||
|               </el-form-item> | ||||
|             </div> | ||||
|           </el-col> | ||||
|           <el-col :span="10" class="el-col" type="flex"> | ||||
|             <div class="text item"> | ||||
|               <el-form-item label="密码" prop="platformPassword"> | ||||
|                 <el-input | ||||
|                     v-model="editLogin.platformPassword" | ||||
|                     placeholder="请输入密码" | ||||
|                     style="width: 81%" | ||||
|                     size="small" | ||||
|                     type="password" | ||||
|                     show-password | ||||
|                 ></el-input> | ||||
|                 <el-button type="primary" style="margin-left: 7px;" @click.native="testUserInfo"> | ||||
|                   账号验证 | ||||
|                 </el-button> | ||||
|               </el-form-item> | ||||
|             </div> | ||||
|           </el-col> | ||||
|         </el-row> | ||||
|       </el-card> | ||||
|     </el-form> | ||||
| 
 | ||||
|     <el-card> | ||||
|       <el-button size="mini" type="primary" style="float: right; margin-right: 35px;margin-bottom: 12px;" :disabled="!check"  @click.native="addDelect()">添加</el-button> | ||||
|       <el-table :data="delectList" border highlight-current-row style="width: 100%"> | ||||
|         <el-table-column label="本地单据" prop="sourceName" fixed></el-table-column> | ||||
|         <el-table-column label="目标部门" prop="invName" fixed></el-table-column> | ||||
|         <el-table-column label="目标仓库" prop="invSubName" fixed></el-table-column> | ||||
|         <el-table-column label="目标单据类型" prop="targetName" fixed></el-table-column> | ||||
|               <el-table-column label="操作" fixed="right"> | ||||
|                 <template slot-scope="scope"> | ||||
|                   <el-button type="text" size="small" :disabled="!check" @click.native.stop="addDelect(scope.row)">编辑</el-button> | ||||
|                 </template> | ||||
|               </el-table-column> | ||||
|       </el-table> | ||||
| 
 | ||||
|       <pagination | ||||
|           v-show="total>0" | ||||
|           :total="total" | ||||
|           :limit.sync="query.limit" | ||||
|           :page.sync="query.page" | ||||
|           @pagination="handleCurrentChange" | ||||
|       ></pagination> | ||||
|     </el-card> | ||||
| 
 | ||||
|     <el-dialog | ||||
|         :title="formName[formQuery]" | ||||
|         :visible.sync="editLoginVisible" | ||||
|          v-if="editLoginVisible" | ||||
|         append-to-body | ||||
|         :close-on-click-modal="false" | ||||
|         :close-on-press-escape="false" | ||||
|         width="40%" | ||||
|     > | ||||
|       <bindPlatformEditModel | ||||
|           :formQuery="formQuery" | ||||
|           :editQuery="editLogin" | ||||
|           :closeDialog="closeDialogEdit" | ||||
|       ></bindPlatformEditModel> | ||||
|     </el-dialog> | ||||
| 
 | ||||
|   </div> | ||||
| </template> | ||||
| 
 | ||||
| <script> | ||||
| import {testUserInfo} from "@/api/userManage/platform"; | ||||
| import {getCorpLists, getPlatFormDelect} from "@/api/basic/basicUnitMaintain"; | ||||
| import {getBussinessType} from "@/api/basic/bussinessType"; | ||||
| import {isBlank} from "@/utils/strUtil"; | ||||
| import bindPlatformEditModel from "@/views/userManage/bindPlatformEditModel"; | ||||
| 
 | ||||
| export default { | ||||
|   name:'bindPlatformModel', | ||||
|   props: { | ||||
|     closeDialog: { | ||||
|       type: Function, | ||||
|       required: true, | ||||
|     }, | ||||
|     editQuery: { | ||||
|       type: Object, | ||||
|       required: true, | ||||
|     }, | ||||
|   }, | ||||
|   data() { | ||||
|     return { | ||||
|       editLogin: { | ||||
|         id: null, | ||||
|         unitId: null, | ||||
|         name: null, | ||||
|         corpName: null, | ||||
|         platformId: null, | ||||
|         platformUsername: null, | ||||
|         platformPassword: null, | ||||
|         appid: null, | ||||
|         appKey: null, | ||||
|         sceretKey: null, | ||||
|         sourceAction: null, | ||||
|         targetAction: null, | ||||
|         platformList: [], | ||||
|         invCode: "", | ||||
|         invSubCode: "", | ||||
|       }, | ||||
|       platformRules: { | ||||
|         corpName: [ | ||||
|           {required: true, message: "请选择往来单位", trigger: "change"} | ||||
|         ], | ||||
|         platformId: [ | ||||
|           {required: true, message: "请选择自助平台", trigger: "change"} | ||||
|         ], | ||||
|         invCode: [ | ||||
|           {required: true, message: "请选择目标分库", trigger: "change"} | ||||
|         ], | ||||
|         invSubCode: [ | ||||
|           {required: true, message: "请选择目标分库", trigger: 'change'} | ||||
|         ], | ||||
|         platformUsername: [ | ||||
|           {required: true, message: "请输入账号", trigger: "change"} | ||||
|         ], | ||||
|         platformPassword: [ | ||||
|           {required: true, message: "请输入密码", trigger: "change"} | ||||
|         ], | ||||
|         sourceAction: [ | ||||
|           {required: true, message: "请选择本地单据类型", trigger: "change"} | ||||
|         ], | ||||
|         targetAction: [ | ||||
|           {required: true, message: "请选择目标单据类型", trigger: "change"} | ||||
|         ] | ||||
|       }, | ||||
|       editDialogVisible: false, | ||||
|       corpNamesList: [], | ||||
|       delectList: [], | ||||
|       curPlatformId: "", | ||||
|       targetPlatformEdit: true, //目标平台启用编辑 | ||||
|       editPlatformQuery: { | ||||
|         unitId: null, | ||||
|         name: null, | ||||
|         host: null | ||||
|       }, | ||||
|       query: { | ||||
|         platformId: null, | ||||
|         page: 1, | ||||
|         limit: 20 | ||||
|       }, | ||||
|       formName:{ | ||||
|         1 : "添加客户信息", | ||||
|         2 : "编辑客户信息" | ||||
|       }, | ||||
|       formQuery:null, | ||||
|       editLoginVisible:false, | ||||
|       platformList: [], | ||||
|       bussinessTypes: [], | ||||
|       targetActions: [], | ||||
|       targetInvs: [], | ||||
|       targetSubInvs: [], | ||||
|       total: 0, | ||||
|       check:false | ||||
|     }; | ||||
|   }, | ||||
|   components: {bindPlatformEditModel}, | ||||
|   methods: { | ||||
|     getUnitMaintain() { | ||||
|       getCorpLists() | ||||
|           .then((response) => { | ||||
|             this.corpNamesList = response.data || []; | ||||
|           }) | ||||
|           .catch(() => { | ||||
|             this.loading = false; | ||||
|           }); | ||||
|     }, | ||||
|     intentPlatform(value) { | ||||
|       this.editPlatformQuery.id = value; | ||||
|       this.curPlatformId = value; | ||||
|       this.targetPlatformEdit = true; | ||||
|       //拉取对应平台的单据类型 | ||||
|       this.getTargetInv(value); | ||||
|     }, | ||||
|     testUserInfo() { | ||||
|       if (isBlank(this.editLogin.platformId)) { | ||||
|         this.$message.error("请选择自助平台"); | ||||
|         return; | ||||
|       } | ||||
|       if (isBlank(this.editLogin.platformUsername)) { | ||||
|         this.$message.error("请输入用户名"); | ||||
|         return; | ||||
|       } | ||||
|       if (isBlank(this.editLogin.platformPassword)) { | ||||
|         this.$message.error("请输入密码"); | ||||
|         return; | ||||
|       } | ||||
|       let data = { | ||||
|         platformId: this.editLogin.platformId, | ||||
|         username: this.editLogin.platformUsername, | ||||
|         password: this.editLogin.platformPassword | ||||
|       }; | ||||
|       testUserInfo(data).then((res) => { | ||||
|         if (res.code === 20000) { | ||||
|           this.targetPlatformEdit = false; | ||||
|           this.check=true; | ||||
|           this.editLogin.appid=res.data.appid; | ||||
|           this.editLogin.apiKey=res.data.apiKey; | ||||
|           this.editLogin.secretKey=res.data.secretKey; | ||||
|           this.$message.success("验证成功"); | ||||
|         } else { | ||||
|           this.$message.error(res.message); | ||||
|         } | ||||
|       }).catch((error) => { | ||||
|       }); | ||||
|     }, | ||||
|     closeDialog() { | ||||
|       this.orderMutiVisible = false; | ||||
|       this.getList(); | ||||
|     }, | ||||
|     getLocalBussinessType() { | ||||
|       let tQuery = {}; | ||||
|       getBussinessType(tQuery).then((res) => { | ||||
|         this.bussinessTypes = res.data.list || []; | ||||
|       }).catch((error) => { | ||||
|         this.$message.error(error.message); | ||||
|       }); | ||||
|     }, | ||||
|     handleCurrentChange(val) { | ||||
|       this.query.page = val; | ||||
|       this.getList(); | ||||
|     }, | ||||
|     addDelect(row){ | ||||
|       if(this.check=true){ | ||||
|         if(row==null){ | ||||
|           this.formQuery=1; | ||||
|           this.editLoginVisible=true; | ||||
|         }else{ | ||||
|           this.formQuery=2; | ||||
|           this.editLogin.id=row.id | ||||
|           this.editLoginVisible=true; | ||||
|         } | ||||
|       }else{ | ||||
|         this.$message.error("请先验证账号信息!"); | ||||
|       } | ||||
|     }, | ||||
|     closeDialogEdit(){ | ||||
|       this.editLoginVisible=false; | ||||
|       this.getPlatFormDelect(); | ||||
|     }, | ||||
|     //获取详情列表 | ||||
|     getPlatFormDelect() { | ||||
|       this.query.platformId=this.editLogin.platformId | ||||
|       getPlatFormDelect(this.query).then((res) => { | ||||
|         this.delectList = res.data.list || []; | ||||
|         this.total = res.data.total || 0; | ||||
|       }).catch((error) => { | ||||
|         this.$message.error(error.message); | ||||
|       }); | ||||
|     }, | ||||
|   }, | ||||
|   created() { | ||||
|     this.editLogin.platformId = this.editQuery.platformId; | ||||
|     this.editLogin.name = this.editQuery.name; | ||||
|     this.editLogin.unitId=this.editQuery.unitId; | ||||
|     this.editLogin.customerId=this.editQuery.platformId | ||||
|     this.editLogin.sourceAction = this.editQuery.sourceAction | ||||
|     this.editLogin.invCode = this.editQuery.invCode | ||||
|     this.editLogin.invSubCode = this.editQuery.invSubCode | ||||
|     this.editLogin.targetAction = this.editQuery.targetAction | ||||
|     if(this.editLogin.unitId!=null){ | ||||
|       this.editDialogVisible=true | ||||
|     } | ||||
|     this.getUnitMaintain() | ||||
|     this.getLocalBussinessType() | ||||
|     this.getPlatFormDelect() | ||||
|   } | ||||
| }; | ||||
| </script> | ||||
| 
 | ||||
| <style scoped> | ||||
| 
 | ||||
| </style> | ||||
| @ -0,0 +1,248 @@ | ||||
| <template> | ||||
|     <div> | ||||
|       <el-card> | ||||
|         <el-form  :model="filterQuery"  label-width="100px" size="mini"> | ||||
|             <el-row> | ||||
|               <el-col :span="6"> | ||||
|                 <el-form-item label="自助平台名称:" class="query-form-item"> | ||||
|                     <el-input v-model="filterQuery.name" placeholder="请输入自助平台名称"></el-input> | ||||
|                 </el-form-item> | ||||
|               </el-col> | ||||
|               <el-col :span="6"> | ||||
|                 <el-form-item> | ||||
|                     <el-button-group> | ||||
|                         <el-button type="primary" icon="el-icon-refresh" @click="onReset"></el-button> | ||||
|                         <el-button type="primary" icon="search" @click="onSubmit">查询</el-button> | ||||
|                         <el-button type="primary" icon="search" @click="handleAddClick">添加自助平台信息</el-button> | ||||
|                     </el-button-group> | ||||
|                 </el-form-item> | ||||
|               </el-col> | ||||
|             </el-row> | ||||
|         </el-form> | ||||
| 
 | ||||
|         <el-table v-loading="loading" :data="list" border highlight-current-row style="width: 100%"> | ||||
|             <el-table-column label="序号" type="index"></el-table-column> | ||||
|             <el-table-column label="自助平台名称" prop="name" width="260"></el-table-column> | ||||
|             <el-table-column label="自助平台访问地址" prop="host" width="260"></el-table-column> | ||||
|             <el-table-column label="操作" width="220"> | ||||
|                 <template slot-scope="scope"> | ||||
|                     <el-button type="text" size="small" @click.native.stop="handleModifyClick(scope.row)">编辑</el-button> | ||||
|                     <el-button type="text" size="small" @click.native.stop="deleteDialog(scope.row)">删除</el-button> | ||||
|                     <el-button type="text" size="small" @click.native.stop="testConnection(scope.row)">测试连通 | ||||
|                     </el-button> | ||||
|                 </template> | ||||
|             </el-table-column> | ||||
|         </el-table> | ||||
| 
 | ||||
| 
 | ||||
|         <el-dialog :title=editTypeMap[editType] :visible.sync="formVisible" width="30%" :close-on-click-modal="false" :close-on-press-escape="false"> | ||||
|             <el-form :model="formData" label-width="120px" :rules="formRules" ref="dataForm"> | ||||
|                 <el-row :gutter="20" class="el-row" type="flex"> | ||||
|                     <el-col :span="12" class="el-col" type="flex"> | ||||
|                         <div> | ||||
|                             <el-form-item label="平台名称" prop="name"> | ||||
|                                 <el-input v-model="formData.name" style="width: 200%" size="small"></el-input> | ||||
|                             </el-form-item> | ||||
|                         </div> | ||||
|                     </el-col> | ||||
|                 </el-row> | ||||
| 
 | ||||
|                 <el-row :gutter="20" class="el-row" type="flex"> | ||||
|                     <el-col :span="12" class="el-col" type="flex"> | ||||
|                         <div class="text item"> | ||||
|                             <el-form-item label="平台访问地址" prop="host"> | ||||
|                                 <el-input v-model="formData.host" style="width: 200%" size="small"></el-input> | ||||
|                             </el-form-item> | ||||
|                         </div> | ||||
|                     </el-col> | ||||
|                 </el-row> | ||||
|             </el-form> | ||||
| 
 | ||||
|             <div slot="footer" class="dialog-footer"> | ||||
|                 <el-button @click.native="cancelDialog" size="small">取消</el-button> | ||||
|                 <el-button type="primary" size="small" @click.native="formSubmit()">提交</el-button> | ||||
|             </div> | ||||
|         </el-dialog> | ||||
| 
 | ||||
|         <pagination | ||||
|             v-show="total>0" | ||||
|             :total="total" | ||||
|             :limit.sync="filterQuery.limit" | ||||
|             :page.sync="filterQuery.page" | ||||
|             @pagination="handleCurrentChange" | ||||
|         ></pagination> | ||||
|       </el-card> | ||||
|     </div> | ||||
| </template> | ||||
| 
 | ||||
| <script> | ||||
| import { | ||||
|     getPlatform, | ||||
|     updatePlatform, | ||||
|     deletePlatform, | ||||
|     testPlatformConnection | ||||
| } from "@/api/userManage/platform"; | ||||
| 
 | ||||
| export default { | ||||
|     data() { | ||||
|         return { | ||||
|             filterQuery: { | ||||
|                 name: "", | ||||
|                 page: 1, | ||||
|                 limit: 20 | ||||
|             }, | ||||
|             value: "", | ||||
|             total: 0, | ||||
|             list: [], | ||||
|             formVisible: false, | ||||
|             loading: false, | ||||
|             timer: "", | ||||
|             formData: { | ||||
|                 id: "", | ||||
|                 name: "", | ||||
|                 host: "" | ||||
|             }, | ||||
|             check: "", | ||||
|             roles: [], | ||||
|             formRules: { | ||||
|                 name: [{required: true, message: "请输入平台名称", trigger: "blur"}], | ||||
|                 host: [{required: true, message: "请输入平台访问地址", trigger: "blur"}] | ||||
|             }, | ||||
|             editTypeMap: { | ||||
|                 "add": "新增自助平台", | ||||
|                 "edit": "平台信息编辑" | ||||
|             }, | ||||
|             editType: null | ||||
|         }; | ||||
|     }, | ||||
|     methods: { | ||||
|         onReset() { | ||||
|             this.$router.push({ | ||||
|                 path: "" | ||||
|             }); | ||||
|             this.filterQuery = { | ||||
|                 name: "", | ||||
|                 page: 1, | ||||
|                 limit: 20 | ||||
|             }; | ||||
|             this.getList(); | ||||
|         }, | ||||
|         resetForm() { | ||||
|             this.$nextTick(() => { | ||||
|                 if (this.editType === "add") { | ||||
|                     this.$refs["dataForm"].resetFields(); | ||||
|                 } | ||||
|                 this.$refs["dataForm"].clearValidate(); | ||||
|             }); | ||||
|         }, | ||||
|         formSubmit() { | ||||
|             this.$refs["dataForm"].validate((valid) => { | ||||
|                 if (valid) { | ||||
|                     //验证连通性 | ||||
|                     testPlatformConnection({host: this.formData.host}).then((res) => { | ||||
|                         if (res.code === 20000) { | ||||
|                             this.loading = true; | ||||
|                             updatePlatform(this.formData) | ||||
|                                 .then((response) => { | ||||
|                                     if (response.code === 20000) { | ||||
|                                         this.loading = false; | ||||
|                                         this.cancelDialog(); | ||||
|                                         this.getList(); | ||||
|                                     } else { | ||||
|                                         this.$message.error(response.message); | ||||
|                                         this.loading = false; | ||||
|                                     } | ||||
|                                 }) | ||||
|                                 .catch(() => { | ||||
|                                     this.cancelDialog(); | ||||
|                                     this.loading = false; | ||||
|                                 }); | ||||
|                         } else { | ||||
|                             this.$message.error("连通失败,请检查自助平台访问地址!") | ||||
|                         } | ||||
|                     }) | ||||
|                 } | ||||
|             }); | ||||
|         }, | ||||
|         onSubmit() { | ||||
|             this.filterQuery.page = 1; | ||||
|             this.getList(); | ||||
|         }, | ||||
|         getList() { | ||||
|             this.loading = true; | ||||
|             getPlatform(this.filterQuery) | ||||
|                 .then((response) => { | ||||
|                     this.loading = false; | ||||
|                     this.list = response.data.list || []; | ||||
|                     this.total = response.data.total || 0; | ||||
|                 }) | ||||
|                 .catch(() => { | ||||
|                     this.loading = false; | ||||
|                     this.list = []; | ||||
|                     this.total = 0; | ||||
|                 }); | ||||
|         }, | ||||
| 
 | ||||
|         cancelDialog() { | ||||
|             this.formVisible = false; | ||||
|         }, | ||||
|         handleAddClick() { | ||||
|             this.editType = "add"; | ||||
|             this.formVisible = true; | ||||
|             this.formData = { | ||||
|                 id: null, | ||||
|                 name: null, | ||||
|                 host: null | ||||
|             }; | ||||
|         }, | ||||
|         handleModifyClick(row) { | ||||
|             this.editType = "edit"; | ||||
|             this.formData = { | ||||
|                 id: row.id, | ||||
|                 name: row.name, | ||||
|                 host: row.host | ||||
|             }; | ||||
|             this.resetForm(); | ||||
|             this.formVisible = true; | ||||
|         }, | ||||
|         handleCurrentChange(val) { | ||||
|             this.filterQuery.page = val; | ||||
|             this.getList(); | ||||
|         }, | ||||
|         deleteDialog(row) { | ||||
|             this.$confirm("确认删除该自助平台信息?", "提示", { | ||||
|                 confirmButtonText: "确定", | ||||
|                 cancelButtonText: "取消", | ||||
|                 type: "warning" | ||||
|             }) | ||||
|                 .then(() => { | ||||
|                     let tQuery = { | ||||
|                         id: row.id | ||||
|                     }; | ||||
|                     deletePlatform(tQuery).then(() => { | ||||
|                         this.getList(); | ||||
|                     }); | ||||
|                 }) | ||||
|                 .catch(() => { | ||||
|                 }); | ||||
|         }, | ||||
|         testConnection(row) { | ||||
|             let params = {host: row.host}; | ||||
|             testPlatformConnection(params).then((res) => { | ||||
|                 if (res.code === 20000) { | ||||
|                     this.$message.success("连接成功"); | ||||
|                     return true; | ||||
|                 } else { | ||||
|                     this.$message.error("连通失败,请检查自助平台访问地址!"); | ||||
|                     return false; | ||||
|                 } | ||||
|             }) | ||||
|         }, | ||||
|     }, | ||||
|     mounted() { | ||||
|     }, | ||||
|     created() { | ||||
|         this.getList(); | ||||
|     } | ||||
| }; | ||||
| </script> | ||||
					Loading…
					
					
				
		Reference in New Issue