first commit
This commit is contained in:
@@ -0,0 +1,422 @@
|
||||
<!--#
|
||||
layout("/layouts/platform.html"){
|
||||
#-->
|
||||
|
||||
<style>
|
||||
.audit-userids-select .el-select__tags {
|
||||
flex-wrap: unset;
|
||||
overflow: auto;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div id="app" v-cloak>
|
||||
<guava ref="guava">
|
||||
<el-card shadow="never">
|
||||
<table-tool :app="this" label="类型列表">
|
||||
<template #func>
|
||||
<el-button @click="openAdd" size="small" type="primary">新增类型</el-button>
|
||||
</template>
|
||||
</table-tool>
|
||||
<el-table :data="tableData" :size="tableSize"
|
||||
@sort-change="pageOrder" class="vi-table"
|
||||
row-key="id" style="width: 100%">
|
||||
|
||||
<el-table-column align="center" header-align="center" label="序号" type="index"
|
||||
width="80px"></el-table-column>
|
||||
|
||||
<el-table-column
|
||||
:label="column.label"
|
||||
:prop="column.prop"
|
||||
:sortable="column.sortable"
|
||||
:width="column.width"
|
||||
align="center"
|
||||
header-align="center"
|
||||
min-width="50"
|
||||
show-overflow-tooltip
|
||||
v-for="column in tableColumns"
|
||||
>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column label="操作">
|
||||
<template scope="{row}">
|
||||
<el-button @click="openEdit(row)" size="mini" type="primary">编辑</el-button>
|
||||
<el-button @click="doDelete(row.id)" size="mini" type="danger">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
</el-table>
|
||||
</el-card>
|
||||
|
||||
<template #edit>
|
||||
<vi-title title="基础信息"></vi-title>
|
||||
<el-form :model="formData" :rules="formRules" label-width="80px" ref="form">
|
||||
<el-form-item label="名称" prop="meetingTypeName">
|
||||
<el-input v-model="formData.meetingTypeName"></el-input>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="模块名称" prop="moduleName">
|
||||
<el-input v-model="formData.moduleName"></el-input>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="序号" prop="sortNum">
|
||||
<el-input-number :max="tableData.length + 1" :min="1" :precision="0"
|
||||
v-model="formData.sortNum"></el-input-number>
|
||||
</el-form-item>
|
||||
|
||||
<vi-title title="审核节点信息(温馨提醒:如审核节点没有限制,审核节点类型不选即可)"></vi-title>
|
||||
<el-table :data="formData.auditStateList">
|
||||
<el-table-column label="节点ID" prop="stateId" width="100px">
|
||||
<template slot-scope="scope">
|
||||
<el-input readonly v-model="scope.row.stateId"></el-input>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column label="审核节点名称" prop="stateName">
|
||||
<template slot-scope="scope">
|
||||
<el-input v-model="scope.row.stateName"></el-input>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="审核节点类型" prop="auditAfterType" width="150px">
|
||||
<template slot-scope="scope">
|
||||
<el-select v-model="scope.row.auditAfterType" clearable>
|
||||
<el-option :label="item.desc"
|
||||
:value="item.value"
|
||||
v-for="item in customAuditTypeList"></el-option>
|
||||
</el-select>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="审核人" prop="selectUserId">
|
||||
<template slot-scope="scope">
|
||||
<el-select :remote-method="userRemoteMethod"
|
||||
class="audit-userids-select" filterable
|
||||
multiple placeholder="请输入姓名或工号查找"
|
||||
remote style="width: 100%"
|
||||
v-model="scope.row.selectUserId">
|
||||
<el-option :key="item.id"
|
||||
:label="item.username + '(' + item.loginname + ')'"
|
||||
:value="item.id"
|
||||
v-for="item in userList"></el-option>
|
||||
</el-select>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column label="筛选审核人" width="100px">
|
||||
<template scope="scope">
|
||||
<el-button @click="openUserSelect(scope.$index)" type="text">筛选用户</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column label="通过下个节点" pro="afterPassStateId" width="120px">
|
||||
<template slot-scope="scope">
|
||||
<el-select v-model="scope.row.afterPassStateId">
|
||||
<el-option :label="item"
|
||||
:value="item"
|
||||
v-for="item in stateIdList"></el-option>
|
||||
</el-select>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column label="拒绝下个节点" pro="afterRejectStateId" width="120px">
|
||||
<template slot-scope="scope">
|
||||
<el-select v-model="scope.row.afterRejectStateId">
|
||||
<el-option :label="item"
|
||||
:value="item"
|
||||
v-for="item in stateIdList"></el-option>
|
||||
</el-select>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column label="审核类型" prop="stateAuditType" width="150px">
|
||||
<template slot-scope="scope">
|
||||
<el-select v-model="scope.row.stateAuditType">
|
||||
<el-option :label="item.desc"
|
||||
:value="item.value"
|
||||
v-for="item in stateAuditTypeList"></el-option>
|
||||
</el-select>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column width="100px">
|
||||
<template scope="scope" slot="header">
|
||||
<el-button @click="addState"
|
||||
icon="el-icon-circle-plus-outline"
|
||||
size="mini"
|
||||
type="primary"></el-button>
|
||||
</template>
|
||||
<template scope="scope">
|
||||
<el-button @click="formData.auditStateList.splice(scope.$index, 1)"
|
||||
icon="el-icon-delete"
|
||||
size="mini"
|
||||
type="danger"></el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-form>
|
||||
<el-row class="mt10" justify="end" type="flex">
|
||||
<el-button @click="$refs.guava.index()">取消</el-button>
|
||||
<el-button @click="doConfirm" type="primary">确定</el-button>
|
||||
</el-row>
|
||||
</template>
|
||||
</guava>
|
||||
|
||||
<condition :fields="fields"
|
||||
:show_filter_result="true"
|
||||
@confirm="cndConfirm"
|
||||
ref="cnd"
|
||||
v-model="cnd"></condition>
|
||||
|
||||
</div>
|
||||
|
||||
<script>
|
||||
<!--# include("/platform/meeting/includeJs/meetingUtil.js"){} #-->
|
||||
const meetUtil = new meetingUtil()
|
||||
var vue = new Vue({
|
||||
el: '#app',
|
||||
mixins: [initTableMixins],
|
||||
components: {
|
||||
'condition': httpVueLoader('/components/plugins/ConditionStructure.vue?v=1.0.0'),
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
tableColumns: [
|
||||
{prop: 'meetingTypeName', label: '类型名称'},
|
||||
{prop: 'moduleName', label: '模块名称'},
|
||||
{prop: 'sortNum', label: '排序编号'}],
|
||||
stateAuditTypeList: [],
|
||||
customAuditTypeList: [],
|
||||
formData: {
|
||||
auditStateList: []
|
||||
},
|
||||
formRules: {
|
||||
meetingTypeName: [{
|
||||
required: true,
|
||||
message: '请输入类型名称',
|
||||
trigger: ['blur', 'change']
|
||||
}],
|
||||
moduleName: [{
|
||||
required: true,
|
||||
message: '请输入模块名称,英文命名',
|
||||
trigger: ['blur', 'change']
|
||||
}],
|
||||
sortNum: [{required: true, message: '请输入排序编号', trigger: ['blur', 'change']}]
|
||||
},
|
||||
userList: [],
|
||||
maxStateId: 0,
|
||||
userSelectDialogVisible: false,
|
||||
cnd: {},
|
||||
fields: [],
|
||||
nodeIndex: null
|
||||
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
async 'formData.auditStateList'(val) {
|
||||
const {id} = this.formData
|
||||
for (let i = 0; i < val.length; i++) {
|
||||
let item = val[i]
|
||||
if (id) {
|
||||
if (item.isAddRow) {
|
||||
//当前行是新增的第几行
|
||||
const addIndex = i + 1 - val.filter(v => !v.isAddRow).length
|
||||
|
||||
const stateId = val[0].stateId + i * 10
|
||||
const licitStateCode = await this.checkStateId(stateId, addIndex)
|
||||
item['stateId'] = licitStateCode
|
||||
}
|
||||
} else {
|
||||
item['stateId'] = this.maxStateId + (i + 1) * 10
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
// this.$set(this.formData,'auditStateList',val)
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
dialogTitle() {
|
||||
if (this.formData.id) {
|
||||
return '编辑'
|
||||
}
|
||||
return '新增'
|
||||
},
|
||||
stateIdList() {
|
||||
return this.formData.auditStateList.map(v => v.stateId)
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
async checkStateId(stateId, stateIndex) {
|
||||
const resp = await $.get(loc() + '/checkStateId', {stateId, stateIndex})
|
||||
if (resp.code === 0) {
|
||||
return resp.data
|
||||
} else {
|
||||
this.notifyError(resp.msg)
|
||||
}
|
||||
},
|
||||
|
||||
addState() {
|
||||
this.formData.auditStateList.push({
|
||||
stateId: null,
|
||||
stateName: null,
|
||||
selectUserId: [],
|
||||
auditStateUserList: [],
|
||||
afterPassStateId: null,
|
||||
afterRejectStateId: null,
|
||||
isAddRow: true
|
||||
})
|
||||
},
|
||||
|
||||
async findAll() {
|
||||
const resp_data = await $.get(loc() + '/findAll')
|
||||
if (resp_data.code === 0) {
|
||||
resp_data.data.forEach(v => {
|
||||
v.auditStateList.forEach(x => {
|
||||
if (x.matchCnd) {
|
||||
x.matchCnd = JSON.parse(x.matchCnd)
|
||||
}
|
||||
})
|
||||
})
|
||||
this.tableData = resp_data.data
|
||||
}
|
||||
},
|
||||
openAdd() {
|
||||
this.formData = {
|
||||
meetingName: null,
|
||||
sortNum: this.tableData.length + 1,
|
||||
auditStateList: [{}]
|
||||
}
|
||||
this.$refs.guava.edit()
|
||||
},
|
||||
async doConfirm() {
|
||||
try {
|
||||
const valid = await this.$refs['form'].validate()
|
||||
if (valid) {
|
||||
this.formData.auditStateList.forEach(v => {
|
||||
v['auditStateUserList'] = v.selectUserId.map(x => {
|
||||
return {userId: x}
|
||||
})
|
||||
v['matchCnd'] = JSON.stringify(v['matchCnd'])
|
||||
})
|
||||
const resp = await $.post(loc() + '/doHandle', {data: JSON.stringify(this.formData)})
|
||||
if (resp.code === 0) {
|
||||
this.$refs.guava.index()
|
||||
this.notifySuccess(resp.msg)
|
||||
this.findAll()
|
||||
} else {
|
||||
this.notifyError(resp.msg)
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
}
|
||||
},
|
||||
async openEdit(row) {
|
||||
const d = clone(row)
|
||||
let u = []
|
||||
d.auditStateList.forEach(v => {
|
||||
v['selectUserId'] = v.auditStateUserList.map(x => x.userId)
|
||||
u = u.concat(v['selectUserId'])
|
||||
})
|
||||
this.userList = await queryUserByIds(u)
|
||||
|
||||
this.formData = d
|
||||
this.$refs.guava.edit()
|
||||
},
|
||||
async doDelete(id) {
|
||||
try {
|
||||
const confirm = await this.$confirm('您确定要删除吗', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
})
|
||||
if (confirm === 'confirm') {
|
||||
const resp = await $.post(loc() + '/delete/' + id)
|
||||
if (resp.code === 0) {
|
||||
this.notifySuccess(resp.msg)
|
||||
this.findAll()
|
||||
} else {
|
||||
this.notifyError(resp.msg)
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
}
|
||||
},
|
||||
async userRemoteMethod(query) {
|
||||
if (query) {
|
||||
this.userList = await searchUser(query)
|
||||
}
|
||||
},
|
||||
openUserSelect(node_index) {
|
||||
this.nodeIndex = node_index
|
||||
const node = this.formData.auditStateList[node_index]
|
||||
if (node.matchCnd) {
|
||||
this.cnd = node.matchCnd
|
||||
console.log('......')
|
||||
} else {
|
||||
this.cnd = {method: "AND", conditions: [{}]}
|
||||
}
|
||||
this.$refs.cnd.open(false)
|
||||
},
|
||||
async initCndFields() {
|
||||
this.cnd = {
|
||||
method: "AND",
|
||||
conditions: [{}],
|
||||
}
|
||||
const meet_data = await getOpenMeeting()
|
||||
const meet_options = meet_data.map(v => {
|
||||
return {"label": v.jdhallname, "value": v.id}
|
||||
})
|
||||
this.fields.push(
|
||||
{label: '教代会', value: 'jdhid', type: "select", options: meet_options}
|
||||
)
|
||||
const {data: role_data} = await $.get('/platform/sys/role/getAllRoles')
|
||||
const role_options = role_data.map(v => {
|
||||
return {"label": v.name, "value": v.id}
|
||||
})
|
||||
this.fields.push(
|
||||
{label: '角色', value: 'roleId', type: "select", options: role_options}
|
||||
)
|
||||
this.fields.push(
|
||||
{label: '姓名', value: 'username', options: null}
|
||||
)
|
||||
|
||||
|
||||
},
|
||||
async cndConfirm(val) {
|
||||
if (val) {
|
||||
const matchCnd = clone(val)
|
||||
if (matchCnd.conditions && matchCnd.conditions.length > 0) {
|
||||
this.formData.auditStateList[this.nodeIndex].matchCnd = matchCnd
|
||||
const resp = await $.post('/platform/userFilter/findUserByCnd', {cnd: JSON.stringify(matchCnd)})
|
||||
if (resp.code === 0) {
|
||||
if (resp.data) {
|
||||
const d = this.formData.auditStateList[this.nodeIndex]
|
||||
d.matchCnd = matchCnd
|
||||
d.selectUserId = [...new Set(d.selectUserId.concat(resp.data.map(v => v.id)))]
|
||||
|
||||
this.$set(this.formData.auditStateList, this.nodeIndex, d)
|
||||
let u = []
|
||||
this.formData.auditStateList.forEach(v => {
|
||||
u = u.concat(v.selectUserId.map(x => x))
|
||||
})
|
||||
this.userList = await queryUserByIds([...new Set(u)])
|
||||
}
|
||||
}
|
||||
console.log(resp)
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
async created() {
|
||||
this.findAll()
|
||||
this.initCndFields()
|
||||
this.maxStateId = await meetUtil.findMaxStateId()
|
||||
this.stateAuditTypeList = await getEnumOptions('AuditTypeEnum')
|
||||
this.customAuditTypeList = await getEnumOptions('CustomAuditTypeEnum')
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
|
||||
<!--#
|
||||
}
|
||||
#-->
|
||||
Reference in New Issue
Block a user