InspectContentList.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282
  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.contentname"></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="设备id">
  14. <a-input placeholder="请输入设备id" v-model="queryParam.equipmentid"></a-input>
  15. </a-form-item>
  16. </a-col> -->
  17. <!-- <a-col :xl="6" :lg="7" :md="8" :sm="24">
  18. <a-form-item label="设备类型">
  19. <j-tree-select
  20. ref="treeSelect"
  21. placeholder="请选择设备类型"
  22. v-model="queryParam.equipdefid"
  23. dict="tpm_equipment_tree,name,id"
  24. pidField="parentid"
  25. pidValue="0"
  26. hasChildField="has_child"
  27. >
  28. </j-tree-select>
  29. </a-form-item>
  30. </a-col> -->
  31. <a-col :xl="6" :lg="7" :md="8" :sm="24">
  32. <a-form-item label="巡检项目类型">
  33. <j-dict-select-tag type="list" v-model="queryParam.classification" dictCode="inspect_item_type" placeholder="请选择巡检项目类型" />
  34. </a-form-item>
  35. </a-col>
  36. <template v-if="toggleSearchStatus">
  37. <a-col :xl="6" :lg="7" :md="8" :sm="24">
  38. <a-form-item label="状态">
  39. <j-dict-select-tag v-model="queryParam.status" dictCode="inspect_content_status" placeholder="请选择状态" />
  40. </a-form-item>
  41. </a-col>
  42. </template>
  43. <a-col :xl="6" :lg="7" :md="8" :sm="24">
  44. <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
  45. <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
  46. <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
  47. <a @click="handleToggleSearch" style="margin-left: 8px">
  48. {{ toggleSearchStatus ? '收起' : '展开' }}
  49. <a-icon :type="toggleSearchStatus ? 'up' : 'down'"/>
  50. </a>
  51. </span>
  52. </a-col>
  53. </a-row>
  54. </a-form>
  55. </div>
  56. <!-- 查询区域-END -->
  57. <!-- 操作按钮区域 -->
  58. <div class="table-operator">
  59. <a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>
  60. <!-- <a-button type="primary" icon="download" @click="handleExportXls('巡检项目')">导出</a-button>
  61. <a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel">
  62. <a-button type="primary" icon="import">导入</a-button>
  63. </a-upload> -->
  64. <!-- 高级查询区域 -->
  65. <!-- <j-super-query :fieldList="superFieldList" ref="superQueryModal" @handleSuperQuery="handleSuperQuery"></j-super-query> -->
  66. <a-dropdown v-if="selectedRowKeys.length > 0">
  67. <a-menu slot="overlay">
  68. <a-menu-item key="1" @click="batchDel"><a-icon type="delete"/>删除</a-menu-item>
  69. </a-menu>
  70. <a-button style="margin-left: 8px"> 批量操作 <a-icon type="down" /></a-button>
  71. </a-dropdown>
  72. </div>
  73. <!-- table区域-begin -->
  74. <div>
  75. <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
  76. <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>项
  77. <a style="margin-left: 24px" @click="onClearSelected">清空</a>
  78. </div>
  79. <a-table
  80. ref="table"
  81. size="middle"
  82. :scroll="{x:true}"
  83. bordered
  84. rowKey="id"
  85. :columns="columns"
  86. :dataSource="dataSource"
  87. :pagination="ipagination"
  88. :loading="loading"
  89. :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
  90. class="j-table-force-nowrap"
  91. @change="handleTableChange">
  92. <template slot="htmlSlot" slot-scope="text">
  93. <div v-html="text"></div>
  94. </template>
  95. <template slot="imgSlot" slot-scope="text,record">
  96. <span v-if="!text" style="font-size: 12px;font-style: italic;">无图片</span>
  97. <img v-else :src="getImgView(text)" :preview="record.id" height="25px" alt="" style="max-width:80px;font-size: 12px;font-style: italic;"/>
  98. </template>
  99. <template slot="fileSlot" slot-scope="text">
  100. <span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span>
  101. <a-button
  102. v-else
  103. :ghost="true"
  104. type="primary"
  105. icon="download"
  106. size="small"
  107. @click="downloadFile(text)">
  108. 下载
  109. </a-button>
  110. </template>
  111. <template slot="status" slot-scope="text, record">
  112. <a-switch :checked="record.status === '0' ? true : false" checked-children="启动" un-checked-children="停用" @click="changeStatus(record)"/>
  113. </template>
  114. <span slot="action" slot-scope="text, record">
  115. <a @click="handleEdit(record)">编辑</a>
  116. <a-divider type="vertical" />
  117. <a-dropdown>
  118. <a class="ant-dropdown-link">更多 <a-icon type="down" /></a>
  119. <a-menu slot="overlay">
  120. <a-menu-item>
  121. <a @click="handleDetail(record)">详情</a>
  122. </a-menu-item>
  123. <a-menu-item>
  124. <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
  125. <a>删除</a>
  126. </a-popconfirm>
  127. </a-menu-item>
  128. </a-menu>
  129. </a-dropdown>
  130. </span>
  131. </a-table>
  132. </div>
  133. <inspect-content-modal ref="modalForm" @ok="modalFormOk"></inspect-content-modal>
  134. </a-card>
  135. </template>
  136. <script>
  137. import { httpAction, getAction } from '@/api/manage'
  138. import '@/assets/less/TableExpand.less'
  139. import { mixinDevice } from '@/utils/mixin'
  140. import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  141. import InspectContentModal from './modules/InspectContentModal'
  142. export default {
  143. name: 'InspectContentList',
  144. mixins:[JeecgListMixin, mixinDevice],
  145. components: {
  146. InspectContentModal
  147. },
  148. data () {
  149. return {
  150. description: '巡检项目管理页面',
  151. // 表头
  152. columns: [
  153. {
  154. title: '序号',
  155. dataIndex: '',
  156. key:'rowIndex',
  157. width:60,
  158. align:"center",
  159. customRender:function (t,r,index) {
  160. return parseInt(index)+1;
  161. }
  162. },
  163. {
  164. title:'巡检项目编号',
  165. align:"center",
  166. dataIndex: 'contentcode'
  167. },
  168. {
  169. title:'巡检项目名称',
  170. align:"center",
  171. dataIndex: 'contentname'
  172. },
  173. {
  174. title:'巡检项目类型',
  175. align:"center",
  176. dataIndex: 'classification_dictText'
  177. },
  178. {
  179. title:'设备名称',
  180. align:"center",
  181. dataIndex: 'equipmentname'
  182. },
  183. {
  184. title:'状态',
  185. align:"center",
  186. dataIndex: 'status',
  187. scopedSlots: { customRender: 'status' }
  188. },
  189. {
  190. title:'备注',
  191. align:"center",
  192. dataIndex: 'remark'
  193. },
  194. {
  195. title: '操作',
  196. dataIndex: 'action',
  197. align:"center",
  198. fixed:"right",
  199. width:147,
  200. scopedSlots: { customRender: 'action' }
  201. }
  202. ],
  203. url: {
  204. list: "/cmmsInspectContent/cmmsInspectContent/list",
  205. delete: "/cmmsInspectContent/cmmsInspectContent/delete",
  206. deleteBatch: "/cmmsInspectContent/cmmsInspectContent/deleteBatch",
  207. exportXlsUrl: "/cmmsInspectContent/cmmsInspectContent/exportXls",
  208. importExcelUrl: "cmmsInspectContent/cmmsInspectContent/importExcel",
  209. updateStatus: "/cmmsInspectContent/cmmsInspectContent/updatestatus",
  210. },
  211. dictOptions:{},
  212. superFieldList:[],
  213. }
  214. },
  215. created() {
  216. this.getSuperFieldList();
  217. },
  218. computed: {
  219. importExcelUrl: function(){
  220. return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
  221. },
  222. },
  223. methods: {
  224. changeStatus(record){
  225. // console.log(record.status)
  226. const that = this
  227. that.$confirm({
  228. title: "提示",
  229. content: record.status ==='0'?'确定停用吗?':'确定启用吗?',
  230. onOk() {
  231. var status = {
  232. id: record.id,
  233. equipmentid: record.equipmentid,
  234. status: record.status ==='0' ? '1' : '0',
  235. }
  236. httpAction(that.url.updateStatus,status,'post').then((res)=>{
  237. if(res.success){
  238. that.loadData()
  239. that.$message.success(res.message);
  240. }else{
  241. that.$message.warning(res.message);
  242. }
  243. })
  244. },
  245. onCancel() {
  246. }
  247. });
  248. },
  249. initDictConfig(){
  250. },
  251. getSuperFieldList(){
  252. let fieldList=[];
  253. fieldList.push({type:'string',value:'contentcode',text:'巡检项目编号',dictCode:''})
  254. fieldList.push({type:'string',value:'contentname',text:'巡检项目名称',dictCode:''})
  255. fieldList.push({type:'string',value:'equipmentid',text:'设备id',dictCode:''})
  256. fieldList.push({type:'string',value:'status',text:'状态:启用:0、禁用:1',dictCode:''})
  257. fieldList.push({type:'string',value:'remark',text:'备注',dictCode:''})
  258. this.superFieldList = fieldList
  259. }
  260. }
  261. }
  262. </script>
  263. <style scoped>
  264. @import '~@assets/less/common.less';
  265. .ant-card{
  266. height: 100%;
  267. overflow: auto;
  268. }
  269. </style>