RFIDManage.vue 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302
  1. <!--RFID管理-->
  2. <template>
  3. <div class="app-container approval_handle">
  4. <div class="approval_handle-page" v-if="pageType == 1">
  5. <el-form :model="queryParams" ref="queryForm" style="margin-top:20px;" :inline="true">
  6. <el-form-item label="关键字" prop="name">
  7. <el-input
  8. v-model="queryParams.searchValue"
  9. placeholder="标签码"
  10. clearable
  11. maxLength="30"
  12. size="small"
  13. />
  14. </el-form-item>
  15. <el-form-item label="添加时间" prop="dateRange">
  16. <el-date-picker
  17. :clearable="false"
  18. v-model="dateRange"
  19. size="small"
  20. style="width: 240px"
  21. value-format="yyyy-MM-dd"
  22. type="daterange"
  23. range-separator="-"
  24. start-placeholder="开始日期"
  25. end-placeholder="结束日期"
  26. ></el-date-picker>
  27. </el-form-item>
  28. <el-form-item>
  29. <p class="inquire-button-one" @click="handleQuery">查询</p>
  30. <p class="reset-button-one" @click="resetQuery">重置</p>
  31. </el-form-item>
  32. <el-form-item style="float: right;">
  33. <el-col :span="1.5">
  34. <el-button
  35. type="primary"
  36. plain
  37. icon="el-icon-plus"
  38. size="mini"
  39. @click="handleClick('','','add')"
  40. v-hasPermi="['airbottle:tag:add']"
  41. >新增</el-button>
  42. </el-col>
  43. </el-form-item>
  44. </el-form>
  45. <el-table border v-loading="loading" :data="tableData">
  46. <el-table-column label="标签码" align="left" prop="tagCode"/>
  47. <el-table-column label="是否绑定" align="left" prop="isBind">
  48. <template slot-scope="scope">
  49. <span v-if="scope.row.isBind == 1">绑定</span>
  50. <span v-if="scope.row.isBind == 0">未绑定</span>
  51. </template>
  52. </el-table-column>
  53. <el-table-column label="添加时间" align="left" prop="createTime"></el-table-column>
  54. <el-table-column label="操作" align="left" class-name="small-padding fixed-width" width="260">
  55. <template slot-scope="scope">
  56. <div class="button-box">
  57. <p class="table-min-button"
  58. style="margin-right: 10px"
  59. @click="handleClick('',scope.row,'reprint')"
  60. >二维码补打</p>
  61. <p class="table-min-button"
  62. @click="handleClick('',scope.row,'delete')"
  63. v-hasPermi="['airbottle:tag:remove']"
  64. >删除</p>
  65. </div>
  66. </template>
  67. </el-table-column>
  68. </el-table>
  69. <pagination :page-sizes="[20, 30, 40, 50]"
  70. :total="total"
  71. layout="total, prev, pager, next, sizes, jumper"
  72. :page.sync="queryParams.pageNum"
  73. :limit.sync="queryParams.pageSize"
  74. @pagination="getList"
  75. />
  76. </div>
  77. <!-- -->
  78. <el-dialog title="RFID标签录入" :visible.sync="dialogVisible " @close="handleClose" width="500px" append-to-body>
  79. <div style="text-align: center">
  80. <el-form ref="form" :model="form" label-width="80px">
  81. <p class="entering_t">请将RFID标签放置在RIFD读写器上进行识别</p>
  82. <img class="entering_img" src="@/assets/ZDimages/gasManage3_0/rfid_icon.png"/>
  83. <el-input ref="clickPosition" style="width: 320px;margin: 20px 0;" v-model="form.tagCode" placeholder="rfid标签" />
  84. </el-form>
  85. <div id="form1" style="display: none">{{form.tagCode}}</div>
  86. <div slot="footer" class="dialog-footer" >
  87. <el-button style="width: 120px" type="primary" @click="printQRcode()">打印二维码</el-button>
  88. </div>
  89. <!-- <vue-qr id="form1" style="display: block;height:200px;width:200px;cursor:pointer;margin:0 auto;" text="12123123123123" :size="200"></vue-qr>-->
  90. </div>
  91. </el-dialog>
  92. </div>
  93. </template>
  94. <script>
  95. import {
  96. qualificationApplyAdd,
  97. qualificationApplyList,
  98. RFIDtagAdd,
  99. RFIDtagDelete,
  100. RFIDtagList
  101. } from '@/api/gasManage3_0/gasManage'
  102. import { getToken } from "@/utils/auth";
  103. import { getLodop } from "@/utils/LodopFuncs";
  104. import vueQr from 'vue-qr'
  105. import { delGroup } from '@/api/laboratory/group'
  106. export default {
  107. name: "Approval",
  108. components: {
  109. vueQr
  110. },
  111. data() {
  112. return {
  113. dialogVisible :false,
  114. //页面状态
  115. pageType:1,
  116. loading:false,
  117. headers: {
  118. Authorization: "Bearer " + getToken()
  119. },
  120. // 查询参数
  121. queryParams: {
  122. pageNum: 1,
  123. pageSize:20,
  124. searchValue:'',
  125. },
  126. form:{
  127. tagCode:'',
  128. },
  129. total:0,
  130. tableData:[],
  131. dateRange:[],
  132. };
  133. },
  134. methods: {
  135. //监听弹窗关闭
  136. handleClose(){
  137. this.getList()
  138. },
  139. //新增的打印
  140. CreateOneFormPage() {
  141. LODOP = getLodop()
  142. LODOP.PRINT_INIT('') //打印初始化
  143. LODOP.SET_PRINT_STYLE('Bold', 1) //设置对象风格
  144. LODOP.ADD_PRINT_TEXT(138,30,300,200,this.form.tagCode,) //增加纯文本项
  145. LODOP.SET_PRINT_STYLEA(0,'FontSize', 14) //设置对象风格
  146. LODOP.SET_PRINT_PAGESIZE(1, 500, 300, '') //设定纸张大小
  147. LODOP.SET_PRINT_MODE('PRINT_PAGE_PERCENT', '60%')//设置缩放
  148. LODOP.SET_PREVIEW_WINDOW(2, 2, 0, 0, 0, '')//设置窗口
  149. //LODOP.ADD_PRINT_HTM(2,80,160,160, document.getElementById("form1").innerHTML);//增加超文本项
  150. LODOP.ADD_PRINT_BARCODE(2,80,160, 160,'QRCode',this.form.tagCode);
  151. },
  152. handleClick(index,row,doType){
  153. let _this=this;
  154. if(doType=='add'){//添加
  155. _this.form.tagCode='';
  156. _this.dialogVisible=true;
  157. this.$nextTick(()=>{
  158. this.$refs.clickPosition.focus()
  159. })
  160. }else if(doType=='reprint'){//补打
  161. this.$confirm('是否确认补打二维码标签?', '提示', {
  162. confirmButtonText: '确定',
  163. cancelButtonText: '取消',
  164. type: 'warning'
  165. }).then(() => {
  166. _this.form.tagCode=row.tagCode
  167. setTimeout(function () {
  168. _this.CreateOneFormPage()
  169. LODOP.PREVIEW() //打印预览
  170. },100)
  171. }).catch(() => {});
  172. }else if(doType=='delete'){//删除
  173. this.$confirm('是否确认删除当前数据项?', "警告", {
  174. confirmButtonText: "确定",
  175. cancelButtonText: "取消",
  176. type: "warning"
  177. }).then(function() {
  178. RFIDtagDelete(row.id).then( response => {
  179. if(response.code==200){
  180. _this.getList();
  181. _this.msgSuccess("删除成功");
  182. }
  183. });
  184. }).then(() => {
  185. }).catch(() => {});
  186. }else if(doType=='back'){//重新申请
  187. _this.pageType=1;
  188. }
  189. },
  190. //打印二维码
  191. printQRcode(){
  192. let _this=this;
  193. if(_this.form.tagCode==''){
  194. _this.msgError("请先录入RFID标签!");
  195. return
  196. }
  197. _this.submitForm();
  198. setTimeout(function () {
  199. _this.CreateOneFormPage()
  200. LODOP.PREVIEW() //打印预览
  201. },100)
  202. },
  203. /** 搜索按钮操作 */
  204. handleQuery() {
  205. this.queryParams.pageNum = 1;
  206. this.getList();
  207. },
  208. /** 重置按钮操作 */
  209. resetQuery() {
  210. this.queryParams.searchValue = "";
  211. this.dateRange=[];
  212. this.queryParams.startTime=null;
  213. this.queryParams.endTime=null
  214. this.handleQuery();
  215. },
  216. getList(){
  217. let _this=this;
  218. if(this.dateRange&&this.dateRange.length>0) {
  219. this.queryParams.startTime=this.dateRange[0]
  220. this.queryParams.endTime=this.dateRange[1]
  221. } else {
  222. this.queryParams.startTime=null;
  223. this.queryParams.endTime=null
  224. }
  225. RFIDtagList(_this.queryParams).then( response => {
  226. let res=response.rows;
  227. _this.tableData=res;
  228. _this.total=response.total;
  229. });
  230. },
  231. submitForm(){
  232. let _this = this;
  233. RFIDtagAdd(_this.form).then(res => {
  234. this.$message({
  235. type: 'success',
  236. message: '操作成功!',
  237. duration:2000,
  238. onClose:function(){
  239. _this.backPage();
  240. _this.loading = false;
  241. }
  242. });
  243. });
  244. },
  245. },
  246. mounted() {
  247. this.getList();
  248. }
  249. };
  250. </script>
  251. <style scoped lang="scss">
  252. .approval_handle {
  253. display: flex!important;
  254. flex-direction: column;
  255. .approval_handle-page{
  256. flex:1;
  257. display: flex!important;
  258. flex-direction: column;
  259. box-shadow: 0 0 8px 2px rgba(0, 0, 0, 0.1);
  260. padding:20px 20px 20px!important;
  261. border-radius:10px;
  262. .button-box{
  263. width:200px;
  264. display: flex;
  265. }
  266. }
  267. .entering_t{
  268. font-size: 16px;
  269. font-family: Microsoft YaHei;
  270. font-weight: 400;
  271. color: #333333;
  272. line-height: 16px;
  273. margin: 36px auto 25px;
  274. text-align: center;
  275. }
  276. .entering_img{
  277. width: 288px;
  278. height: 140px;
  279. }
  280. .entering_input{
  281. width: 288px;
  282. }
  283. }
  284. </style>