|
@@ -0,0 +1,273 @@
|
|
|
+<template>
|
|
|
+
|
|
|
+ <a-card :bordered="false">
|
|
|
+ <a-row :gutter="8">
|
|
|
+ <!-- <a-col :span="5">
|
|
|
+ <a-tree
|
|
|
+ @expand="onExpand"
|
|
|
+ :expandedKeys="expandedKeys"
|
|
|
+ :autoExpandParent="true"
|
|
|
+ @select="onSelect"
|
|
|
+ :selectedKeys="selectedKeys"
|
|
|
+ :treeData="spareTypeTreeData"
|
|
|
+ />
|
|
|
+ </a-col>-->
|
|
|
+ <a-col :span="24">
|
|
|
+ <div class="table-page-search-wrapper">
|
|
|
+ <a-form layout="inline">
|
|
|
+ <a-row :gutter="48">
|
|
|
+ <a-col :md="6" :sm="24">
|
|
|
+ <a-form-item label="存货名称">
|
|
|
+ <a-input v-model.trim="queryParam.name" placeholder="存货名称"/>
|
|
|
+ </a-form-item>
|
|
|
+ </a-col>
|
|
|
+ <a-col :md="6" :sm="24">
|
|
|
+ <a-form-item label="规格型号">
|
|
|
+ <a-input v-model.trim="queryParam.ggxh" placeholder="规格型号"/>
|
|
|
+ </a-form-item>
|
|
|
+ </a-col>
|
|
|
+ <a-col :md="6" :sm="24">
|
|
|
+ <a-form-item label="计量单位">
|
|
|
+ <a-input v-model.trim="queryParam.unit" placeholder="计量单位"/>
|
|
|
+ </a-form-item>
|
|
|
+ </a-col>
|
|
|
+ <a-col :md="6" :sm="24">
|
|
|
+ <a-form-item label="状态">
|
|
|
+ <a-select v-model="queryParam.status">
|
|
|
+ <a-select-option
|
|
|
+ v-for="(label,value) in statusMap"
|
|
|
+ :key="value"
|
|
|
+ :label="label"
|
|
|
+ :value="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>
|
|
|
+ <a-button style="margin-left: 8px" @click="handleAdd">新增</a-button>
|
|
|
+ </span>
|
|
|
+ </a-col>
|
|
|
+ </a-row>
|
|
|
+ </a-form>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class="table-operator" style="margin-bottom: 8px;">
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <s-table
|
|
|
+ ref="table"
|
|
|
+ size="default"
|
|
|
+ rowKey="autoId"
|
|
|
+ :columns="columns"
|
|
|
+ :data="loadData"
|
|
|
+ :alert="options.alert"
|
|
|
+ :customRow="options.customRow"
|
|
|
+ :rowSelection="options.rowSelection"
|
|
|
+ showPagination="auto"
|
|
|
+ >
|
|
|
+ <template #action="record">
|
|
|
+ <a @click="handleView(record)">查看</a>
|
|
|
+ <operation-button
|
|
|
+ v-if="record.status===1||record.status===3"
|
|
|
+ @click="handlePush(record)"
|
|
|
+ >重新推送</operation-button>
|
|
|
+ </template>
|
|
|
+ <template #status="text">
|
|
|
+ <badge :text="BaseTool.Object.getField(statusMap,text)" :status="DictCache.COLOR.ADD_SPARE_STATUS[text]"/>
|
|
|
+ </template>
|
|
|
+ </s-table>
|
|
|
+ </a-col>
|
|
|
+ </a-row>
|
|
|
+ <detail ref="detailModal"/>
|
|
|
+ <AddSpareForm ref="addSpareForm" @ok="handleOk" />
|
|
|
+ </a-card>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+import { STable, Ellipsis } from '@/components'
|
|
|
+import AddSpareForm from './modules/AddSpareForm'
|
|
|
+import Detail from './modules/Detail'
|
|
|
+import { fetchSpareTypeTree } from '@/api/sqarepartmanage/sparetype'
|
|
|
+import { fetchStoreTree } from '@/api/store/store'
|
|
|
+
|
|
|
+import { getSpareAddPage, pushSpareStore } from '@/api/yongyou/yongyou'
|
|
|
+export default {
|
|
|
+ name: 'SpareStoreSelectModalYY',
|
|
|
+ components: {
|
|
|
+ STable,
|
|
|
+ Ellipsis,
|
|
|
+ Detail,
|
|
|
+ AddSpareForm
|
|
|
+ },
|
|
|
+ data () {
|
|
|
+ return {
|
|
|
+ confirmLoading: false,
|
|
|
+ mdl: {},
|
|
|
+ modalTitle: null,
|
|
|
+ visible: false,
|
|
|
+ record: null,
|
|
|
+ spareTypeTreeData: [],
|
|
|
+ expandedKeys: [],
|
|
|
+ selectedKeys: [],
|
|
|
+ isSpecial: null,
|
|
|
+ // 查询参数
|
|
|
+ queryParam: {
|
|
|
+ storeNo: '09'
|
|
|
+ },
|
|
|
+ // 表头
|
|
|
+ columns: [
|
|
|
+ {
|
|
|
+ title: '序号',
|
|
|
+ checked: true,
|
|
|
+ width: '100px',
|
|
|
+ dataIndex: 'index',
|
|
|
+ customRender: (text, record, index) => {
|
|
|
+ return `${(this.$refs.table.localPagination.current - 1) * this.$refs.table.localPagination.pageSize + index + 1}`
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '物料名称',
|
|
|
+ checked: true,
|
|
|
+ width: '100px',
|
|
|
+ dataIndex: 'name'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '规格型号',
|
|
|
+ checked: true,
|
|
|
+ width: '100px',
|
|
|
+ dataIndex: 'ggxh'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '计量单位',
|
|
|
+ checked: true,
|
|
|
+ width: '100px',
|
|
|
+ dataIndex: 'unit',
|
|
|
+ customRender: (text) => {
|
|
|
+ return this.unitMap[text]
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '备注',
|
|
|
+ checked: true,
|
|
|
+ width: '100px',
|
|
|
+ dataIndex: 'remark'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '状态',
|
|
|
+ dataIndex: 'status',
|
|
|
+ width: '100px',
|
|
|
+ fixed: 'right',
|
|
|
+ checked: true,
|
|
|
+ align: 'center',
|
|
|
+ scopedSlots: { customRender: 'status' }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '操作',
|
|
|
+ key: 'action',
|
|
|
+ width: '150px',
|
|
|
+ fixed: 'right',
|
|
|
+ checked: true,
|
|
|
+ align: 'center',
|
|
|
+ scopedSlots: { customRender: 'action' }
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ // 下拉框map
|
|
|
+ tokenType: 1,
|
|
|
+ // 加载数据方法 必须为 Promise 对象
|
|
|
+ loadData: parameter => {
|
|
|
+ parameter = {
|
|
|
+ ...parameter,
|
|
|
+ ...this.queryParam,
|
|
|
+ tokenType: this.tokenType,
|
|
|
+ dataScope: {
|
|
|
+ sortBy: 'desc',
|
|
|
+ sortName: 'update_time'
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return getSpareAddPage(Object.assign(parameter, this.queryParam)).then(res => {
|
|
|
+ if (res.data.rows === null) {
|
|
|
+ const data = { total: 0, rows: [], pageNum: 1, pageSize: 10, pages: 1 }
|
|
|
+ return data
|
|
|
+ } else {
|
|
|
+ return res.data
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ selectedRowKeys: [],
|
|
|
+ selectedRows: [],
|
|
|
+ options: {
|
|
|
+ alert: { show: true, clear: () => { this.selectedRowKeys = [] } },
|
|
|
+ rowSelection: {
|
|
|
+ selectedRowKeys: this.selectedRowKeys,
|
|
|
+ onChange: this.onSelectChange
|
|
|
+ }
|
|
|
+ },
|
|
|
+ optionAlertShow: false,
|
|
|
+ isCreated: false,
|
|
|
+ statusMap: {},
|
|
|
+ unitMap: {}
|
|
|
+ }
|
|
|
+ },
|
|
|
+ created () {
|
|
|
+ // 下拉框map
|
|
|
+ this.statusMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.ADD_SPARE_STATUS)
|
|
|
+ this.unitMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SPARE_ADD_UNIT)
|
|
|
+ // this.tableOption()
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ tableOption () {
|
|
|
+ if (!this.optionAlertShow) {
|
|
|
+ this.options = {
|
|
|
+ alert: { show: true, clear: () => { this.selectedRowKeys = [] } },
|
|
|
+ rowSelection: {
|
|
|
+ selectedRowKeys: this.selectedRowKeys,
|
|
|
+ onChange: this.onSelectChange,
|
|
|
+ type: this.type,
|
|
|
+ getCheckboxProps: record => ({
|
|
|
+ props: {
|
|
|
+ disabled: false,
|
|
|
+ name: record.id
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.optionAlertShow = true
|
|
|
+ } else {
|
|
|
+ this.options = {
|
|
|
+ alert: false,
|
|
|
+ rowSelection: null
|
|
|
+ }
|
|
|
+ this.optionAlertShow = false
|
|
|
+ }
|
|
|
+ },
|
|
|
+ handleOk () {
|
|
|
+ this.$refs.table.refresh()
|
|
|
+ },
|
|
|
+ resetSearchForm () {
|
|
|
+ this.queryParam = {
|
|
|
+ storeNo: '09'
|
|
|
+ }
|
|
|
+ this.$refs.table.refresh(true)
|
|
|
+ },
|
|
|
+ handlePush (record) {
|
|
|
+ pushSpareStore(record).then(res => {
|
|
|
+ this.$message.success('推送成功!')
|
|
|
+ }).catch(() => {
|
|
|
+ this.$message.error('推送失败!')
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
+ handleAdd () {
|
|
|
+ this.$refs.addSpareForm.base()
|
|
|
+ },
|
|
|
+ handleView (record) {
|
|
|
+ const modal = this.$refs.detailModal
|
|
|
+ this.visible = false
|
|
|
+ modal.base(record)
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+</script>
|