terminalApply.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437
  1. <template>
  2. <div>
  3. <div class="container structure-r" style="margin: 0;width: calc(50% - 10px);">
  4. <fullscreen :fullscreen.sync="fullscreen" class="container-box" style="padding: 0 20px 0 0;">
  5. <div class="titbox">
  6. <h2 class="font-ui">测试终端申请</h2>
  7. </div>
  8. <div class="search">
  9. <mySearch :searchList="searchList" @searchInfo="searchInfo"></mySearch>
  10. </div>
  11. <div class="tabbox">
  12. <el-table height="calc(100% - 40px)" class="com-table" ref="multipleTable" :data="tableData" tooltip-effect="dark" size="small"
  13. border style="width: 100%">
  14. <el-table-column prop="terminalTypeName" label="类型">
  15. </el-table-column>
  16. <el-table-column prop="brandName" label="品牌">
  17. </el-table-column>
  18. <el-table-column prop="modelType" label="型号">
  19. </el-table-column>
  20. <el-table-column prop="terminalNo" label="终端编码">
  21. </el-table-column>
  22. <el-table-column label="操作" width="80px" align="center">
  23. <template slot-scope="scope">
  24. <el-button size="mini" type="primary" @click="dialogCheck(scope.row)">申请</el-button>
  25. </template>
  26. </el-table-column>
  27. </el-table>
  28. <el-pagination class="pageBox" @current-change="currchange" layout="prev, pager, next" background
  29. :total="total">
  30. </el-pagination>
  31. </div>
  32. </fullscreen>
  33. </div>
  34. <div class="container structure-r" style="margin: 0;width: calc(50% - 10px);margin-left: 20px;">
  35. <div class="onetab">
  36. <el-table height="calc(100% - 10px)" class="com-table" ref="multipleTable" :data="infoApply" tooltip-effect="dark" size="small"
  37. border style="width: 100%">
  38. <el-table-column prop="terminalTypeName" label="类型">
  39. </el-table-column>
  40. <el-table-column prop="brandName" label="品牌">
  41. </el-table-column>
  42. <el-table-column prop="modelType" label="型号">
  43. </el-table-column>
  44. <el-table-column prop="terminalNo" label="终端编码">
  45. </el-table-column>
  46. <el-table-column label="操作" width="80px" align="center">
  47. <template slot-scope="scope">
  48. <el-button size="mini" type="danger" @click="delone(scope.row)">x</el-button>
  49. </template>
  50. </el-table-column>
  51. </el-table>
  52. </div>
  53. <el-form :model="infolist" ref="infolist" :rules="rules">
  54. <div class="info-line">
  55. <el-form-item prop="terminalTypeName">
  56. <span>申请标题</span>
  57. <el-input v-model="infolist.tit" placeholder="申请标题" :disabled="disableStatus"></el-input>
  58. </el-form-item>
  59. <el-form-item prop="modelType">
  60. <span>归还时间</span>
  61. <el-date-picker v-model="infolist.time" type="date" placeholder="归还时间">
  62. </el-date-picker>
  63. </el-form-item>
  64. </div>
  65. <div class="info-line">
  66. <el-form-item>
  67. <span>申请流程</span>
  68. <el-select clearable v-model="terminal" placeholder="申请流程" disabled>
  69. <el-option v-for="items in options" :key="items.procId" :label="items.procName"
  70. :value="items.procId">
  71. </el-option>
  72. </el-select>
  73. </el-form-item>
  74. <el-form-item>
  75. <span>操作姓名</span>
  76. <el-input v-model="infolist.opName" placeholder="操作姓名" disabled></el-input>
  77. </el-form-item>
  78. </div>
  79. </el-form>
  80. <div class="t-footer">
  81. <el-button type="primary" @click="dialogCli(2)">确 定</el-button>
  82. <el-button @click="dialogCli(1)">取 消</el-button>
  83. </div>
  84. </div>
  85. </div>
  86. </template>
  87. <script>
  88. import mySearch from "../../../components/search.vue";
  89. export default {
  90. components: {
  91. mySearch
  92. },
  93. data() {
  94. const terminalTypeName = (rule, value, callback) => {
  95. if (!this.infolist.tit) {
  96. callback(new Error('不能为空'))
  97. } else {
  98. callback()
  99. }
  100. }
  101. const modelType = (rule, value, callback) => {
  102. if (!this.infolist.time) {
  103. callback(new Error('不能为空'))
  104. } else {
  105. callback()
  106. }
  107. }
  108. return {
  109. rules: {
  110. terminalTypeName: [{
  111. required: true,
  112. trigger: 'blur',
  113. validator: terminalTypeName
  114. }],
  115. modelType: [{
  116. required: true,
  117. trigger: 'blur',
  118. validator: modelType
  119. }],
  120. },
  121. searchList: [{
  122. type: 'input',
  123. tit: '类别',
  124. value: '',
  125. width: '48%',
  126. },
  127. {
  128. type: 'input',
  129. tit: '品牌',
  130. value: '',
  131. width: '48%',
  132. },
  133. // {
  134. // type: 'input',
  135. // tit: '型号',
  136. // value: '',
  137. // width: '32%',
  138. // },
  139. ],
  140. fullscreen: false,
  141. total: 0,
  142. pageSize: 1,
  143. tableData: [{}],
  144. disableStatus: false,
  145. titname: '终端',
  146. infolist: {},
  147. typeOptions: [{
  148. dataCode: 1,
  149. dataName: 111,
  150. }],
  151. userInfo: {},
  152. params: {},
  153. infoApply: [],
  154. options: [],
  155. terminal:'686495855492730880',
  156. }
  157. },
  158. methods: {
  159. //搜索数据
  160. searchInfo(v) {
  161. this.params = {};
  162. v[0] ? this.params.terminalTypeName = v[0] : '';
  163. v[1] ? this.params.brandName = v[1] : '';
  164. v[2] ? this.params.modelType = v[2] : '';
  165. this.getList(this.params, this.pageSize);
  166. },
  167. //获取列表
  168. getList(v, n) {
  169. v.sts = '0';
  170. this.pageSize = n;
  171. let _this = this;
  172. this.$http({
  173. url: "/market/terminal/terminalrepo/queryPage",
  174. method: "post",
  175. headers: {
  176. "Content-Type": "application/json",
  177. "page": '{"pageNo":"' + n + '","pageSize":"10"}'
  178. },
  179. data: v,
  180. }).then((res) => {
  181. this.tableData = res.data.data;
  182. this.total = res.data.totalRecord;
  183. for (let i = 0; i < this.tableData.length; i++) {
  184. _this.tableData[i].opTime = _this.$formatDate(_this.tableData[i].opTime, "YYYY-MM-DD")
  185. }
  186. });
  187. },
  188. currchange(v) {
  189. this.pageSize = v;
  190. this.getList(this.params, this.pageSize);
  191. },
  192. //申请
  193. dialogCheck(n) {
  194. let _this = this;
  195. let sts = true;
  196. this.infolist.opNo = this.userInfo.loginNo;
  197. this.infolist.opName = this.userInfo.loginName;
  198. for(let i=0;i<this.infoApply.length;i++){
  199. if(n.id === this.infoApply[i].id){
  200. sts = false;
  201. }
  202. }
  203. sts ? this.infoApply.push(Object.assign({}, n)) : '';
  204. },
  205. delone(n){
  206. for(let i=0;i<this.infoApply.length;i++){
  207. if(n.id === this.infoApply[i].id){
  208. this.infoApply.splice(i,1)
  209. }
  210. }
  211. },
  212. //添加
  213. dialogCli(v) {
  214. if (v === 1) {
  215. this.infolist = {};
  216. this.infoApply = [];
  217. this.getUser();
  218. return
  219. }
  220. let _this = this;
  221. let info = {};
  222. info.opTime = _this.$formatDate(new Date(), "YYYY-MM-DD");
  223. info.opNo = this.userInfo.loginNo;
  224. info.opName = this.userInfo.loginName;
  225. info.params = {};
  226. info.params.reqBackTime = _this.infolist.time?_this.$formatDate(_this.infolist.time, "YYYY-MM-DD"):'';
  227. info.params.terminalRes = [];
  228. for (let i = 0; i < this.infoApply.length; i++) {
  229. let terminal = {
  230. terminalNo: this.infoApply[i].terminalNo,
  231. terminalTypeName: this.infoApply[i].terminalTypeName,
  232. brandName: this.infoApply[i].brandName,
  233. modelType: this.infoApply[i].modelType,
  234. id: this.infoApply[i].id,
  235. }
  236. info.params.terminalRes.push(terminal)
  237. }
  238. info.woTitle = this.infolist.tit;
  239. info.params.woTitle = this.infolist.tit;
  240. info.procId = this.terminal;
  241. for (let i = 0; i < this.options.length; i++) {
  242. if(this.infolist.terminal === this.options[i].procId){
  243. info.procName = this.options[i].procName;
  244. info.procVersion = this.options[i].procVersion;
  245. }
  246. }
  247. info.params.terminalRes = JSON.stringify(info.params.terminalRes)
  248. this.submitInfo("/bpm/api/startProc",info);
  249. },
  250. submitInfo(u,v) {
  251. let _this = this;
  252. this.$refs.infolist.validate(valid => {
  253. if (valid) {
  254. this.$http({
  255. url: u,
  256. method: "post",
  257. headers: {
  258. "Content-Type": "application/json",
  259. },
  260. data: v,
  261. }).then((res) => {
  262. if (res.data.result === 1) {
  263. _this.$message({
  264. message: res.data.desc,
  265. type: 'error'
  266. });
  267. } else {
  268. _this.$message({
  269. message: '成功',
  270. type: 'success'
  271. });
  272. _this.infolist = {};
  273. _this.infoApply = [];
  274. _this.getUser();
  275. }
  276. });
  277. }
  278. })
  279. },
  280. //删除
  281. delLine(v) {
  282. let _this = this;
  283. this.$confirm('即将删除此条数据, 是否删除?', '提示', {
  284. confirmButtonText: '确定',
  285. cancelButtonText: '取消',
  286. type: 'warning'
  287. }).then(() => {
  288. this.$http({
  289. url: "/market/terminal/terminaltype/del",
  290. method: "post",
  291. headers: {
  292. "Content-Type": "application/json",
  293. },
  294. data: {
  295. id: v.id
  296. },
  297. }).then((res) => {
  298. if (res.data.result === 1) {
  299. _this.$message({
  300. message: res.data.desc,
  301. type: 'error'
  302. });
  303. } else {
  304. _this.$message({
  305. message: '删除成功',
  306. type: 'success'
  307. });
  308. _this.getList(this.params, this.pageSize);
  309. }
  310. });
  311. })
  312. },
  313. //流程
  314. getTermianl() {
  315. this.$http({
  316. url: "/bpm/api/queryBpmProcList",
  317. method: "post",
  318. headers: {
  319. "Content-Type": "application/json",
  320. "page": '{"pageNo":"' + 1 + '","pageSize":"100"}'
  321. },
  322. data: {},
  323. }).then((res) => {
  324. this.options = res.data.data;
  325. });
  326. },
  327. //功能栏
  328. iconCli(v) {
  329. if (v === 1) {
  330. this.getList(this.params, this.pageSize);
  331. }
  332. if (v === 2) {
  333. this.fullscreen = !this.fullscreen
  334. }
  335. },
  336. getUser() {
  337. this.userInfo = JSON.parse(window.sessionStorage.userInfo);
  338. this.infolist = {
  339. opNo: '',
  340. opName: '',
  341. };
  342. this.infolist.opNo = this.userInfo.loginNo;
  343. this.infolist.opName = this.userInfo.loginName;
  344. }
  345. },
  346. mounted() {
  347. this.getList({}, 1);
  348. this.getTermianl();
  349. this.getUser();
  350. },
  351. created() {
  352. }
  353. }
  354. </script>
  355. <style scoped lang="scss">
  356. .t-footer {
  357. text-align: right;
  358. padding-right: 20px;
  359. }
  360. .onetab {
  361. padding: 20px;
  362. height: calc(100% - 180px);
  363. }
  364. .titbox {
  365. div {
  366. float: right;
  367. i {
  368. font-size: 22px;
  369. margin-left: 20px;
  370. cursor: pointer;
  371. }
  372. }
  373. }
  374. .tabbox {
  375. margin-top: 15px;
  376. }
  377. .pageBox {
  378. text-align: right;
  379. margin-top: 10px;
  380. }
  381. .info-line {
  382. width: 100%;
  383. display: block;
  384. padding-left: 20px;
  385. div {
  386. width: 50%;
  387. display: inline-block;
  388. }
  389. span {
  390. width: 80px;
  391. display: inline-block;
  392. text-align: left;
  393. i {
  394. color: red;
  395. display: inline-block;
  396. padding-right: 5px;
  397. }
  398. }
  399. .el-select,
  400. .el-input {
  401. width: calc(100% - 100px);
  402. }
  403. }
  404. .online {
  405. width: 100%;
  406. .el-select {
  407. width: calc(100% - 100px);
  408. }
  409. span {
  410. vertical-align: top;
  411. }
  412. .el-textarea {
  413. width: calc(100% - 100px);
  414. }
  415. }
  416. </style>