SbInfoForPartInfo.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444
  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="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">
  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="{y: BaseTool.Constant.scrollY }"
  46. showPagination="auto"
  47. >
  48. <span slot="action" slot-scope="record">
  49. <template>
  50. <a @click="partInfoListView(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. <part-info-list ref="partInfoList" />
  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 PartInfoList from '@/views/part/info/modules/PartInfoList'
  95. // 以设备为维度操作部件
  96. export default {
  97. name: 'SbInfoForPartInfo',
  98. components: {
  99. STable,
  100. Ellipsis,
  101. BaseForm,
  102. PartInfoList,
  103. Detail,
  104. DownloadModal,
  105. PreviewModal
  106. },
  107. data () {
  108. return {
  109. // 查询参数
  110. queryParam: {
  111. },
  112. depreciationTypeMap: {},
  113. levelMap: {},
  114. statusMap: {},
  115. unitMap: {},
  116. sourceTypeMap: {},
  117. treeData: [],
  118. // 表头
  119. columns: [
  120. {
  121. title: '序号',
  122. dataIndex: 'index',
  123. width: 80,
  124. checked: true,
  125. customRender: (text, record, index) => {
  126. return `${(this.$refs.table.localPagination.current - 1) * this.$refs.table.localPagination.pageSize + index + 1}`
  127. }
  128. },
  129. {
  130. title: '设备编号',
  131. checked: true,
  132. dataIndex: 'no',
  133. width: 200
  134. },
  135. {
  136. title: '财务编码',
  137. checked: true,
  138. dataIndex: 'financingNo',
  139. width: 200
  140. },
  141. {
  142. title: '设备名称',
  143. checked: true,
  144. dataIndex: 'name',
  145. width: 200
  146. },
  147. {
  148. title: '设备类型',
  149. checked: true,
  150. dataIndex: 'type',
  151. width: 200,
  152. customRender: (text, record, index) => {
  153. return record.typeName
  154. }
  155. },
  156. {
  157. title: '设备等级',
  158. checked: true,
  159. dataIndex: 'level',
  160. width: 200,
  161. customRender: (text, record, index) => {
  162. return this.BaseTool.Object.getField(this.levelMap, text)
  163. }
  164. },
  165. {
  166. title: '设备原值',
  167. dataIndex: 'initialValue',
  168. width: 200,
  169. customRender: (text, record, index) => {
  170. return this.BaseTool.Amount.formatter(text)
  171. }
  172. },
  173. {
  174. title: '当前价值',
  175. dataIndex: 'currentValue',
  176. width: 200,
  177. customRender: (text, record, index) => {
  178. return this.BaseTool.Amount.formatter(text)
  179. }
  180. },
  181. {
  182. title: '已折旧价值',
  183. dataIndex: 'cutValue',
  184. width: 200,
  185. customRender: (text, record, index) => {
  186. return this.BaseTool.Amount.formatter(text)
  187. }
  188. },
  189. {
  190. title: '生产商',
  191. dataIndex: 'producerId',
  192. width: 200,
  193. customRender: (text, record, index) => {
  194. return record.producerName
  195. }
  196. },
  197. {
  198. title: '设备来源方式',
  199. dataIndex: 'sourceType',
  200. width: 200,
  201. customRender: (text, record, index) => {
  202. return this.BaseTool.Object.getField(this.sourceTypeMap, text)
  203. }
  204. },
  205. {
  206. title: '来源设备id',
  207. dataIndex: 'sourceSbId',
  208. width: 200,
  209. customRender: (text, record, index) => {
  210. return record.sourceSbName
  211. }
  212. },
  213. {
  214. title: '上级设备',
  215. dataIndex: 'parentId',
  216. width: 200,
  217. customRender: (text, record, index) => {
  218. return record.parentName
  219. }
  220. },
  221. {
  222. title: '单位',
  223. dataIndex: 'unit',
  224. width: 200,
  225. customRender: (text, record, index) => {
  226. return this.BaseTool.Object.getField(this.unitMap, text)
  227. }
  228. },
  229. {
  230. title: '所属车间',
  231. dataIndex: 'positionId',
  232. width: 200,
  233. customRender: (text, record, index) => {
  234. return record.positionName
  235. }
  236. },
  237. {
  238. title: '规格型号',
  239. dataIndex: 'guigeId',
  240. width: 200,
  241. customRender: (text, record, index) => {
  242. return record.guigeName
  243. }
  244. },
  245. {
  246. title: '保管人',
  247. dataIndex: 'saveUser',
  248. width: 200
  249. },
  250. {
  251. title: '购置日期',
  252. dataIndex: 'buyDate',
  253. width: 200
  254. },
  255. {
  256. title: '投用日期',
  257. dataIndex: 'startDate',
  258. width: 200
  259. },
  260. {
  261. title: '下次检定日期',
  262. dataIndex: 'nextCheckDate',
  263. width: 200
  264. },
  265. {
  266. title: '保修截至日期',
  267. dataIndex: 'guaranteeDate',
  268. width: 200
  269. },
  270. {
  271. title: '预计工作年限',
  272. dataIndex: 'workYear',
  273. width: 200
  274. },
  275. {
  276. title: '预计报废日期',
  277. dataIndex: 'retirementDate',
  278. width: 200
  279. },
  280. {
  281. title: '折旧方式',
  282. dataIndex: 'depreciationType',
  283. width: 200,
  284. customRender: (text, record, index) => {
  285. return this.BaseTool.Object.getField(this.depreciationTypeMap, text)
  286. }
  287. },
  288. {
  289. title: '维保手册',
  290. dataIndex: 'wbFile',
  291. width: 200,
  292. scopedSlots: { customRender: 'wbFile' }
  293. },
  294. {
  295. title: '使用手册',
  296. dataIndex: 'useFile',
  297. width: 200,
  298. scopedSlots: { customRender: 'useFile' }
  299. },
  300. {
  301. title: '验收文件',
  302. dataIndex: 'checkFile',
  303. width: 200,
  304. scopedSlots: { customRender: 'checkFile' }
  305. },
  306. {
  307. title: '状态',
  308. checked: true,
  309. dataIndex: 'status',
  310. width: 200,
  311. scopedSlots: { customRender: 'status' }
  312. },
  313. {
  314. title: '备注',
  315. dataIndex: 'remark',
  316. width: 200
  317. },
  318. {
  319. title: '创建日期',
  320. dataIndex: 'createdTime',
  321. width: 200
  322. },
  323. {
  324. title: '操作',
  325. key: 'action',
  326. checked: true,
  327. width: '200px',
  328. align: 'center',
  329. fixed: 'right',
  330. scopedSlots: { width: 200, customRender: 'action' }
  331. }
  332. ],
  333. // 加载数据方法 必须为 Promise 对象
  334. loadData: parameter => {
  335. parameter = {
  336. ...parameter,
  337. ...this.queryParam,
  338. dataScope: {
  339. sortBy: 'desc',
  340. sortName: 'update_time'
  341. }
  342. }
  343. return getSbInfoPage(Object.assign(parameter, this.queryParam))
  344. .then(res => {
  345. return res.data
  346. })
  347. },
  348. selectedRowKeys: [],
  349. selectedRows: [],
  350. options: {
  351. alert: { show: true, clear: () => { this.selectedRowKeys = [] } },
  352. rowSelection: {
  353. selectedRowKeys: this.selectedRowKeys,
  354. onChange: this.onSelectChange
  355. }
  356. },
  357. optionAlertShow: false
  358. }
  359. },
  360. created () {
  361. this.tableOption()
  362. this.depreciationTypeMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SBINFO_DEPRECIATIONTYPE)
  363. this.levelMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SBINFO_LEVEL)
  364. this.statusMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SB_INFO_STATUS)
  365. this.unitMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SBINFO_UNIT)
  366. this.sourceTypeMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SBTYPE_SOURCETYPE)
  367. },
  368. methods: {
  369. tableOption () {
  370. if (!this.optionAlertShow) {
  371. this.options = {
  372. alert: { show: true, clear: () => { this.selectedRowKeys = [] } },
  373. rowSelection: {
  374. selectedRowKeys: this.selectedRowKeys,
  375. onChange: this.onSelectChange,
  376. getCheckboxProps: record => ({
  377. props: {
  378. disabled: false,
  379. name: record.id
  380. }
  381. })
  382. }
  383. }
  384. this.optionAlertShow = true
  385. } else {
  386. this.options = {
  387. alert: false,
  388. rowSelection: null
  389. }
  390. this.optionAlertShow = false
  391. }
  392. },
  393. partInfoListView (record) {
  394. const modal = this.$refs.partInfoList
  395. modal.base({ sbId: record.id }, { sbId: record.id })
  396. },
  397. handleOk () {
  398. this.setTree()
  399. this.$refs.table.refresh()
  400. },
  401. onSelectChange (selectedRowKeys, selectedRows) {
  402. this.selectedRowKeys = selectedRowKeys
  403. this.selectedRows = selectedRows
  404. },
  405. resetSearchForm () {
  406. this.queryParam = {
  407. }
  408. this.$refs.table.refresh(true)
  409. },
  410. doExport () {
  411. const parameter = {
  412. ...this.queryParam
  413. }
  414. exportSbInfo(parameter).then(file => {
  415. this.BaseTool.UPLOAD.downLoadExportExcel(file)
  416. })
  417. },
  418. handleRepairFilePreview (record) {
  419. console.log(record, 87878)
  420. this.$refs.previewModal.base(record.id, this.DictCache.VALUE.FILE_MODULE.SBINFO_REPAIRFILE)
  421. },
  422. handleRepairFileDownload (record) {
  423. // this.$refs.downloadModal.base(record.id, this.DictCache.VALUE.FILE_MODULE.SBINFO_REPAIRFILE, getDownloadUrl(record.id))
  424. },
  425. handleUseFilePreview (record) {
  426. this.$refs.previewModal.base(record.id, this.DictCache.VALUE.FILE_MODULE.SBINFO_USEFILE)
  427. },
  428. handleUseFileDownload (record) {
  429. // this.$refs.downloadModal.base(record.id, this.DictCache.VALUE.FILE_MODULE.SBINFO_USEFILE, getDownloadUrl(record.id))
  430. },
  431. handleCheckFilePreview (record) {
  432. this.$refs.previewModal.base(record.id, this.DictCache.VALUE.FILE_MODULE.SBINFO_RECHECKFILE)
  433. },
  434. handleCheckFileDownload (record) {
  435. // this.$refs.downloadModal.base(record.id, this.DictCache.VALUE.FILE_MODULE.SBINFO_RECHECKFILE, getDownloadUrl(record.id))
  436. }
  437. }
  438. }
  439. </script>