1 line
16 KiB
1 line
16 KiB
{"version":3,"sources":["webpack:///src/views/daily/page/src/views/daily/page/inspectionPoint.vue"],"names":[],"mappings":"AACA,yBACA,iBAAA,CACA,QAAA,CACA,OAAA,CACA,WACA","file":"chunk-3327be95.85fbac31.css","sourcesContent":["<style scoped>\n.qrcode {\n position: absolute;\n left: 50%;\n top: 40%;\n z-index: 100;\n}\n</style>\n<template>\n <div>\n <div class=\"main-content\">\n <div class=\"main-titel\">\n <span>巡检点</span>\n </div>\n <div class=\"content\">\n <div class=\"qrcode\" ref=\"qrCodeUrl\" v-if=\"isShow\"></div>\n <div class=\"content-btn\">\n <el-button\n class=\"init-button\"\n @click=\"add()\"\n icon=\"el-icon-plus\"\n >新增巡检点</el-button\n >\n </div>\n\n <div class=\"\">\n <VueTable\n ref=\"table\"\n :config=\"config\"\n @tableCheck=\"tableCheck\"\n >\n <!-- 二维码\n <template slot=\"qrCode\">\n <el-button\n class=\"init-text\"\n type=\"text\"\n >\n <span @mouseenter=\"creatQrCode()\" @mouseleave=\"missQr()\"> 查看</span>\n </el-button>\n </template> -->\n <template slot=\"tabs\">\n <el-tabs v-model=\"activeName\">\n <el-tab-pane\n label=\"全部\"\n name=\"0\"\n ></el-tab-pane>\n </el-tabs>\n </template>\n\n <template slot=\"footer\">\n <div class=\"table-footer\">\n <button\n @click=\"creatQrCode()\"\n @mouseleave=\"missQr()\"\n >\n 查看二维码\n </button>\n <button @click=\"edit(table_row)\">编辑</button>\n <button @click=\"del(table_row)\">删除</button>\n </div>\n </template>\n </VueTable>\n </div>\n <!-- 新增 -->\n <Drawer\n drawerTitle=\"新增巡检点\"\n @drawerClose=\"addClose\"\n :drawerVrisible=\"add_vrisible\"\n >\n <div style=\"padding: 30px\">\n <FromCard>\n <template slot=\"title\">巡检点信息</template>\n <template>\n <VueForm ref=\"addForm\" :formObj=\"addForm\">\n <!-- 检查项 -->\n <template v-slot:itemsList>\n <Button @click=\"addInt\">添加</Button>\n <div\n v-for=\"(\n item, index\n ) in inspectionArr\"\n :key=\"index\"\n >\n <el-input\n v-model=\"item.name\"\n placeholder=\"请输入内容\"\n size=\"small\"\n ></el-input>\n </div>\n </template>\n </VueForm>\n </template>\n </FromCard>\n </div>\n <div slot=\"footer\">\n <button class=\"btn-orange\" @click=\"addSubmit()\">\n <span>\n <i class=\"el-icon-circle-check\"></i>提交</span\n >\n </button>\n <button class=\"btn-gray\" @click=\"addClose\">\n <span>取消</span>\n </button>\n </div>\n </Drawer>\n <!-- edit -->\n <Drawer\n drawerTitle=\"修改巡检点\"\n @drawerClose=\"editClose\"\n :drawerVrisible=\"edit_vrisible\"\n >\n <div style=\"padding: 30px\">\n <FromCard>\n <template slot=\"title\">巡检点信息</template>\n <template>\n <VueForm ref=\"editForm\" :formObj=\"editForm\">\n <!-- 检查项 -->\n <template v-slot:itemsList>\n <Button @click=\"addInt\">添加</Button>\n <div\n v-for=\"(\n item, index\n ) in inspectionArr\"\n :key=\"index\"\n >\n <el-input\n v-model=\"item.name\"\n placeholder=\"请输入内容\"\n size=\"small\"\n ></el-input>\n </div>\n </template>\n </VueForm>\n </template>\n </FromCard>\n </div>\n <div slot=\"footer\">\n <button class=\"btn-orange\" @click=\"editSubmit()\">\n <span>\n <i class=\"el-icon-circle-check\"></i>提交</span\n >\n </button>\n <button class=\"btn-gray\" @click=\"editClose\">\n <span>取消</span>\n </button>\n </div>\n </Drawer>\n </div>\n </div>\n </div>\n</template>\n\n<script>\nimport { inspectionPointInsert, inspectionPointUpdate ,inspectionPointFindById} from '@/api/daily'\nimport QRCode from 'qrcodejs2'\nexport default {\n data() {\n return {\n inspectionArr: [\n {\n name: null\n }\n ],\n isShow: false,\n link: '',\n add_vrisible: false,\n edit_vrisible: false,\n addDate: null,\n addForm: {\n ruleForm: {\n name: null,\n code: '',\n type: '1'\n },\n form_item: [\n {\n type: 'Input',\n label: '编号',\n width: '100%',\n prop: 'code',\n disabled: true\n },\n {\n type: 'Input',\n label: '名称',\n placeholder: '请输入',\n width: '100%',\n prop: 'name'\n },\n // {\n // type: 'Input',\n // label: '巡检模式',\n // disabled: true,\n // width: '100%',\n // prop: 'type'\n // },\n {\n type: 'Slot',\n label: '检查项',\n width: '50%',\n prop: 'itemsList',\n slotName: 'itemsList'\n }\n ]\n },\n editForm: {\n ruleForm: {\n name: null,\n code: null,\n type: '1'\n },\n form_item: [\n {\n type: 'Input',\n label: '编号',\n width: '100%',\n prop: 'code',\n disabled: true\n },\n {\n type: 'Input',\n label: '名称',\n placeholder: '请输入',\n width: '100%',\n prop: 'name'\n },\n // {\n // type: 'Input',\n // label: '巡检模式',\n // disabled: true,\n // width: '100%',\n // prop: 'type'\n // },\n {\n type: 'Slot',\n label: '检查项',\n width: '50%',\n prop: 'itemsList',\n slotName: 'itemsList'\n }\n ]\n },\n table_row: [],\n activeName: '0',\n config: {\n thead: [\n { label: '序号', type: 'index', width: '80' },\n { label: '编号', prop: 'code', width: 'auto' },\n { label: '名称', prop: 'name', width: 'auto' },\n {\n label: '巡检模式',\n prop: 'type',\n width: 'auto',\n type: 'function',\n callback: (row, prop) => {\n if (row.type == 1) {\n return '扫码'\n }\n }\n },\n // {\n // label: '二维码',\n // width: 'auto',\n // type: 'slot',\n // slotName: 'qrCode'\n // },\n { label: '创建时间', prop: 'createDate', width: 'auto' }\n ],\n table_data: [],\n url: 'inspectionPointList',\n search_item: [\n {\n type: 'Input',\n label: '编号',\n placeholder: '请输入',\n prop: 'code'\n },\n {\n type: 'Input',\n label: '名称',\n placeholder: '请输入',\n prop: 'name'\n }\n ],\n data: {\n pageNum: 1,\n size: 10\n }\n }\n }\n },\n methods: {\n creatQrCode() {\n if (this.table_row.length > 1) {\n this.$message.error('只能查看一条')\n return\n } else {\n // this.missQr()\n this.isShow = !this.isShow\n this.link = ''\n this.link = this.table_row[0].code\n console.log(this.link)\n this.$nextTick(function () {\n setTimeout(() => {\n let qrcode = new QRCode(this.$refs.qrCodeUrl, {\n text: this.link, //this.link, // 需要转换为二维码的内容\n width: 200,\n height: 200,\n colorDark: '#000000',\n colorLight: '#ffffff',\n correctLevel: QRCode.CorrectLevel.H\n })\n }, 100)\n })\n }\n },\n missQr() {\n ;(this.isShow = false), (this.link = null)\n },\n addInt() {\n this.inspectionArr.push({\n name: null\n })\n },\n add() {\n this.add_vrisible = true\n let random = Math.floor(Math.random() * 100000000)\n this.addForm.ruleForm.code = random\n },\n addClose() {\n this.$refs.addForm.reset()\n this.add_vrisible = false\n this.inspectionArr = [{ name: null }]\n },\n addSubmit() {\n let resData = {\n ...this.addForm.ruleForm,\n type: this.addForm.ruleForm.type,\n itemsList: this.inspectionArr\n }\n inspectionPointInsert(resData).then((res) => {\n if (res.status) {\n this.$message({\n message: res.message,\n type: 'success'\n })\n this.$refs.table.loadData()\n this.addClose()\n }\n })\n },\n edit(data) {\n if (data.length != 1) {\n this.$message({\n message: '只能编辑一条数据',\n type: 'error'\n })\n } else {\n this.edit_vrisible = true\n console.log(data[0].id)\n this.editForm.ruleForm.id = data[0].id\n inspectionPointFindById({ id: data[0].id }).then((res) => {\n console.log(res.data)\n this.editForm.ruleForm.code = res.data.code\n this.editForm.ruleForm.name = res.data.name\n this.inspectionArr = res.data.checkItemsList\n })\n }\n },\n editClose() {\n this.$refs.editForm.reset()\n this.edit_vrisible = false\n this.inspectionArr = [{ name: null }]\n },\n editSubmit() {\n let resData = {\n code:this.editForm.ruleForm.code,\n name:this.editForm.ruleForm.name,\n id: this.editForm.ruleForm.id,\n itemsList: this.inspectionArr\n }\n inspectionPointUpdate(resData).then((res) => {\n if (res.status) {\n this.$message({\n message: res.message,\n type: 'success'\n })\n this.$refs.table.loadData()\n this.editClose()\n }\n })\n },\n dateTimeChange(arr) {\n this.addForm.ruleForm.openStartDate = arr[0]\n this.addForm.ruleForm.openEndDate = arr[1]\n },\n\n // 表格选中\n tableCheck(data) {\n this.table_row = data\n },\n // 删除\n del(data) {\n if (data.length) {\n let arr = []\n for (let i = 0; i < this.table_row.length; i++) {\n arr.push(this.table_row[i].id)\n }\n this.$confirm('是否确认删除?删除不可恢复', '删除', {\n confirmButtonText: '确定',\n cancelButtonText: '取消',\n confirmButtonClass: 'confirmButton',\n cancelButtonClass: 'cancelButton'\n })\n .then(() => {\n this.$refs.table.tableDelete(arr)\n })\n .catch((action) => {})\n } else {\n this.$message.error('请选中需要删除的数据')\n }\n }\n }\n}\n</script>\n"]} |