Commit 985533a1 by zhaopanyu

zpy 8.16

parent 87ed926a
...@@ -81,9 +81,13 @@ ...@@ -81,9 +81,13 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="16"> <el-col :span="16">
<el-form-item label="管理员" prop="admin"> <el-form-item label="管理员" prop="adminId">
<el-input v-model="selectedAdmin.admin" placeholder="请选择管理员" @focus="selectChange" <el-select v-model="postForm.adminId" filterable placeholder="请选择管理员" clearable
style="width: 100%"></el-input> style="width: 100%;">
<el-option v-for="(item, index) in adminUser" :key="index" :label="item.admin"
:value="item.adminId">
</el-option>
</el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
...@@ -93,31 +97,6 @@ ...@@ -93,31 +97,6 @@
<el-button @click="cancel"> 取 消 </el-button> <el-button @click="cancel"> 取 消 </el-button>
</div> </div>
</el-dialog> </el-dialog>
<!-- 选择管理员弹出框 -->
<el-dialog :title="title" :visible.sync="workableVehicle" width="500px" append-to-body>
<el-form :model="queryVehicleForm" inline @submit.native.prevent>
<el-form-item label="管理员" prop="admin">
<el-input v-model="queryVehicleForm.adminId" placeholder="请输入管理员"></el-input>
</el-form-item>
<el-form-item>
<el-button type="primary" size="small" icon="el-icon-search" @click="handleQueryVehicle">搜索
</el-button>
<el-button plain size="small" icon="el-icon-refresh" @click="resetQueryVehicle">重置
</el-button>
</el-form-item>
</el-form>
<el-table :data="vehicleList" max-height="350" ref="vehicleSelectTable" @row-click="rowClick"
@selection-change="selectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="管理员" align="center" prop="admin">
</el-table-column>
</el-table>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="abolish" :disabled="!multi">确 定</el-button>
<el-button @click="abolish">取 消</el-button>
</div>
</el-dialog>
</div> </div>
...@@ -142,19 +121,6 @@ export default { ...@@ -142,19 +121,6 @@ export default {
dicts: ["vehicle_type", "vehicle_state"], dicts: ["vehicle_type", "vehicle_state"],
data() { data() {
return { return {
// 管理员列表总数
NaN: 0,
// 可选管理员列表
vehicleList: [],
// 管理员列表
queryVehicleForm: {
admin: '',
adminId: '',
},
//父设备分类下拉框
deptOptions: [],
// 是否显示选择管理员弹出层
workableVehicle: false,
// 是否禁用输入框 // 是否禁用输入框
isDisabled: false, isDisabled: false,
queryForm: { queryForm: {
...@@ -175,6 +141,7 @@ export default { ...@@ -175,6 +141,7 @@ export default {
parentId: undefined, parentId: undefined,
equipmentType: '', equipmentType: '',
model: '', model: '',
admin: '',
adminId: '', adminId: '',
orderNum: '', orderNum: '',
}, },
...@@ -194,12 +161,11 @@ export default { ...@@ -194,12 +161,11 @@ export default {
classificationCode: [{ required: true, message: '分类编码不能为空', trigger: 'blur' }], classificationCode: [{ required: true, message: '分类编码不能为空', trigger: 'blur' }],
equipmentType: [{ required: true, message: '设备分类不能为空', trigger: 'blur' }], equipmentType: [{ required: true, message: '设备分类不能为空', trigger: 'blur' }],
orderNum: [{ required: true, message: '显示排序不能为空', trigger: 'blur' }], orderNum: [{ required: true, message: '显示排序不能为空', trigger: 'blur' }],
adminId: [{ required: true, message: '管理员不能为空', trigger: 'blur' }],
}, },
//管理员 //管理员
selectedAdmin: { adminUser: [],
admin: '',
adminId: '',
}
} }
}, },
...@@ -207,6 +173,8 @@ export default { ...@@ -207,6 +173,8 @@ export default {
created() { created() {
this.getList(); this.getList();
this.enuqLeader(); this.enuqLeader();
this.getAdminUserList();
}, },
methods: { methods: {
...@@ -219,61 +187,6 @@ export default { ...@@ -219,61 +187,6 @@ export default {
this.loading = false; this.loading = false;
}) })
}, },
// 选择管理员对话框选中数据
selectionChange(selection) {
this.selectedAdmin = selection[0];
console.log('this.selectedAdmin', this.selectedAdmin);
this.multi = selection.length === 1;
},
// 可选管理员取消按钮
abolish() {
this.workableVehicle = false;
this.$nextTick(() => {
this.$refs.postForm.validateField('admin');
})
},
// 列表查询管理员列表
getVehicleList() {
this.vehicleLoading = true;
console.log('this.queryVehicleForm', this.queryVehicleForm)
getAdmin(this.queryVehicleForm).then(response => {
this.vehicleLoading = false;
this.vehicleList = response.data;
console.log('this.vehicleList', this.vehicleList);
this.NaN = response.NaN;
}).catch(err => {
this.vehicleLoading = false;
})
},
rowClick(row) {
this.$refs.vehicleSelectTable.clearSelection();
this.$refs.vehicleSelectTable.toggleRowSelection(row, true);
},
// 查询管理员列表
handleQueryVehicle() {
this.throttle(() => {
this.getVehicleList();
})
},
// 重置管理员列表查询
resetQueryVehicle() {
this.queryVehicleForm = {
pageNum: 1,
pageSize: 8,
admin: ''
};
this.handleQueryVehicle();
},
// 弹出选择管理员对话框
selectChange() {
this.workableVehicle = true;
this.handleQueryVehicle();
},
// 展开/折叠 // 展开/折叠
...@@ -284,14 +197,19 @@ export default { ...@@ -284,14 +197,19 @@ export default {
this.refreshTable = true; this.refreshTable = true;
}); });
}, },
//获取管理员人列表
getAdminUserList() {
getAdmin().then(res => {
if (res.code == 200) {
this.adminUser = res.data
console.log(this.adminUser);
}
})
},
// 新增 // 新增
handleAdd(row) { handleAdd(row) {
this.reset(); this.reset();
this.selectedAdmin.admin = null;
this.queryVehicleForm.adminId = null;
this.open = true; this.open = true;
this.getList(); this.getList();
if (row != null && row.id) { if (row != null && row.id) {
...@@ -319,7 +237,7 @@ export default { ...@@ -319,7 +237,7 @@ export default {
getProductCategory().then(((res) => { getProductCategory().then(((res) => {
if (res.code == 200) { if (res.code == 200) {
this.sbflOptions = res.data; this.sbflOptions = res.data;
console.log('this.sbflOptions', this.sbflOptions); // console.log('this.sbflOptions', this.sbflOptions);
} }
})) }))
...@@ -329,7 +247,8 @@ export default { ...@@ -329,7 +247,8 @@ export default {
this.reset(); this.reset();
queryProduct(row.id).then(response => { queryProduct(row.id).then(response => {
this.postForm = response.data; this.postForm = response.data;
this.selectedAdmin.admin = response.data.admin; this.getAdminUserList();
console.log('this.postForm修改', this.postForm);
this.open = true; this.open = true;
this.title = "修改资产信息"; this.title = "修改资产信息";
}); });
...@@ -343,6 +262,7 @@ export default { ...@@ -343,6 +262,7 @@ export default {
return deleteProduct(row.id); return deleteProduct(row.id);
}).then(() => { }).then(() => {
this.getList(); this.getList();
this.enuqLeader();
this.loading = false; this.loading = false;
this.$modal.msgSuccess("删除成功"); this.$modal.msgSuccess("删除成功");
}).catch(() => { }).catch(() => {
...@@ -351,22 +271,31 @@ export default { ...@@ -351,22 +271,31 @@ export default {
}, },
// 确定 // 确定
submitForm() { submitForm() {
this.postForm.adminId = this.selectedAdmin.adminId; const adminId = this.postForm.adminId
console.log('this.postForm', this.postForm); this.postForm.admin = adminId == '' ? '' : this.adminUser.find(item => item.adminId == adminId).admin
this.$refs["postForm"].validate(valid => { this.$refs["postForm"].validate(valid => {
if (valid) { if (valid) {
if (this.postForm.id != null) { if (this.postForm.id != null) {
editProduct(this.postForm).then(response => { editProduct(this.postForm).then(response => {
console.log('this.postForm', this.postForm);
this.$modal.msgSuccess("修改成功"); this.$modal.msgSuccess("修改成功");
this.open = false; this.open = false;
this.getList(); this.getList();
this.enuqLeader();
}); });
} else { } else {
addProduct(this.postForm).then(response => { addProduct(this.postForm).then(response => {
console.log('this.postForm', this.postForm);
// if (this.postForm.parentId === 0) {
// console.log(1111, this.postForm.parentId);
// }
this.$modal.msgSuccess("新增成功"); this.$modal.msgSuccess("新增成功");
this.open = false; this.open = false;
this.getList(); this.getList();
this.enuqLeader();
}); });
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment