Browse Source

no message

linwenxin 8 months ago
parent
commit
36ed41c724

+ 20 - 74
src/api/material-system/shop/purchase-sheet.js

@@ -1,108 +1,54 @@
 import request, { postBlob } from '@/utils/request'
 
-// 新增网点采购单
-export function addPurchaseSheet(params) {
-  return request({
-    url: '/shop/purchase/add',
-    method: 'post',
-    data: params
-  })
-}
-
-// 审核网点采购单
-export function confirmPurchaseSheet(params) {
-  return request({
-    url: '/shop/purchase/confirm',
-    method: 'post',
-    params
-  })
-}
-
-// 反审网点采购单
-export function unAuditPurchaseSheet(params) {
+export function getNewPurchaseSheetList(data) {
   return request({
-    url: '/shop/purchase/unAudit',
+    url: `/websit/purchase/in/order/list?moduleId=${data.moduleId}`,
     method: 'post',
-    params
+    data
   })
 }
 
-// 下推网点采购单
-export function pushPurchaseSheet(params) {
-  return request({
-    url: '/shop/purchase/push',
-    method: 'post',
-    params
+// 导出
+export function exportNewPurchaseSheetList(data, name) {
+  return postBlob({
+    url: '/websit/purchase/in/order/list/export',
+    data,
+    name
   })
 }
 
 // 作废网点采购单
 export function revokePurchaseSheet(params) {
   return request({
-    url: '/shop/purchase/revoke',
-    method: 'get',
+    url: '/websit/purchase/in/order/revoke',
+    method: 'post',
     params
   })
 }
 
-// 删除网点采购单
-export function delPurchaseSheet(params) {
+// 审核网点采购单
+export function confirmPurchaseSheet(params) {
   return request({
-    url: '/shop/purchase/del',
-    method: 'get',
+    url: '/websit/purchase/in/order/confirm',
+    method: 'post',
     params
   })
 }
 
 // 编辑网点采购单
-export function editPurchaseSheet(params) {
+export function editPurchaseSheet(data) {
   return request({
-    url: '/shop/purchase/update',
+    url: '/websit/purchase/in/order/update',
     method: 'post',
-    data: params
+    data
   })
 }
 
 // 获取网点采购单信息
 export function getPurchaseSheet(params) {
   return request({
-    url: '/shop/purchase/detail',
-    method: 'get',
-    params
-  })
-}
-
-// 复制网点采购单
-export function copyPurchaseSheet(params) {
-  return request({
-    url: '/shop/purchase/copy',
-    method: 'get',
-    params
-  })
-}
-
-// 获取网点采购单列表
-export function getPurchaseSheetList(params) {
-  return request({
-    url: '/shop/purchase/list',
-    method: 'get',
-    params
-  })
-}
-
-export function getNewPurchaseSheetList(data) {
-  return request({
-    url: `/shop/purchase/zfire/list?moduleId=${data.moduleId}`,
+    url: '/websit/purchase/in/order/detail',
     method: 'post',
-    data
-  })
-}
-
-// 导出
-export function exportNewPurchaseSheetList(data, name) {
-  return postBlob({
-    url: '/shop/purchase/zfire/list/export',
-    data,
-    name
+    params
   })
 }

+ 21 - 5
src/views/auxiliaryFittings/shop/components/PurchaseApplyArea.vue

@@ -133,11 +133,28 @@
     </el-row>
     <div style="text-align: right">
       <el-button @click="cancelForm">取 消</el-button>
-      <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
+        v-if="$restrict('add') && inputParam.openType == 'add'"
+        type="primary"
+        :disabled="saveBtn"
+        @click="submitForm('add')"
         >保 存</el-button
       >
-      <el-button v-if="$restrict('submit')" type="success" @click="submitSheet(dataForm.purchaseId)">提 交</el-button>
+      <el-button
+        v-if="
+          $restrict('edit') && dataForm.flag === 'SAVE' && dataForm.isRecheck === 'ON' && inputParam.openType == 'edit'
+        "
+        type="primary"
+        :disabled="saveBtn"
+        @click="submitForm('edit')"
+        >保 存</el-button
+      >
+      <el-button
+        v-if="$restrict('submit') && dataForm.flag === 'SAVE' && dataForm.isRecheck === 'ON'"
+        type="success"
+        @click="submitSheet(dataForm.purchaseId)"
+        >提 交</el-button
+      >
     </div>
     <el-dialog
       width="70%"
@@ -191,7 +208,6 @@ import {
   editPurchaseApplySheet,
   getPurchaseApplySheet
 } from '@/api/material-system/shop/purchase-apply-sheet'
-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'
@@ -263,8 +279,8 @@ export default {
     }
   },
   mounted() {
-    this.getVenderList()
     this.getDetail()
+    this.getVenderList()
     getWebsit({ type: 'C', status: true }).then(res => {
       this.authShop = res.data
     })

+ 60 - 183
src/views/auxiliaryFittings/shop/components/PurchaseArea.vue

@@ -8,19 +8,14 @@
     label-position="left"
     label-width="90px"
   >
-    <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 authShop"
-              :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>
@@ -32,13 +27,13 @@
             :disabled="formDisabled"
             placeholder="请选择供应商"
             style="width: 100%"
-            @change="getVenderGoodsList"
           >
             <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>
@@ -195,69 +190,29 @@
     </el-row>
     <div style="text-align: right">
       <el-button @click="cancelForm">取 消</el-button>
-      <el-button v-if="checkBtn('edit')" type="primary" :disabled="saveBtn" @click="submitForm('edit')"
+      <el-button
+        v-if="$restrict('edit') && dataForm.flag === 'SAVE' && dataForm.isRecheck === 'ON'"
+        type="primary"
+        :disabled="saveBtn"
+        @click="submitForm('edit')"
         >保 存</el-button
       >
-      <el-button v-if="checkBtn('confirm')" type="success" @click="confirmSheet(dataForm.sheetId)">审 核</el-button>
-    </div>
-    <el-dialog
-      width="70%"
-      title="商品列表"
-      :visible.sync="innerVisible"
-      :close-on-click-modal="false"
-      @close="$refs.goodsTable.clearSelection()"
-    >
-      <el-input
-        v-model="searchGoods"
-        size="small"
-        placeholder="输入 辅材名称 或 规格 模糊搜索"
-        style="margin-bottom: 5px"
-        :clearable="true"
-      />
-      <el-table
-        ref="goodsTable"
-        :data="
-          goodsList.filter(
-            data =>
-              !searchGoods ||
-              data.goodsName.toLowerCase().includes(searchGoods.toLowerCase()) ||
-              data.specification.toLowerCase().includes(searchGoods.toLowerCase())
-          )
-        "
-        :row-key="getRowKeys"
-        height="400"
-        size="mini"
-        border
-        header-cell-class-name="headerRowColor"
-        style="width: 100%"
+      <el-button
+        v-if="$restrict('confirm') && dataForm.flag === 'SUBMIT' && dataForm.isRecheck === 'ON'"
+        type="success"
+        @click="confirmSheet(dataForm.purchaseId)"
+        >审 核</el-button
       >
-        <el-table-column type="selection" width="55" :reserve-selection="true" />
-        <el-table-column prop="goodsId" label="辅材编号" />
-        <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>
-      <div slot="footer" class="dialog-footer">
-        <el-button type="primary" @click="selGoods">确 定</el-button>
-      </div>
-    </el-dialog>
+    </div>
   </el-form>
 </template>
 
 <script>
-import { getVenderGoodsList, getVenderList } from '@/api/material-system/vender'
 import { computeVal } from '@/api/material-system/common'
 import { getToken } from '@/utils/auth'
-import {
-  addPurchaseSheet,
-  confirmPurchaseSheet,
-  editPurchaseSheet,
-  getPurchaseSheet
-} from '@/api/material-system/shop/purchase-sheet'
-
+import { confirmPurchaseSheet, editPurchaseSheet, getPurchaseSheet } from '@/api/material-system/shop/purchase-sheet'
+import { listPageV2 } from '@/api/auxiliaryFittings/supplier'
+import { getWebsit } from '@/api/customerManagement.js'
 export default {
   name: 'PurchaseArea',
   props: {
@@ -266,7 +221,7 @@ export default {
       default: function () {
         return {
           openType: 'add',
-          sheetId: ''
+          purchaseId: ''
         }
       }
     }
@@ -284,8 +239,6 @@ export default {
       callback()
     }
     const validateRecQty = (rule, value, callback) => {
-      // const index = /^items\.([0-9]+)\.recQty/.exec(rule.fullField)[1]
-      // const deliverQty = this.dataForm.items[index].deliverQty
       this.saveBtn = true
       if (Number.isNaN(parseFloat(value))) {
         return callback(new Error('请输入数字值'))
@@ -293,9 +246,6 @@ export default {
       if (parseFloat(value) < 0) {
         return callback(new Error('不能少于0'))
       }
-      // if (index && deliverQty && parseFloat(value) > parseFloat(deliverQty)) {
-      //   return callback(new Error('不能大于供应'))
-      // }
       this.saveBtn = false
       callback()
     }
@@ -316,9 +266,9 @@ export default {
       baseURL: process.env.VUE_APP_BASE_API,
       myHeaders: { 'x-token': getToken() },
       dataForm: {
-        sheetId: '', // 单据ID
-        shopId: '', // 网点ID
-        shopName: '', // 网点名称
+        purchaseId: '', // 单据ID
+        websitId: '', // 网点ID
+        websitName: '', // 网点名称
         venderId: '', // 供应商ID
         venderName: '', // 供应商名称
         purchaseTime: '', // 采购日期
@@ -338,41 +288,33 @@ export default {
       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
     }
   },
-  watch: {
-    // 网点变动重新执行辅材获取资料
-    'shopPurchaseForm.shopId': function () {
-      this.getVenderGoodsList(this.dataForm.venderId)
-    },
-    searchGoods: function () {
-      this.$refs.goodsTable.clearSelection()
-    }
-  },
   mounted() {
-    this.getVenderList()
     this.getDetail()
+    this.getVenderList()
+    getWebsit({ type: 'C', status: true }).then(res => {
+      this.authShop = res.data
+    })
   },
   methods: {
     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') {
-        getPurchaseSheet({ sheetId }).then(res => {
+        getPurchaseSheet({ purchaseId }).then(res => {
           this.setDataForm(res.data)
-          if (openType !== 'view') {
-            this.getVenderGoodsList(this.dataForm.venderId)
-          }
           this.loading = false
         })
       } else {
@@ -396,15 +338,7 @@ export default {
         if (valid) {
           if (type === 'edit') {
             editPurchaseSheet(this.dataForm).then(() => {
-              this.getDetail(this.dataForm.sheetId)
-              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')
-            addPurchaseSheet(this.dataForm).then(res => {
-              this.inputParam.openType = 'edit'
-              this.setDataForm(res.data)
+              this.getDetail(this.dataForm.purchaseId)
               this.$successMsg('保存成功')
             })
           }
@@ -413,8 +347,8 @@ export default {
     },
     setDataForm(data) {
       this.dataForm = {
-        sheetId: data.sheetId, // 单据编号
-        shopId: data.shopId, // 网点ID
+        purchaseId: data.purchaseId, // 单据编号
+        websitId: data.websitId, // 网点ID
         venderId: data.venderId, // 供应商Id
         purchaseTime: data.purchaseTime, // 采购日期
         flag: data.flag,
@@ -424,39 +358,29 @@ export default {
       }
       Object.assign(this.orgDataForm, this.dataForm)
     },
-    checkBtn(type) {
-      const typeMap = {
-        add: this.inputParam.openType === type,
-        edit: this.dataForm.flag === 2 && this.inputParam.openType === type,
-        confirm:
-          this.dataForm.flag === 2 &&
-          this.dataForm.sheetId !== '' &&
-          this.orgDataForm.purchaseTime &&
-          this.orgDataForm.image
-      }
-      // 检查按钮权限
-      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
       })
     },
-    // 获取供应商关系辅材列表
-    getVenderGoodsList(val) {
-      if (val) {
-        getVenderGoodsList({
-          pageNum: 1,
-          pageSize: -1,
-          venderId: val,
-          flag: 1,
-          status: 1,
-          shopId: this.dataForm.shopId
-        }).then(res => {
-          this.goodsList = res.data.records
-        })
-      }
+    // 预估进价或申请数量变动
+    changeCostValue(index, row) {
+      computeVal({
+        frontVal: row.applyQty,
+        afterVal: row.applyCost,
+        operator: '*',
+        scale: 2
+      }).then(res => {
+        this.dataForm.items[index].applyCostValue = res.data
+      })
     },
     getSummaries(param) {
       const { columns, data } = param
@@ -467,7 +391,7 @@ export default {
           return
         }
         const values = data.map(item => Number(item[column.property]))
-        if (column.property === 'costValue') {
+        if (column.property === 'applyCostValue') {
           let count = 0
           sums[index] = values.reduce((prev, curr) => {
             const suffix = (curr + '').split('.')
@@ -486,53 +410,6 @@ export default {
       })
       return sums
     },
-    // 进价或验收数量变动
-    changeCostValue(index, row) {
-      computeVal({
-        frontVal: row.recQty,
-        afterVal: row.cost,
-        operator: '*',
-        scale: 4
-      }).then(res => {
-        this.dataForm.items[index].costValue = res.data
-      })
-    },
-    // 选中辅材添加到表单中
-    selGoods() {
-      this.searchGoods = ''
-      this.$refs.goodsTable.selection.forEach(value => {
-        const index = this.dataForm.items.findIndex(item => {
-          return item.goodsId === value.goodsId
-        })
-        // 添加不在列表的商品
-        if (index < 0) {
-          this.dataForm.items.push({
-            goodsId: value.goodsId,
-            goodsName: value.goodsName,
-            cost: value.cost,
-            ndays: value.ndays,
-            purchaseQty: 0,
-            recQty: 0,
-            measureUnit: value.measureUnit,
-            unitQty: value.unitQty,
-            salesUnit: value.salesUnit,
-            recGiftQty: 0,
-            costValue: 0,
-            productModel: value.productModel,
-            specification: value.specification
-          })
-        }
-      })
-      this.$refs.goodsTable.clearSelection()
-      this.innerVisible = false
-    },
-    // 删除明细
-    delItem(index) {
-      this.dataForm.items.splice(index, 1)
-    },
-    getRowKeys(row) {
-      return row.goodsId
-    },
     // 上传成功回调
     uploadSuccess(res) {
       this.imageLoading = false
@@ -556,9 +433,9 @@ export default {
       this.imageLoading = false
     },
     // 审核 采购入库单
-    confirmSheet(sheetId) {
+    confirmSheet(purchaseId) {
       this.$confirm(
-        `此操作将审核 ${sheetId} 单据,<span style="color: #ff0000;">当前内容如果已修改将忽略保存</span>,是否继续?`,
+        `此操作将审核 ${purchaseId} 单据,<span style="color: #ff0000;">当前内容如果已修改将忽略保存</span>,是否继续?`,
         '提示',
         {
           confirmButtonText: '确定',
@@ -569,11 +446,11 @@ export default {
       )
         .then(() => {
           this.loading = true
-          confirmPurchaseSheet({ sheetId: sheetId }).then(
+          confirmPurchaseSheet({ purchaseId: purchaseId }).then(
             () => {
               setTimeout(() => {
                 this.inputParam.openType = 'view'
-                this.getDetail(sheetId)
+                this.getDetail(purchaseId)
                 this.$successMsg('审核成功')
                 this.loading = false
               }, 2000)

+ 68 - 335
src/views/auxiliaryFittings/shop/purchase-sheet/index.vue

@@ -13,119 +13,58 @@
       >
       </template-page>
     </div>
-    <template v-if="purchaseArea && purchaseAreaParam.openType === 'add'">
-      <el-page-header class="pdt" content="新增采购订单" @back="backUpdPage" />
-      <el-divider />
+    <template v-if="purchaseArea">
+      <div style="box-sizing: border-box; padding: 20px">
+        <el-page-header
+          :content="
+            purchaseAreaParam.openType === 'add'
+              ? '新增采购订单'
+              : purchaseAreaParam.openType === 'view'
+              ? '查看采购订单'
+              : '编辑采购订单'
+          "
+          @back="backUpdPage"
+        />
+        <el-divider />
+        <!-- 新增编辑单据 -->
+        <purchase-area
+          v-if="purchaseArea"
+          :is-open.sync="purchaseArea"
+          :input-param="purchaseAreaParam"
+          @getList="$refs.pageRef.refreshList()"
+        />
+      </div>
     </template>
-    <template v-else-if="purchaseArea && purchaseAreaParam.openType !== 'add'">
-      <el-page-header
-        class="pdt"
-        :content="purchaseAreaParam.openType === 'view' ? '查看采购订单' : '编辑采购订单'"
-        @back="backUpdPage"
-      />
-      <el-divider />
-    </template>
-    <!-- 新增编辑单据 -->
-    <purchase-area
-      v-if="purchaseArea"
-      :is-open.sync="purchaseArea"
-      :input-param="purchaseAreaParam"
-      @getList="$refs.pageRef.refreshList()"
-    />
   </div>
 </template>
 
 <script>
 import {
   confirmPurchaseSheet,
-  unAuditPurchaseSheet,
-  pushPurchaseSheet,
-  delPurchaseSheet,
-  copyPurchaseSheet,
-  getPurchaseSheetList,
   revokePurchaseSheet,
   getNewPurchaseSheetList,
   exportNewPurchaseSheetList
 } from '@/api/material-system/shop/purchase-sheet'
-import { downloadFiles, handleImport } from '@/utils/util'
-import { getToken } from '@/utils/auth'
 import PurchaseArea from '../components/PurchaseArea'
 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: 'PurchaseSheet',
   components: { PurchaseArea, TemplatePage },
-  mixins: [import_mixin],
-
-  filters: {
-    syncFilter(value) {
-      const syncMap = {
-        0: '待处理',
-        1: '待同步',
-        2: '非同步',
-        3: '已同步',
-        99: '取消同步'
-      }
-      return syncMap[value]
-    }
-  },
+  mixins: [import_mixin, operation_mixin],
   data() {
     return {
       purchaseArea: false,
       purchaseAreaParam: {
         openType: 'add',
-        sheetId: ''
+        purchaseId: ''
       },
-      baseURL: process.env.VUE_APP_BASE_API,
-      myHeaders: { 'x-token': getToken() },
-      dataList: null, // 列表数据
       listLoading: false, // 列表加载loading
-      currentPage: 1, // 当前页码
-      pageSize: 10, // 每页数量
-      listTotal: 0, // 列表总数
-      screenForm: {
-        // 筛选表单数据
-        verifyTime: '', // 创建时间
-        flag: '', // 状态
-        keyword: '', // 关键词
-        sheetId: '', // 单据编号
-        shopId: ''
-      },
-      importLoading: false, // 导入加载loading
-      importResult: null, // 导入结果
-      importFileList: [], // 导入列表
-      // 事件组合
-      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.remark}</span>
-                </el-form-item>
-                <el-form-item label="备注">
-                  <span>{row.notes}</span>
-                </el-form-item>
-              </el-form>
-            </div>
-          )
-        }
+        selectColumn: false
       },
       // 表格事件
       tableEvents: {
@@ -134,101 +73,38 @@ export default {
       recordSelected: []
     }
   },
-  created() {
-    // this.$refs.screenForm.resetFields();
-  },
   methods: {
-    // 查询列表
-    // getList() {
-    //   this.listLoading = true;
-
-    //   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
-    //   };
-    //   getPurchaseSheetList(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()
-    },
-    // 重置筛选表单
-    resetScreenForm() {
-      this.currentPage = 1
-      this.$refs.pageRef.refreshList()
-    },
-    // 提交筛选表单
-    submitScreenForm() {
-      this.currentPage = 1
-      this.$refs.pageRef.refreshList()
-    },
     // 新增编辑 采购入库单
     addOrEdit(type, id) {
       this.purchaseArea = true
       this.purchaseAreaParam.openType = type
-      this.purchaseAreaParam.sheetId = id
+      this.purchaseAreaParam.purchaseId = id
     },
     // 删除单据
-    revokeSheet(sheetId) {
-      this.$confirm(`此操作将作废 ${sheetId} 单据, 是否继续?`, '提示', {
+    revokeSheet(purchaseId) {
+      this.$confirm(`此操作将作废 ${purchaseId} 单据, 是否继续?`, '提示', {
         confirmButtonText: '确定',
         cancelButtonText: '取消',
         type: 'warning'
       })
         .then(() => {
-          revokePurchaseSheet({ sheetId: sheetId }).then(() => {
+          revokePurchaseSheet({ purchaseId: purchaseId }).then(() => {
             this.$refs.pageRef.refreshList()
             this.$successMsg('作废成功')
           })
         })
         .catch(() => console.log('取消'))
     },
-    // 删除单据
-    delSheet(sheetId) {
-      this.$confirm(`此操作将删除 ${sheetId} 单据, 是否继续?`, '提示', {
-        confirmButtonText: '确定',
-        cancelButtonText: '取消',
-        type: 'warning'
-      })
-        .then(() => {
-          delPurchaseSheet({ sheetId: sheetId }).then(() => {
-            this.$refs.pageRef.refreshList()
-            this.$successMsg('删除成功')
-          })
-        })
-        .catch(() => console.log('取消'))
-    },
     // 审核 采购入库单
-    confirmSheet(sheetId) {
-      this.$confirm(`此操作将审核 ${sheetId} 单据, 是否继续?`, '提示', {
+    confirmSheet(purchaseId) {
+      this.$confirm(`此操作将审核 ${purchaseId} 单据, 是否继续?`, '提示', {
         confirmButtonText: '确定',
         cancelButtonText: '取消',
         type: 'warning'
       })
         .then(() => {
           this.listLoading = true
-          confirmPurchaseSheet({ sheetId: sheetId }).then(
+          confirmPurchaseSheet({ purchaseId: purchaseId }).then(
             () => {
               setTimeout(() => {
                 this.$refs.pageRef.refreshList()
@@ -243,127 +119,12 @@ export default {
         })
         .catch(() => console.log('取消'))
     },
-
-    // 反审 采购入库单
-    unAuditSheet(sheetId) {
-      this.$confirm(`此操作将反审 ${sheetId} 单据, 是否继续?`, '提示', {
-        confirmButtonText: '确定',
-        cancelButtonText: '取消',
-        type: 'warning'
-      })
-        .then(() => {
-          this.listLoading = true
-          unAuditPurchaseSheet({ sheetId: sheetId }).then(
-            () => {
-              setTimeout(() => {
-                this.$refs.pageRef.refreshList()
-                this.$successMsg('反审成功')
-                this.listLoading = false
-              }, 2000)
-            },
-            () => {
-              this.listLoading = false
-            }
-          )
-        })
-        .catch(() => console.log('取消'))
-    },
-
-    // 下推 采购入库单
-    pushSheet(sheetId) {
-      this.$confirm(`此操作将下推 ${sheetId} 单据, 是否继续?`, '提示', {
-        confirmButtonText: '确定',
-        cancelButtonText: '取消',
-        type: 'warning'
-      })
-        .then(() => {
-          this.listLoading = true
-          pushPurchaseSheet({ sheetId: sheetId }).then(
-            () => {
-              setTimeout(() => {
-                // this.$successMsg('下推成功')
-                this.$confirm(`是否跳转到采购入库单 ${sheetId} 单据,是否继续?`, '下推成功', {
-                  confirmButtonText: '确定',
-                  cancelButtonText: '取消',
-                  type: 'success'
-                })
-                  .then(() => {
-                    this.$router.push({
-                      name: 'purchase-in-stock-sheet',
-                      params: {
-                        sheetId
-                      }
-                    })
-                  })
-                  .catch(() => this.getList())
-                this.listLoading = false
-              }, 2000)
-            },
-            () => {
-              this.listLoading = false
-            }
-          )
-        })
-        .catch(() => console.log('取消'))
-    },
-
-    // 导出
-    exportSheet() {
-      const screenData = {
-        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] : ''
-      }
-      downloadFiles('shop/purchase/export', screenData)
-    },
-    // 下载导入模版
-    handleDownload() {
-      downloadFiles('shop/purchase/template/download')
-    },
-    // 导入
-    async handleImport(param) {
-      this.importLoading = true
-      const file = param.file
-      const formData = new FormData()
-      formData.append('file', file)
-      const result = await handleImport('shop/purchase/import', formData)
-      this.importLoading = false
-      this.importFileList = []
-      if (result.code === 1) {
-        this.$successMsg('导入成功')
-        this.$refs.pageRef.refreshList()
-      } else {
-        await this.$alert(result.message, '导入失败', {
-          confirmButtonText: '确定'
-        })
-      }
-    },
-    // 复制 采购入库单
-    copySheet(sheetId) {
-      copyPurchaseSheet({ sheetId: sheetId }).then(() => {
-        this.$refs.pageRef.refreshList()
-        this.$successMsg('复制成功')
-      })
-    },
-    // 操作事件
-    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.purchaseArea = false
     },
     // 列表请求函数
-    getList(...p) {
-      this.recordSelected = []
-      return getNewPurchaseSheetList(...p)
-    },
+    getList: getNewPurchaseSheetList,
     // 列表导出函数
     exportList: exportNewPurchaseSheetList,
     // 表格列解析渲染数据更改
@@ -374,72 +135,44 @@ export default {
     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 === 2 ? (
-                  <div>
-                    {this.checkBtnRole('edit') ? (
-                      <el-dropdown-item icon="el-icon-edit" command={[row.sheetId, 'edit']}>
-                        编辑
-                      </el-dropdown-item>
-                    ) : null}
 
-                    {this.checkBtnRole('confirm') ? (
-                      <el-dropdown-item icon="el-icon-circle-check" command={[row.sheetId, 'confirm']}>
-                        审核
-                      </el-dropdown-item>
-                    ) : null}
-                    {this.checkBtnRole('revoke') ? (
-                      <el-dropdown-item icon="el-icon-unlock" command={[row.sheetId, 'revoke']}>
-                        作废
-                      </el-dropdown-item>
-                    ) : null}
-                  </div>
-                ) : null}
-                {row.flag === 100 ? (
-                  <div>
-                    {this.checkBtnRole('unAudit') &&
-                    (row.execFlag === 1 || (row.execFlag === 3 && row.kingDeePosition === 1)) ? (
-                      <el-dropdown-item icon="el-icon-circle-check" command={[row.sheetId, 'unAudit']}>
-                        反审
-                      </el-dropdown-item>
-                    ) : null}
-                  </div>
-                ) : null}
-                {this.checkBtnRole('push') && row.execFlag === 3 && row.kingDeePosition === 1 ? (
-                  <el-dropdown-item icon="el-icon-download" command={[row.sheetId, 'push']}>
-                    下推
-                  </el-dropdown-item>
-                ) : null}
-              </el-dropdown-menu>
-            </el-dropdown>
-          </div>
-        )
-      }
+    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)
+          }
+        },
+        confirm: {
+          prompt: '确定审核吗?',
+          conditions: ({ row, index, column }) => {
+            return row.flag === 'SUBMIT' && row.isRecheck === 'ON'
+          },
+          click: ({ row, index, column }) => {
+            this.confirmSheet(row.purchaseId)
+          }
+        },
+        revoke: {
+          prompt: '确定撤消吗?',
+          conditions: ({ row, index, column }) => {
+            return row.flag === 'SUBMIT' && row.isRecheck === 'ON'
+          },
+          click: ({ row, index, column }) => {
+            this.revokeSheet(row.purchaseId)
+          }
+        }
+      })
     }
   }
 }
 </script>
 
-<style scoped>
-.pdt {
-  padding: 20px 20px 0 20px;
-}
-</style>
+<style scoped></style>