update code
parent
afc6f5afcc
commit
fcf673fdae
|
@ -62,6 +62,7 @@
|
||||||
<el-table-column label="资产名称" align="left" prop="name">
|
<el-table-column label="资产名称" align="left" prop="name">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-tag v-if="!scope.row.deptId" effect="dark" type="danger">系统</el-tag>
|
<el-tag v-if="!scope.row.deptId" effect="dark" type="danger">系统</el-tag>
|
||||||
|
{{ scope.row.name }}
|
||||||
<span style="margin-left:10px;"><span v-if="scope.row.parentId">{{scope.row.parentName +' > '}}</span>{{scope.row.name }}<span>
|
<span style="margin-left:10px;"><span v-if="scope.row.parentId">{{scope.row.parentName +' > '}}</span>{{scope.row.name }}<span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
@ -74,6 +75,7 @@
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="160">
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="160">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
|
<template v-if="scope.row.deptId">
|
||||||
<template v-if="scope.row.deptId || !nonAdmin">
|
<template v-if="scope.row.deptId || !nonAdmin">
|
||||||
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
|
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
|
||||||
v-hasPermi="['base:assetsType:edit']">修改</el-button>
|
v-hasPermi="['base:assetsType:edit']">修改</el-button>
|
||||||
|
@ -91,21 +93,28 @@
|
||||||
@pagination="getList" />
|
@pagination="getList" />
|
||||||
|
|
||||||
<!-- 添加或修改物资类型对话框 -->
|
<!-- 添加或修改物资类型对话框 -->
|
||||||
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body custom-class="assets-type-dialog"
|
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body custom-class="assets-type-dialog" :close-on-click-modal="false"
|
||||||
:close-on-click-modal="false" :close-on-press-escape="false">
|
:close-on-press-escape="false">
|
||||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||||
|
<el-form-item label="公司名称">
|
||||||
<el-form-item label="公司名称" v-if="nonAdmin">
|
<el-form-item label="公司名称" v-if="nonAdmin">
|
||||||
<el-input v-model="form.compName" disabled />
|
<el-input v-model="form.compName" disabled />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
<el-form-item label="项目名称">
|
||||||
<el-form-item label="项目名称" v-if="nonAdmin">
|
<el-form-item label="项目名称" v-if="nonAdmin">
|
||||||
<el-input v-model="form.deptName" disabled />
|
<el-input v-model="form.deptName" disabled />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
<el-form-item label="一级分类" prop="type">
|
||||||
|
<el-select v-model="form.type" placeholder="请选择资产类型" @change="doLvl1Change">
|
||||||
<el-form-item label="资产类型" prop="type">
|
<el-form-item label="资产类型" prop="type">
|
||||||
<el-select v-model="form.type" placeholder="请选择资产类型" @change="doLvl1Change" style="width:100%">
|
<el-select v-model="form.type" placeholder="请选择资产类型" @change="doLvl1Change" style="width:100%">
|
||||||
<el-option v-for="dict in dict.type.sys_process_category" :key="dict.value" :label="dict.label"
|
<el-option v-for="dict in dict.type.sys_process_category" :key="dict.value" :label="dict.label"
|
||||||
:value="dict.value"></el-option>
|
:value="dict.value"></el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
<el-form-item label="二级分类" prop="parentId">
|
||||||
|
<el-select v-model="form.parentId" placeholder="请选择资产类型">
|
||||||
|
<el-option v-for="it in lvl2Opts" :key="it.id" :label="it.name" :value="it.id"></el-option>
|
||||||
<el-form-item label="父级分类" prop="parentId">
|
<el-form-item label="父级分类" prop="parentId">
|
||||||
<el-select v-model="form.parentId" placeholder="请选择父级分类" style="width:100%">
|
<el-select v-model="form.parentId" placeholder="请选择父级分类" style="width:100%">
|
||||||
<el-option v-for="item in parentTypeOptions" :key="item.id" :label="item.name" :value="item.id"></el-option>
|
<el-option v-for="item in parentTypeOptions" :key="item.id" :label="item.name" :value="item.id"></el-option>
|
||||||
|
@ -114,18 +123,14 @@
|
||||||
<el-form-item label="资产名称" prop="name">
|
<el-form-item label="资产名称" prop="name">
|
||||||
<el-input v-model="form.name" placeholder="请输入资产名称" />
|
<el-input v-model="form.name" placeholder="请输入资产名称" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
<el-form-item label="资产单位" prop="sunit">
|
||||||
<el-form-item label="资产单位" prop="sunit" v-if="form.parentId">
|
<el-form-item label="资产单位" prop="sunit" v-if="form.parentId">
|
||||||
<el-input v-model="form.sunit" placeholder="请输入资产单位" />
|
<el-input v-model="form.sunit" placeholder="请输入资产单位" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<<<<<<< HEAD
|
<div class="div-unit">
|
||||||
<div class="div-unit" v-if="form.parentId">
|
<div class="div-unit" v-if="form.parentId">
|
||||||
<el-tag v-for="(it, idx) in units" :class="{ 'is-selected': it.sel, 'is-del': it.del }" @close="doCloseTag(it, idx)"
|
<el-tag v-for="(it, idx) in units" :class="{ 'is-selected': it.sel, 'is-del': it.del }" @close="doCloseTag(it, idx)"
|
||||||
:closable="!it.sys" @click="doSelTag(it)" :key="idx">
|
:closable="!it.sys" @click="doSelTag(it)" :key="idx">
|
||||||
=======
|
|
||||||
<div class="div-unit">
|
|
||||||
<el-tag v-for="(it, idx) in units" :class="{ 'is-selected': it.sel, 'is-del': it.del }"
|
|
||||||
@close="doCloseTag(it, idx)" :closable="!it.sys" @click="doSelTag(it)" :key="idx">
|
|
||||||
>>>>>>> c55cd0599b359c435db26a66f3232d599b2d2048
|
|
||||||
<i class="el-icon-check"></i>
|
<i class="el-icon-check"></i>
|
||||||
{{ it.text }}
|
{{ it.text }}
|
||||||
</el-tag>
|
</el-tag>
|
||||||
|
@ -140,6 +145,7 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import { listAssetsType, getAssetsType, delAssetsType, addAssetsType, updateAssetsType, listLevel2 } from "@/api/base/assetsType";
|
||||||
import { listAssetsType, getAssetsType, delAssetsType, addAssetsType, updateAssetsType, listLevel2, findParentTypesByCategory } from "@/api/base/assetsType";
|
import { listAssetsType, getAssetsType, delAssetsType, addAssetsType, updateAssetsType, listLevel2, findParentTypesByCategory } from "@/api/base/assetsType";
|
||||||
import { listDept } from '@/api/system/dept'
|
import { listDept } from '@/api/system/dept'
|
||||||
export default {
|
export default {
|
||||||
|
@ -173,6 +179,7 @@ export default {
|
||||||
open: false,
|
open: false,
|
||||||
// 查询参数
|
// 查询参数
|
||||||
queryParams: {
|
queryParams: {
|
||||||
|
parentId: -1,
|
||||||
pageNum: 1,
|
pageNum: 1,
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
compyId: null,
|
compyId: null,
|
||||||
|
@ -188,6 +195,8 @@ export default {
|
||||||
rules: {
|
rules: {
|
||||||
type: [{ required: true, message: "资产类型不能为空", trigger: "change" }],
|
type: [{ required: true, message: "资产类型不能为空", trigger: "change" }],
|
||||||
name: [{ required: true, message: "资产名称不能为空", trigger: "blur" }]
|
name: [{ required: true, message: "资产名称不能为空", trigger: "blur" }]
|
||||||
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
parentTypeOptions:[],
|
parentTypeOptions:[],
|
||||||
nonAdmin:true,
|
nonAdmin:true,
|
||||||
|
@ -215,6 +224,7 @@ export default {
|
||||||
listLevel2().then(d => {
|
listLevel2().then(d => {
|
||||||
this.lvlDatas = d.data;
|
this.lvlDatas = d.data;
|
||||||
})
|
})
|
||||||
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
doCloseTag(tag) {
|
doCloseTag(tag) {
|
||||||
|
@ -231,6 +241,11 @@ export default {
|
||||||
}
|
}
|
||||||
tag.sel = !tag.sel;
|
tag.sel = !tag.sel;
|
||||||
},
|
},
|
||||||
|
doLvl1Change(a) {
|
||||||
|
this.lvl2Opts = this.lvlDatas.filter(d => d.type == a);
|
||||||
|
if (this.lvl2Opts.length > 0) {
|
||||||
|
this.form.parentId = this.lvl2Opts[0].id;
|
||||||
|
}
|
||||||
doLvl1Change(value) {
|
doLvl1Change(value) {
|
||||||
// this.lvl2Opts = this.lvlDatas.filter(d => d.type == a);
|
// this.lvl2Opts = this.lvlDatas.filter(d => d.type == a);
|
||||||
// if (this.lvl2Opts.length > 0) {
|
// if (this.lvl2Opts.length > 0) {
|
||||||
|
@ -294,6 +309,7 @@ export default {
|
||||||
this.form = {
|
this.form = {
|
||||||
id: null,
|
id: null,
|
||||||
parentId: null,
|
parentId: null,
|
||||||
|
deptId: this.queryParams.defaultDeptId,
|
||||||
deptId: this.nonAdmin?this.queryParams.defaultDeptId:null,
|
deptId: this.nonAdmin?this.queryParams.defaultDeptId:null,
|
||||||
type: null,
|
type: null,
|
||||||
name: null,
|
name: null,
|
||||||
|
@ -311,6 +327,14 @@ export default {
|
||||||
tmps = this.prjOpts.filter(d => d.deptId == this.form.deptId);
|
tmps = this.prjOpts.filter(d => d.deptId == this.form.deptId);
|
||||||
this.form.deptName = tmps.length > 0 ? tmps[0].deptName : "";
|
this.form.deptName = tmps.length > 0 ? tmps[0].deptName : "";
|
||||||
tmps = this.dict.type.sys_process_category
|
tmps = this.dict.type.sys_process_category
|
||||||
|
if (tmps.length > 0) {
|
||||||
|
this.form.type = tmps[0].value;
|
||||||
|
this.lvl2Opts = this.lvlDatas.filter(d => d.type == this.form.type);
|
||||||
|
if (this.lvl2Opts.length > 0) {
|
||||||
|
this.form.parentId = this.lvl2Opts[0].id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// if (tmps.length > 0) {
|
// if (tmps.length > 0) {
|
||||||
// this.form.type = tmps[0].value;
|
// this.form.type = tmps[0].value;
|
||||||
// this.lvl2Opts = this.lvlDatas.filter(d => d.type == this.form.type);
|
// this.lvl2Opts = this.lvlDatas.filter(d => d.type == this.form.type);
|
||||||
|
@ -348,7 +372,20 @@ export default {
|
||||||
handleUpdate(row) {
|
handleUpdate(row) {
|
||||||
this.reset();
|
this.reset();
|
||||||
const id = row.id || this.ids
|
const id = row.id || this.ids
|
||||||
<<<<<<< HEAD
|
let tmps=row.unit.split(",").filter(d=>d);
|
||||||
|
let uns=this.units.map(d=>d.text).join(",")
|
||||||
|
tmps.forEach(it=>{
|
||||||
|
if((","+uns+",").indexOf(","+it+",")==-1){
|
||||||
|
this.units.push({
|
||||||
|
text:it,
|
||||||
|
del:false,
|
||||||
|
sys:false
|
||||||
|
})
|
||||||
|
}
|
||||||
|
});
|
||||||
|
this.units.forEach(it=>{
|
||||||
|
it.sel=(","+row.unit+",").indexOf(","+it.text+",")>=0;
|
||||||
|
});
|
||||||
if(row.unit){
|
if(row.unit){
|
||||||
let tmps=row.unit.split(",").filter(d=>d);
|
let tmps=row.unit.split(",").filter(d=>d);
|
||||||
let uns=this.units.map(d=>d.text).join(",")
|
let uns=this.units.map(d=>d.text).join(",")
|
||||||
|
@ -365,24 +402,8 @@ export default {
|
||||||
it.sel=(","+row.unit+",").indexOf(","+it.text+",")>=0;
|
it.sel=(","+row.unit+",").indexOf(","+it.text+",")>=0;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
=======
|
|
||||||
let tmps = row.unit.split(",").filter(d => d);
|
|
||||||
let uns = this.units.map(d => d.text).join(",")
|
|
||||||
tmps.forEach(it => {
|
|
||||||
if (("," + uns + ",").indexOf("," + it + ",") == -1) {
|
|
||||||
this.units.push({
|
|
||||||
text: it,
|
|
||||||
del: false,
|
|
||||||
sys: false
|
|
||||||
})
|
|
||||||
}
|
|
||||||
});
|
|
||||||
this.units.forEach(it => {
|
|
||||||
it.sel = ("," + row.unit + ",").indexOf("," + it.text + ",") >= 0;
|
|
||||||
});
|
|
||||||
>>>>>>> c55cd0599b359c435db26a66f3232d599b2d2048
|
|
||||||
getAssetsType(id).then(response => {
|
getAssetsType(id).then(response => {
|
||||||
this.form = { ...response.data, sunit: '' };
|
this.form = {...response.data,sunit:''};
|
||||||
this.open = true;
|
this.open = true;
|
||||||
this.title = "修改物资类型";
|
this.title = "修改物资类型";
|
||||||
});
|
});
|
||||||
|
@ -506,5 +527,4 @@ export default {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}</style>
|
||||||
</style>
|
|
Loading…
Reference in New Issue