Commit a862e28f authored by Kimber's avatar Kimber

'update'

parent 21df03ec
......@@ -56,7 +56,7 @@ export function editMenu(data) {
export function getUserOnPonds(data) {
return request({
url: 'tab/usertailpon/byuser',
url: 'api/incubator/list',
method: 'get',
data:data,
params:data,
......
......@@ -309,72 +309,6 @@ var reqApis = function(){
})
})
},
openCharts: function () { // 内页共用图表
var that = this;
qf.UI.popupLayer({
//title:'<div>标题</div>',
html: '<div style="width:13rem;"></div>',
onload: function (el) {
var box = el.firstElementChild;
box.innerHTML = '<div class="p-head" style="padding-top:5px;display:flex;align-items:center;"><div class="select" style="margin:0 15px 0 5px;"><select style="height:25px;min-width:100px;"></select></div><div class="date"></div><button style="margin-left:20px;"class="el-button el-button--small el-button--primary query">查询</button></div><div class="p-body" style="height:7rem;"><div class="chart26" style="height:100%;width:100%;border:1px solid #ccc;margin-top:10px;"></div></div><div style="margin-top:5px;"><button data-type="line" class="switch" style="margin-right:4px;">折线图</button><button data-type="column" class="switch">柱状图</button></div>';
var headEl = box.firstElementChild;
var selectEl = headEl.firstElementChild;
var dateEl = selectEl.nextElementSibling;
var chartEl = headEl.nextElementSibling.firstElementChild;
var toDay = qf.UI.Dates().format('yyyy-MM-dd');
var daterange = [toDay, toDay];
var query = { daterange: daterange.join(','), sort: 'date,desc' };
var selectData = that.Dict.selectList.sensorid;
Tools.createOnSelect(selectEl.firstElementChild, selectData, {
value: 'equipno',
name: 'equipname',
fn: function (value) {
query['code'] = value
},
onload: function (value) {
query['code'] = value
},
});
qf.vue.render({
el: dateEl,
datakey: 'timeSpace',
dataType: daterange,
name: 'el-date-picker',
style: "width:280px",
attrs: {
type: "daterange",
"value-format": "yyyy-MM-dd",
"range-separator": "",
"start-placeholder": "开始日期",
"end-placeholder": "结束日期",
clearable: ""
},
change: function (value) {
query.daterange = (value || []).join(',');
}
});
var chartOpts = {};
box.onclick = function (e) {
var tag = e.target || e.srcElement;
if (tag.classList.contains('query')) {
that.pageApi.reqchart(query).then((res) => {
var body = res.body || [];
chartOpts.cache = Highchart.template.rich.call(that, chartEl, body, chartOpts);
})
} else if (tag.classList.contains('switch')) {
chartOpts.cache.update({ chart: { type: tag.dataset.type } })
};
};
that.pageApi.reqchart(query).then((res) => {
var body = res.body || [];
chartOpts.cache = Highchart.template.rich.call(that, chartEl, body, chartOpts);
})
},
})
},
getPermission: function (item) {
var list = item.permission || [];
var username = this.$store.state.user.user.username;
......@@ -796,8 +730,79 @@ var reqApis = function(){
reqApi.common.toAdd.call(this);
}
},
{
type: 'primary', icon: 'el-icon-folder-add', name: '导入企业基础信息', 'callback':function(){
var m = this;
m.uploadView = qf.UI.popWindow({
cover:true,
coverFull: true,
className:'qyzz-dialog',
//container:b0_e, // id || Element对象
//backgroundColor:'rgba(0,0,0,.4);backdrop-filter:blur(15px);',
closeEvent:true,
html:`
<div role="dialog" aria-modal="true" aria-label="信息导入" class="el-dialog" style="width:500px;">
<div class="el-dialog__header"><span class="el-dialog__title">信息导入</span><button type="button" aria-label="Close" class="el-dialog__headerbtn"><i class="el-dialog__close el-icon el-icon-close"></i></button></div>
<div class="el-dialog__body">
<div class="el-form-item el-form-item--small"><label for="incubatorImage" class="el-form-item__label" style="width: 120px;">上传企业信息</label><div class="el-form-item__content">
<div class="img-upload"><input type="file" id="kimUpload" ></div></div>
</div>
</div>
<div class="el-dialog__footer"><div class="dialog-footer"><button type="button" class="el-button el-button--text el-button--small cancel">取消</button><button type="button" class="el-button el-button--primary el-button--small confirm">确认</button></div></div>
</div>
`,
onload: function(v){
m.loginView = v;
var el = v.el;
v.file = el.querySelector("#kimUpload");
},
click: function(tag){
if(tag.classList.contains('el-icon-close')){ // 移除
m.uploadView.remove()
}else if(tag.classList.contains('confirm')){
var file = m.loginView.file.files[0];
m.uploadView.remove();
if(file){
m.fullLoading = m.$loading({
lock: true,
text: 'Loading',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
});
var data = new FormData();
data.append('file', file);
return m.pageApi.uploadfile(data).then((res) => {
m.fullLoading.close();
if(res.code === 200){
//m.loginView.file.value = '';
m.loadData()
};
m.$notify({
title: '提示',
message: res.msg,
type: 'success',
duration: 5000,
zIndex:2000,
})
}).catch(function(error) {
});
};
}else if(tag.classList.contains('cancel')){ // 取消
m.uploadView.remove()
};
},
close: function(e){
},
});
}
},
],
rightBtn: [
{
fn:'download', type:'primary', name:'下载企业基础信息模板', 'callback':function(){
window.open(baseAPI + 'api/company/exportTemplate');
}
},
],
search: [
{
......@@ -807,7 +812,7 @@ var reqApis = function(){
},
{ 'type': 'select', 'name': '在孵状态', 'word': 'incubationStatus', 'mode': 1, 'width': '140px' },
{ 'type': 'select', 'name': '企业类型', 'word': 'companyType', 'mode': 1, 'width': '140px' },
{ 'type': 'daterange', 'defaultTime': ['00:00:00', '23:59:59'], 'name': '日期范围', 'word': 'daterange', 'mode': 0, 'width': '300px', format: 'yyyy-MM-dd' },
{ 'type':'daterange', 'defaultTime':['00:00:00', '23:59:59'], 'name':'日期范围', 'word':'daterange', 'mode': 0, 'width':'300px', format:'yyyy-MM-dd' },
{
'type': 'button', 'label': '查询', 'width': '140px', 'icon': 'el-icon-search', 'click': function (e) {
this.table.page = 1;
......@@ -822,6 +827,9 @@ var reqApis = function(){
upload: function (data) {
return reqPublic('api/file/upload', 'post', data)
},
uploadfile: function (data) {
return reqPublic('api/company/import', 'post', data)
},
},
product: { // 产品信息
name: '企业产品信息',
......
......@@ -213,6 +213,9 @@ export default {
height:100%;width:100%;
}
.upload-layer.show{display:flex;}
div.upload-text1{
&:after{content:"上传文件";}
}
}
.el-dialog{
margin-top:0 !important;
......
......@@ -86,8 +86,7 @@
<el-form-item label="岗位" prop="jobs" class="is-required">
<el-select
v-model="jobDatas"
style="width: 178px"
multiple
style="width:178px"
placeholder="请选择"
@remove-tag="deleteTag"
@change="changeJob"
......@@ -133,12 +132,11 @@
/>
</el-select>
</el-form-item>
<el-form-item style="margin-bottom: 0;" label="尾矿库" prop="ponds" v-if="form.username !== 'admin'">
<el-form-item style="margin-bottom: 0;" label="孵化器" prop="ponds" v-if="jobDatas === 1">
<el-select
v-model="pondDatas"
style="width: 437px"
multiple
placeholder="请选择尾矿库"
placeholder="请选择孵化器"
@remove-tag="deletePonds"
@change="changePonds"
>
......@@ -247,7 +245,7 @@ export default {
return {
height: document.documentElement.clientHeight - 180 + 'px;',
deptName: '', depts: [], deptDatas: [], jobs: [], level: 3, roles: [],
jobDatas: [], roleDatas: [], // 多选时使用
jobDatas: '', roleDatas: [], // 多选时使用
defaultProps: { children: 'children', label: 'name', isLeaf: 'leaf' },
permission: {
add: ['admin', 'user:add'],
......@@ -275,7 +273,7 @@ export default {
{ required: true, trigger: 'blur', validator: validPhone }
]
},
ponds:[], pondDatas: [],
ponds:[], pondDatas: '',
}
},
computed: {
......@@ -290,7 +288,7 @@ export default {
const that = this
window.onresize = function temp() {
that.height = document.documentElement.clientHeight - 180 + 'px;'
}
};
},
methods: {
changeRole(value) {
......@@ -301,11 +299,15 @@ export default {
})
},
changeJob(value) {
userJobs = []
value.forEach(function(data, index) {
const job = { id: data }
userJobs.push(job)
})
if(value !== 1){
this.pondDatas = void 0;
};
//userJobs = []
//value.forEach(function(data, index) {
// const job = { id: data }
// userJobs.push(job)
//})
},
deleteTag(value) {
userRoles.forEach(function(data, index) {
......@@ -324,24 +326,27 @@ export default {
}
this.getRoleLevel()
this.getJobs()
// 获取尾矿库列表和权限
this.getUserOnPonds({username:form.username}, form);
form.enabled = form.enabled.toString()
},
// 新增前将多选的值设置为空
[CRUD.HOOK.beforeToAdd]() {
this.jobDatas = []
this.jobDatas = ''
this.roleDatas = []
},
// 初始化编辑时候的角色与岗位
[CRUD.HOOK.beforeToEdit](crud, form) {
this.getJobs(this.form.dept.id)
this.jobDatas = []
this.jobDatas = ''
this.roleDatas = []
userRoles = []
userJobs = []
this.pondDatas = form.incubatorId;
const _this = this
form.roles.forEach(function(role, index) {
_this.roleDatas.push(role.id)
......@@ -349,9 +354,10 @@ export default {
userRoles.push(rol)
})
form.jobs.forEach(function(job, index) {
_this.jobDatas.push(job.id)
//_this.jobDatas.push(job.id)
_this.jobDatas = job.id;
const data = { id: job.id }
userJobs.push(data)
//userJobs.push(data)
});
},
// 提交前做的操作
......@@ -362,7 +368,7 @@ export default {
type: 'warning'
})
return false
} else if (this.jobDatas.length === 0) {
} else if (!this.jobDatas) {
this.$message({
message: '岗位不能为空',
type: 'warning'
......@@ -376,8 +382,10 @@ export default {
return false
}
crud.form.roles = userRoles
crud.form.jobs = userJobs
crud.form.ponds = userPonds;
crud.form.jobs = [{id: this.jobDatas}],
//crud.form.jobs = userJobs
crud.form.incubatorId = this.pondDatas;
//crud.form.ponds = userPonds;
return true
},
// 获取左侧部门数据
......@@ -492,21 +500,21 @@ export default {
getUserOnPonds(param, form) {
getUserOnPonds(param).then(res => {
var self = this;
this.ponds = res.body.list;
this.ponds = res.body || [];
form.ponds = res.body.user;
this.pondDatas = [];
userPonds = [];
form.ponds.forEach(function(pond, index) {
self.pondDatas.push(pond.id);
userPonds.push({ id: pond.id });
})
//this.pondDatas = '';
//userPonds = [];
//form.ponds.forEach(function(pond, index) {
// self.pondDatas.push(pond.id);
// userPonds.push({ id: pond.id });
//})
}).catch(() => { })
},
changePonds(value) {
userPonds = []
value.forEach(function(data, index) {
userPonds.push({ id: data })
})
//userPonds = []
//value.forEach(function(data, index) {
// userPonds.push({ id: data })
//})
},
deletePonds(value) {
/* userRoles.forEach(function(data, index) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment