parent
a1f4c7ebf1
commit
51b5c0a3df
@ -0,0 +1,167 @@
|
||||
<template>
|
||||
<div>
|
||||
<!-- 发起流程前选择流程 或直接发起流程 -->
|
||||
<Modal :width="70" class-name="oa-modal" title="事前流程" :mask-closable="false" v-model="isShowOaLinkModal"
|
||||
>
|
||||
<div style="width: 100%;height: 100%;padding:10px 40px">
|
||||
<el-button size="small" type="primary" style="margin-bottom:10px" @click="saveNewOa(row)">发起新流程</el-button>
|
||||
<div class="search">
|
||||
<el-input size="small" style="width: 200px;margin-right:10px" v-model="select.keyword"
|
||||
placeholder="请输入关键词"></el-input>
|
||||
<el-button size="small" type="primary" @click="select.page=1,getOaLink()">查询</el-button>
|
||||
</div>
|
||||
<div class="xytable">
|
||||
<xy-table
|
||||
:header-cell-class-name="cellClassName"
|
||||
ref="oaTable" :list="oaList" row-key="id" :table-item="table" :height="300"
|
||||
@select="handleSelectionChange">
|
||||
<template v-slot:btns>
|
||||
<el-table-column :fixed="$store.getters.device === 'mobile'?false:'right'" header-align="center"
|
||||
label="操作" width="80">
|
||||
<template slot-scope="scope">
|
||||
<el-button size="mini" type="primary" @click="toOaDetail(scope.row)">查看</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</template>
|
||||
</xy-table>
|
||||
<div style="display: flex; justify-content: flex-end">
|
||||
<Page :total="total" show-elevator @on-change="pageChange" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<template v-slot:footer>
|
||||
<div>
|
||||
<el-button size="small" type="" style="margin-bottom:10px" @click="cancelOa">取消</el-button>
|
||||
<el-button size="small" type="primary" style="margin-bottom:10px" @click="confirmOa">确定</el-button>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
</Modal>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
oaSelect,
|
||||
oaSave
|
||||
} from "@/api/contract/contract";
|
||||
export default {
|
||||
|
||||
data() {
|
||||
return {
|
||||
isShowOaLinkModal: false,
|
||||
row: {},
|
||||
oaList: [],
|
||||
flow:'', //类型
|
||||
select: {
|
||||
page: 1,
|
||||
page_size: 10,
|
||||
keyword: ''
|
||||
},
|
||||
total: 0,
|
||||
table: [{
|
||||
type: 'selection',
|
||||
align: 'center',
|
||||
width: 58,
|
||||
}, {
|
||||
prop: 'title',
|
||||
label: 'OA流程',
|
||||
align: "left"
|
||||
}]
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
isShowOaLinkModal(newval) {
|
||||
if (newval) {
|
||||
console.log("row", this.row)
|
||||
this.getOaLink()
|
||||
} else {
|
||||
this.row = {}
|
||||
this.oaList = []
|
||||
this.flow = ''
|
||||
console.log("row2", this.row)
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
async getOaLink() {
|
||||
this.$refs.oaTable.clearSelection();
|
||||
const res = await oaSelect({
|
||||
custom_model_id: this.row.flow_mod_id,
|
||||
page: this.select.page,
|
||||
page_size: this.select.page_size,
|
||||
keyword: this.select.keyword
|
||||
})
|
||||
this.oaList = res.flows.data
|
||||
this.total = res.flows.total
|
||||
if (!this.oaList.length && this.select.page == 1) {
|
||||
this.saveNewOa(this.row)
|
||||
}
|
||||
},
|
||||
pageChange(e) {
|
||||
this.select.page = e
|
||||
this.getOaLink()
|
||||
},
|
||||
async saveNewOa(row) {
|
||||
this.$emit('createOa', row,this.flow)
|
||||
this.isShowOaLinkModal = false
|
||||
},
|
||||
confirmOa() {
|
||||
console.log("this.$refs['oaTable'].getSelection()", this.$refs['oaTable'].getSelection());
|
||||
let flowsList = this.$refs['oaTable'].getSelection();
|
||||
if(flowsList.length==0){
|
||||
this.$message.warning('请选择一条流程关联')
|
||||
return
|
||||
}
|
||||
if(flowsList.length>1){
|
||||
this.$message.warning('只能选择一条流程关联')
|
||||
return
|
||||
}
|
||||
|
||||
oaSave({
|
||||
foreign_field:'out_contract_id',
|
||||
foreign_id:this.row.id,
|
||||
flow_id:flowsList[0].id
|
||||
}).then(res=>{
|
||||
this.$message.success('关联成功')
|
||||
this.$emit('refresh')
|
||||
this.isShowOaLinkModal = false
|
||||
})
|
||||
},
|
||||
cancelOa() {
|
||||
this.isShowOaLinkModal = false
|
||||
},
|
||||
// 查看oa流程
|
||||
toOaDetail(row) {
|
||||
this.$emit('oaDetail', row)
|
||||
},
|
||||
cellClassName({row,column,rowIndex,columnIndex}){
|
||||
if(columnIndex===1){
|
||||
return 'allSelect'
|
||||
}
|
||||
|
||||
},
|
||||
handleSelectionChange(selectedRows) {
|
||||
if (selectedRows.length > 1) {
|
||||
// 只保留最新选择的项
|
||||
this.$refs.oaTable.clearSelection();
|
||||
this.$refs.oaTable.toggleRowSelection(selectedRows[selectedRows.length - 1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.oa-modal {
|
||||
.search {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
}
|
||||
::v-deep .allSelect .cell {
|
||||
display: none;
|
||||
}
|
||||
</style>
|
||||
Loading…
Reference in new issue