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.
 
 
 
 
 
 

475 lines
17 KiB

<template>
<div class="app-container">
<!-- Start 列表页面 -->
<div v-show="viewState == 1">
<button-bar view-title="采购渠道选择" ref="btnbar" :btndisabled="btndisabled" @btnhandle="btnHandle"/>
<div class="main-content">
<div class="switch_btn">
<el-button :class="{btn_style:viewState === 1}">待选择</el-button>
<el-button class="" @click="handleClick">已选择</el-button>
</div>
<div class="searchcon">
<el-button size="small" class="searchbtn" @click="clicksearchShow">{{ searchxianshitit }}</el-button>
<div v-show="isSearchShow" class="search">
<el-form ref="listQueryform" :inline="true" :model="listQuery" class="tab-header">
<el-form-item label="销售订单编号">
<el-input v-model="listQuery.params.saleOrderNo" clearable placeholder="" class="addinputw"></el-input>
</el-form-item>
<el-form-item label="销售订单审批日期">
<el-date-picker v-model="listQuery.params.saleOrderApproStartDate" type="date" clearable value-format="yyyy-MM-dd" placeholder="选择日期"/>
<span style="padding: 0 8px">至</span>
<el-date-picker v-model="listQuery.params.saleOrderApproEndDate" type="date" clearable value-format="yyyy-MM-dd" placeholder="选择日期"/>
</el-form-item>
<el-form-item label="业务类型">
<el-input v-model="listQuery.params.businessType" clearable placeholder="" class="addinputw"></el-input>
</el-form-item>
<el-form-item label="申请部门">
<el-select v-model="listQuery.params.applyDeptSid" placeholder="请选择" filterable clearable class="addinputw">
<el-option v-for="item in orgDept_list" :key="item.orgDeptSid" :label="item.orgDeptName" :value="item.orgDeptSid"/>
</el-select>
</el-form-item>
<el-form-item label="申请人">
<el-input v-model="listQuery.params.applyPeoName" clearable placeholder="" class="addinputw"></el-input>
</el-form-item>
<el-form-item label="车型">
<el-input v-model="listQuery.params.modelName" clearable placeholder="" class="addinputw"></el-input>
</el-form-item>
<el-form-item label="配置">
<el-input v-model="listQuery.params.configName" clearable placeholder="" class="addinputw"></el-input>
</el-form-item>
</el-form>
<div class="btn" style="text-align: center;">
<el-button type="primary" icon="el-icon-search" @click="handleFilter" size="small">查询</el-button>
<el-button type="primary" icon="el-icon-refresh" @click="handleReset" size="small">重置</el-button>
</div>
</div>
</div>
<div class="listtop">
<div class="tit">待选择列表</div>
<pageye v-show="list.length > 0" :total="listQuery.total" :page.sync="listQuery.current" :limit.sync="listQuery.size" class="pagination" @pagination="getList"/>
</div>
<div class="">
<el-table :key="tableKey" v-loading="listLoading" :data="list" border style="width: 100%;" @selection-change="handleSelectionChange">
<el-table-column fixed width="50" type="selection" align="center"/>
<el-table-column fixed width="60" label="序号" type="index" :index="indexMethod" align="center"/>
<el-table-column label="销售订单编号" align="center" width="150">
<template slot-scope="scope">
<span class="bluezi" @click="lookSale(scope.row)">{{ scope.row.saleOrderNo }}</span>
</template>
</el-table-column>
<el-table-column label="销售订单审批日期" align="center" width="150">
<template slot-scope="scope">
<span>{{ scope.row.saleOrderApproDate }}</span>
</template>
</el-table-column>
<el-table-column label="业务类型" align="center" width="120">
<template slot-scope="scope">
<span>{{ scope.row.businessType }}</span>
</template>
</el-table-column>
<el-table-column label="申请部门" align="center" width="150">
<template slot-scope="scope">
<span>{{ scope.row.applyDeptName }}</span>
</template>
</el-table-column>
<el-table-column label="申请人" align="center" width="120">
<template slot-scope="scope">
<span>{{ scope.row.applyPeoName }}</span>
</template>
</el-table-column>
<el-table-column label="车型" align="center">
<template slot-scope="scope">
<span class="bluezi" @click="lookPeiZhi(scope.row)">{{ scope.row.modelName }}</span>
</template>
</el-table-column>
<el-table-column label="配置简述" align="center">
<template slot-scope="scope">
<span>{{ scope.row.configName }}</span>
</template>
</el-table-column>
<el-table-column label="数量" align="center" width="80">
<template slot-scope="scope">
<span>{{ scope.row.num }}</span>
</template>
</el-table-column>
<el-table-column label="审批记录" align="center" width="100">
<template slot-scope="scope">
<span @click="flowRecord(scope.row)" class="bluezi">查看</span>
</template>
</el-table-column>
</el-table>
</div>
<div class="pages">
<!-- 翻页 -->
<pagination v-show="list.length > 0" :total="listQuery.total" :page.sync="listQuery.current" :limit.sync="listQuery.size" class="pagination" @pagination="getList"/>
</div>
</div>
</div>
<!-- End 列表页面 -->
<!-- 已选择列表 -->
<caigouqudaoselected v-show="viewState == 2" ref="divSelect" @doback="resetState"/>
<!-- 查看销售订单 -->
<saleOrder v-show="viewState == 3" ref="divSale" @doback="resetState"/>
<!-- 查看车型配置标准页面 -->
<vehicleconfiguration v-show="viewState == 4" ref="divPeizhi" @doback="resetState"/>
<!-- 选择采购渠道 -->
<el-dialog :visible.sync="dialogVisible" width="50%">
<el-form ref="form_obj" :model="formobj" class="formaddcopy02">
<el-row style="border-top: 1px solid #E0E3EB">
<el-col :span="24">
<div class="span-sty">采购渠道</div>
<el-form-item>
<el-select class="addinputInfo" v-model="formobj.purchaseOrderTypeValue" placeholder="请选择" filterable clearable @change="changePurchaseOrderType">
<el-option v-for="item in purchaseOrderType_list" :disabled="item.dictValue == '挂车' || item.dictValue == '内购'" :key="item.dictKey" :label="item.dictValue" :value="item.dictValue"/>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<div class="span-sty">采购系统</div>
<el-form-item>
<el-select class="addinputInfo" v-model="formobj.purchaseSystemName" placeholder="请选择" @change="changeOrgDept" clearable filterable>
<el-option v-for="item in purchaseSystem_list" :key="item.deptSid" :label="item.purchaseSystemName" :value="item.purchaseSystemName"></el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="handleConfirm">确定</el-button>
<el-button @click="handleQuXiao">取消</el-button>
</span>
</el-dialog>
<el-dialog title="" :visible.sync="centerDialogVisible" width="78%" height="1%" :before-close="closeIt" center>
<iframe frameborder="0" id="iframe" style="width:100%;" scrolling="no" :src="this.centerDialogVisible === true ? url :''"></iframe>
</el-dialog>
</div>
</template>
<script>
import req from '@/api/purchasingchannels/purchasingchannels'
import { getOrgSidByPath, selectOrgLists, typeValues, fetchDetailsByUseOrgSid } from '@/api/cheliang/dictcommons'
import Pagination from '@/components/pagination'
import pageye from '@/components/pagination/pageye'
import ButtonBar from '@/components/ButtonBar'
import caigouqudaoselected from './caigouqudaoselected'
import saleOrder from '@/components/publicPage/saleOrder'
import vehicleconfiguration from '@/views/cheliang/cheliangtaizhang/relation/vehicleconfiguration'
import { getStorage } from '@/utils/auth'
export default {
name: 'caigouqudaotobeselected',
components: {
Pagination,
pageye,
ButtonBar,
caigouqudaoselected,
saleOrder,
vehicleconfiguration
},
data() {
return {
url: '',
dialogHeight: '80%',
centerDialogVisible: false,
viewState: 1,
dialogVisible: false,
btndisabled: false,
btnList: [
{
type: 'primary',
size: 'small',
icon: '',
btnKey: 'tobeSelect',
btnLabel: '选择'
},
{
type: 'info',
size: 'small',
icon: 'cross',
btnKey: 'doClose',
btnLabel: '关闭'
}
],
isSearchShow: false,
searchxianshitit: '显示查询条件',
// 查询条件 -----------
tableKey: 0,
list: [],
sids: [],
orgDept_list: [],
purchaseOrderType_list: [],
purchaseSystem_list: [],
FormLoading: false,
listLoading: false,
formobj: {
purchaseOrderTypeValue: '',
purchaseOrderTypeKey: '',
purchaseSystemName: '',
purchaseSystemSid: ''
},
listQuery: {
params: {
applyDeptSid: '',
applyPeoName: '',
businessType: '',
configName: '',
modelName: '',
saleOrderApproEndDate: '',
saleOrderApproStartDate: '',
saleOrderNo: '',
state: '1',
useOrgSid: ''
},
current: 1,
size: 10,
total: 0
},
rules: {}
}
},
created() {
// 初始化变量
this.init()
},
mounted() {
// 在外部vue的window上添加postMessage的监听,而且绑定处理函数handleMessage
window.addEventListener('message', this.handleMessage)
this.$refs['btnbar'].setButtonList(this.btnList)
},
methods: {
async handleMessage(event) {
var code = ''
if (event.data.params !== null && event.data.params !== undefined) {
code = event.data.params.code
}
if (code === 1) {
this.init()
this.centerDialogVisible = false
} else if (code === 2) {
this.dialogHeight = event.data.params.data
this.setIframeHeight(document.getElementById('iframe'))
}
},
closeIt() {
this.url = ''
this.centerDialogVisible = false
},
setIframeHeight(iframe) {
iframe.height = this.dialogHeight
},
flowRecord(row) {
this.centerDialogVisible = true
var params = {
deployId: row.procDefId,
procInsId: row.procInstId,
token: getStorage()
}
this.url = '/#/flow/flowRecordForBusiness?data=' + encodeURI((JSON.stringify(params)))
},
// 搜索条件效果
clicksearchShow() {
this.isSearchShow = !this.isSearchShow
if (this.isSearchShow) {
this.searchxianshitit = '隐藏查询条件'
} else {
this.searchxianshitit = '显示查询条件'
}
},
btnHandle(btnKey) {
console.log('XXXXXXXXXXXXXXX ' + btnKey)
switch (btnKey) {
case 'tobeSelect':
this.tobeSelect()
break
case 'doClose':
this.doClose()
break
default:
break
}
},
init() {
typeValues({ type: 'purchaseOrderType' }).then((resp) => {
if (resp.success) {
this.purchaseOrderType_list = resp.data
}
})
selectOrgLists({ userSid: window.sessionStorage.getItem('userSid') }).then((res) => {
if (res.success) {
this.orgDept_list = res.data
}
})
getOrgSidByPath({ orgPath: window.sessionStorage.getItem('defaultOrgPath') }).then((res) => {
if (res.success) {
this.listQuery.params.useOrgSid = res.data
fetchDetailsByUseOrgSid(res.data).then((res) => {
if (res.success) {
this.purchaseSystem_list = res.data
}
})
// 加载列表
this.getList()
}
})
},
// 序号
indexMethod(index) {
var pagestart = (this.listQuery.current - 1) * this.listQuery.size
var pageindex = index + 1 + pagestart
return pageindex
},
handleSelectionChange(row) {
const aa = []
row.forEach((element) => {
aa.push({
sid: element.sid,
userSid: window.sessionStorage.getItem('userSid'),
orgSidPath: window.sessionStorage.getItem('defaultOrgPath'),
purchaseOrderTypeKey: '',
purchaseOrderTypeValue: '',
purchaseSystemSid: '',
purchaseSystemName: ''
})
})
this.sids = aa
},
// 查询列表信息
getList() {
this.listLoading = true
this.listQuery.params.state = '1'
req.listPage(this.listQuery).then((response) => {
console.log('列表查询结果:', response)
this.listLoading = false
if (response.success) {
this.list = response.data.records
this.listQuery.total = response.data.total
} else {
this.list = []
this.listQuery.total = 0
}
})
},
tobeSelect() {
if (this.sids.length === 1) {
this.dialogVisible = true
} else {
this.$message({ showClose: true, type: 'error', message: '请选择一条记录进行操作' })
return
}
},
changeOrgDept(value) {
const choose = this.purchaseSystem_list.filter((item) => item.purchaseSystemName === value)
this.formobj.purchaseSystemSid = choose[0].deptSid
},
changePurchaseOrderType(value) {
const choose = this.purchaseOrderType_list.filter((item) => item.dictValue === value)
this.formobj.purchaseOrderTypeKey = choose[0].dictKey
},
handleConfirm() {
if (this.formobj.purchaseOrderTypeValue === '') {
this.$message({ showClose: true, type: 'error', message: '采购渠道不能为空' })
return
}
if (this.formobj.purchaseSystemName === '') {
this.$message({ showClose: true, type: 'error', message: '采购系统不能为空' })
return
}
for (var i = 0; i < this.sids.length; i++) {
this.sids[i].purchaseOrderTypeValue = this.formobj.purchaseOrderTypeValue
this.sids[i].purchaseOrderTypeKey = this.formobj.purchaseOrderTypeKey
this.sids[i].purchaseSystemName = this.formobj.purchaseSystemName
this.sids[i].purchaseSystemSid = this.formobj.purchaseSystemSid
}
const tip = '请确认采购渠道以及采购系统是否选择正确'
this.$confirm(tip, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
req.choice(this.sids).then((res) => {
if (res.success) {
this.$message({ showClose: true, type: 'success', message: '操作成功' })
this.handleQuXiao()
this.getList()
}
})
})
},
handleQuXiao() {
this.formobj = {
purchaseOrderTypeValue: '',
purchaseOrderTypeKey: '',
purchaseSystemName: '',
purchaseSystemSid: ''
}
this.dialogVisible = false
},
handleClick() {
this.viewState = 2
this.$refs['divSelect'].init()
},
// 查询按钮
handleFilter() {
this.listQuery.current = 1
this.init()
},
handleReset() {
this.listQuery = {
params: {
applyDeptSid: '',
applyPeoName: '',
businessType: '',
configName: '',
modelName: '',
saleOrderApproEndDate: '',
saleOrderApproStartDate: '',
saleOrderNo: '',
state: '1',
useOrgSid: ''
},
current: 1,
size: 10,
total: 0
}
this.init()
},
lookSale(row) {
this.viewState = 3
this.$refs['divSale'].showInfo({ sid: row.saleOrderSid })
},
lookPeiZhi(row) {
this.viewState = 4
const aa = {
modelSid: row.modelSid,
modelConfigSid: row.configSid,
vehModelConfigSid: row.modelConfigSid,
guidedPrice: row.guidedPrice
}
this.$refs['divPeizhi'].showInfo(aa)
},
resetState() {
this.viewState = 1
},
doClose() {
this.$store.dispatch('tagsView/delView', this.$route)
this.$router.go(-1)
}
}
}
</script>
<style scoped>
.btn_style {
background-color: #018ad2;
color: white;
font-weight: 600;
}
.span-sty {
width: 130px !important;
}
.addinputInfo {
margin-left: 120px !important;
}
</style>