shebeigongyingshang
This commit is contained in:
parent
2fed5b2aec
commit
63320da683
|
@ -0,0 +1,30 @@
|
||||||
|
import request from '@/utils/request'
|
||||||
|
|
||||||
|
export function getpEquipmentList(query) {
|
||||||
|
return request({
|
||||||
|
url: '/em/equipment/',
|
||||||
|
method: 'get',
|
||||||
|
params: query
|
||||||
|
})
|
||||||
|
}
|
||||||
|
export function createEquipment(data) {
|
||||||
|
return request({
|
||||||
|
url: '/em/equipment/',
|
||||||
|
method: 'post',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
export function updateEquipment(id, data) {
|
||||||
|
return request({
|
||||||
|
url: `/em/equipment/${id}/`,
|
||||||
|
method: 'put',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
export function deleteEquipment(id, data) {
|
||||||
|
return request({
|
||||||
|
url: `/em/equipment/${id}/`,
|
||||||
|
method: 'delete',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
|
@ -0,0 +1,30 @@
|
||||||
|
import request from '@/utils/request'
|
||||||
|
|
||||||
|
export function getpVendorList(query) {
|
||||||
|
return request({
|
||||||
|
url: '/pum/vendor/',
|
||||||
|
method: 'get',
|
||||||
|
params: query
|
||||||
|
})
|
||||||
|
}
|
||||||
|
export function createVendor(data) {
|
||||||
|
return request({
|
||||||
|
url: '/pum/vendor/',
|
||||||
|
method: 'post',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
export function updateVendor(id, data) {
|
||||||
|
return request({
|
||||||
|
url: `/pum/vendor/${id}/`,
|
||||||
|
method: 'put',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
export function deleteVendor(id, data) {
|
||||||
|
return request({
|
||||||
|
url: `/pum/vendor/${id}/`,
|
||||||
|
method: 'delete',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
|
@ -73,11 +73,44 @@ export const constantRoutes = [
|
||||||
|
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* asyncRoutes
|
* asyncRoutes
|
||||||
* the routes that need to be dynamically loaded based on user perms
|
* the routes that need to be dynamically loaded based on user perms
|
||||||
*/
|
*/
|
||||||
export const asyncRoutes = [
|
export const asyncRoutes = [
|
||||||
|
{
|
||||||
|
path: '/equipment',
|
||||||
|
component: Layout,
|
||||||
|
redirect: '/equipment/index',
|
||||||
|
name: 'equipment',
|
||||||
|
meta: { title: '设备管理', icon: 'example', perms: ['equipment_set'] },
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
path: 'index',
|
||||||
|
name: 'index',
|
||||||
|
component: () => import('@/views/equipment/index'),
|
||||||
|
meta: { title: '设备台账', icon: 'example', perms: ['index_manage'] }
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
path: '/procurement',
|
||||||
|
component: Layout,
|
||||||
|
redirect: '/procurement/index',
|
||||||
|
name: 'procurement',
|
||||||
|
meta: { title: '采购管理', icon: 'example', perms: ['procurement_set'] },
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
path: 'vendor',
|
||||||
|
name: 'vendor',
|
||||||
|
component: () => import('@/views/procurement/vendor'),
|
||||||
|
meta: { title: '供应商', icon: 'example', perms: ['vendor_manage'] }
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
path: '/system',
|
path: '/system',
|
||||||
component: Layout,
|
component: Layout,
|
||||||
|
|
|
@ -0,0 +1,333 @@
|
||||||
|
<template>
|
||||||
|
<div class="app-container">
|
||||||
|
<el-card>
|
||||||
|
<div>
|
||||||
|
<el-input
|
||||||
|
v-model="listQuery.search"
|
||||||
|
placeholder="设备名称/设备型号"
|
||||||
|
style="width: 300px"
|
||||||
|
class="filter-item"
|
||||||
|
@keyup.enter.native="handleFilter"
|
||||||
|
/>
|
||||||
|
<el-button
|
||||||
|
class="filter-item"
|
||||||
|
type="primary"
|
||||||
|
icon="el-icon-search"
|
||||||
|
@click="handleFilter"
|
||||||
|
>搜索</el-button
|
||||||
|
>
|
||||||
|
<el-button
|
||||||
|
class="filter-item"
|
||||||
|
type="primary"
|
||||||
|
icon="el-icon-refresh-left"
|
||||||
|
@click="resetFilter"
|
||||||
|
>重置</el-button
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
<div style="margin-top: 10px">
|
||||||
|
<el-button type="primary" icon="el-icon-plus" @click="handleCreate"
|
||||||
|
>新增设备</el-button
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
</el-card>
|
||||||
|
<el-card style="margin-top: 10px">
|
||||||
|
<el-table
|
||||||
|
v-loading="listLoading"
|
||||||
|
:data="equipmentList.results"
|
||||||
|
border
|
||||||
|
fit
|
||||||
|
stripe
|
||||||
|
highlight-current-row
|
||||||
|
max-height="600"
|
||||||
|
>
|
||||||
|
<el-table-column type="index" width="50" />
|
||||||
|
<el-table-column label="设备名称">
|
||||||
|
<template slot-scope="scope">{{ scope.row.name }}</template>
|
||||||
|
</el-table-column>
|
||||||
|
|
||||||
|
<el-table-column label="设备型号">
|
||||||
|
<template slot-scope="scope">{{ scope.row.model }}</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="购置日期">
|
||||||
|
<template slot-scope="scope">{{ scope.row.buy_date }}</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="保管人">
|
||||||
|
<template slot-scope="scope">{{ scope.row.keeper_.username }}</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="存放位置">
|
||||||
|
<template slot-scope="scope">{{ scope.row.place }}</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="任务备注">
|
||||||
|
<template slot-scope="scope">{{ scope.row.description }}</template>
|
||||||
|
</el-table-column>
|
||||||
|
|
||||||
|
<el-table-column
|
||||||
|
align="center"
|
||||||
|
label="操作"
|
||||||
|
width="220px"
|
||||||
|
>
|
||||||
|
<template slot-scope="scope">
|
||||||
|
|
||||||
|
<el-link
|
||||||
|
v-if="checkPermission(['equipment_update'])"
|
||||||
|
@click="handleEdit(scope)"
|
||||||
|
>编辑</el-link
|
||||||
|
>
|
||||||
|
<el-link
|
||||||
|
v-if="checkPermission(['equipment_delete'])"
|
||||||
|
type="danger"
|
||||||
|
@click="handleDelete(scope)"
|
||||||
|
>删除</el-link
|
||||||
|
>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
<pagination
|
||||||
|
v-show="equipmentList.count > 0"
|
||||||
|
:total="equipmentList.count"
|
||||||
|
:page.sync="listQuery.page"
|
||||||
|
:limit.sync="listQuery.page_size"
|
||||||
|
@pagination="getList"
|
||||||
|
/>
|
||||||
|
</el-card>
|
||||||
|
<el-dialog
|
||||||
|
:visible.sync="dialogVisible"
|
||||||
|
:title="dialogType === 'edit' ? '编辑设备' : '新增设备'"
|
||||||
|
>
|
||||||
|
<el-form
|
||||||
|
ref="Form"
|
||||||
|
:model="equipment"
|
||||||
|
label-width="80px"
|
||||||
|
label-position="right"
|
||||||
|
:rules="rule1"
|
||||||
|
>
|
||||||
|
<el-form-item label="设备名称" prop="name">
|
||||||
|
<el-input v-model="equipment.name" placeholder="设备名称" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="设备编号" prop="number">
|
||||||
|
<el-input v-model="equipment.number" placeholder="设备编号" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="规格型号" prop="model">
|
||||||
|
<el-input v-model="equipment.model" placeholder="规格型号" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="设备状态" prop="state">
|
||||||
|
|
||||||
|
<el-select style="width: 100%" v-model="equipment.state" placeholder="请选择">
|
||||||
|
<el-option
|
||||||
|
v-for="item in options"
|
||||||
|
:key="item.value"
|
||||||
|
:label="item.label"
|
||||||
|
:value="item.value">
|
||||||
|
</el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item label="生产厂商" prop="factory">
|
||||||
|
<el-input v-model="equipment.factory" placeholder="生产厂商" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="生产日期" prop="production_date">
|
||||||
|
<el-date-picker
|
||||||
|
v-model="equipment.production_date"
|
||||||
|
type="date"
|
||||||
|
placeholder="选择日期"
|
||||||
|
value-format="yyyy-MM-dd"
|
||||||
|
style="width:100%"
|
||||||
|
>
|
||||||
|
</el-date-picker>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="购置日期" prop="buy_date">
|
||||||
|
<el-date-picker
|
||||||
|
v-model="equipment.buy_date"
|
||||||
|
type="date"
|
||||||
|
placeholder="选择日期"
|
||||||
|
value-format="yyyy-MM-dd"
|
||||||
|
style="width:100%"
|
||||||
|
>
|
||||||
|
</el-date-picker>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item label="技术参数" prop="parameter">
|
||||||
|
<el-input v-model="equipment.parameter" placeholder="技术参数" />
|
||||||
|
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="存放位置" prop="place">
|
||||||
|
<el-input v-model="equipment.place" placeholder="存放位置" />
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item label="保管人" prop="keeper">
|
||||||
|
|
||||||
|
<el-select
|
||||||
|
v-model="equipment.keeper"
|
||||||
|
filterable
|
||||||
|
style="width: 100%"
|
||||||
|
allow-create
|
||||||
|
default-first-option
|
||||||
|
placeholder="请选择">
|
||||||
|
<el-option
|
||||||
|
v-for="item in keeperOptions"
|
||||||
|
:key="item.value"
|
||||||
|
:label="item.label"
|
||||||
|
:value="item.value">
|
||||||
|
</el-option>
|
||||||
|
</el-select>
|
||||||
|
|
||||||
|
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="设备备注" prop="description">
|
||||||
|
<el-input
|
||||||
|
type="textarea"
|
||||||
|
:rows="4"
|
||||||
|
v-model="equipment.description"
|
||||||
|
placeholder="设备备注"
|
||||||
|
/>
|
||||||
|
</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('Form')">确认</el-button>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
import { getpEquipmentList, createEquipment,updateEquipment,deleteEquipment } from "@/api/equipment";
|
||||||
|
import { getUserList } from "@/api/user";
|
||||||
|
import checkPermission from "@/utils/permission";
|
||||||
|
|
||||||
|
import { genTree } from "@/utils";
|
||||||
|
import Pagination from "@/components/Pagination"; // secondary package based on el-pagination
|
||||||
|
const defaultequipment = {
|
||||||
|
name: "",
|
||||||
|
number: "",
|
||||||
|
};
|
||||||
|
export default {
|
||||||
|
components: { Pagination },
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
equipment: defaultequipment,
|
||||||
|
equipmentList: {
|
||||||
|
count: 0,
|
||||||
|
},
|
||||||
|
options: [{
|
||||||
|
value: '0',
|
||||||
|
label: '运转正常'
|
||||||
|
}, {
|
||||||
|
value: '1',
|
||||||
|
label: '停用'
|
||||||
|
}, {
|
||||||
|
value: '2',
|
||||||
|
label: '报废'
|
||||||
|
}],
|
||||||
|
listQuery: {
|
||||||
|
page: 1,
|
||||||
|
page_size: 20,
|
||||||
|
},
|
||||||
|
keeperOptions:[],
|
||||||
|
listLoading: true,
|
||||||
|
dialogVisible: false,
|
||||||
|
dialogType: "new",
|
||||||
|
rule1: {
|
||||||
|
name: [{ required: true, message: "请输入", trigger: "blur" }],
|
||||||
|
number: [{ required: true, message: "请输入", trigger: "blur" }],
|
||||||
|
model: [{ required: true, message: "请输入", trigger: "blur" }],
|
||||||
|
state: [{ required: true, message: "请选择", trigger: "blur" }],
|
||||||
|
},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
computed: {},
|
||||||
|
watch: {},
|
||||||
|
created() {
|
||||||
|
this.getList();
|
||||||
|
this.getUserList();
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
checkPermission,
|
||||||
|
//设备列表
|
||||||
|
getList() {
|
||||||
|
this.listLoading = true;
|
||||||
|
getpEquipmentList(this.listQuery).then((response) => {
|
||||||
|
if (response.data) {
|
||||||
|
this.equipmentList = response.data;
|
||||||
|
}
|
||||||
|
this.listLoading = false;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
//组员列表
|
||||||
|
getUserList() {
|
||||||
|
getUserList({pageoff:true}).then((res) => {
|
||||||
|
this.keeperOptions = genTree(res.data.results);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
handleFilter() {
|
||||||
|
this.listQuery.page = 1;
|
||||||
|
this.getList();
|
||||||
|
},
|
||||||
|
resetFilter() {
|
||||||
|
this.listQuery = {
|
||||||
|
page: 1,
|
||||||
|
page_size: 20,
|
||||||
|
}
|
||||||
|
this.getList();
|
||||||
|
},
|
||||||
|
handleCreate() {
|
||||||
|
this.equipment = Object.assign({}, defaultequipment);
|
||||||
|
this.dialogType = "new";
|
||||||
|
this.dialogVisible = true;
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.$refs["Form"].clearValidate();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
handleEdit(scope) {
|
||||||
|
this.equipment = Object.assign({}, scope.row); // copy obj
|
||||||
|
this.dialogType = "edit";
|
||||||
|
this.dialogVisible = true;
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.$refs["Form"].clearValidate();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
handleDelete(scope) {
|
||||||
|
this.$confirm("确认删除?", "警告", {
|
||||||
|
confirmButtonText: "确认",
|
||||||
|
cancelButtonText: "取消",
|
||||||
|
type: "error",
|
||||||
|
})
|
||||||
|
.then(async () => {
|
||||||
|
await deleteEquipment(scope.row.id);
|
||||||
|
this.getList();
|
||||||
|
this.$message.success("成功");
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
console.error(err);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
async confirm(form) {
|
||||||
|
this.$refs[form].validate((valid) => {
|
||||||
|
if (valid) {
|
||||||
|
const isEdit = this.dialogType === "edit";
|
||||||
|
if (isEdit) {
|
||||||
|
updateEquipment(this.equipment.id, this.equipment).then((res) => {
|
||||||
|
if (res.code >= 200) {
|
||||||
|
this.getList();
|
||||||
|
this.dialogVisible = false;
|
||||||
|
this.$message.success("成功");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
createEquipment(this.equipment).then((res) => {
|
||||||
|
if (res.code >= 200) {
|
||||||
|
this.getList();
|
||||||
|
this.dialogVisible = false;
|
||||||
|
this.$message.success("成功");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
|
@ -0,0 +1,268 @@
|
||||||
|
<template>
|
||||||
|
<div class="app-container">
|
||||||
|
<el-card>
|
||||||
|
<div>
|
||||||
|
<el-input
|
||||||
|
v-model="listQuery.search"
|
||||||
|
placeholder="供应商名称"
|
||||||
|
style="width: 300px"
|
||||||
|
class="filter-item"
|
||||||
|
@keyup.enter.native="handleFilter"
|
||||||
|
/>
|
||||||
|
<el-button
|
||||||
|
class="filter-item"
|
||||||
|
type="primary"
|
||||||
|
icon="el-icon-search"
|
||||||
|
@click="handleFilter"
|
||||||
|
>搜索</el-button
|
||||||
|
>
|
||||||
|
<el-button
|
||||||
|
class="filter-item"
|
||||||
|
type="primary"
|
||||||
|
icon="el-icon-refresh-left"
|
||||||
|
@click="resetFilter"
|
||||||
|
>重置</el-button
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
<div style="margin-top: 10px">
|
||||||
|
<el-button type="primary" icon="el-icon-plus" @click="handleCreate"
|
||||||
|
>新增供应商</el-button
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
</el-card>
|
||||||
|
<el-card style="margin-top: 10px">
|
||||||
|
<el-table
|
||||||
|
v-loading="listLoading"
|
||||||
|
:data="vendorList.results"
|
||||||
|
border
|
||||||
|
fit
|
||||||
|
stripe
|
||||||
|
highlight-current-row
|
||||||
|
max-height="600"
|
||||||
|
>
|
||||||
|
<el-table-column type="index" width="50" />
|
||||||
|
<el-table-column label="供应商名">
|
||||||
|
<template slot-scope="scope">{{ scope.row.name }}</template>
|
||||||
|
</el-table-column>
|
||||||
|
|
||||||
|
<el-table-column label="联系人">
|
||||||
|
<template slot-scope="scope">{{ scope.row.contact }}</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="联系电话">
|
||||||
|
<template slot-scope="scope">{{ scope.row.contact_phone }}</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="地址">
|
||||||
|
<template slot-scope="scope">{{ scope.row.address }}</template>
|
||||||
|
</el-table-column>
|
||||||
|
|
||||||
|
<el-table-column label="备注">
|
||||||
|
<template slot-scope="scope">{{ scope.row.description }}</template>
|
||||||
|
</el-table-column>
|
||||||
|
|
||||||
|
<el-table-column
|
||||||
|
align="center"
|
||||||
|
label="操作"
|
||||||
|
width="220px"
|
||||||
|
>
|
||||||
|
<template slot-scope="scope">
|
||||||
|
|
||||||
|
<el-link
|
||||||
|
v-if="checkPermission(['vendor_update'])"
|
||||||
|
@click="handleEdit(scope)"
|
||||||
|
>编辑</el-link
|
||||||
|
>
|
||||||
|
<el-link
|
||||||
|
v-if="checkPermission(['vendor_delete'])"
|
||||||
|
type="danger"
|
||||||
|
@click="handleDelete(scope)"
|
||||||
|
>删除</el-link
|
||||||
|
>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
<pagination
|
||||||
|
v-show="vendorList.count > 0"
|
||||||
|
:total="vendorList.count"
|
||||||
|
:page.sync="listQuery.page"
|
||||||
|
:limit.sync="listQuery.page_size"
|
||||||
|
@pagination="getList"
|
||||||
|
/>
|
||||||
|
</el-card>
|
||||||
|
<el-dialog
|
||||||
|
:visible.sync="dialogVisible"
|
||||||
|
:title="dialogType === 'edit' ? '编辑设备' : '新增设备'"
|
||||||
|
>
|
||||||
|
<el-form
|
||||||
|
ref="Form"
|
||||||
|
:model="vendor"
|
||||||
|
label-width="80px"
|
||||||
|
label-position="right"
|
||||||
|
:rules="rule1"
|
||||||
|
>
|
||||||
|
<el-form-item label="供应商名称" prop="name">
|
||||||
|
<el-input v-model="vendor.name" placeholder="供应商名称" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="联系人" prop="contact">
|
||||||
|
<el-input v-model="vendor.contact" placeholder="联系人" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="联系电话" prop="contact_phone">
|
||||||
|
<el-input v-model="vendor.contact_phone" placeholder="联系电话" />
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item label="地址" prop="address">
|
||||||
|
<el-input v-model="vendor.address" placeholder="地址" />
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
|
||||||
|
<el-form-item label="备注" prop="description">
|
||||||
|
<el-input
|
||||||
|
type="textarea"
|
||||||
|
:rows="4"
|
||||||
|
v-model="vendor.description"
|
||||||
|
placeholder="备注"
|
||||||
|
/>
|
||||||
|
</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('Form')">确认</el-button>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
import { getpVendorList, createVendor,updateVendor,deleteVendor } from "@/api/vendor";
|
||||||
|
import { getUserList } from "@/api/user";
|
||||||
|
import checkPermission from "@/utils/permission";
|
||||||
|
|
||||||
|
import { genTree } from "@/utils";
|
||||||
|
import Pagination from "@/components/Pagination"; // secondary package based on el-pagination
|
||||||
|
const defaultvendor = {
|
||||||
|
name: "",
|
||||||
|
number: "",
|
||||||
|
};
|
||||||
|
export default {
|
||||||
|
components: { Pagination },
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
vendor: defaultvendor,
|
||||||
|
vendorList: {
|
||||||
|
count: 0,
|
||||||
|
},
|
||||||
|
options: [{
|
||||||
|
value: '0',
|
||||||
|
label: '运转正常'
|
||||||
|
}, {
|
||||||
|
value: '1',
|
||||||
|
label: '停用'
|
||||||
|
}, {
|
||||||
|
value: '2',
|
||||||
|
label: '报废'
|
||||||
|
}],
|
||||||
|
listQuery: {
|
||||||
|
page: 1,
|
||||||
|
page_size: 20,
|
||||||
|
},
|
||||||
|
keeperOptions:[],
|
||||||
|
listLoading: true,
|
||||||
|
dialogVisible: false,
|
||||||
|
dialogType: "new",
|
||||||
|
rule1: {
|
||||||
|
name: [{ required: true, message: "请输入", trigger: "blur" }],
|
||||||
|
number: [{ required: true, message: "请输入", trigger: "blur" }],
|
||||||
|
model: [{ required: true, message: "请输入", trigger: "blur" }],
|
||||||
|
state: [{ required: true, message: "请选择", trigger: "blur" }],
|
||||||
|
},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
computed: {},
|
||||||
|
watch: {},
|
||||||
|
created() {
|
||||||
|
this.getList();
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
checkPermission,
|
||||||
|
//供应商列表
|
||||||
|
getList() {
|
||||||
|
this.listLoading = true;
|
||||||
|
getpVendorList(this.listQuery).then((response) => {
|
||||||
|
if (response.data) {
|
||||||
|
this.vendorList = response.data;
|
||||||
|
}
|
||||||
|
this.listLoading = false;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
handleFilter() {
|
||||||
|
this.listQuery.page = 1;
|
||||||
|
this.getList();
|
||||||
|
},
|
||||||
|
resetFilter() {
|
||||||
|
this.listQuery = {
|
||||||
|
page: 1,
|
||||||
|
page_size: 20,
|
||||||
|
}
|
||||||
|
this.getList();
|
||||||
|
},
|
||||||
|
handleCreate() {
|
||||||
|
this.vendor = Object.assign({}, defaultvendor);
|
||||||
|
this.dialogType = "new";
|
||||||
|
this.dialogVisible = true;
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.$refs["Form"].clearValidate();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
handleEdit(scope) {
|
||||||
|
this.vendor = Object.assign({}, scope.row); // copy obj
|
||||||
|
this.dialogType = "edit";
|
||||||
|
this.dialogVisible = true;
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.$refs["Form"].clearValidate();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
handleDelete(scope) {
|
||||||
|
this.$confirm("确认删除?", "警告", {
|
||||||
|
confirmButtonText: "确认",
|
||||||
|
cancelButtonText: "取消",
|
||||||
|
type: "error",
|
||||||
|
})
|
||||||
|
.then(async () => {
|
||||||
|
await deleteVendor(scope.row.id);
|
||||||
|
this.getList();
|
||||||
|
this.$message.success("成功");
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
console.error(err);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
async confirm(form) {
|
||||||
|
this.$refs[form].validate((valid) => {
|
||||||
|
if (valid) {
|
||||||
|
const isEdit = this.dialogType === "edit";
|
||||||
|
if (isEdit) {
|
||||||
|
updateVendor(this.vendor.id, this.vendor).then((res) => {
|
||||||
|
if (res.code >= 200) {
|
||||||
|
this.getList();
|
||||||
|
this.dialogVisible = false;
|
||||||
|
this.$message.success("成功");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
createVendor(this.vendor).then((res) => {
|
||||||
|
if (res.code >= 200) {
|
||||||
|
this.getList();
|
||||||
|
this.dialogVisible = false;
|
||||||
|
this.$message.success("成功");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
|
@ -20,7 +20,7 @@ class Equipment(CommonBModel):
|
||||||
)
|
)
|
||||||
name = models.CharField('设备名称', max_length=50)
|
name = models.CharField('设备名称', max_length=50)
|
||||||
number = models.CharField('设备编号', max_length=50, unique=True)
|
number = models.CharField('设备编号', max_length=50, unique=True)
|
||||||
model = models.CharField('规格型号', max_length=10, null=True, blank=True)
|
model = models.CharField('规格型号', max_length=60, null=True, blank=True)
|
||||||
factory = models.CharField('生产厂', max_length=50, null=True, blank=True)
|
factory = models.CharField('生产厂', max_length=50, null=True, blank=True)
|
||||||
production_date = models.DateField('生产日期', null=True, blank=True)
|
production_date = models.DateField('生产日期', null=True, blank=True)
|
||||||
buy_date = models.DateField('购置日期', null=True, blank=True)
|
buy_date = models.DateField('购置日期', null=True, blank=True)
|
||||||
|
|
Loading…
Reference in New Issue