SbInfo.vue 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829
  1. <template>
  2. <div>
  3. <a-card :bordered="false" v-show="visible">
  4. <a-row :gutter="8" >
  5. <!-- <a-col :span="4">
  6. <a-tree
  7. @expand="onExpand"
  8. :expandedKeys="expandedKeys"
  9. :autoExpandParent="true"
  10. @select="onSelect"
  11. :selectedKeys="selectedKeys"
  12. :treeData="treeData"
  13. />
  14. </a-col>-->
  15. <a-col :span="24">
  16. <div>
  17. <div class="table-page-search-wrapper">
  18. <a-form layout="inline">
  19. <a-row :gutter="48">
  20. <a-col :md="6" :sm="24">
  21. <a-form-item label="关键字">
  22. <a-input v-model.trim="queryParam.keyword" placeholder="名称/设备编号"/>
  23. </a-form-item>
  24. </a-col>
  25. <a-col :md="6" :sm="24">
  26. <a-form-item label="设备位号">
  27. <a-input v-model.trim="queryParam.positionNo" placeholder="设备位号"/>
  28. </a-form-item>
  29. </a-col>
  30. <!-- <a-col :md="6" :sm="24">
  31. <a-form-item label="设备自编号">
  32. <a-input v-model="queryParam.zbh" placeholder="设备自编号"/>
  33. </a-form-item>
  34. </a-col>-->
  35. <a-col :md="6" :sm="24">
  36. <a-form-item label="设备等级">
  37. <a-select v-model="queryParam.level" placeholder="请选择">
  38. <a-select-option
  39. v-for="(label,value) in levelMap"
  40. :key="value"
  41. :label="label"
  42. :value="parseInt(value)">{{ label }}
  43. </a-select-option>
  44. </a-select>
  45. </a-form-item>
  46. </a-col>
  47. <a-col :md="6" :sm="24">
  48. <a-form-item label="自定义类型">
  49. <a-select v-model="queryParam.useType" placeholder="请选择">
  50. <a-select-option
  51. v-for="(label,value) in useTypeMap"
  52. :key="value"
  53. :label="label"
  54. :value="parseInt(value)">{{ label }}
  55. </a-select-option>
  56. </a-select>
  57. </a-form-item>
  58. </a-col>
  59. <a-col :md="6" :sm="24">
  60. <a-form-item label="规格型号">
  61. <a-input v-model="queryParam.model" placeholder="规格型号"/>
  62. </a-form-item>
  63. </a-col>
  64. <a-col :md="6" :sm="24">
  65. <a-form-item label="设备位置">
  66. <a-select v-model="queryParam.positionId" placeholder="请选择">
  67. <a-select-option
  68. v-for="({id,name}) in sbPositionData"
  69. :key="id"
  70. :label="name"
  71. :value="id">{{ name }}
  72. </a-select-option>
  73. </a-select>
  74. </a-form-item>
  75. </a-col>
  76. <a-col :md="6" :sm="24">
  77. <a-form-item label="电力线路">
  78. <a-select v-model="queryParam.baoyangTimes" placeholder="请选择">
  79. <a-select-option
  80. v-for="(label,value) in lineMap"
  81. :key="value"
  82. :label="label"
  83. :value="parseInt(value)">{{ label }}
  84. </a-select-option>
  85. </a-select>
  86. </a-form-item>
  87. </a-col>
  88. <a-col :md="6" :sm="24">
  89. <a-form-item label="生产商">
  90. <a-input v-model="queryParam.producerName" placeholder="生产商名称"/>
  91. </a-form-item>
  92. </a-col>
  93. <a-col :md="6" :sm="24">
  94. <a-form-item label="设备类型">
  95. <a-tree-select
  96. style="width: 100%"
  97. :dropdownStyle="{ maxHeight: '400px', overflow: 'auto' }"
  98. :treeData="treeData"
  99. :treeNodeFilterProp="'title'"
  100. :showSearch="true"
  101. v-model="queryParam.typeId"
  102. placeholder="请选择"
  103. >
  104. </a-tree-select>
  105. </a-form-item>
  106. </a-col>
  107. <a-col :md="6" :sm="24">
  108. <a-form-item label="设备状态">
  109. <a-select v-model="queryParam.status" placeholder="请选择">
  110. <a-select-option
  111. v-for="(label,value) in statusMap"
  112. :key="value"
  113. :defaultValue="DictCache.VALUE.SB_INFO_STATUS.IN_USE"
  114. :label="label"
  115. :value="parseInt(value)">{{ label }}
  116. </a-select-option>
  117. </a-select>
  118. </a-form-item>
  119. </a-col>
  120. <a-col :md="6" :sm="24">
  121. <a-form-item label="主子设备">
  122. <a-select v-model="queryParam.isChild" placeholder="请选择">
  123. <a-select-option value="1">子设备</a-select-option>
  124. <a-select-option value="2">父设备</a-select-option>
  125. <a-select-option value="3">普通设备</a-select-option>
  126. </a-select>
  127. </a-form-item>
  128. </a-col>
  129. <a-col :md="6 || 24" :sm="24">
  130. <span class="table-page-search-submitButtons">
  131. <a-button type="primary" @click="$refs.table.refresh(true)">查询</a-button>
  132. <a-button style="margin-left: 8px" @click="resetSearchForm">重置</a-button>
  133. </span>
  134. </a-col>
  135. </a-row>
  136. </a-form>
  137. </div>
  138. <div class="table-operator" style="margin-bottom: 8px;">
  139. <a-button v-if="$auth('sb-infos-add')" type="primary" icon="plus" @click="handleAdd">新增</a-button>
  140. <a-button style="margin-left: 8px" v-if="$auth('sb-infos-export')" type="primary" icon="download" @click="doExport">导出</a-button>
  141. <!-- <a-button style="margin-left:8px;" type="primary" @click="doImport">
  142. <a-icon type="upload"/>
  143. 新增导入
  144. </a-button>-->
  145. <a-button style="margin-left:8px;" type="primary" @click="doImportStandard">
  146. <a-icon type="upload"/>
  147. 导入
  148. </a-button>
  149. <a-button style="margin-left:8px;" type="primary" @click="doImportForUpdate">
  150. <a-icon type="upload"/>
  151. 修改导入
  152. </a-button>
  153. <a-button style="margin-left: 8px" type="primary" icon="printer" @click="handlePrintBatch()">批量打印</a-button>
  154. <!-- <a-button style="margin-left: 8px" type="primary" icon="reload" @click="handleMeasureBatch()">批量检定</a-button> -->
  155. <a-button style="margin-left: 8px" v-if="$auth('sb-infos-generate-code-all')" :loading="confirmLoading" type="primary" @click="batchGenerate()">重新生成二维码</a-button>
  156. <a-dropdown v-action:edit v-if="selectedRowKeys.length > 0 && $auth('sb-infos-del')">
  157. <a-menu slot="overlay">
  158. <a-popconfirm title="是否要删除所选数据?" @confirm="batchDelete()">
  159. <a-menu-item key="1"><a-icon type="delete" /><a>删除</a></a-menu-item>
  160. </a-popconfirm>
  161. <a-popconfirm v-if="measureStatus===1" :visible="false" @visibleChange="batchIncorrect()">
  162. <a-menu-item key="2"><my-icon type="icon-pandian" /><a>检定</a></a-menu-item>
  163. </a-popconfirm>
  164. <a-popconfirm v-if="measureStatus!==1" :visible="false" @visibleChange="batchLocation()">
  165. <a-menu-item key="3"><my-icon type="icon-pandian" /><a>设备位号</a></a-menu-item>
  166. </a-popconfirm>
  167. </a-menu>
  168. <a-button style="margin-left: 8px">
  169. 批量操作 <a-icon type="down" />
  170. </a-button>
  171. </a-dropdown>
  172. </div>
  173. <s-table
  174. ref="table"
  175. size="default"
  176. rowKey="id"
  177. :widthSpace="true"
  178. :columns="columns"
  179. :data="loadData"
  180. :alert="options.alert"
  181. :rowSelection="options.rowSelection"
  182. :scroll="{x: 1500, y: BaseTool.Constant.scrollY}"
  183. showPagination="auto"
  184. >
  185. <span slot="action" slot-scope="record">
  186. <template>
  187. <div>
  188. <!--<a-divider type="vertical" />
  189. <a-popconfirm v-if="$auth('sb-infos-del')" title="是否要删除该设备?" @confirm="batchDelete(record.id)">
  190. <a>删除</a>
  191. </a-popconfirm>
  192. <a-divider type="vertical" />
  193. <a @click="handleCopy(record)">复制</a>-->
  194. <a-dropdown>
  195. <a-menu slot="overlay">
  196. <a-menu-item key="0">
  197. <a @click="handleView(record)">查看</a>
  198. </a-menu-item>
  199. <a-menu-item key="1">
  200. <a v-if="$auth('sb-infos-edit')" @click="handleEdit(record)">修改</a>
  201. </a-menu-item>
  202. <a-menu-item key="2" v-if="measureStatus===1" >
  203. <a @click="batchIncorrect(record)">检定</a>
  204. </a-menu-item>
  205. <a-menu-item v-if="record.status != 2" key="2">
  206. <a-popconfirm title="是否要启用该设备?" @confirm="handleStart(record)">
  207. <a>启用</a>
  208. </a-popconfirm>
  209. </a-menu-item>
  210. <a-menu-item v-if="record.status != 7" key="3">
  211. <a-popconfirm title="是否要停用该设备?" @confirm="handleStop(record)">
  212. <a>停用</a>
  213. </a-popconfirm>
  214. </a-menu-item>
  215. <a-menu-item key="10">
  216. <a v-if="$auth('sb-infos-edit')" @click="handleCopy(record)">复制</a>
  217. </a-menu-item>
  218. <a-menu-item key="4">
  219. <a @click="handlePrint(record)">打印</a>
  220. </a-menu-item>
  221. </a-menu>
  222. <a-button> 操作 <a-icon type="down" /> </a-button>
  223. </a-dropdown>
  224. </div>
  225. </template>
  226. </span>
  227. <span slot="status" slot-scope="text">
  228. <badge
  229. :status="DictCache.COLOR.SB_INFO_STATUS[text]"
  230. :text="statusMap[text]" />
  231. </span>
  232. </s-table>
  233. </div>
  234. </a-col>
  235. </a-row>
  236. </a-card>
  237. <base-form ref="baseModal" :parent-id="queryParam.parentId" :parent-name="queryParam.parentName" @ok="handleOk"/>
  238. <base-form-status-log ref="baseModalStatusLog" @ok="handleOk"/>
  239. <detail ref="detailModal" @ok="handleOk"/>
  240. <download-modal ref="downloadModal"/>
  241. <preview-modal ref="previewModal"/>
  242. <import-form-add ref="importModal" @ok="handleOk"/>
  243. <import-form-add-standard ref="importModalStandard" @ok="handleOk"/>
  244. <import-form-update ref="importModalUpdate" @ok="handleOk"/>
  245. <print-sb-code ref="printSbCode"/>
  246. <print-in-sb-info-batch ref="printInSbInfoBatch" @ok="handleOk"/>
  247. <detail-sb-measure ref="detailSbMeasureModal" @ok="handleOk"/>
  248. <base-form-measure ref="baseModalMeasure" @ok="handleOk"/>
  249. <base-form-location ref="baseFormLocation" @ok="handleOk" />
  250. </div>
  251. </template>
  252. <script>
  253. import { STable, Ellipsis } from '@/components'
  254. import BaseForm from './modules/BaseForm'
  255. import DetailSbMeasure from '@/views/sb/measurelog/modules/DetailSbCheckBatch'
  256. import BaseFormStatusLog from '@/views/sb/status-log/modules/BaseForm'
  257. import Detail from './modules/Detail'
  258. import BaseFormMeasure from './modules/BaseFormMeasure'
  259. import BaseFormLocation from './modules/BaseFormLocation'
  260. import DownloadModal from '@/views/download/DownloadModal'
  261. import PreviewModal from '@/views/preview/PreviewModal'
  262. import { getSbInfoPage, deleteSbInfos, fetchSbInfo, fetchSbInfos, exportSbInfo, batchLocationList } from '@/api/sb/info'
  263. import { queryDept } from '@/api/upms/dept'
  264. import { generateSbCodeAll } from '@/api/upms/code'
  265. import { fetchSbTypeTree } from '@/api/sb/type'
  266. import ImportFormAdd from './modules/ImportFormAdd'
  267. import ImportFormAddStandard from './modules/ImportFormAddStandard'
  268. import ImportFormUpdate from './modules/ImportFormUpdate'
  269. import PrintSbCode from '@/views/sb/info/modules/PrintSbCode'
  270. import PrintInSbInfoBatch from '@/views/sb/info/modules/PrintInSbInfoBatch'
  271. import { querySbPosition } from '@/api/sb/position'
  272. export default {
  273. name: 'SbInfoList',
  274. components: {
  275. STable,
  276. Ellipsis,
  277. BaseForm,
  278. DetailSbMeasure,
  279. Detail,
  280. DownloadModal,
  281. PreviewModal,
  282. PrintSbCode,
  283. ImportFormAdd,
  284. ImportFormAddStandard,
  285. ImportFormUpdate,
  286. PrintInSbInfoBatch,
  287. BaseFormMeasure,
  288. BaseFormLocation,
  289. BaseFormStatusLog
  290. },
  291. props: {
  292. filter: {
  293. type: Number,
  294. default: -1
  295. },
  296. useType: {
  297. type: Number,
  298. default: null
  299. },
  300. measureStatus: {
  301. type: Number,
  302. default: null
  303. }
  304. },
  305. data () {
  306. return {
  307. // 查询参数
  308. queryParam: {
  309. filter: this.filter,
  310. useType: this.useType,
  311. measureStatus: this.measureStatus,
  312. id: this.$route.query.id,
  313. typeId: this.$route.query.typeId,
  314. status: this.$route.query.status
  315. },
  316. depreciationTypeMap: {},
  317. visible: true,
  318. sbPositionData: [],
  319. levelMap: {},
  320. lineMap: {},
  321. unitMap: {},
  322. areaList: {},
  323. companyList: {},
  324. projectList: {},
  325. isChildMap: {},
  326. isShowMap: {},
  327. deptList: {},
  328. confirmLoading: false,
  329. useTypeMap: {},
  330. statusMap: {},
  331. expandedKeys: [],
  332. selectedKeys: [],
  333. sourceTypeMap: {},
  334. treeData: [],
  335. // 表头
  336. columns: [
  337. {
  338. title: '序号',
  339. dataIndex: 'index',
  340. width: 100,
  341. checked: true,
  342. customRender: (text, record, index) => {
  343. return `${(this.$refs.table.localPagination.current - 1) * this.$refs.table.localPagination.pageSize + index + 1}`
  344. }
  345. },
  346. {
  347. title: '设备编号',
  348. dataIndex: 'no',
  349. width: 120,
  350. checked: true
  351. },
  352. {
  353. title: '设备名称',
  354. checked: true,
  355. width: 200,
  356. dataIndex: 'name'
  357. },
  358. {
  359. title: '设备位号',
  360. dataIndex: 'positionNo',
  361. width: 150,
  362. checked: true
  363. },
  364. /* {
  365. title: '设备自编号',
  366. dataIndex: 'zbh',
  367. width: 120,
  368. checked: true
  369. }, */
  370. {
  371. title: '设备类型',
  372. checked: true,
  373. dataIndex: 'type',
  374. width: 150,
  375. customRender: (text, record, index) => {
  376. return record.typeName
  377. }
  378. },
  379. {
  380. title: '设备等级',
  381. checked: true,
  382. dataIndex: 'level',
  383. width: 120,
  384. customRender: (text, record, index) => {
  385. return this.BaseTool.Object.getField(this.levelMap, text)
  386. }
  387. },
  388. {
  389. title: '规格型号',
  390. dataIndex: 'model',
  391. width: 150,
  392. checked: true
  393. },
  394. {
  395. title: '自定义类型',
  396. checked: true,
  397. dataIndex: 'useType',
  398. width: 150,
  399. customRender: (text, record, index) => {
  400. return this.BaseTool.Object.getField(this.useTypeMap, text)
  401. }
  402. },
  403. {
  404. title: '设备位置',
  405. checked: true,
  406. width: 200,
  407. dataIndex: 'positionName'
  408. },
  409. {
  410. title: '使用机台',
  411. checked: true,
  412. width: 200,
  413. dataIndex: 'saveUserName'
  414. },
  415. {
  416. title: '生产商',
  417. dataIndex: 'producerName',
  418. width: 120,
  419. checked: true
  420. },
  421. /* {
  422. title: '大小尺寸',
  423. dataIndex: 'zz',
  424. width: 120,
  425. checked: true
  426. }, */
  427. {
  428. title: '出厂编号',
  429. dataIndex: 'zzh',
  430. width: 120,
  431. checked: true
  432. },
  433. /* {
  434. title: '是否显示',
  435. dataIndex: 'isShow',
  436. width: 120,
  437. checked: true,
  438. customRender: (text, record, index) => {
  439. return this.BaseTool.Object.getField(this.isShowMap, text)
  440. }
  441. }, */
  442. /* {
  443. title: '是否子设备',
  444. dataIndex: 'isChild',
  445. width: 120,
  446. checked: true,
  447. customRender: (text, record, index) => {
  448. return this.BaseTool.Object.getField(this.isChildMap, text)
  449. }
  450. }, */
  451. {
  452. title: '资产编号',
  453. dataIndex: 'financingNo',
  454. width: 120,
  455. checked: true
  456. },
  457. {
  458. title: '设备原值',
  459. dataIndex: 'initialValue',
  460. width: 100,
  461. checked: true,
  462. customRender: (text, record, index) => {
  463. return this.BaseTool.Amount.formatter(text)
  464. }
  465. },
  466. {
  467. title: '购置日期',
  468. dataIndex: 'buyDate',
  469. width: 120,
  470. checked: true
  471. },
  472. {
  473. title: '投用日期',
  474. dataIndex: 'startDate',
  475. width: 120,
  476. checked: true
  477. },
  478. /* {
  479. title: '检定日期',
  480. dataIndex: 'checkDate',
  481. width: 150,
  482. checked: true
  483. },
  484. {
  485. title: '检定周期',
  486. dataIndex: 'checkPeriod',
  487. width: 100,
  488. checked: true,
  489. customRender: (text, record, index) => {
  490. if (record.nextCheckDate == null) {
  491. return '未知'
  492. } else {
  493. return text + '月'
  494. }
  495. }
  496. },
  497. {
  498. title: '检定有效期',
  499. dataIndex: 'nextCheckDate',
  500. width: 150,
  501. checked: true
  502. },
  503. {
  504. title: '检定截止',
  505. dataIndex: 'restDay',
  506. width: 100,
  507. checked: true,
  508. customRender: (text, record, index) => {
  509. if (record.nextCheckDate == null) {
  510. return '未知'
  511. } else {
  512. return this.BaseTool.Date.getCountBetween(new Date(), record.nextCheckDate, 1) + '天'
  513. }
  514. }
  515. }, */
  516. {
  517. title: '状态',
  518. checked: true,
  519. dataIndex: 'status',
  520. width: 100,
  521. scopedSlots: { customRender: 'status' }
  522. },
  523. {
  524. title: '操作',
  525. key: 'action',
  526. checked: true,
  527. fixed: 'right',
  528. align: 'center',
  529. width: '120',
  530. scopedSlots: { customRender: 'action' }
  531. }
  532. ],
  533. // 加载数据方法 必须为 Promise 对象
  534. loadData: parameter => {
  535. parameter = {
  536. ...parameter,
  537. ...this.queryParam,
  538. dataScope: {
  539. sortBy: 'asc',
  540. sortName: 'no'
  541. }
  542. }
  543. console.log(parameter)
  544. return getSbInfoPage(Object.assign(parameter, this.queryParam))
  545. .then(res => {
  546. return res.data
  547. })
  548. },
  549. selectedRowKeys: [],
  550. selectedRows: [],
  551. options: {
  552. alert: { show: true, clear: () => { this.selectedRowKeys = [] } },
  553. rowSelection: {
  554. selectedRowKeys: this.selectedRowKeys,
  555. onChange: this.onSelectChange
  556. }
  557. },
  558. optionAlertShow: false
  559. }
  560. },
  561. created () {
  562. console.log('this.$route.query.parentId: ' + this.$route.query.parentId)
  563. this.queryParam.parentId = this.$route.query.parentId
  564. this.queryParam.parentName = this.$route.query.parentName
  565. this.tableOption()
  566. this.depreciationTypeMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SBINFO_DEPRECIATIONTYPE)
  567. this.levelMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SBINFO_LEVEL)
  568. this.statusMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SB_INFO_STATUS)
  569. this.unitMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SBINFO_UNIT)
  570. this.sourceTypeMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SBTYPE_SOURCETYPE)
  571. this.useTypeMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SB_USE_TYPE)
  572. this.isChildMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SB_IS_CHILD)
  573. this.isShowMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SB_IS_SHOW)
  574. this.lineMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.REMOTE_LINE)
  575. querySbPosition().then(res => {
  576. this.sbPositionData = res.data
  577. })
  578. },
  579. methods: {
  580. tableOption () {
  581. this.setTree()
  582. if (!this.optionAlertShow) {
  583. this.options = {
  584. alert: { show: true, clear: () => { this.selectedRowKeys = [] } },
  585. rowSelection: {
  586. selectedRowKeys: this.selectedRowKeys,
  587. onChange: this.onSelectChange,
  588. getCheckboxProps: record => ({
  589. props: {
  590. disabled: false,
  591. name: record.id
  592. }
  593. })
  594. }
  595. }
  596. this.optionAlertShow = true
  597. } else {
  598. this.options = {
  599. alert: false,
  600. rowSelection: null
  601. }
  602. this.optionAlertShow = false
  603. }
  604. },
  605. batchDelete (id) {
  606. let ids = []
  607. if (this.BaseTool.String.isBlank(id)) {
  608. const length = this.selectedRows.length
  609. if (length === 0) {
  610. this.$message.info('请选择要删除的记录')
  611. return
  612. }
  613. ids = this.selectedRows.map(item => item.id)
  614. } else {
  615. ids = [id]
  616. }
  617. deleteSbInfos(ids).then(res => {
  618. this.$message.info('删除成功')
  619. this.handleOk()
  620. this.$refs.table.clearSelected()
  621. })
  622. },
  623. batchGenerate () {
  624. this.confirmLoading = true
  625. this.$message.info('正在生成请稍后')
  626. generateSbCodeAll().then(res => {
  627. this.confirmLoading = false
  628. this.$message.info('生成成功')
  629. this.handleOk()
  630. this.$refs.table.clearSelected()
  631. })
  632. },
  633. handleEdit (record) {
  634. fetchSbInfo({ id: record.id }).then(res => {
  635. this.visible = false
  636. const modal = this.$refs.baseModal
  637. modal.base(res.data)
  638. })
  639. },
  640. handlePrint (record) {
  641. this.visible = false
  642. fetchSbInfo({ id: record.id }).then(res => {
  643. const modal = this.$refs.printInSbInfoBatch
  644. modal.base([res.data])
  645. })
  646. },
  647. batchLocation () {
  648. let ids = []
  649. const length = this.selectedRows.length
  650. if (length === 0) {
  651. this.$message.info('请选择设备')
  652. return
  653. }
  654. ids = this.selectedRows.map(item => item.id)
  655. console.log(ids)
  656. batchLocationList({ ids }).then(res => {
  657. this.visible = false
  658. const modal = this.$refs.baseFormLocation
  659. modal.base(res.data)
  660. })
  661. },
  662. batchIncorrect (id) {
  663. let ids = []
  664. if (this.BaseTool.String.isBlank(id)) {
  665. const length = this.selectedRows.length
  666. if (length === 0) {
  667. this.$message.info('请选择要填报的设备')
  668. return
  669. }
  670. ids = this.selectedRows
  671. } else {
  672. ids = [id]
  673. }
  674. console.log(ids)
  675. this.visible = false
  676. const modal = this.$refs.baseModalMeasure
  677. modal.base(ids)
  678. },
  679. handleMeasureBatch () {
  680. const modal = this.$refs.detailSbMeasureModal
  681. modal.base()
  682. },
  683. handlePrintBatch () {
  684. this.visible = false
  685. let ids = []
  686. const length = this.selectedRows.length
  687. if (length === 0) {
  688. this.$message.info('请选择要打印的设备')
  689. return
  690. }
  691. ids = this.selectedRows.map(item => item.id)
  692. fetchSbInfos(ids).then(res => {
  693. const modal = this.$refs.printInSbInfoBatch
  694. modal.base(res.data)
  695. })
  696. },
  697. handleStart (record) {
  698. const modal = this.$refs.baseModalStatusLog
  699. modal.base(null, {
  700. sbId: record.id,
  701. sbNo: record.no,
  702. changeUserId: this.$store.getters.userInfo.userId,
  703. actualUser: this.$store.getters.userInfo.realName,
  704. preStatus: record.status,
  705. afterStatus: this.DictCache.VALUE.SB_INFO_STATUS.IN_USE
  706. })
  707. },
  708. handleStop (record) {
  709. const modal = this.$refs.baseModalStatusLog
  710. modal.base(null, {
  711. sbId: record.id,
  712. sbNo: record.no,
  713. changeUserId: this.$store.getters.userInfo.userId,
  714. actualUser: this.$store.getters.userInfo.realName,
  715. preStatus: record.status,
  716. afterStatus: this.DictCache.VALUE.SB_INFO_STATUS.IN_STOP
  717. })
  718. },
  719. handleAdd () {
  720. this.visible = false
  721. this.$refs.baseModal.base()
  722. },
  723. handleView (record) {
  724. fetchSbInfo({ id: record.id }).then(res => {
  725. this.visible = false
  726. const modal = this.$refs.detailModal
  727. modal.base(res.data)
  728. })
  729. },
  730. handleCopy (record) {
  731. this.visible = false
  732. fetchSbInfo({ id: record.id }).then(res => {
  733. const modal = this.$refs.baseModal
  734. modal.base(res.data, 1)
  735. })
  736. },
  737. handleOk () {
  738. this.visible = true
  739. this.setTree()
  740. this.$refs.table.refresh()
  741. },
  742. onSelectChange (selectedRowKeys, selectedRows) {
  743. this.selectedRowKeys = selectedRowKeys
  744. this.selectedRows = selectedRows
  745. },
  746. resetSearchForm () {
  747. this.queryParam = {
  748. filter: this.filter,
  749. useType: this.useType,
  750. measureStatus: this.measureStatus,
  751. id: this.$route.query.id,
  752. typeId: this.$route.query.typeId,
  753. status: this.$route.query.status
  754. }
  755. this.visible = true
  756. this.$refs.table.refresh(true)
  757. },
  758. doExport () {
  759. const parameter = {
  760. ...this.queryParam,
  761. sbIds: this.selectedRowKeys,
  762. dataScope: {
  763. sortBy: 'asc',
  764. sortName: 'no'
  765. }
  766. }
  767. console.log(parameter)
  768. exportSbInfo(parameter).then(file => {
  769. this.BaseTool.UPLOAD.downLoadExportExcel(file)
  770. })
  771. },
  772. setTree (record = {}) {
  773. queryDept({ nature: this.DictCache.VALUE.SYS_DEPT_NATURE.JITUAN }).then(res => {
  774. this.areaList = res.data
  775. })
  776. fetchSbTypeTree().then(res => {
  777. this.treeData = res.data
  778. })
  779. },
  780. onSelect: function (selectedKeys, info) {
  781. this.selectedKeys = selectedKeys
  782. this.queryParam.typeId = selectedKeys.length > 0 ? selectedKeys[0] : ''
  783. this.$refs.table.refresh(true)
  784. },
  785. onExpand (expandedKeys) {
  786. this.expandedKeys = expandedKeys
  787. this.autoExpandParent = false
  788. },
  789. handleRepairFilePreview (record) {
  790. console.log(record, 87878)
  791. this.$refs.previewModal.base(record.id, this.DictCache.VALUE.FILE_MODULE.SBINFO_REPAIRFILE)
  792. },
  793. handleRepairFileDownload (record) {
  794. // this.$refs.downloadModal.base(record.id, this.DictCache.VALUE.FILE_MODULE.SBINFO_REPAIRFILE, getDownloadUrl(record.id))
  795. },
  796. handleUseFilePreview (record) {
  797. this.$refs.previewModal.base(record.id, this.DictCache.VALUE.FILE_MODULE.SBINFO_USEFILE)
  798. },
  799. handleUseFileDownload (record) {
  800. // this.$refs.downloadModal.base(record.id, this.DictCache.VALUE.FILE_MODULE.SBINFO_USEFILE, getDownloadUrl(record.id))
  801. },
  802. handleCheckFilePreview (record) {
  803. this.$refs.previewModal.base(record.id, this.DictCache.VALUE.FILE_MODULE.SBINFO_RECHECKFILE)
  804. },
  805. handleCheckFileDownload (record) {
  806. // this.$refs.downloadModal.base(record.id, this.DictCache.VALUE.FILE_MODULE.SBINFO_RECHECKFILE, getDownloadUrl(record.id))
  807. },
  808. doImport () {
  809. this.$refs.importModal.base(null, null)
  810. },
  811. doImportStandard () {
  812. // this.$refs.importModalStandard.base()
  813. this.$refs.importModalUpdate.base(null, 1)
  814. },
  815. doImportForUpdate () {
  816. this.$refs.importModalUpdate.base(null, 4)
  817. }
  818. }
  819. }
  820. </script>