| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260 |
- <template>
- <a-card :bordered="false">
- <a-row :gutter="8" v-show="visible">
- <a-col :span="24">
- <div class="table-page-search-wrapper">
- <a-form layout="inline">
- <a-row :gutter="48">
- <a-col :md="8" :sm="24">
- <a-form-item label="关键字">
- <a-input v-model="queryParam.keyword" placeholder="请输入名称/编码" />
- </a-form-item>
- </a-col>
- <a-col :md="8" :sm="24">
- <a-form-item label="品牌">
- <a-input v-model="queryParam.brand" placeholder="模糊查询" />
- </a-form-item>
- </a-col>
- <a-col :md="8" :sm="24">
- <a-form-item label="类型">
- <a-tree-select style="width: 100%" :dropdownStyle="{ maxHeight: '400px', overflow: 'auto' }" :treeData="spareTypeTreeData" :treeNodeFilterProp="'title'" :showSearch="true" v-model="queryParam.typeId" placeholder="请选择">
- </a-tree-select>
- </a-form-item>
- </a-col>
- <a-col :md="8" :sm="24">
- <a-form-item label="规格型号">
- <a-input v-model="queryParam.ggxh" placeholder="模糊查询" />
- </a-form-item>
- </a-col>
- <a-col :md="8" :sm="24">
- <a-form-item label="等级">
- <a-select v-model="queryParam.levelList" mode="multiple" placeholder="请选择">
- <a-select-option v-for="(label,value) in levelMap" :key="value" :label="label" :value="parseInt(value)">{{ label }}
- </a-select-option>
- </a-select>
- </a-form-item>
- </a-col>
- <a-col :md="6 || 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="searchTypeNull">空类型</a-button>
- </span>
- </a-col>
- </a-row>
- </a-form>
- </div>
- <div class="table-operator">
- <a-button type="primary" icon="plus" @click="handleAdd">更多仓库关联</a-button>
- </div>
- <s-table ref="table" size="default" rowKey="id" :columns="columns" :data="loadData" :scroll="{x: 1500, y: BaseTool.Constant.scrollY}" :alert="options.alert" :rowSelection="options.rowSelection" showPagination="auto">
- <span slot="action" slot-scope="record">
- <template>
- <!-- <a @click="handleView(record)">查看</a>-->
- <a v-if="record.storeId === null || record.storeId === ''" @click="handleRelation(record)">关联仓库</a>
- </template>
- </span>
- </s-table>
- </a-col>
- </a-row>
- <BaseForm ref="baseModal" @ok="handleOk" />
- </a-card>
- </template>
- <script>
- import { STable, Ellipsis } from '@/components'
- import BaseForm from './modules/BaseForm.vue'
- import { getSpareBomPage } from '@/api/sqarepartmanage/sparepartinfo'
- import { fetchSpareTypeTree } from '@/api/sqarepartmanage/sparetype'
- export default {
- name: 'SpareStoreBom',
- components: {
- STable,
- Ellipsis,
- BaseForm,
- },
- data() {
- return {
- // 查询参数
- queryParam: {},
- confirmLoading: false,
- // 表头
- columns: [
- {
- title: '序号',
- width: '100px',
- dataIndex: 'index',
- checked: true,
- customRender: (text, record, index) => {
- return `${
- (this.$refs.table.localPagination.current - 1) * this.$refs.table.localPagination.pageSize + index + 1
- }`
- },
- },
- {
- title: '备件编码',
- width: '150px',
- checked: true,
- dataIndex: 'no',
- },
- {
- title: '备件名称',
- width: '150px',
- checked: true,
- dataIndex: 'name',
- },
- {
- title: '备件类别',
- dataIndex: 'typeName',
- checked: true,
- width: '150px',
- },
- {
- title: '品牌',
- width: '150px',
- checked: true,
- dataIndex: 'brand',
- },
- {
- title: '规格型号',
- width: '150px',
- checked: true,
- dataIndex: 'ggxh',
- },
- {
- title: '等级',
- checked: true,
- width: '150px',
- dataIndex: 'level',
- customRender: (text, record, index) => {
- return this.BaseTool.Object.getField(this.levelMap, text)
- },
- },
- {
- title: '备件价值',
- width: '150px',
- checked: true,
- dataIndex: 'initialValue',
- },
- {
- title: '操作',
- checked: true,
- width: '120',
- fixed: 'right',
- key: 'action',
- align: 'center',
- scopedSlots: { customRender: 'action' },
- },
- ],
- // 加载数据方法 必须为 Promise 对象
- loadData: (parameter) => {
- parameter = {
- ...parameter,
- ...this.queryParam,
- bomFlag: 0,
- dataScope: {
- sortBy: 'desc',
- sortName: 'info.created_time',
- },
- }
- return getSpareBomPage(Object.assign(parameter, this.queryParam)).then((res) => {
- return res.data
- })
- },
- selectedRowKeys: [],
- selectedRows: [],
- expandedKeys: [],
- selectedKeys: [],
- levelMap: {},
- id: null,
- visible: true,
- spareTypeTreeData: [],
- options: {
- alert: {
- show: true,
- clear: () => {
- this.selectedRowKeys = []
- },
- },
- rowSelection: {
- selectedRowKeys: this.selectedRowKeys,
- onChange: this.onSelectChange,
- },
- },
- optionAlertShow: false,
- }
- },
- created() {
- // 下拉框map
- this.levelMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SPARE_PART_INFO_LEVEL)
- this.tableOption()
- fetchSpareTypeTree({}).then((res) => {
- this.spareTypeTreeData = res.data
- })
- },
- 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
- }
- },
- handleAdd () {
- this.$refs.baseModal.base()
- },
- handleRelation(record) {
- this.$refs.baseModal.base(record)
- },
- handleOk() {
- this.visible = true
- this.$refs.table.refresh()
- },
- onSelectChange(selectedRowKeys, selectedRows) {
- this.selectedRowKeys = selectedRowKeys
- this.selectedRows = selectedRows
- },
- resetSearchForm() {
- this.queryParam = {}
- this.$refs.table.refresh(true)
- },
- onSelect: function (selectedKeys, info) {
- this.selectedKeys = selectedKeys
- this.queryParam.typeId = selectedKeys.length > 0 ? selectedKeys[0] : ''
- this.$refs.table.refresh(true)
- },
- onExpand(expandedKeys) {
- this.expandedKeys = expandedKeys
- this.autoExpandParent = false
- },
- searchTypeNull() {
- this.queryParam.searchType = true
- this.$refs.table.refresh(true)
- },
- },
- }
- </script>
|