刘翔宇-旅管家 4 years ago
commit a84dedd47d

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

Loading…
Cancel
Save