RFIDManage.vue 9.1 KB

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