liqianyi 2 éve
szülő
commit
4d867eee1c

+ 0 - 1
src/views/modules/order/order.vue

@@ -185,7 +185,6 @@
     created () {
       this.optionsState = this.$store.state.common.approveStates
       this.userId = this.$store.state.user.id
-      console.log(this.userId)
       this.queryData()
     },
     data () {

+ 7 - 16
src/views/modules/sale/add-material.vue

@@ -56,10 +56,15 @@
 </template>
 
 <script>
-  import { getDictList } from '@/api/dict'
   import MaterialComponent from '@/views/modules/common/material-component'
   export default {
     name: 'add-material',
+    props: {
+      optionsType: {
+        type: Array,
+        default: () => []
+      }
+    },
     components: {MaterialComponent},
     data () {
       return {
@@ -69,7 +74,6 @@
         transferData: {},
         dataForm: {},
         id: 0,
-        optionsType: [], // 采购类别
         dataRule: {
           materialName: [{ required: true, message: '物品名称不能为空', trigger: 'blur' }],
           specification: [{ required: true, message: '型号及规格不能为空', trigger: 'blur' }],
@@ -81,12 +85,7 @@
       }
     },
     methods: {
-      async init (id, display, transferData, optionsType) {
-        if (optionsType) {
-          this.optionsType = optionsType
-        } else {
-          this.getTypeList()
-        }
+      init (id, display, transferData) {
         this.dataForm = {
           cnt: 1
         }
@@ -96,14 +95,6 @@
         if (!id) return
         this.dataForm = transferData
       },
-      // 获取采购类别字典
-      getTypeList () {
-        getDictList({type: 'purchase_type'}).then(({data}) => {
-          if (data) {
-            this.optionsType = data
-          }
-        })
-      },
       // 表单提交
       dataFormSubmit () {
         this.$refs['dataForm'].validate((valid) => {

+ 10 - 13
src/views/modules/sale/purchase-add-or-update.vue

@@ -136,18 +136,23 @@
       <el-button type="primary" @click="dataFormSubmit()">确定</el-button>
     </span>
     <!-- 新增物品 -->
-    <Add v-show="addMaterialVisible" ref="comAddMaterial" @addItem="addMaterialCallback"/>
+    <Add v-show="addMaterialVisible" ref="comAddMaterial" :options-type="optionsType" @addItem="addMaterialCallback"/>
   </div>
 </template>
 
 <script>
   import Add from './add-material'
-  import { getDictList } from '@/api/dict'
   import { getPurchaseDetail } from '@/api/sale'
   import { dealStepData, dealStepLogs } from '@/api/util'
   import UserComponent from '../common/user-component'
   export default {
     name: 'purchase-add-or-update',
+    props: {
+      optionsType: {
+        type: Array,
+        default: () => []
+      }
+    },
     components: {
       UserComponent,
       Add
@@ -158,7 +163,7 @@
         dataList: [],
         id: 0,
         dataForm: {},
-        optionsType: [],
+        // optionsType: [],
         materialDetails: [],
         addMaterialVisible: false,
         dataRule: {
@@ -173,14 +178,6 @@
       onChose () {
         this.$emit('onChose')
       },
-      // 获取采购类别字典
-      getTypeList () {
-        getDictList({type: 'purchase_type'}).then(({data}) => {
-          if (data) {
-            this.optionsType = data
-          }
-        })
-      },
       async init (id) {
         this.materialDetails = []
         this.dataForm = {
@@ -247,13 +244,13 @@
       addMaterial () {
         this.addMaterialVisible = true
         this.$nextTick(() => {
-          this.$refs.comAddMaterial.init(null, null, null, this.optionsType)
+          this.$refs.comAddMaterial.init(null, null, null)
         })
       },
       addMaterialHandle (row, disable) {
         this.addMaterialVisible = true
         this.$nextTick(() => {
-          this.$refs.comAddMaterial.init(row.detailId, disable, row, this.optionsType)
+          this.$refs.comAddMaterial.init(row.detailId, disable, row)
         })
       },
       deleteMaterialHandle (detailId) {

+ 5 - 3
src/views/modules/sale/purchase.vue

@@ -207,8 +207,8 @@
           label="操作">
           <template slot-scope="scope">
             <el-button v-if="isAuth('purchase:detail:info')" type="text" size="small" @click="detailHandle(scope.row.procurementId)">查看</el-button>
-            <el-button v-if="isAuth('purchase:detail:update') && (Number(scope.row.approvalState) === 1)" type="text" size="small" @click="addOrUpdateHandle(scope.row.procurementId)">编辑</el-button>
-            <el-button v-if="isAuth('purchase:detail:updatePurchaseDetail') && (Number(scope.row.purchaseState) === 1)" type="text" size="small" @click="operateHandle(scope.row)">采购</el-button>
+            <el-button v-if="isAuth('purchase:detail:update') && (Number(scope.row.approvalState) < 2) && scope.row.creatorId === userId.toString()" type="text" size="small" @click="addOrUpdateHandle(scope.row.procurementId)">编辑</el-button>
+            <el-button v-if="isAuth('purchase:detail:updatePurchaseDetail')&& (Number(scope.row.approvalState) === 3) && (Number(scope.row.purchaseState) === 1)" type="text" size="small" @click="operateHandle(scope.row)">采购</el-button>
             <el-button v-if="isAuth('purchase:detail:infoPutIn') && (Number(scope.row.approvalState) === 3  && (Number(scope.row.purchaseState) === 2 || Number(scope.row.purchaseState) === 5))" type="text" size="small" @click="inboundHandle(scope.row)">入库</el-button>
             <el-button v-if="isAuth('purchase:detail:infoPutInAgain') && (Number(scope.row.purchaseState) === 5)" type="text" size="small" @click="inboundHandle(scope.row.procurementId)">再次入库</el-button>
           </template>
@@ -225,7 +225,7 @@
       </el-pagination>
     </template>
     <!-- 弹窗, 新增 / 修改 -->
-    <add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList" @onChose="onChose"></add-or-update>
+    <add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" :options-type="optionsType" @refreshDataList="getDataList" @onChose="onChose"></add-or-update>
     <detail v-if="detailVisible" ref="detail" @onChose="onChose"/>
     <!-- 采购操作 -->
     <operate v-if="operateVisible" ref="operate" @onChose="onChose" @refreshDataList="getDataList"/>
@@ -257,6 +257,7 @@
         inboundVisible: false,
         noticeChangeAttachVisible: false,
         dataForm: {},
+        userId: 0,
         dataList: [],
         pageIndex: 1,
         pageSize: 10,
@@ -279,6 +280,7 @@
     },
     created () {
       this.optionsState = this.$store.state.common.approveStates
+      this.userId = this.$store.state.user.id
       this.getTypeList()
       this.getDataList()
     },