feat: consulting/device 新增设备台账

This commit is contained in:
zty 2024-06-27 16:19:55 +08:00
parent 86d9b9a3cb
commit 4761c5ae21
5 changed files with 272 additions and 2 deletions

19
client/src/api/device.js Normal file
View File

@ -0,0 +1,19 @@
import request from '@/utils/request'
export function getDeviceList(query) {
return request({
url: '/consulting/device/',
method: 'get',
params: query
})
}
export function DeviceImp(data) {
return request({
url: '/consulting/device/imp/',
method: 'post',
data
})
}

View File

@ -203,7 +203,12 @@ export const asyncRoutes = [
name: 'professional',
component: () => import('@/views/consulting/professional.vue'),
meta: { title: '专业领域要求', perms: ['professional_view'] }
}, {
},{
path: 'device',
name: 'device',
component: () => import('@/views/consulting/device.vue'),
meta: { title: '设备台账', perms: ['policy_view'] }
}, {
path: 'validation',
name: 'validation',
component: () => import('@/views/consulting/validation.vue'),

View File

@ -0,0 +1,243 @@
<template>
<div class="app-container">
<el-card>
<el-input
v-model="listQuery.search"
placeholder="输入公司名称、设备名称、规格型号、生产厂家、检测参数、采购时间搜索"
style="width: 600px;"
class="filter-item"
/>
<el-button
class="filter-item"
type="primary"
icon="el-icon-search"
@click="handleSearch">搜索</el-button>
<el-button type="primary"
@click="importExcel"
icon="el-icon-upload"
:disabled="checkPermission['device_import']"
>导入Excel</el-button>
</el-card>
<el-card style="margin-top: 10px">
<el-table
v-loading="listLoading"
:data="contentList.results"
border
fit
stripe
highlight-current-row
max-height="700"
>
<el-table-column type="index" width="50" />
<el-table-column align="left" label="公司名称">
<template slot-scope="scope">{{ scope.row.company_name }}</template>
</el-table-column>
<el-table-column align="left" label="设备名称">
<template slot-scope="scope">{{ scope.row.device_name }}</template>
</el-table-column>
<el-table-column align="left" label="设备编号">
<template slot-scope="scope">{{ scope.row.device_number }}</template>
</el-table-column>
<el-table-column align="left" label="规格型号">
<template slot-scope="scope">{{ scope.row.spec }}</template>
</el-table-column>
<el-table-column align="left" label="生产厂家">
<template slot-scope="scope">{{ scope.row.manufactor }}</template>
</el-table-column>
<el-table-column align="left" label="检测参数">
<template slot-scope="scope">{{ scope.row.dec_parameter }}</template>
</el-table-column>
<el-table-column align="left" label="量程">
<template slot-scope="scope">{{ scope.row.range }}</template>
</el-table-column>
<el-table-column align="left" label="精度">
<template slot-scope="scope">{{ scope.row.precision }}</template>
</el-table-column>
<el-table-column align="left" label="其他技术参数">
<template slot-scope="scope">{{ scope.row.other_parameter }}</template>
</el-table-column>
<el-table-column align="left" label="使用部门">
<template slot-scope="scope">{{ scope.row.department }}</template>
</el-table-column>
<el-table-column align="left" label="采购时间">
<template slot-scope="scope">{{ scope.row.procurement_time }}</template>
</el-table-column>
<el-table-column align="left" label="资产原值">
<template slot-scope="scope">{{ scope.row.original_price }}</template>
</el-table-column>
<el-table-column align="left" label="资产净值">
<template slot-scope="scope">{{ scope.row.current_price }}</template>
</el-table-column>
<el-table-column align="left" label="原值是否含基建">
<template slot-scope="scope">
<el-tag v-if="scope.row.is_infrastructure" type="success"></el-tag>
<el-tag v-else type="danger"></el-tag>
</template>
</el-table-column>
<el-table-column align="left" label="基建原值占比(%)">
<template slot-scope="scope">{{ scope.row.infras_percentage }}</template>
</el-table-column>
<el-table-column align="left" label="是否有说明书">
<template slot-scope="scope">
<el-tag v-if="scope.row.is_instructions" type="success"></el-tag>
<el-tag v-else type="danger"></el-tag>
</template>
</el-table-column>
<el-table-column align="left" label="保管人">
<template slot-scope="scope">{{ scope.row.custodian }}</template>
</el-table-column>
<el-table-column align="left" label="存放地点">
<template slot-scope="scope">{{ scope.row.depositor }}</template>
</el-table-column>
<el-table-column align="left" label="设备联系人">
<template slot-scope="scope">{{ scope.row.contacts }}</template>
</el-table-column>
<el-table-column align="left" label="联系电话">
<template slot-scope="scope">{{ scope.row.tel }}</template>
</el-table-column>
<el-table-column align="left" label="备注">
<template slot-scope="scope">{{ scope.row.remark }}</template>
</el-table-column>
</el-table>
<pagination
v-show="contentList.count > 0"
:total="contentList.count"
:page.sync="listQuery.page"
:limit.sync="listQuery.page_size"
@pagination="getList"
/>
</el-card>
<el-dialog
:visible.sync="dialogVisible"
>
<el-form
ref="Form"
:model="Content"
label-width="80px"
label-position="right"
:rules="rule1">
<el-form-item label="文档上传" prop="file" v-if="dialogVisible">
<el-upload
ref="upload"
:action="upUrl"
:on-preview="handlePreview"
:on-success="handleUpSuccess"
:on-remove="handleRemove"
:headers="upHeaders"
:file-list="fileList"
:limit="1"
accept=".doc,.docx,.xls,.xlsx,.ppt,.pptx,.pdf,.zip"
>
<el-button size="small" type="primary">上传文件</el-button>
</el-upload>
</el-form-item>
</el-form>
<div style="text-align: right">
<el-button type="danger" @click="dialogVisible = false">取消</el-button>
<el-button type="primary" @click="confirm()">确认</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import {
getDeviceList,
DeviceImp,
} from "@/api/device";
import checkPermission from "@/utils/permission";
import Pagination from "@/components/Pagination"; // secondary package based on el-pagination
import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
import { upUrl, upHeaders } from "@/api/file";
const defaultContent = {
excel_path:''
};
export default {
components: { Pagination, Treeselect },
data() {
return {
upHeaders: upHeaders(),
upUrl: upUrl(),
fileList:[],
Content: defaultContent,
listLoading:false,
dialogVisible: false,
listQuery: {
page: 1,
search:'',
page_size: 20,
},
contentList: {
count:0
},
dialogType: "new",
rule1: {
name: [{ required: true, message: "请输入名称", trigger: "blur" }],
},
};
},
computed: {},
watch: {
filterOrgText(val) {
this.$refs.tree.filter(val);
},
},
created() {
this.getList();
},
methods: {
handleSearch(){
this.listQuery.page = 1
this.getList();
},
handlePreview(file) {
if ("url" in file) {
window.open(file.url);
} else {
window.open(file.response.data.path);
}
},
handleUpSuccess(res, file, filelist) {
let that =this;
if (res.code == 201){
that.Content.excel_path = res.data.path;
}else{
that.$message.error(res.msg);
that.Content.excel_path = null;
}
},
importExcel(){
this.dialogVisible = true;
},
handleRemove(file, filelist){
this.Content.file = null;
},
checkPermission,
getList() {
getDeviceList(this.listQuery).then((response) => {
if (response.data) {
this.contentList = response.data;
}
});
},
async confirm(){
let that = this;
this.dialogVisible = false;
DeviceImp(that.Content).then(res => {
if (res.code >= 200) {
that.getList(listQuery)
that.$message({
type: "success",
message: "上传成功"
})
this.dialogVisible = false;
}
}
)
},
},
};
</script>

View File

@ -115,8 +115,11 @@ import { options } from "runjs";
params: "",
result: 10,
handle_result:0,
field:"",
a_class:true,
task2do: 0
},
type: "add",
titleOption: {
add: "新增能力验证结果",
edit: "能力验证结果编辑",

View File

@ -704,7 +704,7 @@ class ImpMixin:
# 对于能力验证和监督检查进行有则跳过无则更新操作。
if repalce:
if types.lower()== 'pt':
model_info = mymodel.objects.filter(name=data.get('name'), number=data.get('number'))
model_info = mymodel.objects.filter(name=data.get('name'), number=data.get('number'), params=data.get('params'))
if model_info:
i = i + 1
continue