whj 1 year ago
parent
commit
a5c2ce7769

+ 2 - 2
src/api/purchase/purchase-order.js

@@ -497,9 +497,9 @@ export function getPurchasePrice (parameter) {
  * @param parameter :
  * @returns {*}
  */
-export function mergePurchase (parameter) {
+export function mergePurchase (title, parameter) {
   return axios({
-    url: `/merge/merge/${parameter.title}`,
+    url: `/merge/merge/${title}`,
     method: 'post',
     data: parameter
   })

+ 354 - 0
src/views/purchase/purchase-marge-page/PurchaseMargePage.vue

@@ -0,0 +1,354 @@
+<template>
+  <a-card :bordered="false">
+    <div v-show="visible">
+      <div class="table-page-search-wrapper" @keyup.enter="handleEnter">
+        <a-form layout="inline">
+          <a-row :gutter="48">
+            <a-col :md="8" :sm="24">
+              <a-form-item label="请购人员">
+                <a-input v-model.trim="queryParam.keyword" placeholder="请输入请购人员"/>
+              </a-form-item>
+            </a-col>
+            <a-col :md="8" :sm="24">
+              <a-form-item label="采购单状态">
+                <a-select v-model="queryParam.status" placeholder="请选择">
+                  <a-select-option
+                    v-for="(label,value) in statusMap"
+                    :key="value"
+                    :label="label"
+                    :value="parseInt(value)">{{ label }}
+                  </a-select-option>
+                </a-select>
+              </a-form-item>
+            </a-col>
+            <a-col :md="8 || 24" :sm="24">
+              <span class="table-page-search-submitButtons">
+                <a-button type="primary" @click="$refs.table.refresh(true)">查询</a-button>
+                <a-button style="margin-left: 8px" @click="resetSearchForm">重置</a-button>
+              </span>
+            </a-col>
+          </a-row>
+        </a-form>
+      </div>
+
+      <div class="table-operator" style="margin-bottom: 8px;">
+        <a-button v-if="$auth('longyanpurchaseorder-menu-add')" type="primary" icon="plus" @click="$refs.baseForm.base()">采购申请</a-button>
+        <!--        <a-button v-if="$auth('purchase-purchase-orders-add')" style="margin-left: 8px" type="primary" icon="plus" @click="$refs.addSpareForm.base()">新增物料</a-button>-->
+        <a-dropdown v-if="selectedRowKeys.length > 0 ">
+          <!-- <a-menu slot="overlay">
+            <a-popconfirm title="是否要删除所选数据?" @confirm="batchDelete()">
+              <a-menu-item key="1"><a-icon type="delete" /><a>删除</a></a-menu-item>
+            </a-popconfirm>
+          </a-menu> -->
+          <a-menu slot="overlay">
+            <a-menu-item key="1" @click="handleMerge"><a-icon type="apartment" />合并</a-menu-item>
+          </a-menu>
+          <a-button style="margin-left: 8px">
+            批量操作 <a-icon type="down" />
+          </a-button>
+        </a-dropdown>
+      </div>
+
+      <s-table
+        ref="table"
+        size="default"
+        rowKey="id"
+        :columns="columns"
+        :scroll="{x: 1, y: BaseTool.Constant.scrollY }"
+        :data="loadData"
+        :alert="options.alert"
+        :rowSelection="options.rowSelection"
+        showPagination="auto"
+      >
+        <span slot="action" slot-scope="record">
+          <a @click="handleView(record)">查看</a>
+          <operation-button
+            v-if="record.status===1"
+            @click="handleEdit(record)"
+          >修改</operation-button>
+          <operation-button
+            v-if=" record.status===1 || record.status === 0"
+            @click="handlePush(record)"
+          >推送</operation-button>
+          <operation-button
+            v-if="record.status>2&&record.status<8"
+            @click="handleViewPurchase(record)"
+          >同步</operation-button>
+          <operation-button
+            v-if=" record.status>=0"
+            :type="2"
+            title="是否要删除该条数据?"
+            @confirm="batchDelete(record.id)">删除</operation-button>
+          <operation-button
+            v-if=" record.status==1||record.status==2"
+            :type="2"
+            title="是否要废弃该条数据?"
+            @confirm="batchWaste(record)">废弃</operation-button>
+        </span>
+        <template #status="text">
+          <badge :text="BaseTool.Object.getField(statusMap,text)" :status="DictCache.COLOR.LONG_YAN_PURCHASE_ORDER_STATUS[text]"/>
+        </template>
+      </s-table>
+    </div>
+    <MargeModal ref="margeModal" @ok="handleOk"/>
+  </a-card>
+</template>
+
+<script>
+import { STable, Ellipsis } from '@/components'
+import { getPurchaseOrderPage2 } from '@/api/purchase/purchase-order'
+import MargeModal from './modules/MargeModal.vue'
+
+export default {
+  name: 'PurchaseOrderPage',
+  components: {
+    STable,
+    Ellipsis,
+    MargeModal
+  },
+  data () {
+    return {
+      // 查询参数
+      queryParam: {
+      },
+      visible: true,
+      user: this.$store.getters.userInfo,
+      dollarExchangeRate: this.$store.getters.rmbRate,
+      cptcodeMap: {},
+      cbustypeMap: {},
+      // 表头
+      columns: [
+        {
+          title: '序号',
+          dataIndex: 'index',
+          checked: true,
+          width: 70,
+          customRender: (text, record, index) => {
+            return `${(this.$refs.table.localPagination.current - 1) * this.$refs.table.localPagination.pageSize + index + 1}`
+          }
+        },
+        {
+          title: '计划类型',
+          dataIndex: 'type',
+          checked: true,
+          width: 100,
+          customRender: (text, record, index) => {
+            return this.BaseTool.Table.getMapText(this.typeMap, text)
+          }
+        },
+        {
+          title: '采购类型',
+          dataIndex: 'cptcode',
+          checked: true,
+          width: 130,
+          customRender: (text, record, index) => {
+            return this.BaseTool.Table.getMapText(this.cptcodeMap, text)
+          }
+        },
+        {
+          title: '业务类型',
+          dataIndex: 'cbustype',
+          checked: true,
+          width: 150,
+          customRender: (text, record, index) => {
+            return this.BaseTool.Table.getMapText(this.cbustypeMap, text)
+          }
+        },
+        {
+          title: '关联设备',
+          dataIndex: 'positionNo',
+          checked: true,
+          width: 150
+        },
+        {
+          title: '采购数量',
+          dataIndex: 'totalNum',
+          checked: true,
+          width: 150
+        },
+        {
+          title: '请购人员',
+          dataIndex: 'createdUserName',
+          checked: true,
+          width: 150
+        },
+        {
+          title: '用友单号',
+          checked: true,
+          width: 100,
+          dataIndex: 'yongYouId'
+        },
+        {
+          title: '需求日期',
+          dataIndex: 'needDate',
+          checked: true,
+          width: 150
+        },
+        {
+          title: '计划到货日期',
+          dataIndex: 'planGetDate',
+          checked: true,
+          width: 150
+        },
+        {
+          title: '申请时间',
+          dataIndex: 'updateTime',
+          checked: true,
+          width: 150
+        },
+        {
+          title: '请购原因',
+          checked: true,
+          width: 100,
+          dataIndex: 'cmemo'
+        },
+        {
+          title: '错误消息',
+          checked: true,
+          width: 100,
+          dataIndex: 'errorMessage'
+        },
+
+        {
+          title: '状态',
+          dataIndex: 'status',
+          width: '100px',
+          fixed: 'right',
+          checked: true,
+          align: 'center',
+          scopedSlots: { customRender: 'status' }
+        },
+        {
+          title: '操作',
+          key: 'action',
+          width: '200px',
+          fixed: 'right',
+          checked: true,
+          align: 'center',
+          scopedSlots: { customRender: 'action' }
+        }
+      ],
+      // 下拉框map
+      typeMap: {},
+      // 加载数据方法 必须为 Promise 对象
+      loadData: parameter => {
+        parameter = {
+          ...parameter,
+          ...this.queryParam,
+          dataScope: {
+            sortBy: 'desc',
+            sortName: 'update_time'
+          }
+        }
+        return getPurchaseOrderPage2(Object.assign(parameter, this.queryParam))
+          .then(res => {
+            return res.data
+          })
+      },
+      selectedRowKeys: [],
+      selectedRows: [],
+      options: {
+        alert: { show: true, clear: () => { this.selectedRowKeys = [] } },
+        rowSelection: {
+          selectedRowKeys: this.selectedRowKeys,
+          onChange: this.onSelectChange
+        }
+      },
+      optionAlertShow: false,
+      statusMap: {}
+    }
+  },
+  created () {
+    // 下拉框map
+    this.typeMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.LONG_YAN_PURCHASE_TYPE)
+    this.statusMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.LONG_YAN_PURCHASE_ORDER_STATUS)
+    this.cptcodeMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.LONG_YAN_PURCHASE_ORDER_PLAN_TYPE)
+    this.cbustypeMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.LONG_YAN_PURCHASE_BUSINESS_TYPE)
+    console.log(this.cptcodeMap)
+    this.tableOption()
+  },
+  methods: {
+    tableOption () {
+      if (!this.optionAlertShow) {
+        this.options = {
+          alert: { show: true, clear: () => { this.selectedRowKeys = [] } },
+          rowSelection: {
+            selectedRowKeys: this.selectedRowKeys,
+            onChange: this.onSelectChange,
+            getCheckboxProps: record => ({
+              props: {
+                disabled: false,
+                name: record.id
+              }
+            })
+          }
+        }
+        this.optionAlertShow = true
+      } else {
+        this.options = {
+          alert: false,
+          rowSelection: null
+        }
+        this.optionAlertShow = false
+      }
+    },
+    onSelectChange (selectedRowKeys, selectedRows) {
+      this.selectedRowKeys = selectedRowKeys
+      this.selectedRows = selectedRows
+    },
+    handleMerge () {
+      this.$refs.margeModal.base(null, this.selectedRows)
+    },
+    handleOk () {
+      this.visible = true
+      this.$refs.table.clearSelected()
+      this.$refs.table.refresh(true)
+    },
+    resetSearchForm () {
+      this.queryParam = {
+      }
+      this.$refs.table.refresh(true)
+    },
+    batchDelete (id) {
+      deletePurchaseOrder2({ id }).then(res => {
+        this.$message.info(res.data)
+        this.handleOk()
+      })
+    },
+    batchWaste (record) {
+      wastePurchaseOrder(record).then(res => {
+        this.$message.info('废弃成功')
+        this.handleOk()
+      })
+    },
+    handleEnter () {
+      this.$refs.table.refresh(true)
+    },
+    handleEdit (record) {
+      getPurchaseOrderInfo(record).then(res => {
+        this.$refs.baseForm.base(res.data)
+      })
+    },
+    handleView (record) {
+      getPurchaseOrderInfo(record).then(res => {
+        this.$refs.detail.base(res.data)
+      })
+    },
+    handlePush (record) {
+      pushPurchaseOrder(record).then(res => {
+        this.$message.info('推送成功')
+        this.handleOk()
+        this.$refs.table.clearSelected()
+      })
+    },
+    handleViewPurchase (record) {
+      getPurchaseOrderList({ yongYouId: record.yongYouId, oldOrNew: record.oldOrNew })
+        .then(res => {
+          this.$message.info('同步成功')
+          this.handleOk()
+          this.$refs.table.clearSelected()
+        })
+    }
+  }
+}
+</script>

+ 1 - 1
src/views/purchase/purchase-order-page/modules/MargeModal.vue

@@ -226,7 +226,7 @@ export default {
             this.confirmLoading = false
           })
         } else {
-          mergePurchase(values).then(res => {
+          mergePurchase(values.title, values.purchaseOrderStr).then(res => {
             this.$message.success('创建成功!')
             this.handleCancel()
           }).catch(() => {