hi-ucs/front/src/views/home/apply.vue

983 lines
34 KiB
Vue
Raw Normal View History

2022-06-14 09:32:49 +08:00
<template>
<div>
<home-header></home-header>
<div id="apply-container">
<!-- <aside>
<aside-menu></aside-menu>
</aside> -->
<article>
2022-07-18 17:26:18 +08:00
<div class="from-card" v-if="applySuccess && !applyAll">
2022-06-28 21:49:50 +08:00
<AbilityToApplyFor :dataList="list"></AbilityToApplyFor>
2022-06-23 19:19:48 +08:00
</div>
2022-06-14 09:32:49 +08:00
<div class="form-container">
<div v-if="applySuccess">
<a-form
ref="formRef"
:model="formName"
name="basic"
:label-col="{ style: { width: '106px' } }"
:wrapper-col="{ style: { width: '230px' } }"
labelAlign="left"
autocomplete="off"
>
2022-06-29 17:28:49 +08:00
<div class="base-info">
<a-form-item
label="申请标题"
name="title"
:rules="[{ required: true, message: '请输入申请标题' }]"
>
<a-input
placeholder="请输入能力申请标题"
v-model:value="formName.title"
/>
</a-form-item>
</div>
2022-06-14 09:32:49 +08:00
<div class="base-info">
<a-form-item
2022-06-23 19:19:48 +08:00
label="申请人信息"
2022-06-14 09:32:49 +08:00
name="user"
:rules="[{ required: true, message: '请输入申请人' }]"
>
<a-input
placeholder="请输入申请人"
v-model:value="formName.user"
disabled
/>
</a-form-item>
<a-form-item
style="margin: 0 22px"
2022-06-23 19:19:48 +08:00
label="电话"
2022-06-14 09:32:49 +08:00
name="phone"
:rules="[
{
required: true,
pattern: /^1[3456789]\d{9}$/,
message: '请输入正确的电话号码',
},
]"
>
<a-input
placeholder="请输入申请人电话"
v-model:value="formName.phone"
/>
</a-form-item>
<a-form-item
2022-06-23 19:19:48 +08:00
label="单位"
2022-06-14 09:32:49 +08:00
name="unit"
2022-06-23 19:19:48 +08:00
:rules="[{ required: true, message: '请输入单位' }]"
2022-06-14 09:32:49 +08:00
>
<a-input
2022-06-23 19:19:48 +08:00
placeholder="请输入单位"
2022-06-14 09:32:49 +08:00
v-model:value="formName.unit"
2022-06-29 17:28:49 +08:00
disabled
2022-06-14 09:32:49 +08:00
/>
</a-form-item>
</div>
2022-07-18 14:43:24 +08:00
<div class="base-info" v-if="flag">
2022-06-29 17:28:49 +08:00
<a-form-item
label="应用系统"
name="applicationSystem"
:rules="[{ required: true, message: '请选择应用系统' }]"
>
<a-select
v-model:value="formName.applicationSystem"
show-search
2022-06-30 18:48:59 +08:00
placeholder="请输入关键字"
2022-06-29 17:28:49 +08:00
style="width: 200px"
:options="systemOptions"
@focus="handleFocus"
@blur="handleBlur"
@change="systemHandleChange"
@search="systemHandleSearch"
></a-select>
</a-form-item>
<a-form-item
class="applicationScene"
2022-07-18 14:27:11 +08:00
label="应用领域"
2022-06-29 17:28:49 +08:00
name="applicationScene"
2022-07-18 14:27:11 +08:00
:rules="[{ required: true, message: '请选择应用领域' }]"
2022-06-29 17:28:49 +08:00
style="width: 6.93rem"
>
<a-select
v-model:value="formName.applicationScene"
:options="applicationSceneOpthion"
mode="tags"
:size="size"
2022-07-18 14:27:11 +08:00
placeholder="请选择应用领域"
2022-06-29 17:28:49 +08:00
:filterOption="false"
:searchValue="false"
style="width: 5.87rem"
></a-select>
</a-form-item>
</div>
<div>
<a-form-item
label="应用背景"
name="applicationBackground"
2022-08-12 18:06:56 +08:00
:rules="[
{ required: true, message: '请输入应用背景' },
{ min: 50, message: '应用背景最少为50个字' },
]"
2022-06-29 17:28:49 +08:00
>
2022-07-04 11:56:45 +08:00
<a-textarea
2022-06-29 17:28:49 +08:00
placeholder="请输入应用背景"
v-model:value="formName.applicationBackground"
2022-07-04 11:56:45 +08:00
:rows="4"
2022-06-14 09:32:49 +08:00
/>
2022-06-29 17:28:49 +08:00
</a-form-item>
</div>
2022-08-12 18:06:56 +08:00
<!-- <div>
2022-06-29 17:28:49 +08:00
<a-form-item
label="期望效果"
name="effectWish"
:rules="[{ required: true, message: '请输入期望效果' }]"
>
2022-07-04 11:56:45 +08:00
<a-textarea
2022-06-29 17:28:49 +08:00
placeholder="请输入期望效果"
v-model:value="formName.effectWish"
2022-07-04 11:56:45 +08:00
:rows="4"
2022-06-29 17:28:49 +08:00
/>
</a-form-item>
2022-08-12 18:06:56 +08:00
</div> -->
<!-- <a-form-item
2022-06-14 09:32:49 +08:00
style="color: #666; font-size: 16px"
label="申请单附件"
name="applyDoc"
>
<a-upload
v-model:file-list="fileList"
name="file"
2022-06-23 19:19:48 +08:00
:action="`${baseURL}/upload`"
2022-06-14 09:32:49 +08:00
:headers="headers"
@change="handleChange"
:before-upload="beforeUpload"
2022-07-22 16:51:00 +08:00
:maxCount="1"
2022-06-14 09:32:49 +08:00
>
<a-button
style="
width: 100px;
height: 30px;
margin-right: 10px;
background: #edf4fc;
color: #0087ff;
font-size: 14px;
border-radius: 6px;
border: 1px solid #bbd3ef;
padding: 0;
text-align: center;
"
>
<upload-outlined></upload-outlined>
文件上传
</a-button>
<span style="font-size: 14px; color: #999">
支持docdocxjpgpngjpegpdfxlxsppt类型文件
</span>
2022-07-22 16:51:00 +08:00
<div v-if="fileList.length < 1">
<plus-outlined />
<div style="margin-top: 8px">上传限一个文件</div>
</div>
2022-06-14 09:32:49 +08:00
</a-upload>
2022-08-12 18:06:56 +08:00
</a-form-item> -->
2022-07-04 11:56:45 +08:00
<div class="bottom-btn">
2022-06-14 09:32:49 +08:00
<a-button
style="
width: 80px;
height: 38px;
margin-right: 20px;
background: #e1edfa;
color: #0087ff;
font-size: 14px;
border-radius: 6px;
border: none;
padding: 0;
text-align: center;
"
type="primary"
html-type="cancle"
@click="resetFields()"
>
退出申请
</a-button>
<a-button
style="
width: 80px;
height: 38px;
background: #0087ff;
color: #fff;
font-size: 14px;
border-radius: 6px;
border: none;
padding: 0;
text-align: center;
"
type="primary"
html-type="submit"
@click="processStartHandle()"
>
提交申请
</a-button>
2022-07-04 11:56:45 +08:00
</div>
2022-06-14 09:32:49 +08:00
</a-form>
</div>
<div class="success" v-else>
<div>
<img src="../../assets/home/success.png" alt="" />
</div>
2022-07-15 17:52:31 +08:00
<p>您已成功申请能力请耐心等待审批结果结果会第一时间通知您</p>
2022-06-14 09:32:49 +08:00
</div>
</div>
</article>
</div>
</div>
</template>
<script>
2022-06-23 19:19:48 +08:00
import AbilityToApplyFor from './AbilityToApplyFor.vue'
2022-06-14 09:32:49 +08:00
import HomeHeader from '@/views/home/components/header'
2022-06-23 19:19:48 +08:00
import { reactive, ref, watch, onBeforeUnmount } from 'vue'
2022-06-14 09:32:49 +08:00
import { useRouter } from 'vue-router'
import { message } from 'ant-design-vue'
import qs from 'qs'
// import { UploadOutlined } from '@ant-design/icons-vue'
import { Upload } from 'ant-design-vue'
import {
lastestPage,
tabilityapplication,
startOfBusinessKey,
updateInstanceId,
submitApply,
2022-07-18 17:26:18 +08:00
applyAllApplication,
2022-06-14 09:32:49 +08:00
getUser,
getUserInfo,
relaunch,
2022-06-23 19:19:48 +08:00
selectOne,
2022-06-14 09:32:49 +08:00
} from '@/api/home'
import { getCategoryTreePage, endProcess } from '@/api/personalCenter'
2022-06-14 09:32:49 +08:00
import mybus from '@/myplugins/mybus'
import { sgcDel, getApplyForm } from '@/api/personalCenter'
2022-06-29 17:28:49 +08:00
import { pageWithAttrs } from '@/api/home'
2022-06-16 16:58:49 +08:00
// import { baseURL } from '@/config'
2022-06-14 09:32:49 +08:00
// import AsideMenu from './components/asideMenu.vue'
export default {
name: '',
props: {},
components: {
HomeHeader,
2022-06-23 19:19:48 +08:00
AbilityToApplyFor,
2022-06-14 09:32:49 +08:00
// AsideMenu,
// UploadOutlined,
},
setup() {
const router = useRouter()
const disabled = ref(false)
2022-07-18 14:43:24 +08:00
const flag = ref(false)
2022-07-04 17:02:00 +08:00
const list = ref(JSON.parse(localStorage.getItem('applyList')))
2022-07-18 17:26:18 +08:00
const applyAll = router.currentRoute.value.query.applyAll
2022-07-19 09:16:29 +08:00
const num = ref(0)
2022-07-18 17:26:18 +08:00
if (!applyAll) {
list.value.map((item) => {
item.arr.map((val) => {
console.log(item, '组件===========================')
let obj = item.children
? item.children.filter((type) => type.id == val.id)[0]
: val.type !== '应用资源'
if (obj) {
console.log('11111111111111111111111111111', obj, flag.value)
if (obj.type !== '应用资源') {
flag.value = true
}
2022-07-18 14:43:24 +08:00
}
2022-07-18 17:26:18 +08:00
})
if (item.checkedList) {
console.log(item)
num.value += Number(item.checkedList.length)
2022-07-18 14:43:24 +08:00
}
})
2022-07-18 17:26:18 +08:00
}
2022-07-04 17:02:00 +08:00
console.log(
'list',
2022-07-05 11:51:31 +08:00
list.value
// list.value[0].children.filter(
// (val) => val.id == list.value[0].checkedList[0]
// )[0].resourceName
2022-07-04 17:02:00 +08:00
)
2022-06-23 19:19:48 +08:00
const baseURL = window.SITE_CONFIG.apiURL
let record = ref('1')
2022-06-29 17:28:49 +08:00
const text = ref('')
2022-06-14 09:32:49 +08:00
const formName = reactive({
2022-07-18 17:26:18 +08:00
title: applyAll
? '全部应用资源申请'
2022-08-01 09:21:57 +08:00
: list.value[0].arr && list.value[0].arr[0].type == '单兵设备'
? '单兵设备申请'
2022-07-18 17:26:18 +08:00
: list.value[0].children
2022-08-17 11:16:25 +08:00
? '申请' +
list.value[0].children
2022-07-05 11:51:31 +08:00
.filter((val) => val.id == list.value[0].checkedList[0])[0]
.resourceName.concat(
2022-08-17 11:16:25 +08:00
num.value > 1 ? '等' + num.value + '项能力' : ''
2022-07-05 11:51:31 +08:00
)
2022-08-17 11:16:25 +08:00
: '申请' + list.value[0].arr[0].resourceName, // 标题
2022-08-15 18:06:34 +08:00
applicationSystem: '', // 应用系统
2022-07-21 11:26:47 +08:00
// applicationSystem: [], // 应用系统
2022-07-18 14:27:11 +08:00
applicationScene: [], // 应用领域
2022-06-29 17:28:49 +08:00
applicationBackground: '', // 应用背景
effectWish: '', // 期望效果
2022-06-14 09:32:49 +08:00
user: '',
userId: '',
phone: '',
unit: '',
system: [],
enclosure: '', //附件
2022-07-13 16:30:37 +08:00
enclosureName: '', //附件
})
2022-06-23 19:19:48 +08:00
const dataList = ref([])
const id = router.currentRoute.value.query.id
const taskId = router.currentRoute.value.query.taskId
const businessKey = ref(router.currentRoute.value.query.id)
if (id) {
getApplyForm(id).then((res) => {
console.log('修改==============>', res.data.data)
// formName.id = res.data.data.id || ''
2022-08-15 18:06:34 +08:00
formName.applicationSystem = res.data.data.applicationSystem || ''
formName.applicationScene = res.data.data.applicationScene || []
formName.applicationBackground =
res.data.data.applicationBackground || ''
formName.effectWish = res.data.data.effectWish || ''
formName.phone = res.data.data.phone || ''
// formName.system = res.data.data.system || []
formName.enclosure = res.data.data.enclosure || ''
formName.enclosureName = res.data.data.enclosureName || ''
if (res.data.data.enclosure) {
fileList.value.push({
name: res.data.data.enclosureName,
url: res.data.data.enclosure,
})
}
})
}
2022-06-14 09:32:49 +08:00
getUser().then((res) => {
formName.user = res.data.data.realName
formName.userId = res.data.data.id
getUserInfo(formName.userId).then((res) => {
if (res.data.data.mobile) {
formName.phone = res.data.data.mobile
}
formName.unit = res.data.data.deptName
})
})
2022-06-29 09:56:01 +08:00
// console.log('本地存储====================》', list.value)
2022-06-29 17:28:49 +08:00
const applicationSceneOpthion = ref([])
getCategoryTreePage({
page: 1,
limit: 20,
dictTypeId: '1513712507692818433',
deFlage: 0,
}).then((res) => {
res.data.data.list.map((val) => {
applicationSceneOpthion.value.push({
value: val.dictLabel,
label: val.dictLabel,
})
})
// console.log('字典值========>', applicationSceneOpthion.value)
})
2022-06-29 09:56:01 +08:00
// console.log(formName.system)
2022-06-14 09:32:49 +08:00
const formRef = ref()
const applySuccess = ref(true)
// const rootObj = null
const dataForm = {
processDefinitionKey: 'abilityprocess',
}
const callbacks = {
startProcessSuccessCallback: null,
startProcessErrorCallback: null,
formSaveSuccessCallback: null,
formSaveErrorCallback: null,
}
const instanceIdUrl = '/processForm/tabilityapplication/updateInstanceId'
const formUrl = '/processForm/tabilityapplication'
//退出返回上一页
const resetFields = () => {
window.history.go(-1)
}
const processStartHandle = () => {
formRef.value.validate().then(() => {
if (!formUrl) {
return message.error('请设置保存表单的URL')
}
if (!formName) {
return message.error('请设置表单名称')
}
if (id) {
endProcess({ instanceId: taskId }).then((end) => {
if (end.data.code == 0) {
let ids = []
let falgNum = 0
let sxt = true
formName.system = []
console.log('list==================', list.value)
list.value.map((val) => {
val.arr.map((item) => {
if (item.type !== '基础设施') {
falgNum++
}
})
})
list.value.map((val) => {
val.arr.map((item) => {
if (item.type !== '基础设施') {
formName.system.push({
resourceId: item.resourceId,
resourceName: item.resourceName,
})
falgNum++
console.log(item.id)
if (item.id) {
ids.push(item.id)
}
} else {
let obj = {}
Object.assign(obj, formName)
console.log('摄像头===============>', obj, item)
obj.system = []
item.note1 = JSON.parse(item.note1)
item.note1.map((sxt) => {
obj.system.push({
resourceId: sxt.idtCameraChannel + '',
resourceName: sxt.channelName,
cameraId: sxt.channelId, // 改接口后删除
channelCode: sxt.channelCode,
channelId: sxt.channelId,
channelName: sxt.channelName,
checkStatus: sxt.checkStatus + '',
gpsX: sxt.gpsX,
gpsY: sxt.gpsY,
idtCameraChannel: sxt.idtCameraChannel + '',
nodeName: sxt.nodeName,
parentId: sxt.parentId,
status: sxt.status + '',
})
})
submitApply(obj).then((res) => {
// applySuccess.value = false
console.log('摄像头申请================>', res)
if (item.id) {
sgcDel({ ids: [item.id] }).then((res1) => {
if (res1.data.msg === 'success') {
if (falgNum == 0 && sxt) {
message.success(
'申请提交成功,请到消息中心查看!'
)
sxt = false
}
mybus.emit('getSgcNum')
router.push({
path: '/DetailsPageconetent',
query: {
select: '组件服务',
},
})
}
})
} else {
if (
res.data.msg === 'success' &&
falgNum == 0 &&
sxt
) {
message.success('申请提交成功,请到消息中心查看!')
sxt = false
}
router.push({
path: '/DetailsPageconetent',
query: {
select: '组件服务',
},
})
}
})
}
})
})
console.log(
'提交数据==========================>',
formName,
ids
)
if (formName.system.length !== 0) {
if (formName.applicationSystem.length == 0) {
2022-08-15 18:06:34 +08:00
formName.applicationSystem = ''
}
submitApply(formName).then((res) => {
// applySuccess.value = false
message.success('申请提交成功,请到消息中心查看!')
console.log('能力申请================>', res)
if (res.data.code == 0) {
if (ids && ids.length > 0) {
sgcDel({ ids: ids }).then((res) => {
if (res.data.msg === 'success') {
mybus.emit('getSgcNum')
router.push({
path: '/DetailsPageconetent',
query: {
select: '组件服务',
},
})
}
})
} else {
router.push({
path: '/DetailsPageconetent',
query: {
select: '组件服务',
},
})
}
} else {
message.error('申请失败!')
}
})
2022-06-14 09:32:49 +08:00
}
}
})
} else {
2022-07-18 17:26:18 +08:00
if (!applyAll) {
2022-08-01 09:21:57 +08:00
console.log(list.value[0].arr[0])
// 单兵设备为了演示 添加 不做处理
if (list.value[0].arr[0].type == '单兵设备') {
message.success('单兵设备申请提交成功!')
router.push({
path: '/DetailsPageconetent',
query: {
select: '组件服务',
},
2022-07-25 10:17:08 +08:00
})
2022-08-01 09:21:57 +08:00
} else {
let ids = []
let falgNum = 0
let sxt = true
formName.system = []
console.log('list==================', list.value)
list.value.map((val) => {
val.arr.map((item) => {
if (item.type !== '基础设施') {
falgNum++
2022-06-30 15:27:16 +08:00
}
})
2022-08-01 09:21:57 +08:00
})
list.value.map((val) => {
val.arr.map((item) => {
if (item.type !== '基础设施') {
formName.system.push({
resourceId: item.resourceId,
resourceName: item.resourceName,
2022-07-15 17:52:31 +08:00
})
2022-08-01 09:21:57 +08:00
falgNum++
console.log(item.id)
2022-07-18 17:26:18 +08:00
if (item.id) {
2022-08-01 09:21:57 +08:00
ids.push(item.id)
}
} else {
let obj = {}
Object.assign(obj, formName)
console.log('摄像头===============>', obj, item)
obj.system = []
item.note1 = JSON.parse(item.note1)
item.note1.map((sxt) => {
obj.system.push({
resourceId: sxt.idtCameraChannel + '',
resourceName: sxt.channelName,
cameraId: sxt.channelId, // 改接口后删除
channelCode: sxt.channelCode,
channelId: sxt.channelId,
channelName: sxt.channelName,
checkStatus: sxt.checkStatus + '',
gpsX: sxt.gpsX,
gpsY: sxt.gpsY,
idtCameraChannel: sxt.idtCameraChannel + '',
nodeName: sxt.nodeName,
parentId: sxt.parentId,
status: sxt.status + '',
})
})
submitApply(obj).then((res) => {
// applySuccess.value = false
console.log('摄像头申请================>', res)
if (item.id) {
sgcDel({ ids: [item.id] }).then((res1) => {
if (res1.data.msg === 'success') {
if (falgNum == 0 && sxt) {
message.success(
'申请提交成功,请到消息中心查看!'
)
sxt = false
}
mybus.emit('getSgcNum')
router.push({
path: '/DetailsPageconetent',
query: {
select: '组件服务',
},
})
2022-07-25 10:17:08 +08:00
}
2022-08-01 09:21:57 +08:00
})
} else {
if (
res.data.msg === 'success' &&
falgNum == 0 &&
sxt
) {
message.success('申请提交成功,请到消息中心查看!')
sxt = false
2022-07-18 17:26:18 +08:00
}
2022-07-19 10:22:16 +08:00
router.push({
path: '/DetailsPageconetent',
query: {
select: '组件服务',
},
})
}
})
}
})
2022-08-01 09:21:57 +08:00
})
console.log(
'提交数据==========================>',
formName,
ids
)
if (formName.system.length !== 0) {
if (formName.applicationSystem.length == 0) {
2022-08-15 18:06:34 +08:00
formName.applicationSystem = ''
2022-08-01 09:21:57 +08:00
}
submitApply(formName).then((res) => {
// applySuccess.value = false
message.success('申请提交成功,请到消息中心查看!')
console.log('能力申请================>', res)
if (res.data.code == 0) {
if (ids && ids.length > 0) {
sgcDel({ ids: ids }).then((res) => {
if (res.data.msg === 'success') {
2022-07-18 17:26:18 +08:00
mybus.emit('getSgcNum')
2022-07-19 09:16:29 +08:00
router.push({
2022-07-19 10:22:16 +08:00
path: '/DetailsPageconetent',
query: {
select: '组件服务',
},
})
2022-07-18 17:26:18 +08:00
}
})
2022-07-22 15:46:13 +08:00
} else {
router.push({
path: '/DetailsPageconetent',
query: {
select: '组件服务',
},
})
}
2022-07-19 10:22:16 +08:00
} else {
2022-08-01 09:21:57 +08:00
message.error('申请失败!')
2022-07-19 10:22:16 +08:00
}
2022-08-01 09:21:57 +08:00
})
}
2022-07-18 17:26:18 +08:00
}
} else {
2022-08-15 18:06:34 +08:00
formName.applicationSystem = ''
2022-07-18 17:26:18 +08:00
applyAllApplication(formName).then((res) => {
if (res.data.code == 0) {
message.success('申请提交成功,请到消息中心查看!')
2022-07-15 17:52:31 +08:00
router.push({
path: '/DetailsPageconetent',
query: {
select: '组件服务',
},
})
2022-07-18 17:26:18 +08:00
} else {
message.error('申请失败!')
2022-06-30 15:27:16 +08:00
}
})
}
}
})
2022-06-14 09:32:49 +08:00
}
// 启动流程
const startProcess = (processDefinitionKey, businessKey, formData) => {
var data = {
processDefinitionKey: processDefinitionKey,
businessKey: businessKey,
variables: formData,
}
// proxy.$http['post']('/act/running/startOfBusinessKey', data)
startOfBusinessKey(data)
.then(({ data: res }) => {
2022-07-19 09:16:29 +08:00
// applySuccess.value = false
2022-06-14 09:32:49 +08:00
if (res.code !== 0) {
if (callbacks.startProcessErrorCallback) {
callbacks.startProcessErrorCallback(res.data)
}
}
message({
message: '操作成功',
type: 'success',
duration: 500,
onClose: () => {
if (callbacks.startProcessSuccessCallback) {
callbacks.startProcessSuccessCallback(res.data)
}
},
})
if (instanceIdUrl) {
var params = qs.stringify({
processInstanceId: res.data.processInstanceId,
processDefinitionKey: processDefinitionKey,
businessKey: businessKey,
})
// proxy.$http['post'](instanceIdUrl + '?' + params)
updateInstanceId(params).then(
// ({ data: res }) => {}
() => {}
)
}
})
2022-06-14 09:32:49 +08:00
.catch(() => {})
}
const options = ref([
{
value: '政法委',
label: '政法委',
},
{
value: '公安局',
label: '公安局',
},
{
value: '卫健委',
label: '卫健委',
},
{
value: '城市管理局',
label: '城市管理局',
},
{
value: '生态环境局',
label: '生态环境局',
},
{
value: '交通运输局',
label: '交通运输局',
},
])
2022-06-29 17:28:49 +08:00
const systemOptions = ref([])
2022-07-04 11:56:45 +08:00
const systemOptions2 = ref([])
2022-06-14 09:32:49 +08:00
const handleChange = (info) => {
if (info.file.status !== 'uploading') {
2022-06-29 09:56:01 +08:00
// console.log(info.file, info.fileList)
2022-06-14 09:32:49 +08:00
}
if (info.file.status === 'done') {
message.success(`${info.file.name} 上传成功`)
formName.enclosure = info.file.response.data
2022-07-13 16:30:37 +08:00
formName.enclosureName = info.file.name
2022-06-14 09:32:49 +08:00
} else if (info.file.status === 'error') {
message.error(`${info.file.name} 上传失败`)
}
}
const beforeUpload = (file) => {
const isPNG =
file.type === 'image/png' ||
'image/doc' ||
'image/docx' ||
'image/jpg' ||
'image/png' ||
'image/jpeg' ||
'image/pdf' ||
'image/xlxs' ||
'image/ppt'
if (!isPNG) {
message.error(`上传失败`)
}
return isPNG || Upload.LIST_IGNORE
}
const fileList = ref([])
2022-06-29 17:28:49 +08:00
// 应用系统下拉
const systemHandleChange = (value) => {
console.log(`selected ${value}`)
}
const systemHandleSearch = (value) => {
2022-08-15 18:06:34 +08:00
// console.log(`search ${value}`)
// text.value = value
// systemOptions.value = systemOptions2.value.filter(
// (item) => item.label.search(text.value) > -1
// )
let valueArray = []
systemOptions.value.map((val) => {
valueArray.push(val.value)
})
if (valueArray.indexOf(value) == -1) {
systemOptions.value.push({
value: value,
label: value,
})
}
2022-07-04 11:56:45 +08:00
}
pageWithAttrs({
pageNum: 1,
pageSize: 99999,
type: '应用资源',
name: '',
infoList: [],
}).then((res) => {
if (res.data.code == 0) {
if (res.data.data.records.length == 0) {
message.warning('该关键词,暂无应用资源!')
} else {
res.data.data.records.map((val) => {
systemOptions2.value.push({
value: val.name,
label: val.name,
})
2022-06-29 17:28:49 +08:00
})
2022-07-04 11:56:45 +08:00
// console.log('第一次获取===================>', systemOptions2.value)
2022-06-29 17:28:49 +08:00
}
2022-07-04 11:56:45 +08:00
} else {
message.error('应用系统获取数据失败!')
}
})
2022-06-29 17:28:49 +08:00
const handleBlur = () => {
console.log('blur')
}
const handleFocus = () => {
console.log('focus')
2022-07-04 11:56:45 +08:00
// console.log(formName.applicationSystem)
// formName.applicationSystem = []
2022-08-15 18:06:34 +08:00
let arrId = []
for (var valueIndex of systemOptions2.value) {
if (arrId.indexOf(valueIndex['value']) == -1) {
arrId.push(valueIndex['value'])
systemOptions.value.push(valueIndex)
}
}
// systemOptions.value = systemOptions2.value
2022-07-04 11:56:45 +08:00
// systemOptions.value = []
}
2022-06-29 17:28:49 +08:00
// const filterOption = (input, option) => {
// return option.value.toLowerCase().indexOf(input.toLowerCase()) >= 0
// }
2022-06-23 19:19:48 +08:00
onBeforeUnmount(() => {
mybus.off('reomveOldData')
})
2022-06-14 09:32:49 +08:00
return {
formRef,
formName,
instanceIdUrl,
formUrl,
processStartHandle,
resetFields,
startProcess,
options,
fileList,
2022-06-28 21:49:50 +08:00
list,
2022-06-14 09:32:49 +08:00
headers: {
authorization: 'authorization-text',
},
handleChange,
applySuccess,
disabled,
2022-06-23 19:19:48 +08:00
baseURL,
2022-06-14 09:32:49 +08:00
beforeUpload,
2022-06-23 19:19:48 +08:00
dataList,
2022-06-29 17:28:49 +08:00
systemHandleChange,
systemHandleSearch,
handleBlur,
handleFocus,
systemOptions,
applicationSceneOpthion,
2022-07-18 14:43:24 +08:00
flag,
2022-07-18 17:26:18 +08:00
applyAll,
2022-06-14 09:32:49 +08:00
}
},
}
</script>
<style scoped lang="less">
2022-07-22 15:46:13 +08:00
#apply-container {
// background-color: #f5f8fc;
height: 100%;
width: 100%;
margin: 0.8rem auto 0;
2022-06-14 09:32:49 +08:00
display: flex;
justify-content: space-between;
2022-07-22 15:46:13 +08:00
aside {
width: 282px;
height: 96%;
overflow-y: auto;
background-color: #fff;
margin: 1% 0 3%;
}
article {
width: 1090px;
height: 99%;
overflow-y: auto;
background-color: #fff;
margin: 1% auto;
2022-06-14 09:32:49 +08:00
}
2022-07-22 15:46:13 +08:00
.form-container {
padding: 20px 20px 30px 20px;
.title {
font-size: 20px;
color: #000;
font-weight: bold;
margin-bottom: 20px;
2022-06-14 09:32:49 +08:00
}
2022-07-22 15:46:13 +08:00
}
.base-info {
display: flex;
justify-content: space-between;
}
:deep(.ant-form-item-label) {
label {
color: #666;
font-size: 16px;
&::after {
content: '';
}
}
}
:deep(.ant-form-item-required) {
&::before {
font-size: 8px;
margin-right: 10px;
}
2022-06-14 09:32:49 +08:00
}
2022-07-22 15:46:13 +08:00
:deep(.ant-input) {
border: 1px solid #e0e0e0;
border-radius: 6px;
}
.success {
div {
width: 100px;
margin: 80px auto 40px;
}
text-align: center;
font-size: 20px;
font-weight: bold;
2022-07-22 15:46:13 +08:00
color: #000;
}
}
2022-07-22 15:46:13 +08:00
.applicationScene {
:deep(.ant-select-selector) {
overflow-x: scroll;
2022-06-29 17:28:49 +08:00
}
2022-07-22 15:46:13 +08:00
:deep(.ant-select-selection-overflow) {
flex-wrap: nowrap;
}
}
2022-07-22 15:46:13 +08:00
textarea {
resize: none;
font-size: 14px;
}
2022-07-22 15:46:13 +08:00
.bottom-btn {
display: flex;
justify-content: center;
// position: fixed;
2022-07-04 11:56:45 +08:00
}
</style>