资产维修\保养
This commit is contained in:
parent
21a0949135
commit
ad4e9766a6
@ -107,7 +107,7 @@
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="取得日期" prop="getDate">
|
||||
<el-date-picker clearable v-model="formData.getDate" type="date" value-format="timestamp"
|
||||
<el-date-picker clearable v-model="formData.getDate" type="date" value-format="yyyy-MM-dd"
|
||||
placeholder="选择取得日期"
|
||||
/>
|
||||
</el-form-item>
|
||||
@ -116,7 +116,7 @@
|
||||
<el-row :gutter="2">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="出厂日期" prop="prodDate">
|
||||
<el-date-picker clearable v-model="formData.prodDate" type="date" value-format="timestamp"
|
||||
<el-date-picker clearable v-model="formData.prodDate" type="date" value-format="yyyy-MM-dd"
|
||||
placeholder="选择出厂日期"
|
||||
/>
|
||||
</el-form-item>
|
||||
@ -146,14 +146,14 @@
|
||||
<el-row :gutter="2">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="上次维修/保养日期" prop="lastKeepDate">
|
||||
<el-date-picker @blur="getNextKeepDate" clearable v-model="formData.lastKeepDate" type="date" value-format="timestamp"
|
||||
<el-date-picker @blur="getNextKeepDate" clearable v-model="formData.lastKeepDate" type="date" value-format="yyyy-MM-dd"
|
||||
placeholder="选择上次维修/保养日期"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="下次维修/保养日期" prop="nextKeepDate">
|
||||
<el-date-picker disabled clearable v-model="formData.nextKeepDate" type="date" value-format="timestamp"
|
||||
<el-date-picker disabled clearable v-model="formData.nextKeepDate" type="date" value-format="yyyy-MM-dd"
|
||||
placeholder="选择下次维修/保养日期"
|
||||
/>
|
||||
</el-form-item>
|
||||
@ -172,7 +172,7 @@
|
||||
<el-row :gutter="2">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="启用日期" prop="openDate">
|
||||
<el-date-picker clearable v-model="formData.openDate" type="date" value-format="timestamp"
|
||||
<el-date-picker clearable v-model="formData.openDate" type="date" value-format="yyyy-MM-dd"
|
||||
placeholder="选择启用日期"
|
||||
/>
|
||||
</el-form-item>
|
||||
@ -322,11 +322,6 @@ export default {
|
||||
const res = await PropertyApi.getProperty(id)
|
||||
this.formData = res.data
|
||||
this.formData.userId = parseInt(this.formData.userId)
|
||||
this.formData.prodDate = new Date(this.formData.prodDate)
|
||||
this.formData.lastKeepDate = new Date(this.formData.lastKeepDate)
|
||||
this.formData.openDate = new Date(this.formData.openDate)
|
||||
this.formData.nextKeepDate = new Date(this.formData.nextKeepDate)
|
||||
this.formData.getDate = new Date(this.formData.getDate)
|
||||
this.dialogTitle = '修改企业管理-资产'
|
||||
} finally {
|
||||
this.formLoading = false
|
||||
|
@ -158,6 +158,21 @@
|
||||
v-hasPermi="['company:property:delete']"
|
||||
>删除
|
||||
</el-button>
|
||||
<el-dropdown @command="(command) => handleCommand(command, scope.$index, scope.row)"
|
||||
v-hasPermi="['company:property:query']"
|
||||
>
|
||||
<el-button size="mini" type="text" icon="el-icon-d-arrow-right">更多</el-button>
|
||||
<el-dropdown-menu slot="dropdown">
|
||||
<el-dropdown-item command="handlePropertyKeepCrate" size="mini" type="text" icon="el-icon-setting"
|
||||
v-hasPermi="['company:property-keep:create']"
|
||||
>登录维修\保养记录
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item command="handlePropertyKeepQuery" size="mini" type="text" icon="el-icon-search"
|
||||
v-hasPermi="['company:property-keep:query']"
|
||||
>查看维修\保养记录
|
||||
</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</el-dropdown>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
@ -167,6 +182,8 @@
|
||||
/>
|
||||
<!-- 对话框(添加 / 修改) -->
|
||||
<PropertyForm ref="formRef" @success="getList"/>
|
||||
<PropertyKeepCreate ref="propertyKeepCreateRef" @success="getList" />
|
||||
<PropertyKeepQuery ref="propertyKeepQueryRef" @success="getList" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@ -177,11 +194,15 @@ import { listCategory } from '@/api/system/category'
|
||||
import { DICT_TYPE } from '@/utils/dict'
|
||||
import { getStaffList } from '@/api/company/staff'
|
||||
import { getPropertyPosList } from '@/api/company/property/position'
|
||||
import PropertyKeepCreate from '@/views/company/property/propertykeep/PropertyKeepCreate'
|
||||
import PropertyKeepQuery from '@/views/company/property/propertykeep/PropertyKeepQuery'
|
||||
|
||||
export default {
|
||||
name: 'Property',
|
||||
components: {
|
||||
PropertyForm
|
||||
PropertyForm,
|
||||
PropertyKeepCreate,
|
||||
PropertyKeepQuery
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
@ -313,6 +334,25 @@ export default {
|
||||
getPropertyPosList().then(res => {
|
||||
this.positionList = res.data
|
||||
})
|
||||
},
|
||||
// 更多操作
|
||||
handleCommand(command, index, row) {
|
||||
switch (command) {
|
||||
case 'handlePropertyKeepCrate':
|
||||
this.handlePropertyKeepCrate(row)
|
||||
break
|
||||
case 'handlePropertyKeepQuery':
|
||||
this.handlePropertyKeepQuery(row)
|
||||
break
|
||||
default:
|
||||
break
|
||||
}
|
||||
},
|
||||
handlePropertyKeepCrate(row){
|
||||
this.$refs['propertyKeepCreateRef'].open(row)
|
||||
},
|
||||
handlePropertyKeepQuery(row){
|
||||
this.$refs['propertyKeepQueryRef'].open(row)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
225
src/views/company/property/propertykeep/PropertyKeepCreate.vue
Normal file
225
src/views/company/property/propertykeep/PropertyKeepCreate.vue
Normal file
@ -0,0 +1,225 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-dialog :title="dialogTitle" :visible.sync="dialogVisible" width="80%" v-dialogDrag append-to-body>
|
||||
<el-form ref="formRef" :model="formData" :rules="formRules" v-loading="formLoading" label-width="145px">
|
||||
<el-card class="box-card">
|
||||
<!-- 卡片头 -->
|
||||
<div slot="header" class="clearfix">
|
||||
<i class="el-icon-plus" />
|
||||
<span>基本信息</span>
|
||||
</div>
|
||||
<!-- 卡片内容 -->
|
||||
<div>
|
||||
<el-row :gutter="2">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="资产编号" prop="propNo">
|
||||
<el-input disabled v-model="formData.property.propNo" placeholder="请输入资产编号"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="资产名称" prop="propName">
|
||||
<el-input disabled v-model="formData.property.propName" placeholder="请输入资产名称"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="2">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="资产状态" prop="propStatus">
|
||||
<el-select disabled v-model="formData.property.propStatus" placeholder="请选择资产状态" class="customerSelectWidth">
|
||||
<el-option v-for="dict in this.getDictDatas(DICT_TYPE.COMPANY_PROP_STATUS)" :key="dict.value"
|
||||
:label="dict.label" :value="dict.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="上次维修/保养日期" prop="lastKeepDate">
|
||||
<el-date-picker disabled clearable v-model="formData.property.lastKeepDate" type="date" value-format="yyyy-MM-dd"
|
||||
placeholder="选择上次维修/保养日期"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="2">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="维修/保养周期单位" prop="keepCycleType">
|
||||
<el-select disabled v-model="formData.property.keepCycleType" placeholder="请选择维修/保养周期单位" clearable class="customerSelectWidth">
|
||||
<el-option v-for="dict in this.getDictDatas(DICT_TYPE.CYCLE_DICT)" :key="dict.value"
|
||||
:label="dict.label" :value="dict.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="维修/保养周期" prop="keepCycle">
|
||||
<el-input disabled v-model="formData.property.keepCycle" placeholder="请输入维修/保养周期"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
</el-card>
|
||||
|
||||
<el-card class="box-card">
|
||||
<!-- 卡片头 -->
|
||||
<div slot="header" class="clearfix">
|
||||
<i class="el-icon-plus" />
|
||||
<span>维修\保养信息</span>
|
||||
</div>
|
||||
<!-- 卡片内容 -->
|
||||
<div>
|
||||
<el-row :gutter="2">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="维修/保养日期" prop="keepDate">
|
||||
<el-date-picker @blur="getNextKeepDate" clearable v-model="formData.keepDate" type="date" value-format="yyyy-MM-dd"
|
||||
placeholder="选择维修/保养日期"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="下次维修/保养日期" prop="nextKeepDate">
|
||||
<el-date-picker disabled clearable v-model="formData.property.nextKeepDate" type="date" value-format="yyyy-MM-dd"
|
||||
placeholder="选择下次维修/保养日期"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
</el-card>
|
||||
|
||||
<el-card class="box-card">
|
||||
<!-- 卡片头 -->
|
||||
<div slot="header" class="clearfix">
|
||||
<i class="el-icon-plus" />
|
||||
<span>附件\备注信息</span>
|
||||
</div>
|
||||
<!-- 卡片内容 -->
|
||||
<div>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input type="textarea" :autosize="{ minRows: 2, maxRows: 5}" v-model="formData.remark"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="附件上传" prop="fileUrls">
|
||||
<FileUpload v-model="formData.fileUrls"/>
|
||||
</el-form-item>
|
||||
</div>
|
||||
</el-card>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="submitForm" :disabled="formLoading">确 定</el-button>
|
||||
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {createPropertyKeep} from '@/api/company/property/propertykeep'
|
||||
import FileUpload from '@/components/FileUpload'
|
||||
|
||||
export default {
|
||||
name: 'PropertyKeepCreate',
|
||||
components: {
|
||||
FileUpload,
|
||||
},
|
||||
data(){
|
||||
return{
|
||||
// 弹出层标题
|
||||
dialogTitle: '登记维修\\保养记录',
|
||||
// 是否显示弹出层
|
||||
dialogVisible: false,
|
||||
// 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
|
||||
formLoading: false,
|
||||
// 表单参数
|
||||
formData: {
|
||||
property:{
|
||||
id: undefined,
|
||||
propNo: undefined,
|
||||
propName: undefined,
|
||||
propStatus: undefined,
|
||||
lastKeepDate: undefined,
|
||||
nextKeepDate: undefined,
|
||||
keepCycleType: undefined,
|
||||
keepCycle: undefined,
|
||||
},
|
||||
fileUrls: undefined,
|
||||
remark: undefined,
|
||||
keepDate: undefined,
|
||||
},
|
||||
// 表单校验
|
||||
formRules: {
|
||||
keepDate: [{required: true, message: '维修\\保养日期不能为空', trigger: 'blur'}],
|
||||
},
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
/** 打开弹窗 */
|
||||
async open(row){
|
||||
this.dialogVisible = true
|
||||
this.reset()
|
||||
this.formData.property = row
|
||||
},
|
||||
/** 表单重置 */
|
||||
reset() {
|
||||
this.formData = {
|
||||
property:{
|
||||
id: undefined,
|
||||
propNo: undefined,
|
||||
propName: undefined,
|
||||
propStatus: undefined,
|
||||
lastKeepDate: undefined,
|
||||
nextKeepDate: undefined,
|
||||
keepCycleType: undefined,
|
||||
keepCycle: undefined,
|
||||
},
|
||||
fileUrls: undefined,
|
||||
remark: undefined,
|
||||
keepDate: undefined,
|
||||
}
|
||||
this.resetForm('formRef')
|
||||
},
|
||||
// 计算下次维修、保养时间
|
||||
getNextKeepDate(){
|
||||
if (this.formData.keepDate){
|
||||
const tempDate = new Date(this.formData.keepDate)
|
||||
const chooseType = this.formData.property.keepCycleType;
|
||||
const num = parseInt(this.formData.property.keepCycle)
|
||||
switch (chooseType) {
|
||||
case '01':
|
||||
tempDate.setFullYear(tempDate.getFullYear() + num);
|
||||
break;
|
||||
case '02':
|
||||
tempDate.setMonth(tempDate.getMonth() + num);
|
||||
break;
|
||||
case '03':
|
||||
tempDate.setDate(tempDate.getDate() + num);
|
||||
break;
|
||||
default:
|
||||
throw new Error('超出预期了,只能是年、月、天');
|
||||
}
|
||||
this.formData.property.nextKeepDate = tempDate
|
||||
}
|
||||
},
|
||||
/** 提交按钮 */
|
||||
async submitForm() {
|
||||
// 校验主表
|
||||
await this.$refs['formRef'].validate()
|
||||
this.formLoading = true
|
||||
try {
|
||||
const data = this.formData
|
||||
// 提交
|
||||
await createPropertyKeep(data)
|
||||
this.$modal.msgSuccess('新增成功')
|
||||
this.dialogVisible = false
|
||||
this.$emit('success')
|
||||
} finally {
|
||||
this.formLoading = false
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.box-card {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
</style>
|
@ -1,112 +0,0 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<!-- 对话框(添加 / 修改) -->
|
||||
<el-dialog :title="dialogTitle" :visible.sync="dialogVisible" width="45%" v-dialogDrag append-to-body>
|
||||
<el-form ref="formRef" :model="formData" :rules="formRules" v-loading="formLoading" label-width="100px">
|
||||
<el-form-item label="资产id" prop="propertyId">
|
||||
<el-input v-model="formData.propertyId" placeholder="请输入资产id" />
|
||||
</el-form-item>
|
||||
<el-form-item label="维修/保养日期" prop="keepDate">
|
||||
<el-date-picker clearable v-model="formData.keepDate" type="date" value-format="timestamp"
|
||||
placeholder="选择维修/保养日期" />
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="formData.remark" placeholder="请输入备注" />
|
||||
</el-form-item>
|
||||
<el-form-item label="附件urls">
|
||||
<FileUpload v-model="formData.fileUrls" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="submitForm" :disabled="formLoading">确 定</el-button>
|
||||
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import * as PropertyKeepApi from '@/api/company/property/propertykeep';
|
||||
import FileUpload from '@/components/FileUpload';
|
||||
export default {
|
||||
name: "PropertyKeepForm",
|
||||
components: {
|
||||
FileUpload,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
// 弹出层标题
|
||||
dialogTitle: "",
|
||||
// 是否显示弹出层
|
||||
dialogVisible: false,
|
||||
// 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
|
||||
formLoading: false,
|
||||
// 表单参数
|
||||
formData: {
|
||||
id: undefined,
|
||||
propertyId: undefined,
|
||||
keepDate: undefined,
|
||||
remark: undefined,
|
||||
fileUrls: undefined,
|
||||
},
|
||||
// 表单校验
|
||||
formRules: {
|
||||
},
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
/** 打开弹窗 */
|
||||
async open(id) {
|
||||
this.dialogVisible = true;
|
||||
this.reset();
|
||||
// 修改时,设置数据
|
||||
if (id) {
|
||||
this.formLoading = true;
|
||||
try {
|
||||
const res = await PropertyKeepApi.getPropertyKeep(id);
|
||||
this.formData = res.data;
|
||||
this.title = "修改资产维修/保养记录";
|
||||
} finally {
|
||||
this.formLoading = false;
|
||||
}
|
||||
}
|
||||
this.title = "新增资产维修/保养记录";
|
||||
},
|
||||
/** 提交按钮 */
|
||||
async submitForm() {
|
||||
// 校验主表
|
||||
await this.$refs["formRef"].validate();
|
||||
this.formLoading = true;
|
||||
try {
|
||||
const data = this.formData;
|
||||
// 修改的提交
|
||||
if (data.id) {
|
||||
await PropertyKeepApi.updatePropertyKeep(data);
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.dialogVisible = false;
|
||||
this.$emit('success');
|
||||
return;
|
||||
}
|
||||
// 添加的提交
|
||||
await PropertyKeepApi.createPropertyKeep(data);
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.dialogVisible = false;
|
||||
this.$emit('success');
|
||||
} finally {
|
||||
this.formLoading = false;
|
||||
}
|
||||
},
|
||||
/** 表单重置 */
|
||||
reset() {
|
||||
this.formData = {
|
||||
id: undefined,
|
||||
propertyId: undefined,
|
||||
keepDate: undefined,
|
||||
remark: undefined,
|
||||
fileUrls: undefined,
|
||||
};
|
||||
this.resetForm("formRef");
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
302
src/views/company/property/propertykeep/PropertyKeepQuery.vue
Normal file
302
src/views/company/property/propertykeep/PropertyKeepQuery.vue
Normal file
@ -0,0 +1,302 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-dialog :title="dialogTitle" :visible.sync="dialogVisible" width="80%" v-dialogDrag append-to-body>
|
||||
<el-form ref="formRef" :model="formData" :rules="formRules" v-loading="formLoading" label-width="145px">
|
||||
<el-card class="box-card">
|
||||
<!-- 卡片头 -->
|
||||
<div slot="header" class="clearfix">
|
||||
<i class="el-icon-plus"/>
|
||||
<span>基本信息</span>
|
||||
</div>
|
||||
<!-- 卡片内容 -->
|
||||
<div>
|
||||
<el-row :gutter="2">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="资产编号" prop="propNo">
|
||||
<el-input disabled v-model="formData.property.propNo" placeholder="请输入资产编号"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="资产名称" prop="propName">
|
||||
<el-input disabled v-model="formData.property.propName" placeholder="请输入资产名称"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="2">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="资产状态" prop="propStatus">
|
||||
<el-select disabled v-model="formData.property.propStatus" placeholder="请选择资产状态"
|
||||
class="customerSelectWidth"
|
||||
>
|
||||
<el-option v-for="dict in this.getDictDatas(DICT_TYPE.COMPANY_PROP_STATUS)" :key="dict.value"
|
||||
:label="dict.label" :value="dict.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="上次维修/保养日期" prop="lastKeepDate">
|
||||
<el-date-picker disabled clearable v-model="formData.property.lastKeepDate" type="date"
|
||||
value-format="yyyy-MM-dd"
|
||||
placeholder="选择上次维修/保养日期"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="2">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="维修/保养周期单位" prop="keepCycleType">
|
||||
<el-select disabled v-model="formData.property.keepCycleType" placeholder="请选择维修/保养周期单位" clearable
|
||||
class="customerSelectWidth"
|
||||
>
|
||||
<el-option v-for="dict in this.getDictDatas(DICT_TYPE.CYCLE_DICT)" :key="dict.value"
|
||||
:label="dict.label" :value="dict.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="维修/保养周期" prop="keepCycle">
|
||||
<el-input disabled v-model="formData.property.keepCycle" placeholder="请输入维修/保养周期"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="2">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="下次维修/保养日期" prop="nextKeepDate">
|
||||
<el-date-picker disabled clearable v-model="formData.property.nextKeepDate" type="date"
|
||||
value-format="yyyy-MM-dd"
|
||||
placeholder="选择下次维修/保养日期"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
</el-card>
|
||||
|
||||
<el-card class="box-card">
|
||||
<!-- 卡片头 -->
|
||||
<div slot="header" class="clearfix">
|
||||
<i class="el-icon-plus"/>
|
||||
<span>维修\保养记录</span>
|
||||
</div>
|
||||
<!-- 卡片内容 -->
|
||||
<div>
|
||||
<!-- 搜索工作栏 -->
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch"
|
||||
label-width="68px"
|
||||
>
|
||||
<el-form-item label="维修/保养日期" prop="keepDateArray" label-width="100">
|
||||
<el-date-picker v-model="queryParams.keepDateArray" style="width: 240px"
|
||||
value-format="yyyy-MM-dd HH:mm:ss"
|
||||
type="daterange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期"
|
||||
:default-time="['00:00:00', '23:59:59']"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
|
||||
<el-table-column label="序号" align="center" prop="num">
|
||||
<template slot-scope="scope">
|
||||
<span style="margin-left: 10px">{{
|
||||
queryParams.pageSize * (queryParams.pageNo - 1) + scope.$index + 1
|
||||
}}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="维修/保养日期" align="center" prop="keepDate"/>
|
||||
<el-table-column label="备注" align="center" prop="remark"/>
|
||||
<el-table-column fixed="right" label="操作" align="center" class-name="small-padding fixed-width"
|
||||
width="200"
|
||||
>
|
||||
<template v-slot="scope">
|
||||
<el-button size="mini" type="text" icon="el-icon-edit" @click="openForm(scope.row)"
|
||||
v-hasPermi="['company:property-keep:query']"
|
||||
>列表查看
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!-- 分页组件 -->
|
||||
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo"
|
||||
:limit.sync="queryParams.pageSize"
|
||||
@pagination="listPropertyKeep"
|
||||
/>
|
||||
</div>
|
||||
</el-card>
|
||||
</el-form>
|
||||
</el-dialog>
|
||||
|
||||
<el-drawer
|
||||
title="维修\保养记录详情"
|
||||
:with-header="false"
|
||||
:visible.sync="drawer"
|
||||
:direction="direction"
|
||||
>
|
||||
<div style="padding: 10px 0 0 10px">
|
||||
<el-descriptions class="margin-top" title="维修\保养记录详情" :column="1" border>
|
||||
<el-descriptions-item label="资产编号">{{ drawerDate.propNo }}</el-descriptions-item>
|
||||
<el-descriptions-item label="资产名称">{{ drawerDate.propName }}</el-descriptions-item>
|
||||
<el-descriptions-item label="资产状态">
|
||||
<dict-tag :type="DICT_TYPE.COMPANY_PROP_STATUS" :value="drawerDate.propStatus"/>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="维修/保养周期单位">
|
||||
<dict-tag :type="DICT_TYPE.CYCLE_DICT" :value="drawerDate.keepCycleType"/>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="维修/保养周期">{{ drawerDate.keepCycle }}</el-descriptions-item>
|
||||
<el-descriptions-item label="维修/保养日期">{{ drawerDate.keepDate }}</el-descriptions-item>
|
||||
<el-descriptions-item label="备注">{{ drawerDate.remark }}</el-descriptions-item>
|
||||
<el-descriptions-item label="附件">
|
||||
<el-card v-for="(file, index) in drawerDate.fileUrls" :key="index" style="margin-bottom: 10px">
|
||||
<div slot="header" class="clearfix">
|
||||
<i :class="getFileIcon(file.fileUrl)"></i>
|
||||
<span>{{ file.fileName }}</span>
|
||||
</div>
|
||||
<div>
|
||||
<a :href="file.fileUrl" download :title="file.fileName" target="_blank">
|
||||
<el-button type="primary" size="small">
|
||||
下载
|
||||
</el-button>
|
||||
</a>
|
||||
</div>
|
||||
</el-card>
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
</div>
|
||||
</el-drawer>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getPropertyKeepPage } from '@/api/company/property/propertykeep'
|
||||
|
||||
export default {
|
||||
name: 'PropertyKeepQuery',
|
||||
data() {
|
||||
return {
|
||||
drawer: false,
|
||||
direction: 'rtl',
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 弹出层标题
|
||||
dialogTitle: '查看维修\\保养记录',
|
||||
// 是否显示弹出层
|
||||
dialogVisible: false,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 导出遮罩层
|
||||
exportLoading: false,
|
||||
formData: {
|
||||
property: {
|
||||
id: undefined,
|
||||
propNo: undefined,
|
||||
propName: undefined,
|
||||
propStatus: undefined,
|
||||
lastKeepDate: undefined,
|
||||
nextKeepDate: undefined,
|
||||
keepCycleType: undefined,
|
||||
keepCycle: undefined
|
||||
}
|
||||
},
|
||||
// 表单校验
|
||||
formRules: {},
|
||||
// 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
|
||||
formLoading: false,
|
||||
list: [],
|
||||
queryParams: {
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
keepDateArray: [],
|
||||
propertyId: undefined
|
||||
},
|
||||
total: 0,
|
||||
drawerDate: {}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
/** 打开弹窗 */
|
||||
async open(row) {
|
||||
this.reset()
|
||||
this.resetQuery()
|
||||
await this.listPropertyKeep(row.id)
|
||||
this.formData.property = row
|
||||
this.drawerDate = {
|
||||
...row,
|
||||
keepDate: undefined,
|
||||
remark: undefined,
|
||||
fileUrls: undefined
|
||||
}
|
||||
this.dialogVisible = true
|
||||
},
|
||||
/** 表单重置 */
|
||||
reset() {
|
||||
this.formData = {
|
||||
property: {
|
||||
id: undefined,
|
||||
propNo: undefined,
|
||||
propName: undefined,
|
||||
propStatus: undefined,
|
||||
lastKeepDate: undefined,
|
||||
nextKeepDate: undefined,
|
||||
keepCycleType: undefined,
|
||||
keepCycle: undefined
|
||||
}
|
||||
}
|
||||
this.resetForm('formRef')
|
||||
},
|
||||
// 获得记录
|
||||
async listPropertyKeep(id) {
|
||||
this.queryParams.propertyId = id
|
||||
const res = await getPropertyKeepPage(this.queryParams)
|
||||
this.list = res.data.records
|
||||
this.total = res.data.total
|
||||
this.loading = false
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNo = 1
|
||||
this.listPropertyKeep()
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm('queryForm')
|
||||
this.handleQuery()
|
||||
},
|
||||
openForm(row) {
|
||||
this.drawer = true
|
||||
this.drawerDate.keepDate = row.keepDate
|
||||
this.drawerDate.remark = row.remark
|
||||
this.drawerDate.fileUrls = row.fileUrls.split(',').map(item => {
|
||||
return {
|
||||
fileName: item.split('/').pop(),
|
||||
fileUrl: item
|
||||
}
|
||||
})
|
||||
},
|
||||
getFileIcon(url) {
|
||||
// 这个函数用于根据文件类型返回对应的图标类名
|
||||
const fileName = url.split('/').pop()
|
||||
const extension = fileName.split('.').pop().toLowerCase()
|
||||
switch (extension) {
|
||||
case 'doc':
|
||||
case 'docx':
|
||||
return 'el-icon-document'
|
||||
case 'xls':
|
||||
case 'xlsx':
|
||||
return 'el-icon-s-data'
|
||||
case 'pdf':
|
||||
return 'el-icon-document-checked'
|
||||
default:
|
||||
return 'el-icon-folder'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
@ -1,164 +0,0 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<!-- 搜索工作栏 -->
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form-item label="资产id" prop="propertyId">
|
||||
<el-input v-model="queryParams.propertyId" placeholder="请输入资产id" clearable @keyup.enter.native="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="维修/保养日期" prop="keepDate" label-width="100">
|
||||
<el-date-picker v-model="queryParams.keepDate" style="width: 240px" value-format="yyyy-MM-dd HH:mm:ss"
|
||||
type="daterange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期"
|
||||
:default-time="['00:00:00', '23:59:59']" />
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="queryParams.remark" placeholder="请输入备注" clearable @keyup.enter.native="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="创建时间" prop="createTime" label-width="60">
|
||||
<el-date-picker v-model="queryParams.createTime" style="width: 240px" value-format="yyyy-MM-dd HH:mm:ss"
|
||||
type="daterange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期"
|
||||
:default-time="['00:00:00', '23:59:59']" />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<!-- 操作工具栏 -->
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="openForm(undefined)"
|
||||
v-hasPermi="['company:property-keep:create']">新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport"
|
||||
:loading="exportLoading" v-hasPermi="['company:property-keep:export']">导出</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
|
||||
<el-table-column label="序号" align="center" prop="num">
|
||||
<template slot-scope="scope">
|
||||
<span style="margin-left: 10px">{{ queryParams.pageSize * (queryParams.pageNo - 1) + scope.$index + 1
|
||||
}}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="资产id" align="center" prop="propertyId" />
|
||||
<el-table-column label="维修/保养日期" align="center" prop="keepDate" />
|
||||
<el-table-column label="备注" align="center" prop="remark" />
|
||||
<el-table-column label="附件urls" align="center" prop="fileUrls" />
|
||||
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
|
||||
<template v-slot="scope">
|
||||
<span>{{ parseTime(scope.row.createTime) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column fixed="right" label="操作" align="center" class-name="small-padding fixed-width" width="200">
|
||||
<template v-slot="scope">
|
||||
<el-button size="mini" type="text" icon="el-icon-edit" @click="openForm(scope.row.id)"
|
||||
v-hasPermi="['company:property-keep:update']">修改</el-button>
|
||||
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
|
||||
v-hasPermi="['company:property-keep:delete']">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!-- 分页组件 -->
|
||||
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
|
||||
@pagination="getList" />
|
||||
<!-- 对话框(添加 / 修改) -->
|
||||
<PropertyKeepForm ref="formRef" @success="getList" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import * as PropertyKeepApi from '@/api/company/property/propertykeep';
|
||||
import PropertyKeepForm from './PropertyKeepForm.vue';
|
||||
export default {
|
||||
name: "PropertyKeep",
|
||||
components: {
|
||||
PropertyKeepForm,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 导出遮罩层
|
||||
exportLoading: false,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 资产维修/保养记录列表
|
||||
list: [],
|
||||
// 是否展开,默认全部展开
|
||||
isExpandAll: true,
|
||||
// 重新渲染表格状态
|
||||
refreshTable: true,
|
||||
// 选中行
|
||||
currentRow: {},
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
propertyId: null,
|
||||
keepDate: [],
|
||||
remark: null,
|
||||
fileUrls: null,
|
||||
createTime: [],
|
||||
},
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
/** 查询列表 */
|
||||
async getList() {
|
||||
try {
|
||||
this.loading = true;
|
||||
const res = await PropertyKeepApi.getPropertyKeepPage(this.queryParams);
|
||||
this.list = res.data.records;
|
||||
this.total = res.data.total;
|
||||
} finally {
|
||||
this.loading = false;
|
||||
}
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNo = 1;
|
||||
this.getList();
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
},
|
||||
/** 添加/修改操作 */
|
||||
openForm(id) {
|
||||
this.$refs["formRef"].open(id);
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
async handleDelete(row) {
|
||||
const id = row.id;
|
||||
await this.$modal.confirm('是否确认删除资产维修/保养记录编号为"' + id + '"的数据项?')
|
||||
try {
|
||||
await PropertyKeepApi.deletePropertyKeep(id);
|
||||
await this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
} catch { }
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
async handleExport() {
|
||||
await this.$modal.confirm('是否确认导出所有资产维修/保养记录数据项?');
|
||||
try {
|
||||
this.exportLoading = true;
|
||||
const data = await PropertyKeepApi.exportPropertyKeepExcel(this.queryParams);
|
||||
this.$download.excel(data, '资产维修/保养记录.xls');
|
||||
} catch {
|
||||
} finally {
|
||||
this.exportLoading = false;
|
||||
}
|
||||
},
|
||||
}
|
||||
};
|
||||
</script>
|
@ -35,7 +35,7 @@
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="formData.remark"/>
|
||||
<el-input type="textarea" :autosize="{ minRows: 2, maxRows: 5}" v-model="formData.remark"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="附件" prop="fileUrls">
|
||||
<file-upload v-model="formData.fileUrls"></file-upload>
|
||||
|
Loading…
Reference in New Issue
Block a user