123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334 |
- <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 || 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-action:edit v-if="selectedRowKeys.length > 0 && $auth('purchase-purchase-orders-del')">
- <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-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>
- <BaseForm ref="baseForm" @ok="handleOk"/>
- <Detail ref="detail" @ok="handleOk"/>
- <AddSpareForm ref="addSpareForm" />
- </a-card>
- </template>
- <script>
- import { STable, Ellipsis } from '@/components'
- import { getPurchaseOrderPage2, deletePurchaseOrder2, getPurchaseOrderInfo, pushPurchaseOrder, wastePurchaseOrder, getPurchaseOrderList } from '@/api/purchase/purchase-order'
- import BaseForm from './modules/BaseForm.vue'
- import Detail from './modules/Detail.vue'
- import AddSpareForm from '@/views/store/sparestore/modules/AddSpareForm'
- export default {
- name: 'PurchaseOrderPage',
- components: {
- STable,
- Ellipsis,
- BaseForm,
- AddSpareForm,
- Detail
- },
- 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: 'remark'
- },
- {
- 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
- }
- },
- 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,
- getCheckboxProps: record => ({
- props: {
- disabled: false,
- name: record.id
- }
- })
- }
- }
- this.optionAlertShow = true
- } else {
- this.options = {
- alert: false,
- rowSelection: null
- }
- this.optionAlertShow = false
- }
- },
- handleOk () {
- this.visible = true
- this.$refs.table.refresh()
- },
- resetSearchForm () {
- this.queryParam = {
- }
- this.$refs.table.refresh(true)
- },
- batchDelete (id) {
- deletePurchaseOrder2({ id }).then(res => {
- this.$message.info('删除成功')
- 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>
|