刘翔宇-旅管家 4 years ago
parent d1a1cc28fc
commit b66b32af5f

Binary file not shown.

@ -18,22 +18,22 @@
<el-table-column type="index" width="50" align="center"> </el-table-column>
<el-table-column :prop="column.field" :align="column.align" v-for="(column,index) in columns"
:label="column.title" :width="column.width">
<template slot-scope="scope">
<div v-for="safe in scope.row.safety_task_departments" v-if="safe.departments.id==department_user_id">
<div v-if="column.type=='status'">
<div v-for="item in isStatus" v-if="safe.status==item.id">
{{item.name}}
</div>
</div>
<div v-else-if="column.type=='opt'">
<Button v-if="safe.status==0" ghost size="small" @click="edit(scope.row)" type="primary"
style="margin-left: 10px;">新增上报</Button>
<Button v-if="safe.status==1" ghost size="small" @click="edit(safe,true)" type="primary"
style="margin-left: 10px;">编辑上报</Button>
<Button v-if="safe.status==2" ghost size="small" @click="show(safe)" type="primary"
style="margin-left: 10px;">查看上报</Button>
</div>
<div v-else>{{scope.row[column.field]}}</div>
<template slot-scope="scope">
<div v-for="safe in scope.row.safety_task_departments" v-if="safe.departments.id==department_user_id">
<div v-if="column.type=='status'">
<div v-for="item in isStatus" v-if="safe.status==item.id">
{{item.name}}
</div>
</div>
<div v-else-if="column.type=='opt'">
<Button v-if="safe.status==0" ghost size="small" @click="edit(scope.row)" type="primary"
style="margin-left: 10px;">新增上报</Button>
<Button v-if="safe.status==1" ghost size="small" @click="edit(safe,true)" type="primary"
style="margin-left: 10px;">编辑上报</Button>
<Button v-if="safe.status==2" ghost size="small" @click="show(safe)" type="primary"
style="margin-left: 10px;">查看上报</Button>
</div>
<div v-else>{{scope.row[column.field]}}</div>
</div>
</template>
</el-table-column>
@ -43,58 +43,60 @@
:page-size="paginations.page_size" background layout="prev, pager, next" :total="paginations.total">
</el-pagination>
</div>
</div>
<el-dialog title="安全生产任务上报编辑" :visible.sync="dialogFormVisible" fullscreen width="90%">
<div class="dialogConcent" :style="{height:clientHeight+'px'}">
<el-scrollbar style="flex: 1">
<el-form :model="form" :rules="rules" ref="form" label-position="right" :label-width="formLabelWidth">
<el-form-item label="内容" prop="content">
<div style="width: 99.9%;">
<tinymce v-model="form.content" :height="300" />
</div>
</el-form-item>
<el-form-item label="附件" prop="file_list">
<el-upload class="upload-demo" :on-success="handlesuccess" :data="uploadOther"
action="/api/admin/upload-file" :on-remove="handleRemove" :before-remove="beforeRemove"
:on-exceed="handleExceed" :file-list="fileList">
<el-button size="small" type="primary">点击上传</el-button>
</el-upload>
</el-form-item>
</el-form>
</el-scrollbar>
</div>
<div slot="footer" class="dialog-footer" v-if="!isReportSave">
<el-button @click="resetForm('form')"> </el-button>
<el-button type="primary" v-preventReClick @click="submitForm('form','1')"> </el-button>
</div>
<div slot="footer" class="dialog-footer" v-if="isReportSave">
<el-button @click="resetForm('form')"> </el-button>
<el-button type="primary" v-preventReClick @click="submitForm('form','1')"> </el-button>
<el-button type="primary" v-preventReClick @click="submitForm('form', '2')"> </el-button>
</div>
</el-dialog>
<el-dialog title="安全生产任务上报内容查看" :visible.sync="dialogShowViewVisible" fullscreen>
<div class="dialogConcent" :style="{height:clientHeight+'px'}">
<el-scrollbar style="flex: 1">
<el-form :model="form" ref="form" label-position="right" :label-width="formLabelWidth">
<el-form-item label="内容" prop="content">
<div style="width: 99.9%;" v-html="form.content">
</div>
</el-form-item>
<el-form-item label="附件" prop="files">
<el-link v-for="item in form.files" target="_blank" :href="item.url" type="primary">{{item.original_name}}</el-link>
</el-form-item>
</el-form>
</el-scrollbar>
</div>
<div slot="footer" class="dialog-footer">
<el-button @click="resetForm('form')"> </el-button>
</div>
</el-dialog>
</div>
<el-dialog title="安全生产任务上报编辑" :visible.sync="dialogFormVisible" fullscreen width="90%">
<div class="dialogConcent" :style="{height:clientHeight+'px'}">
<el-scrollbar style="flex: 1">
<el-form :model="form" :rules="rules" ref="form" label-position="right" :label-width="formLabelWidth">
<el-form-item label="内容" prop="content">
<div style="width: 99.9%;">
<tinymce v-model="form.content" :height="300" />
</div>
</el-form-item>
<el-form-item label="附件" prop="file_list">
<el-upload class="upload-demo" :on-success="handlesuccess" :data="uploadOther"
action="/api/admin/upload-file" :on-remove="handleRemove" :before-remove="beforeRemove"
:on-exceed="handleExceed" :file-list="fileList">
<el-button size="small" type="primary">点击上传</el-button>
</el-upload>
</el-form-item>
</el-form>
</el-scrollbar>
</div>
<div slot="footer" class="dialog-footer" v-if="!isReportSave">
<el-button @click="resetForm('form')"> </el-button>
<el-button type="primary" v-preventReClick @click="submitForm('form','1')"> </el-button>
</div>
<div slot="footer" class="dialog-footer" v-if="isReportSave">
<el-button @click="resetForm('form')"> </el-button>
<el-button type="primary" v-preventReClick @click="submitForm('form','1')"> </el-button>
<el-button type="primary" v-preventReClick @click="submitForm('form', '2')"> </el-button>
</div>
</el-dialog>
<el-dialog title="安全生产任务上报内容查看" :visible.sync="dialogShowViewVisible" fullscreen>
<div class="dialogConcent" :style="{height:clientHeight+'px'}">
<el-scrollbar style="flex: 1">
<el-form :model="form" ref="form" label-position="right" :label-width="formLabelWidth">
<el-form-item label="内容" prop="content">
<div style="width: 99.9%;" v-html="form.content">
</div>
</el-form-item>
<el-form-item label="附件" prop="files">
<el-link v-for="item in form.files" target="_blank" :href="item.url" type="primary">
{{item.original_name}}
</el-link>
</el-form-item>
</el-form>
</el-scrollbar>
</div>
<div slot="footer" class="dialog-footer">
<el-button @click="resetForm('form')"> </el-button>
</div>
</el-dialog>
</div>
</div>
@ -114,9 +116,9 @@
} from "../../api/daily/deptindex.js";
import {
listtask
} from "../../api/daily/index.js";
import {
getInfo
} from "../../api/daily/index.js";
import {
getInfo
} from "../../api/user.js";
export default {
@ -125,11 +127,11 @@
Tinymce
},
data() {
return {
isReportSave:false,
return {
isReportSave: false,
checkAll: false,
isIndeterminate: true,
department_user_id:"",
isIndeterminate: true,
department_user_id: "",
paginations: {
page: 1,
page_size: 15,
@ -137,8 +139,8 @@
},
show_self: 1,
tableHeight: 0,
dialogFormVisible: false,
dialogShowViewVisible:false,
dialogFormVisible: false,
dialogShowViewVisible: false,
formLabelWidth: "120px",
clientHeight: 0,
form: {
@ -230,14 +232,14 @@
this.paginations.page = page;
this.load();
},
load() {
getInfo({
// token:this.uploadOther.token;
}).then(response => {
this.department_user_id = response.department_id
}).catch(error => {
console.log(error)
reject(error)
load() {
getInfo({
// token:this.uploadOther.token;
}).then(response => {
this.department_user_id = response.department_id
}).catch(error => {
console.log(error)
reject(error)
});
listtask({
page: this.paginations.page,
@ -249,75 +251,77 @@
}).catch(error => {
console.log(error)
reject(error)
});
});
},
show(obj) {
this.clientHeight = document.documentElement.clientHeight - 84 - 110;
this.dialogViewVisible = false;
this.dialogViewVisible = false;
this.dialogShowViewVisible = true;
this.info(obj);
},
info(obj) {
var that = this;
get(obj.id).then(res => {
let result = Object.assign(that.form, res);
// this.$set(that.form,res);
console.log("res", res);
let result = Object.assign(that.form, res);
that.form = result;
console.log("form", result);
let _files = [];
for (var mod of result.files) {
let m = Object.assign({}, mod);
m.name = mod.original_name;
_files.push(m);
}
that.form.safety_task_department_id = result.id;
}
that.form.safety_task_department_id = result.id;
that.form.safety_task_id = result.safety_task_id;
that.fileList = _files;
console.log(this.form);
that.$forceUpdate()
}).catch(error => {
//reject(error)
})
},
edit(obj,isnew) {
edit(obj, isnew) {
this.form = this.$options.data().form;
this.clientHeight = document.documentElement.clientHeight - 84 - 110;
if (isnew) {
var that = this;
that.form.content="";
that.info(obj);
this.isReportSave = true;
} else {
this.clientHeight = document.documentElement.clientHeight - 84 - 110;
this.form.safety_task_id = obj.id;
this.isReportSave = false;
}
this.form.content = "";
this.form.file_list = [];
this.clientHeight = document.documentElement.clientHeight - 84 - 110;
if (isnew) {
var that = this;
that.info(obj);
this.isReportSave = true;
} else {
this.clientHeight = document.documentElement.clientHeight - 84 - 110;
this.form.safety_task_id = obj.id;
this.isReportSave = false;
}
this.dialogFormVisible = true;
},
editSave(obj) {
},
editSave(obj) {
},
submitForm(formName, status) {
var that = this;
this.$refs[formName].validate((valid) => {
if (valid) {
if(status=="2"){
submitsave(that.form).then(response => {
//console.log(response)
this.$Message.success('操作成功');
that.load();
that.dialogFormVisible = false;
}).catch(error => {
//reject(error)
})
}else{
save(that.form).then(response => {
//console.log(response)
this.$Message.success('操作成功');
that.load();
that.dialogFormVisible = false;
}).catch(error => {
//reject(error)
})
if (valid) {
if (status == "2") {
submitsave(that.form).then(response => {
//console.log(response)
this.$Message.success('操作成功');
that.load();
that.dialogFormVisible = false;
}).catch(error => {
//reject(error)
})
} else {
save(that.form).then(response => {
//console.log(response)
this.$Message.success('操作成功');
that.load();
that.dialogFormVisible = false;
}).catch(error => {
//reject(error)
})
}
that.fileList = [];
} else {
@ -355,11 +359,11 @@
this.form.file_list = listUrl;
},
resetForm(formName) {
var that = this;
var that = this;
that.fileList = [];
this.$refs[formName].resetFields();
that.dialogFormVisible = false;
that.dialogShowViewVisible = false;
that.dialogFormVisible = false;
that.dialogShowViewVisible = false;
},
}

Loading…
Cancel
Save