DeviceManageIndex.vue 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835
  1. <template>
  2. <div class="content-main-manage">
  3. <div class="search-list">
  4. <div class="search-left">
  5. <Form class="common-form common-form-list" ref="tableParams" :model="tableParams" inline>
  6. <FormItem label="" prop="lineId">
  7. <Select v-model="tableParams.lineId" placeholder="线路" @on-select="changeLine" label-in-value>
  8. <Option v-for="item in lineTypeData" :value="item.id" :key="item.id">{{ item.lineName }}</Option>
  9. </Select>
  10. </FormItem>
  11. <FormItem label="" prop="stationId">
  12. <Select v-model="tableParams.stationId" placeholder="站点">
  13. <Option v-for="item in stationTypeData" :value="item.id" :key="item.id">{{ item.stationName }}</Option>
  14. </Select>
  15. </FormItem>
  16. <FormItem label="" prop="equipmentStatus">
  17. <Select v-model="tableParams.equipmentStatus" placeholder="设备状态">
  18. <Option v-for="item in equipStateData" :value="item.id" :key="item.id">{{ item.value }}</Option>
  19. </Select>
  20. </FormItem>
  21. <!-- <FormItem label="" prop="equipmentType">
  22. <Select v-model="tableParams.equipmentType" placeholder="设备类型">
  23. <Option v-for="item in equipTypeData" :value="(item.id)" :key="item.id">{{ item.name }}</Option>
  24. </Select>
  25. </FormItem> -->
  26. <FormItem label="">
  27. <DatePicker type="daterange" :value="dateRange" :clearable="false" :editable="false" class="common-date-picker date-picker-main" placement="bottom-start" placeholder="启用日期范围" @on-change="changePicker"></DatePicker>
  28. </FormItem>
  29. <FormItem label="" prop="equipmentName">
  30. <Input placeholder="输入关键字查询" clearable search v-model="tableParams.equipmentName" />
  31. </FormItem>
  32. <FormItem label="" >
  33. <Button type="primary" class="common-btn-search" @click="searchClick">
  34. <Icon type="ios-search" style="margin-right:4px;font-size: 16px"/> 筛选
  35. </Button>
  36. <Button type="primary" class="common-btn-search" style="margin-left:10px" @click="resetClick('tableParams')">
  37. <Icon type="ios-search" style="margin-right:4px;font-size: 16px"/> 重置
  38. </Button>
  39. </FormItem>
  40. </Form>
  41. </div>
  42. </div>
  43. <div class="btn-container">
  44. <Button icon="ios-add" class="common-add-btn" @click="addClick">新增设备</Button>
  45. </div>
  46. <div class="manage-main-center">
  47. <Table :columns="columns" :data="tableData" class="common-table app-table" no-data-text="" :row-class-name="rowClassName" :loading="loading">
  48. <template slot="loading">
  49. <Loading-animation></Loading-animation>
  50. </template>
  51. <!-- <template slot-scope="{ row }" slot="lineName">
  52. <span>{{!row.lineName ? '/' : row.lineName}}</span>
  53. </template>
  54. <template slot-scope="{ row }" slot="stationName">
  55. <span>{{!row.stationName ? '/' : row.stationName}}</span>
  56. </template> -->
  57. <template slot-scope="{ row }" slot="action">
  58. <Tooltip content="详情" placement="top">
  59. <i class="iconfont icon-xiangqingmingxi" style="cursor:pointer;color:#B8B532;fontSize:20px;marginRight:6px" @click="detailClick(row)"></i>
  60. </Tooltip>
  61. <Tooltip content="编辑" placement="top">
  62. <i class="iconfont icon-bianji" style="cursor:pointer;color:#64ACFE;fontSize:20px;marginRight:6px" @click="editClick(row)"></i>
  63. </Tooltip>
  64. <Tooltip content="删除" placement="top">
  65. <i class="iconfont icon-shanchu" style="cursor:pointer;color:#E92E2E;fontSize:20px;marginRight:6px" @click="delClick(row)"></i>
  66. </Tooltip>
  67. </template>
  68. </Table>
  69. </div>
  70. <div class="common-page">
  71. <div class="common-page-total">
  72. 共<span>{{tablePage}}</span>页 / <span>{{tableTotal}}</span>条数据
  73. </div>
  74. <Page :total="tableTotal" :current="tableParams.pageNum" :page-size="tableParams.pageSize" @on-change="changePage" @on-page-size-change="sizeChange" show-elevator />
  75. </div>
  76. <Modal
  77. v-model="showModal"
  78. :title="title"
  79. width="36"
  80. ref="modalGrag"
  81. draggable
  82. reset-drag-position
  83. @on-visible-change="modalChange"
  84. :mask-closable="false"
  85. class-name="common-modal">
  86. <Form class="common-form" ref="formOption" :model="formOption" :rules="ruleValidate" :label-width="120" inline>
  87. <FormItem label="归属线路:" prop="lineId" style="width:48%">
  88. <Select v-model="formOption.lineId" placeholder="线路" @on-change="selectModalLine" label-in-value>
  89. <Option v-for="item in lineTypeData" :value="String(item.id)" :key="item.id">{{ item.lineName }}</Option>
  90. </Select>
  91. </FormItem>
  92. <FormItem label="归属站点:" prop="stationId" style="width:48%">
  93. <Select v-model="formOption.stationId" placeholder="站点" @on-change="selectModalStation" label-in-value>
  94. <Option v-for="item in stationTypeData" :value="String(item.id)" :key="item.id">{{ item.stationName }}</Option>
  95. </Select>
  96. </FormItem>
  97. <FormItem label="归属应用:" prop="appId" style="width:48%">
  98. <Select v-model="formOption.appId" placeholder="归属应用" @on-change="selectModalApp">
  99. <Option v-for="item in equipAppModalData" :value="item.id" :key="item.id">{{ item.appName }}</Option>
  100. </Select>
  101. </FormItem>
  102. <FormItem label="设备类型:" prop="equipmentType" style="width:48%">
  103. <Select v-model="formOption.equipmentType" placeholder="设备类型">
  104. <Option v-for="item in equipTypeModalData" :value="item.equipmentTypeId" :key="item.equipmentTypeId">{{ item.equipmentName }}</Option>
  105. </Select>
  106. </FormItem>
  107. <FormItem label="设备ID:" style="width:100%">
  108. <span v-show="title=='新增设备'">系统自动生成,唯一不重复</span>
  109. <span v-show="title=='编辑设备'">{{formOption.equipmentId}}</span>
  110. </FormItem>
  111. <FormItem label="设备名称:" prop="equipmentName" style="width:100%">
  112. <Input v-model.trim="formOption.equipmentName" type="textarea" :rows="3" maxlength="100" show-word-limit />
  113. </FormItem>
  114. <FormItem label="设备状态:" prop="equipmentStatus" style="width:48%">
  115. <Select v-model="formOption.equipmentStatus" placeholder="设备状态">
  116. <Option v-for="item in equipStateModalData" :value="item.id" :key="item.id">{{ item.value }}</Option>
  117. </Select>
  118. </FormItem>
  119. <FormItem label="启用日期:" prop="useDate" style="width:48%">
  120. <DatePicker type="date" :value="formOption.useDate" :editable="false" class="common-date-picker" placement="bottom-start" placeholder="启用日期" style="width: 100%" @on-change="changeMoldaPicker"></DatePicker>
  121. </FormItem>
  122. <FormItem label="设备型号:" prop="equipmentVersion" style="width:100%">
  123. <Input v-model="formOption.equipmentVersion" maxlength="20" show-word-limit />
  124. </FormItem>
  125. <FormItem label="供应商:" prop="supplier" style="width:100%">
  126. <Input v-model="formOption.supplier" maxlength="20" show-word-limit />
  127. </FormItem>
  128. <FormItem label="说明:" prop="remark" style="width:100%">
  129. <Input v-model="formOption.remark" type="textarea" :rows="6" maxlength="200" show-word-limit />
  130. </FormItem>
  131. </Form>
  132. <div slot="footer">
  133.     <Button @click="modalCancel">取消</Button>
  134.     <Button type="primary" @click="modalOk('formOption')">确定</Button>
  135.   </div>
  136. </Modal>
  137. <Modal
  138. v-model="modalStatus"
  139. :title="commonTitle"
  140. width="30"
  141. ref="modalGrag"
  142. draggable
  143. reset-drag-position
  144. :mask-closable="false"
  145. class-name="common-modal">
  146. <Icon type="ios-information-circle" :style="{ color: activeColor}" class="modal-icon"></Icon>
  147. <span class="modal-text">{{modalTitle}}</span>
  148. <div slot="footer">
  149.     <Button @click="commonCancel">取消</Button>
  150.     <Button type="primary" @click="commonOk">确定</Button>
  151.   </div>
  152. </Modal>
  153. <Modal
  154. v-model="detailStatus"
  155. title="设备详情"
  156. width="45"
  157. ref="modalGrag"
  158. draggable
  159. reset-drag-position
  160. footer-hide
  161. :mask-closable="false"
  162. class-name="common-modal">
  163. <div v-for="(item,index) in detailLabel" :key="index">
  164. <div class="common-modal-top">
  165. <span class="common-modal-top-text">{{item.name}}</span>
  166. </div>
  167. <div class="common-modal-content">
  168. <div class="modal-content-item" v-for="(val,i) in item.value" :key="i" :class="{'item-especial': val.name == '说明'|| val.name == '最后通讯时间' && item.value.length%2!=0,'item-especial-bot':(i==item.value.length-1 || i==item.value.length-2) && item.value.length%2==0}">
  169. <div class="modal-content-item-name">
  170. {{val.name}}
  171. </div>
  172. <div class="modal-content-item-value">
  173. <Tooltip placement="top-start" transfer max-width="350" v-if="val.name == '归属线路' || val.name == '归属站点' || val.value || val.value===0">
  174. <span v-if="val.name == '归属线路' || val.name == '归属站点'">{{!val.value ? '/' : val.value}}</span>
  175. <span v-else>{{val.value}}</span>
  176. <div slot="content">
  177. <span v-if="val.name == '归属线路' || val.name == '归属站点'">{{!val.value ? '/' : val.value}}</span>
  178. <span v-else>{{val.value}}</span>
  179. </div>
  180. </Tooltip>
  181. <span v-else>{{val.value}}</span>
  182. </div>
  183. </div>
  184. </div>
  185. </div>
  186. </Modal>
  187. </div>
  188. </template>
  189. <script>
  190. const defaultFrom = {lineId: '',stationId: '',appId:'',equipmentName: '',equipmentType:'',equipmentStatus: '',equipmentVersion: '',supplier: '',remark: ''}
  191. export default {
  192. name: "DeviceManageIndex",
  193. components:{
  194. },
  195. // props: {
  196. // currentAppId: [String,Number],
  197. // currentEquTypeId: [String,Number],
  198. // level: [String,Number],
  199. // },
  200. data() {
  201. return {
  202. applicationParams: {
  203. level: '',
  204. lineId: '',
  205. stationId: '',
  206. equipmentCheck: '',
  207. instrumentCheck: '',
  208. pageNum: 1,
  209. pageSize: 9999
  210. },
  211. appParams: {
  212. applicationId: '',
  213. equipmentTypeId: '',
  214. keywords: '',
  215. pageNum: 1,
  216. pageSize: 9999
  217. },
  218. loading: true,
  219. dateRange: [],
  220. tableParams: {
  221. lineId: '',
  222. stationId: '',
  223. equipmentStatus: '',
  224. keywords: '',
  225. applicationId:'',
  226. equipmentType: '',
  227. useDateBegin: '',
  228. useDateEnd: '',
  229. equipmentName: '',
  230. pageNum: 1,
  231. pageSize: 10
  232. },
  233. tableData: [],
  234. tableTotal: 0,
  235. tablePage: 0,
  236. rowObj: {},
  237. lineTypeData: [],
  238. stationTypeData: [],
  239. equipStateData: [],
  240. equipStateModalData: [],
  241. equipTypeData: [],
  242. equipTypeModalData: [],
  243. equipAppModalData: [],
  244. columns: [
  245. // {
  246. // type: 'selection',
  247. // width: 60,
  248. // align: 'center'
  249. // },
  250. {
  251. title: '设备ID',
  252. key: 'equipmentId',
  253. align: 'center'
  254. },
  255. {
  256. title: '设备名称',
  257. key: 'equipmentName',
  258. align: 'center',
  259. ellipsis: true,
  260. tooltip: true
  261. },
  262. {
  263. title: '设备类型',
  264. key: 'equipmentTypeName',
  265. align: 'center'
  266. },
  267. {
  268. title: '归属应用',
  269. key: 'appName',
  270. align: 'center',
  271. ellipsis: true,
  272. tooltip: true
  273. },
  274. {
  275. title: '归属线路',
  276. key: 'lineName',
  277. align: 'center',
  278. ellipsis: true,
  279. tooltip: true
  280. },
  281. {
  282. title: '归属站点',
  283. align: 'center',
  284. key: 'stationName',
  285. ellipsis: true,
  286. tooltip: true
  287. },
  288. {
  289. title: '设备状态',
  290. key: 'equipmentStatusValue',
  291. align: 'center'
  292. },
  293. {
  294. title: '启用日期',
  295. key: 'useDate',
  296. align: 'center'
  297. },
  298. {
  299. title: '操作',
  300. align: 'center',
  301. slot: 'action',
  302. width: 120,
  303. }
  304. ],
  305. showModal: false,
  306. detailStatus: false,
  307. modalStatus: false,
  308. title: '新增设备',
  309. commonTitle: "确认删除",
  310. activeColor: '#E92E2E',
  311. activeClass: '',
  312. modalTitle: '',
  313. formOption: {lineId: '',stationId: '',appId:'',equipmentName: '',equipmentType:'',equipmentStatus: '',useDate:'',equipmentVersion: '',supplier: '',remark: ''},
  314. ruleValidate: {
  315. lineId: [{
  316. required: true,
  317. message: '请选择所属线路',
  318. trigger: 'change'
  319. }],
  320. stationId: [{
  321. required: true,
  322. message: '请选择所属站点',
  323. trigger: 'change'
  324. }],
  325. appId: [{
  326. required: true,
  327. type: 'number',
  328. message: '请选择归属应用',
  329. trigger: 'change'
  330. }],
  331. equipmentName: [{
  332. required: true,
  333. message: '请输入设备名称',
  334. trigger: 'change'
  335. }],
  336. appName: [{
  337. required: true,
  338. message: '请输入设备名称',
  339. trigger: 'blur'
  340. }],
  341. equipmentType: [{
  342. required: true,
  343. type: 'number',
  344. message: '请选择设备类型',
  345. trigger: 'change'
  346. }],
  347. equipmentStatus: [{
  348. required: true,
  349. type: 'number',
  350. message: '请选择设备状态',
  351. trigger: 'change'
  352. }]
  353. },
  354. detailLabel: [],
  355. };
  356. },
  357. // watch: {
  358. // currentAppId: {
  359. //  handler(newValue) {
  360. // console.log(newValue)
  361. // this.tableParams.applicationId = newValue
  362. // this.getTableData()
  363. // }
  364. // },
  365. // currentEquTypeId: {
  366. //  handler(newValue) {
  367. // this.tableParams.equipmentType = newValue
  368. // this.getTableData()
  369. // }
  370. // },
  371. // },
  372. mounted() {
  373. this.getType()
  374. this.getAppApplicate()
  375. this.getTableData()
  376. },
  377. methods: {
  378. go (){
  379. // this.$router.push({path:'//ApplicationManage'})
  380. // this.$router.push({path:'/MainPage/ApplicationManage/2'})
  381. this.$router.push({ name: 'ApplicationManage', params: { type:2 }}) // -> /home/123
  382. },
  383. changePicker (date) {
  384. this.tableParams.useDateBegin = date[0]
  385. this.tableParams.useDateEnd = date[1]
  386. },
  387. rowClassName(row, index) {
  388. if (index % 2 == 0) {
  389. return "ivu-table-stripe-even";
  390. } else {
  391. return "ivu-table-stripe-odd";
  392. }
  393. },
  394. // 分页
  395. changePage (val) {
  396. this.tableParams.pageNum = val
  397. this.getTableData()
  398. },
  399. //跳转
  400. sizeChange (val) {
  401. this.tableParams.pageSize = val
  402. this.getTableData()
  403. },
  404. getType () {
  405. //获取所属线路
  406. this.$get('metroapi/lineStation/queryLine', {lineName:''}).then(res=>{
  407. if (res.httpCode == 1 ){
  408. this.lineTypeData = res.data
  409. this.lineTypeData.unshift({ id: '-1', lineName: '线路' })
  410. this.getStationData ('-1')
  411. } else {
  412. this.lineTypeData = []
  413. }
  414. })
  415. // 获取设备状态
  416. this.$get('metroapi/dic/queryDictionary', {name:'设备状态'}).then(res=>{
  417. if (res.httpCode == 1 ){
  418. this.equipStateModalData = JSON.parse(JSON.stringify(res.data))
  419. this.equipStateData = res.data
  420. this.equipStateData.unshift({ id: '-1', value: '设备状态' })
  421. } else {
  422. this.equipStateData = []
  423. this.equipStateModalData = []
  424. }
  425. })
  426. // 获取归属应用
  427. // this.$get('metroapi/application/info/list', this.applicationParams).then(res=>{
  428. // if (res.httpCode == 1 ){
  429. // this.equipAppModalData = res.data.data
  430. // } else {
  431. // this.equipAppModalData = []
  432. // }
  433. // })
  434. },
  435. // 获取归属应用
  436. getAppApplicate () {
  437. this.$get('metroapi/application/info/list', this.applicationParams).then(res=>{
  438. if (res.httpCode == 1 ){
  439. this.equipAppModalData = res.data.data
  440. } else {
  441. this.equipAppModalData = []
  442. }
  443. })
  444. },
  445. changeLine (val) {
  446. // 获取站点类型
  447. this.tableParams.stationId = ''
  448. this.tableParams.lineId = val.value
  449. if (this.tableParams.lineId) {
  450. this.getStationData(val.value)
  451. }
  452. },
  453. // 获取所属站点
  454. getStationData (lineId) {
  455. if(lineId == '-1') {
  456. this.stationTypeData = [{ id: '-1', stationName: '站点' }]
  457. } else {
  458. this.$get('metroapi/lineStation/queryStationByLineId', {lineId:lineId}).then(res=>{
  459. if (res.httpCode == 1 ){
  460. this.stationTypeData = res.data
  461. this.stationTypeData.unshift({ id: '-1', stationName: '站点' })
  462. }
  463. })
  464. }
  465. },
  466. // 获取表格数据
  467. getTableData () {
  468. let params = JSON.parse(JSON.stringify(this.tableParams))
  469. params.lineId = params.lineId == '-1' ? '':params.lineId
  470. params.stationId = params.stationId == '-1'?'':params.stationId
  471. params.equipmentStatus = params.equipmentStatus == '-1' ?'':params.equipmentStatus
  472. this.loading = true
  473. this.$get('metroapi/equipment/queryEquipmentPage', params).then(res=>{
  474. this.loading = false
  475. if (res.httpCode == 1 ){
  476. this.tableData = res.data.data
  477. this.tableTotal = res.data.count
  478. if (res.data.data.length==0) {
  479. this.tablePage = 0
  480. } else {
  481. this.tablePage = res.data.count<= 10 ? 1: Math.ceil(res.data.count/this.tableParams.pageSize)
  482. }
  483. if (res.data.data.length==0 && this.tableParams.pageNum>1) {
  484. this.tableParams.pageNum--
  485. return this.getTableData()
  486. }
  487. } else {
  488. this.tableData = []
  489. this.tableTotal = 0
  490. }
  491. })
  492. },
  493. selectModalLine (val) {
  494. this.formOption.stationId = ''
  495. if (val) {
  496. this.getStationData(val.value)
  497. }
  498. },
  499. selectModalStation (val) {
  500. if (val) {
  501. this.formOption.stationId =val.value
  502. }
  503. },
  504. selectModalApp (val) {
  505. this.appParams.applicationId = val
  506. this.formOption.equipmentType = ''
  507. if (val) {
  508. this.getAddEquipType(this.appParams)
  509. }
  510. },
  511. // 获取新增设备类型
  512. getAddEquipType (params) {
  513. this.$get('metroapi/application/equipmentTypeInfo', params).then(res=>{
  514. if (res.httpCode == 1 ){
  515. this.equipTypeModalData = res.data.data
  516. } else {
  517. this.equipTypeModalData = []
  518. }
  519. })
  520. },
  521. searchClick () {
  522. this.tableParams.pageNum = 1
  523. this.getTableData()
  524. // this.$router.push({ path: '/MainPage/ApplicationManage', query: {deptName: "2"}})
  525. },
  526. resetClick (name) {
  527. this.dateRange = []
  528. this.tableParams.useDateBegin = ''
  529. this.tableParams.useDateEnd = ''
  530. this.stationTypeData = [{ id: '-1', stationName: '站点' }]
  531. this.$refs[name].resetFields()
  532. this.tableParams.pageNum = 1
  533. this.getTableData()
  534. },
  535. changeMoldaPicker (val) {
  536. this.formOption.useDate = val
  537. },
  538. addClick () {
  539. this.formOption = JSON.parse(JSON.stringify(defaultFrom))
  540. this.title = '新增设备'
  541. this.showModal = true
  542. },
  543. detailClick (row) {
  544. this.rowObj = row
  545. this.detailStatus = true
  546. this.$get('metroapi/equipment/equipmentDetail', {equipmentId:row.id}).then(res=>{
  547. if (res.httpCode == 1 ){
  548. this.detailLabel = res.data
  549. } else {
  550. this.$Message.info(res.msg)
  551. }
  552. })
  553. },
  554. editClick (row) {
  555. this.rowObj = row
  556. this.formOption = JSON.parse(JSON.stringify(row));
  557. this.formOption.lineId = this.formOption.lineId ? String(this.formOption.lineId) : '-1'
  558. this.formOption.stationId = this.formOption.stationId ? String(this.formOption.stationId) : '-1'
  559. this.getStationData(this.formOption.lineId)
  560. this.appParams.applicationId = this.formOption.appId
  561. this.getAddEquipType(this.appParams)
  562. this.title = '编辑设备'
  563. this.showModal = true
  564. },
  565. delClick (row) {
  566. this.rowObj = row
  567. this.commonTitle = '确认删除'
  568. this.activeColor = '#E92E2E'
  569. this.activeClass = ''
  570. this.modalTitle = '删除不影响已产生的操作和记录。'
  571. this.modalStatus = true
  572. },
  573. modalChange (modalStatus) {
  574. if (!modalStatus) {
  575. this.$refs.formOption.resetFields();
  576. this.stationTypeData = [{ id: '-1', stationName: '站点' }]
  577. this.equipTypeModalData = []
  578. }
  579. },
  580. modalOk (formName) {
  581. let params = JSON.parse(JSON.stringify(this.formOption)) //把对象中的数据给了某个变量,改变一个对象的值,另一个对象也变化的解决方法
  582. params.lineId = params.lineId == '-1' ? '':params.lineId
  583. params.stationId = params.stationId == '-1' ? '':params.stationId
  584. if (this.title == '新增设备') {
  585. this.$refs[formName].validate((valid) => {
  586. if (valid) {
  587. this.$post('metroapi/equipment/addEquipment', params).then(res=>{
  588. if ( res.httpCode == 1 ){
  589. this.showModal = false
  590. this.$Message.info(res.msg)
  591. this.getTableData()
  592. } else {
  593. this.$Message.info(res.msg)
  594. }
  595. })
  596. } else {
  597. this.showModal = true
  598. }
  599. })
  600. } else {
  601. this.$refs[formName].validate((valid) => {
  602. if (valid) {
  603. this.$post('metroapi/equipment/editEquipment', params).then(res=>{
  604. if (res.httpCode == 1 ){
  605. this.showModal = false
  606. this.$Message.info(res.msg)
  607. this.getTableData()
  608. } else {
  609. this.$Message.info(res.msg)
  610. }
  611. })
  612. } else {
  613. this.showModal = true
  614. }
  615. })
  616. }
  617. },
  618. modalCancel () {
  619. this.showModal = false
  620. },
  621. commonOk () {
  622. let params = {
  623. id: this.rowObj.id
  624. }
  625. this.delData(params)
  626. },
  627. commonCancel () {
  628. this.modalStatus = false
  629. },
  630. // 删除接口
  631. delData (params) {
  632. this.$get('metroapi/equipment/delEquipment',params).then(res=>{
  633. if (res.httpCode == 1 ){
  634. this.modalStatus = false
  635. this.$Message.info(res.msg)
  636. this.getTableData()
  637. } else {
  638. this.$Message.info(res.msg)
  639. }
  640. })
  641. }
  642. }
  643. };
  644. </script>
  645. <style scoped lang="stylus">
  646. .content-main-manage {
  647. position: relative;
  648. height: calc(100% - 50px);
  649. }
  650. .search-list {
  651. display: flex;
  652. padding: 10px 0 0;
  653. }
  654. .search-left {
  655. display: flex;
  656. align-items: center;
  657. .ivu-select {
  658. width: 150px;
  659. height: 32px;
  660. }
  661. .ivu-select-single .ivu-select-selection {
  662. height: 100%;
  663. }
  664. >>> .ivu-input {
  665. width: 165px;
  666. height: 32px;
  667. }
  668. >>> .ivu-date-picker-editor .ivu-input {
  669. width: 210px;
  670. }
  671. >>> .ivu-input-prefix, >>> .ivu-input-suffix {
  672. height: 32px;
  673. line-height: 32px;
  674. }
  675. >>> .ivu-input-icon {
  676. height: 32px;
  677. line-height: 32px;
  678. }
  679. >>> .date-picker-main .ivu-date-picker-header {
  680. border-bottom: 0.0052083333rem solid #204384;
  681. }
  682. }
  683. .btn-container {
  684. display: flex;
  685. justify-content: flex-end;
  686. padding-bottom: 10px;
  687. }
  688. .common-form {
  689. display: flex;
  690. flex-wrap: wrap;
  691. }
  692. >>> .common-form-list .ivu-form-item {
  693. margin-bottom: 10px;
  694. }
  695. .manage-main-center {
  696. width: 100%;
  697. height: calc(100% - 150px);
  698. }
  699. .common-table {
  700. max-height: 100%;
  701. }
  702. >>> .common-table .ivu-table th {
  703. height: 51px;
  704. }
  705. >>> .common-table .ivu-table td {
  706. height: 51px;
  707. }
  708. >>> .common-table .ivu-spin-fix {
  709. top: 51px;
  710. }
  711. >>> .app-table .ivu-spin-fix {
  712. height: calc(100vh - 375px);
  713. }
  714. >>> .ivu-table-tip {
  715. background: url('../../../assets/images/noData.png') no-repeat center;
  716. }
  717. >>> .app-table .ivu-table-tip {
  718. height: calc(100vh - 375px);
  719. }
  720. >>> .common-table .ivu-table-tip table {
  721. display: none;
  722. }
  723. >>> .modal-table {
  724. overflow: auto !important;
  725. }
  726. >>> .modal-table .ivu-spin-fix {
  727. height: 200px;
  728. }
  729. >>> .modal-table .ivu-table-tip {
  730. height: 200px;
  731. }
  732. .common-page {
  733. margin-top: 15px;
  734. display: flex;
  735. align-items: center;
  736. justify-content: flex-end;
  737. position: absolute;
  738. bottom: 0;
  739. right: 0;
  740. }
  741. .common-page-total {
  742. color: #fff;
  743. padding-right: 10px;
  744. font-size: 14px;
  745. span {
  746. color #409EFF;
  747. }
  748. }
  749. >>> .modal-tabs-item {
  750. margin-top: 10px;
  751. }
  752. >>> .common-modal-top-text {
  753. font-size: 14px;
  754. font-weight: bold;
  755. color: #29A0FF;
  756. line-height: 42px;
  757. border-left: 3px solid #1590F1;
  758. padding-left: 12px;
  759. }
  760. >>> .common-modal-content {
  761. display: flex;
  762. width: 100%;
  763. justify-content: space-between;
  764. flex-wrap: wrap;
  765. margin-bottom: 15px;
  766. border-right: 1px solid #21437B;
  767. }
  768. >>> .modal-content-item {
  769. width: 50%;
  770. display: flex;
  771. }
  772. >>> .item-especial {
  773. width: 100%;
  774. }
  775. >>> .modal-content-item-name {
  776. width: 50%;
  777. height: 45px;
  778. line-height: 45px;
  779. background: #13305F;
  780. border-top: 1px solid #21437B;
  781. border-left: 1px solid #21437B;
  782. font-size: 14px;
  783. color: #F5F5F5;
  784. padding-left: 20px;
  785. }
  786. >>> .modal-content-item-value {
  787. width: 50%;
  788. height: 45px;
  789. line-height: 45px;
  790. background: #06214D;
  791. border-top: 1px solid #21437B;
  792. border-left: 1px solid #21437B;
  793. font-size: 14px;
  794. color: #F5F5F5;
  795. padding-left: 20px;
  796. }
  797. >>> .item-especial .modal-content-item-name{
  798. width: 25%;
  799. height: 45px;
  800. line-height: 45px;
  801. border-bottom: 1px solid #21437B;
  802. }
  803. >>> .item-especial .modal-content-item-value{
  804. width: 75%;
  805. height: 45px;
  806. line-height: 45px;
  807. border-bottom: 1px solid #21437B;
  808. }
  809. >>> .item-especial-bot .modal-content-item-name {
  810. border-bottom: 1px solid #21437B;
  811. }
  812. >>> .item-especial-bot .modal-content-item-value {
  813. border-bottom: 1px solid #21437B;
  814. }
  815. /deep/ .ivu-input::-webkit-input-placeholder{
  816. color: #718EBD;
  817. }
  818. /deep/ .ivu-input::-moz-placeholder{ /* Mozilla Firefox 19+ */
  819. color: #718EBD;
  820. }
  821. /deep/ .ivu-input::-moz-placeholder{ /* Mozilla Firefox 4 to 18 */
  822. color: #718EBD;
  823. }
  824. /deep/ .ivu-input::-ms-input-placeholder{ /* Internet Explorer 10-11 */
  825. color: #718EBD;
  826. }
  827. >>> .modal-content-item-value .ivu-tooltip {
  828. width: 100%;
  829. }
  830. >>> .modal-content-item-value .ivu-tooltip-rel {
  831. overflow: hidden;
  832. text-overflow:ellipsis;
  833. white-space: nowrap;
  834. }
  835. </style>