You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

460 lines
15 KiB

<template>
<j-modal
:title="title"
:width="modalWidth"
:visible="visible"
:confirmLoading="confirmLoading"
switchFullscreen
wrapClassName="j-popup-modal"
@ok="handleSubmit"
@cancel="handleCancel"
cancelText="关闭">
<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="物资类型">
<a-input placeholder="请输入物资类型" v-model="queryParam.materialType"></a-input>
</a-form-item>
</a-col>
<a-col :xl="6" :lg="7" :md="8" :sm="24">
<a-form-item label="需求时间">
<j-date placeholder="请选择需求时间" v-model="queryParam.needTime"></j-date>
</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 -->
<!--&lt;!&ndash; 操作按钮区域 &ndash;&gt;
<div class="table-operator">
<a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>
<a-button type="primary" icon="download" @click="handleExportXls('预算计划采购流程')">导出</a-button>
<a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel">
<a-button type="primary" icon="import">导入</a-button>
</a-upload>
&lt;!&ndash; 高级查询区域 &ndash;&gt;
<j-super-query :fieldList="superFieldList" ref="superQueryModal" @handleSuperQuery="handleSuperQuery"></j-super-query>
</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">{{ this.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="pagination"
:loading="loading"
:rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange, type:'radio'}"
:customRow="clickThenSelect"
@change="handleTableChange">
<template slot="htmlSlot" slot-scope="text">
<div v-html="text"></div>
</template>
<template slot="imgSlot" slot-scope="text">
<span v-if="!text" style="font-size: 12px;font-style: italic;">无图片</span>
<img v-else :src="getImgView(text)" height="25px" alt="" style="max-width:80px;font-size: 12px;font-style: italic;"/>
</template>
<template slot="fileSlot" slot-scope="text">
<span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span>
<a-button
v-else
:ghost="true"
type="primary"
icon="download"
size="small"
@click="downloadFile(text)">
下载
</a-button>
</template>
<!-- <template slot="fileOn" slot-scope="text">-->
<!-- <span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span>-->
<!-- <a-button-->
<!-- v-else-->
<!-- :ghost="true"-->
<!-- type="primary"-->
<!-- size="small"-->
<!-- @click="onlineFile(text)">-->
<!-- 预览-->
<!-- </a-button>-->
<!-- </template>-->
<span slot="action" slot-scope="text, record">
<a @click="handleEdit(record)">编辑</a>
<a-divider type="vertical" />
<a-dropdown>
<a class="ant-dropdown-link">更多 <a-icon type="down" /></a>
<a-menu slot="overlay">
<a-menu-item>
<a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
<a>删除</a>
</a-popconfirm>
</a-menu-item>
</a-menu>
</a-dropdown>
</span>
</a-table>
</div>
<a-tabs defaultActiveKey="1">
<a-tab-pane tab="预算计划采购流程物料清单表" key="1" >
<ProcessUdgetPlanMaterialList :mainId="selectedMainId" />
</a-tab-pane>
</a-tabs>
</a-card>
</j-modal>
</template>
<script>
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import { getAction } from '@/api/manage'
import {filterObj} from '@/utils/util'
import ProcessUdgetPlanMaterialList from '../../../views/processmaterials/ProcessUdgetPlanMaterialList'
import JDictSelectTag from '@/components/dict/JDictSelectTag.vue'
import JSuperQuery from '@/components/jeecg/JSuperQuery.vue'
import '@/assets/less/TableExpand.less'
const MODAL_WIDTH = 1200;
export default {
name: 'ProcessPlan',
props: ['multi', 'code', 'groupId', 'param'],
components:{
ProcessUdgetPlanMaterialList,
JSuperQuery,
JDictSelectTag
},
mixins:[JeecgListMixin],
data(){
return {
visible:false,
confirmLoading:false,
title:'预算计划采购流程管理列表',
description: '预算计划采购流程管理页面',
queryParam:{
},
// 表头
columns: [
{
title:'流程发起公司',
align:"center",
dataIndex: 'company_dictText',
},
{
title:'流程发起时间',
align:"center",
dataIndex: 'createTime'
},
{
title:'流程发起部门',
align:"center",
dataIndex: 'sysOrgCode_dictText',
},
{
title:'流程发起人',
align:"center",
dataIndex: 'createBy'
},
{
title:'物资类型',
align:"center",
dataIndex: 'materialType_dictText',
},
{
title:'流程计划',
align:"center",
dataIndex: 'processPlan_dictText',
},
{
title:'需求时间',
align:"center",
dataIndex: 'needTime',
customRender:function (text) {
return !text?"":(text.length>10?text.substr(0,10):text)
}
},
{
title:'顺序号',
align:"center",
dataIndex: 'orderNumber'
},
{
title:'文件id',
align:"center",
dataIndex: 'fileId',
scopedSlots: {customRender: 'fileSlot'}
}
],
url: {
list: "/hy/processUdgetPlan/list",
delete: "/hy/processUdgetPlan/delete",
deleteBatch: "/hy/processUdgetPlan/deleteBatch",
exportXlsUrl: "/hy/processUdgetPlan/exportXls",
importExcelUrl: "hy/processUdgetPlan/importExcel",
},
dictOptions:{
company:[],
sysOrgCode:[],
materialType:[],
processPlan:[],
},
/* 分页参数 */
pagination:{
current: 1,
pageSize: 5,
pageSizeOptions: ['5', '10', '50'],
showTotal: (total, range) => {
return range[0] + "-" + range[1] + " 共" + total + "条"
},
showQuickJumper: true,
showSizeChanger: true,
total: 0
},
selectedMainId:'',
superFieldList:[],
selectedRowKeys:[],
modalWidth:MODAL_WIDTH,
}
},
mounted() {
//this.loadColumnsInfo()
},
/*watch: {
code() {
this.loadData();
},
param:{
deep:true,
handler(){
alert(1)
this.loadData();
},
}
},*/
computed:{
showSearchFlag(){
return this.queryInfo && this.queryInfo.length>0
}
},
methods:{
onClearSelected() {
this.selectedRowKeys = [];
this.selectionRows = [];
this.selectedMainId=''
},
onSelectChange(selectedRowKeys, selectionRows) {
this.selectedMainId=selectedRowKeys[0]
this.selectedRowKeys = selectedRowKeys;
this.selectionRows = selectionRows;
},
loadPlan(arg) {
if(!this.url.list){
this.$message.error("请设置url.list属性!")
return
}
//加载数据 若传入参数1则加载第一页的内容
if (arg === 1) {
this.pagination.current = 1;
}
this.onClearSelected()
var params = this.queryParams();//查询条件
this.loading = true;
getAction(this.url.list, params).then((res) => {
if (res.success) {
this.dataSource = res.result.records;
this.pagination.total = res.result.total;
}
if(res.code===510){
this.$message.warning(res.message)
}
this.loading = false;
})
},
clickThenSelect(record) {
return {
on: {
click: () => {
this.onSelectChange(record.id.split(","), [record]);
}
}
}
},
queryParams() {
let paramTarget = {}
if(this.dynamicParam){
//处理自定义参数
Object.keys(this.dynamicParam).map(key=>{
paramTarget['self_'+key] = this.dynamicParam[key]
})
}
let param = Object.assign(paramTarget, this.queryParam, this.sorter);
param.pageNo = this.pagination.current;
param.pageSize = this.pagination.pageSize;
return filterObj(param);
},
handleChangeInTableSelect(selectedRowKeys, selectionRows) {
//update-begin-author:taoyan date:2020902 for:【issue】开源online的几个问题 LOWCOD-844
if(!selectedRowKeys || selectedRowKeys.length==0){
this.table.selectionRows = []
}else if(selectedRowKeys.length == selectionRows.length){
this.table.selectionRows = selectionRows
}else{
//当两者长度不一的时候 需要判断
let keys = this.table.selectedRowKeys
let rows = this.table.selectionRows;
//这个循环 添加新的记录
for(let i=0;i<selectionRows.length;i++){
let combineKey = this.combineRowKey(selectionRows[i])
if(keys.indexOf(combineKey)<0){
//如果 原来的key 不包含当前记录 push
rows.push(selectionRows[i])
}
}
//这个循环 移除取消选中的数据
this.table.selectionRows = rows.filter(item=>{
let combineKey = this.combineRowKey(item)
return selectedRowKeys.indexOf(combineKey)>=0
})
}
//update-end-author:taoyan date:2020902 for:【issue】开源online的几个问题 LOWCOD-844
this.table.selectedRowKeys = selectedRowKeys
},
handleChangeInTable(pagination, filters, sorter) {
//分页、排序、筛选变化时触发
if (Object.keys(sorter).length > 0) {
this.sorter.column = sorter.field
this.sorter.order = 'ascend' == sorter.order ? 'asc' : 'desc'
}
this.table.pagination = pagination
//this.loadData()
},
handleCancel() {
this.close()
},
handleSubmit() {
if(!this.multi){
if(this.selectionRows && this.selectionRows.length>1){
this.$message.warning("请选择一条记录")
return false
}
}
if(!this.selectionRows || this.selectionRows.length==0){
this.$message.warning("请选择一条记录")
return false
}
console.log(this.selectionRows)
this.$emit('ok', this.selectionRows);
this.close()
},
close() {
this.$emit('close');
this.visible = false;
//this.onClearSelected()
},
show(){
this.visible = true
this.loadPlan(1);
},
handleToggleSearch(){
this.toggleSearchStatus = !this.toggleSearchStatus;
},
searchByquery(){
//this.loadData(1);
},
onlyReload(){
//this.loadData();
},
searchReset(){
Object.keys(this.queryParam).forEach(key=>{
this.queryParam[key]=""
})
//this.loadData(1);
},
/* onClearSelected(){
this.table.selectedRowKeys = []
this.table.selectionRows = []
},*/
combineRowKey(record){
let res = ''
Object.keys(record).forEach(key=>{
res+=record[key]
})
if(res.length>50){
res = res.substring(0,50)
}
return res
},
clickThenCheck(record){
return {
on: {
click: () => {
let rowKey = this.combineRowKey(record)
if(!this.table.selectedRowKeys || this.table.selectedRowKeys.length==0){
let arr1=[],arr2=[]
arr1.push(record)
arr2.push(rowKey)
this.table.selectedRowKeys=arr2
this.table.selectionRows=arr1
}else{
if(this.table.selectedRowKeys.indexOf(rowKey)<0){
this.table.selectedRowKeys.push(rowKey)
this.table.selectionRows.push(record)
}else{
let rowKey_index = this.table.selectedRowKeys.indexOf(rowKey)
this.table.selectedRowKeys.splice(rowKey_index,1);
this.table.selectionRows.splice(rowKey_index,1);
}
}
}
}
}
},
//防止字典中有垃圾数据
initDictOptionData(dictOptions){
alert(1)
let obj = { }
Object.keys(dictOptions).map(k=>{
obj[k] = dictOptions[k].filter(item=>{
return item!=null
});
});
this.dictOptions = obj
}
}
}
</script>
<style scoped>
</style>