Kaynağa Gözat

用户分区设置

lilei 4 yıl önce
ebeveyn
işleme
c5bb6cdccb

+ 2 - 2
src/views/dealerManagement/marketingDivisionSet/editModal.vue

@@ -7,7 +7,7 @@
     :title="modalTit"
     v-model="isShow"
     @cancle="isShow=false"
-    width="800px">
+    width="80%">
     <!-- 表单 -->
     <div>
       <a-form-model
@@ -97,7 +97,7 @@ export default {
       isShow: this.openModal, //  是否打开弹框
       formItemLayout: {
         labelCol: { span: 4 },
-        wrapperCol: { span: 20 }
+        wrapperCol: { span: 18 }
       },
       form: {
         subareaName: '' // 分区名称

+ 119 - 0
src/views/power/user/updateAreal.vue

@@ -0,0 +1,119 @@
+<template>
+  <a-modal
+    centered
+    class="user-modal"
+    :footer="null"
+    :maskClosable="false"
+    :title="title"
+    v-model="isShow"
+    @cancle="isShow=false"
+    :width="600">
+    <div>
+      <a-form-model
+        ref="ruleForm"
+        :model="form"
+        :rules="rules"
+        :label-col="labelCol"
+        :wrapper-col="wrapperCol"
+      >
+        <a-form-model-item label="用户姓名">
+          {{ form.name }}
+        </a-form-model-item>
+        <a-form-model-item label="所属营销分区" prop="subareaSn">
+          <subarea id="user-subarea" v-model="form.subareaSn"></subarea>
+        </a-form-model-item>
+        <div style="display: flex;justify-content: center;padding: 30px 0;">
+          <a-button type="primary" @click="onSubmit">确定</a-button>
+          <a-button style="margin-left: 50px;" @click="cansel">取消</a-button>
+        </div>
+      </a-form-model>
+    </div>
+  </a-modal>
+</template>
+
+<script>
+import { VSelect } from '@/components'
+import { updateDealerLevel } from '@/api/dealer'
+import subarea from '@/views/common/subarea.js'
+export default {
+  name: 'UpdateArea',
+  components: { VSelect, subarea },
+  props: {
+    openUdModal: { //  弹框显示状态
+      type: Boolean,
+      default: false
+    }
+  },
+  data () {
+    return {
+      isShow: this.openUdModal, //  是否打开弹框
+      title: '级别设置',
+      labelCol: { span: 5 },
+      wrapperCol: { span: 16 },
+      other: '',
+      form: {
+        name: '',
+        subareaSn: ''
+      },
+      rules: {
+        subareaSn: [
+          { required: true, message: '请选择所属营销分区', trigger: ['change', 'blur'] }
+        ]
+      },
+      subareaSnBak: undefined
+    }
+  },
+  methods: {
+    setData (row) {
+      this.form.id = row.id
+      this.form.name = row.name
+      this.form.subareaSn = row.subareaSn || ''
+      this.subareaSnBak = row.subareaSn
+    },
+    onSubmit () {
+      const _this = this
+      this.$refs.ruleForm.validate(valid => {
+        if (valid) {
+          _this.submitForm()
+        } else {
+          return false
+        }
+      })
+    },
+    submitForm () {
+      const _this = this
+      const params = JSON.parse(JSON.stringify(_this.form))
+      updateDealerLevel(params).then(res => {
+        if (res.status == 200) {
+          _this.$message.success(res.message)
+          _this.$emit('ok')
+        }
+      })
+    },
+    cansel () {
+      this.$emit('close')
+      this.$refs.ruleForm.resetFields()
+    }
+  },
+  watch: {
+    //  父页面传过来的弹框状态
+    openUdModal (newValue, oldValue) {
+      this.isShow = newValue
+    },
+    //  重定义的弹框状态
+    isShow (newValue, oldValue) {
+      if (!newValue) {
+        this.$emit('close')
+      }
+    }
+  }
+}
+</script>
+
+<style lang="less">
+  .merchantInfoManagement-modal{
+    .ant-modal-body {
+      padding: 40px 40px 24px;
+    }
+  }
+</style>

+ 17 - 4
src/views/power/user/userList.vue

@@ -41,7 +41,7 @@
       <span slot="status" slot-scope="text, record">
         <!-- <a-switch v-if="$hasPermissions('B_powerMD_user_enable')" checkedChildren="启用" unCheckedChildren="禁用" v-model="record.loginFlag" @change="changeFlagHandle(text, record)"/>
         <span v-else>{{ record.loginFlag==1?'已启用':'已禁用' }}</span> -->
-		<a-switch checkedChildren="启用" unCheckedChildren="禁用" v-model="record.loginFlag" @change="changeFlagHandle(text, record)"/>
+        <a-switch checkedChildren="启用" unCheckedChildren="禁用" v-model="record.loginFlag" @change="changeFlagHandle(text, record)"/>
       </span>
       <span slot="action" slot-scope="text, record">
         <!-- <a-icon
@@ -81,9 +81,16 @@
           :style="{fontSize: '20px',color: '#f00',padding: '0 10px'}"
           v-if="record.loginFlag==0"
           @click="delect(record)"/>
+        <a-icon
+          type="setting"
+          title="分区设置"
+          :style="{fontSize: '20px',color:' #00aa00',padding: '0 10px'}"
+          @click="handleSetting(record)" />
       </span>
     </s-table>
     <userModal :visible="showModal" @refresh="$refs.table.refresh(true)" :data="itemData" @close="showModal = false"></userModal>
+    <!-- 分区设置 -->
+    <UpdateArea ref="UpdateArea" :openUdModal="openUdModal" @ok="$refs.table.refresh(true)" @close="openUdModal=false"></UpdateArea>
   </a-card>
 </template>
 
@@ -91,10 +98,11 @@
 import { STable, VSelect } from '@/components'
 import userModal from './userModal.vue'
 import { resetPSD, updateEnableStatus, getPowerUserList, delectUserPower } from '@/api/power-user.js'
+import UpdateArea from './updateAreal.vue'
 export default {
   name: 'UserList',
   components: {
-    STable, VSelect, userModal
+    STable, VSelect, userModal, UpdateArea
   },
   data () {
     return {
@@ -105,6 +113,7 @@ export default {
         loginFlag: ''
       },
       showModal: false,
+      openUdModal: false,
       itemData: {}, // 编辑行数据
       // 表头
       columns: [
@@ -115,7 +124,7 @@ export default {
           align: 'center'
         },
         {
-		  title: '创建时间',
+		      title: '创建时间',
           dataIndex: 'createDate',
           width: 150,
           align: 'center'
@@ -183,9 +192,13 @@ export default {
       this.queryParam.loginFlag = ''
       this.refreshTable()
     },
+    // 分区设置
+    handleSetting (row) {
+      this.openUdModal = true
+      this.$refs.UpdateArea.setData(row)
+    },
     // 重置密码
     resetPassword (row) {
-      const _this = this
       this.$confirm({
         title: '提示',
         content: '确认重置密码吗?',