feat: add new feature
This commit is contained in:
parent
c305692919
commit
f77d1b0fe1
|
@ -1,75 +1,75 @@
|
|||
/**
|
||||
* 部门管理
|
||||
*/
|
||||
import base from './base'; // 导入接口域名列表
|
||||
import axios from '@/request'; // 导入http中创建的axios实例
|
||||
|
||||
const deptAPI = {
|
||||
/**
|
||||
* 新增部门
|
||||
* @param {*} deptId
|
||||
* @param {*} parentId
|
||||
* @param {*} name
|
||||
* @param {*} orderNum
|
||||
* @param {*} delFlag
|
||||
* @param {*} type
|
||||
* @param {*} typeName
|
||||
*/
|
||||
add(param) {
|
||||
return axios.post(`${base.url}/apis/dept/add`, param)
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* 获取部门列表信息
|
||||
* @param {*} deptName 部门名称
|
||||
*/
|
||||
list(param) {
|
||||
return axios.get(`${base.url}/apis/dept/list`, {
|
||||
params: param
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* 删除部门
|
||||
* @param {*} deptId deptId
|
||||
*/
|
||||
remove(param) { return axios.post(`${base.url}/apis/dept/remove`, param ) },
|
||||
|
||||
/**
|
||||
* 修改部门
|
||||
* @param {*} deptId
|
||||
* @param {*} parentId
|
||||
* @param {*} name
|
||||
* @param {*} orderNum
|
||||
* @param {*} delFlag
|
||||
* @param {*} type
|
||||
* @param {*} typeName
|
||||
*/
|
||||
update(param) {
|
||||
return axios.post(`${base.url}/apis/dept/update`, param)
|
||||
},
|
||||
|
||||
// 部门详细信息
|
||||
deptDetail(param) {
|
||||
return axios.post(`${base.url}/apis/dept/deptDetail`, param)
|
||||
},
|
||||
|
||||
//导入往来期初数据
|
||||
importExcel(param) {
|
||||
return axios({
|
||||
url:`${base.url}/apis/dept/export`,
|
||||
method: 'post',
|
||||
data: param,
|
||||
processData: false,// 告诉axios不要去处理发送的数据(重要参数)
|
||||
headers: {
|
||||
'Content-Type': 'multipart/form-data'
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
|
||||
}
|
||||
export default deptAPI;
|
||||
|
||||
|
||||
/**
|
||||
* 部门管理
|
||||
*/
|
||||
import base from './base'; // 导入接口域名列表
|
||||
import axios from '@/request'; // 导入http中创建的axios实例
|
||||
|
||||
const deptAPI = {
|
||||
/**
|
||||
* 新增部门
|
||||
* @param {*} deptId
|
||||
* @param {*} parentId
|
||||
* @param {*} name
|
||||
* @param {*} orderNum
|
||||
* @param {*} delFlag
|
||||
* @param {*} type
|
||||
* @param {*} typeName
|
||||
*/
|
||||
add(param) {
|
||||
return axios.post(`${base.url}/apis/dept/add`, param)
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* 获取部门列表信息
|
||||
* @param {*} deptName 部门名称
|
||||
*/
|
||||
list(param) {
|
||||
return axios.get(`${base.url}/apis/dept/list`, {
|
||||
params: param
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* 删除部门
|
||||
* @param {*} deptId deptId
|
||||
*/
|
||||
remove(param) { return axios.post(`${base.url}/apis/dept/remove`, param ) },
|
||||
|
||||
/**
|
||||
* 修改部门
|
||||
* @param {*} deptId
|
||||
* @param {*} parentId
|
||||
* @param {*} name
|
||||
* @param {*} orderNum
|
||||
* @param {*} delFlag
|
||||
* @param {*} type
|
||||
* @param {*} typeName
|
||||
*/
|
||||
update(param) {
|
||||
return axios.post(`${base.url}/apis/dept/update`, param)
|
||||
},
|
||||
|
||||
// 部门详细信息
|
||||
deptDetail(param) {
|
||||
return axios.post(`${base.url}/apis/dept/deptDetail`, param)
|
||||
},
|
||||
|
||||
//导入往来期初数据
|
||||
importExcel(param) {
|
||||
return axios({
|
||||
url:`${base.url}/apis/dept/export`,
|
||||
method: 'post',
|
||||
data: param,
|
||||
processData: false,// 告诉axios不要去处理发送的数据(重要参数)
|
||||
headers: {
|
||||
'Content-Type': 'multipart/form-data'
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
|
||||
}
|
||||
export default deptAPI;
|
||||
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,285 @@
|
|||
<template>
|
||||
<div class="sys-box plan-box">
|
||||
<div class="sys-operate">
|
||||
<el-button type="primary" @click="back()">{{
|
||||
config.cancelText
|
||||
}}</el-button>
|
||||
<!-- <el-button type="primary" @click="tempSave('form')" :disabled="isDisabled"
|
||||
>暂存</el-button
|
||||
> -->
|
||||
<el-button type="primary" @click="save('form')"
|
||||
>提交</el-button
|
||||
>
|
||||
</div>
|
||||
<div class="sys-form">
|
||||
<el-form
|
||||
ref="form"
|
||||
:model="form"
|
||||
label-width="120px"
|
||||
:rules="rules"
|
||||
>
|
||||
<div class="flex">
|
||||
<el-form-item label="文件名称" prop="wjmc">
|
||||
<el-input v-model="form.wjmc" placeholder="文件名称"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="登记日期" prop="djrq" >
|
||||
<el-date-picker
|
||||
v-model="form.djrq"
|
||||
type="date"
|
||||
format="yyyy-MM-dd"
|
||||
value-format="yyyy-MM-dd"
|
||||
placeholder="选择日期">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="本数" prop="bs">
|
||||
<el-input v-model="form.bs" placeholder="本数"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="发文单位" prop="fwdw">
|
||||
<el-input v-model="form.fwdw" placeholder="发文单位"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="经手人" prop="jsr">
|
||||
<el-input v-model="form.jsr" placeholder="发文单位"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="上传附件">
|
||||
<el-upload
|
||||
:action="uploadUrl"
|
||||
multiple
|
||||
:limit="1"
|
||||
:on-success="uploadSuccess"
|
||||
:on-remove="handleRemove"
|
||||
:on-preview="onPreview"
|
||||
:auto-upload="auto_upload"
|
||||
:on-change="onChange"
|
||||
>
|
||||
<el-button size="small" type="primary">点击上传</el-button>
|
||||
</el-upload>
|
||||
</el-form-item>
|
||||
</div>
|
||||
<el-form-item width="400px" label="备注">
|
||||
<el-input type="textarea" placeholder="备注" v-model="form.bz"></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import config from "@/utils/config.js";
|
||||
import base from '@/api/base';
|
||||
import { mapMutations } from "vuex";
|
||||
|
||||
export default {
|
||||
name: "skwj-add",
|
||||
components: {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
uploadUrl: base.uploadUrl,
|
||||
form:{},
|
||||
config:config,
|
||||
auto_upload: false,
|
||||
fullscreenLoading: false,
|
||||
filePath:'',
|
||||
fileName:'',
|
||||
rules: {
|
||||
wjmc: [
|
||||
{ required: true, message: '文件名称', trigger: 'blur' },
|
||||
],
|
||||
djrq: [
|
||||
{ type: 'date', required: true, message: '请选择日期', trigger: 'change' }
|
||||
],
|
||||
bs: [
|
||||
{ required: true, message: '本数', trigger: 'blur' },
|
||||
],
|
||||
fwdw: [
|
||||
{ required: true, message: '发文单位', trigger: 'blur' },
|
||||
],
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
if (this.$route.query.id) {
|
||||
this.formData.id = this.$route.query.id;
|
||||
this.getDetail();
|
||||
} else {
|
||||
this.$set(this.formData, "jlry", this.userInfo.name);
|
||||
// this.$set(this.formData, "czryid", this.userInfo.userId);
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
...mapMutations({
|
||||
removeTagNav: "tagNav/removeTagNav"
|
||||
}),
|
||||
back() {
|
||||
this.removeTagNav({
|
||||
path: this.$route.path,
|
||||
title: this.$route.meta.name
|
||||
});
|
||||
this.$router.push({ path: "/yfgl/wjgl/ffdj", query: { t: Date.now() } });
|
||||
},
|
||||
save(form){
|
||||
const _this = this
|
||||
this.$refs[form].validate(valid => {
|
||||
if(valid && _this.filePath){
|
||||
const data = {..._this.form,wjmc:_this.fileName,scfj:_this.filePath}
|
||||
_this.$api.yxkAPI.yxkPost('/apis/rc/wjgl/fhdj/add',data).then((res)=>{
|
||||
if(res.code==0){
|
||||
_this.$message.success('保存成功!')
|
||||
_this.back();
|
||||
}else{
|
||||
_this.$message.error(res.msg)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
},
|
||||
httpRequest(upload, name, file) {//file是需要压缩图片时,原图片
|
||||
let _this = this;
|
||||
var tempFormData = new FormData();
|
||||
tempFormData.append("file", upload, name);//上传blob对象
|
||||
this.$api.commonAPI.uploadUrl(tempFormData).then(res => {
|
||||
_this.fullscreenLoading = false;
|
||||
if (res.code == 0) {//上传成功
|
||||
_this.$message({
|
||||
message: '上传成功',
|
||||
type: 'success',
|
||||
duration: 2000
|
||||
});
|
||||
_this.filePath = res.filePath
|
||||
_this.fileName = res.fileName
|
||||
} else {//上传失败
|
||||
_this.fullscreenLoading = false;
|
||||
_this.$message.error('上传失败');
|
||||
_this.$refs.upload.uploadFiles.splice(_this.$refs.upload.uploadFiles.length - 1, 1)
|
||||
}
|
||||
|
||||
});
|
||||
},
|
||||
onChange(file, fileList) {
|
||||
if (file.size > 100 * 1000000) {
|
||||
this.$message.error('上传文件不能超过100M!');
|
||||
this.$refs.upload.fileList = this.$refs.upload.fileList
|
||||
this.$refs.upload.uploadFiles.splice(this.$refs.upload.uploadFiles.length - 1, 1)
|
||||
|
||||
return false
|
||||
}
|
||||
file = file.raw;
|
||||
if (!/image\/\w+/.test(file.type)) {//非图片
|
||||
this.fullscreenLoading = true;
|
||||
this.httpRequest(file, file.name);
|
||||
} else {
|
||||
this.fullscreenLoading = true;
|
||||
let _this = this;
|
||||
imageConversion.compressAccurately(file, 400).then(res => {
|
||||
if (res.size) {//压缩成功
|
||||
_this.httpRequest(res, file.name, file);
|
||||
} else {
|
||||
_this.$message.error('压缩图片失败');
|
||||
_this.fullscreenLoading = false;
|
||||
_this.$refs.upload.uploadFiles.splice(_this.$refs.upload.uploadFiles.length - 1, 1)
|
||||
}
|
||||
}).catch(error=>{
|
||||
_this.httpRequest(file,file.name);
|
||||
})
|
||||
}
|
||||
},
|
||||
uploadSuccess(res, file) {
|
||||
if (res.msg === "操作成功") {
|
||||
this.uploadAttachment.push({
|
||||
filePath: res.filePath,
|
||||
fileName: res.fileName
|
||||
});
|
||||
}
|
||||
},
|
||||
handleRemove(file, fileList) {
|
||||
if (file.raw) {
|
||||
let index
|
||||
for (let i = 0; i < this.uploadAttachment.length; i++) {
|
||||
if (this.uploadAttachment[i].filePath == file.raw.filePath) {
|
||||
index = i;
|
||||
}
|
||||
}
|
||||
|
||||
this.uploadAttachment.splice(index, 1);
|
||||
|
||||
} else {
|
||||
let index;
|
||||
for (let i = 0; i < this.uploadAttachment.length; i++) {
|
||||
if (this.uploadAttachment[i].filePath == file.url.substr(1)) {
|
||||
index = i;
|
||||
}
|
||||
}
|
||||
this.uploadAttachment.splice(index, 1);
|
||||
}
|
||||
},
|
||||
onPreview(file) {
|
||||
if (file.url) {
|
||||
window.open(file.url)
|
||||
} else if (file.raw) {
|
||||
window.open(this.ftpPrefix + file.raw.filePath)
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.flex {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
.sys-form {
|
||||
padding: 20px 20px 20px 20px;
|
||||
}
|
||||
.sys-form .form-inline {
|
||||
width: 33.33%;
|
||||
}
|
||||
.sys-form .form-line {
|
||||
width: 66.66%;
|
||||
}
|
||||
.sys-form .form-half {
|
||||
width: 50%;
|
||||
}
|
||||
.sys-form .form-inline .el-input,
|
||||
.sys-form .form-inline .el-select .el-input {
|
||||
width: 100%;
|
||||
}
|
||||
.sys-form .form-short .el-input,
|
||||
.sys-form .form-short .el-select .el-input {
|
||||
margin-right: 5px;
|
||||
width: 60% !important;
|
||||
}
|
||||
.icon-luyin {
|
||||
color: #2589ee;
|
||||
font-size: 24px;
|
||||
cursor: pointer;
|
||||
}
|
||||
.form-ts {
|
||||
padding-left: 20px;
|
||||
color: #aaa;
|
||||
display: inline-block;
|
||||
}
|
||||
.el-form-item__content .sys-operate {
|
||||
padding: 10px 0px;
|
||||
}
|
||||
</style>
|
||||
<style>
|
||||
.el-cascader .el-input {
|
||||
width: 100% !important;
|
||||
}
|
||||
.plan-box .sys-form .form-inline .el-select,
|
||||
.plan-box .sys-form .form-inline .el-select .el-input {
|
||||
width: 100%;
|
||||
}
|
||||
.plan-box .el-table thead {
|
||||
line-height: 1;
|
||||
}
|
||||
.el-input {
|
||||
width: 100% !important;
|
||||
}
|
||||
</style>
|
|
@ -0,0 +1,527 @@
|
|||
<template>
|
||||
<!-- 保养计划列表页 -->
|
||||
<div class="sys-box knowledge-box">
|
||||
<div class="sys-operate">
|
||||
<el-button type="primary" @click="add()">新增</el-button>
|
||||
<el-button type="primary" @click="remove()" :disabled="btnDelDisabled"
|
||||
>删除</el-button
|
||||
>
|
||||
<el-button type="primary" @click="recycle()">回收</el-button>
|
||||
</div>
|
||||
<div class="sys-search">
|
||||
<el-form inline class="form_item_search_out">
|
||||
<div class="form_item_input_out">
|
||||
<el-form-item
|
||||
label="文件编号"
|
||||
style="width:22%"
|
||||
class="form_item-inline"
|
||||
>
|
||||
<el-input
|
||||
v-model="search_data.wjbh"
|
||||
placeholder="文件编号"
|
||||
></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
label="文件标题"
|
||||
style="width:22%"
|
||||
class="form_item-inline"
|
||||
>
|
||||
<el-input
|
||||
v-model="search_data.wjmc"
|
||||
placeholder="文件标题"
|
||||
></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
label="更改状态"
|
||||
style="width:22%"
|
||||
class="form_item-inline"
|
||||
>
|
||||
<el-input
|
||||
v-model="search_data.zt"
|
||||
placeholder="状态"
|
||||
></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
label="创建日期"
|
||||
style="width:34%"
|
||||
class="form_item-inline"
|
||||
>
|
||||
<el-date-picker
|
||||
v-model="planTime"
|
||||
type="daterange"
|
||||
range-separator="-"
|
||||
start-placeholder="开始日期"
|
||||
end-placeholder="结束日期"
|
||||
></el-date-picker>
|
||||
</el-form-item>
|
||||
</div>
|
||||
<div class="form_item_btn_out">
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="search()">查询</el-button>
|
||||
</el-form-item>
|
||||
</div>
|
||||
</el-form>
|
||||
</div>
|
||||
<div class="sys-table">
|
||||
<el-table
|
||||
border
|
||||
@sort-change="sortChange"
|
||||
v-loading="pictLoading"
|
||||
@row-click="clickRow"
|
||||
ref="tb"
|
||||
:data="tableData"
|
||||
@selection-change="handleSelectionChange"
|
||||
:header-cell-style="{
|
||||
fontWeight: 'normal',
|
||||
textAlign: 'center',
|
||||
backgroundColor: '#eceff4',
|
||||
color: '#222'
|
||||
}"
|
||||
>
|
||||
<el-table-column
|
||||
type="selection"
|
||||
width="55"
|
||||
align="center"
|
||||
></el-table-column>
|
||||
<el-table-column
|
||||
prop="id"
|
||||
width="55"
|
||||
align="center"
|
||||
label="序号"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
<el-link type="primary" @click="viewDetail(scope.row)">{{
|
||||
scope.row.id
|
||||
}}</el-link>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column
|
||||
prop="wjbh"
|
||||
align="center"
|
||||
width="200"
|
||||
label="文件编号"
|
||||
show-overflow-tooltip
|
||||
></el-table-column>
|
||||
<el-table-column
|
||||
prop="skh"
|
||||
label="受控号"
|
||||
align="center"
|
||||
show-overflow-tooltip
|
||||
>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="lyr"
|
||||
label="领用人"
|
||||
align="center"
|
||||
show-overflow-tooltip
|
||||
>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="fs"
|
||||
align="center"
|
||||
label="份数"
|
||||
show-overflow-tooltip
|
||||
></el-table-column>
|
||||
<el-table-column
|
||||
prop="lyrq"
|
||||
label="领用日期"
|
||||
align="center"
|
||||
show-overflow-tooltip
|
||||
></el-table-column>
|
||||
<el-table-column
|
||||
prop="djrq"
|
||||
label="回收日期"
|
||||
align="center"
|
||||
show-overflow-tooltip
|
||||
></el-table-column>
|
||||
<el-table-column
|
||||
prop="zt"
|
||||
align="center"
|
||||
label="状态"
|
||||
></el-table-column>
|
||||
<el-table-column
|
||||
prop="jsr"
|
||||
align="center"
|
||||
label="经手人"
|
||||
></el-table-column>
|
||||
<el-table-column
|
||||
prop="bz"
|
||||
align="center"
|
||||
label="备注"
|
||||
></el-table-column>
|
||||
|
||||
</el-table>
|
||||
</div>
|
||||
<div class="sys-pagination">
|
||||
<el-pagination
|
||||
@size-change="handleSizeChange"
|
||||
@current-change="handleCurrentChange"
|
||||
:current-page="search_data.pageno"
|
||||
:page-sizes="pageSizes"
|
||||
:page-size="search_data.pagesize"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
:total="total"
|
||||
></el-pagination>
|
||||
</div>
|
||||
<!-- 选择负责人-->
|
||||
<!-- <dialogChooseSingleUser
|
||||
:visible.sync="chooseUserVisible"
|
||||
@change="getUser"
|
||||
></dialogChooseSingleUser> -->
|
||||
<!-- <chooseSbjh :visible.sync="chooseSbjhVisible" /> -->
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { formatDateTime } from "@/utils/tools.js";
|
||||
// import btnInput from "@/components/btnInput.vue";
|
||||
// import chooseSbjh from "./components/chooseSbjh.vue";
|
||||
// import dialogChooseSingleUser from "@/components/System/dialogChooseSingleUser";
|
||||
let api = {
|
||||
page: "/apis/rc/wjgl/fhdj/pageList",
|
||||
del: "/apis/rc/wjgl/fhdj/del",
|
||||
edit: "/apis/mdh/cpzsk/edit"
|
||||
};
|
||||
export default {
|
||||
name: "cpzsk",
|
||||
components: {
|
||||
// btnInput
|
||||
// dialogChooseSingleUser
|
||||
// chooseSbjh
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
qyList: [],
|
||||
total: 0, //总条数
|
||||
pageSizes: [10, 20, 50], //每页展示多少条
|
||||
search_data: {
|
||||
pageno: 1,
|
||||
pagesize: 10
|
||||
},
|
||||
|
||||
planTime: "",
|
||||
|
||||
statusList: [], //计划状态
|
||||
getUserList: [], //用户
|
||||
|
||||
btnDelDisabled: true,
|
||||
btnOtherDisabled: true,
|
||||
chooseUserVisible: false,
|
||||
chooseSbjhVisible: false,
|
||||
rowIds: [],
|
||||
tableData: [],
|
||||
dialogVisible: false,
|
||||
pictLoading: false,
|
||||
qyList: [],
|
||||
jllxList: [],
|
||||
dywzList: []
|
||||
};
|
||||
},
|
||||
created() {
|
||||
var _this = this;
|
||||
document.onkeydown = e => {
|
||||
if (e.key === "Enter") {
|
||||
_this.search();
|
||||
}
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
//let user = JSON.parse(sessionStorage.getItem("userInfo"));
|
||||
//console.log(user);
|
||||
//this.search_data.engineerId = user.userId;
|
||||
this.getList();
|
||||
// this.initData();
|
||||
},
|
||||
methods: {
|
||||
viewDetail(r) {
|
||||
this.$router.push({
|
||||
path: "/yfgl/wjgl/ffdj-add",
|
||||
query: { id: r.id, t: Date.now() }
|
||||
});
|
||||
},
|
||||
recycle(){
|
||||
|
||||
},
|
||||
async reback() {
|
||||
if (this.rowIds.length > 0) {
|
||||
let r = this.rowIds[0];
|
||||
let pass = r.zt == 3 ? true : false;
|
||||
if (pass) {
|
||||
const params = {
|
||||
id: r.id,
|
||||
zt: 2,
|
||||
zczt: 0
|
||||
};
|
||||
const res = await this.$api.yxkAPI.yxkPost(api.edit, params);
|
||||
if (res.code == 0) {
|
||||
this.$message({
|
||||
message: "撤回成功",
|
||||
type: "success"
|
||||
});
|
||||
this.getList();
|
||||
}
|
||||
} else {
|
||||
this.$message({
|
||||
message: "非已提交状态不能撤回",
|
||||
type: "warning"
|
||||
});
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
this.$message({
|
||||
message: "请选择一条数据",
|
||||
type: "warning"
|
||||
});
|
||||
return false;
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 获取选择的负责人
|
||||
*/
|
||||
getUser(val) {
|
||||
if (val) {
|
||||
this.$set(this.search_data, "engineerName", val.name);
|
||||
this.$set(this.search_data, "engineerId", val.id);
|
||||
} else {
|
||||
this.$set(this.search_data, "engineerName", "");
|
||||
this.$set(this.search_data, "engineerId", "");
|
||||
}
|
||||
},
|
||||
sortChange({ column, prop, order }) {
|
||||
let j = { column, prop, order };
|
||||
let order_ = j.order == "ascending" ? "asc" : "desc";
|
||||
this.$set(this.search_data, "sort", j.prop);
|
||||
this.$set(this.search_data, "order", order_);
|
||||
this.getList();
|
||||
},
|
||||
clickRow(row) {
|
||||
this.$refs.tb.toggleRowSelection(row);
|
||||
},
|
||||
initData() {
|
||||
Promise.all([
|
||||
this.$api.dictAPI.getDictsByType("qy"),
|
||||
this.$api.dictAPI.getDictsByType("jllx"),
|
||||
this.$api.dictAPI.getDictsByType("dywz")
|
||||
])
|
||||
.then(([r1, r2, r3]) => {
|
||||
if (r1.code === 0) {
|
||||
this.qyList = r1.datas;
|
||||
}
|
||||
if (r2.code == 0) {
|
||||
this.jllxList = r2.datas;
|
||||
}
|
||||
if (r3.code == 0) {
|
||||
this.dywzList = r3.datas;
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
console.log(error);
|
||||
});
|
||||
},
|
||||
/**
|
||||
* 获取列表
|
||||
*/
|
||||
getList() {
|
||||
this.pictLoading = true;
|
||||
if (this.planTime) {
|
||||
this.search_data.ksrq = formatDateTime(this.planTime[0]);
|
||||
this.search_data.jsrq = formatDateTime(this.planTime[1]);
|
||||
} else {
|
||||
this.search_data.ksrq = null;
|
||||
this.search_data.jsrq = null;
|
||||
}
|
||||
this.$api.yxkAPI
|
||||
.yxkPost(api.page, this.search_data)
|
||||
.then(res => {
|
||||
this.pictLoading = false;
|
||||
if (res.data) {
|
||||
this.total = res.data.total;
|
||||
let result = res.data.records;
|
||||
this.tableData = result;
|
||||
} else {
|
||||
this.total = 0;
|
||||
this.tableData = [];
|
||||
}
|
||||
})
|
||||
.catch(r => {
|
||||
console.log(r);
|
||||
});
|
||||
},
|
||||
/**
|
||||
* 查询
|
||||
*/
|
||||
search() {
|
||||
this.search_data.pageno = 1;
|
||||
this.getList();
|
||||
},
|
||||
// 上下分页
|
||||
handleCurrentChange(val) {
|
||||
this.search_data.pageno = val;
|
||||
this.getList();
|
||||
},
|
||||
// 每页显示多少条
|
||||
handleSizeChange(val) {
|
||||
this.search_data.pagesize = val;
|
||||
this.getList();
|
||||
},
|
||||
/**
|
||||
* 新增
|
||||
*/
|
||||
add() {
|
||||
this.$router.push({
|
||||
path: "/yfgl/wjgl/ffdj-add",
|
||||
query: {
|
||||
t: Date.now()
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* 保养执行
|
||||
*/
|
||||
execution() {
|
||||
// let id = this.rowIds[0].reventId;
|
||||
// this.$router.push({
|
||||
// path: "/upkeep/record",
|
||||
// query: { id: id }
|
||||
// });
|
||||
},
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
remove() {
|
||||
let ids = [];
|
||||
this.rowIds.forEach(item => {
|
||||
ids.push(item.id);
|
||||
});
|
||||
this.$confirm("确认删除选中的数据吗?", "提示", {
|
||||
type: "warning"
|
||||
}).then(() => {
|
||||
this.$api.yxkAPI
|
||||
.yxkPost(api.del, ids)
|
||||
.then(res => {
|
||||
console.log(res);
|
||||
if (res.code == 0) {
|
||||
this.$message({
|
||||
message: res.msg,
|
||||
type: "success"
|
||||
});
|
||||
this.getList();
|
||||
} else {
|
||||
this.$message({
|
||||
message: res.msg ? res.msg : "删除失败,请重试",
|
||||
type: "error"
|
||||
});
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
this.$message({
|
||||
message: "删除失败,请重试",
|
||||
type: "error"
|
||||
});
|
||||
});
|
||||
});
|
||||
},
|
||||
/**
|
||||
* 启用
|
||||
*/
|
||||
startUsing() {
|
||||
let ids = [];
|
||||
this.rowIds.forEach(item => {
|
||||
ids.push(item.id);
|
||||
});
|
||||
this.$confirm("确认启用选中的保养计划吗?", "提示", {
|
||||
type: "warning"
|
||||
}).then(() => {
|
||||
this.$api.upkeepPlanAPI
|
||||
.startUsing({ ids: ids })
|
||||
.then(res => {
|
||||
console.log(res);
|
||||
if (res.code === 0) {
|
||||
this.$message({
|
||||
message: res.msg,
|
||||
type: "success"
|
||||
});
|
||||
this.getList();
|
||||
} else {
|
||||
this.$message({
|
||||
message: res.msg ? res.msg : "启用失败,请重试",
|
||||
type: "error"
|
||||
});
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
this.$message({
|
||||
message: "启用失败,请重试",
|
||||
type: "error"
|
||||
});
|
||||
});
|
||||
});
|
||||
},
|
||||
/**
|
||||
* 禁用
|
||||
*/
|
||||
forbidden() {
|
||||
let ids = [];
|
||||
this.rowIds.forEach(item => {
|
||||
ids.push(item.id);
|
||||
});
|
||||
this.$confirm("确认禁用选中的保养计划吗?", "提示", {
|
||||
type: "warning"
|
||||
}).then(() => {
|
||||
this.$api.upkeepPlanAPI
|
||||
.forbidden({ ids: ids })
|
||||
.then(res => {
|
||||
console.log(res);
|
||||
if (res.code === 0) {
|
||||
this.$message({
|
||||
message: res.msg,
|
||||
type: "success"
|
||||
});
|
||||
this.getList();
|
||||
} else {
|
||||
this.$message({
|
||||
message: res.msg ? res.msg : "禁用失败,请重试",
|
||||
type: "error"
|
||||
});
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
this.$message({
|
||||
message: "禁用失败,请重试",
|
||||
type: "error"
|
||||
});
|
||||
});
|
||||
});
|
||||
},
|
||||
/**
|
||||
* 处理选中
|
||||
*/
|
||||
handleSelectionChange(val) {
|
||||
this.rowIds = val;
|
||||
this.setBtn(val);
|
||||
},
|
||||
/**
|
||||
* 控件操作按钮状态
|
||||
*/
|
||||
setBtn(val) {
|
||||
let isFlag = true;
|
||||
let isDelFlag = true;
|
||||
if (val.length > 0) {
|
||||
isDelFlag = false;
|
||||
if (val.length == 1) {
|
||||
isFlag = false;
|
||||
}
|
||||
} else {
|
||||
isFlag = true;
|
||||
isDelFlag = true;
|
||||
}
|
||||
this.btnDelDisabled = isDelFlag;
|
||||
this.btnOtherDisabled = isFlag;
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped></style>
|
|
@ -0,0 +1,277 @@
|
|||
<template>
|
||||
<div class="sys-box plan-box">
|
||||
<div class="sys-operate">
|
||||
<el-button type="primary" @click="back()">{{
|
||||
config.cancelText
|
||||
}}</el-button>
|
||||
<!-- <el-button type="primary" @click="tempSave('form')" :disabled="isDisabled"
|
||||
>暂存</el-button
|
||||
> -->
|
||||
<el-button type="primary" @click="save('form')"
|
||||
>提交</el-button
|
||||
>
|
||||
</div>
|
||||
<div class="sys-form">
|
||||
<el-form
|
||||
ref="form"
|
||||
:model="form"
|
||||
label-width="120px"
|
||||
:rules="rules"
|
||||
>
|
||||
<div class="flex">
|
||||
<el-form-item label="文件名称" prop="wjmc">
|
||||
<el-input v-model="form.wjmc" placeholder="文件名称"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="登记日期" prop="djrq" >
|
||||
<el-date-picker
|
||||
v-model="form.djrq"
|
||||
type="date"
|
||||
format="yyyy-MM-dd"
|
||||
value-format="yyyy-MM-dd"
|
||||
placeholder="选择日期">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="本数" prop="bs">
|
||||
<el-input v-model="form.bs" placeholder="本数"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="发文单位" prop="fwdw">
|
||||
<el-input v-model="form.fwdw" placeholder="发文单位"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="上传附件">
|
||||
<el-upload
|
||||
:action="uploadUrl"
|
||||
multiple
|
||||
:limit="1"
|
||||
:on-success="uploadSuccess"
|
||||
:on-remove="handleRemove"
|
||||
:on-preview="onPreview"
|
||||
:auto-upload="auto_upload"
|
||||
:on-change="onChange"
|
||||
>
|
||||
<el-button size="small" type="primary">点击上传</el-button>
|
||||
</el-upload>
|
||||
</el-form-item>
|
||||
</div>
|
||||
<el-form-item width="400px" label="备注">
|
||||
<el-input type="textarea" placeholder="备注" v-model="form.bz"></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import config from "@/utils/config.js";
|
||||
import base from '@/api/base';
|
||||
import { mapMutations } from "vuex";
|
||||
|
||||
export default {
|
||||
name: "skwj-add",
|
||||
components: {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
uploadUrl: base.uploadUrl,
|
||||
form:{},
|
||||
config:config,
|
||||
auto_upload: false,
|
||||
fullscreenLoading: false,
|
||||
filePath:'',
|
||||
fileName:'',
|
||||
rules: {
|
||||
wjmc: [
|
||||
{ required: true, message: '文件名称', trigger: 'blur' },
|
||||
],
|
||||
djrq: [
|
||||
{ type: 'date', required: true, message: '请选择日期', trigger: 'change' }
|
||||
],
|
||||
bs: [
|
||||
{ required: true, message: '本数', trigger: 'blur' },
|
||||
],
|
||||
fwdw: [
|
||||
{ required: true, message: '发文单位', trigger: 'blur' },
|
||||
],
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
|
||||
},
|
||||
|
||||
methods: {
|
||||
...mapMutations({
|
||||
removeTagNav: "tagNav/removeTagNav"
|
||||
}),
|
||||
back() {
|
||||
this.removeTagNav({
|
||||
path: this.$route.path,
|
||||
title: this.$route.meta.name
|
||||
});
|
||||
this.$router.push({ path: "/yfgl/wjgl/lwdj", query: { t: Date.now() } });
|
||||
},
|
||||
save(form){
|
||||
console.log(this.form)
|
||||
const _this = this
|
||||
this.$refs[form].validate(valid => {
|
||||
if(valid && _this.filePath){
|
||||
const data = {..._this.form,wjmc:_this.fileName,scfj:_this.filePath}
|
||||
_this.$api.yxkAPI.yxkPost('/apis/rc/wjgl/lwdj/add',data).then((res)=>{
|
||||
if(res.code==0){
|
||||
_this.$message.success('保存成功!')
|
||||
_this.back();
|
||||
}else{
|
||||
_this.$message.error(res.msg)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
},
|
||||
httpRequest(upload, name, file) {//file是需要压缩图片时,原图片
|
||||
let _this = this;
|
||||
var tempFormData = new FormData();
|
||||
tempFormData.append("file", upload, name);//上传blob对象
|
||||
this.$api.commonAPI.uploadUrl(tempFormData).then(res => {
|
||||
_this.fullscreenLoading = false;
|
||||
if (res.code == 0) {//上传成功
|
||||
_this.$message({
|
||||
message: '上传成功',
|
||||
type: 'success',
|
||||
duration: 2000
|
||||
});
|
||||
_this.filePath = res.filePath
|
||||
_this.fileName = res.fileName
|
||||
} else {//上传失败
|
||||
_this.fullscreenLoading = false;
|
||||
_this.$message.error('上传失败');
|
||||
_this.$refs.upload.uploadFiles.splice(_this.$refs.upload.uploadFiles.length - 1, 1)
|
||||
}
|
||||
|
||||
});
|
||||
},
|
||||
onChange(file, fileList) {
|
||||
if (file.size > 100 * 1000000) {
|
||||
this.$message.error('上传文件不能超过100M!');
|
||||
this.$refs.upload.fileList = this.$refs.upload.fileList
|
||||
this.$refs.upload.uploadFiles.splice(this.$refs.upload.uploadFiles.length - 1, 1)
|
||||
|
||||
return false
|
||||
}
|
||||
file = file.raw;
|
||||
if (!/image\/\w+/.test(file.type)) {//非图片
|
||||
this.fullscreenLoading = true;
|
||||
this.httpRequest(file, file.name);
|
||||
} else {
|
||||
this.fullscreenLoading = true;
|
||||
let _this = this;
|
||||
imageConversion.compressAccurately(file, 400).then(res => {
|
||||
if (res.size) {//压缩成功
|
||||
_this.httpRequest(res, file.name, file);
|
||||
} else {
|
||||
_this.$message.error('压缩图片失败');
|
||||
_this.fullscreenLoading = false;
|
||||
_this.$refs.upload.uploadFiles.splice(_this.$refs.upload.uploadFiles.length - 1, 1)
|
||||
}
|
||||
}).catch(error=>{
|
||||
_this.httpRequest(file,file.name);
|
||||
})
|
||||
}
|
||||
},
|
||||
uploadSuccess(res, file) {
|
||||
if (res.msg === "操作成功") {
|
||||
this.uploadAttachment.push({
|
||||
filePath: res.filePath,
|
||||
fileName: res.fileName
|
||||
});
|
||||
}
|
||||
},
|
||||
handleRemove(file, fileList) {
|
||||
if (file.raw) {
|
||||
let index
|
||||
for (let i = 0; i < this.uploadAttachment.length; i++) {
|
||||
if (this.uploadAttachment[i].filePath == file.raw.filePath) {
|
||||
index = i;
|
||||
}
|
||||
}
|
||||
|
||||
this.uploadAttachment.splice(index, 1);
|
||||
|
||||
} else {
|
||||
let index;
|
||||
for (let i = 0; i < this.uploadAttachment.length; i++) {
|
||||
if (this.uploadAttachment[i].filePath == file.url.substr(1)) {
|
||||
index = i;
|
||||
}
|
||||
}
|
||||
this.uploadAttachment.splice(index, 1);
|
||||
}
|
||||
},
|
||||
onPreview(file) {
|
||||
if (file.url) {
|
||||
window.open(file.url)
|
||||
} else if (file.raw) {
|
||||
window.open(this.ftpPrefix + file.raw.filePath)
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.flex {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
.sys-form {
|
||||
padding: 20px 20px 20px 20px;
|
||||
}
|
||||
.sys-form .form-inline {
|
||||
width: 33.33%;
|
||||
}
|
||||
.sys-form .form-line {
|
||||
width: 66.66%;
|
||||
}
|
||||
.sys-form .form-half {
|
||||
width: 50%;
|
||||
}
|
||||
.sys-form .form-inline .el-input,
|
||||
.sys-form .form-inline .el-select .el-input {
|
||||
width: 100%;
|
||||
}
|
||||
.sys-form .form-short .el-input,
|
||||
.sys-form .form-short .el-select .el-input {
|
||||
margin-right: 5px;
|
||||
width: 60% !important;
|
||||
}
|
||||
.icon-luyin {
|
||||
color: #2589ee;
|
||||
font-size: 24px;
|
||||
cursor: pointer;
|
||||
}
|
||||
.form-ts {
|
||||
padding-left: 20px;
|
||||
color: #aaa;
|
||||
display: inline-block;
|
||||
}
|
||||
.el-form-item__content .sys-operate {
|
||||
padding: 10px 0px;
|
||||
}
|
||||
</style>
|
||||
<style>
|
||||
.el-cascader .el-input {
|
||||
width: 100% !important;
|
||||
}
|
||||
.plan-box .sys-form .form-inline .el-select,
|
||||
.plan-box .sys-form .form-inline .el-select .el-input {
|
||||
width: 100%;
|
||||
}
|
||||
.plan-box .el-table thead {
|
||||
line-height: 1;
|
||||
}
|
||||
.el-input {
|
||||
width: 100% !important;
|
||||
}
|
||||
</style>
|
|
@ -0,0 +1,503 @@
|
|||
<template>
|
||||
<!-- 保养计划列表页 -->
|
||||
<div class="sys-box knowledge-box">
|
||||
<div class="sys-operate">
|
||||
<el-button type="primary" @click="add()">新增</el-button>
|
||||
<el-button type="primary" @click="remove()" :disabled="btnDelDisabled"
|
||||
>删除</el-button
|
||||
>
|
||||
<el-button type="primary" @click="exportFile()">批量导出</el-button
|
||||
>
|
||||
</div>
|
||||
<div class="sys-search">
|
||||
<el-form inline class="form_item_search_out">
|
||||
<div class="form_item_input_out">
|
||||
<el-form-item
|
||||
label="文件编号"
|
||||
style="width:22%"
|
||||
class="form_item-inline"
|
||||
>
|
||||
<el-input
|
||||
v-model="search_data.wjbh"
|
||||
placeholder="文件编号"
|
||||
></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
label="文件名称"
|
||||
style="width:22%"
|
||||
class="form_item-inline"
|
||||
>
|
||||
<el-input
|
||||
v-model="search_data.wjmc"
|
||||
placeholder="文件名称"
|
||||
></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
label="创建日期"
|
||||
style="width:34%"
|
||||
class="form_item-inline"
|
||||
>
|
||||
<el-date-picker
|
||||
v-model="planTime"
|
||||
type="daterange"
|
||||
range-separator="-"
|
||||
start-placeholder="开始日期"
|
||||
end-placeholder="结束日期"
|
||||
></el-date-picker>
|
||||
</el-form-item>
|
||||
</div>
|
||||
<div class="form_item_btn_out">
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="search()">查询</el-button>
|
||||
</el-form-item>
|
||||
</div>
|
||||
</el-form>
|
||||
</div>
|
||||
<div class="sys-table">
|
||||
<el-table
|
||||
border
|
||||
@sort-change="sortChange"
|
||||
v-loading="pictLoading"
|
||||
@row-click="clickRow"
|
||||
ref="tb"
|
||||
:data="tableData"
|
||||
@selection-change="handleSelectionChange"
|
||||
:header-cell-style="{
|
||||
fontWeight: 'normal',
|
||||
textAlign: 'center',
|
||||
backgroundColor: '#eceff4',
|
||||
color: '#222'
|
||||
}"
|
||||
>
|
||||
<el-table-column
|
||||
type="selection"
|
||||
width="55"
|
||||
align="center"
|
||||
></el-table-column>
|
||||
<el-table-column
|
||||
prop="id"
|
||||
width="55"
|
||||
align="center"
|
||||
label="序号"
|
||||
></el-table-column>
|
||||
|
||||
<el-table-column
|
||||
prop="wjbh"
|
||||
align="center"
|
||||
width="200"
|
||||
label="文件编号"
|
||||
show-overflow-tooltip
|
||||
></el-table-column>
|
||||
<el-table-column
|
||||
prop="fwdw"
|
||||
label="发文单位"
|
||||
align="center"
|
||||
show-overflow-tooltip
|
||||
>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="wjmc"
|
||||
label="文件名称"
|
||||
align="center"
|
||||
show-overflow-tooltip
|
||||
>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="bs"
|
||||
align="center"
|
||||
label="本数"
|
||||
show-overflow-tooltip
|
||||
></el-table-column>
|
||||
<el-table-column
|
||||
prop="updateTime"
|
||||
label="登记日期"
|
||||
align="center"
|
||||
show-overflow-tooltip
|
||||
></el-table-column>
|
||||
<el-table-column
|
||||
prop="djr"
|
||||
align="center"
|
||||
label="登记人"
|
||||
></el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
<div class="sys-pagination">
|
||||
<el-pagination
|
||||
@size-change="handleSizeChange"
|
||||
@current-change="handleCurrentChange"
|
||||
:current-page="search_data.pageno"
|
||||
:page-sizes="pageSizes"
|
||||
:page-size="search_data.pagesize"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
:total="total"
|
||||
></el-pagination>
|
||||
</div>
|
||||
<!-- 选择负责人-->
|
||||
<!-- <dialogChooseSingleUser
|
||||
:visible.sync="chooseUserVisible"
|
||||
@change="getUser"
|
||||
></dialogChooseSingleUser> -->
|
||||
<!-- <chooseSbjh :visible.sync="chooseSbjhVisible" /> -->
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { formatDateTime } from "@/utils/tools.js";
|
||||
// import btnInput from "@/components/btnInput.vue";
|
||||
// import chooseSbjh from "./components/chooseSbjh.vue";
|
||||
// import dialogChooseSingleUser from "@/components/System/dialogChooseSingleUser";
|
||||
let api = {
|
||||
page: "/apis/rc/wjgl/lwdj/pageList",
|
||||
del: "/apis/rc/wjgl/lwdj/del",
|
||||
edit: "/apis/mdh/cpzsk/edit"
|
||||
};
|
||||
export default {
|
||||
name: "cpzsk",
|
||||
components: {
|
||||
// btnInput
|
||||
// dialogChooseSingleUser
|
||||
// chooseSbjh
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
qyList: [],
|
||||
total: 0, //总条数
|
||||
pageSizes: [10, 20, 50], //每页展示多少条
|
||||
search_data: {
|
||||
pageno: 1,
|
||||
pagesize: 10
|
||||
},
|
||||
|
||||
planTime: "",
|
||||
|
||||
statusList: [], //计划状态
|
||||
getUserList: [], //用户
|
||||
|
||||
btnDelDisabled: true,
|
||||
btnOtherDisabled: true,
|
||||
chooseUserVisible: false,
|
||||
chooseSbjhVisible: false,
|
||||
rowIds: [],
|
||||
tableData: [],
|
||||
dialogVisible: false,
|
||||
pictLoading: false,
|
||||
qyList: [],
|
||||
jllxList: [],
|
||||
dywzList: []
|
||||
};
|
||||
},
|
||||
created() {
|
||||
var _this = this;
|
||||
document.onkeydown = e => {
|
||||
if (e.key === "Enter") {
|
||||
_this.search();
|
||||
}
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
//let user = JSON.parse(sessionStorage.getItem("userInfo"));
|
||||
//console.log(user);
|
||||
//this.search_data.engineerId = user.userId;
|
||||
this.getList();
|
||||
// this.initData();
|
||||
},
|
||||
methods: {
|
||||
exportFile(){
|
||||
this.$api.yxkAPI.yxkExport('/apis/rc/wjgl/skwj/exportExcel',this.search_data)
|
||||
},
|
||||
async reback() {
|
||||
if (this.rowIds.length > 0) {
|
||||
let r = this.rowIds[0];
|
||||
let pass = r.zt == 3 ? true : false;
|
||||
if (pass) {
|
||||
const params = {
|
||||
id: r.id,
|
||||
zt: 2,
|
||||
zczt: 0
|
||||
};
|
||||
const res = await this.$api.yxkAPI.yxkPost(api.edit, params);
|
||||
if (res.code == 0) {
|
||||
this.$message({
|
||||
message: "撤回成功",
|
||||
type: "success"
|
||||
});
|
||||
this.getList();
|
||||
}
|
||||
} else {
|
||||
this.$message({
|
||||
message: "非已提交状态不能撤回",
|
||||
type: "warning"
|
||||
});
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
this.$message({
|
||||
message: "请选择一条数据",
|
||||
type: "warning"
|
||||
});
|
||||
return false;
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 获取选择的负责人
|
||||
*/
|
||||
getUser(val) {
|
||||
if (val) {
|
||||
this.$set(this.search_data, "engineerName", val.name);
|
||||
this.$set(this.search_data, "engineerId", val.id);
|
||||
} else {
|
||||
this.$set(this.search_data, "engineerName", "");
|
||||
this.$set(this.search_data, "engineerId", "");
|
||||
}
|
||||
},
|
||||
sortChange({ column, prop, order }) {
|
||||
let j = { column, prop, order };
|
||||
let order_ = j.order == "ascending" ? "asc" : "desc";
|
||||
this.$set(this.search_data, "sort", j.prop);
|
||||
this.$set(this.search_data, "order", order_);
|
||||
this.getList();
|
||||
},
|
||||
clickRow(row) {
|
||||
this.$refs.tb.toggleRowSelection(row);
|
||||
},
|
||||
initData() {
|
||||
Promise.all([
|
||||
this.$api.dictAPI.getDictsByType("qy"),
|
||||
this.$api.dictAPI.getDictsByType("jllx"),
|
||||
this.$api.dictAPI.getDictsByType("dywz")
|
||||
])
|
||||
.then(([r1, r2, r3]) => {
|
||||
if (r1.code === 0) {
|
||||
this.qyList = r1.datas;
|
||||
}
|
||||
if (r2.code == 0) {
|
||||
this.jllxList = r2.datas;
|
||||
}
|
||||
if (r3.code == 0) {
|
||||
this.dywzList = r3.datas;
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
console.log(error);
|
||||
});
|
||||
},
|
||||
/**
|
||||
* 获取列表
|
||||
*/
|
||||
getList() {
|
||||
this.pictLoading = true;
|
||||
if (this.planTime) {
|
||||
this.search_data.ksrq = formatDateTime(this.planTime[0]);
|
||||
this.search_data.jsrq = formatDateTime(this.planTime[1]);
|
||||
} else {
|
||||
this.search_data.ksrq = null;
|
||||
this.search_data.jsrq = null;
|
||||
}
|
||||
this.$api.yxkAPI
|
||||
.yxkPost(api.page, this.search_data)
|
||||
.then(res => {
|
||||
this.pictLoading = false;
|
||||
if (res.data) {
|
||||
this.total = res.data.total;
|
||||
let result = res.data.records;
|
||||
this.tableData = result;
|
||||
} else {
|
||||
this.total = 0;
|
||||
this.tableData = [];
|
||||
}
|
||||
})
|
||||
.catch(r => {
|
||||
console.log(r);
|
||||
});
|
||||
},
|
||||
/**
|
||||
* 查询
|
||||
*/
|
||||
search() {
|
||||
this.search_data.pageno = 1;
|
||||
this.getList();
|
||||
},
|
||||
// 上下分页
|
||||
handleCurrentChange(val) {
|
||||
this.search_data.pageno = val;
|
||||
this.getList();
|
||||
},
|
||||
// 每页显示多少条
|
||||
handleSizeChange(val) {
|
||||
this.search_data.pagesize = val;
|
||||
this.getList();
|
||||
},
|
||||
/**
|
||||
* 新增
|
||||
*/
|
||||
add() {
|
||||
this.$router.push({
|
||||
path: "/yfgl/wjgl/lwdj-add",
|
||||
query: {
|
||||
t: Date.now()
|
||||
}
|
||||
});
|
||||
},
|
||||
/**查看明细 */
|
||||
viewDetail(r) {
|
||||
if (r.zt == 2) {
|
||||
this.$router.push({
|
||||
path: "/yfgl/cpzsk-add",
|
||||
query: { id: r.id, t: Date.now() }
|
||||
});
|
||||
} else {
|
||||
this.$router.push({
|
||||
path: "/yfgl/cpzsk-add",
|
||||
query: { id: r.id, t: Date.now() }
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 保养执行
|
||||
*/
|
||||
execution() {
|
||||
// let id = this.rowIds[0].reventId;
|
||||
// this.$router.push({
|
||||
// path: "/upkeep/record",
|
||||
// query: { id: id }
|
||||
// });
|
||||
},
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
remove() {
|
||||
let ids = [];
|
||||
this.rowIds.forEach(item => {
|
||||
ids.push(item.id);
|
||||
});
|
||||
this.$confirm("确认删除选中的数据吗?", "提示", {
|
||||
type: "warning"
|
||||
}).then(() => {
|
||||
this.$api.yxkAPI
|
||||
.yxkPost(api.del, ids)
|
||||
.then(res => {
|
||||
console.log(res);
|
||||
if (res.code == 0) {
|
||||
this.$message({
|
||||
message: res.msg,
|
||||
type: "success"
|
||||
});
|
||||
this.getList();
|
||||
} else {
|
||||
this.$message({
|
||||
message: res.msg ? res.msg : "删除失败,请重试",
|
||||
type: "error"
|
||||
});
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
this.$message({
|
||||
message: "删除失败,请重试",
|
||||
type: "error"
|
||||
});
|
||||
});
|
||||
});
|
||||
},
|
||||
/**
|
||||
* 启用
|
||||
*/
|
||||
startUsing() {
|
||||
let ids = [];
|
||||
this.rowIds.forEach(item => {
|
||||
ids.push(item.id);
|
||||
});
|
||||
this.$confirm("确认启用选中的保养计划吗?", "提示", {
|
||||
type: "warning"
|
||||
}).then(() => {
|
||||
this.$api.upkeepPlanAPI
|
||||
.startUsing({ ids: ids })
|
||||
.then(res => {
|
||||
console.log(res);
|
||||
if (res.code === 0) {
|
||||
this.$message({
|
||||
message: res.msg,
|
||||
type: "success"
|
||||
});
|
||||
this.getList();
|
||||
} else {
|
||||
this.$message({
|
||||
message: res.msg ? res.msg : "启用失败,请重试",
|
||||
type: "error"
|
||||
});
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
this.$message({
|
||||
message: "启用失败,请重试",
|
||||
type: "error"
|
||||
});
|
||||
});
|
||||
});
|
||||
},
|
||||
/**
|
||||
* 禁用
|
||||
*/
|
||||
forbidden() {
|
||||
let ids = [];
|
||||
this.rowIds.forEach(item => {
|
||||
ids.push(item.id);
|
||||
});
|
||||
this.$confirm("确认禁用选中的保养计划吗?", "提示", {
|
||||
type: "warning"
|
||||
}).then(() => {
|
||||
this.$api.upkeepPlanAPI
|
||||
.forbidden({ ids: ids })
|
||||
.then(res => {
|
||||
console.log(res);
|
||||
if (res.code === 0) {
|
||||
this.$message({
|
||||
message: res.msg,
|
||||
type: "success"
|
||||
});
|
||||
this.getList();
|
||||
} else {
|
||||
this.$message({
|
||||
message: res.msg ? res.msg : "禁用失败,请重试",
|
||||
type: "error"
|
||||
});
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
this.$message({
|
||||
message: "禁用失败,请重试",
|
||||
type: "error"
|
||||
});
|
||||
});
|
||||
});
|
||||
},
|
||||
/**
|
||||
* 处理选中
|
||||
*/
|
||||
handleSelectionChange(val) {
|
||||
this.rowIds = val;
|
||||
this.setBtn(val);
|
||||
},
|
||||
/**
|
||||
* 控件操作按钮状态
|
||||
*/
|
||||
setBtn(val) {
|
||||
let isFlag = true;
|
||||
let isDelFlag = true;
|
||||
if (val.length > 0) {
|
||||
isDelFlag = false;
|
||||
if (val.length == 1) {
|
||||
isFlag = false;
|
||||
}
|
||||
} else {
|
||||
isFlag = true;
|
||||
isDelFlag = true;
|
||||
}
|
||||
this.btnDelDisabled = isDelFlag;
|
||||
this.btnOtherDisabled = isFlag;
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped></style>
|
|
@ -0,0 +1,277 @@
|
|||
<template>
|
||||
<div class="sys-box plan-box">
|
||||
<div class="sys-operate">
|
||||
<el-button type="primary" @click="back()">{{
|
||||
config.cancelText
|
||||
}}</el-button>
|
||||
<!-- <el-button type="primary" @click="tempSave('form')" :disabled="isDisabled"
|
||||
>暂存</el-button
|
||||
> -->
|
||||
<el-button type="primary" @click="save('form')"
|
||||
>提交</el-button
|
||||
>
|
||||
</div>
|
||||
<div class="sys-form">
|
||||
<el-form
|
||||
ref="form"
|
||||
:model="form"
|
||||
label-width="120px"
|
||||
:rules="rules"
|
||||
>
|
||||
<div class="flex">
|
||||
<el-form-item label="文件名称" prop="wjmc">
|
||||
<el-input v-model="form.wjmc" placeholder="文件名称"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="登记日期" prop="djrq">
|
||||
<el-date-picker
|
||||
v-model="form.djrq"
|
||||
type="date"
|
||||
format="yyyy-MM-dd"
|
||||
value-format="yyyy-MM-dd"
|
||||
placeholder="选择日期">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="文件页数" prop="ys">
|
||||
<el-input v-model="form.ys" placeholder="文件页数"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="更改状态" prop="ggzk">
|
||||
<el-input v-model="form.ggzk" placeholder="更改状态"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="上传附件">
|
||||
<el-upload
|
||||
:action="uploadUrl"
|
||||
multiple
|
||||
:limit="1"
|
||||
:on-success="uploadSuccess"
|
||||
:on-remove="handleRemove"
|
||||
:on-preview="onPreview"
|
||||
:auto-upload="auto_upload"
|
||||
:on-change="onChange"
|
||||
>
|
||||
<el-button size="small" type="primary">点击上传</el-button>
|
||||
</el-upload>
|
||||
</el-form-item>
|
||||
</div>
|
||||
<el-form-item width="400px" label="备注">
|
||||
<el-input type="textarea" placeholder="备注" v-model="form.bz"></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import config from "@/utils/config.js";
|
||||
import base from '@/api/base';
|
||||
import { mapMutations } from "vuex";
|
||||
|
||||
export default {
|
||||
name: "skwj-add",
|
||||
components: {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
uploadUrl: base.uploadUrl,
|
||||
form:{},
|
||||
config:config,
|
||||
auto_upload: false,
|
||||
fullscreenLoading: false,
|
||||
filePath:'',
|
||||
fileName:'',
|
||||
rules: {
|
||||
wjmc: [
|
||||
{ required: true, message: '文件名称', trigger: 'blur' },
|
||||
],
|
||||
djrq: [
|
||||
{ type: 'date', required: true, message: '请选择日期', trigger: 'change' }
|
||||
],
|
||||
ys: [
|
||||
{ required: true, message: '文件页数', trigger: 'blur' },
|
||||
],
|
||||
ggzk: [
|
||||
{ required: true, message: '请选择更改状态', trigger: 'change' }
|
||||
],
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
|
||||
},
|
||||
|
||||
methods: {
|
||||
...mapMutations({
|
||||
removeTagNav: "tagNav/removeTagNav"
|
||||
}),
|
||||
back() {
|
||||
this.removeTagNav({
|
||||
path: this.$route.path,
|
||||
title: this.$route.meta.name
|
||||
});
|
||||
this.$router.push({ path: "/yfgl/wjgl/skwj", query: { t: Date.now() } });
|
||||
},
|
||||
save(form){
|
||||
console.log(this.form)
|
||||
const _this = this
|
||||
this.$refs[form].validate(valid => {
|
||||
if(valid && _this.filePath){
|
||||
const data = {..._this.form,wjmc:_this.fileName,scfj:_this.filePath}
|
||||
_this.$api.yxkAPI.yxkPost('/apis/rc/wjgl/skwj/add',data).then((res)=>{
|
||||
if(res.code==0){
|
||||
_this.$message.success('保存成功!')
|
||||
_this.back();
|
||||
}else{
|
||||
_this.$message.error(res.msg)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
},
|
||||
httpRequest(upload, name, file) {//file是需要压缩图片时,原图片
|
||||
let _this = this;
|
||||
var tempFormData = new FormData();
|
||||
tempFormData.append("file", upload, name);//上传blob对象
|
||||
this.$api.commonAPI.uploadUrl(tempFormData).then(res => {
|
||||
_this.fullscreenLoading = false;
|
||||
if (res.code == 0) {//上传成功
|
||||
_this.$message({
|
||||
message: '上传成功',
|
||||
type: 'success',
|
||||
duration: 2000
|
||||
});
|
||||
_this.filePath = res.filePath
|
||||
_this.fileName = res.fileName
|
||||
} else {//上传失败
|
||||
_this.fullscreenLoading = false;
|
||||
_this.$message.error('上传失败');
|
||||
_this.$refs.upload.uploadFiles.splice(_this.$refs.upload.uploadFiles.length - 1, 1)
|
||||
}
|
||||
|
||||
});
|
||||
},
|
||||
onChange(file, fileList) {
|
||||
if (file.size > 100 * 1000000) {
|
||||
this.$message.error('上传文件不能超过100M!');
|
||||
this.$refs.upload.fileList = this.$refs.upload.fileList
|
||||
this.$refs.upload.uploadFiles.splice(this.$refs.upload.uploadFiles.length - 1, 1)
|
||||
|
||||
return false
|
||||
}
|
||||
file = file.raw;
|
||||
if (!/image\/\w+/.test(file.type)) {//非图片
|
||||
this.fullscreenLoading = true;
|
||||
this.httpRequest(file, file.name);
|
||||
} else {
|
||||
this.fullscreenLoading = true;
|
||||
let _this = this;
|
||||
imageConversion.compressAccurately(file, 400).then(res => {
|
||||
if (res.size) {//压缩成功
|
||||
_this.httpRequest(res, file.name, file);
|
||||
} else {
|
||||
_this.$message.error('压缩图片失败');
|
||||
_this.fullscreenLoading = false;
|
||||
_this.$refs.upload.uploadFiles.splice(_this.$refs.upload.uploadFiles.length - 1, 1)
|
||||
}
|
||||
}).catch(error=>{
|
||||
_this.httpRequest(file,file.name);
|
||||
})
|
||||
}
|
||||
},
|
||||
uploadSuccess(res, file) {
|
||||
if (res.msg === "操作成功") {
|
||||
this.uploadAttachment.push({
|
||||
filePath: res.filePath,
|
||||
fileName: res.fileName
|
||||
});
|
||||
}
|
||||
},
|
||||
handleRemove(file, fileList) {
|
||||
if (file.raw) {
|
||||
let index
|
||||
for (let i = 0; i < this.uploadAttachment.length; i++) {
|
||||
if (this.uploadAttachment[i].filePath == file.raw.filePath) {
|
||||
index = i;
|
||||
}
|
||||
}
|
||||
|
||||
this.uploadAttachment.splice(index, 1);
|
||||
|
||||
} else {
|
||||
let index;
|
||||
for (let i = 0; i < this.uploadAttachment.length; i++) {
|
||||
if (this.uploadAttachment[i].filePath == file.url.substr(1)) {
|
||||
index = i;
|
||||
}
|
||||
}
|
||||
this.uploadAttachment.splice(index, 1);
|
||||
}
|
||||
},
|
||||
onPreview(file) {
|
||||
if (file.url) {
|
||||
window.open(file.url)
|
||||
} else if (file.raw) {
|
||||
window.open(this.ftpPrefix + file.raw.filePath)
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.flex {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
.sys-form {
|
||||
padding: 20px 20px 20px 20px;
|
||||
}
|
||||
.sys-form .form-inline {
|
||||
width: 33.33%;
|
||||
}
|
||||
.sys-form .form-line {
|
||||
width: 66.66%;
|
||||
}
|
||||
.sys-form .form-half {
|
||||
width: 50%;
|
||||
}
|
||||
.sys-form .form-inline .el-input,
|
||||
.sys-form .form-inline .el-select .el-input {
|
||||
width: 100%;
|
||||
}
|
||||
.sys-form .form-short .el-input,
|
||||
.sys-form .form-short .el-select .el-input {
|
||||
margin-right: 5px;
|
||||
width: 60% !important;
|
||||
}
|
||||
.icon-luyin {
|
||||
color: #2589ee;
|
||||
font-size: 24px;
|
||||
cursor: pointer;
|
||||
}
|
||||
.form-ts {
|
||||
padding-left: 20px;
|
||||
color: #aaa;
|
||||
display: inline-block;
|
||||
}
|
||||
.el-form-item__content .sys-operate {
|
||||
padding: 10px 0px;
|
||||
}
|
||||
</style>
|
||||
<style>
|
||||
.el-cascader .el-input {
|
||||
width: 100% !important;
|
||||
}
|
||||
.plan-box .sys-form .form-inline .el-select,
|
||||
.plan-box .sys-form .form-inline .el-select .el-input {
|
||||
width: 100%;
|
||||
}
|
||||
.plan-box .el-table thead {
|
||||
line-height: 1;
|
||||
}
|
||||
.el-input {
|
||||
width: 100% !important;
|
||||
}
|
||||
</style>
|
|
@ -0,0 +1,518 @@
|
|||
<template>
|
||||
<!-- 保养计划列表页 -->
|
||||
<div class="sys-box knowledge-box">
|
||||
<div class="sys-operate">
|
||||
<el-button type="primary" @click="add()">新增</el-button>
|
||||
<el-button type="primary" @click="remove()" :disabled="btnDelDisabled"
|
||||
>删除</el-button
|
||||
>
|
||||
<el-button type="primary" @click="exportFile()">批量导出</el-button
|
||||
>
|
||||
</div>
|
||||
<div class="sys-search">
|
||||
<el-form inline class="form_item_search_out">
|
||||
<div class="form_item_input_out">
|
||||
<el-form-item
|
||||
label="文件编号"
|
||||
style="width:22%"
|
||||
class="form_item-inline"
|
||||
>
|
||||
<el-input
|
||||
v-model="search_data.wjbh"
|
||||
placeholder="文件编号"
|
||||
></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
label="文件名称"
|
||||
style="width:22%"
|
||||
class="form_item-inline"
|
||||
>
|
||||
<el-input
|
||||
v-model="search_data.wjmc"
|
||||
placeholder="文件名称"
|
||||
></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
label="更改状态"
|
||||
style="width:22%"
|
||||
class="form_item-inline"
|
||||
>
|
||||
<el-input
|
||||
v-model="search_data.ggzk"
|
||||
placeholder="更改状态"
|
||||
></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
label="创建日期"
|
||||
style="width:34%"
|
||||
class="form_item-inline"
|
||||
>
|
||||
<el-date-picker
|
||||
v-model="planTime"
|
||||
type="daterange"
|
||||
range-separator="-"
|
||||
start-placeholder="开始日期"
|
||||
end-placeholder="结束日期"
|
||||
></el-date-picker>
|
||||
</el-form-item>
|
||||
</div>
|
||||
<div class="form_item_btn_out">
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="search()">查询</el-button>
|
||||
</el-form-item>
|
||||
</div>
|
||||
</el-form>
|
||||
</div>
|
||||
<div class="sys-table">
|
||||
<el-table
|
||||
border
|
||||
@sort-change="sortChange"
|
||||
v-loading="pictLoading"
|
||||
@row-click="clickRow"
|
||||
ref="tb"
|
||||
:data="tableData"
|
||||
@selection-change="handleSelectionChange"
|
||||
:header-cell-style="{
|
||||
fontWeight: 'normal',
|
||||
textAlign: 'center',
|
||||
backgroundColor: '#eceff4',
|
||||
color: '#222'
|
||||
}"
|
||||
>
|
||||
<el-table-column
|
||||
type="selection"
|
||||
width="55"
|
||||
align="center"
|
||||
></el-table-column>
|
||||
<el-table-column
|
||||
prop="id"
|
||||
width="55"
|
||||
align="center"
|
||||
label="序号"
|
||||
></el-table-column>
|
||||
|
||||
<el-table-column
|
||||
prop="wjbh"
|
||||
align="center"
|
||||
width="200"
|
||||
label="文件编号"
|
||||
show-overflow-tooltip
|
||||
></el-table-column>
|
||||
<el-table-column
|
||||
prop="wjmc"
|
||||
label="文件名称"
|
||||
align="center"
|
||||
show-overflow-tooltip
|
||||
>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="ys"
|
||||
align="center"
|
||||
label="页数"
|
||||
show-overflow-tooltip
|
||||
></el-table-column>
|
||||
<el-table-column
|
||||
prop="ggzk"
|
||||
align="center"
|
||||
label="更改状态"
|
||||
show-overflow-tooltip
|
||||
></el-table-column>
|
||||
<el-table-column
|
||||
prop="updateTime"
|
||||
label="登记日期"
|
||||
align="center"
|
||||
show-overflow-tooltip
|
||||
></el-table-column>
|
||||
<el-table-column
|
||||
prop="djr"
|
||||
align="center"
|
||||
label="登记人"
|
||||
></el-table-column>
|
||||
<el-table-column
|
||||
prop="bz"
|
||||
align="center"
|
||||
label="备注"
|
||||
show-overflow-tooltip
|
||||
></el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
<div class="sys-pagination">
|
||||
<el-pagination
|
||||
@size-change="handleSizeChange"
|
||||
@current-change="handleCurrentChange"
|
||||
:current-page="search_data.pageno"
|
||||
:page-sizes="pageSizes"
|
||||
:page-size="search_data.pagesize"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
:total="total"
|
||||
></el-pagination>
|
||||
</div>
|
||||
<!-- 选择负责人-->
|
||||
<!-- <dialogChooseSingleUser
|
||||
:visible.sync="chooseUserVisible"
|
||||
@change="getUser"
|
||||
></dialogChooseSingleUser> -->
|
||||
<!-- <chooseSbjh :visible.sync="chooseSbjhVisible" /> -->
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { formatDateTime } from "@/utils/tools.js";
|
||||
// import btnInput from "@/components/btnInput.vue";
|
||||
// import chooseSbjh from "./components/chooseSbjh.vue";
|
||||
// import dialogChooseSingleUser from "@/components/System/dialogChooseSingleUser";
|
||||
let api = {
|
||||
page: "/apis/rc/wjgl/skwj/pageList",
|
||||
del: "/apis/rc/wjgl/skwj/del",
|
||||
edit: "/apis/mdh/cpzsk/edit"
|
||||
};
|
||||
export default {
|
||||
name: "cpzsk",
|
||||
components: {
|
||||
// btnInput
|
||||
// dialogChooseSingleUser
|
||||
// chooseSbjh
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
qyList: [],
|
||||
total: 0, //总条数
|
||||
pageSizes: [10, 20, 50], //每页展示多少条
|
||||
search_data: {
|
||||
pageno: 1,
|
||||
pagesize: 10
|
||||
},
|
||||
|
||||
planTime: "",
|
||||
|
||||
statusList: [], //计划状态
|
||||
getUserList: [], //用户
|
||||
|
||||
btnDelDisabled: true,
|
||||
btnOtherDisabled: true,
|
||||
chooseUserVisible: false,
|
||||
chooseSbjhVisible: false,
|
||||
rowIds: [],
|
||||
tableData: [],
|
||||
dialogVisible: false,
|
||||
pictLoading: false,
|
||||
qyList: [],
|
||||
jllxList: [],
|
||||
dywzList: []
|
||||
};
|
||||
},
|
||||
created() {
|
||||
var _this = this;
|
||||
document.onkeydown = e => {
|
||||
if (e.key === "Enter") {
|
||||
_this.search();
|
||||
}
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
//let user = JSON.parse(sessionStorage.getItem("userInfo"));
|
||||
//console.log(user);
|
||||
//this.search_data.engineerId = user.userId;
|
||||
this.getList();
|
||||
// this.initData();
|
||||
},
|
||||
methods: {
|
||||
exportFile(){
|
||||
this.$api.yxkAPI.yxkExport('/apis/rc/wjgl/skwj/exportExcel',this.search_data)
|
||||
},
|
||||
async reback() {
|
||||
if (this.rowIds.length > 0) {
|
||||
let r = this.rowIds[0];
|
||||
let pass = r.zt == 3 ? true : false;
|
||||
if (pass) {
|
||||
const params = {
|
||||
id: r.id,
|
||||
zt: 2,
|
||||
zczt: 0
|
||||
};
|
||||
const res = await this.$api.yxkAPI.yxkPost(api.edit, params);
|
||||
if (res.code == 0) {
|
||||
this.$message({
|
||||
message: "撤回成功",
|
||||
type: "success"
|
||||
});
|
||||
this.getList();
|
||||
}
|
||||
} else {
|
||||
this.$message({
|
||||
message: "非已提交状态不能撤回",
|
||||
type: "warning"
|
||||
});
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
this.$message({
|
||||
message: "请选择一条数据",
|
||||
type: "warning"
|
||||
});
|
||||
return false;
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 获取选择的负责人
|
||||
*/
|
||||
getUser(val) {
|
||||
if (val) {
|
||||
this.$set(this.search_data, "engineerName", val.name);
|
||||
this.$set(this.search_data, "engineerId", val.id);
|
||||
} else {
|
||||
this.$set(this.search_data, "engineerName", "");
|
||||
this.$set(this.search_data, "engineerId", "");
|
||||
}
|
||||
},
|
||||
sortChange({ column, prop, order }) {
|
||||
let j = { column, prop, order };
|
||||
let order_ = j.order == "ascending" ? "asc" : "desc";
|
||||
this.$set(this.search_data, "sort", j.prop);
|
||||
this.$set(this.search_data, "order", order_);
|
||||
this.getList();
|
||||
},
|
||||
clickRow(row) {
|
||||
this.$refs.tb.toggleRowSelection(row);
|
||||
},
|
||||
initData() {
|
||||
Promise.all([
|
||||
this.$api.dictAPI.getDictsByType("qy"),
|
||||
this.$api.dictAPI.getDictsByType("jllx"),
|
||||
this.$api.dictAPI.getDictsByType("dywz")
|
||||
])
|
||||
.then(([r1, r2, r3]) => {
|
||||
if (r1.code === 0) {
|
||||
this.qyList = r1.datas;
|
||||
}
|
||||
if (r2.code == 0) {
|
||||
this.jllxList = r2.datas;
|
||||
}
|
||||
if (r3.code == 0) {
|
||||
this.dywzList = r3.datas;
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
console.log(error);
|
||||
});
|
||||
},
|
||||
/**
|
||||
* 获取列表
|
||||
*/
|
||||
getList() {
|
||||
this.pictLoading = true;
|
||||
if (this.planTime) {
|
||||
this.search_data.ksrq = formatDateTime(this.planTime[0]);
|
||||
this.search_data.jsrq = formatDateTime(this.planTime[1]);
|
||||
} else {
|
||||
this.search_data.ksrq = null;
|
||||
this.search_data.jsrq = null;
|
||||
}
|
||||
this.$api.yxkAPI
|
||||
.yxkPost(api.page, this.search_data)
|
||||
.then(res => {
|
||||
this.pictLoading = false;
|
||||
if (res.data) {
|
||||
this.total = res.data.total;
|
||||
let result = res.data.records;
|
||||
this.tableData = result;
|
||||
} else {
|
||||
this.total = 0;
|
||||
this.tableData = [];
|
||||
}
|
||||
})
|
||||
.catch(r => {
|
||||
console.log(r);
|
||||
});
|
||||
},
|
||||
/**
|
||||
* 查询
|
||||
*/
|
||||
search() {
|
||||
this.search_data.pageno = 1;
|
||||
this.getList();
|
||||
},
|
||||
// 上下分页
|
||||
handleCurrentChange(val) {
|
||||
this.search_data.pageno = val;
|
||||
this.getList();
|
||||
},
|
||||
// 每页显示多少条
|
||||
handleSizeChange(val) {
|
||||
this.search_data.pagesize = val;
|
||||
this.getList();
|
||||
},
|
||||
/**
|
||||
* 新增
|
||||
*/
|
||||
add() {
|
||||
this.$router.push({
|
||||
path: "/yfgl/wjgl/skwj-add",
|
||||
query: {
|
||||
t: Date.now()
|
||||
}
|
||||
});
|
||||
},
|
||||
/**查看明细 */
|
||||
viewDetail(r) {
|
||||
if (r.zt == 2) {
|
||||
this.$router.push({
|
||||
path: "/yfgl/cpzsk-add",
|
||||
query: { id: r.id, t: Date.now() }
|
||||
});
|
||||
} else {
|
||||
this.$router.push({
|
||||
path: "/yfgl/cpzsk-add",
|
||||
query: { id: r.id, t: Date.now() }
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 保养执行
|
||||
*/
|
||||
execution() {
|
||||
// let id = this.rowIds[0].reventId;
|
||||
// this.$router.push({
|
||||
// path: "/upkeep/record",
|
||||
// query: { id: id }
|
||||
// });
|
||||
},
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
remove() {
|
||||
let ids = [];
|
||||
this.rowIds.forEach(item => {
|
||||
ids.push(item.id);
|
||||
});
|
||||
this.$confirm("确认删除选中的数据吗?", "提示", {
|
||||
type: "warning"
|
||||
}).then(() => {
|
||||
this.$api.yxkAPI
|
||||
.yxkPost(api.del, ids)
|
||||
.then(res => {
|
||||
console.log(res);
|
||||
if (res.code == 0) {
|
||||
this.$message({
|
||||
message: res.msg,
|
||||
type: "success"
|
||||
});
|
||||
this.getList();
|
||||
} else {
|
||||
this.$message({
|
||||
message: res.msg ? res.msg : "删除失败,请重试",
|
||||
type: "error"
|
||||
});
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
this.$message({
|
||||
message: "删除失败,请重试",
|
||||
type: "error"
|
||||
});
|
||||
});
|
||||
});
|
||||
},
|
||||
/**
|
||||
* 启用
|
||||
*/
|
||||
startUsing() {
|
||||
let ids = [];
|
||||
this.rowIds.forEach(item => {
|
||||
ids.push(item.id);
|
||||
});
|
||||
this.$confirm("确认启用选中的保养计划吗?", "提示", {
|
||||
type: "warning"
|
||||
}).then(() => {
|
||||
this.$api.upkeepPlanAPI
|
||||
.startUsing({ ids: ids })
|
||||
.then(res => {
|
||||
console.log(res);
|
||||
if (res.code === 0) {
|
||||
this.$message({
|
||||
message: res.msg,
|
||||
type: "success"
|
||||
});
|
||||
this.getList();
|
||||
} else {
|
||||
this.$message({
|
||||
message: res.msg ? res.msg : "启用失败,请重试",
|
||||
type: "error"
|
||||
});
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
this.$message({
|
||||
message: "启用失败,请重试",
|
||||
type: "error"
|
||||
});
|
||||
});
|
||||
});
|
||||
},
|
||||
/**
|
||||
* 禁用
|
||||
*/
|
||||
forbidden() {
|
||||
let ids = [];
|
||||
this.rowIds.forEach(item => {
|
||||
ids.push(item.id);
|
||||
});
|
||||
this.$confirm("确认禁用选中的保养计划吗?", "提示", {
|
||||
type: "warning"
|
||||
}).then(() => {
|
||||
this.$api.upkeepPlanAPI
|
||||
.forbidden({ ids: ids })
|
||||
.then(res => {
|
||||
console.log(res);
|
||||
if (res.code === 0) {
|
||||
this.$message({
|
||||
message: res.msg,
|
||||
type: "success"
|
||||
});
|
||||
this.getList();
|
||||
} else {
|
||||
this.$message({
|
||||
message: res.msg ? res.msg : "禁用失败,请重试",
|
||||
type: "error"
|
||||
});
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
this.$message({
|
||||
message: "禁用失败,请重试",
|
||||
type: "error"
|
||||
});
|
||||
});
|
||||
});
|
||||
},
|
||||
/**
|
||||
* 处理选中
|
||||
*/
|
||||
handleSelectionChange(val) {
|
||||
this.rowIds = val;
|
||||
this.setBtn(val);
|
||||
},
|
||||
/**
|
||||
* 控件操作按钮状态
|
||||
*/
|
||||
setBtn(val) {
|
||||
let isFlag = true;
|
||||
let isDelFlag = true;
|
||||
if (val.length > 0) {
|
||||
isDelFlag = false;
|
||||
if (val.length == 1) {
|
||||
isFlag = false;
|
||||
}
|
||||
} else {
|
||||
isFlag = true;
|
||||
isDelFlag = true;
|
||||
}
|
||||
this.btnDelDisabled = isDelFlag;
|
||||
this.btnOtherDisabled = isFlag;
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped></style>
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue