清运清单设备编码组件及接口调整

master
mhsnet 4 months ago
parent b559779158
commit f71acc3ded

@ -7,9 +7,12 @@ import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jnpf.base.ActionResult;
import jnpf.base.UserInfo;
import jnpf.base.model.datainterface.DataInterfacePage;
import jnpf.base.model.datainterface.DataInterfaceParamModel;
import jnpf.base.vo.PageListVO;
import jnpf.base.vo.PaginationVO;
import jnpf.entity.*;
import jnpf.model.datainterface.DIDeviceListInfoModel;
import jnpf.model.recycledevice.Command;
import jnpf.model.recycledevice.RecycleDeviceConstant;
import jnpf.model.recycledevice.RecycleDeviceForm;
@ -297,6 +300,18 @@ public class RecycleDeviceController {
List<RecycleDeviceEntity> list = recycleDeviceService.list(lambda);
return ActionResult.success(list);
}
//获取设备信息
@PostMapping("/getDeviceListInfo")
@Operation(summary = "获取设备清单信息")
public ActionResult getDeviceListInfo( @RequestBody(required = false) Map<String, Object> objectMap) {
DIDeviceListInfoModel model = JsonUtil.getJsonToBean(objectMap, DIDeviceListInfoModel.class);
List<String> ids = model.getIds();
QueryWrapper<RecycleDeviceEntity> wrapper = new QueryWrapper<>();
LambdaQueryWrapper<RecycleDeviceEntity> lambda = wrapper.lambda();
lambda.in(RecycleDeviceEntity::getDeviceCode, ids);
List<RecycleDeviceEntity> list = recycleDeviceService.list(lambda);
return ActionResult.success(list);
}
}

@ -0,0 +1,11 @@
package jnpf.model.datainterface;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
@Data
public class DIDeviceListInfoModel implements Serializable {
private List<String> ids;
}

@ -194,3 +194,21 @@ export function cmdBucket(cmd, deviceCode, bucketCode) {
break;
}
}
// 获取设备列表
export function getDeviceListOption() {
return request({
url: `/api/scm/RecycleDevice/getDeviceListOption`,
method: "POST"
});
}
// 获取设备信息
export function getDeviceListInfo(query) {
// let query = {
// ids: [this.value]
// };
return request({
url: `/api/scm/RecycleDevice/getDeviceListInfo`,
method: "POST",
data: query
});
}

@ -0,0 +1,526 @@
<template>
<div class="popupSelect-container">
<div class="el-select" @click="openDialog">
<el-input
:placeholder="placeholder"
v-model="innerValue"
readonly
:validate-event="false"
@mouseenter.native="inputHovering = true"
@mouseleave.native="inputHovering = false"
>
<template slot="suffix">
<i
v-show="!showClose"
:class="['el-select__caret', 'el-input__icon', 'el-icon-arrow-up']"
></i>
<i
v-if="showClose"
class="el-select__caret el-input__icon el-icon-circle-close"
@click="clear"
></i>
</template>
</el-input>
</div>
<template v-if="popupType === 'dialog'">
<el-dialog
:title="popupTitle"
:close-on-click-modal="false"
:visible.sync="visible"
v-if="visible"
class="JNPF-dialog JNPF-dialog_center"
lock-scroll
append-to-body
:width="popupWidth"
>
<el-row class="JNPF-common-search-box" :gutter="16">
<el-form @submit.native.prevent>
<el-col :span="10">
<el-form-item label="关键词">
<el-input
v-model="listQuery.keyword"
placeholder="请输入关键词查询"
clearable
@keyup.enter.native="search()"
class="search-input"
/>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item>
<el-button
type="primary"
icon="el-icon-search"
@click="search()"
>
{{ $t("common.search") }}
</el-button>
<el-button icon="el-icon-refresh-right" @click="reset()"
>{{ $t("common.reset") }}
</el-button>
</el-form-item>
</el-col>
</el-form>
<div class="JNPF-common-search-box-right">
<el-tooltip
effect="dark"
:content="$t('common.refresh')"
placement="top"
>
<el-link
icon="icon-ym icon-ym-Refresh JNPF-common-head-icon"
:underline="false"
@click="initData()"
/>
</el-tooltip>
</div>
</el-row>
<JNPF-table
v-loading="listLoading"
:data="list"
:border="false"
highlight-current-row
@row-click="rowClick"
:hasNO="false"
>
<el-table-column width="35">
<template slot-scope="scope">
<el-radio :label="scope.row[propsValue]" v-model="checked"
>&nbsp;</el-radio
>
</template>
</el-table-column>
<el-table-column
type="index"
width="50"
label="序号"
align="center"
/>
<el-table-column
:prop="item.value"
:label="item.label"
v-for="(item, i) in columnOptions"
:key="i"
/>
</JNPF-table>
<pagination
:total="total"
:page.sync="listQuery.currentPage"
:limit.sync="listQuery.pageSize"
@pagination="initData"
v-if="hasPage"
/>
<span slot="footer" class="dialog-footer">
<el-button @click="visible = false" size="small">{{
$t("common.cancelButton")
}}</el-button>
<el-button type="primary" @click="select()" size="small"
>{{ $t("common.confirmButton") }}
</el-button>
</span>
</el-dialog>
</template>
<template v-if="popupType === 'drawer'">
<el-drawer
:title="popupTitle"
:visible.sync="visible"
:wrapperClosable="false"
ref="drawer"
:size="popupWidth"
append-to-body
class="JNPF-common-drawer"
>
<div class="JNPF-flex-main">
<el-row class="JNPF-common-search-box" :gutter="16">
<el-form @submit.native.prevent>
<el-col :span="10">
<el-form-item label="关键词">
<el-input
v-model="listQuery.keyword"
placeholder="请输入关键词查询"
clearable
@keyup.enter.native="search()"
class="search-input"
/>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item>
<el-button
type="primary"
icon="el-icon-search"
@click="search()"
>
{{ $t("common.search") }}
</el-button>
<el-button icon="el-icon-refresh-right" @click="reset()"
>{{ $t("common.reset") }}
</el-button>
</el-form-item>
</el-col>
</el-form>
<div class="JNPF-common-search-box-right">
<el-tooltip
effect="dark"
:content="$t('common.refresh')"
placement="top"
>
<el-link
icon="icon-ym icon-ym-Refresh JNPF-common-head-icon"
:underline="false"
@click="initData()"
/>
</el-tooltip>
</div>
</el-row>
<JNPF-table
v-loading="listLoading"
:data="list"
:border="false"
highlight-current-row
@row-click="rowClick"
:hasNO="false"
>
<el-table-column width="35">
<template slot-scope="scope">
<el-radio :label="scope.row[propsValue]" v-model="checked"
>&nbsp;</el-radio
>
</template>
</el-table-column>
<el-table-column
type="index"
width="50"
label="序号"
align="center"
/>
<el-table-column
:prop="item.value"
:label="item.label"
v-for="(item, i) in columnOptions"
:key="i"
/>
</JNPF-table>
<pagination
:total="total"
:page.sync="listQuery.currentPage"
:limit.sync="listQuery.pageSize"
@pagination="initData"
v-if="hasPage"
/>
<div class="drawer-footer">
<el-button @click="visible = false" size="small"
>{{ $t("common.cancelButton") }}
</el-button>
<el-button type="primary" @click="select()" size="small"
>{{ $t("common.confirmButton") }}
</el-button>
</div>
</div>
</el-drawer>
</template>
</div>
</template>
<script>
import {
getDataInterfaceDataSelect,
getDataInterfaceDataInfoByIds
} from "@/api/systemData/dataInterface";
import emitter from "element-ui/src/mixins/emitter";
import { getDeviceListOption, getDeviceListInfo } from "@/api/device";
let {
methods: { dispatch }
} = emitter;
export default {
name: "PopupSelectDeviceCode",
props: {
value: {
default: ""
},
rowIndex: {
default: null
},
formData: {
type: Object
},
templateJson: {
type: Array,
default: () => []
},
interfaceId: {
type: String,
default: ""
},
placeholder: {
type: String,
default: "请选择"
},
propsValue: {
type: String,
default: "id"
},
relationField: {
type: String,
default: "fullName"
},
popupType: {
type: String,
default: "dialog"
},
popupTitle: {
type: String,
default: "选择数据"
},
popupWidth: {
type: String,
default: "800px"
},
field: {
type: String,
default: ""
},
columnOptions: {
type: Array,
default: () => []
},
hasPage: {
type: Boolean,
default: false
},
pageSize: {
type: Number,
default: 20
},
multiple: {
type: Boolean,
default: false
},
disabled: {
type: Boolean,
default: false
},
clearable: {
type: Boolean,
default: true
}
},
model: {
prop: "value",
event: "input"
},
data() {
return {
list: [],
innerValue: "",
listQuery: {
keyword: "",
currentPage: 1,
pageSize: 20
},
total: 0,
checked: "",
checkedTxt: "",
checkedRow: {},
listLoading: false,
visible: false,
inputHovering: false
};
},
watch: {
value(val) {
this.setDefault();
}
},
computed: {
showClose() {
let hasValue = this.multiple
? Array.isArray(this.value) && this.value.length > 0
: this.value !== undefined && this.value !== null && this.value !== "";
let criteria =
this.clearable && !this.disabled && this.inputHovering && hasValue;
return criteria;
},
propsLabel() {
return this.columnOptions[0].value;
}
},
created() {
this.listQuery.pageSize = this.hasPage ? this.pageSize : 100000;
this.setDefault();
},
methods: {
initData() {
if (!this.interfaceId) return;
this.listLoading = true;
// const paramList = this.getParamList();
// const columnOptions = this.columnOptions.map(o => o.value);
// let query = {
// ...this.listQuery,
// interfaceId: this.interfaceId,
// propsValue: this.propsValue,
// relationField: this.relationField,
// columnOptions: columnOptions.join(","),
// paramList
// };
// console.log(query);
// getDataInterfaceDataSelect(this.interfaceId, query)
// .then(res => {
// this.list = res.data.list;
// this.total = res.data.pagination.total;
// this.listLoading = false;
// console.log(this.list);
// console.log((this.total = res.data.pagination.total));
// })
// .catch(() => {
// this.listLoading = false;
// });
getDeviceListOption()
.then(res => {
this.list = res.data;
this.total = res.data.length;
this.listLoading = false;
})
.catch(() => {
this.listLoading = false;
});
},
getParamList() {
let templateJson = this.templateJson;
if (!this.formData) return templateJson;
for (let i = 0; i < templateJson.length; i++) {
if (templateJson[i].relationField) {
if (templateJson[i].relationField.includes("-")) {
let tableVModel = templateJson[i].relationField.split("-")[0];
let childVModel = templateJson[i].relationField.split("-")[1];
templateJson[i].defaultValue =
(this.formData[tableVModel] &&
this.formData[tableVModel][this.rowIndex] &&
this.formData[tableVModel][this.rowIndex][childVModel]) ||
"";
} else {
templateJson[i].defaultValue =
this.formData[templateJson[i].relationField] || "";
}
}
}
return templateJson;
},
interfaceDataHandler(data) {
if (!data.dataProcessing) return data.list;
const dataHandler = this.jnpf.getScriptFunc.call(
this,
data.dataProcessing
);
if (!dataHandler) return data.list;
return dataHandler(data.list);
},
search() {
this.initData();
this.listQuery.currentPage = 1;
this.listQuery.pageSize = this.hasPage ? this.pageSize : 10000;
},
reset() {
this.listQuery.keyword = "";
this.listQuery.currentPage = 1;
this.listQuery.pageSize = this.hasPage ? this.pageSize : 10000;
this.initData();
},
openDialog() {
if (this.disabled) return;
this.checked = this.value;
this.visible = true;
this.reset();
},
clear(event) {
this.checked = "";
this.innerValue = "";
this.checkedRow = {};
this.$emit("input", this.checked);
this.$emit("change", this.checked, this.checkedRow);
dispatch.call(this, "ElFormItem", "el.form.change", this.checked);
event.stopPropagation();
},
select() {
if (!this.checked) return;
this.innerValue = this.checkedTxt;
console.log(this.checked);
console.log(this.checkedRow);
this.$emit("input", this.checked);
// this.$emit("change", this.checked, this.checkedRow);
// dispatch.call(this, "ElFormItem", "el.form.change", this.checked);
this.visible = false;
},
rowClick(row) {
this.checked = row[this.propsValue];
this.checkedTxt = row[this.relationField];
this.checkedRow = row;
},
setDefault() {
console.log("zzzzzzzzzzz");
if (this.value) {
console.log(this.value);
if (!this.interfaceId) return;
const paramList = this.getParamList();
// let query = {
// ids: [this.value],
// interfaceId: this.interfaceId,
// propsValue: this.propsValue,
// relationField: this.relationField,
// paramList
// };
let query = {
ids: [this.value]
};
console.log(this.interfaceId);
console.log(this.value);
getDeviceListInfo(query).then(res => {
const data = res.data && res.data.length ? res.data[0] : {};
this.innerValue = data[this.relationField];
if (!this.field) return;
let relationData = this.$store.state.generator.relationData;
console.log(relationData)
console.log(this.field)
this.$set(relationData, this.field, data);
this.$eventBus.$emit("popupAttrEventBus", relationData, this.field);
this.$store.commit("generator/UPDATE_RELATION_DATA", relationData);
});
// getDataInterfaceDataInfoByIds(this.interfaceId, query).then(res => {
// console.log(res);
// const data = res.data && res.data.length ? res.data[0] : {};
// this.innerValue = data[this.relationField];
// if (!this.field) return;
// let relationData = this.$store.state.generator.relationData;
// this.$set(relationData, this.field, data);
// this.$eventBus.$emit("popupAttrEventBus", relationData, this.field);
// this.$store.commit("generator/UPDATE_RELATION_DATA", relationData);
// });
} else {
this.innerValue = "";
if (!this.field) return;
let relationData = this.$store.state.generator.relationData;
this.$set(relationData, this.field, {});
this.$eventBus.$emit("popupAttrEventBus", relationData, this.field);
this.$store.commit("generator/UPDATE_RELATION_DATA", relationData);
}
}
}
};
</script>
<style lang="scss" scoped>
>>> .el-dialog__body {
height: 70vh;
padding: 0 0 10px !important;
display: flex;
flex-direction: column;
overflow: hidden;
.JNPF-common-search-box {
margin-bottom: 0;
.JNPF-common-search-box-right {
padding: 10px 10px 0 0;
}
}
}
</style>

@ -43,6 +43,7 @@ import JnpfUsersSelect from '@/components/Jnpf/UsersSelect'
import JnpfRoleSelect from '@/components/Jnpf/RoleSelect'
import JnpfInputTable from '@/components/Jnpf/InputTable'
import JnpfPopupSelect from '@/components/Jnpf/PopupSelect'
import PopupSelectDeviceCode from '@/components/Jnpf/PopupSelectDeviceCode'
import JnpfPopupTableSelect from '@/components/Jnpf/PopupTableSelect'
import JnpfPopupAttr from '@/components/Jnpf/PopupAttr'
import JnpfRelationForm from '@/components/Jnpf/RelationForm'
@ -112,6 +113,7 @@ export default {
Vue.component('JnpfRoleSelect', JnpfRoleSelect)
Vue.component('JnpfInputTable', JnpfInputTable)
Vue.component('JnpfPopupSelect', JnpfPopupSelect)
Vue.component('PopupSelectDeviceCode', PopupSelectDeviceCode)
Vue.component('JnpfPopupTableSelect', JnpfPopupTableSelect)
Vue.component('JnpfPopupAttr', JnpfPopupAttr)
Vue.component('JnpfRelationForm', JnpfRelationForm)

@ -60,18 +60,18 @@
<!-- 具体表单 -->
<el-col :span="8">
<jnpf-form-tip-item label="设备编码" prop="deviceCode">
<JnpfPopupSelect
<PopupSelectDeviceCode
v-model="dataForm.deviceCode"
@change="changeData('deviceCode', -1)"
:rowIndex="null"
:formData="dataForm"
:templateJson="interfaceRes.deviceCode"
placeholder="请选择"
propsValue="device_code"
propsValue="deviceCode"
popupWidth="800px"
popupTitle="选择数据"
popupType="dialog"
relationField="device_name"
relationField="deviceName"
field="deviceCode"
interfaceId="564713894723988869"
:pageSize="20"
@ -79,7 +79,7 @@
clearable
:style="{ width: '100%' }"
>
</JnpfPopupSelect>
</PopupSelectDeviceCode>
</jnpf-form-tip-item>
</el-col>
<el-col :span="8">
@ -576,8 +576,8 @@ export default {
// ]
},
deviceCodecolumnOptions: [
{ label: "设备编码", value: "device_code" },
{ label: "设备名称", value: "device_name" }
{ label: "设备编码", value: "deviceCode" },
{ label: "设备名称", value: "deviceName" }
],
productCodeOptions: [],
productCodeProps: { label: "name", value: "id" },
@ -607,7 +607,7 @@ export default {
{
dataType: "varchar",
defaultValue: "",
field: "device_code",
field: "deviceCode",
fieldName: "",
id: "ow3vw72",
jnpfKey: "select",

Loading…
Cancel
Save