commit
This commit is contained in:
@@ -0,0 +1,363 @@
|
|||||||
|
const WORKFLOW_MESSAGE_FORM = {
|
||||||
|
template: /*language=HTML*/ `
|
||||||
|
<div>
|
||||||
|
<el-form :model="formData" ref="formRef" :rules="formRules" label-width="120px">
|
||||||
|
<el-form-item prop="title" label="标题">
|
||||||
|
<el-input maxlength="255" placeholder="请输入标题" v-model="formData.title"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
<!-- <el-form-item prop="url" label="链接地址">
|
||||||
|
<el-input placeholder="请输入链接地址" v-model="formData.url"></el-input>
|
||||||
|
</el-form-item>-->
|
||||||
|
<el-form-item prop="wechatEnterprise" label="同步企业微信">
|
||||||
|
<div style="color: grey; font-size: 13px">(温馨提醒:如选择是,将会在审核通过后同步发送到企业微信。)</div>
|
||||||
|
<el-radio-group v-model="formData.wechatEnterprise" size="small">
|
||||||
|
<el-radio border :label="true">是</el-radio>
|
||||||
|
<el-radio border :label="false">否</el-radio>
|
||||||
|
</el-radio-group>
|
||||||
|
</el-form-item>
|
||||||
|
<!--<el-form-item prop="needBack" label="是否需要反馈">
|
||||||
|
<el-radio-group v-model="formData.needBack" size="small">
|
||||||
|
<el-radio border :label="true">是</el-radio>
|
||||||
|
<el-radio border :label="false">否</el-radio>
|
||||||
|
</el-radio-group>
|
||||||
|
</el-form-item>-->
|
||||||
|
<el-form-item label="用户列表">
|
||||||
|
<el-row class="mb10">
|
||||||
|
<el-button icon="el-icon-search" @click="openSelect" size="small">选择用户</el-button>
|
||||||
|
<el-button icon="el-icon-delete" @click="clearSelect" type="danger" size="small">清空用户</el-button>
|
||||||
|
</el-row>
|
||||||
|
<el-table :data="userTableData" style="width: 100%" size="mini" max-height="500">
|
||||||
|
<el-table-column fixed prop="loginname" label="工号" width="150"></el-table-column>
|
||||||
|
<el-table-column prop="username" label="姓名" width="120"></el-table-column>
|
||||||
|
<el-table-column prop="sex" label="性别" width="50"></el-table-column>
|
||||||
|
<el-table-column prop="userState" label="在职状态" width="120"></el-table-column>
|
||||||
|
<el-table-column prop="personType" label="教职工类别" width="120"></el-table-column>
|
||||||
|
<el-table-column prop="mobile" label="手机" width="120"></el-table-column>
|
||||||
|
<el-table-column prop="unitname" label="所属单位" show-overflow-tooltip></el-table-column>
|
||||||
|
<el-table-column prop="unionname" label="所属工会" show-overflow-tooltip></el-table-column>
|
||||||
|
</el-table>
|
||||||
|
<p style="color: var(--color-primary)">总计:{{ userTableData.length }}人</p>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item prop="note" label="消息内容">
|
||||||
|
<text-editor v-model="formData.note"></text-editor>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item prop="files" label="消息附件">
|
||||||
|
<file-upload :value.sync="formData.files" :upload_number="5" upload_result_category="array" complete_result></file-upload>
|
||||||
|
</el-form-item>
|
||||||
|
<el-row class="mt20" justify="end" type="flex">
|
||||||
|
<el-button @click="back">取消</el-button>
|
||||||
|
<el-button type="primary" @click="doSubmit" :loading="formLoading">提交审核</el-button>
|
||||||
|
</el-row>
|
||||||
|
</el-form>
|
||||||
|
<el-dialog title="选择用户" :visible.sync="selectDialogVisible" width="65%" append-to-body top="2%" class="select-dialog">
|
||||||
|
<div class="btn-group tool-button" style="line-height: 50px">
|
||||||
|
<el-input placeholder="请输入内容" v-model="pageForm.searchKeyword" @keyup.enter.native="doSearch" style="width: 240px">
|
||||||
|
<el-select v-model="pageForm.searchName" slot="prepend" placeholder="查询类型" style="width: 80px">
|
||||||
|
<el-option label="工号" value="u.loginname"></el-option>
|
||||||
|
<el-option label="姓名" value="u.username"></el-option>
|
||||||
|
<el-option label="手机" value="u.mobile"></el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-input>
|
||||||
|
<el-select v-model="pageForm.sex" placeholder="性别" clearable>
|
||||||
|
<el-option label="男" value="男"></el-option>
|
||||||
|
<el-option label="女" value="女"></el-option>
|
||||||
|
</el-select>
|
||||||
|
<el-select v-if="showUnionSelect" v-model="pageForm.unionId" @change="flushUnits" @clear="flushUnits" placeholder="请选择所属工会" filterable clearable>
|
||||||
|
<el-option v-for="item in unionList" :key="item.id" :label="item.name" :value="item.id"></el-option>
|
||||||
|
</el-select>
|
||||||
|
<el-select v-if="showUnitSelect" v-model="pageForm.unitId" placeholder="请选择所属单位" filterable clearable>
|
||||||
|
<el-option v-for="item in selectUnitList" :key="item.id" :label="item.name" :value="item.id"></el-option>
|
||||||
|
</el-select>
|
||||||
|
<el-select v-if="showClubSelect" v-model="pageForm.clubId" placeholder="请选择所属协会" filterable clearable>
|
||||||
|
<el-option v-for="item in clubList" :key="item.id" :label="item.clubName" :value="item.id"></el-option>
|
||||||
|
</el-select>
|
||||||
|
<el-select v-if="showRoleSelect" v-model="pageForm.roleId" placeholder="请选择角色" filterable clearable>
|
||||||
|
<el-option v-for="item in roleList" :key="item.id" :label="item.name" :value="item.id"></el-option>
|
||||||
|
</el-select>
|
||||||
|
<el-button icon="el-icon-search" @click="doSearch" type="primary"></el-button>
|
||||||
|
</div>
|
||||||
|
<div class="left-span-label mt20">人员列表</div>
|
||||||
|
<el-table :data="tableData" v-loading="tableLoading" @selection-change="handleSelectionChange" row-key="id" ref="tableRef">
|
||||||
|
<el-table-column type="selection" reserve-selection width="35"></el-table-column>
|
||||||
|
<el-table-column fixed prop="loginname" label="工号" width="150"></el-table-column>
|
||||||
|
<el-table-column prop="username" label="姓名" width="120"></el-table-column>
|
||||||
|
<el-table-column prop="sex" label="性别" width="50"></el-table-column>
|
||||||
|
<el-table-column prop="userState" label="在职状态" width="120"></el-table-column>
|
||||||
|
<el-table-column prop="personType" label="教职工类别" width="120"></el-table-column>
|
||||||
|
<el-table-column prop="mobile" label="手机" width="120"></el-table-column>
|
||||||
|
<el-table-column prop="unitname" label="所属单位" show-overflow-tooltip></el-table-column>
|
||||||
|
<el-table-column prop="unionname" label="所属工会" show-overflow-tooltip></el-table-column>
|
||||||
|
</el-table>
|
||||||
|
<el-row class="el-pagination-container">
|
||||||
|
<el-pagination @size-change="pageSizeChange" @current-change="pageNumberChange" :current-page="pageForm.pageNumber" :page-sizes="[10, 20, 30, 50]" :page-size="pageForm.pageSize" layout="total, sizes, prev, pager, next" :total="pageForm.totalCount"></el-pagination>
|
||||||
|
</el-row>
|
||||||
|
<span slot="footer" class="dialog-footer">
|
||||||
|
<el-button @click="selectDialogVisible = false">取 消</el-button>
|
||||||
|
<el-button type="primary" @click="doSelect">确 定</el-button>
|
||||||
|
</span>
|
||||||
|
</el-dialog>
|
||||||
|
</div>
|
||||||
|
`,
|
||||||
|
mixins: [initTableMixins],
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
formData: {},
|
||||||
|
taskId: null,
|
||||||
|
userTableData: [],
|
||||||
|
tableData: [],
|
||||||
|
selectUsers: [],
|
||||||
|
selectUnitList: [],
|
||||||
|
unionList: [],
|
||||||
|
unitList: [],
|
||||||
|
clubList: [],
|
||||||
|
roleList: [],
|
||||||
|
selectDialogVisible: false,
|
||||||
|
tableLoading: false,
|
||||||
|
formLoading: false,
|
||||||
|
pageForm: {
|
||||||
|
searchName: "u.username",
|
||||||
|
searchKeyword: "",
|
||||||
|
pageNumber: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
totalCount: 0,
|
||||||
|
pageOrderName: "",
|
||||||
|
pageOrderBy: ""
|
||||||
|
},
|
||||||
|
formRules: {
|
||||||
|
title: [{ required: true, message: "必填", trigger: ["blur", "change"] }],
|
||||||
|
note: [{ required: true, message: "必填", trigger: ["blur", "change"] }],
|
||||||
|
needBack: [{ required: true, message: "必填", trigger: ["blur", "change"] }],
|
||||||
|
wechatEnterprise: [{ required: true, message: "必填", trigger: ["blur", "change"] }]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
isSchoolMsgScope() {
|
||||||
|
return this.$auth.hasPermission("dayofficework.message.workflow.school")
|
||||||
|
},
|
||||||
|
isUnionMsgScope() {
|
||||||
|
return !this.isSchoolMsgScope && this.$auth.hasPermission("dayofficework.message.workflow.union")
|
||||||
|
},
|
||||||
|
isClubMsgScope() {
|
||||||
|
return !this.isSchoolMsgScope && this.$auth.hasPermission("dayofficework.message.workflow.club")
|
||||||
|
},
|
||||||
|
showUnionSelect() {
|
||||||
|
return this.isSchoolMsgScope
|
||||||
|
},
|
||||||
|
showUnitSelect() {
|
||||||
|
return this.isSchoolMsgScope || this.isUnionMsgScope
|
||||||
|
},
|
||||||
|
showClubSelect() {
|
||||||
|
return this.isSchoolMsgScope || this.isClubMsgScope
|
||||||
|
},
|
||||||
|
showRoleSelect() {
|
||||||
|
return this.isSchoolMsgScope
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
initAdd() {
|
||||||
|
this.formData = {
|
||||||
|
id: "",
|
||||||
|
needBack: false,
|
||||||
|
wechatEnterprise: false
|
||||||
|
}
|
||||||
|
this.taskId = null
|
||||||
|
this.userTableData = []
|
||||||
|
this.selectUsers = []
|
||||||
|
if (this.$refs.formRef) {
|
||||||
|
this.$refs.formRef.resetFields()
|
||||||
|
}
|
||||||
|
if (this.$refs.tableRef) {
|
||||||
|
this.$refs.tableRef.clearSelection()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 编辑撤回后的消息申请:row 为申请列表当前行,需包含 id 和 startTaskId;详情接口返回 message 与 receivers 用于回填表单。
|
||||||
|
initEdit(row) {
|
||||||
|
this.taskId = row.startTaskId || row.taskId
|
||||||
|
this.$axios.post("/platform/dayofficework/workflowmessage/info", { id: row.id }).then((res) => {
|
||||||
|
if (res.code === 0) {
|
||||||
|
this.formData = res.data.message
|
||||||
|
this.userTableData = res.data.receivers.map((receiver) => {
|
||||||
|
return {
|
||||||
|
id: receiver.userId,
|
||||||
|
loginname: receiver.loginName,
|
||||||
|
username: receiver.userName,
|
||||||
|
sex: receiver.sex,
|
||||||
|
mobile: receiver.mobile,
|
||||||
|
userState: receiver.userState,
|
||||||
|
personType: receiver.personType,
|
||||||
|
unitname: receiver.unitName,
|
||||||
|
unionname: receiver.unionName
|
||||||
|
}
|
||||||
|
})
|
||||||
|
this.selectUsers = []
|
||||||
|
if (this.$refs.formRef) {
|
||||||
|
this.$refs.formRef.clearValidate()
|
||||||
|
}
|
||||||
|
if (this.$refs.tableRef) {
|
||||||
|
this.$refs.tableRef.clearSelection()
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.$message.warning(res.msg)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
back() {
|
||||||
|
this.$emit("back")
|
||||||
|
},
|
||||||
|
// 初始化表单选人基础数据:单位、工会、协会、角色用于选人弹窗筛选条件。
|
||||||
|
initSelectData() {
|
||||||
|
this.$businessTool.listUnit().then((data) => {
|
||||||
|
this.unitList = data
|
||||||
|
if (this.isSchoolMsgScope) {
|
||||||
|
this.selectUnitList = data
|
||||||
|
}
|
||||||
|
})
|
||||||
|
this.$businessTool.listUnion().then((data) => {
|
||||||
|
this.unionList = data
|
||||||
|
})
|
||||||
|
this.$businessTool.listCLubByRole().then((data) => {
|
||||||
|
this.clubList = data
|
||||||
|
})
|
||||||
|
this.$axios.post("/platform/dayofficework/workflowmessage/roleList").then((res) => {
|
||||||
|
if (res.code === 0) {
|
||||||
|
this.roleList = res.data
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
getCurrentUnionId() {
|
||||||
|
return this.$store.state.user.union && this.$store.state.user.union.id ? this.$store.state.user.union.id : ""
|
||||||
|
},
|
||||||
|
applyMsgScope(resetUnitId) {
|
||||||
|
if (!this.showRoleSelect) {
|
||||||
|
this.$set(this.pageForm, "roleId", null)
|
||||||
|
}
|
||||||
|
if (!this.showUnitSelect) {
|
||||||
|
this.$set(this.pageForm, "unitId", null)
|
||||||
|
}
|
||||||
|
if (!this.showClubSelect) {
|
||||||
|
this.$set(this.pageForm, "clubId", null)
|
||||||
|
}
|
||||||
|
if (this.isUnionMsgScope) {
|
||||||
|
const unionId = this.getCurrentUnionId()
|
||||||
|
this.$set(this.pageForm, "unionId", unionId)
|
||||||
|
if (resetUnitId) {
|
||||||
|
this.$set(this.pageForm, "unitId", null)
|
||||||
|
this.selectUnitList = []
|
||||||
|
}
|
||||||
|
if (unionId && (resetUnitId || this.selectUnitList.length === 0)) {
|
||||||
|
this.$businessTool.listUnit(unionId).then((data) => {
|
||||||
|
this.selectUnitList = data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (this.isSchoolMsgScope) {
|
||||||
|
this.selectUnitList = this.unitList
|
||||||
|
return
|
||||||
|
}
|
||||||
|
this.$set(this.pageForm, "unionId", null)
|
||||||
|
this.selectUnitList = []
|
||||||
|
},
|
||||||
|
flushUnits() {
|
||||||
|
this.$set(this.pageForm, "unitId", null)
|
||||||
|
this.selectUnitList = []
|
||||||
|
if (this.pageForm.unionId) {
|
||||||
|
this.$businessTool.listUnit(this.pageForm.unionId).then((data) => {
|
||||||
|
this.selectUnitList = data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
this.doSearch()
|
||||||
|
},
|
||||||
|
openSelect() {
|
||||||
|
this.applyMsgScope(true)
|
||||||
|
this.selectDialogVisible = true
|
||||||
|
this.pageData()
|
||||||
|
},
|
||||||
|
clearSelect() {
|
||||||
|
this.userTableData = []
|
||||||
|
if (this.$refs.tableRef) {
|
||||||
|
this.$refs.tableRef.clearSelection()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
handleSelectionChange(val) {
|
||||||
|
this.selectUsers = val
|
||||||
|
},
|
||||||
|
pageData() {
|
||||||
|
this.applyMsgScope(false)
|
||||||
|
this.tableLoading = true
|
||||||
|
this.$axios.post("/platform/dayofficework/workflowmessage/userData", this.pageForm).then((res) => {
|
||||||
|
if (res.code === 0) {
|
||||||
|
this.tableData = res.data.list
|
||||||
|
this.pageForm.totalCount = res.data.totalCount
|
||||||
|
} else {
|
||||||
|
this.$message.warning(res.msg)
|
||||||
|
}
|
||||||
|
}).finally(() => {
|
||||||
|
this.tableLoading = false
|
||||||
|
})
|
||||||
|
},
|
||||||
|
doSelect() {
|
||||||
|
const tableLoginNames = this.userTableData.map((v) => v.loginname)
|
||||||
|
const selectUsers = this.selectUsers.length > 0 ? this.selectUsers : (this.$refs.tableRef && this.$refs.tableRef.selection ? this.$refs.tableRef.selection : [])
|
||||||
|
if (selectUsers.length === 0) {
|
||||||
|
this.$message.warning("请选择用户")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
selectUsers.forEach((o) => {
|
||||||
|
if (!tableLoginNames.includes(o.loginname)) {
|
||||||
|
this.userTableData.push(o)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
if (this.$refs.tableRef) {
|
||||||
|
this.$refs.tableRef.clearSelection()
|
||||||
|
}
|
||||||
|
this.selectDialogVisible = false
|
||||||
|
},
|
||||||
|
doSubmit() {
|
||||||
|
this.$refs.formRef.validate((valid) => {
|
||||||
|
if (!valid) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const loginNames = this.userTableData.map((u) => u.loginname)
|
||||||
|
if (loginNames.length === 0) {
|
||||||
|
this.$message.warning("请选择用户")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (loginNames.length > 100) {
|
||||||
|
this.$message.warning("单条消息最多发送100人,请分批次发送。")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
this.$confirm("您确定要提交消息发送申请吗?", "提示", {
|
||||||
|
confirmButtonText: "确定",
|
||||||
|
cancelButtonText: "取消",
|
||||||
|
type: "warning"
|
||||||
|
}).then(() => {
|
||||||
|
this.formLoading = true
|
||||||
|
const url = this.formData.id ? "/platform/dayofficework/workflowmessage/updateSubmit" : "/platform/dayofficework/workflowmessage/submit"
|
||||||
|
const params = {
|
||||||
|
message: JSON.stringify(this.formData),
|
||||||
|
users: JSON.stringify(loginNames)
|
||||||
|
}
|
||||||
|
if (this.formData.id) {
|
||||||
|
this.$set(params, "taskId", this.taskId)
|
||||||
|
}
|
||||||
|
this.$axios.post(url, params).then((res) => {
|
||||||
|
if (res.code === 0) {
|
||||||
|
this.$message.success(res.msg)
|
||||||
|
this.$emit("success")
|
||||||
|
this.back()
|
||||||
|
} else {
|
||||||
|
this.$message.error(res.msg)
|
||||||
|
}
|
||||||
|
}).finally(() => {
|
||||||
|
this.formLoading = false
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.initSelectData()
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user