上架技术文档

This commit is contained in:
851673013@qq.com 2022-07-12 15:58:57 +08:00
parent b7b0a14b86
commit 616d806c2d
7 changed files with 798 additions and 544 deletions

View File

@ -231,3 +231,11 @@ export function queryResourceRelByKeyId(params) {
params,
})
}
//
export function filesUpload(data) {
return request({
url: window.SITE_CONFIG.apiURL + '/upload',
method: 'post',
data,
})
}

View File

@ -99,6 +99,7 @@
import mybus from '@/myplugins/mybus'
const showView = ref('基本信息')
const router = useRouter()
let shiyongshouce = ref({})
const navList = ref([])
const navList2 = ref([])
const fileList = ref({})
@ -285,7 +286,9 @@
}
init()
mybus.on('chageDataFrom', (obj) => {
console.log(obj, dataFrom.value.infoList)
if (obj.attrType == '使用手册' && obj.attrValue != null) {
shiyongshouce.value = obj
}
dataFrom.value.infoList = dataFrom.value.infoList.filter(
(item) => item.attrType !== obj.attrType
)
@ -293,6 +296,14 @@
obj.attrValue = ''
}
dataFrom.value.infoList.push(obj)
if (shiyongshouce.value.attrValue) {
dataFrom.value.infoList.map((syscitem, syscindex) => {
if (syscitem.attrType == '使用手册') {
dataFrom.value.infoList[syscindex] = shiyongshouce.value
}
})
}
console.log('数据变更=================》', obj, dataFrom.value.infoList)
})
mybus.on('chageFileList', (obj) => {
fileList.value = obj

View File

@ -173,6 +173,7 @@
],
},
])
let shiyongshouce = ref({})
const navList = ref([])
const navList2 = ref([])
const fileList = ref({})
@ -297,6 +298,9 @@
}
init()
mybus.on('chageDataFrom', (obj) => {
if (obj.attrType == '使用手册' && obj.attrValue != null) {
shiyongshouce.value = obj
}
dataFrom.value.infoList = dataFrom.value.infoList.filter(
(item) => item.attrType !== obj.attrType
)
@ -304,6 +308,13 @@
obj.attrValue = ''
}
dataFrom.value.infoList.push(obj)
if (shiyongshouce.value.attrValue) {
dataFrom.value.infoList.map((syscitem, syscindex) => {
if (syscitem.attrType == '使用手册') {
dataFrom.value.infoList[syscindex] = shiyongshouce.value
}
})
}
console.log('数据变更=================》', obj, dataFrom.value.infoList)
})
mybus.on('chageFileList', (obj) => {

View File

@ -173,6 +173,7 @@
],
},
])
let shiyongshouce = ref({})
const navList = ref([])
const navList2 = ref([])
const fileList = ref({})
@ -297,6 +298,9 @@
}
init()
mybus.on('chageDataFrom', (obj) => {
if (obj.attrType == '使用手册' && obj.attrValue != null) {
shiyongshouce.value = obj
}
dataFrom.value.infoList = dataFrom.value.infoList.filter(
(item) => item.attrType !== obj.attrType
)
@ -304,6 +308,13 @@
obj.attrValue = ''
}
dataFrom.value.infoList.push(obj)
if (shiyongshouce.value.attrValue) {
dataFrom.value.infoList.map((syscitem, syscindex) => {
if (syscitem.attrType == '使用手册') {
dataFrom.value.infoList[syscindex] = shiyongshouce.value
}
})
}
console.log('数据变更=================》', obj, dataFrom.value.infoList)
})
mybus.on('chageFileList', (obj) => {

View File

@ -0,0 +1,68 @@
<!--
* @Author: hisense.wuhongjian
* @Date: 2022-04-19 17:18:48
* @LastEditors: hisense.wuhongjian
* @LastEditTime: 2022-05-06 19:11:32
* @Description: markdown编辑器
-->
<template>
<editor
v-model="text"
:iconfontJs="iconfontJs"
pageFullScreen
@save="saveText"
></editor>
</template>
<script setup>
import { defineComponent, ref, defineProps } from 'vue'
import { message } from 'ant-design-vue'
import Editor from 'md-editor-v3'
import { pinyin } from 'pinyin-pro'
// import FileSaver from 'file-saver'
import 'md-editor-v3/lib/style.css'
import * as fontJs from '/public/static/js/font.js'
import { filesUpload } from '@/api/personalCenter'
import mybus from '@/myplugins/mybus'
let text = ''
let iconfontJs = fontJs
const props = defineProps({
data: { type: Array, default: null },
})
function saveText(file) {
const blob = new Blob([file], {
type: 'md',
})
let myfile = new File([blob], '技术文档.md')
var formData = new FormData()
const type = pinyin('技术文档', {
pattern: 'initial',
}).replace(/\s*/g, '')
formData.append('fileName', '技术文档' + '.md')
formData.append('type', type)
formData.append('file', myfile) // 'file' HTTP Post, file File
// formData.append('name', this.route.currentRoute.query.id + '.md')
// FileSaver.saveAs(blob, '.md')
filesUpload(formData).then((resData) => {
const res = resData
mybus.emit('showTextFunctionEmit', false)
let infoList = ref({
attrType: '使用手册',
attrValue: res.data.data,
delFlag: 0,
})
mybus.emit('chageDataFrom', infoList.value)
console.log('res', res)
if (res.data.code === 0) {
message.success('保存成功')
} else {
message.error('保存失败')
}
})
}
</script>
<style scoped>
.md-fullscreen {
z-index: 10;
}
</style>

View File

@ -121,6 +121,7 @@
],
},
])
let shiyongshouce = ref({})
const navList = ref([])
const navList2 = ref([])
const fileList = ref({})
@ -245,6 +246,9 @@
}
init()
mybus.on('chageDataFrom', (obj) => {
if (obj.attrType == '使用手册' && obj.attrValue != null) {
shiyongshouce.value = obj
}
dataFrom.value.infoList = dataFrom.value.infoList.filter(
(item) => item.attrType !== obj.attrType
)
@ -252,6 +256,13 @@
obj.attrValue = ''
}
dataFrom.value.infoList.push(obj)
if (shiyongshouce.value.attrValue) {
dataFrom.value.infoList.map((syscitem, syscindex) => {
if (syscitem.attrType == '使用手册') {
dataFrom.value.infoList[syscindex] = shiyongshouce.value
}
})
}
console.log('数据变更=================》', obj, dataFrom.value.infoList)
})
mybus.on('chageFileList', (obj) => {

View File

@ -16,14 +16,21 @@
<template v-if="title.isConfigure">
<div class="bottom">
<div class="items" v-if="data[title.name].length > 0">
<div class="item" v-for="(val, index) in data[title.name]" :key="'key1' + val.name + index">
<div
class="item"
v-for="(val, index) in data[title.name]"
:key="'key1' + val.name + index"
>
<p>
<span>{{ title.name }}-{{ index + 1 }}</span>
<span></span>
</p>
<p v-for="attr in props.configure.filter(
<p
v-for="attr in props.configure.filter(
(item, index2) => item.name === title.name
)[0].list" :key="'key2' + attr.name + index2">
)[0].list"
:key="'key2' + attr.name + index2"
>
<span>{{ attr.name }}</span>
<span v-if="attr.type === 'image'">
<a-image :width="85" :height="60" :src="val.img" />
@ -37,19 +44,51 @@
</div>
</div>
<div class="add">添加更多{{ title.name }}</div>
<div class="form" v-for="(val, index) in props.configure.filter(
<div
class="form"
v-for="(val, index) in props.configure.filter(
(item) => item.name === title.name
)[0].list" :key="'key3' + val.name + index">
)[0].list"
:key="'key3' + val.name + index"
>
<span>{{ val.name }}</span>
<a-input v-model:value="val.note1" :maxlength="24" :placeholder="'请填写' + val.name + ',不超过24个字符'"
v-if="val.type == 'input'" />
<a-textarea v-model:value="val.note1" :showCount="true" :maxlength="200" :placeholder="'请填写' + val.name"
v-else-if="val.type == 'textArea'" />
<a-input-number v-model:value="val.note1" :min="0" :max="9999" :step="0.01" string-mode
:placeholder="'请填写' + val.name" v-else-if="val.type == 'number'" />
<a-radio-group v-model:value="val.note1" :options="val.options" v-else-if="val.type == 'radio'" />
<upload :key="showKey" type="图片" btnName="上传图片" :maxCount="1" :data="val" :list="[]" tip="支持图片类型大小不超过100M"
v-else-if="val.type == 'image'"></upload>
<a-input
v-model:value="val.note1"
:maxlength="24"
:placeholder="'请填写' + val.name + ',不超过24个字符'"
v-if="val.type == 'input'"
/>
<a-textarea
v-model:value="val.note1"
:showCount="true"
:maxlength="200"
:placeholder="'请填写' + val.name"
v-else-if="val.type == 'textArea'"
/>
<a-input-number
v-model:value="val.note1"
:min="0"
:max="9999"
:step="0.01"
string-mode
:placeholder="'请填写' + val.name"
v-else-if="val.type == 'number'"
/>
<a-radio-group
v-model:value="val.note1"
:options="val.options"
v-else-if="val.type == 'radio'"
/>
<upload
:key="showKey"
type="图片"
btnName="上传图片"
:maxCount="1"
:data="val"
:list="[]"
tip="支持图片类型大小不超过100M"
v-else-if="val.type == 'image'"
></upload>
</div>
<div class="submit">
<a-button type="primary" @click="add(title.name)">提交</a-button>
@ -60,59 +99,143 @@
<div class="bottom">
<div class="form" v-for="item in title.children" :key="item.id">
<span>{{ item.name }}</span>
<a-input v-if="item.type == 'input'" v-model:value="item.note1" :placeholder="'请输入' + item.name" />
<a-radio-group v-else-if="item.type == 'radio'" v-model:value="item.note1" :options="item.options" />
<a-input v-else-if="item.type == 'text'" v-model:value="item.note1" :placeholder="'请输入' + item.name"
:disabled="true" />
<a-input v-else-if="item.type == 'text2'" v-model:value="item.note1" :placeholder="'请输入' + item.name"
:disabled="true" />
<a-textarea v-else-if="item.type == 'textArea'" v-model:value="item.note1" :showCount="true"
:maxlength="200" :placeholder="'请输入' + item.name" />
<upload v-else-if="item.type == 'image'" type="图片" btnName="上传图片" :maxCount="1" :data="item"
:list="props.imgList" tip="支持图片类型大小不超过100M"></upload>
<upload v-else-if="item.type == 'file' && item.name !== '使用手册'" type="文件" btnName="上传附件" :maxCount="1"
:data="item" :list="props.fileList" tip="支持文件类型大小不超过100M"></upload>
<upload v-else-if="item.name == '使用手册'" type="文件" btnName="上传附件" :maxCount="1" :data="item" :busType="2"
:list="props.fileList2" tip="支持文件类型大小不超过100M"></upload>
<upload v-else-if="item.type == 'video'" type="视频" btnName="上传视频" :maxCount="1" :data="item"
:list="props.videoList" tip="支持视频类型大小不超过100M"></upload>
<a-input
v-if="item.type == 'input'"
v-model:value="item.note1"
:placeholder="'请输入' + item.name"
/>
<a-radio-group
v-else-if="item.type == 'radio'"
v-model:value="item.note1"
:options="item.options"
/>
<a-input
v-else-if="item.type == 'text'"
v-model:value="item.note1"
:placeholder="'请输入' + item.name"
:disabled="true"
/>
<a-input
v-else-if="item.type == 'text2'"
v-model:value="item.note1"
:placeholder="'请输入' + item.name"
:disabled="true"
/>
<a-textarea
v-else-if="item.type == 'textArea'"
v-model:value="item.note1"
:showCount="true"
:maxlength="200"
:placeholder="'请输入' + item.name"
/>
<upload
v-else-if="item.type == 'image'"
type="图片"
btnName="上传图片"
:maxCount="1"
:data="item"
:list="props.imgList"
tip="支持图片类型大小不超过100M"
></upload>
<upload
v-else-if="item.type == 'file' && item.name !== '使用手册'"
type="文件"
btnName="上传附件"
:maxCount="1"
:data="item"
:list="props.fileList"
tip="支持文件类型大小不超过100M"
></upload>
<div
v-else-if="item.name == '使用手册'"
@click="showTextFunction()"
>
上传附件
</div>
<upload
v-else-if="item.type == 'video'"
type="视频"
btnName="上传视频"
:maxCount="1"
:data="item"
:list="props.videoList"
tip="支持视频类型大小不超过100M"
></upload>
<a-button v-else-if="item.type == 'dialog'" @click="sourceClick">
请选择来源应用
</a-button>
<a-button v-else-if="item.type == 'dialog2'" @click="componentsClick">
<a-button
v-else-if="item.type == 'dialog2'"
@click="componentsClick"
>
请选择关联组件
</a-button>
<a-select v-else-if="item.type == 'select'" style="width: 240px" v-model:value="item.note1"
:placeholder="'请选择' + item.name">
<a-select-option v-for="(itemSelect, indexSelect) in item.options" :key="indexSelect"
:value="itemSelect.dictLabel">
<a-select
v-else-if="item.type == 'select'"
style="width: 240px"
v-model:value="item.note1"
:placeholder="'请选择' + item.name"
>
<a-select-option
v-for="(itemSelect, indexSelect) in item.options"
:key="indexSelect"
:value="itemSelect.dictLabel"
>
{{ itemSelect.dictLabel }}
</a-select-option>
</a-select>
<div v-else-if="item.type == 'checkBox'" class="application-Area" id="application-Area" :key="showKey">
<div v-for="(itemson, indexson) in item.options" :key="indexson" class="application-Area-son"
@click="ApplicationArea(item, itemson)" :class="
<div
v-else-if="item.type == 'checkBox'"
class="application-Area"
id="application-Area"
:key="showKey"
>
<div
v-for="(itemson, indexson) in item.options"
:key="indexson"
class="application-Area-son"
@click="ApplicationArea(item, itemson)"
:class="
item.note2.indexOf(itemson.dictLabel) != -1
? 'application-Area-down'
: ''
">
"
>
{{ itemson.dictLabel }}
</div>
</div>
</div>
<div class="AssociatedApplication">
<a-modal v-model:visible="visibleAssociatedApplication" :title="titleName" @ok="handleOk"
@cancel="handleCancel" style="width: 960px">
<a-modal
v-model:visible="visibleAssociatedApplication"
:title="titleName"
@ok="handleOk"
@cancel="handleCancel"
style="width: 960px"
>
<div>
<a-transfer v-model:target-keys="targetKeys" v-model:selected-keys="selectedKeys"
:data-source="mockData" :titles="titles" :render="(item) => item.title" @change="handleChange"
@selectChange="handleSelectChange" />
<a-transfer
v-model:target-keys="targetKeys"
v-model:selected-keys="selectedKeys"
:data-source="mockData"
:titles="titles"
:render="(item) => item.title"
@change="handleChange"
@selectChange="handleSelectChange"
/>
</div>
</a-modal>
</div>
</div>
</template>
</div>
<div
v-show="showText"
class="fuwenbenbianjiqi"
style="width: 100px; height: 100px; z-index: 10000"
>
<VueTemplateDemo></VueTemplateDemo>
</div>
</div>
</template>
<script setup>
@ -124,9 +247,10 @@ import {
getCategoryTreePage,
queryApplicationRelByResourceId,
queryResourceRelByKeyId,
filesUpload,
} from '@/api/personalCenter'
import VueTemplateDemo from '@/views/capacityOnTheShelf/FilesUpload.vue'
import { useRouter } from 'vue-router'
const router = useRouter()
const abilityToType = router.currentRoute.value.query.abilityToType
const componentTypeValue = router.currentRoute.value.query.componentTypeValue
@ -275,6 +399,16 @@ if (props.dataFrom) {
}
})
}
//
let showText = ref(false)
const showTextFunction = () => {
showText.value = true
}
mybus.on('showTextFunctionEmit', (show) => {
console.log('ssdcsd')
showText.value = show
})
mybus.off('func')
const add = (title) => {
console.log(title, 'title')
let list = props.configure.filter((item) => item.name === title)[0].list