chris hace 2 años
padre
commit
2d4467de1e

+ 93 - 0
src/views/modules/warehouse/stock-notice-change-setting.vue

@@ -0,0 +1,93 @@
+<template>
+    <div>
+        <div class="my-title">变更通知人设置</div>
+        <!-- 表单 -->
+        <el-form :model="dataForm" :rules="dataRule" ref="dataForm" label-width="auto">
+          <el-row class="my-row">
+            <el-form-item label="通知接收人" prop="userIds">
+              <user-components v-model="dataForm.userIds" :userIds.sync="dataForm.userIds" @change="userSelectedChanged"/>
+            </el-form-item>
+          </el-row>
+        </el-form>
+        <span slot="footer" class="dialog-footer">
+          <el-button @click="onChose">取消</el-button>
+          <el-button type="primary" @click="dataFormSubmit()">确定</el-button>
+        </span>
+    </div>
+</template>
+
+<script>
+  import UserComponents from '../common/user-components'
+
+export default {
+    name: 'stock-notice-change-setting',
+    components: {
+      UserComponents
+    },
+    data () {
+      return {
+        visible: false,
+        dataForm: {
+          userIds: []
+        },
+        dataRule: {
+          userIds: [{ required: true, message: '请选择通知接收人', trigger: 'change' }]
+        }
+      }
+    },
+    methods: {
+      onChose () {
+        this.$emit('onChose')
+      },
+      async init () {
+        this.dataForm = {}
+        this.$http({
+          url: this.$http.adornUrl(`/biz-service/stock-mg-ctl/noteChangeConfig`),
+          method: 'get'
+        }).then(({data}) => {
+          if (data && data.code === '200') {
+            this.dataForm = {
+              userIds: data.data
+            }
+          }
+        })
+        this.visible = true
+      },
+      validateField (type) {
+        this.$refs.dataForm.validateField(type)
+      },
+      // 表单提交
+      dataFormSubmit () {
+        this.$refs['dataForm'].validate((valid) => {
+          if (valid) {
+            this.$http({
+              url: this.$http.adornUrl(`/biz-service/stock-mg-ctl/noteChangeConfig`),
+              method: 'post',
+              data: this.dataForm.userIds
+            }).then(({data}) => {
+              if (data && data.code === '200') {
+                this.$message({
+                  message: '操作成功',
+                  type: 'success',
+                  duration: 1500,
+                  onClose: () => {
+                    this.onChose()
+                  }
+                })
+              } else {
+                this.$message.error(data.msg)
+              }
+            })
+          }
+        })
+      },
+      userSelectedChanged (val) {
+        this.dataForm.userIds = val
+      }
+    }
+  }
+</script>
+
+<style scoped>
+
+</style>

+ 19 - 3
src/views/modules/warehouse/stock.vue

@@ -1,7 +1,7 @@
 <!-- 库存管理 -->
 <template>
     <div class="stock">
-      <template v-if="!detailVisible && !addOrUpdateVisible">
+      <template v-if="!detailVisible && !addOrUpdateVisible && !noticeChangeAttachVisible">
         <el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
           <el-form-item label="名称">
             <el-input v-model="dataForm.materialName" placeholder="请输入名称" clearable/>
@@ -9,6 +9,7 @@
           <el-form-item>
             <el-button @click="getDataList()">查询</el-button>
             <el-button v-if="isAuth('wh:stockmanagement:exported')" type="primary" @click="exportExcel()">导出Excel</el-button>
+            <el-button v-if="isAuth('wh:stockmanagement:noteChangeConfig')" type="primary" @click="setNoticeChangeHandel()">库存更改通知设置</el-button>
           </el-form-item>
         </el-form>
         <el-table
@@ -136,15 +137,21 @@
       </template>
       <stock-details v-if="detailVisible" ref="details" @onChose="onChose"/>
       <stock-add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList" @onChose="onChose"/>
+      <notice-change-setting v-if="noticeChangeAttachVisible" ref="noticeChangeSetting" @onChose="onChose"/>
     </div>
 </template>
 
 <script>
   import StockDetails from './stock-details'
   import StockAddOrUpdate from './stock-add-or-update'
+  import NoticeChangeSetting from './stock-notice-change-setting'
   export default {
     name: 'stock',
-    components: {StockAddOrUpdate, StockDetails},
+    components: {
+      StockAddOrUpdate,
+      StockDetails,
+      NoticeChangeSetting
+    },
     data () {
       return {
         dataForm: {
@@ -157,7 +164,8 @@
         dataListLoading: false,
         dataListSelections: [],
         detailVisible: false,
-        addOrUpdateVisible: false
+        addOrUpdateVisible: false,
+        noticeChangeAttachVisible: false
       }
     },
     activated () {
@@ -167,6 +175,7 @@
       onChose () {
         this.addOrUpdateVisible = false
         this.detailVisible = false
+        this.noticeChangeAttachVisible = false
       },
       // 获取数据列表
       getDataList () {
@@ -235,6 +244,13 @@
       formatState (row) {
         if (!row.lockCnt) return ''
         return row.lockCnt === '0' ? '正常' : '盘点中'
+      },
+      // 变更通知人设置
+      setNoticeChangeHandel () {
+        this.noticeChangeAttachVisible = true
+        this.$nextTick(() => {
+          this.$refs.noticeChangeSetting.init()
+        })
       }
     }
   }