zhangherong
2025-05-27 5e31103125cb1ff33be29ec400c9c8d007448462
src/views/tms/stocktakingBound/ToolsStocktakingBoundList.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,322 @@
<template>
  <a-card :bordered="false">
    <!-- æŸ¥è¯¢åŒºåŸŸ -->
    <div class="table-page-search-wrapper">
      <a-form layout="inline" @keyup.enter.native="searchQuery">
        <a-row :gutter="24">
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <a-form-item label="盘点单号">
              <j-input placeholder="请输入盘点单号" v-model="queryParam.orderCode"></j-input>
            </a-form-item>
          </a-col>
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <a-form-item label="经手人">
              <j-dict-select-tag dictCode="sys_user,realname,id" placeholder="请选择经手人" v-model="queryParam.handler"
                                  />
            </a-form-item>
          </a-col>
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
              <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
              <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
              <a @click="handleToggleSearch" style="margin-left: 8px">
                {{ toggleSearchStatus ? '收起' : '展开' }}
                <a-icon :type="toggleSearchStatus ? 'up' : 'down'"/>
              </a>
            </span>
          </a-col>
        </a-row>
      </a-form>
    </div>
    <!-- æŸ¥è¯¢åŒºåŸŸ-END -->
    <!-- æ“ä½œæŒ‰é’®åŒºåŸŸ -->
    <div class="table-operator">
      <a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>
<!--      <a-dropdown v-if="selectedRowKeys.length > 0">-->
<!--        <a-menu slot="overlay">-->
<!--          <a-menu-item key="1" @click="batchDel"><a-icon type="delete"/>删除</a-menu-item>-->
<!--        </a-menu>-->
<!--        <a-button style="margin-left: 8px"> æ‰¹é‡æ“ä½œ <a-icon type="down" /></a-button>-->
<!--      </a-dropdown>-->
    </div>
    <!-- table区域-begin -->
    <div>
      <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
        <i class="anticon anticon-info-circle ant-alert-icon"></i> å·²é€‰æ‹© <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>项
        <a style="margin-left: 24px" @click="onClearSelected">清空</a>
      </div>
      <a-table
        ref="table"
        size="middle"
        bordered
        rowKey="id"
        class="j-table-force-nowrap"
        :scroll="{x:true}"
        :columns="columns"
        :dataSource="dataSource"
        :pagination="ipagination"
        :loading="loading"
        :rowSelection='{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }' :customRow='clickThenSelect'
        @change="handleTabChange">
        <span slot="action" slot-scope="text, record">
          <a @click="handleDetail(record)">详情</a>
          <span v-if="record.approvalStatus === '1'">
            <a-divider type="vertical" />
            <a-popconfirm title="确定提交吗?" @confirm="() => handleSubmit(record)">
              <a>提交</a>
            </a-popconfirm>
            <a-divider type="vertical" />
            <a-dropdown>
              <a class="ant-dropdown-link">更多<a-icon type="down" /></a>
              <a-menu slot="overlay">
                <a-menu-item>
                  <a @click="handleEdit(record)">编辑</a>
                </a-menu-item>
                <a-menu-item>
                  <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
                    <a>删除</a>
                  </a-popconfirm>
                </a-menu-item>
              </a-menu>
            </a-dropdown>
          </span>
        </span>
      </a-table>
      <a-tabs defaultActiveKey="1">
        <!-- type="card" -->
        <a-tab-pane tab='盘点单明细' key="1">
          <div class="table-operator" style="margin:-16px">
            <tools-stockta-king-bound-detail ref="toolStockingBoundDetail"  :mainId='mainId' />
          </div>
        </a-tab-pane>
      </a-tabs>
    </div>
    <tools-stocktaking-bound-modal
      ref="modalForm"
      @ok="modalFormOk"
    ></tools-stocktaking-bound-modal>
  </a-card>
</template>
<script>
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import ToolsStocktaKingBoundDetail from './ToolsStocktaKingBoundDetail.vue'
import ToolsStocktakingBoundModal from './modules/ToolsStocktakingBoundModal'
import '@/assets/less/TableExpand.less'
import { deleteAction, getAction } from '@api/manage'
export default {
    name: "ToolsStocktakingBoundList",
    mixins:[JeecgListMixin],
    components: {
      ToolsStocktakingBoundModal,
      ToolsStocktaKingBoundDetail
    },
    data () {
      return {
        description: '盘点单表管理页面',
        // è¡¨å¤´
        columns: [
          {
            title: '#',
            dataIndex: '',
            key:'rowIndex',
            width:60,
            align:"center",
            customRender:function (t,r,index) {
              return parseInt(index)+1;
            }
          },
          {
            title:'盘点单号',
            align:"center",
            dataIndex: 'orderCode'
          },
          {
            title:'经手人',
            align:"center",
            dataIndex: 'handler_dictText'
          },
          {
            title:'审核人',
            align:"center",
            dataIndex: 'reviewer_dictText'
          },
          {
            title:'盘点名称',
            align:"center",
            dataIndex: 'stocktakingName'
          },
          {
            title:'备注',
            align:"center",
            dataIndex: 'remark'
          },
          {
            title:'审核状态',
            align:"center",
            dataIndex: 'approvalStatus_dictText'
          },
          {
            title:'审核意见',
            align:"center",
            dataIndex: 'approvalOpinion'
          },
          {
            title:'盘点时间',
            align:"center",
            dataIndex: 'inventoryTime'
          },
          {
            title: '操作',
            dataIndex: 'action',
            align:"center",
            fixed:"right",
            width:147,
            scopedSlots: { customRender: 'action' },
          }
        ],
        url: {
          list: "/tms/toolsStocktakingBound/list",
          submit:"/tms/toolsStocktakingBound/submit",
          delete: "/tms/toolsStocktakingBound/delete",
          deleteBatch: "/tms/toolsStocktakingBound/deleteBatch",
          exportXlsUrl: "/tms/toolsStocktakingBound/exportXls",
          importExcelUrl: "tms/toolsStocktakingBound/importExcel",
        },
        dictOptions:{},
        mainId: '',
        superFieldList:[],
        selectedMainId: '',
      }
    },
    created() {
    },
    computed: {
      importExcelUrl: function(){
        return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
      }
    },
    methods: {
      clickThenSelect(record) {
        return {
          on: {
            click: () => {
              this.onSelectChange(record.id.split(','), [record])
            }
          }
        }
      },
      onClearSelected() {
        this.selectedRowKeys = []
        this.selectionRows = []
        this.selectedMainId = ''
      },
      onSelectChange(selectedRowKeys, selectionRows) {
        if (selectedRowKeys.length == 1) {
          this.mainId = selectionRows[0]['id']
        } else {
          this.mainId = ''
        }
        this.selectedRowKeys = selectedRowKeys
        this.selectionRows = selectionRows
      },
      handleTabChange(pagination, filters, sorter) {
        this.selectedRowKeys = []
        this.$refs.toolStockingBoundDetail.dataSource = []
        this.handleTableChange(pagination, filters, sorter)
      },
      handleDelete: function (id) {
        if (!this.url.delete) {
          this.$message.error('请设置url.delete属性!')
          return
        }
        deleteAction(this.url.delete, { id: id }).then((res) => {
          if (res.success) {
            //重新计算分页问题
            this.reCalculatePage(1)
            this.$message.success(res.message)
            this.$refs.toolStockingBoundDetail.dataSource = []
            this.loadData()
          } else {
            this.$message.warning(res.message)
          }
        })
      },
      handleSubmit(record) {
        getAction(this.url.submit,{ id: record.id }).then((res)=>{
          if (res.success) {
            this.$message.success(res.message);
            this.loadData();
            this.$refs.toolStockingBoundDetail.clearList()
          } else {
            this.$message.warning(res.message);
          }
        })
      },
      searchQuery() {
        this.selectedRowKeys = [];
        this.$refs.toolStockingBoundDetail.loadData();
        this.$refs.toolStockingBoundDetail.selectedRowKeys = [];
        this.loadData();
      },
      searchReset() {
        this.queryParam = {}
        this.selectedRowKeys = []
        this.$refs.toolStockingBoundDetail.dataSource = []
        this.loadData();
      },
      modalFormOk() {
        this.queryParam = {}
        this.selectedRowKeys = []
        this.$refs.toolStockingBoundDetail.dataSource = []
        this.loadData();
      },
      handleEdit: function (record) {
        console.log('record:', record)
        this.$refs.modalForm.title = '编辑'
        this.$refs.modalForm.disableSubmit = false
        this.$refs.modalForm.edit(record)
      },
      handleDetail:function(record){
        this.$refs.modalForm.title="详情";
        this.$refs.modalForm.disableSubmit = true;
        this.$refs.modalForm.edit(record);
      },
      handleAdd: function () {
        this.$refs.modalForm.disableSubmit = false
        this.$refs.modalForm.title = "新增工具申请单";
        this.$refs.modalForm.add();
        console.log(this.$refs.modalForm.title);
      },
      initDictConfig(){
      },
    }
  }
</script>
<style scoped>
  @import '~@assets/less/common.less';
</style>