ItdmDeviceList.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341
  1. <template>
  2. <a-card :bordered="false">
  3. <!-- 查询区域 -->
  4. <div class="table-page-search-wrapper">
  5. <a-form layout="inline" @keyup.enter.native="searchQuery">
  6. <a-row :gutter="24">
  7. <a-col :xl="6" :lg="7" :md="8" :sm="24">
  8. <a-form-item label="设备名称">
  9. <a-input placeholder="请输入设备名称" v-model="queryParam.deviceName"></a-input>
  10. </a-form-item>
  11. </a-col>
  12. <a-col :xl="6" :lg="7" :md="8" :sm="24">
  13. <a-form-item label="设备类型">
  14. <a-input placeholder="请输入设备类型" v-model="queryParam.deviceType"></a-input>
  15. </a-form-item>
  16. </a-col>
  17. <template v-if="toggleSearchStatus">
  18. <a-col :xl="6" :lg="7" :md="8" :sm="24">
  19. <a-form-item label="设备状态">
  20. <j-dict-select-tag placeholder="请选择设备状态" v-model="queryParam.deviceStatus" dictCode="device_status"/>
  21. </a-form-item>
  22. </a-col>
  23. <a-col :xl="6" :lg="7" :md="8" :sm="24">
  24. <a-form-item label="是否已维护">
  25. <j-dict-select-tag placeholder="请选择是否已维护" v-model="queryParam.isRepair" dictCode="is_repair"/>
  26. </a-form-item>
  27. </a-col>
  28. </template>
  29. <a-col :xl="6" :lg="7" :md="8" :sm="24">
  30. <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
  31. <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
  32. <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
  33. <a @click="handleToggleSearch" style="margin-left: 8px">
  34. {{ toggleSearchStatus ? '收起' : '展开' }}
  35. <a-icon :type="toggleSearchStatus ? 'up' : 'down'"/>
  36. </a>
  37. </span>
  38. </a-col>
  39. </a-row>
  40. </a-form>
  41. </div>
  42. <!-- 查询区域-END -->
  43. <!-- 操作按钮区域 -->
  44. <div class="table-operator">
  45. <a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>
  46. <a-button type="primary" icon="download" @click="handleExportXls('设备表')">导出</a-button>
  47. <!-- <a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel">-->
  48. <!-- <a-button type="primary" icon="import">导入</a-button>-->
  49. <!-- </a-upload>-->
  50. <!-- 高级查询区域 -->
  51. <!-- <j-super-query :fieldList="superFieldList" ref="superQueryModal" @handleSuperQuery="handleSuperQuery"></j-super-query>-->
  52. <!-- <a-dropdown v-if="selectedRowKeys.length > 0">-->
  53. <!-- <a-menu slot="overlay">-->
  54. <!-- <a-menu-item key="1" @click="batchDel"><a-icon type="delete"/>删除</a-menu-item>-->
  55. <!-- </a-menu>-->
  56. <!-- <a-button style="margin-left: 8px"> 批量操作 <a-icon type="down" /></a-button>-->
  57. <!-- </a-dropdown>-->
  58. </div>
  59. <!-- table区域-begin -->
  60. <div>
  61. <!-- <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">-->
  62. <!-- <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>项-->
  63. <!-- <a style="margin-left: 24px" @click="onClearSelected">清空</a>-->
  64. <!-- </div>-->
  65. <a-table
  66. ref="table"
  67. size="middle"
  68. :scroll="{x:true}"
  69. bordered
  70. rowKey="id"
  71. :columns="columns"
  72. :dataSource="dataSource"
  73. :pagination="ipagination"
  74. :loading="loading"
  75. :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
  76. class="j-table-force-nowrap"
  77. @change="handleTableChange">
  78. <template slot="htmlSlot" slot-scope="text">
  79. <div v-html="text"></div>
  80. </template>
  81. <template slot="imgSlot" slot-scope="text,record">
  82. <span v-if="!text" style="font-size: 12px;font-style: italic;">无图片</span>
  83. <img v-else :src="getImgView(text)" :preview="record.id" height="25px" alt="" style="max-width:80px;font-size: 12px;font-style: italic;"/>
  84. </template>
  85. <template slot="fileSlot" slot-scope="text">
  86. <span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span>
  87. <a-button
  88. v-else
  89. :ghost="true"
  90. type="primary"
  91. icon="download"
  92. size="small"
  93. @click="downloadFile(text)">
  94. 下载
  95. </a-button>
  96. </template>
  97. <span slot="action" slot-scope="text, record">
  98. <a @click="handleEdit(record)">编辑</a>
  99. <a-divider type="vertical" />
  100. <a-dropdown>
  101. <a class="ant-dropdown-link">更多 <a-icon type="down" /></a>
  102. <a-menu slot="overlay">
  103. <a-menu-item>
  104. <!-- <a @click="handleDetail(record)">详情</a>-->
  105. <a-popconfirm :title="record.deviceStatus == 3 ? '确定取消设备故障吗': '确定设备出现故障吗'" @confirm="() => handleGuzhang(record)">
  106. <a>{{record.deviceStatus == 3 ? '取消故障状态': '设为故障状态'}}</a>
  107. </a-popconfirm>
  108. </a-menu-item>
  109. <a-menu-item v-if="record.izDelete == 1">
  110. <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id) ">
  111. <a>{{record.izDelete == 0 ? '不可删除': '删除'}}</a>
  112. </a-popconfirm>
  113. </a-menu-item>
  114. </a-menu>
  115. </a-dropdown>
  116. </span>
  117. <!-- <span slot="action2" slot-scope="text, item">-->
  118. <!-- <a-popconfirm :title="item.deviceStatus == 3 ? '确定取消设备故障吗': '确定设备出现故障吗'" @confirm="() => handleGuzhang(item)">-->
  119. <!-- <a>{{item.deviceStatus == 3 ? '非故障': '故障'}}</a>-->
  120. <!-- </a-popconfirm>-->
  121. <!-- </span>-->
  122. </a-table>
  123. </div>
  124. <itdm-device-modal ref="modalForm" @ok="modalFormOk"></itdm-device-modal>
  125. </a-card>
  126. </template>
  127. <script>
  128. import '@/assets/less/TableExpand.less'
  129. import { mixinDevice } from '@/utils/mixin'
  130. import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  131. import ItdmDeviceModal from './modules/ItdmDeviceModal'
  132. import {filterMultiDictText} from '@/components/dict/JDictSelectUtil'
  133. import {checkGuzhang} from '@/api/api'
  134. export default {
  135. name: 'ItdmDeviceList',
  136. mixins:[JeecgListMixin, mixinDevice],
  137. components: {
  138. ItdmDeviceModal
  139. },
  140. data () {
  141. return {
  142. /* 排序参数 */
  143. isorter: {
  144. column: 'id', // 排序字段
  145. order: 'asc' // 正序or倒叙
  146. },
  147. description: '设备表管理页面',
  148. // 表头
  149. columns: [
  150. {
  151. title: '#',
  152. dataIndex: '',
  153. key:'rowIndex',
  154. width:60,
  155. align:"center",
  156. customRender:function (t,r,index) {
  157. return parseInt(index)+1;
  158. }
  159. },
  160. {
  161. title:'设备名称',
  162. align:"center",
  163. dataIndex: 'deviceName'
  164. },
  165. {
  166. title:'重要性标准',
  167. align:"center",
  168. dataIndex: 'zyxbz_dictText'
  169. },
  170. {
  171. title:'试验单价',
  172. align:"center",
  173. dataIndex: 'danjia'
  174. },
  175. {
  176. title:'设备编号',
  177. align:"center",
  178. dataIndex: 'deviceNo'
  179. },
  180. {
  181. title:'设备规格',
  182. align:"center",
  183. dataIndex: 'deviceSpecification'
  184. },
  185. {
  186. title:'设备型号',
  187. align:"center",
  188. dataIndex: 'deviceModel'
  189. },
  190. {
  191. title:'设备状态',
  192. align:"center",
  193. dataIndex: 'deviceStatus_dictText'
  194. },
  195. {
  196. title:'设备类型',
  197. align:"center",
  198. dataIndex: 'deviceType'
  199. },
  200. {
  201. title:'维护时间',
  202. align:"center",
  203. dataIndex: 'repairTime'
  204. },
  205. {
  206. title:'维护人',
  207. align:"center",
  208. dataIndex: 'repairer'
  209. },
  210. {
  211. title:'维护记录',
  212. align:"center",
  213. dataIndex: 'record'
  214. },
  215. {
  216. title:'本次运行开始时间',
  217. align:"center",
  218. dataIndex: 'runStartTime'
  219. },
  220. {
  221. title:'设备运行标识',
  222. align:"center",
  223. dataIndex: 'biaoshi_dictText'
  224. },
  225. // {
  226. // title:'是否已维护',
  227. // align:"center",
  228. // dataIndex: 'isRepair_dictText'
  229. // },
  230. {
  231. title:'更新人',
  232. align:"center",
  233. dataIndex: 'updateBy'
  234. },
  235. {
  236. title:'更新日期',
  237. align:"center",
  238. dataIndex: 'updateTime'
  239. },
  240. // {
  241. // title: '故障判断',
  242. // dataIndex: 'action2',
  243. // align:"center",
  244. // fixed:"right",
  245. // scopedSlots: { customRender: 'action2' }
  246. // },
  247. {
  248. title: '操作',
  249. dataIndex: 'action',
  250. align:"center",
  251. fixed:"right",
  252. width:70,
  253. scopedSlots: { customRender: 'action' }
  254. }
  255. ],
  256. url: {
  257. list: "/itdmDevice/itdmDevice/list",
  258. delete: "/itdmDevice/itdmDevice/delete",
  259. deleteBatch: "/itdmDevice/itdmDevice/deleteBatch",
  260. exportXlsUrl: "/itdmDevice/itdmDevice/exportXls",
  261. importExcelUrl: "itdmDevice/itdmDevice/importExcel",
  262. },
  263. dictOptions:{},
  264. superFieldList:[],
  265. deviceForm:{},
  266. }
  267. },
  268. created() {
  269. this.getSuperFieldList();
  270. },
  271. computed: {
  272. importExcelUrl: function(){
  273. return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
  274. },
  275. },
  276. methods: {
  277. initDictConfig(){
  278. },
  279. getSuperFieldList(){
  280. let fieldList=[];
  281. fieldList.push({type:'string',value:'updateBy',text:'更新人',dictCode:''})
  282. fieldList.push({type:'datetime',value:'updateTime',text:'更新日期'})
  283. fieldList.push({type:'string',value:'deviceName',text:'设备名称',dictCode:''})
  284. fieldList.push({type:'string',value:'deviceType',text:'设备类型',dictCode:''})
  285. fieldList.push({type:'string',value:'deviceNo',text:'设备编号',dictCode:''})
  286. fieldList.push({type:'int',value:'deviceStatus',text:'设备状态',dictCode:'device_status'})
  287. fieldList.push({type:'datetime',value:'repairTime',text:'维护时间'})
  288. fieldList.push({type:'string',value:'repairer',text:'维护人',dictCode:''})
  289. fieldList.push({type:'string',value:'record',text:'维护记录',dictCode:''})
  290. fieldList.push({type:'string',value:'deviceSpecification',text:'设备规格',dictCode:''})
  291. fieldList.push({type:'string',value:'deviceModel',text:'设备型号',dictCode:''})
  292. fieldList.push({type:'string',value:'deviceLife',text:'计量有效期',dictCode:''})
  293. fieldList.push({type:'datetime',value:'runStartTime',text:'本次运行开始时间'})
  294. fieldList.push({type:'int',value:'biaoshi',text:'设备运行标识',dictCode:'biaoshi'})
  295. fieldList.push({type:'int',value:'isRepair',text:'是否已维护',dictCode:'is_repair'})
  296. fieldList.push({type:'int',value:'equipmenttreeid',text:'设备树id',dictCode:''})
  297. fieldList.push({type:'string',value:'address',text:'安装地点',dictCode:''})
  298. fieldList.push({type:'int',value:'specid',text:'区域',dictCode:''})
  299. fieldList.push({type:'string',value:'remark',text:'备注',dictCode:''})
  300. this.superFieldList = fieldList
  301. },
  302. handleGuzhang(item){
  303. console.log("item",item,item.deviceStatus)
  304. const _this = this
  305. _this.deviceForm = JSON.parse(JSON.stringify(item))
  306. console.log(_this.deviceForm)
  307. if(item.deviceStatus == 3){
  308. _this.deviceForm.deviceStatus = 4
  309. // console.log(_this.deviceForm,item)
  310. checkGuzhang(_this.deviceForm).then((res) => {
  311. console.log(res)
  312. this.loadData();
  313. })
  314. }else{
  315. _this.deviceForm.deviceStatus = 3
  316. checkGuzhang(_this.deviceForm).then((res) => {
  317. console.log(res)
  318. this.loadData();
  319. })
  320. }
  321. }
  322. }
  323. }
  324. </script>
  325. <style scoped>
  326. @import '~@assets/less/common.less';
  327. </style>