SbInfo.vue 30 KB

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