|
@@ -0,0 +1,233 @@
|
|
|
+<template>
|
|
|
+ <a-modal
|
|
|
+ centered
|
|
|
+ class="bindEdit-modal"
|
|
|
+ :footer="null"
|
|
|
+ :maskClosable="false"
|
|
|
+ title="账号授权"
|
|
|
+ v-model="isShow"
|
|
|
+ @cancle="isShow=false"
|
|
|
+ :width="800">
|
|
|
+ <!-- 表单 -->
|
|
|
+ <div>
|
|
|
+ <a-form-model
|
|
|
+ id="bindEdit-form"
|
|
|
+ ref="ruleForm"
|
|
|
+ :model="form"
|
|
|
+ :rules="rules"
|
|
|
+ :label-col="formItemLayout.labelCol"
|
|
|
+ :wrapper-col="formItemLayout.wrapperCol"
|
|
|
+ >
|
|
|
+ <a-form-model-item label="选择中心店" prop="ownerOrgSn">
|
|
|
+ <a-select
|
|
|
+ placeholder="请选择中心店"
|
|
|
+ id="productInfoList-ownerOrgSn"
|
|
|
+ allowClear
|
|
|
+ v-model="form.ownerOrgSn"
|
|
|
+ :showSearch="true"
|
|
|
+ option-filter-prop="children"
|
|
|
+ :filter-option="filterOption"
|
|
|
+ @change="orgChange">
|
|
|
+ <a-select-option v-for="item in orgList" :key="item.orgSn" :value="item.orgSn">{{ item.orgName }}</a-select-option>
|
|
|
+ </a-select>
|
|
|
+ </a-form-model-item>
|
|
|
+ <a-form-model-item label="选择授权账号" prop="userSn">
|
|
|
+ <a-select
|
|
|
+ placeholder="请选择授权账号"
|
|
|
+ id="productInfoList-userSn"
|
|
|
+ allowClear
|
|
|
+ v-model="form.userSn"
|
|
|
+ :showSearch="true"
|
|
|
+ option-filter-prop="children"
|
|
|
+ :filter-option="filterOption">
|
|
|
+ <a-select-option v-for="item in userList" :key="item.sn" :value="item.sn">{{ item.name }}</a-select-option>
|
|
|
+ </a-select>
|
|
|
+ </a-form-model-item>
|
|
|
+ <a-form-model-item label="选择配送店" prop="orgSnList">
|
|
|
+ <a-select
|
|
|
+ placeholder="请选择配送店"
|
|
|
+ id="productInfoList-orgSnList"
|
|
|
+ allowClear
|
|
|
+ v-model="form.orgSnList"
|
|
|
+ mode="multiple"
|
|
|
+ :showSearch="true"
|
|
|
+ option-filter-prop="children"
|
|
|
+ :filter-option="filterOption">
|
|
|
+ <a-select-option v-for="item in childList" :key="item.sn" :value="item.sn">{{ item.name }}</a-select-option>
|
|
|
+ </a-select>
|
|
|
+ </a-form-model-item>
|
|
|
+ </a-form-model>
|
|
|
+ <div class="btn-cont">
|
|
|
+ <a-button type="primary" id="bindEdit-modal-save" @click="handleSave">保存</a-button>
|
|
|
+ <a-button id="bindEdit-modal-back" @click="isShow = false" style="margin-left: 15px;">关闭</a-button>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </a-modal>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+import { STable } from '@/components'
|
|
|
+import { jxsorgRelationSave, jxsorgRelationDetail, jxsorgRelationQueryList } from '@/api/jxsorg'
|
|
|
+import { userOrgUserList, userOrgDetail, userOrgSave } from '@/api/userOrg'
|
|
|
+export default {
|
|
|
+ name: 'BindEditModal',
|
|
|
+ components: { STable },
|
|
|
+ props: {
|
|
|
+ openModal: { // 弹框显示状态
|
|
|
+ type: Boolean,
|
|
|
+ default: false
|
|
|
+ },
|
|
|
+ itemSn: {
|
|
|
+ type: [Number, String],
|
|
|
+ default: ''
|
|
|
+ }
|
|
|
+ },
|
|
|
+ data () {
|
|
|
+ return {
|
|
|
+ isShow: this.openModal, // 是否打开弹框
|
|
|
+ formItemLayout: {
|
|
|
+ labelCol: { span: 6 },
|
|
|
+ wrapperCol: { span: 16 }
|
|
|
+ },
|
|
|
+ form: {
|
|
|
+ ownerOrgSn: undefined,
|
|
|
+ userSn: undefined,
|
|
|
+ orgSnList: undefined
|
|
|
+ },
|
|
|
+ rules: {
|
|
|
+ ownerOrgSn: [ { required: true, message: '请选择中心店', trigger: 'change' } ],
|
|
|
+ userSn: [ { required: true, message: '请选择授权账号', trigger: 'change' } ],
|
|
|
+ orgSnList: [ { required: true, message: '请选择配送店', trigger: 'change' } ]
|
|
|
+ },
|
|
|
+ orgList: [],
|
|
|
+ userList: [],
|
|
|
+ childList: []
|
|
|
+ }
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ // 中心店 change
|
|
|
+ orgChange (val) {
|
|
|
+ this.getUserList()
|
|
|
+ this.getChildList()
|
|
|
+ },
|
|
|
+ filterOption (input, option) {
|
|
|
+ return (
|
|
|
+ option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
|
|
|
+ )
|
|
|
+ },
|
|
|
+ // 详情
|
|
|
+ getDetail () {
|
|
|
+ const _this = this
|
|
|
+ // userOrgDetail({ sn: this.itemSn }).then(res => {
|
|
|
+ // if (res.status == 200) {
|
|
|
+ // if (res.data.orgName) {
|
|
|
+ // _this.$refs.orgList.fetchUser(res.data.orgName)
|
|
|
+ // setTimeout(() => {
|
|
|
+ // _this.$refs.orgList.dealerName = res.data.orgSn
|
|
|
+ // }, 1000)
|
|
|
+ // }
|
|
|
+ // _this.form.orgSn = res.data.orgSn || undefined
|
|
|
+ // const childSnList = []
|
|
|
+ // if (res.data.childList) {
|
|
|
+ // res.data.childList.map(item => {
|
|
|
+ // childSnList.push(item.sn)
|
|
|
+ // })
|
|
|
+ // }
|
|
|
+ // _this.form.childSnList = childSnList
|
|
|
+ // _this.$refs.orgMultipleList.setData(childSnList)
|
|
|
+ // _this.$refs.orgMultipleList.dealerName = childSnList
|
|
|
+ // }
|
|
|
+ // })
|
|
|
+ },
|
|
|
+ // 保存
|
|
|
+ handleSave () {
|
|
|
+ const _this = this
|
|
|
+ this.$refs.ruleForm.validate(valid => {
|
|
|
+ if (valid) {
|
|
|
+ userOrgSave(_this.form).then(res => {
|
|
|
+ if (res.status == 200) {
|
|
|
+ _this.$message.success(res.message)
|
|
|
+ _this.$emit('ok')
|
|
|
+ setTimeout(function () {
|
|
|
+ _this.isShow = false
|
|
|
+ }, 300)
|
|
|
+ } else {
|
|
|
+
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ console.log('error submit!!')
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 中心店数据
|
|
|
+ getOrgList () {
|
|
|
+ jxsorgRelationQueryList({}).then(res => {
|
|
|
+ if (res.status == 200) {
|
|
|
+ this.orgList = res.data
|
|
|
+ } else {
|
|
|
+ this.orgList = []
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 授权账号数据
|
|
|
+ getUserList () {
|
|
|
+ userOrgUserList({ orgSn: this.form.ownerOrgSn }).then(res => {
|
|
|
+ if (res.status == 200) {
|
|
|
+ if (res.status == 200) {
|
|
|
+ this.userList = res.data
|
|
|
+ } else {
|
|
|
+ this.userList = []
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 配送店数据
|
|
|
+ getChildList () {
|
|
|
+ jxsorgRelationDetail({ sn: this.form.ownerOrgSn }).then(res => {
|
|
|
+ if (res.status == 200) {
|
|
|
+ this.childList = res.data.childList || []
|
|
|
+ } else {
|
|
|
+ this.childList = []
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
+ watch: {
|
|
|
+ // 父页面传过来的弹框状态
|
|
|
+ openModal (newValue, oldValue) {
|
|
|
+ this.isShow = newValue
|
|
|
+ },
|
|
|
+ // 重定义的弹框状态
|
|
|
+ isShow (newValue, oldValue) {
|
|
|
+ if (!newValue) {
|
|
|
+ this.$emit('close')
|
|
|
+ this.$refs.ruleForm.resetFields()
|
|
|
+ this.orgList = []
|
|
|
+ this.userList = []
|
|
|
+ this.childList = []
|
|
|
+ } else {
|
|
|
+ this.getOrgList()
|
|
|
+ }
|
|
|
+ },
|
|
|
+ itemSn (newValue, oldValue) {
|
|
|
+ if (this.isShow && newValue) {
|
|
|
+ this.getDetail()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="less">
|
|
|
+ .bindEdit-modal{
|
|
|
+ .ant-modal-body {
|
|
|
+ padding: 40px 40px 24px;
|
|
|
+ }
|
|
|
+ .btn-cont {
|
|
|
+ text-align: center;
|
|
|
+ margin: 35px 0 10px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+</style>
|