yujialong 2 years ago
parent fe898632d4
commit ff78ab0a19
  1. 171
      src/assets/css/main.css
  2. 4
      src/setting.js
  3. 1
      src/utils/api.js
  4. 52
      src/views/order/AddOrder.vue
  5. 362
      src/views/serve/addModel.vue
  6. 578
      src/views/serve/backstage/model.vue
  7. 550
      src/views/serve/backstage/modelType.vue
  8. 385
      src/views/serve/backstage/sourceModel.vue
  9. 331
      src/views/serve/backstage/sourceType.vue
  10. 46
      src/views/shop/addProduct/index.vue

@ -14,21 +14,20 @@ body,
} }
body { body {
font-family: 'PingFang SC', "Helvetica Neue", Helvetica, "microsoft yahei", arial, STHeiTi, sans-serif; font-family: 'PingFang SC', 'Helvetica Neue', Helvetica, 'microsoft yahei', arial, STHeiTi, sans-serif;
font-size: 14px; font-size: 14px;
} }
a { a {
text-decoration: none text-decoration: none;
} }
i{ i {
font-style: normal; font-style: normal;
} }
li { li {
list-style-type:none; list-style-type: none;
} }
::-webkit-scrollbar { ::-webkit-scrollbar {
width: 8px; width: 8px;
height: 8px; height: 8px;
@ -40,23 +39,23 @@ li {
background: #d7d7d7; background: #d7d7d7;
} }
.flex { .flex {
display: flex; display: flex;
} }
.j-between { .j-between {
justify-content: space-between; justify-content: space-between;
} }
.a-center { .a-center {
align-items: center; align-items: center;
} }
.m-b-10 { .m-b-10 {
margin-bottom: 10px; margin-bottom: 10px;
} }
.el-table th>.cell { .el-table th > .cell {
font-size: 14px; font-size: 14px;
} }
.content-box { .content-box {
-webkit-transition: left .3s ease-in-out; -webkit-transition: left 0.3s ease-in-out;
transition: left .3s ease-in-out; transition: left 0.3s ease-in-out;
background: #f0f0f0; background: #f0f0f0;
flex: 1; flex: 1;
} }
@ -86,9 +85,9 @@ li {
color: #585858; color: #585858;
border-left: 3px solid #9278ff; border-left: 3px solid #9278ff;
} }
.el-upload-list{ .el-upload-list {
width: 100%; width: 100%;
max-width: 400px; max-width: 400px;
} }
.page { .page {
position: relative; position: relative;
@ -115,7 +114,7 @@ li {
margin-right: 6px; margin-right: 6px;
font-size: 14px; font-size: 14px;
line-height: 14px; line-height: 14px;
color: rgba(0, 0, 0, .65); color: rgba(0, 0, 0, 0.65);
white-space: nowrap; white-space: nowrap;
} }
@ -123,7 +122,7 @@ li {
display: flex; display: flex;
align-items: center; align-items: center;
padding: 0 24px; padding: 0 24px;
border-bottom: 1px solid rgba(0, 0, 0, .06); border-bottom: 1px solid rgba(0, 0, 0, 0.06);
} }
.tabs .item { .tabs .item {
position: relative; position: relative;
@ -169,7 +168,7 @@ li {
margin-bottom: 20px; margin-bottom: 20px;
} }
.el-button+.el-tooltip { .el-button + .el-tooltip {
margin-left: 10px; margin-left: 10px;
} }
@ -177,14 +176,14 @@ li {
background: #f6faff; background: #f6faff;
} }
.orderTable td .el-input{ .orderTable td .el-input {
width: 60%; width: 60%;
} }
.orderTable td .normal{ .orderTable td .normal {
width: 90%; width: 90%;
} }
.orderTable .el-select>.el-input{ .orderTable .el-select > .el-input {
display: inline-block; display: inline-block;
} }
@ -198,7 +197,7 @@ li {
.move-enter-active, .move-enter-active,
.move-leave-active { .move-leave-active {
transition: opacity .5s; transition: opacity 0.5s;
} }
.move-enter, .move-enter,
@ -294,159 +293,157 @@ li {
min-height: 500px; min-height: 500px;
} }
.ms-login .el-tabs__nav-wrap::after{ .ms-login .el-tabs__nav-wrap::after {
background-color: #fff; background-color: #fff;
opacity: 0; opacity: 0;
} }
.ms-login .el-tabs__item{ .ms-login .el-tabs__item {
padding: 0 90px; padding: 0 90px;
color: #999; color: #999;
} }
.ms-login .el-tabs__item:hover{ .ms-login .el-tabs__item:hover {
color: #000; color: #000;
} }
.ms-login .el-tabs__item.is-active{ .ms-login .el-tabs__item.is-active {
color: #333; color: #333;
font-weight: bold; font-weight: bold;
} }
.ms-login .el-tabs__active-bar{ .ms-login .el-tabs__active-bar {
background-color: #000; background-color: #000;
border-radius:2px; border-radius: 2px;
} }
.ms-login .el-tabs__nav-scroll{ .ms-login .el-tabs__nav-scroll {
display: flex; display: flex;
justify-content: center; justify-content: center;
} }
.ms-login .el-input__inner{ .ms-login .el-input__inner {
height: 80px; height: 80px;
line-height: 80px; line-height: 80px;
border:1px solid rgba(220,220,220,1); border: 1px solid rgba(220, 220, 220, 1);
border-radius:2px; border-radius: 2px;
} }
.el-row { .el-row {
margin-bottom: 20px; margin-bottom: 20px;
} }
#app .el-table thead{ #app .el-table thead {
color: #fff; color: #fff;
} }
#app .el-table th{ #app .el-table th {
background-color: #9278FF!important; background-color: #9278ff !important;
font-size: 16px; font-size: 16px;
font-weight: normal; font-weight: normal;
} }
.el-input__inner[type=number] { .el-input__inner[type='number'] {
padding-right: 0; padding-right: 0;
} }
/*flex*/ /*flex*/
.flex-center{ .flex-center {
display: flex; display: flex;
align-items: center; align-items: center;
} }
.flex-c-c{ .flex-c-c {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
} }
.flex-between{ .flex-between {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
} }
.flex-around{ .flex-around {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: space-around; justify-content: space-around;
} }
.flex-start-around{ .flex-start-around {
display: flex; display: flex;
align-items: flex-start; align-items: flex-start;
justify-content: center; justify-content: center;
} }
.flex-end-around{ .flex-end-around {
display: flex; display: flex;
align-items: flex-end; align-items: flex-end;
justify-content: center; justify-content: center;
} }
.flex-column{ .flex-column {
display: flex; display: flex;
align-items: center; align-items: center;
flex-direction: column; flex-direction: column;
} }
.flex-start{ .flex-start {
display: flex; display: flex;
align-items: flex-start; align-items: flex-start;
} }
.hr_tag{ .hr_tag {
background-color: #9278FF; background-color: #9278ff;
width: 3px; width: 3px;
height: 15px; height: 15px;
margin-right: 5px; margin-right: 5px;
} }
.user_header{ .user_header {
padding: 20px 0; padding: 20px 0;
border-bottom: 1px dashed #eee; border-bottom: 1px dashed #eee;
} }
.border-b-dashed{ .border-b-dashed {
border-bottom: 1px dashed #e3e3e3; border-bottom: 1px dashed #e3e3e3;
width: 100%; width: 100%;
height: 1px; height: 1px;
margin-bottom: 20px; margin-bottom: 20px;
} }
.shadow{ .shadow {
border: 0.0625rem solid #EBEEF5; border: 0.0625rem solid #ebeef5;
background-color: #FFF; background-color: #fff;
color: #303133; color: #303133;
-webkit-transition: .3s; -webkit-transition: 0.3s;
transition: .3s; transition: 0.3s;
} }
.shadow :hover{ .shadow :hover {
box-shadow: 0 0.125rem 0.75rem 0 rgb(0 0 0 / 10%); box-shadow: 0 0.125rem 0.75rem 0 rgb(0 0 0 / 10%);
} }
.flex-col{ .flex-col {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
} }
.addhr_tag{ .addhr_tag {
background-color: #666; background-color: #666;
width: 6px; width: 6px;
height: 17px; height: 17px;
margin-right: 5px; margin-right: 5px;
} }
.per_title span{ .per_title span {
font-size: 16px; font-size: 16px;
font-weight: bold; font-weight: bold;
} }
.per_back{ .per_back {
margin-left: 5px; margin-left: 5px;
} }
.per_school{ .per_school {
margin-left: 30px; margin-left: 30px;
} }
.per_title:hover{ .per_title:hover {
cursor:pointer; cursor: pointer;
} }
/* 溢出省略号 */ /* 溢出省略号 */
.ellipsis{ .ellipsis {
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
white-space: nowrap; white-space: nowrap;
} }
.userRadio .el-radio{ .userRadio .el-radio {
margin-right: 10px!important; margin-right: 10px !important;
} }
.userRadio .el-radio__input{ .userRadio .el-radio__input {
display: none!important; display: none !important;
} }
.cursor { .cursor {
cursor: pointer; cursor: pointer;
@ -455,39 +452,39 @@ li {
font-size: 12px; font-size: 12px;
} }
.m-b-20 { .m-b-20 {
margin-bottom: 20px; margin-bottom: 20px;
} }
.m-r-10 { .m-r-10 {
margin-right: 10px; margin-right: 10px;
} }
@media (max-width: 720px) { @media (max-width: 720px) {
.el-message { .el-message {
min-width: auto !important; min-width: auto !important;
width: 85%; width: 85%;
} }
} }
.el-tooltip__popper { .el-tooltip__popper {
max-width: 500px !important; max-width: 500px !important;
} }
.no-atTheMoment > .el-picker-panel__footer > .el-button--text:first-child{ .no-atTheMoment > .el-picker-panel__footer > .el-button--text:first-child {
display: none; display: none;
} }
.tox-notifications-container { .tox-notifications-container {
display: none; display: none;
} }
.mce-content-body:not([dir=rtl]) blockquote { .mce-content-body:not([dir='rtl']) blockquote {
border-left: 0; border-left: 0;
background-color: #ccc; background-color: #ccc;
} }
.search-wrap { .search-wrap {
display: flex; display: flex;
} }
.search-wrap .el-select { .search-wrap .el-select {
width: 140px; width: 140px;
} }
.search-wrap .keyword .el-input__inner { .search-wrap .keyword .el-input__inner {
border-left: 0; border-left: 0;
} }
.search-wrap .el-input__inner { .search-wrap .el-input__inner {
border-radius: 0; border-radius: 0;
} }

@ -11,8 +11,8 @@ if (isDev) {
jumpPath = 'http://192.168.31.125:8087/' // 本地调试-需要启动本地判分点系统 jumpPath = 'http://192.168.31.125:8087/' // 本地调试-需要启动本地判分点系统
host = 'http://121.37.12.51/' host = 'http://121.37.12.51/'
// host = 'https://huorantech.cn/' // host = 'https://huorantech.cn/'
// host = 'http://192.168.31.151:9000/'// 榕 host = 'http://192.168.31.152:9000/'// 榕
host = 'http://192.168.31.53:9000/'// 赓 // host = 'http://192.168.31.53:9000/'// 赓
} else if (isPro) { } else if (isPro) {
jumpPath = 'https://www.huorantech.cn/judgmentPoint/' jumpPath = 'https://www.huorantech.cn/judgmentPoint/'
} }

@ -125,6 +125,7 @@ export default {
updateSysModelDemo: `nakadai/nakadai/model/demo/updateSysModelDemo`, updateSysModelDemo: `nakadai/nakadai/model/demo/updateSysModelDemo`,
runPythonCode: `nakadai/nakadai/model/demo/runPythonCode`, runPythonCode: `nakadai/nakadai/model/demo/runPythonCode`,
getAllModelListBySys: `nakadai/nakadai/model/demo/getAllModelListBySys`, getAllModelListBySys: `nakadai/nakadai/model/demo/getAllModelListBySys`,
InstitutionSourceModel: `nakadai/nakadai/model/demo/InstitutionSourceModel`,
// 课程管理三级联查 // 课程管理三级联查
courseDiscipline: `nakadai/nakadai/subject/courseDiscipline`, //课程学科类别 courseDiscipline: `nakadai/nakadai/subject/courseDiscipline`, //课程学科类别

@ -1666,8 +1666,14 @@
<el-dialog title="发货信息填写" <el-dialog title="发货信息填写"
:visible.sync="shipVisible" :visible.sync="shipVisible"
width="380px" width="380px"
class="dialog" class="ship-dia"
:close-on-click-modal="false"> :close-on-click-modal="false">
<!-- <div v-if="curRow.mallNonAssociatedLinks"
class="ship">
<p class="line"
v-for="(link, i) in curRow.mallNonAssociatedLinks"
:key="i">{{ link.urlName }}{{ link.url }}</p>
</div> -->
<el-input :disabled="viewDisabled" <el-input :disabled="viewDisabled"
v-model="shipContent" v-model="shipContent"
placeholder="请填写需交付的产品登录地址、账号、密码等内容...(300个字以内)" placeholder="请填写需交付的产品登录地址、账号、密码等内容...(300个字以内)"
@ -1676,7 +1682,19 @@
maxlength="300"></el-input> maxlength="300"></el-input>
<span slot="footer" <span slot="footer"
class="dialog-footer"> class="dialog-footer">
<el-button @click="shipVisible = false">取消</el-button> <el-popover v-if="curRow.mallNonAssociatedLinks"
placement="bottom"
width="200"
trigger="click">
<div class="cursor"
v-html="shipInfo"
title="点击复制到文本框"
@click="copyLink"></div>
<el-button type="text"
slot="reference">产品链接</el-button>
</el-popover>
<el-button style="margin-left: 10px"
@click="shipVisible = false">取消</el-button>
<el-button v-if="!viewDisabled" <el-button v-if="!viewDisabled"
type="primary" type="primary"
@click="submitShip">确定</el-button> @click="submitShip">确定</el-button>
@ -1903,6 +1921,7 @@ export default {
rate: '', rate: '',
shipVisible: false, shipVisible: false,
shipContent: '', shipContent: '',
shipInfo: '',
curRow: {}, curRow: {},
// 1 2 3 45 6 // 1 2 3 45 6
classificationId: 0, classificationId: 0,
@ -2569,6 +2588,7 @@ export default {
options: 1, options: 1,
settlementPrice: orderType === 2 ? 0 : '', // settlementPrice: orderType === 2 ? 0 : '', //
settlementPriceUnit: e.settlementPrice || 0, // settlementPriceUnit: e.settlementPrice || 0, //
mallNonAssociatedLinks: e.mallNonAssociatedLinks //
}) })
}; };
const productId = [] const productId = []
@ -2830,9 +2850,27 @@ export default {
// //
showShip (row) { showShip (row) {
this.curRow = row this.curRow = row
this.shipContent = row.shipContent let val = ''
row.mallNonAssociatedLinks.forEach(e => {
val += e.urlName + ':' + e.url + '\n'
})
this.shipInfo = val
this.shipContent = row.shipContent || val
this.shipVisible = true this.shipVisible = true
}, },
copyLink () {
// const oInput = document.createElement('input')
// oInput.value = this.shipInfo
// document.body.appendChild(oInput)
// oInput.select()
// document.execCommand('Copy')
// this.$message({
// message: '',
// type: 'success'
// })
// oInput.remove()
this.shipContent += this.shipInfo
},
// //
submitShip () { submitShip () {
this.curRow.shipContent = this.shipContent this.curRow.shipContent = this.shipContent
@ -3109,4 +3147,12 @@ export default {
text-overflow: ellipsis; text-overflow: ellipsis;
white-space: nowrap; white-space: nowrap;
} }
/deep/.ship-dia {
.el-dialog__body {
padding: 0 20px;
}
.ship {
cursor: pointer;
}
}
</style> </style>

@ -1,194 +1,208 @@
<template> <template>
<div class="wrap"> <div class="wrap">
<el-card shadow="hover" class="mgb20"> <el-card shadow="hover"
<div class="flex-between"> class="mgb20">
<div class="per_title" v-preventReClick @click="back"> <div class="flex-between">
<i class="el-icon-arrow-left"></i> <div class="per_title"
<span class="per_back">返回</span> v-preventReClick
<span class="per_school" v-text="isDetail ? '查看源模型' : (id ? '编辑源模型' : '新增源模型')"></span> @click="back">
</div> <i class="el-icon-arrow-left"></i>
<div v-if="!isDetail"> <span class="per_back">返回</span>
<el-button type="primary" round v-preventReClick @click="submit(1)">发布</el-button> <span class="per_school"
<el-button v-if="!postStatus" type="primary" round v-preventReClick @click="submit(0)">草稿</el-button> v-text="isDetail ? '查看源模型' : (id ? '编辑源模型' : '新增源模型')"></span>
</div> </div>
</div> <div v-if="!isDetail">
</el-card> <el-button type="primary"
round
v-preventReClick
@click="submit(1)">发布</el-button>
<el-button v-if="!postStatus"
type="primary"
round
v-preventReClick
@click="submit(0)">草稿</el-button>
</div>
</div>
</el-card>
<el-card shadow="hover"> <el-card shadow="hover">
<el-form label-width="80px" :disabled="isDetail"> <el-form label-width="80px"
<div class="item name"> :disabled="isDetail">
<label>模型名称</label> <div class="item name">
<el-input placeholder="请输入模型名称" v-model="form.modelName" maxlength="25" style="width: 400px"></el-input> <label>模型名称</label>
</div> <el-input placeholder="请输入模型名称"
<div class="item name"> v-model="form.modelName"
<label>模型分类</label> maxlength="25"
<el-cascader style="width: 400px"></el-input>
:options="categoryList" </div>
v-model="categoryIdCus" <div class="item name">
:props="categoryProps" <label>模型分类</label>
clearable <el-cascader :options="categoryList"
> v-model="categoryIdCus"
</el-cascader> :props="categoryProps"
</div> clearable>
<div class="item code"> </el-cascader>
<label>模型代码</label> </div>
<codemirror <div class="item code">
:key="codeKey" <label>模型代码</label>
:code.sync="form.modelDemo" <codemirror :key="codeKey"
:readOnly="isDetail" :code.sync="form.modelDemo"
></codemirror> :readOnly="isDetail"></codemirror>
</div> </div>
</el-form> </el-form>
</el-card> </el-card>
</div> </div>
</template> </template>
<script> <script>
import codemirror from '@/components/codemirror' import codemirror from '@/components/codemirror'
export default { export default {
components:{ codemirror }, components: { codemirror },
data() { data () {
return { return {
categoryId : Number(this.$route.query.categoryId), categoryId: Number(this.$route.query.categoryId),
id : Number(this.$route.query.id), id: Number(this.$route.query.id),
postStatus : Number(this.$route.query.postStatus), postStatus: Number(this.$route.query.postStatus),
isDetail : Boolean(this.$route.query.show), // isDetail: Boolean(this.$route.query.show), //
isModel : Boolean(this.$route.query.model), // isModel: Boolean(this.$route.query.model), //
categoryIdCus: [], categoryIdCus: [],
form: {
modelName: '',
modelDemo: ''
},
categoryList: [],
categoryProps: {
checkStrictly: true,
label: 'categoryName',
value: 'id'
},
codeKey: 1,
submiting: false,
updateTime: 0
};
},
watch: {
// ,
form: { form: {
handler(){ modelName: '',
this.updateTime++ modelDemo: ''
}, },
deep:true categoryList: [],
categoryProps: {
checkStrictly: true,
label: 'categoryName',
value: 'id'
}, },
codeKey: 1,
submiting: false,
updateTime: 0
};
},
watch: {
// ,
form: {
handler () {
this.updateTime++
},
deep: true
}, },
mounted() { },
this.getType() mounted () {
this.getType()
},
methods: {
//
async getData () {
// /
const res = await this.$post(`${this.api[this.isModel ? 'referenceFindById' : 'modelFindById']}?id=${this.id}`)
const { data } = res
const { modelName, categoryId, modelDemo } = data
this.form = {
modelName,
modelDemo
}
this.handleId(this.categoryList, categoryId)
this.codeKey++
}, },
methods: { // id
// handleId (list, id, parentId = []) {
async getData() { list.map(e => {
// / // idid
const res = await this.$post(`${this.api[this.isModel ? 'referenceFindById' : 'modelFindById']}?id=${this.id}`) if (id === e.id) {
const { data } = res parentId.shift() // id
const { modelName, categoryId, modelDemo } = data this.categoryIdCus = [...parentId, e.id]
this.form = { } else {
modelName, e.children && this.handleId(e.children, id, [...parentId, e.id])
modelDemo }
} })
this.handleId(this.categoryList, categoryId) },
this.codeKey++ //
}, getType () {
// id this.$post(this.api.sourceModelClassification, {
handleId(list, id, parentId = []) { founder: 0
}).then(res => {
const { data } = res
// children
const handleLeaf = list => {
list.map(e => { list.map(e => {
// idid if (e.children.length) {
if (id === e.id) { handleLeaf(e.children)
parentId.shift() // id
this.categoryIdCus = [...parentId, e.id]
} else { } else {
e.children && this.handleId(e.children, id, [...parentId, e.id]) delete e.children
} }
}) })
},
//
getType() {
this.$post(this.api.sourceModelClassification).then(res => {
const { data } = res
// children
const handleLeaf = list => {
list.map(e => {
if (e.children.length) {
handleLeaf(e.children)
} else {
delete e.children
}
})
}
handleLeaf(data)
this.categoryList = data[0].children
if (this.id) {
this.getData()
} else {
this.handleId(data, this.categoryId)
}
}).catch(res => {})
},
//
submit(postStatus, fromBack){
if (this.submiting) return false
const { modelName, categoryId, modelDemo } = this.form
const categoryIdCus = this.categoryIdCus
const id = this.id
if (!modelName) return this.$message.error('请输入模型名称')
if (categoryIdCus[0] === 1) return this.$message.error('请选择模型分类')
if (postStatus) {
if (!modelDemo) return this.$message.error('请输入模型代码')
}
this.submiting = true
const data = {
categoryId: categoryIdCus[categoryIdCus.length - 1],
modelName,
modelDemo,
postStatus
}
if (id) {
data.id = id
this.$post(this.api.updateSysModelDemo, data).then(res => {
this.$message.success('编辑成功')
fromBack || this.$router.back()
}).catch(res => {
this.submiting = false
})
} else {
this.$post(this.api.saveSysModelDemo, data).then(res => {
this.$message.success('新增成功')
fromBack || this.$router.back()
}).catch(res => {
this.submiting = false
})
}
},
//
backPage() {
this.$router.back()
},
//
back() {
const id = this.id
const updateTime = this.updateTime
//
if ((id && updateTime > 1) || (!id && updateTime)) {
this.$confirm(`编辑的内容未保存,是否保存?`, '提示', {
type: 'warning'
}).then(() => {
this.submit(this.postStatus ? 1 : 0, 1)
this.backPage()
}).catch(() => {
this.backPage()
})
} else {
this.backPage()
}
} }
handleLeaf(data)
this.categoryList = data[0].children
if (this.id) {
this.getData()
} else {
this.handleId(data, this.categoryId)
}
}).catch(res => { })
},
//
submit (postStatus, fromBack) {
if (this.submiting) return false
const { modelName, categoryId, modelDemo } = this.form
const categoryIdCus = this.categoryIdCus
const id = this.id
if (!modelName) return this.$message.error('请输入模型名称')
if (categoryIdCus[0] === 1) return this.$message.error('请选择模型分类')
if (postStatus) {
if (!modelDemo) return this.$message.error('请输入模型代码')
}
this.submiting = true
const data = {
categoryId: categoryIdCus[categoryIdCus.length - 1],
modelName,
modelDemo,
postStatus,
founder: 0
}
if (id) {
data.id = id
this.$post(this.api.updateSysModelDemo, data).then(res => {
this.$message.success('编辑成功')
fromBack || this.$router.back()
}).catch(res => {
this.submiting = false
})
} else {
this.$post(this.api.saveSysModelDemo, data).then(res => {
this.$message.success('新增成功')
fromBack || this.$router.back()
}).catch(res => {
this.submiting = false
})
}
},
//
backPage () {
this.$router.back()
},
//
back () {
const id = this.id
const updateTime = this.updateTime
//
if ((id && updateTime > 1) || (!id && updateTime)) {
this.$confirm(`编辑的内容未保存,是否保存?`, '提示', {
type: 'warning'
}).then(() => {
this.submit(this.postStatus ? 1 : 0, 1)
this.backPage()
}).catch(() => {
this.backPage()
})
} else {
this.backPage()
}
} }
}
}; };
</script> </script>

@ -1,281 +1,325 @@
<template> <template>
<div class="wrap"> <div class="wrap">
<div class="side"> <div class="side">
<org ref="tree" @initData="initData" @getData="getData"></org> <org ref="tree"
</div> @initData="initData"
@getData="getData"></org>
<div class="right"> </div>
<h6 class="p-title">筛选</h6>
<div class="tool">
<ul class="filter">
<li>
<el-input placeholder="请输入模型名称" prefix-icon="el-icon-search" v-model.trim="keyword" clearable></el-input>
</li>
</ul>
<div>
<el-button type="primary" round @click="add">导入模型</el-button>
<el-button type="primary" round @click="batchDel">批量移除</el-button>
</div>
</div>
<el-table :data="listData" class="table" ref="table" stripe header-align="center" @selection-change="handleSelectionChange"> <div class="right">
<el-table-column type="selection" width="55" align="center"></el-table-column> <h6 class="p-title">筛选</h6>
<el-table-column type="index" label="序号" width="55" align="center"></el-table-column> <div class="tool">
<el-table-column prop="modelName" label="模型名称" align="center"></el-table-column> <ul class="filter">
<el-table-column v-if="isTopLevel" prop="categoryName" label="分类" width="150" align="center"></el-table-column> <li>
<el-table-column prop="createTime" label="导入时间" align="center"></el-table-column> <el-input placeholder="请输入模型名称"
<el-table-column label="状态" align="center"> prefix-icon="el-icon-search"
<template slot-scope="scope"> v-model.trim="keyword"
{{ scope.row.isOpen ? '禁用' : '启用' }} clearable></el-input>
</template> </li>
</el-table-column> </ul>
<el-table-column label="操作" width="200" align="center"> <div>
<template slot-scope="scope"> <el-button type="primary"
<el-button type="text" @click="show(scope.row)">查看</el-button> round
<el-button type="text" @click="del(scope.row)">移除</el-button> @click="add">导入模型</el-button>
</template> <el-button type="primary"
</el-table-column> round
</el-table> @click="batchDel">批量移除</el-button>
<div class="pagination">
<el-pagination background layout="total, prev, pager, next" :current-page="page" @current-change="handleCurrentChange" :total="total"></el-pagination>
</div>
</div> </div>
</div>
<el-dialog title="请选择需要导入的模型" :visible.sync="modelVisible" width="500px" class="dialog" :close-on-click-modal="false"> <el-table :data="listData"
<div class="model-wrap"> class="table"
<el-tree ref="table"
v-if="modelData.length" stripe
:data="modelData" v-loading="modelLoading" header-align="center"
ref="model" @selection-change="handleSelectionChange">
default-expand-all <el-table-column type="selection"
show-checkbox width="55"
node-key="id" align="center"></el-table-column>
:props="{children: 'children', label: 'categoryName', isLeaf: 'leaf'}"> <el-table-column type="index"
</el-tree> label="序号"
<div class="none" v-else>暂无可导入的模型</div> width="55"
</div> align="center"></el-table-column>
<span slot="footer" class="dialog-footer"> <el-table-column prop="modelName"
<el-button @click="modelVisible = false"> </el-button> label="模型名称"
<el-button type="primary" @click="submit"> </el-button> align="center"></el-table-column>
</span> <el-table-column v-if="isTopLevel"
</el-dialog> prop="categoryName"
label="分类"
width="150"
align="center"></el-table-column>
<el-table-column prop="createTime"
label="导入时间"
align="center"></el-table-column>
<el-table-column label="状态"
align="center">
<template slot-scope="scope">
{{ scope.row.isOpen ? '禁用' : '启用' }}
</template>
</el-table-column>
<el-table-column label="操作"
width="200"
align="center">
<template slot-scope="scope">
<el-button type="text"
@click="show(scope.row)">查看</el-button>
<el-button type="text"
@click="del(scope.row)">移除</el-button>
</template>
</el-table-column>
</el-table>
<div class="pagination">
<el-pagination background
layout="total, prev, pager, next"
:current-page="page"
@current-change="handleCurrentChange"
:total="total"></el-pagination>
</div>
</div> </div>
<el-dialog title="请选择需要导入的模型"
:visible.sync="modelVisible"
width="500px"
class="dialog"
:close-on-click-modal="false">
<div class="model-wrap">
<el-tree v-if="modelData.length"
:data="modelData"
v-loading="modelLoading"
ref="model"
default-expand-all
show-checkbox
node-key="id"
:props="{children: 'children', label: 'categoryName', isLeaf: 'leaf'}">
</el-tree>
<div class="none"
v-else>暂无可导入的模型</div>
</div>
<span slot="footer"
class="dialog-footer">
<el-button @click="modelVisible = false"> </el-button>
<el-button type="primary"
@click="submit"> </el-button>
</span>
</el-dialog>
</div>
</template> </template>
<script> <script>
import org from "./modelType" import org from "./modelType"
export default { export default {
data() { data () {
return { return {
systemId: this.$route.query.systemId, systemId: this.$route.query.systemId,
isTopLevel: true, // isTopLevel: true, //
listData: [], listData: [],
keyword: '', keyword: '',
page: +this.$route.query.page || 1, page: +this.$route.query.page || 1,
pageSize: 10, pageSize: 10,
total: 0, total: 0,
multipleSelection: [], multipleSelection: [],
modelVisible: false, modelVisible: false,
modelLoading: false, modelLoading: false,
modelData: [], modelData: [],
submiting: false submiting: false
}; };
}, },
components: { components: {
org org
},
watch: {
keyword: function (val) {
clearTimeout(this.searchTimer);
this.searchTimer = setTimeout(() => {
this.initData()
}, 500)
}
},
mounted () { },
methods: {
getData () {
const curNode = this.$refs.tree.$refs.tree.getCurrentNode() //
this.isTopLevel = !curNode.level && curNode.categoryName === '全部'
//
if (this.isTopLevel) {
this.$post(this.api.getAllModelList, {
modelName: this.keyword,
pageNum: this.page,
pageSize: this.pageSize,
systemId: this.systemId
}).then(res => {
this.listData = res.data.records
this.total = res.data.total
}).catch(res => { })
} else {
this.$post(this.api.referenceDemoList, {
modelName: this.keyword,
pageNum: this.page,
pageSize: this.pageSize,
categoryId: curNode.id,
founder: 0
}).then(res => {
this.listData = res.data.records
this.total = res.data.total
}).catch(res => { })
}
}, },
watch: { initData () {
keyword: function(val) { this.$refs.table.clearSelection()
clearTimeout(this.searchTimer); this.page = 1
this.searchTimer = setTimeout(() => { this.getData()
this.initData()
}, 500)
}
}, },
mounted() {}, //
methods: { add () {
getData() { if (!this.$refs.tree.orgList.length) return this.$message.error('请先添加模型分类')
const curNode = this.$refs.tree.$refs.tree.getCurrentNode() // if (this.isTopLevel) return this.$message.error('请选择子分类进入导入模型')
this.isTopLevel = !curNode.level && curNode.categoryName === '全部' this.modelVisible = true
// this.modelLoading = true
if (this.isTopLevel) { //
this.$post(this.api.getAllModelList, { this.$post(this.api.getAllModelList, {
modelName: this.keyword, pageNum: 1,
pageNum: this.page, pageSize: 10000,
pageSize: this.pageSize, systemId: this.systemId
systemId: this.systemId }).then(res => {
}).then(res => { const modelList = res.data.records
this.listData = res.data.records
this.total = res.data.total
}).catch(res => {})
} else {
this.$post(this.api.referenceDemoList, {
modelName: this.keyword,
pageNum: this.page,
pageSize: this.pageSize,
categoryId: curNode.id
}).then(res => {
this.listData = res.data.records
this.total = res.data.total
}).catch(res => {})
}
},
initData() {
this.$refs.table.clearSelection()
this.page = 1
this.getData()
},
//
add() {
if (!this.$refs.tree.orgList.length) return this.$message.error('请先添加模型分类')
if (this.isTopLevel) return this.$message.error('请选择子分类进入导入模型')
this.modelVisible = true
this.modelLoading = true
//
this.$post(this.api.getAllModelList, {
pageNum: 1,
pageSize: 10000,
systemId: this.systemId
}).then(res => {
const modelList = res.data.records
// //
this.$post(this.api.sourceModelClassification).then(res => { this.$post(this.api.sourceModelClassification).then(res => {
let { data } = res let { data } = res
const promises = [] const promises = []
const addType = list => { const addType = list => {
list.map((e, i) => { list.map((e, i) => {
// promise // promise
promises.push(new Promise((resolve,reject) => { promises.push(new Promise((resolve, reject) => {
// //
this.$post(this.api.sysModelDemoList, { this.$post(this.api.sysModelDemoList, {
pageNum: 1, pageNum: 1,
pageSize: 10000, pageSize: 10000,
categoryId: e.id categoryId: e.id
}).then(res => { }).then(res => {
const { records } = res.data const { records } = res.data
const modelChildren = [] const modelChildren = []
// copyIdid // copyIdid
records.map(n => { records.map(n => {
if (!modelList.find(e => e.copyId === n.id)) { if (!modelList.find(e => e.copyId === n.id)) {
n.categoryName = n.modelName n.categoryName = n.modelName
modelChildren.push(n) modelChildren.push(n)
}
})
// disabled
if (modelChildren.length) {
e.children = [...e.children, ...modelChildren]
} else if (records.length) {
e.disabled = true
}
resolve()
}).catch(res => {
reject()
})
}))
e.children && e.children.length && addType(e.children)
})
}
addType(data)
// disabledtrue
const handleType = list => {
return list.filter((e, i) => {
return !e.disabled
}).map(e => {
if (e.children) {
e.children = handleType(e.children)
}
return e
})
} }
Promise.all(promises).then(_ => { })
data = handleType(data) // disabled
this.modelData = (data.length && data[0].children && data[0].children.length) ? data : [] if (modelChildren.length) {
this.modelLoading = false e.children = [...e.children, ...modelChildren]
}).catch(res => {}) } else if (records.length) {
}).catch(res => {}) e.disabled = true
}).catch(res => {}) }
}, resolve()
// }).catch(res => {
reject()
// })
show(row) { }))
this.$router.push(`/addModel?categoryId=${this.$refs.tree.$refs.tree.getCurrentKey()}&id=${row.id}&show=1&model=1`) e.children && e.children.length && addType(e.children)
}, })
// }
del(row) { addType(data)
this.$confirm("确定要删除吗?", "提示", { // disabledtrue
type: "warning" const handleType = list => {
}).then(() => { return list.filter((e, i) => {
this.$post(this.api.deleteReferenceDemo, [row.id]).then(res => { return !e.disabled
this.$message.success("删除成功") }).map(e => {
this.getData() if (e.children) {
}).catch(res => {}) e.children = handleType(e.children)
}).catch(() => {})
},
handleSelectionChange(val) {
this.multipleSelection = val
},
//
batchDel() {
if (this.multipleSelection.length) {
this.$confirm("确定要删除吗?", "提示", {
type: "warning"
}).then(() => {
let ids = this.multipleSelection.map(e => e.id)
this.$post(this.api.deleteReferenceDemo, ids).then(res => {
this.$refs.table.clearSelection()
this.$message.success("删除成功")
this.getData()
}).catch(res => {})
}).catch(() => {})
} else {
this.$message.error("请先选择模型 !")
}
},
handleCurrentChange(val) {
this.page = val
this.$router.push({
path: 'backstage',
query: {
...this.$route.query,
page: val
} }
return e
}) })
}
Promise.all(promises).then(_ => {
data = handleType(data)
this.modelData = (data.length && data[0].children && data[0].children.length) ? data : []
this.modelLoading = false
}).catch(res => { })
}).catch(res => { })
}).catch(res => { })
},
//
//
show (row) {
this.$router.push(`/addModel?categoryId=${this.$refs.tree.$refs.tree.getCurrentKey()}&id=${row.id}&show=1&model=1`)
},
//
del (row) {
this.$confirm("确定要删除吗?", "提示", {
type: "warning"
}).then(() => {
this.$post(this.api.deleteReferenceDemo, [row.id]).then(res => {
this.$message.success("删除成功")
this.getData()
}).catch(res => { })
}).catch(() => { })
},
handleSelectionChange (val) {
this.multipleSelection = val
},
//
batchDel () {
if (this.multipleSelection.length) {
this.$confirm("确定要删除吗?", "提示", {
type: "warning"
}).then(() => {
let ids = this.multipleSelection.map(e => e.id)
this.$post(this.api.deleteReferenceDemo, ids).then(res => {
this.$refs.table.clearSelection()
this.$message.success("删除成功")
this.getData() this.getData()
}, }).catch(res => { })
// }).catch(() => { })
submit() { } else {
if (this.submiting) return false this.$message.error("请先选择模型 !")
const data = [] }
const systemId = this.systemId },
if (this.$refs.model) { handleCurrentChange (val) {
const list = this.$refs.model.getCheckedNodes() // this.page = val
const categoryId = this.$refs.tree.$refs.tree.getCurrentKey() // this.$router.push({
if (!list.length) return this.$message.error('请选择模型') path: 'backstage',
this.submiting = true query: {
list.map(e => { ...this.$route.query,
// categoryId page: val
e.categoryId && data.push({
systemId,
categoryId,
copyId: e.id
})
})
this.$post(this.api.saveReferenceDemo, data).then(res => {
this.modelVisible = false
this.initData()
setTimeout(() => {
this.submiting = false
}, 2000)
}).catch(res => {
this.submiting = false
})
} else {
this.submiting = false
this.modelVisible = false
}
} }
})
this.getData()
},
//
submit () {
if (this.submiting) return false
const data = []
const systemId = this.systemId
if (this.$refs.model) {
const list = this.$refs.model.getCheckedNodes() //
const categoryId = this.$refs.tree.$refs.tree.getCurrentKey() //
if (!list.length) return this.$message.error('请选择模型')
this.submiting = true
list.map(e => {
// categoryId
e.categoryId && data.push({
systemId,
categoryId,
copyId: e.id
})
})
this.$post(this.api.saveReferenceDemo, data).then(res => {
this.modelVisible = false
this.initData()
setTimeout(() => {
this.submiting = false
}, 2000)
}).catch(res => {
this.submiting = false
})
} else {
this.submiting = false
this.modelVisible = false
}
} }
}
}; };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@ -294,15 +338,15 @@ export default {
padding: 24px; padding: 24px;
} }
} }
.el-input__inner{ .el-input__inner {
height: 32px; height: 32px;
} }
.model-wrap { .model-wrap {
max-height: 400px; max-height: 400px;
overflow: auto; overflow: auto;
.none { .none {
text-align: center; text-align: center;
color: #8b8b8b; color: #8b8b8b;
} }
} }
</style> </style>

@ -1,15 +1,21 @@
<template> <template>
<div>
<div> <div>
<div> <div class="front-switch">
<div class="front-switch"> <el-switch v-model="modelIsShow"
<el-switch v-model="modelIsShow" :active-value="0" :inactive-value="1" active-text="内置模型按钮前台展示" @change="changeModelStatus"></el-switch> :active-value="0"
</div> :inactive-value="1"
<div class="flex-between m-b-20"> active-text="内置模型按钮前台展示"
<el-button type="text" icon="el-icon-refresh" @click="syncModel">同步原始模型列表</el-button> @change="changeModelStatus"></el-switch>
<el-button type="text" @click="addType(0)">添加</el-button> </div>
</div> <div class="flex-between m-b-20">
<org-tree <el-button type="text"
v-if="orgList.length" icon="el-icon-refresh"
@click="syncModel">同步原始模型列表</el-button>
<el-button type="text"
@click="addType(0)">添加</el-button>
</div>
<org-tree v-if="orgList.length"
:data="orgList" :data="orgList"
default-expand-all default-expand-all
ref="tree" ref="tree"
@ -17,277 +23,289 @@
highlight-current highlight-current
:expand-on-click-node="false" :expand-on-click-node="false"
@node-click="getSingle" @node-click="getSingle"
:props="{children: 'children', label: 'categoryName', isLeaf: 'leaf'}" :props="{children: 'children', label: 'categoryName', isLeaf: 'leaf'}">
> <span class="custom-tree-node"
<span class="custom-tree-node" slot-scope="{ node, data }"> slot-scope="{ node, data }">
<span style="display: inline-block; margin-right: 20px">{{ node.label }}</span> <span style="display: inline-block; margin-right: 20px">{{ node.label }}</span>
<span> <span>
<el-button <el-button type="text"
type="text" icon="el-icon-edit-outline"
icon="el-icon-edit-outline" @click="editType(data)">
@click="editType(data)"> </el-button>
</el-button> <el-button type="text"
<el-button icon="el-icon-circle-plus-outline"
type="text" @click="addType(node, data)">
icon="el-icon-circle-plus-outline" </el-button>
@click="addType(node, data)"> <el-button type="text"
</el-button> icon="el-icon-delete"
<el-button @click="delType(data)">
type="text" </el-button>
icon="el-icon-delete" </span>
@click="delType(data)"> </span>
</el-button> </org-tree>
</span> <div class="none"
</span> v-else>暂无数据请点击添加按钮添加模型分类</div>
</org-tree>
<div class="none" v-else>暂无数据请点击添加按钮添加模型分类</div>
</div>
<el-dialog :title="Form.id ? '编辑分类' : '新增分类'" :visible.sync="typeVisible" width="24%" center @close="closeDia" :close-on-click-modal="false">
<el-form ref="Form" :model="Form" :rules="rules">
<el-form-item prop="categoryName">
<el-input placeholder="请输入分类名称" v-model="Form.categoryName"></el-input>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="typeVisible = false"> </el-button>
<el-button type="primary" @click="submit"> </el-button>
</span>
</el-dialog>
</div> </div>
<el-dialog :title="Form.id ? '编辑分类' : '新增分类'"
:visible.sync="typeVisible"
width="24%"
center
@close="closeDia"
:close-on-click-modal="false">
<el-form ref="Form"
:model="Form"
:rules="rules">
<el-form-item prop="categoryName">
<el-input placeholder="请输入分类名称"
v-model="Form.categoryName"></el-input>
</el-form-item>
</el-form>
<span slot="footer"
class="dialog-footer">
<el-button @click="typeVisible = false"> </el-button>
<el-button type="primary"
@click="submit"> </el-button>
</span>
</el-dialog>
</div>
</template> </template>
<script> <script>
import OrgTree from "@/components/org-tree/src/tree"; import OrgTree from "@/components/org-tree/src/tree";
export default { export default {
props: ["Data"], props: ["Data"],
data() { data () {
return { return {
systemId: this.$route.query.systemId, systemId: this.$route.query.systemId,
modelIsShow: false, modelIsShow: false,
orgList: [], orgList: [],
typeVisible: false, typeVisible: false,
Form: { Form: {
id: '', id: '',
parentId: '', parentId: '',
categoryName: '', categoryName: '',
level: '' level: ''
}, },
rules: { rules: {
categoryName: [ categoryName: [
{ required: true, message: "请输入分类名称", trigger: "blur" } { required: true, message: "请输入分类名称", trigger: "blur" }
] ]
}
};
},
components: {
OrgTree
},
mounted () {
this.getType()
this.getModelStatus()
},
methods: {
//
getType () {
this.$post(`${this.api.modelClassList}?systemId=${this.systemId}`).then(res => {
const { data } = res
this.orgList = data
data.length && this.$nextTick(() => {
const categoryId = this.$route.query.categoryId
this.$refs.tree.setCurrentKey(categoryId || data[0].id)
this.$router.push({
path: 'backstage',
query: {
...this.$route.query,
categoryId: this.$refs.tree.getCurrentKey()
} }
}; }).catch(err => { })
this.$emit('getData')
})
}).catch(res => { })
}, },
components: { //
OrgTree getModelStatus () {
this.$post(`${this.api.checkIsShowBySystemId}?systemId=${this.systemId}`).then(res => {
this.modelIsShow = res.isShow // 0 1
}).catch(res => { })
}, },
mounted() { //
this.getType() changeModelStatus (val) {
this.getModelStatus() this.$post(`${this.api.modifyIsShowState}?systemId=${this.systemId}&isShow=${val}`).then(res => { }).catch(res => { })
}, },
methods: { getSingle () {
// this.$router.push({
getType() { path: 'backstage',
this.$post(`${this.api.modelClassList}?systemId=${this.systemId}`).then(res => { query: {
const { data } = res ...this.$route.query,
this.orgList = data categoryId: this.$refs.tree.getCurrentKey()
data.length && this.$nextTick(() => { }
const categoryId = this.$route.query.categoryId }).catch(err => { })
this.$refs.tree.setCurrentKey(categoryId || data[0].id) this.$emit('initData')
this.$router.push({ },
path: 'backstage', syncModelData () {
query: { //
...this.$route.query, this.$post(`${this.api.delModelInfoBySystemId}?systemId=${this.systemId}`).then(res => {
categoryId: this.$refs.tree.getCurrentKey() this.$post(`${this.api.synchronizationMdel}?systemId=${this.systemId}`).then(res => {
}
}).catch(err => {})
this.$emit('getData')
})
}).catch(res => {})
},
//
getModelStatus() {
this.$post(`${this.api.checkIsShowBySystemId}?systemId=${this.systemId}`).then(res => {
this.modelIsShow = res.isShow // 0 1
}).catch(res => {})
},
//
changeModelStatus(val) {
this.$post(`${this.api.modifyIsShowState}?systemId=${this.systemId}&isShow=${val}`).then(res => {}).catch(res => {})
},
getSingle() {
this.$router.push({ this.$router.push({
path: 'backstage', path: 'backstage',
query: { query: {
...this.$route.query, ...this.$route.query,
categoryId: this.$refs.tree.getCurrentKey() categoryId: ''
}
}).catch(err => {})
this.$emit('initData')
},
syncModelData() {
//
this.$post(`${this.api.delModelInfoBySystemId}?systemId=${this.systemId}`).then(res => {
this.$post(`${this.api.synchronizationMdel}?systemId=${this.systemId}`).then(res => {
this.$router.push({
path: 'backstage',
query: {
...this.$route.query,
categoryId: ''
}
})
this.getType()
})
}).catch(() => {})
},
syncModel() {
if (this.orgList.length) {
this.$confirm('同步后当前的组织架构将会被删除,是否继续?', '提示', {
type: 'warning'
}).then(() => {
this.syncModelData()
}).catch(() => {})
} else {
this.syncModelData()
} }
}, })
// this.getType()
async addData(id) { })
// }).catch(() => { })
this.$post(this.api.sourceModelClassification).then(res => { },
const { data } = res syncModel () {
const systemId = this.systemId if (this.orgList.length) {
const promises = [] this.$confirm('同步后当前的组织架构将会被删除,是否继续?', '提示', {
// type: 'warning'
const addType = async (list, refId) => { }).then(() => {
for (const e of list) { this.syncModelData()
// promise }).catch(() => { })
// promises.push(new Promise(async (resolve, reject) => { } else {
// this.syncModelData()
await this.$post(this.api.saveReferenceCategory, { }
id: '', },
categoryName: e.categoryName, //
systemId, async addData (id) {
level: e.level, //
parentId: refId || id this.$post(this.api.sourceModelClassification, {
}).then(async res => { founder: 0
const referenceCategoryId = res.referenceCategoryId // idparentId }).then(res => {
const { data } = res
// const systemId = this.systemId
promises.push(new Promise((resolve1, reject1) => { const promises = []
this.$post(this.api.sysModelDemoList, { //
pageNum: 1, const addType = async (list, refId) => {
pageSize: 10000, for (const e of list) {
categoryId: e.id // promise
}).then(res => { // promises.push(new Promise(async (resolve, reject) => {
let { records } = res.data //
records = records.filter(e => e.postStatus && !e.isOpen) // await this.$post(this.api.saveReferenceCategory, {
if (records.length) { id: '',
const modelData = [] categoryName: e.categoryName,
// systemId,
records.map(e => { level: e.level,
modelData.push({ parentId: refId || id,
systemId, founder: 0
categoryId: referenceCategoryId, }).then(async res => {
copyId: e.id const referenceCategoryId = res.referenceCategoryId // idparentId
})
})
//
this.$post(this.api.saveReferenceDemo, modelData).then(res => {
// resolve()
resolve1()
}).catch(res => {
// reject()
reject1()
})
} else {
// resolve()
}
e.children = [...e.children, ...records]
}).catch(res => {
// reject()
})
}))
// //
this.$nextTick(() => { promises.push(new Promise((resolve1, reject1) => {
e.children && e.children.length && addType(e.children, res.referenceCategoryId) this.$post(this.api.sysModelDemoList, {
}) pageNum: 1,
}).catch(res => { pageSize: 10000,
// reject() categoryId: e.id
}) }).then(res => {
// })) let { records } = res.data
} records = records.filter(e => e.postStatus && !e.isOpen) //
} if (records.length) {
addType(data[0].children, id) const modelData = []
Promise.all(promises).then(_ => { //
setTimeout(this.getType, 500) records.map(e => {
modelData.push({
systemId,
categoryId: referenceCategoryId,
copyId: e.id
})
})
//
this.$post(this.api.saveReferenceDemo, modelData).then(res => {
// resolve()
resolve1()
}).catch(res => {
// reject()
reject1()
})
} else {
// resolve()
}
e.children = [...e.children, ...records]
}).catch(res => {
// reject()
}) })
}).catch(res => {}) }))
},
// //
addType(node, data) { this.$nextTick(() => {
this.typeVisible = true e.children && e.children.length && addType(e.children, res.referenceCategoryId)
this.Form.parentId = data ? data.id : 0 })
this.Form.level = node ? node.level : 0 }).catch(res => {
}, // reject()
//
editType(data) {
this.Form.id = data.id
this.Form.parentId = data ? data.parentId : 0
this.Form.categoryName = data.categoryName
this.typeVisible = true
},
//
submit() {
this.$refs['Form'].validate((valid) => {
if (valid) {
const form = this.Form
const data = {
id: form.id,
parentId: form.parentId,
categoryName: form.categoryName,
systemId: this.systemId
}
if (data.id) {
this.$post(this.api.updateModelClass, data).then(res => {
this.$message.success("编辑成功")
this.typeVisible = false
this.getType()
}).catch(res => {})
} else {
data.level = form.level
this.$post(this.api.saveReferenceCategory, data).then(res => {
this.$message.success("添加成功")
this.typeVisible = false
this.getType()
}).catch(res => {})
}
}
}) })
}, // }))
closeDia() { }
this.$refs.Form.resetFields()
this.Form = {
id: '',
parentId: '',
categoryName: ''
}
},
//
delType(item) {
this.$confirm("确定要删除分类吗?", "提示", {
type: "warning"
}).then(() => {
this.$post(`${this.api.deleteModelClass}?categoryId=${item.id}`).then(res => {
this.$message.success("删除成功")
this.$emit('initData')
this.getType()
}).catch(res => {})
}).catch(() => {})
} }
addType(data[0].children, id)
Promise.all(promises).then(_ => {
setTimeout(this.getType, 500)
})
}).catch(res => { })
},
//
addType (node, data) {
this.typeVisible = true
this.Form.parentId = data ? data.id : 0
this.Form.level = node ? node.level : 0
},
//
editType (data) {
this.Form.id = data.id
this.Form.parentId = data ? data.parentId : 0
this.Form.categoryName = data.categoryName
this.typeVisible = true
},
//
submit () {
this.$refs['Form'].validate((valid) => {
if (valid) {
const form = this.Form
const data = {
id: form.id,
parentId: form.parentId,
categoryName: form.categoryName,
systemId: this.systemId,
founder: 0
}
if (data.id) {
this.$post(this.api.updateModelClass, data).then(res => {
this.$message.success("编辑成功")
this.typeVisible = false
this.getType()
}).catch(res => { })
} else {
data.level = form.level
this.$post(this.api.saveReferenceCategory, data).then(res => {
this.$message.success("添加成功")
this.typeVisible = false
this.getType()
}).catch(res => { })
}
}
})
},
closeDia () {
this.$refs.Form.resetFields()
this.Form = {
id: '',
parentId: '',
categoryName: ''
}
},
//
delType (item) {
this.$confirm("确定要删除分类吗?", "提示", {
type: "warning"
}).then(() => {
this.$post(`${this.api.deleteModelClass}?categoryId=${item.id}`).then(res => {
this.$message.success("删除成功")
this.$emit('initData')
this.getType()
}).catch(res => { })
}).catch(() => { })
} }
}
}; };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@ -297,9 +315,9 @@ export default {
border-bottom: 1px solid #f0f0f0; border-bottom: 1px solid #f0f0f0;
} }
.none { .none {
margin-top: 20px; margin-top: 20px;
text-align: center; text-align: center;
color: #909399; color: #909399;
font-size: 12px; font-size: 12px;
} }
</style> </style>

@ -1,189 +1,234 @@
<template> <template>
<div class="wrap"> <div class="wrap">
<div class="side"> <div class="side">
<org ref="tree" @initData="initData" @getData="getData"></org> <org ref="tree"
@initData="initData"
@getData="getData"></org>
</div>
<div class="right">
<h6 class="p-title">筛选</h6>
<div class="tool">
<ul class="filter">
<li>
<el-input placeholder="请输入模型名称"
prefix-icon="el-icon-search"
v-model.trim="keyword"
clearable></el-input>
</li>
</ul>
<div>
<el-button type="primary"
round
@click="add">新增模型</el-button>
<el-button type="primary"
round
@click="batchDel">批量删除</el-button>
<el-button type="primary"
round
@click="batchOff(1)">批量禁用</el-button>
<el-button type="primary"
round
@click="batchOff(0)">批量开启</el-button>
</div> </div>
</div>
<div class="right"> <el-table :data="listData"
<h6 class="p-title">筛选</h6> class="table"
<div class="tool"> ref="table"
<ul class="filter"> stripe
<li> header-align="center"
<el-input placeholder="请输入模型名称" prefix-icon="el-icon-search" v-model.trim="keyword" clearable></el-input> @selection-change="handleSelectionChange">
</li> <el-table-column type="selection"
</ul> width="55"
<div> align="center"></el-table-column>
<el-button type="primary" round @click="add">新增模型</el-button> <el-table-column type="index"
<el-button type="primary" round @click="batchDel">批量删除</el-button> label="序号"
<el-button type="primary" round @click="batchOff(1)">批量禁用</el-button> width="55"
<el-button type="primary" round @click="batchOff(0)">批量开启</el-button> align="center"></el-table-column>
</div> <el-table-column prop="modelName"
</div> label="模型名称"
align="center"></el-table-column>
<el-table-column v-if="isTopLevel"
prop="categoryName"
label="分类"
width="150"
align="center"></el-table-column>
<el-table-column prop="modifyName"
label="编辑人"
align="center">
<el-table :data="listData" class="table" ref="table" stripe header-align="center" @selection-change="handleSelectionChange"> <template slot-scope="scope">
<el-table-column type="selection" width="55" align="center"></el-table-column> {{ scope.row.schoolName || scope.row.modifyName }}
<el-table-column type="index" label="序号" width="55" align="center"></el-table-column> </template>
<el-table-column prop="modelName" label="模型名称" align="center"></el-table-column> </el-table-column>
<el-table-column v-if="isTopLevel" prop="categoryName" label="分类" width="150" align="center"></el-table-column> <el-table-column prop="updateTime"
<el-table-column prop="modifyName" label="编辑人" align="center"></el-table-column> label="最新编辑时间"
<el-table-column prop="updateTime" label="最新编辑时间" width="150" align="center"></el-table-column> width="150"
<el-table-column prop="workNumber" label="状态" width="100" align="center"> align="center"></el-table-column>
<template slot-scope="scope"> <el-table-column prop="workNumber"
{{ scope.row.postStatus ? '已发布' : '草稿' }} label="状态"
</template> width="100"
</el-table-column> align="center">
<el-table-column label="操作" width="230"> <template slot-scope="scope">
<template slot-scope="scope"> {{ scope.row.postStatus ? '已发布' : '草稿' }}
<el-button type="text" @click="show(scope.row)">查看</el-button> </template>
<el-button type="text" @click="edit(scope.row)">编辑</el-button> </el-table-column>
<el-button type="text" @click="del(scope.row)">删除</el-button> <el-table-column label="操作"
<el-switch v-if="scope.row.postStatus" v-model="scope.row.isOpen" :active-value="0" :inactive-value="1" style="margin: 0 10px 0 5px" :active-text="scope.row.isOpen ? '禁用' : '启用'" @change="switchOff($event,scope.row,scope.$index)"></el-switch> width="230">
</template> <template slot-scope="scope">
</el-table-column> <el-button type="text"
</el-table> @click="show(scope.row)">查看</el-button>
<div class="pagination"> <el-button type="text"
<el-pagination background layout="total, prev, pager, next" :current-page="page" @current-change="handleCurrentChange" :total="total"></el-pagination> @click="edit(scope.row)">编辑</el-button>
</div> <el-button type="text"
</div> @click="del(scope.row)">删除</el-button>
<el-switch v-if="scope.row.postStatus"
v-model="scope.row.isOpen"
:active-value="0"
:inactive-value="1"
style="margin: 0 10px 0 5px"
:active-text="scope.row.isOpen ? '禁用' : '启用'"
@change="switchOff($event,scope.row,scope.$index)"></el-switch>
</template>
</el-table-column>
</el-table>
<div class="pagination">
<el-pagination background
layout="total, prev, pager, next"
:current-page="page"
@current-change="handleCurrentChange"
:total="total"></el-pagination>
</div>
</div> </div>
</div>
</template> </template>
<script> <script>
import org from "./sourceType" import org from "./sourceType"
export default { export default {
data() { data () {
return { return {
isTopLevel: true, // isTopLevel: true, //
listData: [], listData: [],
keyword: "", keyword: "",
page: +this.$route.query.page || 1, page: +this.$route.query.page || 1,
pageSize: 10, pageSize: 10,
total: 0, total: 0,
multipleSelection: [] multipleSelection: []
}; };
}, },
components: { components: {
org org
},
watch: {
keyword: function (val) {
clearTimeout(this.searchTimer);
this.searchTimer = setTimeout(() => {
this.initData()
}, 500)
}
},
mounted () {
},
methods: {
//
async getData (school) {
const curNode = this.$refs.tree.$refs.tree.getCurrentNode() //
this.isTopLevel = !curNode.level
//
const { data } = await this.$post(this.api[school ? 'InstitutionSourceModel' : !curNode.level ? 'getAllModelListBySys' : 'sysModelDemoList'], {
modelName: this.keyword,
pageNum: this.page,
pageSize: this.pageSize,
categoryId: curNode.id,
founder: 0
})
this.listData = data.records
this.total = data.total
}, },
watch: { initData (school) {
keyword: function(val) { this.$refs.table.clearSelection()
clearTimeout(this.searchTimer); this.page = 1
this.searchTimer = setTimeout(() => { this.getData(school)
this.initData()
}, 500)
}
}, },
mounted() { //
add () {
this.$router.push(`/addModel?categoryId=${this.$refs.tree.$refs.tree.getCurrentKey()}`)
}, },
methods: { //
// batchDel () {
getData() { if (this.multipleSelection.length) {
const curNode = this.$refs.tree.$refs.tree.getCurrentNode() // //
this.isTopLevel = !curNode.level let ids = this.multipleSelection.map(e => e.id)
// this.$confirm("确定要删除吗?", "提示", {
if (!curNode.level) { type: "warning"
this.$post(this.api.getAllModelListBySys, { }).then(() => {
modelName: this.keyword, this.$post(this.api.deleteSysModelDemo, ids).then(res => {
pageNum: this.page, this.$message.success('删除成功')
pageSize: this.pageSize
}).then(res => {
this.listData = res.data.records
this.total = res.data.total
}).catch(res => {})
} else {
this.$post(this.api.sysModelDemoList, {
modelName: this.keyword,
pageNum: this.page,
pageSize: this.pageSize,
categoryId: curNode.id
}).then(res => {
this.listData = res.data.records
this.total = res.data.total
}).catch(res => {})
}
},
initData() {
this.$refs.table.clearSelection()
this.page = 1
this.getData() this.getData()
}, }).catch(res => { })
// }).catch(() => { })
add() { } else {
this.$router.push(`/addModel?categoryId=${this.$refs.tree.$refs.tree.getCurrentKey()}`) this.$message.error("请先选择模型 !")
}, }
},
//
batchOff (isOpen) {
const off = isOpen === 0
if (this.multipleSelection.length) {
// //
batchDel() { let ids = this.multipleSelection.map(e => e.id)
if (this.multipleSelection.length) { this.$confirm(`确定要${off ? '启用' : '禁用'}吗?`, "提示", {
// type: "warning"
let ids = this.multipleSelection.map(e => e.id) }).then(() => {
this.$confirm("确定要删除吗?", "提示", { this.$post(`${this.api.bulkDisable}?isOpen=${isOpen}`, ids).then(res => {
type: "warning" this.$message.success(`${off ? '启用' : '禁用'}成功`)
}).then(() => {
this.$post(this.api.deleteSysModelDemo, ids).then(res => {
this.$message.success('删除成功')
this.getData()
}).catch(res => {})
}).catch(() => {})
} else {
this.$message.error("请先选择模型 !")
}
},
//
batchOff(isOpen) {
const off = isOpen === 0
if (this.multipleSelection.length) {
//
let ids = this.multipleSelection.map(e => e.id)
this.$confirm(`确定要${off ? '启用' : '禁用'}吗?`, "提示", {
type: "warning"
}).then(() => {
this.$post(`${this.api.bulkDisable}?isOpen=${isOpen}`, ids).then(res => {
this.$message.success(`${off ? '启用' : '禁用'}成功`)
this.getData()
}).catch(res => {})
}).catch(() => {})
} else {
this.$message.error("请先选择模型 !")
}
},
//
show(row) {
this.$router.push(`/addModel?categoryId=${this.$refs.tree.$refs.tree.getCurrentKey()}&id=${row.id}&show=1`)
},
//
edit(row) {
this.$router.push(`/addModel?categoryId=${this.$refs.tree.$refs.tree.getCurrentKey()}&id=${row.id}&postStatus=${row.postStatus}`)
},
del(row) {
this.$confirm("确定要删除吗?", "提示", {
type: "warning"
}).then(() => {
this.$post(this.api.deleteSysModelDemo, [row.id]).then(res => {
this.$message.success('删除成功')
this.getData()
}).catch(res => {})
}).catch(() => {})
},
switchOff(val,row,index) {
this.$post(`${this.api.bulkDisable}?isOpen=${val}`, [row.id]).then(res => {
this.$message.success(val ? '禁用成功' : '启用成功')
}).catch(res => {})
},
handleSelectionChange(val) {
this.multipleSelection = val
},
handleCurrentChange(val) {
this.page = val
this.$router.push({
path: 'backstage',
query: {
...this.$route.query,
page: val
}
})
this.getData() this.getData()
}).catch(res => { })
}).catch(() => { })
} else {
this.$message.error("请先选择模型 !")
}
},
//
show (row) {
this.$router.push(`/addModel?categoryId=${this.$refs.tree.$refs.tree.getCurrentKey()}&id=${row.id}&show=1`)
},
//
edit (row) {
this.$router.push(`/addModel?categoryId=${this.$refs.tree.$refs.tree.getCurrentKey()}&id=${row.id}&postStatus=${row.postStatus}`)
},
del (row) {
this.$confirm("确定要删除吗?", "提示", {
type: "warning"
}).then(() => {
this.$post(this.api.deleteSysModelDemo, [row.id]).then(res => {
this.$message.success('删除成功')
this.getData()
}).catch(res => { })
}).catch(() => { })
},
switchOff (val, row, index) {
this.$post(`${this.api.bulkDisable}?isOpen=${val}`, [row.id]).then(res => {
this.$message.success(val ? '禁用成功' : '启用成功')
}).catch(res => { })
},
handleSelectionChange (val) {
this.multipleSelection = val
},
handleCurrentChange (val) {
this.page = val
this.$router.push({
path: 'backstage',
query: {
...this.$route.query,
page: val
} }
})
this.getData()
} }
}
}; };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@ -201,7 +246,7 @@ export default {
padding: 24px; padding: 24px;
} }
} }
.el-input__inner{ .el-input__inner {
height: 32px; height: 32px;
} }
</style> </style>

@ -1,175 +1,206 @@
<template> <template>
<div>
<div> <div>
<div> <org-tree :data="orgList"
<org-tree
:data="orgList"
default-expand-all default-expand-all
ref="tree" ref="tree"
node-key="id" node-key="id"
highlight-current highlight-current
:expand-on-click-node="false" :expand-on-click-node="false"
@node-click="getSingle" @node-click="getSingle"
:props="{children: 'children', label: 'categoryName', isLeaf: 'leaf'}" :props="{children: 'children', label: 'categoryName', isLeaf: 'leaf'}">
> <span class="custom-tree-node"
<span class="custom-tree-node" slot-scope="{ node, data }"> slot-scope="{ node, data }">
<span style="display: inline-block; margin-right: 20px">{{ node.label }}</span> <span style="display: inline-block; margin-right: 20px">{{ node.label }}</span>
<span> <span>
<el-button <el-button v-if="node.level > 1"
v-if="node.level > 1" type="text"
type="text" icon="el-icon-edit-outline"
icon="el-icon-edit-outline" @click="editType(data)">
@click="editType(data)"> </el-button>
</el-button> <el-button type="text"
<el-button icon="el-icon-circle-plus-outline"
type="text" @click="addType(node, data)">
icon="el-icon-circle-plus-outline" </el-button>
@click="addType(node, data)"> <el-button v-if="node.level > 1"
</el-button> type="text"
<el-button icon="el-icon-delete"
v-if="node.level > 1" @click="delType(data)">
type="text" </el-button>
icon="el-icon-delete" </span>
@click="delType(data)"> </span>
</el-button> </org-tree>
</span> <div :class="['school-create', {active: schoolActive}]"
</span> @click="schoolClick">院校创建</div>
</org-tree>
</div>
<el-dialog :title="Form.id ? '编辑分类' : '新增分类'" :visible.sync="typeVisible" width="24%" center @close="closeDia" :close-on-click-modal="false">
<el-form ref="Form" :model="Form" :rules="rules">
<el-form-item prop="categoryName">
<el-input placeholder="请输入分类名称" v-model="Form.categoryName"></el-input>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="typeVisible = false"> </el-button>
<el-button type="primary" @click="submit"> </el-button>
</span>
</el-dialog>
</div> </div>
<el-dialog :title="Form.id ? '编辑分类' : '新增分类'"
:visible.sync="typeVisible"
width="24%"
center
@close="closeDia"
:close-on-click-modal="false">
<el-form ref="Form"
:model="Form"
:rules="rules">
<el-form-item prop="categoryName">
<el-input placeholder="请输入分类名称"
v-model="Form.categoryName"></el-input>
</el-form-item>
</el-form>
<span slot="footer"
class="dialog-footer">
<el-button @click="typeVisible = false"> </el-button>
<el-button type="primary"
@click="submit"> </el-button>
</span>
</el-dialog>
</div>
</template> </template>
<script> <script>
import OrgTree from "@/components/org-tree/src/tree"; import OrgTree from "@/components/org-tree/src/tree";
export default { export default {
props: ["Data"], props: ["Data"],
data() { data () {
return { return {
systemId: this.$route.query.systemId, systemId: this.$route.query.systemId,
orgList: [], orgList: [],
typeVisible: false, typeVisible: false,
Form: { Form: {
id: '', id: '',
parentId: '', parentId: '',
categoryName: '', categoryName: '',
level: '' level: ''
}, },
rules: { rules: {
categoryName: [ categoryName: [
{ required: true, message: "请输入分类名称", trigger: "blur" } { required: true, message: "请输入分类名称", trigger: "blur" }
] ]
} },
}; schoolActive: 0
}, };
components: { },
OrgTree components: {
}, OrgTree
mounted() { },
this.getType() mounted () {
}, this.getType()
methods: { },
getType() { methods: {
this.$post(this.api.sourceModelClassification).then(res => { //
const { data } = res getType () {
this.orgList = data this.$post(this.api.sourceModelClassification, {
data.length && this.$nextTick(() => { founder: 0
const categoryId = this.$route.query.categoryId }).then(res => {
this.$refs.tree.setCurrentKey(categoryId || data[0].id) const { data } = res
this.$router.push({ this.orgList = data
path: 'backstage', data.length && this.$nextTick(() => {
query: { const categoryId = this.$route.query.categoryId
...this.$route.query, this.$refs.tree.setCurrentKey(categoryId || data[0].id)
categoryId: this.$refs.tree.getCurrentKey()
}
}).catch(err => {})
this.$emit('getData')
})
}).catch(res => {})
},
getSingle() {
this.$router.push({ this.$router.push({
path: 'backstage', path: 'backstage',
query: { query: {
...this.$route.query, ...this.$route.query,
categoryId: this.$refs.tree.getCurrentKey() categoryId: this.$refs.tree.getCurrentKey()
} }
}).catch(err => {}) }).catch(err => { })
this.$emit('initData') this.$emit('getData')
}, })
// }).catch(res => { })
addType(node, data) { },
this.typeVisible = true //
this.Form.parentId = data ? data.id : 0 getSingle () {
this.Form.level = node ? node.level : 0 this.schoolActive = 0
}, this.$router.push({
// path: 'backstage',
editType(data) { query: {
this.Form.id = data.id ...this.$route.query,
this.Form.parentId = data ? data.parentId : 0 categoryId: this.$refs.tree.getCurrentKey()
this.Form.categoryName = data.categoryName }
this.typeVisible = true }).catch(err => { })
}, this.$emit('initData')
// },
submit() { //
this.$refs['Form'].validate((valid) => { schoolClick () {
if (valid) { this.schoolActive = 1
const form = this.Form this.$emit('initData', 1)
const data = { },
id: form.id, //
parentId: form.parentId, addType (node, data) {
categoryName: form.categoryName, this.typeVisible = true
systemId: this.systemId this.Form.parentId = data ? data.id : 0
} this.Form.level = node ? node.level : 0
if (data.id) { },
this.$post(this.api.updateSourceModelCategory, data).then(res => { //
this.$message.success("编辑成功") editType (data) {
this.typeVisible = false this.Form.id = data.id
this.getType() this.Form.parentId = data ? data.parentId : 0
}).catch(res => {}) this.Form.categoryName = data.categoryName
} else { this.typeVisible = true
data.level = form.level },
this.$post(this.api.categorySave, data).then(res => { //
this.$message.success("添加成功") submit () {
this.typeVisible = false this.$refs['Form'].validate((valid) => {
this.getType() if (valid) {
}).catch(res => {}) const form = this.Form
} const data = {
} id: form.id,
}) parentId: form.parentId,
}, categoryName: form.categoryName,
closeDia() { systemId: this.systemId,
this.$refs.Form.resetFields() founder: 0
this.Form = { }
id: '', if (data.id) {
parentId: '', this.$post(this.api.updateSourceModelCategory, data).then(res => {
categoryName: '' this.$message.success("编辑成功")
} this.typeVisible = false
}, this.getType()
// }).catch(res => { })
delType(item) { } else {
this.$confirm("确定要删除分类吗?", "提示", { data.level = form.level
type: "warning" this.$post(this.api.categorySave, data).then(res => {
}).then(() => { this.$message.success("添加成功")
this.$post(`${this.api.deleteSourceModelCategory}?categoryId=${item.id}`).then(res => { this.typeVisible = false
this.$message.success("删除成功") this.getType()
this.$emit('initData') }).catch(res => { })
this.getType() }
}).catch(res => {})
}).catch(() => {})
} }
})
},
closeDia () {
this.$refs.Form.resetFields()
this.Form = {
id: '',
parentId: '',
categoryName: ''
}
},
//
delType (item) {
this.$confirm("确定要删除分类吗?", "提示", {
type: "warning"
}).then(() => {
this.$post(`${this.api.deleteSourceModelCategory}?categoryId=${item.id}`).then(res => {
this.$message.success("删除成功")
this.$emit('initData')
this.getType()
}).catch(res => { })
}).catch(() => { })
} }
}
}; };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.school-create {
padding: 3px 5px 3px 23px;
margin-top: 5px;
font-size: 14px;
cursor: pointer;
&.active {
background-color: #f0f7ff;
}
&:hover {
background-color: #f0f7ff;
}
}
</style> </style>

@ -107,7 +107,7 @@
:key="i" :key="i"
:label="item.classificationName" :label="item.classificationName"
:value="item.classificationId" :value="item.classificationId"
:disabled="form.mall.isAssociatedProduct && (item.classificationId !== 4 && item.classificationId !== 6)"></el-option> :disabled="!!(form.mall.isAssociatedProduct && (item.classificationId !== 4 && item.classificationId !== 6))"></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item class="req" <el-form-item class="req"
@ -278,7 +278,7 @@
prop="miniProgramPictureAddress"> prop="miniProgramPictureAddress">
<el-upload class="avatar-uploader" <el-upload class="avatar-uploader"
accept=".jpg,.png,.jpeg" accept=".jpg,.png,.jpeg"
:before-remove="beforeMiniRemove" :on-remove="handleMiniRemove"
:on-success="uploadSuccessMini" :on-success="uploadSuccessMini"
:limit="1" :limit="1"
:action="api.fileupload" :action="api.fileupload"
@ -500,7 +500,8 @@
</el-form-item> </el-form-item>
<el-form-item prop="file" <el-form-item prop="file"
label="产品参数"> label="产品参数">
<el-upload :before-remove="beforeFileRemove" <el-upload :before-remove="beforeRemove"
:on-remove="handleFileRemove"
:on-success="uploadSuccessFile" :on-success="uploadSuccessFile"
:action="api.fileUploadNakadai" :action="api.fileUploadNakadai"
:file-list="form.mallAnnex" :file-list="form.mallAnnex"
@ -593,14 +594,19 @@
<li>操作</li> <li>操作</li>
</ul> </ul>
<el-tree class="sort" <el-tree class="sort"
:indent="0"
:data="labels" :data="labels"
node-key="id" node-key="tagsId"
default-expand-all default-expand-all
draggable> draggable
:allow-drop="allowDrop"
@node-drag-end="handleDrop">
<ul class="sort-line" <ul class="sort-line"
slot-scope="{ node, data }"> slot-scope="{ node, data }">
<li>{{ data.index + 1 }}</li> <li>
<i class="el-icon-rank"></i>
{{ data.index + 1 }}
</li>
<li> <li>
<el-input v-if="data.edit" <el-input v-if="data.edit"
placeholder="请输入主题名称" placeholder="请输入主题名称"
@ -699,7 +705,6 @@ import quill from "@/components/quill";
import Editor from '@tinymce/tinymce-vue' import Editor from '@tinymce/tinymce-vue'
import editorConfig from '@/utils/editor' import editorConfig from '@/utils/editor'
export default { export default {
name: "courseAddEdit",
data () { data () {
return { return {
headers: { headers: {
@ -811,7 +816,6 @@ export default {
// , // ,
form: { form: {
handler (val) { handler (val) {
console.log("🚀 ~ file: index.vue:511 ~ handler ~ val:", val)
this.updateTime++ this.updateTime++
}, },
deep: true deep: true
@ -1120,6 +1124,15 @@ export default {
this.labelVisible = false this.labelVisible = false
} }
}, },
allowDrop (draggingNode, dropNode, type) {
if (dropNode.level == 1 && type === 'inner') return false
return true
},
handleDrop () {
this.labels.forEach((e, i) => {
e.index = i
})
},
// //
sortLabel () { sortLabel () {
const list = this.labels const list = this.labels
@ -1345,7 +1358,7 @@ export default {
uploadSuccessMini (res) { uploadSuccessMini (res) {
this.form.mall.appletIcon = res.data.filesResult.fileUrl; this.form.mall.appletIcon = res.data.filesResult.fileUrl;
}, },
beforeMiniRemove () { handleMiniRemove () {
this.form.mall.appletIcon = '' this.form.mall.appletIcon = ''
}, },
uploadSuccessInterface (res) { // uploadSuccessInterface (res) { //
@ -1353,15 +1366,18 @@ export default {
}, },
uploadSuccessFile (res) { // uploadSuccessFile (res) { //
const e = res.filesResult const e = res.filesResult
this.form.mallAnnex = [{ this.form.mallAnnex.push({
mallId: this.id, mallId: this.id,
filePath: e.fileUrl, filePath: e.fileUrl,
fileName: e.originalFileName, fileName: e.originalFileName,
name: e.originalFileName, name: e.originalFileName,
}] })
},
beforeRemove (file, fileList) {
return this.$confirm(`确定移除 ${file.name}`);
}, },
beforeFileRemove () { handleFileRemove (file, fileList) {
this.form.mallAnnex = [] this.form.mallAnnex = fileList
}, },
// //
beforeUpload () { beforeUpload () {
@ -1668,7 +1684,7 @@ $avatar-width: 104px;
&:nth-child(2) { &:nth-child(2) {
position: absolute; position: absolute;
width: 280px; width: 280px;
left: 100px; left: 105px;
} }
&:last-child { &:last-child {
position: absolute; position: absolute;

Loading…
Cancel
Save