传感器类型
This commit is contained in:
parent
bd27dbc86a
commit
5ad085bf27
|
@ -30,3 +30,10 @@ export function productAttribute(materialCode) {
|
|||
method: 'get',
|
||||
});
|
||||
}
|
||||
|
||||
export function getNameplate(code) {
|
||||
return request({
|
||||
url: '/productCategory/getNameplate/' + code,
|
||||
method: 'get',
|
||||
});
|
||||
}
|
||||
|
|
|
@ -26,6 +26,24 @@
|
|||
autocomplete="off"
|
||||
></el-input>
|
||||
</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-input
|
||||
v-model.trim="form.remark"
|
||||
|
@ -43,10 +61,14 @@
|
|||
|
||||
<script>
|
||||
import { addData, updateData } from '@/api/product';
|
||||
import { baseURL } from '@/config';
|
||||
import store from '@/store';
|
||||
export default {
|
||||
name: 'GroupEdit',
|
||||
data() {
|
||||
return {
|
||||
updateAction: '',
|
||||
fileList: [],
|
||||
form: {
|
||||
id: '',
|
||||
name: '',
|
||||
|
@ -56,27 +78,59 @@ export default {
|
|||
materialCode: [
|
||||
{ required: true, trigger: 'blur', message: '请输入物料编码' },
|
||||
],
|
||||
nameplate: [
|
||||
{ required: true, trigger: 'blur', message: '请上传铭片模板' },
|
||||
],
|
||||
},
|
||||
roleData: [],
|
||||
clearable: true,
|
||||
roleId: '',
|
||||
parentData: [],
|
||||
title: '',
|
||||
dialogVisible: false,
|
||||
dialogFormVisible: false,
|
||||
};
|
||||
},
|
||||
created() {},
|
||||
created() {
|
||||
this.setUpdateData();
|
||||
},
|
||||
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) {
|
||||
if (!row) {
|
||||
this.title = '添加产品';
|
||||
} else {
|
||||
this.title = '编辑产品';
|
||||
row.nameplate &&
|
||||
this.fileList.push({
|
||||
url: row.nameplate,
|
||||
});
|
||||
this.form = Object.assign({}, row);
|
||||
}
|
||||
|
||||
this.dialogFormVisible = true;
|
||||
},
|
||||
close() {
|
||||
this.fileList = [];
|
||||
this.$refs['form'].resetFields();
|
||||
this.form = this.$options.data().form;
|
||||
this.dialogFormVisible = false;
|
||||
|
|
|
@ -91,6 +91,8 @@ import {
|
|||
} from '@/api/product';
|
||||
import groupEdit from './groupEdit';
|
||||
import attributeEdit from './attributeEdit';
|
||||
import { baseURL } from '@/config';
|
||||
import { imgReplacePath } from '@/utils/img';
|
||||
export default {
|
||||
name: 'Index',
|
||||
components: { groupEdit, attributeEdit },
|
||||
|
@ -123,7 +125,13 @@ export default {
|
|||
async fetchData() {
|
||||
this.listLoading = true;
|
||||
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;
|
||||
setTimeout(() => {
|
||||
this.listLoading = false;
|
||||
|
|
|
@ -71,7 +71,7 @@
|
|||
<el-input v-model="data.remark" placeholder="1"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item v-if="isConfig" label="传感点类型">
|
||||
<el-select v-model="data.type" placeholder="请选择传感点类型">
|
||||
<el-select v-model="form.type" placeholder="请选择传感点类型">
|
||||
<el-option
|
||||
v-for="item in typeData"
|
||||
:key="item.dataCode"
|
||||
|
@ -143,6 +143,7 @@
|
|||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="数据格式">
|
||||
<el-select v-model="form.dataFormat" placeholder="请选择数据格式">
|
||||
<el-option
|
||||
|
@ -200,6 +201,7 @@ export default {
|
|||
attrData: [],
|
||||
typeData: [],
|
||||
unitData: [],
|
||||
|
||||
strategyData: [],
|
||||
codeData: [],
|
||||
fileUrl: baseURL + '/static/img/',
|
||||
|
@ -255,7 +257,7 @@ export default {
|
|||
},
|
||||
config: '',
|
||||
isNumber: false,
|
||||
isConfig: false,
|
||||
isConfig: true,
|
||||
dialogFormVisible: false,
|
||||
title: '',
|
||||
diffData: {},
|
||||
|
@ -309,6 +311,7 @@ export default {
|
|||
}
|
||||
this.form.id = form.id;
|
||||
this.form.name = form.name;
|
||||
this.form.type = form.type.dataCode;
|
||||
this.form.img = form.img;
|
||||
this.form.addressId = form.addressId;
|
||||
this.form.offset = form.offset;
|
||||
|
@ -360,6 +363,7 @@ export default {
|
|||
},
|
||||
async getDictData() {
|
||||
const { data } = await getDictData();
|
||||
this.sensorTypeData = data.sensorType;
|
||||
this.attrData = data.sensorAttribute;
|
||||
this.typeData = data.sensorType;
|
||||
this.unitData = data.sensorUnit;
|
||||
|
|
|
@ -89,6 +89,12 @@
|
|||
width="200"
|
||||
align="center"
|
||||
></el-table-column>
|
||||
<el-table-column
|
||||
prop="type.dataValue"
|
||||
label="类型"
|
||||
width="200"
|
||||
align="center"
|
||||
></el-table-column>
|
||||
<!-- <el-table-column-->
|
||||
<!-- prop="status"-->
|
||||
<!-- label="传感器状态"-->
|
||||
|
|
|
@ -123,7 +123,12 @@
|
|||
width="50%"
|
||||
@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-item
|
||||
|
@ -140,9 +145,9 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import { getList, details, productAttribute } from '@/api/ywry';
|
||||
import { getList, details, productAttribute, getNameplate } from '@/api/ywry';
|
||||
import qcode from './qcode';
|
||||
|
||||
import { baseURL } from '@/config';
|
||||
import info from './info';
|
||||
import { getDate } from '@/common/times';
|
||||
import QRCode from 'qrcode';
|
||||
|
@ -175,37 +180,7 @@ export default {
|
|||
codeUrl: '',
|
||||
data: {},
|
||||
qrinfoData: {},
|
||||
printObj: {
|
||||
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-index,默认是20002,最好比默认值更高
|
||||
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绑定的按钮了!');
|
||||
},
|
||||
},
|
||||
nameplate: '',
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
|
@ -235,16 +210,36 @@ export default {
|
|||
this.fetchData();
|
||||
},
|
||||
qrProject(row) {
|
||||
let code = 'C0200053'; // row.materialCode
|
||||
productAttribute(code).then(res => {
|
||||
this.dialogqrcodeVisible = true;
|
||||
this.codeId = row.billNo;
|
||||
this.codeUrl =
|
||||
'http://sm.lidinghb.com?materialCode=' +
|
||||
code +
|
||||
'&billNo=' +
|
||||
row.billNo;
|
||||
this.qrinfoData = res.data;
|
||||
let code = row.materialCode;
|
||||
|
||||
let producInfo = new Promise((resolve, reject) => {
|
||||
productAttribute(code).then(res => {
|
||||
resolve(res.data);
|
||||
});
|
||||
});
|
||||
let getPlate = new Promise((resolve, reject) => {
|
||||
getNameplate(code).then(res => {
|
||||
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() {
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
</el-button>
|
||||
|
||||
<div id="printCanvas" class="container">
|
||||
<img src="@/assets/mb.png" />
|
||||
<img :src="srcImg" />
|
||||
|
||||
<div class="date">{{ currentDate }}</div>
|
||||
<img :src="qcodeImg" class="qrcodeimg" ass />
|
||||
|
@ -26,9 +26,9 @@ const canvasref = ref(null);
|
|||
|
||||
const qcodeImg = ref();
|
||||
|
||||
const props = defineProps(['url', 'id']);
|
||||
const props = defineProps(['url', 'id', 'nameplate']);
|
||||
console.log(props.url);
|
||||
|
||||
const srcImg = ref(props.nameplate);
|
||||
const sn = ref(props.id);
|
||||
const printButton = ref(null);
|
||||
const currentDate = ref('');
|
||||
|
|
|
@ -101,7 +101,7 @@ export default {
|
|||
});
|
||||
},
|
||||
handleQuery() {
|
||||
this.queryForm.pageNo = 1;
|
||||
this.queryForm.page = 1;
|
||||
this.fetchData();
|
||||
},
|
||||
handleSizeChange(val) {
|
||||
|
@ -109,7 +109,7 @@ export default {
|
|||
this.fetchData();
|
||||
},
|
||||
handleCurrentChange(val) {
|
||||
this.queryForm.pageNo = val;
|
||||
this.queryForm.page = val;
|
||||
this.fetchData();
|
||||
},
|
||||
},
|
||||
|
|
|
@ -101,7 +101,7 @@ export default {
|
|||
});
|
||||
},
|
||||
handleQuery() {
|
||||
this.queryForm.pageNo = 1;
|
||||
this.queryForm.page = 1;
|
||||
this.fetchData();
|
||||
},
|
||||
handleSizeChange(val) {
|
||||
|
@ -109,7 +109,7 @@ export default {
|
|||
this.fetchData();
|
||||
},
|
||||
handleCurrentChange(val) {
|
||||
this.queryForm.pageNo = val;
|
||||
this.queryForm.page = val;
|
||||
this.fetchData();
|
||||
},
|
||||
},
|
||||
|
|
|
@ -92,7 +92,7 @@ export default {
|
|||
}, 500);
|
||||
},
|
||||
handleQuery() {
|
||||
this.queryForm.pageNo = 1;
|
||||
this.queryForm.page = 1;
|
||||
this.fetchData();
|
||||
},
|
||||
handleSizeChange(val) {
|
||||
|
|
|
@ -191,7 +191,7 @@
|
|||
<vab-query-form-right-panel>
|
||||
<el-pagination
|
||||
:background="background"
|
||||
:current-page="queryForm.pageNo"
|
||||
:current-page="queryForm.page"
|
||||
:layout="layout"
|
||||
:page-size="queryForm.pageSize"
|
||||
:total="total"
|
||||
|
|
|
@ -86,7 +86,7 @@
|
|||
<vab-query-form-right-panel>
|
||||
<el-pagination
|
||||
:background="background"
|
||||
:current-page="queryForm.pageNo"
|
||||
:current-page="queryForm.page"
|
||||
:layout="layout"
|
||||
:page-size="queryForm.pageSize"
|
||||
:total="total"
|
||||
|
|
|
@ -82,7 +82,7 @@
|
|||
</el-table>
|
||||
<el-pagination
|
||||
:background="background"
|
||||
:current-page="queryForm.pageNo"
|
||||
:current-page="queryForm.page"
|
||||
:layout="layout"
|
||||
:page-size="queryForm.pageSize"
|
||||
:total="total"
|
||||
|
@ -164,7 +164,7 @@ export default {
|
|||
this.$refs['edit'].showEdit(row);
|
||||
},
|
||||
handleQuery() {
|
||||
this.queryForm.pageNo = 1;
|
||||
this.queryForm.page = 1;
|
||||
this.fetchData();
|
||||
},
|
||||
handleSizeChange(val) {
|
||||
|
@ -172,7 +172,7 @@ export default {
|
|||
this.fetchData();
|
||||
},
|
||||
handleCurrentChange(val) {
|
||||
this.queryForm.pageNo = val;
|
||||
this.queryForm.page = val;
|
||||
this.fetchData();
|
||||
},
|
||||
handleDelete(row) {
|
||||
|
|
|
@ -82,7 +82,7 @@
|
|||
</el-table>
|
||||
<el-pagination
|
||||
:background="background"
|
||||
:current-page="queryForm.pageNo"
|
||||
:current-page="queryForm.page"
|
||||
:layout="layout"
|
||||
:page-size="queryForm.pageSize"
|
||||
:total="total"
|
||||
|
@ -164,7 +164,7 @@ export default {
|
|||
this.$refs['edit'].showEdit(row);
|
||||
},
|
||||
handleQuery() {
|
||||
this.queryForm.pageNo = 1;
|
||||
this.queryForm.page = 1;
|
||||
this.fetchData();
|
||||
},
|
||||
handleSizeChange(val) {
|
||||
|
@ -172,7 +172,7 @@ export default {
|
|||
this.fetchData();
|
||||
},
|
||||
handleCurrentChange(val) {
|
||||
this.queryForm.pageNo = val;
|
||||
this.queryForm.page = val;
|
||||
this.fetchData();
|
||||
},
|
||||
handleDelete(row) {
|
||||
|
|
Loading…
Reference in New Issue