源模型增删改查

dev_2022-03-03
yujialong 3 years ago
parent 2cf0f0674c
commit d9b4ec85b8
  1. BIN
      src/assets/img/yes.png
  2. 44
      src/components/codemirror.vue
  3. 7
      src/utils/api.js
  4. 58
      src/views/serve/addModel.vue
  5. 11
      src/views/serve/backstage/index.vue
  6. 578
      src/views/serve/backstage/model.vue
  7. 17
      src/views/serve/backstage/modelType.vue
  8. 220
      src/views/serve/backstage/sourceModel.vue
  9. 17
      src/views/serve/backstage/sourceType.vue

Binary file not shown.

After

Width:  |  Height:  |  Size: 395 B

@ -28,19 +28,11 @@
</div>
</div>
<div class="result-right t-color" v-show="isError">
<!-- <img :src="require(`@/assets/images/system/${systemId}/yes.png`)" alt />运行成功 -->
<img src="@/assets/img/yes.png" alt />运行成功
</div>
<div class="result-wrong" v-show="isError === 0">
<img src="@/assets/img/error.png" alt />
{{errLine}}行出现错误
<el-button class="tips-btn" @click="getTips" v-show="showTips">提示</el-button>
<el-dialog title="答案提示" center :close-on-click-modal="false" :visible.sync="tipsVisible">
<el-tabs>
<el-tab-pane label="参考答案">
<div class="answer-wrap" v-html="answer"></div>
</el-tab-pane>
</el-tabs>
</el-dialog>
</div>
</div>
</div>
@ -89,19 +81,17 @@ import "codemirror/theme/monokai.css";
import "codemirror/theme/base16-light.css";
import { Loading } from 'element-ui';
export default {
props: ['code', 'codeId', 'projectId', 'retResult'],
props: ['code', 'codeId', 'projectId', 'retResult', 'readOnly'],
data() {
return {
showTips: false, //
answer: '', //
codeVal: this.code,
runResult: '', //
isError: false, //
errLine: '', //
tipsVisible: false, //
picSrcList: [],
loadIns: null, // loading
cmOption: {
readOnly: this.readOnly,
scrollbarStyle: "native",
tabSize: 2, // tab
styleActiveLine: true, //
@ -139,7 +129,6 @@ export default {
mounted() {
},
methods: {
//
ready() {
@ -159,22 +148,12 @@ export default {
type: "warning"
})
} else {
const bcId = this.judgmentId
const cid = this.courseId
const projectId = this.projectId
this.loadIns = Loading.service({
background: 'transparent'
})
// savefig(python),savefig
code = code.replace(/\.savefig\(([\u4e00-\u9fa5\w]*?['"])/mg, str => {
return str + Date.now()
})
// Python
this.$post(this.api.runPythonCode, {
code,
bcId,
cid,
projectId
code
}).then(res => {
const data = res.code
const photo = data.photoUrl
@ -183,9 +162,6 @@ export default {
this.loadIns.close()
this.picSrcList = []
if (photo) this.picSrcList = photo.split(',')
this.$emit('update:codeId', res.codeId) // coddeId
this.$emit('update:answer', result) //
this.$emit('update:retResult', data.retResult) //
let imgList = ''
let firtImg = ''
try {
@ -222,15 +198,6 @@ export default {
//
downloadPic(i) {
this.$refs['picLink' + i][0].click()
},
//
getTips() {
this.tipsVisible = true
this.$get(this.api.queryBcJudgmentByBcId, {
bcId: this.judgmentId
}).then(res => {
this.answer = res.experimentCode
}).catch(err => {})
}
}
};
@ -322,8 +289,9 @@ export default {
left: 20px;
right: 20px;
display: flex;
align-items: center;
bottom: 10px;
padding: 0 10px;
padding: 5px 10px;
img {
width: 40px;
height: 40px;

@ -103,6 +103,13 @@ export default {
categorySave: `${host}/nakadai/model/category/save`,
sourceModelClassification: `${host}/nakadai/model/category/sourceModelClassification`,
bulkDisable: `${host}/nakadai/model/demo/bulkDisable`,
deleteSysModelDemo: `${host}/nakadai/model/demo/deleteSysModelDemo`,
modelFindById: `${host}/nakadai/model/demo/findById`,
saveSysModelDemo: `${host}/nakadai/model/demo/saveSysModelDemo`,
sysModelDemoList: `${host}/nakadai/model/demo/sysModelDemoList`,
updateSysModelDemo: `${host}/nakadai/model/demo/updateSysModelDemo`,
runPythonCode: `${host}/nakadai/model/demo/runPythonCode`,
// 课程管理三级联查
courseDiscipline: `${host}/nakadai/nakadai/subject/courseDiscipline`, //课程学科类别

@ -5,19 +5,25 @@
<div class="per_title" v-preventReClick @click="$router.back()">
<i class="el-icon-arrow-left"></i>
<span class="per_back">返回</span>
<span class="per_school" v-text="isDetail ? '查看源模型' : (customerId ? '编辑源模型' : '新增源模型')"></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>
<el-button v-if="!isDetail" type="primary" round v-preventReClick @click="submit">确定</el-button>
</div>
</el-card>
<el-card shadow="hover">
<el-form ref="form" label-width="120px" :disabled="isDetail">
<el-form-item label="模型名称">
<el-input placeholder="请输入模型名称" v-model="form.position" maxlength="25"></el-input>
<el-input placeholder="请输入模型名称" v-model="form.modelName" maxlength="25"></el-input>
</el-form-item>
<el-form-item label="模型代码">
<codemirror
:key="codeKey"
:code.sync="form.modelDemo"
:readOnly="isDetail"
></codemirror>
</el-form-item>
</el-form>
@ -31,20 +37,54 @@ export default {
components:{ codemirror },
data() {
return {
customerId : this.$route.query.id,
categoryId : Number(this.$route.query.categoryId),
id : Number(this.$route.query.id),
postStatus : Number(this.$route.query.postStatus),
isDetail : Boolean(this.$route.query.show),
form: {
}
modelName: '',
modelDemo: ''
},
codeKey: 1
};
},
mounted() {
this.id && this.getData()
},
methods: {
//
getData() {
this.$post(`${this.api.modelFindById}?id=${this.id}`).then(res => {
const { data } = res
this.form.modelName = data.modelName
this.form.modelDemo = data.modelDemo
this.codeKey++
}).catch(res => {})
},
//
submit(){
submit(postStatus){
const { modelName, modelDemo } = this.form
const id = this.id
if (!modelName) return this.$message.error('请输入模型名称')
if (!modelDemo) return this.$message.error('请输入模型代码')
const data = {
categoryId: this.categoryId,
modelName,
modelDemo,
postStatus
}
if (id) {
data.id = id
this.$post(this.api.updateSysModelDemo, data).then(res => {
this.$message.success('编辑成功')
this.$router.back()
}).catch(res => {})
} else {
this.$post(this.api.saveSysModelDemo, data).then(res => {
this.$message.success('新增成功')
this.$router.back()
}).catch(res => {})
}
},
}
};

@ -15,7 +15,7 @@ import sourceModel from "./sourceModel";
export default {
data() {
return {
active: "model",
active: this.$route.query.type || 'model',
tabs: {
model: "模型列表管理",
sourceModel: "源模型管理"
@ -32,7 +32,14 @@ export default {
created() {},
methods: {
tabChange(index) {
this.active = index;
this.active = index
this.$router.push({
path: 'backstage',
query: {
...this.$route.query,
type: index
}
})
}
}
};

@ -1,7 +1,7 @@
<template>
<div class="wrap">
<div class="side">
<org ref="org" @getSingle="getSingle" @getCheck="getCheck"></org>
<org ref="org"></org>
</div>
<div class="right">
@ -13,8 +13,8 @@
</li>
</ul>
<div>
<el-button type="primary" round @click="addTeacher">导入模型</el-button>
<el-button type="primary" round @click="delAllSelection">批量移除</el-button>
<el-button type="primary" round @click="add">导入模型</el-button>
<el-button type="primary" round @click="batchDel">批量移除</el-button>
</div>
</div>
@ -27,7 +27,7 @@
<el-table-column label="操作" width="200" align="center">
<template slot-scope="scope">
<el-button type="text" @click="showTeacher(scope.row)">查看</el-button>
<el-button type="text" @click="delTeacher(scope.row)">移除</el-button>
<el-button type="text" @click="del(scope.row)">移除</el-button>
</template>
</el-table-column>
</el-table>
@ -36,186 +36,84 @@
</div>
</div>
<el-dialog :title="isDetail ? '查看员工' : (isAdd ? '新增员工' : '编辑员工')" :visible.sync="teacherVisible"
width="30%" @close="closeTeacher" class="dialog" :close-on-click-modal="false">
<el-form ref="teacherForm" :model="teacherForm" :rules="rules" label-width="150px" :disabled="isDetail" style='margin-right: 80px;'>
<el-form-item prop="account" label="账号">
<el-input v-model.trim="teacherForm.account" placeholder="请输入职工账号"></el-input>
</el-form-item>
<el-form-item prop="userName" label="用户姓名">
<el-input v-model.trim="teacherForm.userName" placeholder="请输入员工姓名"></el-input>
</el-form-item>
<el-form-item prop="roleValue" label="账号角色">
<el-select v-model="teacherForm.roleValue" @change="roleChange" @remove-tag="roleRemove" multiple style="width: 100%;height: 32px">
<el-option
v-for="item in roleList"
:key="item.id"
:label="item.roleName"
:value="item.id">
</el-option>
</el-select>
</el-form-item>
<el-form-item prop="uniqueIdentification" label="唯一标识">
<el-input disabled v-model.trim="teacherForm.uniqueIdentification" placeholder="请输入职工工号获取唯一标识"></el-input>
</el-form-item>
<el-form-item prop="workNumber" label="工号">
<el-input v-model.trim="teacherForm.workNumber" placeholder="请输入职工工号"></el-input>
</el-form-item>
<el-form-item v-for="item in teacherForm.roleAndDeptList" :label="`${item.roleName}所属部门`" :rules="{
required: true, message: '请选择', trigger: 'change'
}">
<el-cascader
v-model="item.cascaderValue"
:options="orgList"
:props="casProps"
style="width: 100%"
></el-cascader>
</el-form-item>
<el-form-item prop="phone" label="手机号">
<el-input v-model.trim="teacherForm.phone" placeholder="请输入手机号" maxlength="11" @blur="phoneChange"></el-input>
</el-form-item>
<el-form-item prop="email" label="邮箱">
<el-input v-model.trim="teacherForm.email" placeholder="请输入邮箱" @blur="emailChange"></el-input>
</el-form-item>
</el-form>
<el-dialog title="请选择需要导入的模型" :visible.sync="modelVisible" width="500px" class="dialog" :close-on-click-modal="false">
<el-tree
:data="modelData"
ref="tree"
default-expand-all
show-checkbox
:check-strictly="true"
node-key="id">
</el-tree>
<span slot="footer" class="dialog-footer" v-if="!isDetail">
<el-button @click="closeTeacher"> </el-button>
<el-button type="primary" @click="saveSure('teacherForm')"> </el-button>
</span>
</el-dialog>
<el-dialog title="批量导入" :visible.sync="importVisible" width="24%" :close-on-click-modal="false">
<div style="text-align: center">
<div style="margin-bottom: 10px;">
<el-button type="primary" @click="downLoad">模板下载<i class="el-icon-download el-icon--right"></i></el-button>
</div>
<el-upload
name="file"
accept=".xls,.xlsx"
:on-remove="handleRemove"
:on-error="uploadError"
:on-success="uploadSuccess"
:before-remove="beforeRemove"
:limit="1"
:on-exceed="handleExceed"
:action="this.api.importStaff"
:file-list="uploadList"
:headers="headers"
>
<el-button type="primary" class="ml20">上传文件<i class="el-icon-upload2 el-icon--right"></i></el-button>
</el-upload>
<el-link v-if="uploadFaild" type="primary" @click="showFaild">部分数据导入失败查看失败原因</el-link>
</div>
<span slot="footer" class="dialog-footer">
<el-button @click="importVisible = false"> </el-button>
<el-button type="primary" @click="uploadSure"> </el-button>
<el-button @click="modelVisible = false"> </el-button>
<el-button type="primary" @click="submit"> </el-button>
</span>
</el-dialog>
</div>
</template>
<script>
import Setting from "@/setting";
import org from "./modelType"
export default {
data() {
var accountPass = (rule, value, callback) => {
if (value === '') {
callback(new Error('请输入账号'));
} else {
var pattern = /^[A-Za-z0-9]*$/;
if(pattern.test(value)){
this.accountChange();
callback();
}else{
callback(new Error('请输入正确账号格式'));
}
}
};
var workNumberPass = (rule, value, callback) => {
if (value === '') {
callback(new Error('请输入职工工号'));
} else {
var pattern = /^[a-zA-Z0-9]*$/;
if(pattern.test(value)){
this.workNumberChange();
callback();
}else{
callback(new Error('职工工号必须为数字或英文'));
}
}
};
return {
exportCode: "",
headers: {
// token: util.local.get(Setting.tokenKey)
},
isDetail: false,
isAdd: false,
teacherVisible: false,
roleList: [], //
orgList: [], //
casProps: {
value: 'id'
},
teacherForm: {
accountId: "",
account: "",
userName: "",
roleValue: [],
roleAndDeptList: [],
uniqueIdentification: "",
workNumber: "",
phone: "",
email: ""
},
rules: {
account: [
{ required: true, validator: accountPass, trigger: 'blur' }
],
userName: [
{ required: true, message: "请输入用户姓名", trigger: "blur" }
],
roleValue: [
{ required: true, message: "请选择账号角色", trigger: "change" }
],
workNumber: [
{ required: true, validator: workNumberPass , trigger: 'blur' }
],
uniqueIdentification: [
// { required: true, message: '', trigger: 'blur' },
],
phone: [
// { required: true, message: '', trigger: 'blur' },
{ pattern: /^1[3456789]\d{9}$/, message: "请输入正确的手机号", trigger: "blur"}
],
email: [
// { required: true, message: '', trigger: 'blur' },
{
pattern: /^([a-zA-Z]|[0-9])(\w|\-)+@[a-zA-Z0-9]+\.([a-zA-Z]{2,4})$/,
message: "请输入正确的邮箱",
trigger: "blur"
}
],
},
accountReapeat: false,
workNumberReapeat: false,
phoneRepeat: false,
emailRepeat: false,
listData: [], //
keyword: "",
listData: [],
keyword: '',
page: 1,
pageSize: 10,
total: 0,
multipleSelection: [], //
importVisible: false, //
uploadList: [], //
uploadFaild: false, //
gradeId: "", // ID
staffArchitectureId: "", // ID
submiting: false //
multipleSelection: [],
modelVisible: false,
modelData: [
{
id: 1,
label: '品牌一',
children: [
{
id: 4,
label: '华东区域',
children: [
{
id: 9,
label: '上海'
},
{
id: 10,
label: '昆山'
}
]
}
]
},
{
id: 2,
label: '品牌二',
children: [
{
id: 5,
label: '华东区域'
},
{
id: 6,
label: '华南区域'
}
]
},
{
id: 3,
label: '品牌三',
children: [
{
id: 7,
label: '华北区域'
},
{
id: 8,
label: '华南区域'
}
]
}
]
};
},
components: {
@ -225,36 +123,13 @@ export default {
keyword: function(val) {
clearTimeout(this.searchTimer);
this.searchTimer = setTimeout(() => {
this.initData();
}, 500);
this.initData()
}, 500)
}
},
mounted() {
// this.getRoleData()
// this.getData()
},
mounted() {},
methods: {
getSingle(data) {
this.staffArchitectureId = data.gradeId ? '' : data.staffArchitectureId
this.gradeId = data.gradeId || ''
this.initData()
},
getCheck(data) {
const marjorIds = []
const depIds = []
data.forEach(e => {
e.gradeId ? depIds.push(e.gradeId) : marjorIds.push(e.staffArchitectureId)
});
this.staffArchitectureId = marjorIds.toString()
this.gradeId = depIds.toString()
this.initData()
},
initData() {
this.$refs.table.clearSelection()
this.page = 1
this.getData()
},
getData() { //
getData() {
let data = {
keyWord: this.keyword,
pageNum: this.page,
@ -267,236 +142,21 @@ export default {
this.total = res.page.total;
}).catch(res => {});
},
getRoleData() { //
this.roleList =[];
this.$get(`${this.api.roleList}?page=1&size=100&name=&platformId=1`).then(res => {
for(var i=0;i<res.rolePage.records.length;i++){
if (res.rolePage.records[i].roleName == '超级管理员'){
}else{
this.roleList.push(res.rolePage.records[i])
}
}
// this.roleList = res.rolePage.records;
}).catch(res => {});
},
closeTeacher() { // /
this.teacherForm = {
accountId: "",
account: "",
userName: "",
roleValue: [],
roleAndDeptList: [],
uniqueIdentification: "",
workNumber: "",
phone: "",
email: ""
};
this.$refs.teacherForm.clearValidate();
this.teacherVisible = false;
},
addTeacher() { //
this.isDetail = false;
this.isAdd = true;
this.teacherVisible = true;
this.orgList = this.$refs.org.orgList;
},
getStaffDetail(accountId) { //
this.$get(`${this.api.staffDetail}?accountId=${accountId}`).then(res => {
let { data } = res;
this.teacherForm = data;
this.teacherForm.roleValue = data.roleAndDeptList.map(i => i.roleId);
this.teacherForm.roleAndDeptList = data.roleAndDeptList.map(i => {
i.cascaderValue = [i.staffArchitectureId, i.gradeId]
return i;
});
console.log(22, this.teacherForm)
}).catch(res => {});
},
resetPassword(row) { //
this.$confirm(`重置后的密码为:${Setting.initialPassword},确定重置?`, "提示", { type: "warning" }).then(() => {
this.$get(`${this.api.resetPassword}?userId=${row.userId}&newPwd=111aaa`).then(res => {
this.$message.success("重置成功");
}).catch(res => {
});
}).catch(() => {
});
},
editTeacher(row) { //
this.isDetail = false;
this.isAdd = false;
this.teacherVisible = true;
this.orgList = this.$refs.org.orgList;
this.getStaffDetail(row.accountId);
},
showTeacher(row) { //
this.isDetail = true;
this.isAdd = false;
this.teacherVisible = true;
this.orgList = this.$refs.org.orgList;
this.getStaffDetail(row.accountId);
},
accountChange() { //
if (this.teacherForm.account) {
let url = "";
if (this.isAdd) {
url = `${this.api.checkWorkNumOrAccount}?platformId=${Setting.platformId}&type=${Setting.platformType}&account=${this.teacherForm.account}&workNumber=`;
} else {
url = `${this.api.checkWorkNumOrAccount}?platformId=${Setting.platformId}&type=${Setting.platformType}&accountId=${this.teacherForm.accountId}&account=${this.teacherForm.account}&workNumber=`;
}
this.$post(url).then(res => {
if (res.status === 200) {
this.accountReapeat = false;
}
}).catch( err => {
this.accountReapeat = true;
});
}
},
workNumberChange() { //
if (this.teacherForm.workNumber) {
let url = "";
if (this.isAdd) {
url = `${this.api.checkWorkNumOrAccount}?platformId=${Setting.platformId}&type=${Setting.platformType}&workNumber=${this.teacherForm.workNumber}&account=`;
} else {
url = `${this.api.checkWorkNumOrAccount}?platformId=${Setting.platformId}&type=${Setting.platformType}&accountId=${this.teacherForm.accountId}&workNumber=${this.teacherForm.workNumber}&account=`;
}
this.$post(url).then(res => {
if (res.status === 200) {
this.workNumberReapeat = false;
}
}).catch( err => {
this.workNumberReapeat = true;
});
}
},
phoneChange() { //
let regex = /^1[3456789]\d{9}$/;
if (regex.test(this.teacherForm.phone)) {
let url = "";
if (this.isAdd) {
url = `${this.api.checkEmailOrPhone}?phone=${this.teacherForm.phone}&email=`;
} else {
url = `${this.api.checkEmailOrPhone}?accountId=${this.teacherForm.accountId}&phone=${this.teacherForm.phone}&email=`;
}
this.$post(url).then(res => {
if (res.status === 200) {
this.phoneRepeat = false;
}
}).catch( err => {
this.phoneRepeat = true;
});
}
},
emailChange() { //
let regex = /^([a-zA-Z]|[0-9])(\w|\-)+@[a-zA-Z0-9]+\.([a-zA-Z]{2,4})$/;
if (regex.test(this.teacherForm.email)) {
let url = "";
if (this.isAdd) {
url = `${this.api.checkEmailOrPhone}?email=${this.teacherForm.email}&phone=`;
} else {
url = `${this.api.checkEmailOrPhone}?accountId=${this.teacherForm.accountId}&email=${this.teacherForm.email}&phone=`;
}
this.$post(url).then(res => {
if (res.status === 200) {
this.emailRepeat = false;
}
}).catch( err => {
this.emailRepeat = true;
});
}
},
roleChange(value) { //
console.log(this.teacherForm.roleValue)
if (value.length) {
let ids = this.teacherForm.roleAndDeptList.map(e => e.roleId);
this.roleList.forEach(i => {
let obj = {
roleId: "",
roleName: "",
cascaderValue: []
};
if (value.includes(i.id) && !ids.includes(i.id)) {
console.log(i)
obj.roleId = i.id;
obj.roleName = i.roleName;
this.teacherForm.roleAndDeptList.push(obj);
}
});
} else {
this.teacherForm.roleAndDeptList.splice(0);
}
initData() {
this.$refs.table.clearSelection()
this.page = 1
this.getData()
},
roleRemove(value) { //
let list = [];
for(var i=0;i<this.teacherForm.roleAndDeptList.length;i++){
if (this.teacherForm.roleAndDeptList[i].roleId == value){
}else{
list.push(this.teacherForm.roleAndDeptList[i])
}
}
this.teacherForm.roleAndDeptList = list
//
add() {
this.modelVisible = true
},
async saveSure(teacherForm) {
this.$refs[teacherForm].validate((valid) => {
if (valid) {
if (this.submiting) return false
if (this.accountReapeat) return this.$message.warning("该账号已存在");
if (this.workNumberReapeat) return this.$message.warning("该员工工号已存在");
if (this.phoneRepeat) return this.$message.warning("该手机号已存在");
if (this.emailRepeat) return this.$message.warning("该邮箱已存在");
let data = {
accountId: this.teacherForm.accountId,
account: this.teacherForm.account,
userName: this.teacherForm.userName,
roleAndDeptList: [],
uniqueIdentification: this.teacherForm.uniqueIdentification ? this.teacherForm.uniqueIdentification : new Date().getTime(),
workNumber: this.teacherForm.workNumber,
phone: this.teacherForm.phone,
email: this.teacherForm.email
};
if (this.teacherForm.roleAndDeptList.length){
for (let i = 0; i < this.teacherForm.roleAndDeptList.length; i++) {
if (this.teacherForm.roleAndDeptList[i].cascaderValue.length < 2) {
this.$message.warning(`请选择${this.teacherForm.roleAndDeptList[i].roleName}所属部门`)
return;
} else {
let obj = {
roleId: this.teacherForm.roleAndDeptList[i].roleId,
staffArchitectureId: this.teacherForm.roleAndDeptList[i].cascaderValue[0],
gradeId: this.teacherForm.roleAndDeptList[i].cascaderValue[1]
};
data.roleAndDeptList.push(obj);
}
}
}
this.submiting = true
if (this.teacherForm.accountId) {
this.$post(this.api.modifyStaff, data).then(res => {
this.$message.success("编辑成功");
this.closeTeacher();
this.getData();
this.submiting = false
}).catch(res => {
this.submiting = false
});
} else {
this.$post(this.api.saveStaff, data).then(res => {
this.$message.success("添加成功");
this.closeTeacher();
this.getData();
this.submiting = false
}).catch(res => {
this.submiting = false
});
}
} else {
return false;
}
});
//
show(row) {
this.modelVisible = true
},
delTeacher(row) {
//
del(row) {
this.$confirm("确定要删除吗?", "提示", {
type: "warning"
}).then(() => {
@ -507,11 +167,11 @@ export default {
}).catch(() => {});
},
handleSelectionChange(val) {
this.multipleSelection = val;
this.multipleSelection = val
},
delAllSelection() {
//
batchDel() {
if (this.multipleSelection.length) {
//
this.$confirm("确定要删除吗?", "提示", {
type: "warning"
}).then(() => {
@ -528,66 +188,16 @@ export default {
}).catch(() => {
});
} else {
this.$message.error("请先选择员工 !");
this.$message.error("请先选择模型 !");
}
},
batchImport() {
this.importVisible = true;
this.uploadList = [];
this.uploadFaild = false;
},
searchTeacher() {
this.page = 1;
this.getData();
},
handleCurrentChange(val) {
this.page = val;
this.getData();
},
downLoad() {
location.href = this.api.staffTemplate;
},
showFaild() {
location.href = `${this.api.exportFailureStaff}?exportCode=${this.exportCode}`;
},
//
handleExceed(files, fileList) {
this.$message.warning(
`当前限制选择 1 个文件,如需更换,请删除上一个文件再重新选择!`
);
},
uploadSuccess(res, file, fileList) {
console.log(res);
this.uploadFaild = false;
if (res.status === 200) {
if (res.data.exportCode) {
this.exportCode = res.data.exportCode;
this.uploadFaild = true;
}
this.$message.success(`上传成功${res.data.successNum},上传失败${res.data.failureNum}`);
} else {
res.message ? this.$message.error(res.message) : this.$message.error("上传失败,请检查数据");
}
},
uploadError(err, file, fileList) {
this.$message({
message: "上传出错,请重试!",
type: "error",
center: true
});
},
beforeRemove(file, fileList) {
return this.$confirm(`确定移除 ${file.name}`);
},
handleRemove(file, fileList) {
this.uploadList = fileList;
this.uploadFaild = false;
this.page = val
this.getData()
},
uploadSure() {
this.importVisible = false;
this.page = 1;
this.keyword = "";
this.getData();
//
submit() {
}
}
};

@ -2,7 +2,7 @@
<div>
<div>
<div class="flex-between m-b-20">
<el-button type="text" icon="el-icon-refresh">同步原始模型列表</el-button>
<el-button type="text" icon="el-icon-refresh" @click="syncModel">同步原始模型列表</el-button>
<el-button type="text" @click="addMajor">添加</el-button>
</div>
<org-tree
@ -101,6 +101,21 @@ export default {
this.Form.staffArchitectureName = ''
this.typeVisible = true
},
//
syncModel() {
this.$confirm('同步后当前的组织架构将会被删除,是否继续?', '提示', {
type: "warning"
}).then(() => {
// let ids = this.multipleSelection.map(item => {
// return item.accountId;
// });
// this.$post(`${this.api.delStaff}?accountIds=${ids.toString()}`).then(res => {
// this.$refs.table.clearSelection();
// this.$message.success("");
// this.getData();
// }).catch(res => {})
}).catch(() => {})
},
sure(Form) { // /
this.$refs[Form].validate((valid) => {
if (valid) {

@ -1,7 +1,7 @@
<template>
<div class="wrap">
<div class="side">
<org ref="org" @getSingle="getSingle" @getCheck="getCheck"></org>
<org ref="tree" @initData="initData"></org>
</div>
<div class="right">
@ -15,24 +15,28 @@
<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">批量禁用</el-button>
<el-button type="primary" round @click="batchOpen">批量开启</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="userName" label="模型名称" align="center"></el-table-column>
<el-table-column prop="account" label="编辑人" align="center"></el-table-column>
<el-table-column prop="account" label="最新编辑时间" align="center"></el-table-column>
<el-table-column prop="workNumber" label="状态" align="center"></el-table-column>
<el-table-column label="操作" width="200" align="center">
<el-table-column prop="modelName" label="模型名称" 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-model="scope.row.isEnable" :active-value="1" :inactive-value="0" style="margin: 0 10px 0 5px" :active-text="scope.row.isEnable ? '启用' : '禁用'" @change="switchOff($event,scope.row,scope.$index)"></el-switch>
<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>
@ -43,53 +47,16 @@
</div>
</template>
<script>
import Setting from "@/setting";
import org from "./sourceType"
export default {
data() {
return {
exportCode: "",
headers: {
// token: util.local.get(Setting.tokenKey)
},
isDetail: false,
isAdd: false,
teacherVisible: false,
roleList: [], //
orgList: [], //
casProps: {
value: 'id'
},
teacherForm: {
accountId: "",
account: "",
userName: "",
roleValue: [],
roleAndDeptList: [],
uniqueIdentification: "",
workNumber: "",
phone: "",
email: ""
},
accountReapeat: false,
workNumberReapeat: false,
phoneRepeat: false,
emailRepeat: false,
listData: [], //
keyword: "",
page: 1,
pageSize: 10,
total: 0,
multipleSelection: [], //
importVisible: false, //
uploadList: [], //
uploadFaild: false, //
gradeId: "", // ID
staffArchitectureId: "", // ID
submiting: false //
multipleSelection: []
};
},
components: {
@ -99,178 +66,99 @@ export default {
keyword: function(val) {
clearTimeout(this.searchTimer);
this.searchTimer = setTimeout(() => {
this.initData();
}, 500);
this.initData()
}, 500)
}
},
mounted() {
},
methods: {
getSingle(data) {
this.staffArchitectureId = data.gradeId ? '' : data.staffArchitectureId
this.gradeId = data.gradeId || ''
this.initData()
},
getCheck(data) {
const marjorIds = []
const depIds = []
data.forEach(e => {
e.gradeId ? depIds.push(e.gradeId) : marjorIds.push(e.staffArchitectureId)
});
this.staffArchitectureId = marjorIds.toString()
this.gradeId = depIds.toString()
this.initData()
//
getData() {
this.$post(this.api.sysModelDemoList, {
modelName: this.keyword,
pageNum: this.page,
pageSize: this.pageSize,
categoryId: this.$refs.tree.$refs.tree.getCurrentKey()
}).then(res => {
this.listData = res.data.records
this.total = res.data.total
}).catch(res => {})
},
initData() {
this.$refs.table.clearSelection()
this.page = 1
this.getData()
},
getData() { //
let data = {
keyWord: this.keyword,
pageNum: this.page,
pageSize: this.pageSize,
staffArchitectureId: this.staffArchitectureId,
gradeId: this.gradeId
};
this.$post(this.api.staffList, data).then(res => {
this.listData = res.page.records;
this.total = res.page.total;
}).catch(res => {});
},
getRoleData() { //
this.roleList =[];
this.$get(`${this.api.roleList}?page=1&size=100&name=&platformId=1`).then(res => {
for(var i=0;i<res.rolePage.records.length;i++){
if (res.rolePage.records[i].roleName == '超级管理员'){
}else{
this.roleList.push(res.rolePage.records[i])
}
}
// this.roleList = res.rolePage.records;
}).catch(res => {});
},
closeTeacher() { // /
this.teacherForm = {
accountId: "",
account: "",
userName: "",
roleValue: [],
roleAndDeptList: [],
uniqueIdentification: "",
workNumber: "",
phone: "",
email: ""
};
this.$refs.teacherForm.clearValidate();
this.teacherVisible = false;
},
//
add() {
this.$router.push('/addModel')
this.$router.push(`/addModel?categoryId=${this.$refs.tree.$refs.tree.getCurrentKey()}`)
},
//
batchDel() {
if (this.multipleSelection.length) {
//
let ids = this.multipleSelection.map(e => e.id)
this.$confirm("确定要删除吗?", "提示", {
type: "warning"
}).then(() => {
let ids = this.multipleSelection.map(item => {
return item.accountId;
});
this.$post(`${this.api.delStaff}?accountIds=${ids.toString()}`).then(res => {
this.$refs.table.clearSelection();
this.$message.success("删除成功");
this.getData();
this.$post(this.api.deleteSysModelDemo, ids).then(res => {
this.$message.success('删除成功')
this.getData()
}).catch(res => {})
}).catch(() => {
});
}).catch(() => {})
} else {
this.$message.error("请先选择模型 !")
}
},
//
batchOff() {
//
batchOff(isOpen) {
const off = isOpen === 0
if (this.multipleSelection.length) {
//
this.$confirm("确定要删除吗?", "提示", {
let ids = this.multipleSelection.map(e => e.id)
this.$confirm(`确定要${off ? '启用' : '禁用'}吗?`, "提示", {
type: "warning"
}).then(() => {
let ids = this.multipleSelection.map(item => {
return item.accountId;
});
this.$post(`${this.api.delStaff}?accountIds=${ids.toString()}`).then(res => {
this.$refs.table.clearSelection();
this.$message.success("删除成功");
this.getData();
this.$post(`${this.api.bulkDisable}?isOpen=${isOpen}`, ids).then(res => {
this.$message.success(`${off ? '启用' : '禁用'}成功`)
this.getData()
}).catch(res => {})
}).catch(() => {
});
} else {
this.$message.error("请先选择模型 !")
}
},
//
batchOpen() {
if (this.multipleSelection.length) {
//
this.$confirm("确定要删除吗?", "提示", {
type: "warning"
}).then(() => {
let ids = this.multipleSelection.map(item => {
return item.accountId;
});
this.$post(`${this.api.delStaff}?accountIds=${ids.toString()}`).then(res => {
this.$refs.table.clearSelection();
this.$message.success("删除成功");
this.getData();
}).catch(res => {})
}).catch(() => {
});
}).catch(() => {})
} else {
this.$message.error("请先选择模型 !")
}
},
//
show(row) {
this.$router.push('/addModel')
this.$router.push(`/addModel?categoryId=${this.$refs.tree.$refs.tree.getCurrentKey()}&id=${row.id}&show=1`)
},
//
edit(row) {
this.$router.push('/addModel')
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.delStaff}?accountIds=${row.accountId}`).then(res => {
this.$message.success("删除成功");
this.getData();
}).catch(res => {});
}).catch(() => {});
this.$post(this.api.deleteSysModelDemo, [row.id]).then(res => {
this.$message.success('删除成功')
this.getData()
}).catch(res => {})
}).catch(() => {})
},
switchOff(val,row,index) {
this.$get(this.api.updateAccountAllEnable,{
id: row.userId,
isEnable: val
}).then(res => {
if(res.code == '200') {
this.$message.success(val ? '启用成功' : '禁用成功')
}else{
this.$message.success(res.message)
}
this.$post(`${this.api.bulkDisable}?isOpen=${val}`, [row.id]).then(res => {
this.$message.success(val ? '禁用成功' : '启用成功')
}).catch(res => {})
},
handleSelectionChange(val) {
this.multipleSelection = val;
this.multipleSelection = val
},
handleCurrentChange(val) {
this.page = val;
this.getData();
this.page = val
this.getData()
}
}
};

@ -6,14 +6,12 @@
</div>
<org-tree
:data="orgList"
show-checkbox
default-expand-all
ref="orgTree"
ref="tree"
node-key="id"
highlight-current
:expand-on-click-node="false"
@node-click="getSingle"
@check="getCheck"
:props="{children: 'children', label: 'categoryName', isLeaf: 'leaf'}"
>
<span class="custom-tree-node" slot-scope="{ node, data }">
@ -83,11 +81,16 @@ export default {
methods: {
getType() {
this.$post(this.api.sourceModelClassification).then(res => {
this.orgList = res.data
const { data } = res
this.orgList = data
data.length && this.$nextTick(() => {
this.$refs.tree.setCurrentKey(data[0].id)
this.getSingle()
})
}).catch(res => {})
},
getSingle(data) {
this.$emit('getSingle', data)
getSingle() {
this.$emit('initData')
},
getCheck(data, checked) {
this.$emit('getCheck', checked.checkedNodes)
@ -117,7 +120,7 @@ export default {
if (data.id) {
debugger
this.$post(this.api.updateProfessional, data).then(res => {
his.$message.success("编辑成功")
this.$message.success("编辑成功")
this.typeVisible = false
this.getType()
}).catch(res => {})

Loading…
Cancel
Save