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

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

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

@ -1666,8 +1666,14 @@
<el-dialog title="发货信息填写"
:visible.sync="shipVisible"
width="380px"
class="dialog"
class="ship-dia"
: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"
v-model="shipContent"
placeholder="请填写需交付的产品登录地址、账号、密码等内容...(300个字以内)"
@ -1676,7 +1682,19 @@
maxlength="300"></el-input>
<span slot="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"
type="primary"
@click="submitShip">确定</el-button>
@ -1903,6 +1921,7 @@ export default {
rate: '',
shipVisible: false,
shipContent: '',
shipInfo: '',
curRow: {},
// 1 2 3 45 6
classificationId: 0,
@ -2569,6 +2588,7 @@ export default {
options: 1,
settlementPrice: orderType === 2 ? 0 : '', //
settlementPriceUnit: e.settlementPrice || 0, //
mallNonAssociatedLinks: e.mallNonAssociatedLinks //
})
};
const productId = []
@ -2830,9 +2850,27 @@ export default {
//
showShip (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
},
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 () {
this.curRow.shipContent = this.shipContent
@ -3109,4 +3147,12 @@ export default {
text-overflow: ellipsis;
white-space: nowrap;
}
/deep/.ship-dia {
.el-dialog__body {
padding: 0 20px;
}
.ship {
cursor: pointer;
}
}
</style>

@ -1,194 +1,208 @@
<template>
<div class="wrap">
<el-card shadow="hover" class="mgb20">
<div class="flex-between">
<div class="per_title" v-preventReClick @click="back">
<i class="el-icon-arrow-left"></i>
<span class="per_back">返回</span>
<span class="per_school" v-text="isDetail ? '查看源模型' : (id ? '编辑源模型' : '新增源模型')"></span>
</div>
<div v-if="!isDetail">
<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>
<div class="wrap">
<el-card shadow="hover"
class="mgb20">
<div class="flex-between">
<div class="per_title"
v-preventReClick
@click="back">
<i class="el-icon-arrow-left"></i>
<span class="per_back">返回</span>
<span class="per_school"
v-text="isDetail ? '查看源模型' : (id ? '编辑源模型' : '新增源模型')"></span>
</div>
<div v-if="!isDetail">
<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-form label-width="80px" :disabled="isDetail">
<div class="item name">
<label>模型名称</label>
<el-input placeholder="请输入模型名称" v-model="form.modelName" maxlength="25" style="width: 400px"></el-input>
</div>
<div class="item name">
<label>模型分类</label>
<el-cascader
:options="categoryList"
v-model="categoryIdCus"
:props="categoryProps"
clearable
>
</el-cascader>
</div>
<div class="item code">
<label>模型代码</label>
<codemirror
:key="codeKey"
:code.sync="form.modelDemo"
:readOnly="isDetail"
></codemirror>
</div>
</el-form>
</el-card>
</div>
<el-card shadow="hover">
<el-form label-width="80px"
:disabled="isDetail">
<div class="item name">
<label>模型名称</label>
<el-input placeholder="请输入模型名称"
v-model="form.modelName"
maxlength="25"
style="width: 400px"></el-input>
</div>
<div class="item name">
<label>模型分类</label>
<el-cascader :options="categoryList"
v-model="categoryIdCus"
:props="categoryProps"
clearable>
</el-cascader>
</div>
<div class="item code">
<label>模型代码</label>
<codemirror :key="codeKey"
:code.sync="form.modelDemo"
:readOnly="isDetail"></codemirror>
</div>
</el-form>
</el-card>
</div>
</template>
<script>
import codemirror from '@/components/codemirror'
export default {
components:{ codemirror },
data() {
return {
categoryId : Number(this.$route.query.categoryId),
id : Number(this.$route.query.id),
postStatus : Number(this.$route.query.postStatus),
isDetail : Boolean(this.$route.query.show), //
isModel : Boolean(this.$route.query.model), //
categoryIdCus: [],
form: {
modelName: '',
modelDemo: ''
},
categoryList: [],
categoryProps: {
checkStrictly: true,
label: 'categoryName',
value: 'id'
},
codeKey: 1,
submiting: false,
updateTime: 0
};
},
watch: {
// ,
components: { codemirror },
data () {
return {
categoryId: Number(this.$route.query.categoryId),
id: Number(this.$route.query.id),
postStatus: Number(this.$route.query.postStatus),
isDetail: Boolean(this.$route.query.show), //
isModel: Boolean(this.$route.query.model), //
categoryIdCus: [],
form: {
handler(){
this.updateTime++
},
deep:true
modelName: '',
modelDemo: ''
},
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: {
//
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++
},
// id
handleId(list, id, parentId = []) {
// id
handleId (list, id, parentId = []) {
list.map(e => {
// idid
if (id === e.id) {
parentId.shift() // id
this.categoryIdCus = [...parentId, e.id]
} else {
e.children && this.handleId(e.children, id, [...parentId, e.id])
}
})
},
//
getType () {
this.$post(this.api.sourceModelClassification, {
founder: 0
}).then(res => {
const { data } = res
// children
const handleLeaf = list => {
list.map(e => {
// idid
if (id === e.id) {
parentId.shift() // id
this.categoryIdCus = [...parentId, e.id]
if (e.children.length) {
handleLeaf(e.children)
} 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>

@ -1,281 +1,325 @@
<template>
<div class="wrap">
<div class="side">
<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>
</div>
</div>
<div class="wrap">
<div class="side">
<org ref="tree"
@initData="initData"
@getData="getData"></org>
</div>
<el-table :data="listData" class="table" ref="table" stripe header-align="center" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center"></el-table-column>
<el-table-column type="index" label="序号" width="55" align="center"></el-table-column>
<el-table-column prop="modelName" 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="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 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>
</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>
<el-table :data="listData"
class="table"
ref="table"
stripe
header-align="center"
@selection-change="handleSelectionChange">
<el-table-column type="selection"
width="55"
align="center"></el-table-column>
<el-table-column type="index"
label="序号"
width="55"
align="center"></el-table-column>
<el-table-column prop="modelName"
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="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>
<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>
<script>
import org from "./modelType"
export default {
data() {
return {
systemId: this.$route.query.systemId,
isTopLevel: true, //
listData: [],
keyword: '',
page: +this.$route.query.page || 1,
pageSize: 10,
total: 0,
multipleSelection: [],
modelVisible: false,
modelLoading: false,
modelData: [],
submiting: false
};
},
components: {
org
data () {
return {
systemId: this.$route.query.systemId,
isTopLevel: true, //
listData: [],
keyword: '',
page: +this.$route.query.page || 1,
pageSize: 10,
total: 0,
multipleSelection: [],
modelVisible: false,
modelLoading: false,
modelData: [],
submiting: false
};
},
components: {
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: {
keyword: function(val) {
clearTimeout(this.searchTimer);
this.searchTimer = setTimeout(() => {
this.initData()
}, 500)
}
initData () {
this.$refs.table.clearSelection()
this.page = 1
this.getData()
},
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
}).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
//
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 => {
let { data } = res
const promises = []
const addType = list => {
list.map((e, i) => {
// promise
promises.push(new Promise((resolve,reject) => {
//
this.$post(this.api.sysModelDemoList, {
pageNum: 1,
pageSize: 10000,
categoryId: e.id
}).then(res => {
const { records } = res.data
const modelChildren = []
// copyIdid
records.map(n => {
if (!modelList.find(e => e.copyId === n.id)) {
n.categoryName = n.modelName
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
})
//
this.$post(this.api.sourceModelClassification).then(res => {
let { data } = res
const promises = []
const addType = list => {
list.map((e, i) => {
// promise
promises.push(new Promise((resolve, reject) => {
//
this.$post(this.api.sysModelDemoList, {
pageNum: 1,
pageSize: 10000,
categoryId: e.id
}).then(res => {
const { records } = res.data
const modelChildren = []
// copyIdid
records.map(n => {
if (!modelList.find(e => e.copyId === n.id)) {
n.categoryName = n.modelName
modelChildren.push(n)
}
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()
}).catch(res => {})
}).catch(() => {})
} else {
this.$message.error("请先选择模型 !")
}
},
handleCurrentChange(val) {
this.page = val
this.$router.push({
path: 'backstage',
query: {
...this.$route.query,
page: val
})
// 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)
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()
},
//
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
}
}).catch(res => { })
}).catch(() => { })
} else {
this.$message.error("请先选择模型 !")
}
},
handleCurrentChange (val) {
this.page = val
this.$router.push({
path: 'backstage',
query: {
...this.$route.query,
page: val
}
})
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>
<style lang="scss" scoped>
@ -294,15 +338,15 @@ export default {
padding: 24px;
}
}
.el-input__inner{
.el-input__inner {
height: 32px;
}
.model-wrap {
max-height: 400px;
overflow: auto;
.none {
text-align: center;
color: #8b8b8b;
}
max-height: 400px;
overflow: auto;
.none {
text-align: center;
color: #8b8b8b;
}
}
</style>

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

@ -1,189 +1,234 @@
<template>
<div class="wrap">
<div class="side">
<org ref="tree" @initData="initData" @getData="getData"></org>
<div class="wrap">
<div class="side">
<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 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>
<el-table :data="listData"
class="table"
ref="table"
stripe
header-align="center"
@selection-change="handleSelectionChange">
<el-table-column type="selection"
width="55"
align="center"></el-table-column>
<el-table-column type="index"
label="序号"
width="55"
align="center"></el-table-column>
<el-table-column prop="modelName"
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">
<el-table-column type="selection" width="55" align="center"></el-table-column>
<el-table-column type="index" label="序号" width="55" align="center"></el-table-column>
<el-table-column prop="modelName" 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-column>
<el-table-column prop="updateTime" label="最新编辑时间" width="150" align="center"></el-table-column>
<el-table-column prop="workNumber" label="状态" width="100" align="center">
<template slot-scope="scope">
{{ scope.row.postStatus ? '已发布' : '草稿' }}
</template>
</el-table-column>
<el-table-column label="操作" width="230">
<template slot-scope="scope">
<el-button type="text" @click="show(scope.row)">查看</el-button>
<el-button type="text" @click="edit(scope.row)">编辑</el-button>
<el-button type="text" @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>
<template slot-scope="scope">
{{ scope.row.schoolName || scope.row.modifyName }}
</template>
</el-table-column>
<el-table-column prop="updateTime"
label="最新编辑时间"
width="150"
align="center"></el-table-column>
<el-table-column prop="workNumber"
label="状态"
width="100"
align="center">
<template slot-scope="scope">
{{ scope.row.postStatus ? '已发布' : '草稿' }}
</template>
</el-table-column>
<el-table-column label="操作"
width="230">
<template slot-scope="scope">
<el-button type="text"
@click="show(scope.row)">查看</el-button>
<el-button type="text"
@click="edit(scope.row)">编辑</el-button>
<el-button type="text"
@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>
</template>
<script>
import org from "./sourceType"
export default {
data() {
return {
isTopLevel: true, //
listData: [],
keyword: "",
page: +this.$route.query.page || 1,
pageSize: 10,
total: 0,
multipleSelection: []
};
},
components: {
org
data () {
return {
isTopLevel: true, //
listData: [],
keyword: "",
page: +this.$route.query.page || 1,
pageSize: 10,
total: 0,
multipleSelection: []
};
},
components: {
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: {
keyword: function(val) {
clearTimeout(this.searchTimer);
this.searchTimer = setTimeout(() => {
this.initData()
}, 500)
}
initData (school) {
this.$refs.table.clearSelection()
this.page = 1
this.getData(school)
},
mounted() {
//
add () {
this.$router.push(`/addModel?categoryId=${this.$refs.tree.$refs.tree.getCurrentKey()}`)
},
methods: {
//
getData() {
const curNode = this.$refs.tree.$refs.tree.getCurrentNode() //
this.isTopLevel = !curNode.level
//
if (!curNode.level) {
this.$post(this.api.getAllModelListBySys, {
modelName: this.keyword,
pageNum: this.page,
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
//
batchDel () {
if (this.multipleSelection.length) {
//
let ids = this.multipleSelection.map(e => e.id)
this.$confirm("确定要删除吗?", "提示", {
type: "warning"
}).then(() => {
this.$post(this.api.deleteSysModelDemo, ids).then(res => {
this.$message.success('删除成功')
this.getData()
},
//
add() {
this.$router.push(`/addModel?categoryId=${this.$refs.tree.$refs.tree.getCurrentKey()}`)
},
}).catch(res => { })
}).catch(() => { })
} else {
this.$message.error("请先选择模型 !")
}
},
//
batchOff (isOpen) {
const off = isOpen === 0
if (this.multipleSelection.length) {
//
batchDel() {
if (this.multipleSelection.length) {
//
let ids = this.multipleSelection.map(e => e.id)
this.$confirm("确定要删除吗?", "提示", {
type: "warning"
}).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
}
})
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()
}
}
};
</script>
<style lang="scss" scoped>
@ -201,7 +246,7 @@ export default {
padding: 24px;
}
}
.el-input__inner{
.el-input__inner {
height: 32px;
}
</style>

@ -1,175 +1,206 @@
<template>
<div>
<div>
<div>
<org-tree
:data="orgList"
<org-tree :data="orgList"
default-expand-all
ref="tree"
node-key="id"
highlight-current
:expand-on-click-node="false"
@node-click="getSingle"
:props="{children: 'children', label: 'categoryName', isLeaf: 'leaf'}"
>
<span class="custom-tree-node" slot-scope="{ node, data }">
<span style="display: inline-block; margin-right: 20px">{{ node.label }}</span>
<span>
<el-button
v-if="node.level > 1"
type="text"
icon="el-icon-edit-outline"
@click="editType(data)">
</el-button>
<el-button
type="text"
icon="el-icon-circle-plus-outline"
@click="addType(node, data)">
</el-button>
<el-button
v-if="node.level > 1"
type="text"
icon="el-icon-delete"
@click="delType(data)">
</el-button>
</span>
</span>
</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>
:props="{children: 'children', label: 'categoryName', isLeaf: 'leaf'}">
<span class="custom-tree-node"
slot-scope="{ node, data }">
<span style="display: inline-block; margin-right: 20px">{{ node.label }}</span>
<span>
<el-button v-if="node.level > 1"
type="text"
icon="el-icon-edit-outline"
@click="editType(data)">
</el-button>
<el-button type="text"
icon="el-icon-circle-plus-outline"
@click="addType(node, data)">
</el-button>
<el-button v-if="node.level > 1"
type="text"
icon="el-icon-delete"
@click="delType(data)">
</el-button>
</span>
</span>
</org-tree>
<div :class="['school-create', {active: schoolActive}]"
@click="schoolClick">院校创建</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>
<script>
import OrgTree from "@/components/org-tree/src/tree";
export default {
props: ["Data"],
data() {
return {
systemId: this.$route.query.systemId,
orgList: [],
typeVisible: false,
Form: {
id: '',
parentId: '',
categoryName: '',
level: ''
},
rules: {
categoryName: [
{ required: true, message: "请输入分类名称", trigger: "blur" }
]
}
};
},
components: {
OrgTree
},
mounted() {
this.getType()
},
methods: {
getType() {
this.$post(this.api.sourceModelClassification).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 => {})
},
getSingle() {
props: ["Data"],
data () {
return {
systemId: this.$route.query.systemId,
orgList: [],
typeVisible: false,
Form: {
id: '',
parentId: '',
categoryName: '',
level: ''
},
rules: {
categoryName: [
{ required: true, message: "请输入分类名称", trigger: "blur" }
]
},
schoolActive: 0
};
},
components: {
OrgTree
},
mounted () {
this.getType()
},
methods: {
//
getType () {
this.$post(this.api.sourceModelClassification, {
founder: 0
}).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('initData')
},
//
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
}
if (data.id) {
this.$post(this.api.updateSourceModelCategory, data).then(res => {
this.$message.success("编辑成功")
this.typeVisible = false
this.getType()
}).catch(res => {})
} else {
data.level = form.level
this.$post(this.api.categorySave, 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.deleteSourceModelCategory}?categoryId=${item.id}`).then(res => {
this.$message.success("删除成功")
this.$emit('initData')
this.getType()
}).catch(res => {})
}).catch(() => {})
}).catch(err => { })
this.$emit('getData')
})
}).catch(res => { })
},
//
getSingle () {
this.schoolActive = 0
this.$router.push({
path: 'backstage',
query: {
...this.$route.query,
categoryId: this.$refs.tree.getCurrentKey()
}
}).catch(err => { })
this.$emit('initData')
},
//
schoolClick () {
this.schoolActive = 1
this.$emit('initData', 1)
},
//
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.updateSourceModelCategory, data).then(res => {
this.$message.success("编辑成功")
this.typeVisible = false
this.getType()
}).catch(res => { })
} else {
data.level = form.level
this.$post(this.api.categorySave, 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.deleteSourceModelCategory}?categoryId=${item.id}`).then(res => {
this.$message.success("删除成功")
this.$emit('initData')
this.getType()
}).catch(res => { })
}).catch(() => { })
}
}
};
</script>
<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>

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

Loading…
Cancel
Save