SbInfoForLocation.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465
  1. <template>
  2. <a-card :bordered="false">
  3. <div class="table-page-search-wrapper">
  4. <a-form layout="inline">
  5. <a-row :gutter="48">
  6. <a-col :md="8" :sm="24">
  7. <a-form-item label="关键字">
  8. <a-input v-model.trim="queryParam.keyword" placeholder="请输入名称/编码"/>
  9. </a-form-item>
  10. </a-col>
  11. <!-- <a-col :md="8" :sm="24">
  12. <a-form-item label="上层设备类型">
  13. <a-tree-select
  14. style="width: 100%"
  15. :dropdownStyle="{ maxHeight: '400px', overflow: 'auto' }"
  16. :treeData="treeData"
  17. :treeNodeFilterProp="'title'"
  18. :showSearch="true"
  19. v-model="queryParam.parentId"
  20. placeholder="请选择"
  21. >
  22. </a-tree-select>
  23. </a-form-item>
  24. </a-col>-->
  25. <a-col :md="8 || 24" :sm="24">
  26. <span class="table-page-search-submitButtons">
  27. <a-button type="primary" @click="$refs.table.refresh(true)">查询</a-button>
  28. <a-button style="margin-left: 8px" @click="resetSearchForm">重置</a-button>
  29. </span>
  30. </a-col>
  31. </a-row>
  32. </a-form>
  33. </div>
  34. <div class="table-operator" style="margin-bottom: 8px;">
  35. <a-button style="margin-left: 8px" v-if="$auth('sb-infos-export')" type="primary" icon="download" @click="doExport">导出</a-button>
  36. </div>
  37. <s-table
  38. ref="table"
  39. size="default"
  40. rowKey="id"
  41. :columns="columns"
  42. :data="loadData"
  43. :alert="options.alert"
  44. :rowSelection="options.rowSelection"
  45. :scroll="{x: 1500, y: BaseTool.Constant.scrollY}"
  46. showPagination="auto"
  47. >
  48. <span slot="action" slot-scope="record">
  49. <template>
  50. <a @click="locationListView(record)">位号列表</a>
  51. </template>
  52. </span>
  53. <span slot="status" slot-scope="text">
  54. <badge
  55. :status="DictCache.COLOR.SB_INFO_STATUS[text]"
  56. :text="statusMap[text]" />
  57. </span>
  58. <span slot="wbFile" slot-scope="record">
  59. <template>
  60. <a @click="handleRepairFilePreview(record)">预览</a>
  61. <a-divider type="vertical" />
  62. <a @click="handleRepairFileDownload(record)">下载</a>
  63. </template>
  64. </span>
  65. <span slot="useFile" slot-scope="record">
  66. <template>
  67. <a @click="handleUseFilePreview(record)">预览</a>
  68. <a-divider type="vertical" />
  69. <a @click="handleUseFileDownload(record)">下载</a>
  70. </template>
  71. </span>
  72. <span slot="checkFile" slot-scope="record">
  73. <template>
  74. <a @click="handleCheckFilePreview(record)">预览</a>
  75. <a-divider type="vertical" />
  76. <a @click="handleCheckFileDownload(record)">下载</a>
  77. </template>
  78. </span>
  79. </s-table>
  80. <base-form ref="baseModal" @ok="handleOk"/>
  81. <detail ref="detailModal"/>
  82. <download-modal ref="downloadModal"/>
  83. <preview-modal ref="previewModal"/>
  84. <location-list ref="locationList" />
  85. </a-card>
  86. </template>
  87. <script>
  88. import { STable, Ellipsis } from '@/components'
  89. import BaseForm from './modules/BaseForm'
  90. import Detail from './modules/Detail'
  91. import DownloadModal from '@/views/download/DownloadModal'
  92. import PreviewModal from '@/views/preview/PreviewModal'
  93. import { getSbInfoPage, exportSbInfo } from '@/api/sb/info'
  94. import LocationList from '@/views/sb/location/modules/LocationList'
  95. // 以设备为维度操作位号
  96. export default {
  97. name: 'SbInfoForPartInfo',
  98. components: {
  99. STable,
  100. Ellipsis,
  101. BaseForm,
  102. LocationList,
  103. Detail,
  104. DownloadModal,
  105. PreviewModal
  106. },
  107. data () {
  108. return {
  109. // 查询参数
  110. queryParam: {
  111. id: this.$route.query.id
  112. },
  113. depreciationTypeMap: {},
  114. levelMap: {},
  115. statusMap: {},
  116. unitMap: {},
  117. sourceTypeMap: {},
  118. treeData: [],
  119. // 表头
  120. columns: [
  121. {
  122. title: '序号',
  123. dataIndex: 'index',
  124. width: 80,
  125. checked: true,
  126. customRender: (text, record, index) => {
  127. return `${(this.$refs.table.localPagination.current - 1) * this.$refs.table.localPagination.pageSize + index + 1}`
  128. }
  129. },
  130. {
  131. title: '设备编号',
  132. checked: true,
  133. dataIndex: 'no',
  134. width: 200
  135. },
  136. {
  137. title: '设备位号',
  138. checked: true,
  139. dataIndex: 'positionNo',
  140. width: 200
  141. },
  142. {
  143. title: '设备名称',
  144. checked: true,
  145. dataIndex: 'name',
  146. width: 200
  147. },
  148. {
  149. title: '设备类型',
  150. checked: true,
  151. dataIndex: 'type',
  152. width: 200,
  153. customRender: (text, record, index) => {
  154. return record.typeName
  155. }
  156. },
  157. {
  158. title: '设备等级',
  159. checked: true,
  160. dataIndex: 'level',
  161. width: 200,
  162. customRender: (text, record, index) => {
  163. return this.BaseTool.Object.getField(this.levelMap, text)
  164. }
  165. },
  166. {
  167. title: '设备原值',
  168. dataIndex: 'initialValue',
  169. width: 200,
  170. checked: true,
  171. customRender: (text, record, index) => {
  172. return this.BaseTool.Amount.formatter(text)
  173. }
  174. },
  175. {
  176. title: '当前价值',
  177. dataIndex: 'currentValue',
  178. width: 200,
  179. checked: true,
  180. customRender: (text, record, index) => {
  181. return this.BaseTool.Amount.formatter(text)
  182. }
  183. },
  184. {
  185. title: '已折旧价值',
  186. dataIndex: 'cutValue',
  187. width: 200,
  188. checked: true,
  189. customRender: (text, record, index) => {
  190. return this.BaseTool.Amount.formatter(text)
  191. }
  192. },
  193. {
  194. title: '生产商',
  195. dataIndex: 'producerId',
  196. width: 200,
  197. checked: true
  198. },
  199. {
  200. title: '设备来源方式',
  201. dataIndex: 'sourceType',
  202. width: 200,
  203. checked: true,
  204. customRender: (text, record, index) => {
  205. return this.BaseTool.Object.getField(this.sourceTypeMap, text)
  206. }
  207. },
  208. {
  209. title: '来源设备id',
  210. dataIndex: 'sourceSbId',
  211. width: 200,
  212. checked: true,
  213. customRender: (text, record, index) => {
  214. return record.sourceSbName
  215. }
  216. },
  217. {
  218. title: '上级设备',
  219. dataIndex: 'parentId',
  220. width: 200,
  221. checked: true,
  222. customRender: (text, record, index) => {
  223. return record.parentName
  224. }
  225. },
  226. {
  227. title: '计量单位',
  228. dataIndex: 'unit',
  229. width: 200,
  230. checked: true,
  231. customRender: (text, record, index) => {
  232. return this.BaseTool.Object.getField(this.unitMap, text)
  233. }
  234. },
  235. {
  236. title: '设备位置',
  237. dataIndex: 'positionId',
  238. width: 200,
  239. checked: true,
  240. customRender: (text, record, index) => {
  241. return record.positionName
  242. }
  243. },
  244. {
  245. title: '规格型号',
  246. dataIndex: 'guigeId',
  247. width: 200,
  248. checked: true,
  249. customRender: (text, record, index) => {
  250. return record.guigeName
  251. }
  252. },
  253. {
  254. title: '保管人',
  255. dataIndex: 'saveUser',
  256. checked: true,
  257. width: 200
  258. },
  259. {
  260. title: '购置日期',
  261. dataIndex: 'buyDate',
  262. checked: true,
  263. width: 200
  264. },
  265. {
  266. title: '投用日期',
  267. dataIndex: 'startDate',
  268. checked: true,
  269. width: 200
  270. },
  271. {
  272. title: '下次检定日期',
  273. dataIndex: 'nextCheckDate',
  274. checked: true,
  275. width: 200
  276. },
  277. {
  278. title: '保修截至日期',
  279. dataIndex: 'guaranteeDate',
  280. checked: true,
  281. width: 200
  282. },
  283. {
  284. title: '预计工作年限',
  285. dataIndex: 'workYear',
  286. checked: true,
  287. width: 200
  288. },
  289. {
  290. title: '预计报废日期',
  291. dataIndex: 'retirementDate',
  292. checked: true,
  293. width: 200
  294. },
  295. {
  296. title: '折旧方式',
  297. dataIndex: 'depreciationType',
  298. checked: true,
  299. width: 200,
  300. customRender: (text, record, index) => {
  301. return this.BaseTool.Object.getField(this.depreciationTypeMap, text)
  302. }
  303. },
  304. {
  305. title: '维保手册',
  306. dataIndex: 'wbFile',
  307. checked: true,
  308. width: 200,
  309. scopedSlots: { customRender: 'wbFile' }
  310. },
  311. {
  312. title: '使用手册',
  313. dataIndex: 'useFile',
  314. width: 200,
  315. checked: true,
  316. scopedSlots: { customRender: 'useFile' }
  317. },
  318. {
  319. title: '验收文件',
  320. dataIndex: 'checkFile',
  321. width: 200,
  322. checked: true,
  323. scopedSlots: { customRender: 'checkFile' }
  324. },
  325. {
  326. title: '状态',
  327. checked: true,
  328. dataIndex: 'status',
  329. width: 200,
  330. scopedSlots: { customRender: 'status' }
  331. },
  332. {
  333. title: '备注',
  334. dataIndex: 'remark',
  335. checked: true,
  336. width: 200
  337. },
  338. {
  339. title: '创建日期',
  340. dataIndex: 'createdTime',
  341. checked: true,
  342. width: 200
  343. },
  344. {
  345. title: '操作',
  346. key: 'action',
  347. checked: true,
  348. width: '200px',
  349. align: 'center',
  350. fixed: 'right',
  351. scopedSlots: { width: 200, customRender: 'action' }
  352. }
  353. ],
  354. // 加载数据方法 必须为 Promise 对象
  355. loadData: parameter => {
  356. parameter = {
  357. ...parameter,
  358. ...this.queryParam,
  359. dataScope: {
  360. sortBy: 'desc',
  361. sortName: 'update_time'
  362. }
  363. }
  364. return getSbInfoPage(Object.assign(parameter, this.queryParam))
  365. .then(res => {
  366. return res.data
  367. })
  368. },
  369. selectedRowKeys: [],
  370. selectedRows: [],
  371. options: {
  372. alert: { show: true, clear: () => { this.selectedRowKeys = [] } },
  373. rowSelection: {
  374. selectedRowKeys: this.selectedRowKeys,
  375. onChange: this.onSelectChange
  376. }
  377. },
  378. optionAlertShow: false
  379. }
  380. },
  381. created () {
  382. this.tableOption()
  383. this.depreciationTypeMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SBINFO_DEPRECIATIONTYPE)
  384. this.levelMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SBINFO_LEVEL)
  385. this.statusMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SB_INFO_STATUS)
  386. this.unitMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SBINFO_UNIT)
  387. this.sourceTypeMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SBTYPE_SOURCETYPE)
  388. },
  389. methods: {
  390. tableOption () {
  391. if (!this.optionAlertShow) {
  392. this.options = {
  393. alert: { show: true, clear: () => { this.selectedRowKeys = [] } },
  394. rowSelection: {
  395. selectedRowKeys: this.selectedRowKeys,
  396. onChange: this.onSelectChange,
  397. getCheckboxProps: record => ({
  398. props: {
  399. disabled: false,
  400. name: record.id
  401. }
  402. })
  403. }
  404. }
  405. this.optionAlertShow = true
  406. } else {
  407. this.options = {
  408. alert: false,
  409. rowSelection: null
  410. }
  411. this.optionAlertShow = false
  412. }
  413. },
  414. locationListView (record) {
  415. const modal = this.$refs.locationList
  416. modal.base({ sbId: record.id }, { sbId: record.id })
  417. },
  418. handleOk () {
  419. this.setTree()
  420. this.$refs.table.refresh()
  421. },
  422. onSelectChange (selectedRowKeys, selectedRows) {
  423. this.selectedRowKeys = selectedRowKeys
  424. this.selectedRows = selectedRows
  425. },
  426. resetSearchForm () {
  427. this.queryParam = {
  428. }
  429. this.$refs.table.refresh(true)
  430. },
  431. doExport () {
  432. const parameter = {
  433. ...this.queryParam
  434. }
  435. exportSbInfo(parameter).then(file => {
  436. this.BaseTool.UPLOAD.downLoadExportExcel(file)
  437. })
  438. },
  439. handleRepairFilePreview (record) {
  440. console.log(record, 87878)
  441. this.$refs.previewModal.base(record.id, this.DictCache.VALUE.FILE_MODULE.SBINFO_REPAIRFILE)
  442. },
  443. handleRepairFileDownload (record) {
  444. // this.$refs.downloadModal.base(record.id, this.DictCache.VALUE.FILE_MODULE.SBINFO_REPAIRFILE, getDownloadUrl(record.id))
  445. },
  446. handleUseFilePreview (record) {
  447. this.$refs.previewModal.base(record.id, this.DictCache.VALUE.FILE_MODULE.SBINFO_USEFILE)
  448. },
  449. handleUseFileDownload (record) {
  450. // this.$refs.downloadModal.base(record.id, this.DictCache.VALUE.FILE_MODULE.SBINFO_USEFILE, getDownloadUrl(record.id))
  451. },
  452. handleCheckFilePreview (record) {
  453. this.$refs.previewModal.base(record.id, this.DictCache.VALUE.FILE_MODULE.SBINFO_RECHECKFILE)
  454. },
  455. handleCheckFileDownload (record) {
  456. // this.$refs.downloadModal.base(record.id, this.DictCache.VALUE.FILE_MODULE.SBINFO_RECHECKFILE, getDownloadUrl(record.id))
  457. }
  458. }
  459. }
  460. </script>