RFIDManage.vue 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300
  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=""/>
  48. <el-table-column label="是否绑定" align="left" prop="isBind">
  49. <template slot-scope="scope">
  50. <span v-if="scope.row.isBind == 1">绑定</span>
  51. <span v-if="scope.row.isBind == 0">未绑定</span>
  52. </template>
  53. </el-table-column>
  54. <el-table-column label="添加时间" align="left" prop="createTime"></el-table-column>
  55. <el-table-column label="操作" align="left" class-name="small-padding fixed-width" width="260">
  56. <template slot-scope="scope">
  57. <div class="button-box">
  58. <p class="table-min-button"
  59. style="margin-right: 10px"
  60. @click="handleClick('',scope.row,'reprint')"
  61. >标签码补打</p>
  62. <p class="table-min-button"
  63. @click="handleClick('',scope.row,'delete')"
  64. v-hasPermi="['airbottle:tag:remove']"
  65. >删除</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 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(80,20,300,200,this.form.tagCode,) //增加纯文本项
  145. LODOP.SET_PRINT_STYLEA(0,'FontSize', 16) //设置对象风格
  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. },
  150. handleClick(index,row,doType){
  151. let _this=this;
  152. if(doType=='add'){//添加
  153. _this.form.tagCode='';
  154. _this.dialogVisible=true;
  155. this.$nextTick(()=>{
  156. this.$refs.clickPosition.focus()
  157. })
  158. }else if(doType=='reprint'){//补打
  159. this.$confirm('是否确认补打标签?', '提示', {
  160. confirmButtonText: '确定',
  161. cancelButtonText: '取消',
  162. type: 'warning'
  163. }).then(() => {
  164. _this.form.tagCode=row.tagCode
  165. setTimeout(function () {
  166. _this.CreateOneFormPage()
  167. LODOP.PREVIEW() //打印预览
  168. },100)
  169. }).catch(() => {});
  170. }else if(doType=='delete'){//删除
  171. this.$confirm('是否确认删除当前数据项?', "警告", {
  172. confirmButtonText: "确定",
  173. cancelButtonText: "取消",
  174. type: "warning"
  175. }).then(function() {
  176. RFIDtagDelete(row.id).then( response => {
  177. if(response.code==200){
  178. _this.getList();
  179. _this.msgSuccess("删除成功");
  180. }
  181. });
  182. }).then(() => {
  183. }).catch(() => {});
  184. }else if(doType=='back'){//重新申请
  185. _this.pageType=1;
  186. }
  187. },
  188. //打印二维码
  189. printQRcode(){
  190. let _this=this;
  191. if(_this.form.tagCode==''){
  192. _this.msgSuccess("请先录入RFID标签!");
  193. return
  194. }
  195. _this.submitForm();
  196. setTimeout(function () {
  197. _this.CreateOneFormPage()
  198. LODOP.PREVIEW() //打印预览
  199. },100)
  200. },
  201. /** 搜索按钮操作 */
  202. handleQuery() {
  203. this.queryParams.pageNum = 1;
  204. this.getList();
  205. },
  206. /** 重置按钮操作 */
  207. resetQuery() {
  208. this.queryParams.searchValue = "";
  209. this.dateRange=[];
  210. this.queryParams.startTime=null;
  211. this.queryParams.endTime=null
  212. this.handleQuery();
  213. },
  214. getList(){
  215. let _this=this;
  216. if(this.dateRange&&this.dateRange.length>0) {
  217. this.queryParams.startTime=this.dateRange[0]
  218. this.queryParams.endTime=this.dateRange[1]
  219. } else {
  220. this.queryParams.startTime=null;
  221. this.queryParams.endTime=null
  222. }
  223. RFIDtagList(_this.queryParams).then( response => {
  224. let res=response.rows;
  225. _this.tableData=res;
  226. _this.total=response.total;
  227. });
  228. },
  229. submitForm(){
  230. let _this = this;
  231. RFIDtagAdd(_this.form).then(res => {
  232. this.$message({
  233. type: 'success',
  234. message: '操作成功!',
  235. duration:2000,
  236. onClose:function(){
  237. _this.backPage();
  238. _this.loading = false;
  239. }
  240. });
  241. });
  242. },
  243. },
  244. mounted() {
  245. this.getList();
  246. }
  247. };
  248. </script>
  249. <style scoped lang="scss">
  250. .approval_handle {
  251. display: flex!important;
  252. flex-direction: column;
  253. .approval_handle-page{
  254. flex:1;
  255. display: flex!important;
  256. flex-direction: column;
  257. box-shadow: 0 0 8px 2px rgba(0, 0, 0, 0.1);
  258. padding:20px 20px 20px!important;
  259. border-radius:10px;
  260. .button-box{
  261. width:200px;
  262. display: flex;
  263. }
  264. }
  265. .entering_t{
  266. font-size: 16px;
  267. font-family: Microsoft YaHei;
  268. font-weight: 400;
  269. color: #333333;
  270. line-height: 16px;
  271. margin: 36px auto 25px;
  272. text-align: center;
  273. }
  274. .entering_img{
  275. width: 288px;
  276. height: 140px;
  277. }
  278. .entering_input{
  279. width: 288px;
  280. }
  281. }
  282. </style>