传感器类型

This commit is contained in:
Cc 2025-02-21 15:02:56 +08:00
parent bd27dbc86a
commit 5ad085bf27
14 changed files with 138 additions and 64 deletions

View File

@ -30,3 +30,10 @@ export function productAttribute(materialCode) {
method: 'get', method: 'get',
}); });
} }
export function getNameplate(code) {
return request({
url: '/productCategory/getNameplate/' + code,
method: 'get',
});
}

View File

@ -26,6 +26,24 @@
autocomplete="off" autocomplete="off"
></el-input> ></el-input>
</el-form-item> </el-form-item>
<el-form-item label="铭片模板" prop="nameplate">
<el-upload
v-if="dialogFormVisible"
:action="updateAction"
list-type="picture-card"
:on-preview="handlePictureCardPreview"
:on-remove="handleRemove"
:on-success="fileSuccess"
:headers="headerData"
name="files"
:file-list="fileList"
>
<i class="el-icon-plus"></i>
</el-upload>
<el-dialog title="大图" v-model="dialogVisible">
<img width="100%" :src="dialogImageUrl" alt="" />
</el-dialog>
</el-form-item>
<el-form-item label="备注"> <el-form-item label="备注">
<el-input <el-input
v-model.trim="form.remark" v-model.trim="form.remark"
@ -43,10 +61,14 @@
<script> <script>
import { addData, updateData } from '@/api/product'; import { addData, updateData } from '@/api/product';
import { baseURL } from '@/config';
import store from '@/store';
export default { export default {
name: 'GroupEdit', name: 'GroupEdit',
data() { data() {
return { return {
updateAction: '',
fileList: [],
form: { form: {
id: '', id: '',
name: '', name: '',
@ -56,27 +78,59 @@ export default {
materialCode: [ materialCode: [
{ required: true, trigger: 'blur', message: '请输入物料编码' }, { required: true, trigger: 'blur', message: '请输入物料编码' },
], ],
nameplate: [
{ required: true, trigger: 'blur', message: '请上传铭片模板' },
],
}, },
roleData: [], roleData: [],
clearable: true, clearable: true,
roleId: '', roleId: '',
parentData: [], parentData: [],
title: '', title: '',
dialogVisible: false,
dialogFormVisible: false, dialogFormVisible: false,
}; };
}, },
created() {}, created() {
this.setUpdateData();
},
methods: { methods: {
setUpdateData() {
this.updateAction = baseURL + '/file/uploadImg';
this.headerData = { token: store.getters['user/token'] };
},
fileSuccess(response, file, fileList) {
var img = this.form.nameplate;
this.form.nameplate = response.data;
console.log(this.form);
},
handleRemove(file, fileList) {
console.log(file, fileList);
this.form.nameplate = '';
},
handlePictureCardPreview(file) {
console.log(file);
this.dialogImageUrl = file.url;
this.dialogVisible = true;
},
showEdit(row) { showEdit(row) {
if (!row) { if (!row) {
this.title = '添加产品'; this.title = '添加产品';
} else { } else {
this.title = '编辑产品'; this.title = '编辑产品';
row.nameplate &&
this.fileList.push({
url: row.nameplate,
});
this.form = Object.assign({}, row); this.form = Object.assign({}, row);
} }
this.dialogFormVisible = true; this.dialogFormVisible = true;
}, },
close() { close() {
this.fileList = [];
this.$refs['form'].resetFields(); this.$refs['form'].resetFields();
this.form = this.$options.data().form; this.form = this.$options.data().form;
this.dialogFormVisible = false; this.dialogFormVisible = false;

View File

@ -91,6 +91,8 @@ import {
} from '@/api/product'; } from '@/api/product';
import groupEdit from './groupEdit'; import groupEdit from './groupEdit';
import attributeEdit from './attributeEdit'; import attributeEdit from './attributeEdit';
import { baseURL } from '@/config';
import { imgReplacePath } from '@/utils/img';
export default { export default {
name: 'Index', name: 'Index',
components: { groupEdit, attributeEdit }, components: { groupEdit, attributeEdit },
@ -123,7 +125,13 @@ export default {
async fetchData() { async fetchData() {
this.listLoading = true; this.listLoading = true;
const { data } = await getList(this.queryForm); const { data } = await getList(this.queryForm);
this.groupData = data.items;
this.groupData = data.items.map(item => {
item.nameplate &&
(item.nameplate = baseURL + '/static/img/' + item.nameplate);
return item;
});
console.log(this.groupData);
this.total = data.total; this.total = data.total;
setTimeout(() => { setTimeout(() => {
this.listLoading = false; this.listLoading = false;

View File

@ -71,7 +71,7 @@
<el-input v-model="data.remark" placeholder="1"></el-input> <el-input v-model="data.remark" placeholder="1"></el-input>
</el-form-item> </el-form-item>
<el-form-item v-if="isConfig" label="传感点类型"> <el-form-item v-if="isConfig" label="传感点类型">
<el-select v-model="data.type" placeholder="请选择传感点类型"> <el-select v-model="form.type" placeholder="请选择传感点类型">
<el-option <el-option
v-for="item in typeData" v-for="item in typeData"
:key="item.dataCode" :key="item.dataCode"
@ -143,6 +143,7 @@
></el-option> ></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="数据格式"> <el-form-item label="数据格式">
<el-select v-model="form.dataFormat" placeholder="请选择数据格式"> <el-select v-model="form.dataFormat" placeholder="请选择数据格式">
<el-option <el-option
@ -200,6 +201,7 @@ export default {
attrData: [], attrData: [],
typeData: [], typeData: [],
unitData: [], unitData: [],
strategyData: [], strategyData: [],
codeData: [], codeData: [],
fileUrl: baseURL + '/static/img/', fileUrl: baseURL + '/static/img/',
@ -255,7 +257,7 @@ export default {
}, },
config: '', config: '',
isNumber: false, isNumber: false,
isConfig: false, isConfig: true,
dialogFormVisible: false, dialogFormVisible: false,
title: '', title: '',
diffData: {}, diffData: {},
@ -309,6 +311,7 @@ export default {
} }
this.form.id = form.id; this.form.id = form.id;
this.form.name = form.name; this.form.name = form.name;
this.form.type = form.type.dataCode;
this.form.img = form.img; this.form.img = form.img;
this.form.addressId = form.addressId; this.form.addressId = form.addressId;
this.form.offset = form.offset; this.form.offset = form.offset;
@ -360,6 +363,7 @@ export default {
}, },
async getDictData() { async getDictData() {
const { data } = await getDictData(); const { data } = await getDictData();
this.sensorTypeData = data.sensorType;
this.attrData = data.sensorAttribute; this.attrData = data.sensorAttribute;
this.typeData = data.sensorType; this.typeData = data.sensorType;
this.unitData = data.sensorUnit; this.unitData = data.sensorUnit;

View File

@ -89,6 +89,12 @@
width="200" width="200"
align="center" align="center"
></el-table-column> ></el-table-column>
<el-table-column
prop="type.dataValue"
label="类型"
width="200"
align="center"
></el-table-column>
<!-- <el-table-column--> <!-- <el-table-column-->
<!-- prop="status"--> <!-- prop="status"-->
<!-- label="传感器状态"--> <!-- label="传感器状态"-->

View File

@ -123,7 +123,12 @@
width="50%" width="50%"
@close="close" @close="close"
> >
<qcode v-if="dialogqrcodeVisible" :url="codeUrl" :id="codeId"></qcode> <qcode
v-if="dialogqrcodeVisible"
:url="codeUrl"
:nameplate="nameplate"
:id="codeId"
></qcode>
<el-descriptions :column="3" border> <el-descriptions :column="3" border>
<el-descriptions-item <el-descriptions-item
@ -140,9 +145,9 @@
</template> </template>
<script> <script>
import { getList, details, productAttribute } from '@/api/ywry'; import { getList, details, productAttribute, getNameplate } from '@/api/ywry';
import qcode from './qcode'; import qcode from './qcode';
import { baseURL } from '@/config';
import info from './info'; import info from './info';
import { getDate } from '@/common/times'; import { getDate } from '@/common/times';
import QRCode from 'qrcode'; import QRCode from 'qrcode';
@ -175,37 +180,7 @@ export default {
codeUrl: '', codeUrl: '',
data: {}, data: {},
qrinfoData: {}, qrinfoData: {},
printObj: { nameplate: '',
id: 'printMe', // ID
// url:'https://www.baidu.com/',
popTitle: '打印表单', //
// extraCss: "https://cdn.bootcdn.net/ajax/libs/animate.css/4.1.1/animate.compat.css, https://cdn.bootcdn.net/ajax/libs/hover.css/2.3.1/css/hover-min.css", // css
// extraHead: '<meta http-equiv="Content-Language"content="zh-cn"/>', //
// preview: true, // false
previewTitle: '打印客户账单', //
previewPrintBtnLabel: '预览结束,开始打印', //
zIndex: 20003, // z-index20002
previewBeforeOpenCallback() {
console.log('正在加载预览窗口!');
}, // callback
previewOpenCallback() {
console.log('已经加载完预览窗口,预览打开了!');
}, // callback
beforeOpenCallback(vue) {
vue.printLoading = true;
console.log('开始打印之前!');
}, // callback
openCallback(vue) {
vue.printLoading = false;
console.log('监听到了打印窗户弹起了!');
}, // callback
closeCallback() {
console.log('关闭了打印工具!');
}, // callback()
clickMounted() {
console.log('点击v-print绑定的按钮了');
},
},
}; };
}, },
computed: { computed: {
@ -235,16 +210,36 @@ export default {
this.fetchData(); this.fetchData();
}, },
qrProject(row) { qrProject(row) {
let code = 'C0200053'; // row.materialCode let code = row.materialCode;
productAttribute(code).then(res => {
this.dialogqrcodeVisible = true; let producInfo = new Promise((resolve, reject) => {
this.codeId = row.billNo; productAttribute(code).then(res => {
this.codeUrl = resolve(res.data);
'http://sm.lidinghb.com?materialCode=' + });
code + });
'&billNo=' + let getPlate = new Promise((resolve, reject) => {
row.billNo; getNameplate(code).then(res => {
this.qrinfoData = res.data; resolve(res.data ? baseURL + '/static/img/' + res.data : null);
});
});
Promise.all([producInfo, getPlate]).then(proData => {
if (proData[1]) {
this.codeId = row.billNo;
this.codeUrl =
'http://sm.lidinghb.com?materialCode=' +
code +
'&billNo=' +
row.billNo;
this.qrinfoData = proData[0];
this.nameplate = proData[1];
this.dialogqrcodeVisible = true;
} else {
this.$message({
type: 'warning',
message: '当前物料产品未配置',
});
}
}); });
}, },
handleAdd() { handleAdd() {

View File

@ -10,7 +10,7 @@
</el-button> </el-button>
<div id="printCanvas" class="container"> <div id="printCanvas" class="container">
<img src="@/assets/mb.png" /> <img :src="srcImg" />
<div class="date">{{ currentDate }}</div> <div class="date">{{ currentDate }}</div>
<img :src="qcodeImg" class="qrcodeimg" ass /> <img :src="qcodeImg" class="qrcodeimg" ass />
@ -26,9 +26,9 @@ const canvasref = ref(null);
const qcodeImg = ref(); const qcodeImg = ref();
const props = defineProps(['url', 'id']); const props = defineProps(['url', 'id', 'nameplate']);
console.log(props.url); console.log(props.url);
const srcImg = ref(props.nameplate);
const sn = ref(props.id); const sn = ref(props.id);
const printButton = ref(null); const printButton = ref(null);
const currentDate = ref(''); const currentDate = ref('');

View File

@ -101,7 +101,7 @@ export default {
}); });
}, },
handleQuery() { handleQuery() {
this.queryForm.pageNo = 1; this.queryForm.page = 1;
this.fetchData(); this.fetchData();
}, },
handleSizeChange(val) { handleSizeChange(val) {
@ -109,7 +109,7 @@ export default {
this.fetchData(); this.fetchData();
}, },
handleCurrentChange(val) { handleCurrentChange(val) {
this.queryForm.pageNo = val; this.queryForm.page = val;
this.fetchData(); this.fetchData();
}, },
}, },

View File

@ -101,7 +101,7 @@ export default {
}); });
}, },
handleQuery() { handleQuery() {
this.queryForm.pageNo = 1; this.queryForm.page = 1;
this.fetchData(); this.fetchData();
}, },
handleSizeChange(val) { handleSizeChange(val) {
@ -109,7 +109,7 @@ export default {
this.fetchData(); this.fetchData();
}, },
handleCurrentChange(val) { handleCurrentChange(val) {
this.queryForm.pageNo = val; this.queryForm.page = val;
this.fetchData(); this.fetchData();
}, },
}, },

View File

@ -92,7 +92,7 @@ export default {
}, 500); }, 500);
}, },
handleQuery() { handleQuery() {
this.queryForm.pageNo = 1; this.queryForm.page = 1;
this.fetchData(); this.fetchData();
}, },
handleSizeChange(val) { handleSizeChange(val) {

View File

@ -191,7 +191,7 @@
<vab-query-form-right-panel> <vab-query-form-right-panel>
<el-pagination <el-pagination
:background="background" :background="background"
:current-page="queryForm.pageNo" :current-page="queryForm.page"
:layout="layout" :layout="layout"
:page-size="queryForm.pageSize" :page-size="queryForm.pageSize"
:total="total" :total="total"

View File

@ -86,7 +86,7 @@
<vab-query-form-right-panel> <vab-query-form-right-panel>
<el-pagination <el-pagination
:background="background" :background="background"
:current-page="queryForm.pageNo" :current-page="queryForm.page"
:layout="layout" :layout="layout"
:page-size="queryForm.pageSize" :page-size="queryForm.pageSize"
:total="total" :total="total"

View File

@ -82,7 +82,7 @@
</el-table> </el-table>
<el-pagination <el-pagination
:background="background" :background="background"
:current-page="queryForm.pageNo" :current-page="queryForm.page"
:layout="layout" :layout="layout"
:page-size="queryForm.pageSize" :page-size="queryForm.pageSize"
:total="total" :total="total"
@ -164,7 +164,7 @@ export default {
this.$refs['edit'].showEdit(row); this.$refs['edit'].showEdit(row);
}, },
handleQuery() { handleQuery() {
this.queryForm.pageNo = 1; this.queryForm.page = 1;
this.fetchData(); this.fetchData();
}, },
handleSizeChange(val) { handleSizeChange(val) {
@ -172,7 +172,7 @@ export default {
this.fetchData(); this.fetchData();
}, },
handleCurrentChange(val) { handleCurrentChange(val) {
this.queryForm.pageNo = val; this.queryForm.page = val;
this.fetchData(); this.fetchData();
}, },
handleDelete(row) { handleDelete(row) {

View File

@ -82,7 +82,7 @@
</el-table> </el-table>
<el-pagination <el-pagination
:background="background" :background="background"
:current-page="queryForm.pageNo" :current-page="queryForm.page"
:layout="layout" :layout="layout"
:page-size="queryForm.pageSize" :page-size="queryForm.pageSize"
:total="total" :total="total"
@ -164,7 +164,7 @@ export default {
this.$refs['edit'].showEdit(row); this.$refs['edit'].showEdit(row);
}, },
handleQuery() { handleQuery() {
this.queryForm.pageNo = 1; this.queryForm.page = 1;
this.fetchData(); this.fetchData();
}, },
handleSizeChange(val) { handleSizeChange(val) {
@ -172,7 +172,7 @@ export default {
this.fetchData(); this.fetchData();
}, },
handleCurrentChange(val) { handleCurrentChange(val) {
this.queryForm.pageNo = val; this.queryForm.page = val;
this.fetchData(); this.fetchData();
}, },
handleDelete(row) { handleDelete(row) {