Jelajahi Sumber

中心店配送店切换登录

chenrui 4 tahun lalu
induk
melakukan
89b73deab5

+ 29 - 6
src/components/tools/UserMenu.vue

@@ -6,18 +6,22 @@
         <span class="action ant-dropdown-link user-dropdown-menu">
         <span class="action ant-dropdown-link user-dropdown-menu">
           <!-- <a-avatar class="avatar" size="small" :src="avatar==''?defaultAvatar:avatar"/> -->
           <!-- <a-avatar class="avatar" size="small" :src="avatar==''?defaultAvatar:avatar"/> -->
           <a-icon type="user" />
           <a-icon type="user" />
-          <span style="margin: 0 5px;">{{ nickname }}</span>
+          <span style="margin: 0 5px;">{{ nickname }} - 【{{ userInfo.orgName || '--' }}】</span>
           <a-icon type="down" />
           <a-icon type="down" />
         </span>
         </span>
         <a-menu slot="overlay" class="user-dropdown-menu-wrapper">
         <a-menu slot="overlay" class="user-dropdown-menu-wrapper">
-          <a-menu-item key="0">
+          <a-menu-item v-for="(item, index) in authOrgs" :key="index" @click="changeRoles(item.orgSn)">
+            <a-icon type="link" style="vertical-align: super;"/>
+            <span style="display: inline-block;white-space: nowrap;width: 100%;overflow: hidden;text-overflow:ellipsis;">{{ item.orgName }}</span>
+          </a-menu-item>
+          <a-menu-divider/>
+          <a-menu-item key="5">
             <router-link :to="{ name: 'changePwd' }">
             <router-link :to="{ name: 'changePwd' }">
               <a-icon type="user"/>
               <a-icon type="user"/>
               <span>修改密码</span>
               <span>修改密码</span>
             </router-link>
             </router-link>
           </a-menu-item>
           </a-menu-item>
-          <a-menu-divider/>
-          <a-menu-item key="1">
+          <a-menu-item key="6">
             <a href="javascript:;" @click="handleLogout">
             <a href="javascript:;" @click="handleLogout">
               <a-icon type="logout"/>
               <a-icon type="logout"/>
               <span>退出登录</span>
               <span>退出登录</span>
@@ -39,7 +43,7 @@ export default {
     NoticeIcon
     NoticeIcon
   },
   },
   computed: {
   computed: {
-    ...mapGetters(['nickname', 'avatar'])
+    ...mapGetters(['nickname', 'avatar', 'authOrgs', 'userInfo'])
   },
   },
   data () {
   data () {
     return {
     return {
@@ -47,7 +51,7 @@ export default {
     }
     }
   },
   },
   methods: {
   methods: {
-    ...mapActions(['Logout']),
+    ...mapActions(['Logout', 'SetOrgSn', 'Login']),
     handleLogout () {
     handleLogout () {
       this.$confirm({
       this.$confirm({
         title: '提示',
         title: '提示',
@@ -69,6 +73,25 @@ export default {
         onCancel () {
         onCancel () {
         }
         }
       })
       })
+    },
+    // 切换角色
+    changeRoles (sn) {
+      return this.SetOrgSn(sn).then(() => {
+        // 重新登录
+        const params = { username: '', password: '' }
+        return this.Login(params).then(() => {
+          window.location.reload() //  刷新页面
+        }).catch(err => this.requestFailed(err))
+      })
+    },
+    requestFailed (err) {
+      console.log(err, 'error')
+      this.isLoginError = true
+      this.$notification['error']({
+        message: '提示',
+        description: ((err.response || {}).data || {}).message || err.message || '请求出现错误,请稍后再试',
+        duration: 4
+      })
     }
     }
   }
   }
 }
 }

+ 14 - 4
src/config/router.config.js

@@ -775,21 +775,31 @@ export const asyncRouterMap = [
                 }
                 }
               },
               },
               {
               {
-                path: 'add/:sn',
+                path: 'add',
                 name: 'intelligentReplenishmentAdd',
                 name: 'intelligentReplenishmentAdd',
-                component: () => import(/* webpackChunkName: "shop" */ '@/views/inventoryManagement/intelligentReplenishment/add.vue'),
+                component: () => import(/* webpackChunkName: "shop" */ '@/views/inventoryManagement/intelligentReplenishment/edit.vue'),
                 meta: {
                 meta: {
                   title: '新增智能补货',
                   title: '新增智能补货',
                   icon: 'monitor',
                   icon: 'monitor',
                   hidden: true
                   hidden: true
                 }
                 }
               },
               },
+              {
+                path: 'edit/:sn',
+                name: 'intelligentReplenishmentEdit',
+                component: () => import(/* webpackChunkName: "shop" */ '@/views/inventoryManagement/intelligentReplenishment/edit.vue'),
+                meta: {
+                  title: '编辑智能补货',
+                  icon: 'monitor',
+                  hidden: true
+                }
+              },
               {
               {
                 path: 'set/:sn',
                 path: 'set/:sn',
                 name: 'intelligentReplenishmentSet',
                 name: 'intelligentReplenishmentSet',
-                component: () => import(/* webpackChunkName: "shop" */ '@/views/inventoryManagement/intelligentReplenishment/basicInfoSettings.vue'),
+                component: () => import(/* webpackChunkName: "shop" */ '@/views/inventoryManagement/intelligentReplenishment/set.vue'),
                 meta: {
                 meta: {
-                  title: '新增智能补货',
+                  title: '基础信息设置',
                   icon: 'monitor',
                   icon: 'monitor',
                   hidden: true
                   hidden: true
                 }
                 }

+ 2 - 0
src/store/getters.js

@@ -9,6 +9,8 @@ const getters = {
   welcome: state => state.user.welcome,
   welcome: state => state.user.welcome,
   roles: state => state.user.roles,
   roles: state => state.user.roles,
   userInfo: state => state.user.info,
   userInfo: state => state.user.info,
+  authOrgs: state => state.user.authOrgs,
+  changeOrg: state => state.user.changeOrg,
   addRouters: state => state.permission.addRouters,
   addRouters: state => state.permission.addRouters,
   multiTab: state => state.app.multiTab,
   multiTab: state => state.app.multiTab,
   lang: state => state.i18n.lang
   lang: state => state.i18n.lang

+ 17 - 1
src/store/modules/user.js

@@ -11,7 +11,9 @@ const user = {
     welcome: '',
     welcome: '',
     avatar: '',
     avatar: '',
     roles: { permissionList: [] },
     roles: { permissionList: [] },
-    info: {}
+    info: {},
+    authOrgs: [],
+    changeOrg: ''
   },
   },
 
 
   mutations: {
   mutations: {
@@ -33,6 +35,12 @@ const user = {
     SET_INFO: (state, info) => {
     SET_INFO: (state, info) => {
       state.info = info
       state.info = info
     },
     },
+    SET_AUTHORGS: (state, authOrgs) => {
+      state.authOrgs = authOrgs
+    },
+    SET_CHANGEORG: (state, changeOrg) => {
+      state.changeOrg = changeOrg
+    },
     SET_MUSTCHANGEPWD: (state, status) => {
     SET_MUSTCHANGEPWD: (state, status) => {
       state.mustChangePwd = status
       state.mustChangePwd = status
     }
     }
@@ -52,6 +60,7 @@ const user = {
               Vue.ls.set('hasError', 0)
               Vue.ls.set('hasError', 0)
               commit('SET_TOKEN', res.access_token)
               commit('SET_TOKEN', res.access_token)
               commit('SET_INFO', users)
               commit('SET_INFO', users)
+              commit('SET_AUTHORGS', res.auth_orgs || [])
               commit('SET_NAME', { name: users.userNameCN, welcome: welcome() })
               commit('SET_NAME', { name: users.userNameCN, welcome: welcome() })
               commit('SET_MUSTCHANGEPWD', users.mustChangePwd)
               commit('SET_MUSTCHANGEPWD', users.mustChangePwd)
               Vue.ls.set('rolesAccess', { permissionList: users.permCodes }, 7 * 24 * 60 * 60 * 1000)
               Vue.ls.set('rolesAccess', { permissionList: users.permCodes }, 7 * 24 * 60 * 60 * 1000)
@@ -84,6 +93,11 @@ const user = {
       commit('SET_NAME', { name: Vue.ls.get('userName'), welcome: '' })
       commit('SET_NAME', { name: Vue.ls.get('userName'), welcome: '' })
       return roles
       return roles
     },
     },
+    // 切换账号
+    SetOrgSn ({ commit, state }, info) {
+      // console.log(info)
+      commit('SET_CHANGEORG', info)
+    },
     // 登出
     // 登出
     Logout ({ commit, state }) {
     Logout ({ commit, state }) {
       console.log(state)
       console.log(state)
@@ -94,6 +108,8 @@ const user = {
           resolve(error)
           resolve(error)
         }).finally(() => {
         }).finally(() => {
           commit('SET_INFO', {})
           commit('SET_INFO', {})
+          commit('SET_AUTHORGS', [])
+          commit('SET_CHANGEORG', '')
           commit('SET_NAME', { name: '', welcome: '' })
           commit('SET_NAME', { name: '', welcome: '' })
           commit('SET_MUSTCHANGEPWD', '')
           commit('SET_MUSTCHANGEPWD', '')
           commit('SET_AVATAR', '')
           commit('SET_AVATAR', '')

+ 2 - 0
src/utils/request.js

@@ -38,8 +38,10 @@ const err = (error) => {
 // request interceptor
 // request interceptor
 service.interceptors.request.use(config => {
 service.interceptors.request.use(config => {
   const token = store.getters.token
   const token = store.getters.token
+  const changeOrg = store.getters.changeOrg
   if (token) {
   if (token) {
     config.headers['access-token'] = token // 让每个请求携带自定义 token 请根据实际情况自行修改
     config.headers['access-token'] = token // 让每个请求携带自定义 token 请根据实际情况自行修改
+    config.headers['access-org'] = changeOrg // 当前要切换的账号 sn
   }
   }
   return config
   return config
 }, err)
 }, err)

+ 0 - 8
src/views/inventoryManagement/intelligentReplenishment/add.vue

@@ -1,8 +0,0 @@
-<template>
-</template>
-
-<script>
-</script>
-
-<style>
-</style>

+ 0 - 8
src/views/inventoryManagement/intelligentReplenishment/basicInfoSettings.vue

@@ -1,8 +0,0 @@
-<template>
-</template>
-
-<script>
-</script>
-
-<style>
-</style>

+ 174 - 0
src/views/inventoryManagement/intelligentReplenishment/detailModal.vue

@@ -0,0 +1,174 @@
+<template>
+  <a-modal
+    centered
+    class="intelligentReplenishmentDetail-modal"
+    :footer="null"
+    :maskClosable="false"
+    title="预测单详情"
+    v-model="isShow"
+    @cancle="isShow=false"
+    :width="800">
+    <div>
+      <a-alert type="info" showIcon style="margin-bottom:15px">
+        <div slot="message">此预测单的各项参数信息如下</div>
+      </a-alert>
+      <div class="module-cont">
+        <p class="title">产品范围</p>
+        <a-tag color="blue" style="margin-bottom: 10px;">自选产品</a-tag>
+        <s-table
+          class="sTable"
+          ref="table"
+          size="small"
+          :rowKey="(record) => record.id"
+          :columns="columns"
+          :data="loadData"
+          :scroll="{ y: 400 }"
+          bordered>
+        </s-table>
+      </div>
+      <div class="module-cont">
+        <p class="title">销售保障法</p>
+        <p class="explain">保障倍数:<span>1.5</span></p>
+      </div>
+      <div class="module-cont">
+        <p class="title">趋势平均法</p>
+        <p class="explain">服务水平:<span>90%</span></p>
+      </div>
+      <div class="spin-cont">
+        按照以上参数设置,系统正在计算中,请耐心等待...
+        <a-spin style="margin-left: 15px;" />
+      </div>
+      <div class="btn-cont">
+        <a-button type="primary" id="intelligentReplenishmentDetail-save" @click="handleDownload">结果下载</a-button>
+        <a-button id="intelligentReplenishmentDetail-back" @click="isShow = false">关闭</a-button>
+      </div>
+    </div>
+  </a-modal>
+</template>
+
+<script>
+import { STable } from '@/components'
+// import { custTypeSave } from '@/api/custType'
+export default {
+  name: 'IntelligentReplenishmentDetailModal',
+  components: { STable },
+  props: {
+    openModal: { //  弹框显示状态
+      type: Boolean,
+      default: false
+    },
+    itemId: {
+      type: [Number, String],
+      default: ''
+    }
+  },
+  data () {
+    return {
+      isShow: this.openModal, //  是否打开弹框
+      detailsData: null, //  详情数据
+      columns: [
+        { title: '序号', dataIndex: 'no', width: 80, align: 'center' },
+        { title: '类型', dataIndex: 'createDate', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '类型名称', dataIndex: 'name', align: 'center', customRender: function (text) { return text || '--' } }
+      ],
+      // 加载数据方法 必须为 Promise 对象
+      loadData: parameter => {
+        // return custTypeList(Object.assign(parameter, this.queryParam)).then(res => {
+        //   const data = res.data
+        //   const no = (data.pageNo - 1) * data.pageSize
+        //   for (var i = 0; i < data.list.length; i++) {
+        //     data.list[i].no = no + i + 1
+        //   }
+        //   return data
+        // })
+        return new Promise(function (resolve, reject) {
+          const data = {
+            pageNo: 1,
+            pageSize: 10,
+            list: [
+              { id: '1', state: 1, purchaseNo: 'jgqp11111111111', creatDate: '产品1', custName: 'jgqp111123545', totalP: '箭冠品牌', totalNums: '产品分类1', totalPrice: '5', payType: '122' },
+              { id: '2', state: 2, purchaseNo: 'jgqp11111111111', creatDate: '产品1', custName: 'jgqp111123545', totalP: '箭冠品牌', totalNums: '产品分类1', totalPrice: '5', payType: '122' },
+              { id: '3', state: 3, purchaseNo: 'jgqp11111111111', creatDate: '产品1', custName: 'jgqp111123545', totalP: '箭冠品牌', totalNums: '产品分类1', totalPrice: '5', payType: '122' },
+              { id: '4', state: 4, purchaseNo: 'jgqp11111111111', creatDate: '产品1', custName: 'jgqp111123545', totalP: '箭冠品牌', totalNums: '产品分类1', totalPrice: '5', payType: '122' },
+              { id: '5', state: 5, purchaseNo: 'jgqp11111111111', creatDate: '产品1', custName: 'jgqp111123545', totalP: '箭冠品牌', totalNums: '产品分类1', totalPrice: '5', payType: '122' }
+            ],
+            count: 10
+          }
+          resolve(data)
+        })
+      }
+    }
+  },
+  methods: {
+    //  结果下载
+    handleDownload () {
+      const params = this.queryParam
+      this.downloadLoading = true
+      // stockExport(params).then(res => {
+      //   this.downloadLoading = false
+      //   this.download(res)
+      // })
+    },
+    download (data) {
+      if (!data) { return }
+      const url = window.URL.createObjectURL(new Blob([data]))
+      const link = document.createElement('a')
+      link.style.display = 'none'
+      link.href = url
+      const a = moment().format('YYYYMMDDHHmmss')
+      const fname = '智能补货' + a
+      link.setAttribute('download', fname + '.xlsx')
+      document.body.appendChild(link)
+      link.click()
+    }
+  },
+  watch: {
+    //  父页面传过来的弹框状态
+    openModal (newValue, oldValue) {
+      this.isShow = newValue
+    },
+    //  重定义的弹框状态
+    isShow (newValue, oldValue) {
+      if (!newValue) {
+        this.$emit('close')
+      }
+    },
+    itemId (newValue, oldValue) {
+      if (this.isShow && newValue) {
+
+      }
+    }
+  }
+}
+</script>
+
+<style lang="less">
+  .intelligentReplenishmentDetail-modal{
+    .module-cont{
+      border: 1px dashed #e8e8e8;
+      border-radius: 12px;
+      position: relative;
+      margin: 30px 0;
+      padding: 20px 15px 15px;
+      .title{
+        position: absolute;
+        left: 50px;
+        top: -12px;
+        padding: 0 10px;
+        background-color: #fff;
+      }
+      .explain{
+        margin-bottom: 5px;
+        font-weight: bold;
+      }
+    }
+    .spin-cont{
+      text-align: center;
+    }
+    .btn-cont {
+      text-align: center;
+      font-weight: bold;
+      margin: 35px 0 10px;
+    }
+  }
+</style>

+ 120 - 0
src/views/inventoryManagement/intelligentReplenishment/edit.vue

@@ -0,0 +1,120 @@
+<template>
+  <div class="intelligentReplenishmentEdit-wrap">
+    <a-page-header :ghost="false" :backIcon="false" class="intelligentReplenishmentEdit-back">
+      <!-- 自定义的二级文字标题 -->
+      <template slot="subTitle">
+        <a id="intelligentReplenishmentEdit-back-btn" href="javascript:;" @click="handleBack"><a-icon type="left" /> 返回列表</a>
+      </template>
+    </a-page-header>
+    <a-card size="small" :bordered="false" class="intelligentReplenishmentEdit-cont">
+      <div class="steps-cont">
+        <a-steps :current="1" size="small">
+          <a-step title="参数设置" />
+          <a-step title="系统计算" />
+        </a-steps>
+      </div>
+      <a-form-model
+        id="intelligentReplenishmentEdit-form"
+        ref="ruleForm"
+        :model="form"
+        :rules="rules"
+        :label-col="formItemLayout.labelCol"
+        :wrapper-col="formItemLayout.wrapperCol"
+      >
+        <div class="module-cont">
+          <p class="title">产品范围</p>
+          <a-form-model-item label="" prop="loginFlag" class="form-item">
+            <a-radio-group name="radioGroup" v-model="form.loginFlag" placeholder="请选择">
+              <a-radio :value="1">全部产品</a-radio>
+              <a-radio :value="0">自选产品</a-radio>
+            </a-radio-group>
+          </a-form-model-item>
+
+        </div>
+        <div class="module-cont">
+          <p class="title">销售保障法<a-button type="link" size="small" class="link-btn">算法说明</a-button></p>
+          <a-form-model-item label="保障倍数" prop="loginFlag" class="form-item">
+            <a-input-number
+              id="intelligentReplenishmentEdit-outQty"
+              v-model="form.outQty"
+              :precision="2"
+              :min="1"
+              :max="3"
+              placeholder="请输入1~3之间的数字,最多两位小数"
+              style="width: 100%;" />
+          </a-form-model-item>
+        </div>
+        <div class="module-cont">
+          <p class="title">趋势平均法<a-button type="link" size="small" class="link-btn">算法说明</a-button></p>
+          <a-form-model-item label="服务水平" prop="loginFlag" class="form-item">
+            <a-input id="intelligentReplenishmentEdit-outQty" v-model="form.productOrigCode" placeholder="请选择" readonly @click="chooseFun" />
+          </a-form-model-item>
+        </div>
+      </a-form-model>
+    </a-card>
+  </div>
+</template>
+
+<script>
+export default {
+  data () {
+    return {
+      formItemLayout: {
+        labelCol: { span: 2 },
+        wrapperCol: { span: 16 }
+      },
+      form: {
+        name: ''
+      },
+      rules: {
+        name: [ { required: true, message: '请输入客户类型名称', trigger: 'blur' } ]
+      }
+    }
+  },
+  methods: {
+    // 返回
+    handleBack () {
+      this.$router.push({ path: `/inventoryManagement/intelligentReplenishment/list` })
+    },
+    //  选择
+    chooseFun () {
+
+    }
+  }
+}
+</script>
+
+<style lang="less">
+  .intelligentReplenishmentEdit-wrap{
+    .intelligentReplenishmentEdit-back{
+      margin-bottom: 10px;
+    }
+    .intelligentReplenishmentEdit-cont{
+      .steps-cont{
+        width: 50%;
+        margin: 0 auto;
+      }
+      .module-cont{
+        border: 1px dashed #e8e8e8;
+        border-radius: 12px;
+        position: relative;
+        margin: 30px 0;
+        padding: 20px 15px 15px;
+        .title{
+          position: absolute;
+          left: 50px;
+          top: -12px;
+          padding: 0 10px;
+          font-size: 15px;
+          background-color: #fff;
+          .link-btn{
+            font-size: 12px;
+          }
+        }
+        .form-item{
+          margin-top: 25px;
+        }
+      }
+    }
+  }
+</style>

+ 143 - 0
src/views/inventoryManagement/intelligentReplenishment/editModal.vue

@@ -0,0 +1,143 @@
+<template>
+  <a-modal
+    centered
+    class="intelligentReplenishmentEdit-modal"
+    :footer="null"
+    :maskClosable="false"
+    :title="modalTit"
+    v-model="isShow"
+    @cancle="isShow=false"
+    :width="800">
+    <!-- 表单 -->
+    <div>
+      <a-form-model
+        id="intelligentReplenishmentEdit-form"
+        ref="ruleForm"
+        :model="form"
+        :rules="rules"
+        :label-col="formItemLayout.labelCol"
+        :wrapper-col="formItemLayout.wrapperCol"
+      >
+        <a-form-model-item label="客户类型名称" prop="name">
+          <a-input
+            id="intelligentReplenishmentEdit-name"
+            :maxLength="30"
+            v-model.trim="form.name"
+            @change="filterEmpty"
+            placeholder="请输入客户类型名称(最多30个字符)"
+            allowClear />
+        </a-form-model-item>
+      </a-form-model>
+      <div class="btn-cont">
+        <a-button type="primary" id="customer-type-edit-modal-save" @click="handleSave">保存</a-button>
+        <a-button id="customer-type-edit-modal-back" @click="isShow = false" style="margin-left: 15px;">返回列表</a-button>
+      </div>
+    </div>
+  </a-modal>
+</template>
+
+<script>
+import { STable } from '@/components'
+import { custTypeSave } from '@/api/custType'
+export default {
+  name: 'CustomerTypeEditModal',
+  components: { STable },
+  props: {
+    openModal: { //  弹框显示状态
+      type: Boolean,
+      default: false
+    },
+    itemId: {
+      type: [Number, String],
+      default: ''
+    },
+    nowData: {
+      type: Object,
+      default: null
+    }
+  },
+  computed: {
+    modalTit () {
+      return (this.itemId ? '编辑' : '新增') + '客户类型'
+    }
+  },
+  data () {
+    return {
+      isShow: this.openModal, //  是否打开弹框
+      detailsData: null, //  品牌数据
+      formItemLayout: {
+        labelCol: { span: 6 },
+        wrapperCol: { span: 16 }
+      },
+      form: {
+        name: '' // 客户类型名称
+      },
+      rules: {
+        name: [
+          { required: true, message: '请输入客户类型名称', trigger: 'blur' }
+        ]
+      }
+    }
+  },
+  methods: {
+    filterEmpty () {
+      let str = this.form.name
+      str = str.replace(/\ +/g, '')
+      str = str.replace(/[ ]/g, '')
+      str = str.replace(/[\r\n]/g, '')
+      this.form.name = str
+    },
+    //  保存
+    handleSave () {
+      const _this = this
+      this.$refs.ruleForm.validate(valid => {
+        if (valid) {
+          const form = _this.form
+          form.id = _this.itemId ? _this.itemId : null
+          custTypeSave(form).then(res => {
+            if (res.status == 200) {
+              _this.$message.success(res.message)
+              _this.isShow = false
+            }
+          })
+        } else {
+          console.log('error submit!!')
+          return false
+        }
+      })
+    }
+  },
+  watch: {
+    //  父页面传过来的弹框状态
+    openModal (newValue, oldValue) {
+      this.isShow = newValue
+    },
+    //  重定义的弹框状态
+    isShow (newValue, oldValue) {
+      if (!newValue) {
+        this.$emit('close')
+        this.$refs.ruleForm.resetFields()
+      }
+    },
+    itemId (newValue, oldValue) {
+      if (this.isShow && newValue) { //  编辑
+        this.form.name = this.nowData && this.nowData.name ? this.nowData.name : ''
+      } else { //  添加
+        this.form.name = ''
+      }
+    }
+  }
+}
+</script>
+
+<style lang="less">
+  .intelligentReplenishmentEdit-modal{
+    .ant-modal-body {
+      padding: 40px 40px 24px;
+    }
+    .btn-cont {
+      text-align: center;
+      margin: 35px 0 10px;
+    }
+  }
+</style>

+ 150 - 3
src/views/inventoryManagement/intelligentReplenishment/list.vue

@@ -1,8 +1,155 @@
 <template>
 <template>
+  <a-card size="small" :bordered="false" class="intelligentReplenishmentList-wrap">
+    <!-- 操作按钮 -->
+    <div class="table-operator">
+      <a-button id="intelligentReplenishmentList-add" type="primary" class="button-error" @click="handleEdit()">新增</a-button>
+      <a-button id="intelligentReplenishmentList-set" type="primary" class="button-warning" @click="handleSet">基础信息设置</a-button>
+    </div>
+    <a-alert type="info" showIcon style="margin-bottom:15px">
+      <div slot="message">为保证系统性能,仅保留最近10次的预测结果</div>
+    </a-alert>
+    <!-- 列表 -->
+    <s-table
+      class="sTable"
+      ref="table"
+      size="default"
+      :rowKey="(record) => record.id"
+      :columns="columns"
+      :data="loadData"
+      bordered>
+      <!-- 操作 -->
+      <template slot="action" slot-scope="text, record">
+        <a-button
+          size="small"
+          type="link"
+          class="button-info"
+          @click="handleEdit(record)"
+          id="intelligentReplenishmentList-edit-btn">编辑</a-button>
+        <a-button
+          size="small"
+          type="link"
+          class="button-error"
+          @click="handleDel(record)"
+          id="intelligentReplenishmentList-del-btn">删除</a-button>
+        <a-button
+          size="small"
+          type="link"
+          class="button-success"
+          @click="handleDetail(record)"
+          id="customerManagementList-detail-btn">详情</a-button>
+        <a-button
+          size="small"
+          type="link"
+          class="button-warning"
+          :loading="downloadLoading"
+          @click="handleDownload(record)"
+          id="chainTransferInList-download-btn">结果下载</a-button>
+      </template>
+    </s-table>
+    <!-- 新增/编辑 -->
+    <intelligent-replenishment-edit-modal :openModal="openModal" :itemId="itemId" @close="closeModal" />
+    <intelligent-replenishment-detail-modal :openModal="openDetailModal" :itemId="itemId" @close="closeModal" />
+  </a-card>
 </template>
 </template>
 
 
 <script>
 <script>
+import moment from 'moment'
+import { custTypeList, custTypeDel } from '@/api/custType'
+import { STable, VSelect } from '@/components'
+import intelligentReplenishmentEditModal from './editModal.vue'
+import intelligentReplenishmentDetailModal from './detailModal.vue'
+export default {
+  components: { STable, VSelect, intelligentReplenishmentEditModal, intelligentReplenishmentDetailModal },
+  data () {
+    return {
+      columns: [
+        { title: '序号', dataIndex: 'no', width: 80, align: 'center' },
+        { title: '创建时间', dataIndex: 'createDate', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '创建人', dataIndex: 'name', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '状态', dataIndex: 'names', width: 200, align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '操作', scopedSlots: { customRender: 'action' }, width: 200, align: 'center' }
+      ],
+      // 加载数据方法 必须为 Promise 对象
+      loadData: parameter => {
+        return custTypeList(Object.assign(parameter, {})).then(res => {
+          const data = res.data
+          const no = (data.pageNo - 1) * data.pageSize
+          for (var i = 0; i < data.list.length; i++) {
+            data.list[i].no = no + i + 1
+          }
+          return data
+        })
+      },
+      openModal: false, //  新增编辑  弹框
+      itemId: '', //  当前id
+      downloadLoading: false,
+      openDetailModal: false
+    }
+  },
+  methods: {
+    //  新增/编辑
+    handleEdit (row) {
+      if (row) {
+        this.$router.push({ path: `/inventoryManagement/intelligentReplenishment/edit/${row.sn}` })
+      } else {
+        this.$router.push({ path: `/inventoryManagement/intelligentReplenishment/add` })
+      }
+    },
+    //  详情
+    handleDetail (row) {
+      this.itemId = row ? row.id : null
+      this.openDetailModal = true
+    },
+    // 设置
+    handleSet (row) {
+      // this.$router.push({ path: `/inventoryManagement/intelligentReplenishment/set/${row.sn}` })
+      this.$router.push({ path: `/inventoryManagement/intelligentReplenishment/set/111` })
+    },
+    // 删除
+    handleDel (row) {
+      const _this = this
+      this.$confirm({
+        title: '提示',
+        content: '删除后不可恢复,确定要进行删除吗?',
+        centered: true,
+        onOk () {
+          // custTypeDel({ id: row.id }).then(res => {
+          //   if (res.status == 200) {
+          //     _this.$message.success(res.message)
+          //     _this.$refs.table.refresh()
+          //   }
+          // })
+        }
+      })
+    },
+    //  关闭弹框
+    closeModal () {
+      this.itemId = ''
+      this.openModal = false
+      this.openDetailModal = false
+      this.$refs.table.refresh(true)
+    },
+    //  结果下载
+    handleDownload () {
+      const params = this.queryParam
+      this.downloadLoading = true
+      // stockExport(params).then(res => {
+      //   this.downloadLoading = false
+      //   this.download(res)
+      // })
+    },
+    download (data) {
+      if (!data) { return }
+      const url = window.URL.createObjectURL(new Blob([data]))
+      const link = document.createElement('a')
+      link.style.display = 'none'
+      link.href = url
+      const a = moment().format('YYYYMMDDHHmmss')
+      const fname = '智能补货' + a
+      link.setAttribute('download', fname + '.xlsx')
+      document.body.appendChild(link)
+      link.click()
+    }
+  }
+}
 </script>
 </script>
-
-<style>
-</style>

+ 163 - 0
src/views/inventoryManagement/intelligentReplenishment/set.vue

@@ -0,0 +1,163 @@
+<template>
+  <div class="intelligentReplenishmentSet-wrap">
+    <a-page-header :ghost="false" :backIcon="false" class="intelligentReplenishmentSet-back">
+      <!-- 自定义的二级文字标题 -->
+      <template slot="subTitle">
+        <a id="intelligentReplenishmentSet-back-btn" href="javascript:;" @click="handleBack"><a-icon type="left" /> 返回列表</a>
+      </template>
+    </a-page-header>
+    <a-card size="small" :bordered="false" class="intelligentReplenishmentSet-cont">
+      <div class="importGuide-con">
+        <div class="explain-con">
+          <div class="explain-item">
+            <div class="explain-tit">
+              <span>1</span>准备导入
+            </div>
+            <p>所有允许导入的数据字段请参考模板,数据字段不符合规则,整条不予以导入。</p>
+            <ul>
+              <li>1) “产品编码”字段为必填项。</li>
+              <li>2) “起订量限制“为选项,只可选择”按整箱‘或者“按设置数量”,选择“按设置数量”时,“起订数量”为必填项。</li>
+            </ul>
+            <a :href="filePath" style="padding: 5px 0 0 23px;display: block;">
+              <a-icon type="download" style="padding-right: 5px;" />下载导入模板
+            </a>
+          </div>
+          <div class="explain-item">
+            <div class="explain-tit">
+              <span>2</span>上传数据文件
+            </div>
+            <p>目前支持的文件类型*.xls,*.xlsx.</p>
+            <p>
+              <Upload
+                id="importGuide-attachList"
+                ref="importUpload"
+                :maxNums="1"
+                fileType="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.ms-excel"
+                uploadType="import"
+                :action="attachAction"
+                :uploadParams="uploadParams"
+                upText="添加文件"
+                @change="changeImport"></Upload>
+            </p>
+          </div>
+        </div>
+        <!-- 按钮 -->
+        <div class="btn-con">
+          <a-button
+            type="primary"
+            id="importGuide-nextStep"
+            size="large"
+            class="button-primary"
+            @click="handlerNextStep"
+            style="padding: 0 60px;">下一步</a-button>
+          <a-button
+            id="importGuide-cancel"
+            size="large"
+            class="button-cancel"
+            @click="isShow=false"
+            style="padding: 0 60px;margin-left: 15px;">取消</a-button>
+        </div>
+      </div>
+    </a-card>
+    <!-- 导入 -->
+    <!-- <chooseImportModal :openModal="openImportModal" :paramsData="paramsData" @close="handleClose" @ok="hanldeOk" /> -->
+  </div>
+</template>
+
+<script>
+import { Upload } from '@/components'
+export default {
+  components: { Upload },
+  data () {
+    return {
+      filePath: 'http://jg-ocs.oss-cn-beijing.aliyuncs.com/templ/promo/normal_product_templ.xlsx',
+      openImportModal: false, //  导入
+      attachAction: process.env.VUE_APP_API_BASE_URL + '/upload',
+      paramsData: null,
+      uploadParams: {
+        savePathType: 'local'
+      }
+    }
+  },
+  methods: {
+    // 返回
+    handleBack () {
+      this.$router.push({ path: `/inventoryManagement/intelligentReplenishment/list` })
+    },
+    // 下一步
+    handlerNextStep () {
+      if (this.paramsData) {
+        this.openImportModal = true
+      } else {
+        this.$message.warning('添加文件后再进行下一步操作!')
+      }
+    },
+    // 上传文件  change
+    changeImport (file) {
+      if (file) {
+        this.paramsData = {
+          promoRuleType: this.params.promoRuleType || '',
+          promoGoodsType: this.params.promoGoodsType || '',
+          path: file
+        }
+      }
+    },
+    // 导入
+    hanldeOk (obj) {
+      if (obj && obj.length > 0) {
+        this.$emit('ok', obj)
+        this.isShow = false
+      }
+    },
+    // 关闭
+    handleClose () {
+      this.openImportModal = false
+      this.isShow = false
+    }
+  }
+}
+</script>
+
+<style lang="less">
+  .importGuide-warp{
+    .importGuide-con{
+      .explain-con{
+        .explain-item{
+          margin-bottom: 10px;
+          .explain-tit{
+            font-weight: bold;
+            span{
+              display: inline-block;
+              width: 18px;
+              height: 18px;
+              line-height: 16px;
+              text-align: center;
+              margin-right: 5px;
+              border-radius: 50%;
+              border: 1px solid rgba(0, 0, 0, 0.3);
+            }
+          }
+          p{
+            margin: 8px 0;
+            padding-left: 23px;
+          }
+          ul{
+            list-style: none;
+            padding: 0;
+            padding-left: 23px;
+            margin: 0;
+            li{
+              line-height: 26px;
+            }
+          }
+        }
+      }
+      .btn-con{
+        margin: 60px 0 20px;
+        .button-cancel{
+          font-size: 12px;
+        }
+      }
+    }
+  }
+</style>