Browse Source

no message

linwenxin 8 months ago
parent
commit
f43ed6b6a4

+ 9 - 9
src/api/material-system/common.js

@@ -1,5 +1,14 @@
 import request from '@/utils/request'
 
+// 后台计算值
+export function computeVal(params) {
+  return request({
+    url: '/common/computeVal',
+    method: 'get',
+    params
+  })
+}
+
 export function commonDict(params) {
   return request({
     url: '/common/dict',
@@ -51,12 +60,3 @@ export function queryPayStatus(params) {
     params
   })
 }
-
-// 后台计算值
-export function computeVal(params) {
-  return request({
-    url: '/common/computeVal',
-    method: 'get',
-    params
-  })
-}

+ 30 - 42
src/api/material-system/shop/purchase-apply-sheet.js

@@ -1,84 +1,72 @@
-import request,{postBlob} from '@/utils/request'
+import request, { postBlob } from '@/utils/request'
 
-// 获取采购申请单列表
-export function getPurchaseApplySheetList(params) {
-  return request({
-    url: '/shop/purchase-apply/list',
-    method: 'get',
-    params
-  })
-}
 export function getNewPurchaseApplySheetList(data) {
-  console.log(data,999);
   return request({
-    url: `/shop/purchase-apply/zfire/list?moduleId=${data.moduleId}`,
-    method: "post",
+    url: `/websit/purchase/apply/list?moduleId=${data.moduleId}`,
+    method: 'post',
     data
-  });
+  })
 }
 
 // 导出
 export function exportNewPurchaseApplySheetList(data, name) {
   return postBlob({
-    url: '/shop/purchase-apply/zfire/list/export',
+    url: '/websit/purchase/apply/list/export',
     data,
     name
   })
 }
 
-
-
-
-// 获取采购申请单信息
-export function getPurchaseApplySheet(params) {
+// 提交采购申请单
+export function submitPurchaseApplySheet(params) {
   return request({
-    url: '/shop/purchase-apply/detail',
-    method: 'get',
+    url: '/websit/purchase/apply/submit',
+    method: 'post',
     params
   })
 }
 
-// 新增采购申请单
-export function addPurchaseApplySheet(params) {
+// 撤消采购申请单
+export function revokePurchaseApplySheet(params) {
   return request({
-    url: '/shop/purchase-apply/add',
+    url: '/websit/purchase/apply/revoke',
     method: 'post',
-    data: params
+    params
   })
 }
 
-// 编辑采购申请单
-export function editPurchaseApplySheet(params) {
+// 删除采购申请单
+export function delPurchaseApplySheet(data) {
   return request({
-    url: '/shop/purchase-apply/update',
+    url: '/websit/purchase/apply/batch/del',
     method: 'post',
-    data: params
+    data
   })
 }
 
-// 提交采购申请单
-export function submitPurchaseApplySheet(params) {
+// 获取采购申请单信息
+export function getPurchaseApplySheet(params) {
   return request({
-    url: '/shop/purchase-apply/submit',
+    url: '/websit/purchase/apply/detail',
     method: 'get',
     params
   })
 }
 
-// 撤消采购申请单
-export function revokePurchaseApplySheet(params) {
+// 新增采购申请单
+export function addPurchaseApplySheet(params) {
   return request({
-    url: '/shop/purchase-apply/revoke',
-    method: 'get',
-    params
+    url: '/websit/purchase/apply/add',
+    method: 'post',
+    data: params
   })
 }
 
-// 删除采购申请单
-export function delPurchaseApplySheet(params) {
+// 编辑采购申请单
+export function editPurchaseApplySheet(params) {
   return request({
-    url: '/shop/purchase-apply/del',
-    method: 'get',
-    params
+    url: '/websit/purchase/apply/edit',
+    method: 'post',
+    data: params
   })
 }

+ 3 - 8
src/api/material-system/shop/purchase-sheet.js

@@ -1,4 +1,4 @@
-import request,{postBlob} from '@/utils/request'
+import request, { postBlob } from '@/utils/request'
 
 // 新增网点采购单
 export function addPurchaseSheet(params) {
@@ -9,9 +9,6 @@ export function addPurchaseSheet(params) {
   })
 }
 
-
-
-
 // 审核网点采购单
 export function confirmPurchaseSheet(params) {
   return request({
@@ -93,14 +90,12 @@ export function getPurchaseSheetList(params) {
   })
 }
 
-
 export function getNewPurchaseSheetList(data) {
-  console.log(data,999);
   return request({
     url: `/shop/purchase/zfire/list?moduleId=${data.moduleId}`,
-    method: "post",
+    method: 'post',
     data
-  });
+  })
 }
 
 // 导出

+ 113 - 98
src/views/auxiliaryFittings/shop/components/PurchaseApplyArea.vue

@@ -8,19 +8,14 @@
     label-position="left"
     label-width="80px"
   >
-    <el-form-item v-if="formDisabled" label="单据编号" prop="sheetId">
-      <el-input disabled :value="dataForm.sheetId" />
+    <el-form-item v-if="formDisabled" label="单据编号" prop="purchaseId">
+      <el-input disabled :value="dataForm.purchaseId" />
     </el-form-item>
     <el-row :gutter="20">
       <el-col :span="8">
-        <el-form-item label="网点" prop="shopId">
-          <el-select v-model="dataForm.shopId" :disabled="formDisabled" placeholder="请选择网点" style="width: 100%">
-            <el-option
-              v-for="(item, index) in getAuthShop(null, dataForm)"
-              :key="index"
-              :label="shopLabelStrHandle(item)"
-              :value="item.shopId"
-            />
+        <el-form-item label="网点" prop="websitId">
+          <el-select v-model="dataForm.websitId" :disabled="formDisabled" placeholder="请选择网点" style="width: 100%">
+            <el-option v-for="(item, index) in authShop" :key="index" :label="item.name" :value="item.websitId" />
           </el-select>
         </el-form-item>
       </el-col>
@@ -37,8 +32,9 @@
             <el-option
               v-for="(item, index) in venderList"
               :key="index"
-              :label="vendorLabelStrHandle(item)"
+              :label="item.venderName"
               :value="item.venderId"
+              :disabled="item.status !== 'ON'"
             />
           </el-select>
         </el-form-item>
@@ -81,50 +77,47 @@
         >
           <el-table-column prop="goodsId" label="辅材编号" />
           <el-table-column prop="goodsName" label="辅材名称" width="230" />
-          <el-table-column prop="estimateCost" label="预估进价" header-align="left" align="center">
+          <el-table-column prop="applyCost" label="预估进价" header-align="left" align="center">
             <template slot-scope="{ $index, row }">
-              <label v-if="inputParam.openType === 'view'">{{ row.estimateCost + ' 元/' + row.measureUnit }}</label>
+              <label v-if="inputParam.openType === 'view'">{{ row.applyCost + ' 元/' + row.goodsStockUnit }}</label>
               <el-form-item
                 v-else
                 style="margin: 18px 0"
                 label-width="0"
                 size="mini"
-                :prop="'items.' + $index + '.estimateCost'"
-                :rules="dataFormRules.estimateCost"
+                :prop="'items.' + $index + '.applyCost'"
+                :rules="dataFormRules.applyCost"
               >
-                <el-input v-model="row.estimateCost" size="mini" @change="changeCostValue($index, row)">
-                  <template slot="suffix">{{ ' 元/' + row.measureUnit }}</template>
+                <el-input v-model="row.applyCost" size="mini" @change="changeCostValue($index, row)">
+                  <template slot="suffix">{{ ' 元/' + row.goodsStockUnit }}</template>
                 </el-input>
               </el-form-item>
             </template>
           </el-table-column>
-          <el-table-column prop="purchaseQty" label="订货数量" header-align="left" align="center" width="120">
+          <el-table-column prop="applyQty" label="订货数量" header-align="left" align="center" width="120">
             <template slot-scope="{ $index, row }">
-              <label v-if="inputParam.openType === 'view'">{{ row.purchaseQty + ' /' + row.measureUnit }}</label>
+              <label v-if="inputParam.openType === 'view'">{{ row.applyQty + ' /' + row.goodsStockUnit }}</label>
               <el-form-item
                 v-else
                 style="margin: 18px 0"
                 label-width="0"
                 size="mini"
-                :prop="'items.' + $index + '.purchaseQty'"
-                :rules="dataFormRules.purchaseQty"
+                :prop="'items.' + $index + '.applyQty'"
+                :rules="dataFormRules.applyQty"
               >
-                <el-input v-model="row.purchaseQty" size="mini" @change="changeCostValue($index, row)">
-                  <template slot="suffix">{{ ' /' + row.measureUnit }}</template>
+                <el-input v-model="row.applyQty" size="mini" @change="changeCostValue($index, row)">
+                  <template slot="suffix">{{ ' /' + row.goodsStockUnit }}</template>
                 </el-input>
               </el-form-item>
             </template>
           </el-table-column>
-          <el-table-column prop="estimateCostValue" label="预估金额" header-align="left" align="center">
+          <el-table-column prop="applyCostValue" label="预估金额" header-align="left" align="center">
             <template slot-scope="{ $index, row }">
-              <label>{{ row.estimateCostValue + ' 元' }}</label>
+              <label>{{ row.applyCostValue + ' 元' }}</label>
             </template>
           </el-table-column>
-          <el-table-column prop="measureUnit" label="采购单位" />
-          <el-table-column prop="unitQty" label="转换系数" />
-          <el-table-column prop="salesUnit" label="售卖单位" />
-          <el-table-column prop="productModel" label="商品型号" min-width="100" />
-          <el-table-column prop="specification" label="规格" min-width="80" />
+          <el-table-column prop="goodsStockUnit" label="采购单位" />
+          <el-table-column prop="goodsSpecification" label="规格" min-width="80" />
           <el-table-column v-if="inputParam.openType !== 'view'" fixed="right" align="center" label="">
             <template slot-scope="scope">
               <el-button type="text" @click="delItem(scope.$index)">删除</el-button>
@@ -140,11 +133,11 @@
     </el-row>
     <div style="text-align: right">
       <el-button @click="cancelForm">取 消</el-button>
-      <el-button v-if="checkBtn('add')" type="primary" :disabled="saveBtn" @click="submitForm('add')">保 存</el-button>
-      <el-button v-if="checkBtn('edit')" type="primary" :disabled="saveBtn" @click="submitForm('edit')"
+      <el-button v-if="$restrict('add')" type="primary" :disabled="saveBtn" @click="submitForm('add')">保 存</el-button>
+      <el-button v-if="$restrict('edit')" type="primary" :disabled="saveBtn" @click="submitForm('edit')"
         >保 存</el-button
       >
-      <el-button v-if="checkBtn('submit')" type="success" @click="submitSheet(dataForm.sheetId)">提 交</el-button>
+      <el-button v-if="$restrict('submit')" type="success" @click="submitSheet(dataForm.purchaseId)">提 交</el-button>
     </div>
     <el-dialog
       width="70%"
@@ -167,7 +160,7 @@
             data =>
               !searchGoods ||
               data.goodsName.toLowerCase().includes(searchGoods.toLowerCase()) ||
-              data.specification.toLowerCase().includes(searchGoods.toLowerCase())
+              data.goodsSpecification.toLowerCase().includes(searchGoods.toLowerCase())
           )
         "
         :row-key="getRowKeys"
@@ -182,9 +175,7 @@
         <el-table-column prop="goodsCode" label="辅材代码" />
         <el-table-column prop="goodsName" label="辅材名称" />
         <el-table-column prop="categoryName" label="小类名称" />
-        <el-table-column prop="productModel" label="商品型号" />
-        <el-table-column prop="specification" label="规格" />
-        <el-table-column prop="qty" label="库存数量" />
+        <el-table-column prop="goodsSpecification" label="规格" />
       </el-table>
       <div slot="footer" class="dialog-footer">
         <el-button type="primary" @click="selGoods">确 定</el-button>
@@ -200,9 +191,11 @@ import {
   editPurchaseApplySheet,
   getPurchaseApplySheet
 } from '@/api/material-system/shop/purchase-apply-sheet'
-import { getVenderGoodsList, getVenderList } from '@/api/material-system/vender'
+import { getVenderGoodsList } from '@/api/material-system/vender'
+import { getNewVenderGoodsList } from '@/api/material-system/vender'
 import { computeVal } from '@/api/material-system/common'
-
+import { listPageV2 } from '@/api/auxiliaryFittings/supplier'
+import { getWebsit } from '@/api/customerManagement.js'
 export default {
   name: 'PurchaseApplyArea',
   props: {
@@ -211,13 +204,13 @@ export default {
       default: function () {
         return {
           openType: 'add',
-          sheetId: ''
+          purchaseId: ''
         }
       }
     }
   },
   data() {
-    const validatePurchaseQty = (rule, value, callback) => {
+    const validateapplyQty = (rule, value, callback) => {
       this.saveBtn = true
       if (Number.isNaN(parseFloat(value))) {
         return callback(new Error('请输入数字值'))
@@ -231,9 +224,9 @@ export default {
     return {
       loading: true,
       dataForm: {
-        sheetId: '', // 单据ID
-        shopId: '', // 网点ID
-        shopName: '', // 网点名称
+        purchaseId: '', // 单据ID
+        websitId: '', // 网点ID
+        websitName: '', // 网点名称
         venderId: '', // 供应商ID
         venderName: '', // 供应商名称
         notes3: '', // 备注
@@ -241,19 +234,20 @@ export default {
         items: [] // 关系辅材列表
       },
       dataFormRules: {
-        shopId: [{ required: true, message: '请选择网点', trigger: 'change' }],
-        purchaseQty: [{ validator: validatePurchaseQty, trigger: 'blur' }]
+        websitId: [{ required: true, message: '请选择网点', trigger: 'change' }],
+        applyQty: [{ validator: validateapplyQty, trigger: 'blur' }]
       },
       goodsList: [], // 商品列表
       venderList: [], // 供应商列表
       innerVisible: false,
       searchGoods: '',
-      saveBtn: false // 保存按钮状态
+      saveBtn: false, // 保存按钮状态
+      authShop: []
     }
   },
   computed: {
     formDisabled() {
-      return this.inputParam.openType === 'view' || this.dataForm.sheetId !== ''
+      return this.inputParam.openType === 'view' || this.dataForm.purchaseId !== ''
     },
     goodsTotalCount: function () {
       return this.dataForm && this.dataForm.items ? this.dataForm.items.length : 0
@@ -261,7 +255,7 @@ export default {
   },
   watch: {
     // 网点变动重新执行辅材获取资料
-    'shopPurchaseForm.shopId': function () {
+    'shopPurchaseForm.websitId': function () {
       this.getVenderGoodsList(this.dataForm.venderId)
     },
     searchGoods: function () {
@@ -271,14 +265,40 @@ export default {
   mounted() {
     this.getVenderList()
     this.getDetail()
+    getWebsit({ type: 'C', status: true }).then(res => {
+      this.authShop = res.data
+    })
   },
   methods: {
+    sheetFlagStr(type, val, filterArrays) {
+      const flag = [
+        { label: '保存', value: 'SAVE' },
+        { label: '提交', value: 'SUBMIT' },
+        { label: '作废', value: 'FAIL' },
+        { label: '已审核', value: 'OK' }
+      ].filter(obj => {
+        if (filterArrays) {
+          return filterArrays.indexOf(obj.value) >= 0
+        }
+        return true
+      })
+      if (type === 'select') {
+        // 下拉选择返回数组
+        return flag
+      } else if (type === 'label') {
+        // 显示代号返回字符
+        if (val === null || val === '') return ''
+        const obj = flag.find(o => o.value === val)
+        return obj ? obj.label : ''
+      }
+      return ''
+    },
     getDetail(id) {
       this.loading = true
       const openType = this.inputParam.openType
-      const sheetId = id || this.inputParam.sheetId
+      const purchaseId = id || this.inputParam.purchaseId
       if (openType !== 'add') {
-        getPurchaseApplySheet({ sheetId }).then(res => {
+        getPurchaseApplySheet({ purchaseId }).then(res => {
           this.setDataForm(res.data)
           if (openType !== 'view') {
             this.getVenderGoodsList(res.data.venderId, false)
@@ -305,8 +325,10 @@ export default {
               this.$successMsg('保存成功')
             })
           } else {
-            this.dataForm.shopName = this.getArraysName(this.authShop, this.dataForm, 'shopId', 'shopName')
-            this.dataForm.venderName = this.getArraysName(this.venderList, this.dataForm, 'venderId', 'venderName')
+            this.dataForm.websitName = this.authShop.find(item => item.websitId === this.dataForm.websitId)?.websitName
+            this.dataForm.venderName = this.venderList.find(
+              item => item.venderId === this.dataForm.venderId
+            )?.venderName
             addPurchaseApplySheet(this.dataForm).then(res => {
               this.inputParam.openType = 'edit'
               this.setDataForm(res.data)
@@ -318,27 +340,24 @@ export default {
     },
     setDataForm(data) {
       this.dataForm = {
-        sheetId: data.sheetId, // 单据编号
-        shopId: data.shopId, // 网点ID
+        purchaseId: data.purchaseId, // 单据编号
+        websitId: data.websitId, // 网点ID
         venderId: data.venderId, // 供应商Id
         flag: data.flag,
         notes: data.notes, // 备注
         items: data.items // 关系商品列表
       }
     },
-    checkBtn(type) {
-      const typeMap = {
-        add: this.inputParam.openType === type,
-        edit: this.dataForm.flag === 0 && this.inputParam.openType === type,
-        revoke: this.dataForm.flag === 1,
-        submit: this.dataForm.flag === 0 && this.dataForm.sheetId !== ''
-      }
-      // 检查按钮权限
-      return this.checkBtnRole(type) && typeMap[type]
-    },
     // 获取供应商列表
     getVenderList() {
-      getVenderList({ pageNum: 1, pageSize: -1, flag: 1 }).then(res => {
+      listPageV2({
+        pageNum: 1,
+        pageSize: -1,
+        params: [
+          { param: 'a.status', compare: '=', value: 'ON' },
+          { param: 'a.vender_type', compare: 'like', value: '辅材' }
+        ]
+      }).then(res => {
         this.venderList = res.data.records
       })
     },
@@ -347,38 +366,34 @@ export default {
       if (clear) {
         this.dataForm.items = []
       }
-      getVenderGoodsList({
-        pageNum: 1,
-        pageSize: -1,
-        venderId: val,
-        flag: 1,
-        status: 1,
-        shopId: this.dataForm.shopId
-      }).then(res => {
-        this.goodsList = res.data.records
-      })
+      if (val) {
+        getNewVenderGoodsList({
+          pageNum: 1,
+          pageSize: -1,
+          params: [{ param: 'a.vender_id', compare: '=', value: val }]
+        }).then(res => {
+          this.goodsList = res.data.records
+        })
+      }
     },
     // 选中辅材添加到表单中
     selGoods() {
       this.searchGoods = ''
       this.$refs.goodsTable.selection.forEach(value => {
-        const index = this.dataForm.items.findIndex(item => {
-          return item.goodsId === value.goodsId
-        })
         // 添加不在列表的商品
-        if (index < 0) {
+        if (
+          !this.dataForm.items.find(item => {
+            return item.goodsId === value.goodsId
+          })
+        ) {
           this.dataForm.items.push({
             goodsId: value.goodsId,
             goodsName: value.goodsName,
-            ndays: value.ndays,
-            purchaseQty: 0,
-            estimateCost: 0,
-            estimateCostValue: 0,
-            measureUnit: value.measureUnit,
-            unitQty: value.unitQty,
-            salesUnit: value.salesUnit,
-            productModel: value.productModel,
-            specification: value.specification
+            goodsSpecification: value.goodsSpecification,
+            applyQty: 0,
+            applyCost: 0,
+            applyCostValue: 0,
+            goodsStockUnit: value.goodsStockUnit
           })
         }
       })
@@ -393,9 +408,9 @@ export default {
       return row.goodsId
     },
     // 提交 采购申请单
-    submitSheet(sheetId) {
+    submitSheet(purchaseId) {
       this.$confirm(
-        `此操作将提交 ${sheetId} 单据,<span style="color: #ff0000;">当前内容如果已修改将忽略保存</span>,是否继续?`,
+        `此操作将提交 ${purchaseId} 单据,<span style="color: #ff0000;">当前内容如果已修改将忽略保存</span>,是否继续?`,
         '提示',
         {
           confirmButtonText: '确定',
@@ -406,11 +421,11 @@ export default {
       )
         .then(() => {
           this.loading = true
-          submitPurchaseApplySheet({ sheetId: sheetId }).then(
+          submitPurchaseApplySheet({ purchaseId: purchaseId }).then(
             () => {
               setTimeout(() => {
                 this.inputParam.openType = 'view'
-                this.getDetail(sheetId)
+                this.getDetail(purchaseId)
                 this.$successMsg('提交成功')
                 this.loading = false
               }, 2000)
@@ -425,12 +440,12 @@ export default {
     // 预估进价或申请数量变动
     changeCostValue(index, row) {
       computeVal({
-        frontVal: row.purchaseQty,
-        afterVal: row.estimateCost,
+        frontVal: row.applyQty,
+        afterVal: row.applyCost,
         operator: '*',
-        scale: 4
+        scale: 2
       }).then(res => {
-        this.dataForm.items[index].estimateCostValue = res.data
+        this.dataForm.items[index].applyCostValue = res.data
       })
     },
     getSummaries(param) {
@@ -442,7 +457,7 @@ export default {
           return
         }
         const values = data.map(item => Number(item[column.property]))
-        if (column.property === 'estimateCostValue') {
+        if (column.property === 'applyCostValue') {
           let count = 0
           sums[index] = values.reduce((prev, curr) => {
             const suffix = (curr + '').split('.')

+ 105 - 185
src/views/auxiliaryFittings/shop/purchase-apply-sheet/index.vue

@@ -1,17 +1,5 @@
 <template>
   <div style="height: 100%">
-    <template v-if="purchaseApplyArea && purchaseApplyAreaParam.openType === 'add'">
-      <el-page-header class="pdt" content="新增采购申请单" @back="backUpdPage" />
-      <el-divider />
-    </template>
-    <template v-else-if="purchaseApplyArea && purchaseApplyAreaParam.openType !== 'add'">
-      <el-page-header
-        class="pdt"
-        :content="purchaseApplyAreaParam.openType === 'view' ? '查看采购申请单' : '编辑采购申请单'"
-        @back="backUpdPage"
-      />
-      <el-divider />
-    </template>
     <div v-show="!purchaseApplyArea" style="height: 100%">
       <template-page
         ref="pageRef"
@@ -26,19 +14,32 @@
       >
       </template-page>
     </div>
-    <!-- 新增编辑单据 -->
-    <purchase-apply-area
-      v-if="purchaseApplyArea"
-      :is-open.sync="purchaseApplyArea"
-      :input-param="purchaseApplyAreaParam"
-      @getList="$refs.pageRef.refreshList()"
-    />
+    <template v-if="purchaseApplyArea">
+      <div style="box-sizing: border-box; padding: 20px">
+        <el-page-header
+          :content="
+            purchaseApplyAreaParam.openType === 'add'
+              ? '新增采购申请单'
+              : purchaseApplyAreaParam.openType === 'view'
+              ? '查看采购申请单'
+              : '编辑采购申请单'
+          "
+          @back="backUpdPage"
+        />
+        <el-divider />
+        <!-- 新增编辑单据 -->
+        <purchase-apply-area
+          :is-open.sync="purchaseApplyArea"
+          :input-param="purchaseApplyAreaParam"
+          @getList="$refs.pageRef.refreshList()"
+        />
+      </div>
+    </template>
   </div>
 </template>
 
 <script>
 import {
-  getPurchaseApplySheetList,
   submitPurchaseApplySheet,
   revokePurchaseApplySheet,
   delPurchaseApplySheet,
@@ -48,59 +49,23 @@ import {
 import PurchaseApplyArea from '../components/PurchaseApplyArea'
 import TemplatePage from '@/components/template/template-page-1.vue'
 import import_mixin from '@/components/template/import_mixin.js'
+import operation_mixin from '@/components/template/operation_mixin.js'
 export default {
   name: 'PurchaseApplySheet',
   components: { PurchaseApplyArea, TemplatePage },
-  mixins: [import_mixin],
+  mixins: [import_mixin, operation_mixin],
   data() {
     return {
       purchaseApplyArea: false,
       purchaseApplyAreaParam: {
         openType: 'add',
-        sheetId: ''
+        purchaseId: ''
       },
-      dataList: null, // 列表数据
       listLoading: false, // 列表加载loading
-      currentPage: 1, // 当前页码
-      pageSize: 10, // 每页数量
-      listTotal: 0, // 列表总数
-      screenForm: {
-        // 筛选表单数据
-        createTime: '', // 创建时间
-        flag: '', // 状态
-        keyword: '', // 关键词
-        sheetId: '', // 单据编号
-        shopId: ''
-      },
-      // 事件组合
-      optionsEvensGroup: [
-        [
-          [
-            {
-              name: '新增单据',
-              click: () => {
-                this.addOrEdit('add')
-              },
-              isRole: this.checkBtnRole('add')
-            }
-          ]
-        ]
-      ],
       // 表格属性
       tableAttributes: {
         // 启用勾选列
-        selectColumn: true,
-        columnExpand: (h, { row, index, columm }) => {
-          return (
-            <div style="padding-left:95px">
-              <el-form label-position="left" inline class="demo-table-expand">
-                <el-form-item label="备注">
-                  <span>{row.notes3}</span>
-                </el-form-item>
-              </el-form>
-            </div>
-          )
-        }
+        selectColumn: false
       },
       // 表格事件
       tableEvents: {
@@ -109,66 +74,96 @@ export default {
       recordSelected: []
     }
   },
-  created() {
-    // this.$refs.pageRef.refreshList();
+  computed: {
+    optionsEvensGroup() {
+      return [
+        [
+          [
+            this.optionsEvensAuth('add', {
+              click: () => {
+                this.addOrEdit('add')
+              }
+            })
+          ]
+        ]
+      ]
+    }
   },
   methods: {
-    // 查询列表
-    getList() {
-      this.listLoading = true
+    // 列表请求函数
+    getList: getNewPurchaseApplySheetList,
 
-      const params = {
-        shopId: this.screenForm.shopId,
-        flag: this.screenForm.flag,
-        venderName: this.screenForm.keyword,
-        sheetId: this.screenForm.sheetId,
-        startTime: this.screenForm.createTime ? this.screenForm.createTime[0] : '',
-        endTime: this.screenForm.createTime ? this.screenForm.createTime[1] : '',
-        pageNum: this.currentPage,
-        pageSize: this.pageSize
-      }
-      getPurchaseApplySheetList(params).then(res => {
-        this.dataList = res.data.records
-        this.listTotal = res.data.total
-        this.listLoading = false
-      })
-    },
-    // 更改每页数量
-    handleSizeChange(val) {
-      this.pageSize = val
-      this.currentPage = 1
-      this.$refs.pageRef.refreshList()
-    },
-    // 更改当前页
-    handleCurrentChange(val) {
-      this.currentPage = val
-      this.$refs.pageRef.refreshList()
+    // 列表导出函数
+    exportList: exportNewPurchaseApplySheetList,
+
+    // 表格列解析渲染数据更改
+    columnParsing(item, defaultData) {
+      return defaultData
     },
-    // 重置筛选表单
-    resetScreenForm() {
-      this.currentPage = 1
-      this.$refs.pageRef.refreshList()
+
+    // 监听勾选变化
+    selectionChange(data) {
+      this.recordSelected = data
     },
-    // 提交筛选表单
-    submitScreenForm() {
-      this.currentPage = 1
-      this.$refs.pageRef.refreshList()
+
+    operation() {
+      return this.operationBtn({
+        view: {
+          click: ({ row, index, column }) => {
+            this.addOrEdit('view', row.purchaseId)
+          }
+        },
+        edit: {
+          conditions: ({ row, index, column }) => {
+            return row.flag === 'SAVE' && row.isRecheck === 'ON'
+          },
+          click: ({ row, index, column }) => {
+            this.addOrEdit('edit', row.purchaseId)
+          }
+        },
+        submit: {
+          conditions: ({ row, index, column }) => {
+            return row.flag === 'SAVE' && row.isRecheck === 'ON'
+          },
+          click: ({ row, index, column }) => {
+            this.submitSheet(row.purchaseId)
+          }
+        },
+        del: {
+          prompt: '确定删除吗?',
+          conditions: ({ row, index, column }) => {
+            return row.flag === 'SAVE' && row.isRecheck === 'ON'
+          },
+          click: ({ row, index, column }) => {
+            this.delSheet(row.purchaseId)
+          }
+        },
+        revoke: {
+          prompt: '确定撤消吗?',
+          conditions: ({ row, index, column }) => {
+            return row.flag === 'SUBMIT' && row.isRecheck === 'ON'
+          },
+          click: ({ row, index, column }) => {
+            this.revokeSheet(row.purchaseId)
+          }
+        }
+      })
     },
     // 新增编辑 采购入库单
     addOrEdit(type, id) {
       this.purchaseApplyArea = true
       this.purchaseApplyAreaParam.openType = type
-      this.purchaseApplyAreaParam.sheetId = id
+      this.purchaseApplyAreaParam.purchaseId = id
     },
     // 撤消单据
-    revokeSheet(sheetId) {
-      this.$confirm(`此操作将撤消 ${sheetId} 单据, 是否继续?`, '提示', {
+    revokeSheet(purchaseId) {
+      this.$confirm(`此操作将撤消 ${purchaseId} 单据, 是否继续?`, '提示', {
         confirmButtonText: '确定',
         cancelButtonText: '取消',
         type: 'warning'
       })
         .then(() => {
-          revokePurchaseApplySheet({ sheetId: sheetId }).then(() => {
+          revokePurchaseApplySheet({ purchaseId: purchaseId }).then(() => {
             this.$refs.pageRef.refreshList()
             this.$successMsg('撤消成功')
           })
@@ -176,14 +171,14 @@ export default {
         .catch(() => console.log('取消'))
     },
     // 删除单据
-    delSheet(sheetId) {
-      this.$confirm(`此操作将删除 ${sheetId} 单据, 是否继续?`, '提示', {
+    delSheet(purchaseId) {
+      this.$confirm(`此操作将删除 ${purchaseId} 单据, 是否继续?`, '提示', {
         confirmButtonText: '确定',
         cancelButtonText: '取消',
         type: 'warning'
       })
         .then(() => {
-          delPurchaseApplySheet({ sheetId: sheetId }).then(() => {
+          delPurchaseApplySheet([purchaseId]).then(() => {
             this.$refs.pageRef.refreshList()
             this.$successMsg('删除成功')
           })
@@ -191,15 +186,15 @@ export default {
         .catch(() => console.log('取消'))
     },
     // 提交 采购入库单
-    submitSheet(sheetId) {
-      this.$confirm(`此操作将提交 ${sheetId} 单据, 是否继续?`, '提示', {
+    submitSheet(purchaseId) {
+      this.$confirm(`此操作将提交 ${purchaseId} 单据, 是否继续?`, '提示', {
         confirmButtonText: '确定',
         cancelButtonText: '取消',
         type: 'warning'
       })
         .then(() => {
           this.listLoading = true
-          submitPurchaseApplySheet({ sheetId: sheetId }).then(
+          submitPurchaseApplySheet({ purchaseId: purchaseId }).then(
             () => {
               setTimeout(() => {
                 this.$refs.pageRef.refreshList()
@@ -214,87 +209,12 @@ export default {
         })
         .catch(() => console.log('取消'))
     },
-    // 操作事件
-    handleCommand(param) {
-      if (param[1] === 'view' || param[1] === 'edit') {
-        this.addOrEdit(param[1], param[0])
-      } else {
-        this[param[1] + 'Sheet'](param[0])
-      }
-    },
     backUpdPage() {
       this.$refs.pageRef.refreshList()
       this.purchaseApplyArea = false
-    },
-    // 列表请求函数
-    getList(...p) {
-      this.recordSelected = []
-      return getNewPurchaseApplySheetList(...p)
-    },
-    // 列表导出函数
-    exportList: exportNewPurchaseApplySheetList,
-    // 表格列解析渲染数据更改
-    columnParsing(item, defaultData) {
-      return defaultData
-    },
-    // 监听勾选变化
-    selectionChange(data) {
-      this.recordSelected = data
-    },
-    operation() {
-      return (h, { row, index, column }) => {
-        return (
-          <div class="operation-btns">
-            <el-dropdown onCommand={p => this.handleCommand(p)}>
-              <el-button type="text">
-                更多
-                <i class="el-icon-arrow-down el-icon--right" />
-              </el-button>
-              <el-dropdown-menu slot="dropdown">
-                {this.checkBtnRole('view') ? (
-                  <el-dropdown-item icon="el-icon-view" command={[row.sheetId, 'view']}>
-                    查看
-                  </el-dropdown-item>
-                ) : null}
-
-                {row.flag === 0 ? (
-                  <div>
-                    {this.checkBtnRole('edit') ? (
-                      <el-dropdown-item icon="el-icon-edit" command={[row.sheetId, 'edit']}>
-                        编辑
-                      </el-dropdown-item>
-                    ) : null}
-
-                    {this.checkBtnRole('submit') ? (
-                      <el-dropdown-item icon="el-icon-lock" command={[row.sheetId, 'submit']}>
-                        提交
-                      </el-dropdown-item>
-                    ) : null}
-
-                    {this.checkBtnRole('del') ? (
-                      <el-dropdown-item icon="el-icon-delete" command={[row.sheetId, 'del']}>
-                        删除
-                      </el-dropdown-item>
-                    ) : null}
-                    {row.flag === 1 && this.checkBtnRole('revoke') ? (
-                      <el-dropdown-item v-if="" icon="el-icon-unlock" command={[row.sheetId, 'revoke']}>
-                        撤消
-                      </el-dropdown-item>
-                    ) : null}
-                  </div>
-                ) : null}
-              </el-dropdown-menu>
-            </el-dropdown>
-          </div>
-        )
-      }
     }
   }
 }
 </script>
 
-<style scoped>
-.pdt {
-  padding: 20px 20px 0 20px;
-}
-</style>
+<style scoped></style>

+ 24 - 2
src/views/auxiliaryFittings/vender/components/ShopPurchaseArea.vue

@@ -39,7 +39,7 @@
       </el-col>
       <el-col :span="8">
         <el-form-item label="状态" prop="flag">
-          <!-- <el-input disabled :value="sheetFlagStr('label', dataForm.flag)" /> -->
+          <el-input disabled :value="sheetFlagStr('label', dataForm.flag)" />
         </el-form-item>
       </el-col>
     </el-row>
@@ -137,7 +137,6 @@ import {
   getPurchaseApplySheet,
   verifyPurchaseApplySheet
 } from '@/api/material-system/vender/shop-purchase-apply'
-import { getVenderList } from '@/api/material-system/vender'
 import { listPageV2 } from '@/api/auxiliaryFittings/supplier'
 import { getWebsit } from '@/api/customerManagement.js'
 export default {
@@ -202,6 +201,29 @@ export default {
     })
   },
   methods: {
+    sheetFlagStr(type, val, filterArrays) {
+      const flag = [
+        { label: '保存', value: 'SAVE' },
+        { label: '提交', value: 'SUBMIT' },
+        { label: '作废', value: 'FAIL' },
+        { label: '已审核', value: 'OK' }
+      ].filter(obj => {
+        if (filterArrays) {
+          return filterArrays.indexOf(obj.value) >= 0
+        }
+        return true
+      })
+      if (type === 'select') {
+        // 下拉选择返回数组
+        return flag
+      } else if (type === 'label') {
+        // 显示代号返回字符
+        if (val === null || val === '') return ''
+        const obj = flag.find(o => o.value === val)
+        return obj ? obj.label : ''
+      }
+      return ''
+    },
     // 获取供应商列表
     getVenderList() {
       listPageV2({

+ 1 - 4
src/views/auxiliaryFittings/vender/shop-purchase/index.vue

@@ -125,10 +125,7 @@ export default {
       this.shopPurchaseArea = false
     },
     // 列表请求函数
-    getList(...p) {
-      this.recordSelected = []
-      return getNewPurchaseApplySheetList(...p)
-    },
+    getList: getNewPurchaseApplySheetList,
     // 列表导出函数
     exportList: exportNewPurchaseApplySheetList,
     // 表格列解析渲染数据更改

+ 23 - 27
src/views/auxiliaryFittings/vender/vender-goods-sheet/index.vue

@@ -1,17 +1,5 @@
 <template>
   <div style="height: 100%">
-    <template v-if="venderGoodsArea && venderGoodsAreaParam.openType === 'add'">
-      <el-page-header class="pdt" content="新增关系维护单" @back="backUpdPage" />
-      <el-divider />
-    </template>
-    <template v-else-if="venderGoodsArea && venderGoodsArea.openType !== 'add'">
-      <el-page-header
-        class="pdt"
-        :content="venderGoodsAreaParam.openType === 'view' ? '查看关系维护单' : '编辑关系维护单'"
-        @back="backUpdPage"
-      />
-      <el-divider />
-    </template>
     <div v-show="!venderGoodsArea" style="height: 100%">
       <template-page
         ref="pageRef"
@@ -25,12 +13,27 @@
       >
       </template-page>
     </div>
-    <vender-goods-area
-      v-if="venderGoodsArea"
-      :is-open.sync="venderGoodsArea"
-      :input-param="venderGoodsAreaParam"
-      @getList="$refs.pageRef.refreshList()"
-    />
+    <template v-if="venderGoodsArea">
+      <div style="box-sizing: border-box; padding: 20px">
+        <el-page-header
+          class="pdt"
+          :content="
+            venderGoodsAreaParam.openType === 'add'
+              ? '新增关系维护单'
+              : venderGoodsAreaParam.openType === 'view'
+              ? '查看关系维护单'
+              : '编辑关系维护单'
+          "
+          @back="backUpdPage"
+        />
+        <el-divider />
+        <vender-goods-area
+          :is-open.sync="venderGoodsArea"
+          :input-param="venderGoodsAreaParam"
+          @getList="$refs.pageRef.refreshList()"
+        />
+      </div>
+    </template>
   </div>
 </template>
 
@@ -85,10 +88,7 @@ export default {
   },
   methods: {
     // 列表请求函数
-    getList(p) {
-      this.recordSelected = []
-      return getNewVenderList(p)
-    },
+    getList: getNewVenderList,
     // 列表导出函数
     exportList: exportNewVenderList,
     // 表格列解析渲染数据更改
@@ -163,8 +163,4 @@ export default {
 }
 </script>
 
-<style scoped>
-.pdt {
-  padding: 20px 20px 0 20px;
-}
-</style>
+<style scoped></style>

+ 1 - 4
src/views/auxiliaryFittings/vender/vender-goods/index.vue

@@ -35,10 +35,7 @@ export default {
   },
   methods: {
     // 列表请求函数
-    getList(...p) {
-      this.recordSelected = []
-      return getNewVenderGoodsList(...p)
-    },
+    getList: getNewVenderGoodsList,
     // 列表导出函数
     exportList: exportVenderGoods,
     // 表格列解析渲染数据更改