SbInfoC.vue 41 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199
  1. <template>
  2. <div>
  3. <a-card :bordered="false" v-show="visible">
  4. <a-row :gutter="8">
  5. <a-col :span="24">
  6. <div>
  7. <div class="table-page-search-wrapper">
  8. <a-form layout="inline">
  9. <a-row :gutter="48">
  10. <a-col :md="6" :sm="24">
  11. <a-form-item label="关键字">
  12. <a-input v-model.trim="queryParam.keyword" placeholder="关键字" />
  13. </a-form-item>
  14. </a-col>
  15. <a-col :md="6" :sm="24">
  16. <a-form-item label="车间位置">
  17. <a-tree-select
  18. style="width: 100%"
  19. :dropdownStyle="{ maxHeight: '400px', overflow: 'auto' }"
  20. :treeData="positionTreeData"
  21. :treeNodeFilterProp="'title'"
  22. :showSearch="true"
  23. v-model="queryParam.positionId"
  24. placeholder="请选择">
  25. </a-tree-select>
  26. </a-form-item>
  27. </a-col>
  28. <a-col :md="6" :sm="24">
  29. <a-form-item label="设备名称">
  30. <a-input v-model.trim="queryParam.name" placeholder="名称"/>
  31. </a-form-item>
  32. </a-col>
  33. <!-- <a-col :md="6" :sm="24">
  34. <a-form-item label="父位号">
  35. <a-input v-model.trim="queryParam.no" placeholder="父位号"/>
  36. </a-form-item>
  37. </a-col>
  38. <a-col :md="6" :sm="24" :style="{ display: expand ? 'block' : 'none' }">
  39. <a-form-item label="设备位号">
  40. <a-input v-model.trim="queryParam.positionNo" placeholder="设备位号"/>
  41. </a-form-item>
  42. </a-col> -->
  43. <a-col :md="6" :sm="24" >
  44. <a-form-item label="生产商">
  45. <a-input v-model.trim="queryParam.producerId" placeholder="生产商"/>
  46. </a-form-item>
  47. </a-col>
  48. <!-- <a-col :md="6" :sm="24">
  49. <a-form-item label="设备自编号">
  50. <a-input v-model="queryParam.zbh" placeholder="设备自编号"/>
  51. </a-form-item>
  52. </a-col>-->
  53. <a-col :md="6" :sm="24">
  54. <a-form-item label="设备等级">
  55. <a-select v-model="queryParam.level" placeholder="请选择">
  56. <a-select-option
  57. v-for="(label,value) in levelMap"
  58. :key="value"
  59. :label="label"
  60. :value="parseInt(value)">{{ label }}
  61. </a-select-option>
  62. </a-select>
  63. </a-form-item>
  64. </a-col>
  65. <!-- <a-col :md="6" :sm="24">
  66. <a-form-item label="自定义类型">
  67. <a-select v-model="queryParam.useType" placeholder="请选择">
  68. <a-select-option
  69. v-for="(label,value) in useTypeMap"
  70. :key="value"
  71. :label="label"
  72. :value="parseInt(value)">{{ label }}
  73. </a-select-option>
  74. </a-select>
  75. </a-form-item>
  76. </a-col>-->
  77. <!-- <a-col :md="6" :sm="24" :style="{ display: expand ? 'block' : 'none' }">
  78. <a-form-item label="检定日期范围">
  79. <a-range-picker v-model="dateRangeCheck" />
  80. </a-form-item>
  81. </a-col> -->
  82. <a-col :md="6" :sm="24">
  83. <a-form-item label="有效日期范围">
  84. <a-range-picker v-model="dateRange" />
  85. </a-form-item>
  86. </a-col>
  87. <a-col :md="6" :sm="24" >
  88. <a-form-item label="设备状态">
  89. <a-select v-model="queryParam.status" placeholder="请选择">
  90. <a-select-option
  91. v-for="(label,value) in statusMap"
  92. :key="value"
  93. :defaultValue="DictCache.VALUE.SB_INFO_STATUS.IN_USE"
  94. :label="label"
  95. :value="parseInt(value)">{{ label }}
  96. </a-select-option>
  97. </a-select>
  98. </a-form-item>
  99. </a-col>
  100. <!-- <a-col :md="6" :sm="24" :style="{ display: expand ? 'block' : 'none' }">
  101. <a-form-item label="规格型号">
  102. <a-input v-model="queryParam.model" placeholder="规格型号"/>
  103. </a-form-item>
  104. </a-col>
  105. <a-col :md="6" :sm="24" :style="{ display: expand ? 'block' : 'none' }">
  106. <a-form-item label="设备类型">
  107. <a-tree-select
  108. style="width: 100%"
  109. :dropdownStyle="{ maxHeight: '400px', overflow: 'auto' }"
  110. :treeData="treeData"
  111. :treeNodeFilterProp="'title'"
  112. :showSearch="true"
  113. v-model="queryParam.typeId"
  114. placeholder="请选择"
  115. >
  116. </a-tree-select>
  117. </a-form-item>
  118. </a-col>
  119. <a-col :md="6" :sm="24" :style="{ display: expand ? 'block' : 'none' }">
  120. <a-form-item label="主子设备">
  121. <a-select v-model="queryParam.isChild" placeholder="请选择">
  122. <a-select-option value="1">子设备</a-select-option>
  123. <a-select-option value="2">父设备</a-select-option>
  124. <a-select-option value="3">普通设备</a-select-option>
  125. </a-select>
  126. </a-form-item>
  127. </a-col>
  128. <a-col :md="6" :sm="24" :style="{ display: expand ? 'block' : 'none' }">
  129. <a-form-item label="电力线路">
  130. <a-select v-model="queryParam.baoyangTimes" placeholder="请选择">
  131. <a-select-option
  132. v-for="(label,value) in lineMap"
  133. :key="value"
  134. :label="label"
  135. :value="parseInt(value)">{{ label }}
  136. </a-select-option>
  137. </a-select>
  138. </a-form-item>
  139. </a-col>
  140. <a-col :md="6" :sm="24" :style="{ display: expand ? 'block' : 'none' }">
  141. <a-form-item label="是否强检">
  142. <a-select v-model="queryParam.checkType" placeholder="请选择">
  143. <a-select-option
  144. v-for="(label,value) in checkTypeMap"
  145. :key="value"
  146. :label="label"
  147. :value="parseInt(value)">{{ label }}
  148. </a-select-option>
  149. </a-select>
  150. </a-form-item>
  151. </a-col> -->
  152. <a-col :span="6" >
  153. <span class="table-page-search-submitButtons">
  154. <a-button type="primary" @click="handleOk">查询</a-button>
  155. <a-button style="margin-left: 8px" @click="resetSearchForm">重置</a-button>
  156. <!-- <a :style="{ marginLeft: '8px', fontSize: '12px' }" @click="expand=!expand">
  157. {{ !expand ? '展开' : '折叠' }} <a-icon :type="expand ? 'up' : 'down'" />
  158. </a> -->
  159. </span>
  160. </a-col>
  161. </a-row>
  162. </a-form>
  163. <a-row :gutter="8">
  164. </a-row>
  165. </div>
  166. <div class="table-operator" style="margin-bottom: 8px;">
  167. <a-button v-if="$auth('sb-infos-add')" type="primary" icon="plus" @click="handleAdd">新增</a-button>
  168. <a-button style="margin-left: 8px" v-if="$auth('sb-infos-export')" type="primary" icon="download" @click="doExport">导出</a-button>
  169. <!-- <a-button style="margin-left:8px;" type="primary" @click="doImport">
  170. <a-icon type="upload"/>
  171. 新增导入
  172. </a-button>-->
  173. <a-button style="margin-left:8px;" type="primary" @click="doImportStandard">
  174. <a-icon type="upload" />
  175. 导入
  176. </a-button>
  177. <a-button style="margin-left:8px;" type="primary" @click="doImportForUpdate">
  178. <a-icon type="upload" />
  179. 修改导入
  180. </a-button>
  181. <a-button style="margin-left:8px;" type="primary" @click="doImportMeasure">
  182. <a-icon type="upload" />
  183. 检定导入
  184. </a-button>
  185. <a-button style="margin-left: 8px" type="primary" icon="printer" @click="handlePrintBatch()">批量打印</a-button>
  186. <a-button style="margin-left: 8px" type="primary" icon="printer" @click="handleBackBatch(13)">批量退库</a-button>
  187. <a-button style="margin-left: 8px" type="primary" icon="printer" @click="handleBackBatch(4)">批量报废</a-button>
  188. <!-- <a-button style="margin-left: 8px" type="primary" icon="reload" @click="handleMeasureBatch()">批量检定</a-button> -->
  189. <a-button style="margin-left: 8px" v-if="$auth('sb-infos-generate-code-all')" :loading="confirmLoading" type="primary" @click="batchGenerate()">重新生成二维码</a-button>
  190. <a-dropdown v-action:edit v-if="selectedRowKeys.length > 0 && $auth('sb-infos-del')">
  191. <a-menu slot="overlay">
  192. <a-popconfirm title="是否要删除所选数据?" @confirm="batchDelete()">
  193. <a-menu-item key="1"><a-icon type="delete" /><a>删除</a></a-menu-item>
  194. </a-popconfirm>
  195. <a-popconfirm v-if="isMeasure===1" @visibleChange="batchIncorrect()">
  196. <a-menu-item key="2"><my-icon type="icon-pandian" /><a>检定</a></a-menu-item>
  197. </a-popconfirm>
  198. <a-popconfirm v-if="isMeasure===1" @visibleChange="batchIncorrectInStore()">
  199. <a-menu-item key="3"><my-icon type="icon-pandian" /><a>入库</a></a-menu-item>
  200. </a-popconfirm>
  201. <a-popconfirm :visible="false" @visibleChange="batchLocation()">
  202. <a-menu-item key="4"><my-icon type="icon-pandian" /><a>设备位号</a></a-menu-item>
  203. </a-popconfirm>
  204. </a-menu>
  205. <a-button style="margin-left: 8px">
  206. 批量操作 <a-icon type="down" />
  207. </a-button>
  208. </a-dropdown>
  209. </div>
  210. <s-table
  211. ref="table"
  212. :onExpand="onExpand"
  213. size="default"
  214. rowKey="id"
  215. :widthSpace="true"
  216. :columns="columns"
  217. :data="loadData"
  218. :alert="options.alert"
  219. :rowSelection="options.rowSelection"
  220. :scroll="{x: 1300, y: BaseTool.Constant.scrollY}"
  221. showPagination="auto"
  222. :rowClassName="rowClassName">
  223. <template #positionNo="text,record">
  224. <a @click="showChangeLog(record)">{{ text }}</a>
  225. </template>
  226. <template #sbMeasureLogCredential="text">
  227. <a @click="$refs.listModal.base(text)">查看</a>
  228. </template>
  229. <span slot="action" slot-scope="record">
  230. <template>
  231. <div>
  232. <!--<a-divider type="vertical" />
  233. <a-popconfirm v-if="$auth('sb-infos-del')" title="是否要删除该设备?" @confirm="batchDelete(record.id)">
  234. <a>删除</a>
  235. </a-popconfirm>
  236. <a-divider type="vertical" />
  237. <a @click="handleCopy(record)">复制</a>-->
  238. <a-dropdown>
  239. <a-menu slot="overlay">
  240. <a-menu-item key="0">
  241. <a @click="handleView(record)">查看</a>
  242. </a-menu-item>
  243. <a-menu-item key="1">
  244. <a v-if="$auth('sb-infos-edit')" @click="addLogBySb(record)">新增记录</a>
  245. </a-menu-item>
  246. <a-menu-item key="1">
  247. <a v-if="$auth('sb-infos-edit')" @click="handleEdit(record)">修改</a>
  248. </a-menu-item>
  249. <a-menu-item key="2" v-if="isMeasure===1">
  250. <a @click="batchIncorrect(record)">检定</a>
  251. </a-menu-item>
  252. <a-menu-item key="3" v-if="isMeasure===1">
  253. <a @click="batchIncorrectInStore(record)">入库</a>
  254. </a-menu-item>
  255. <a-menu-item v-if="record.status != 2" key="2">
  256. <a-popconfirm title="是否要启用该设备?" @confirm="handleStart(record)">
  257. <a>启用</a>
  258. </a-popconfirm>
  259. </a-menu-item>
  260. <a-menu-item v-if="record.status != 7" key="3">
  261. <a-popconfirm title="是否要停用该设备?" @confirm="handleStop(record)">
  262. <a>停用</a>
  263. </a-popconfirm>
  264. </a-menu-item>
  265. <a-menu-item key="10">
  266. <a v-if="$auth('sb-infos-edit')" @click="handleCopy(record)">复制</a>
  267. </a-menu-item>
  268. <a-menu-item key="4">
  269. <a @click="handlePrint(record)">打印</a>
  270. </a-menu-item>
  271. </a-menu>
  272. <a-button> 操作 <a-icon type="down" /> </a-button>
  273. </a-dropdown>
  274. </div>
  275. </template>
  276. </span>
  277. <span slot="status" slot-scope="text">
  278. <badge :status="DictCache.COLOR.SB_INFO_STATUS[text]" :text="statusMap[text]" />
  279. </span>
  280. <span slot="measureStatus" slot-scope="text">
  281. <badge :status="DictCache.COLOR.SB_MEASURE_STATUS[text]" :text="yesNoMap[text]" />
  282. </span>
  283. <div slot="expandedRowRender" slot-scope="record" style="width:100%;">
  284. <a-card :bordered="false" style="width:100%;position: relative; z-inde:9999">
  285. <div slot="title">
  286. <a-row :gutter="20">
  287. <a-col :span="8">
  288. <a-input v-model.trim="createdUserName" placeholder="请输入操作人" />
  289. </a-col>
  290. <a-col :span="8">
  291. <a-button type="primary" @click="getLogBySbId(record,createdUserName)">查询</a-button>
  292. <a-button style="margin-left: 8px" @click="()=>{getLogBySbId(record);createdUserName=''}">重置</a-button>
  293. <!-- <a-button style="margin-left: 8px" type="primary" icon="plus" @click="addLogBySb(record)">新增</a-button> -->
  294. </a-col>
  295. </a-row>
  296. </div>
  297. <a-table rowKey="id" :columns="childColumns1" :data-source="record.childMap">
  298. <template #sbMeasureLogCredential="text">
  299. <a @click="$refs.listModal.base(text)">查看</a>
  300. </template>
  301. </a-table>
  302. </a-card>
  303. </div>
  304. </s-table>
  305. </div>
  306. </a-col>
  307. </a-row>
  308. </a-card>
  309. <base-form ref="baseModal" :parent-id="queryParam.parentId" :parent-name="queryParam.parentName" @ok="handleOk" />
  310. <base-form-status-log ref="baseModalStatusLog" @ok="handleOk" />
  311. <detail ref="detailModal" @ok="handleOk" />
  312. <download-modal ref="downloadModal" />
  313. <preview-modal ref="previewModal" />
  314. <import-form-add ref="importModal" @ok="handleOk" />
  315. <ImportMeasure ref="importMeasure" @ok="handleOk" />
  316. <import-form-add-standard ref="importModalStandard" @ok="handleOk" />
  317. <import-form-update2 ref="importModalUpdate2" @ok="handleOk" />
  318. <print-sb-code ref="printSbCode" />
  319. <print-in-sb-info-batch ref="printInSbInfoBatch" @ok="handleOk" />
  320. <detail-sb-measure ref="detailSbMeasureModal" @ok="handleOk" />
  321. <base-form-measure ref="baseModalMeasure" @ok="handleOk" />
  322. <base-form-measure-in-store ref="baseModalMeasureInStore" @ok="handleOk" />
  323. <base-form-location ref="baseFormLocation" @ok="handleOk" />
  324. <SbChangeLogSelectModal ref="sbChangeRecordSelectModal" @ok="handleOk" />
  325. <AddLogForm ref="addLogForm" @ok="handleLogOk" />
  326. <BackForm ref="backForm" @ok="handleOk" />
  327. <ListModal ref="listModal" />
  328. </div>
  329. </template>
  330. <script>
  331. import { STable, Ellipsis } from '@/components'
  332. import BaseForm from './modules/BaseForm'
  333. import BackForm from './modules/BackForm'
  334. import ListModal from './modules/ListModal'
  335. import AddLogForm from './modules/AddLogForm'
  336. import DetailSbMeasure from '@/views/sb/measurelog/modules/DetailSbCheckBatch'
  337. import BaseFormStatusLog from '@/views/sb/status-log/modules/BaseForm'
  338. import Detail from './modules/Detail'
  339. import BaseFormMeasure from './modules/BaseFormMeasure'
  340. import BaseFormMeasureInStore from './modules/BaseFormMeasureInStore'
  341. import BaseFormLocation from './modules/BaseFormLocation'
  342. import DownloadModal from '@/views/download/DownloadModal'
  343. import PreviewModal from '@/views/preview/PreviewModal'
  344. import {
  345. getSbInfoPage2,
  346. deleteSbInfos,
  347. querySbInfo,
  348. getLogBySbId,
  349. updateLogBySbId,
  350. fetchSbInfo,
  351. fetchSbInfos,
  352. exportSbInfo2,
  353. batchLocationList
  354. } from '@/api/sb/info'
  355. import { queryDept } from '@/api/upms/dept'
  356. import { generateSbCodeAll } from '@/api/upms/code'
  357. import { fetchSbTypeTree } from '@/api/sb/type'
  358. import ImportFormAdd from './modules/ImportFormAdd'
  359. import ImportMeasure from './modules/ImportMeasure'
  360. import ImportFormAddStandard from './modules/ImportFormAddStandard'
  361. import ImportFormUpdate2 from './modules/ImportFormUpdate2'
  362. import PrintSbCode from '@/views/sb/info/modules/PrintSbCode'
  363. import PrintInSbInfoBatch from '@/views/sb/info/modules/PrintInSbInfoBatch'
  364. import { getSbPositionTree } from '@/api/sb/position'
  365. import SbChangeLogSelectModal from '@/views/sb/change-log/modules/SbChangeLogSelectModal'
  366. export default {
  367. name: 'SbInfoList',
  368. components: {
  369. STable,
  370. Ellipsis,
  371. AddLogForm,
  372. BaseForm,
  373. DetailSbMeasure,
  374. Detail,
  375. DownloadModal,
  376. PreviewModal,
  377. PrintSbCode,
  378. ImportFormAdd,
  379. ImportFormAddStandard,
  380. ImportFormUpdate2,
  381. PrintInSbInfoBatch,
  382. BaseFormMeasure,
  383. BaseFormMeasureInStore,
  384. BaseFormLocation,
  385. BaseFormStatusLog,
  386. SbChangeLogSelectModal,
  387. ListModal,
  388. BackForm,
  389. ImportMeasure
  390. },
  391. props: {
  392. filter: {
  393. type: Number,
  394. default: -1
  395. },
  396. useType: {
  397. type: Number,
  398. default: null
  399. },
  400. correctType: {
  401. type: Number,
  402. default: 1
  403. },
  404. measureStatus: {
  405. type: Number,
  406. default: null
  407. },
  408. isMeasure: {
  409. type: Number,
  410. default: null
  411. },
  412. isSelf: {
  413. type: Number,
  414. default: null
  415. },
  416. typeFlag: {
  417. type: Number,
  418. default: null
  419. },
  420. status: {
  421. type: Number,
  422. default: null
  423. }
  424. },
  425. data () {
  426. return {
  427. // 查询参数
  428. queryParam: {
  429. filter: this.filter,
  430. useType: this.useType,
  431. measureStatus: this.measureStatus,
  432. isMeasure: this.isMeasure,
  433. isSelf: this.isSelf,
  434. id: this.$route.query.id,
  435. typeId: this.$route.query.typeId,
  436. status: this.$route.query.status || this.status
  437. },
  438. expand: false,
  439. record: {},
  440. depreciationTypeMap: {},
  441. visible: true,
  442. dateRange: [],
  443. dateRangeCheck: [],
  444. sbPositionData: [],
  445. levelMap: {},
  446. lineMap: {},
  447. unitMap: {},
  448. checkTypeMap: {},
  449. areaList: {},
  450. childMap: [],
  451. companyList: {},
  452. projectList: {},
  453. isChildMap: {},
  454. isShowMap: {},
  455. deptList: {},
  456. confirmLoading: false,
  457. useTypeMap: {},
  458. statusMap: {},
  459. yesNoMap: {},
  460. createdUserName: '',
  461. expandedKeys: [],
  462. selectedKeys: [],
  463. sourceTypeMap: {},
  464. treeData: [],
  465. positionTreeData: [],
  466. // 表头
  467. columns: [
  468. /* {
  469. title: '序号',
  470. dataIndex: 'index',
  471. width: 100,
  472. checked: true,
  473. customRender: (text, record, index) => {
  474. return `${(this.$refs.table.localPagination.current - 1) * this.$refs.table.localPagination.pageSize + index + 1}`
  475. }
  476. }, */
  477. {
  478. title: '车间',
  479. checked: true,
  480. width: 100,
  481. dataIndex: 'positionName'
  482. },
  483. // {
  484. // title: '位置',
  485. // dataIndex: 'cph',
  486. // width: 150,
  487. // checked: true
  488. // },
  489. {
  490. title: '父位号',
  491. dataIndex: 'no',
  492. width: 100,
  493. checked: true
  494. },
  495. {
  496. title: '设备名称',
  497. checked: true,
  498. dataIndex: 'name',
  499. width: 100
  500. },
  501. {
  502. title: '设备等级',
  503. checked: true,
  504. dataIndex: 'level',
  505. width: 120,
  506. customRender: (text, record, index) => {
  507. return this.BaseTool.Object.getField(this.levelMap, text)
  508. }
  509. },
  510. {
  511. title: '规格、型号',
  512. dataIndex: 'model',
  513. width: 150,
  514. checked: true
  515. },
  516. // {
  517. // title: '操作类型',
  518. // dataIndex: 'operatorType',
  519. // width: 100,
  520. // checked: true,
  521. // customRender: (text, record, index) => {
  522. // return this.BaseTool.Object.getField(this.otherTypeMap, text)
  523. // }
  524. // },
  525. // {
  526. // title: '操作人',
  527. // dataIndex: 'operator',
  528. // width: 100,
  529. // checked: true
  530. // },
  531. // {
  532. // title: '处理人员',
  533. // dataIndex: 'updateUserName',
  534. // width: 100,
  535. // checked: true
  536. // },
  537. // {
  538. // title: '操作内容',
  539. // dataIndex: 'operatorContent',
  540. // width: 100,
  541. // checked: true
  542. // },
  543. // {
  544. // title: '异常处理描述',
  545. // dataIndex: 'exceptionDescription',
  546. // width: 100,
  547. // checked: true
  548. // },
  549. // {
  550. // title: '文件查看',
  551. // checked: true,
  552. // dataIndex: 'sbMeasureLogCredential',
  553. // width: 120,
  554. // scopedSlots: { customRender: 'sbMeasureLogCredential' }
  555. // },
  556. // {
  557. // title: '操作时间',
  558. // dataIndex: 'operatorTime',
  559. // width: 100,
  560. // checked: true
  561. // },
  562. {
  563. title: '厂牌',
  564. dataIndex: 'producerId',
  565. width: 100,
  566. checked: true
  567. },
  568. /* {
  569. title: '自定义类型',
  570. checked: true,
  571. dataIndex: 'useType',
  572. width: 150,
  573. customRender: (text, record, index) => {
  574. return this.BaseTool.Object.getField(this.useTypeMap, text)
  575. }
  576. }, */
  577. /* {
  578. title: '使用机台',
  579. checked: true,
  580. width: 200,
  581. dataIndex: 'saveUserName'
  582. },
  583. {
  584. title: '生产商',
  585. dataIndex: 'producerId',
  586. width: 120,
  587. checked: true
  588. }, */
  589. /* {
  590. title: '大小尺寸',
  591. dataIndex: 'zz',
  592. width: 120,
  593. checked: true
  594. }, */
  595. {
  596. title: '出厂编号',
  597. dataIndex: 'zzh',
  598. width: 100,
  599. checked: true
  600. },
  601. {
  602. title: '管理编号',
  603. dataIndex: 'positionNo',
  604. width: 120,
  605. checked: true
  606. },
  607. /* {
  608. title: '是否显示',
  609. dataIndex: 'isShow',
  610. width: 120,
  611. checked: true,
  612. customRender: (text, record, index) => {
  613. return this.BaseTool.Object.getField(this.isShowMap, text)
  614. }
  615. }, */
  616. /* {
  617. title: '是否子设备',
  618. dataIndex: 'isChild',
  619. width: 120,
  620. checked: true,
  621. customRender: (text, record, index) => {
  622. return this.BaseTool.Object.getField(this.isChildMap, text)
  623. }
  624. }, */
  625. /* {
  626. title: '资产编号',
  627. dataIndex: 'financingNo',
  628. width: 120,
  629. checked: true
  630. },
  631. {
  632. title: '设备原值',
  633. dataIndex: 'initialValue',
  634. width: 100,
  635. checked: true,
  636. customRender: (text, record, index) => {
  637. return this.BaseTool.Amount.formatter(text)
  638. }
  639. },
  640. {
  641. title: '购置日期',
  642. dataIndex: 'buyDate',
  643. width: 120,
  644. checked: true
  645. },
  646. {
  647. title: '投用日期',
  648. dataIndex: 'startDate',
  649. width: 120,
  650. checked: true
  651. }, */
  652. /* {
  653. title: '检定日期',
  654. dataIndex: 'checkDate',
  655. width: 150,
  656. checked: true
  657. },
  658. {
  659. title: '检定周期',
  660. dataIndex: 'checkPeriod',
  661. width: 100,
  662. checked: true,
  663. customRender: (text, record, index) => {
  664. if (record.nextCheckDate == null) {
  665. return '未知'
  666. } else {
  667. return text + '月'
  668. }
  669. }
  670. }, */
  671. {
  672. title: '报废日期',
  673. dataIndex: 'scrapedDate',
  674. width: 120,
  675. checked: true
  676. },
  677. {
  678. title: '有效期限',
  679. dataIndex: 'nextCheckDate',
  680. width: 120,
  681. checked: true
  682. },
  683. /* {
  684. title: '检定截止',
  685. dataIndex: 'restDay',
  686. width: 100,
  687. checked: true,
  688. customRender: (text, record, index) => {
  689. if (record.nextCheckDate == null) {
  690. return '未知'
  691. } else {
  692. return this.BaseTool.Date.getCountBetween(new Date(), record.nextCheckDate, 1) + '天'
  693. }
  694. }
  695. }, */
  696. {
  697. title: '检定单位',
  698. checked: true,
  699. dataIndex: 'dph',
  700. width: 100
  701. },
  702. {
  703. title: '是否强检',
  704. dataIndex: 'checkType',
  705. width: 100,
  706. checked: true,
  707. customRender: (text, record, index) => {
  708. return this.BaseTool.Object.getField(this.checkTypeMap, text)
  709. }
  710. },
  711. {
  712. title: '备注',
  713. checked: true,
  714. dataIndex: 'remark',
  715. width: 100
  716. },
  717. {
  718. title: '状态',
  719. checked: true,
  720. dataIndex: 'status',
  721. align: 'center',
  722. width: 100,
  723. scopedSlots: { customRender: 'status' }
  724. },
  725. {
  726. title: '操作',
  727. key: 'action',
  728. checked: true,
  729. align: 'center',
  730. width: 120,
  731. scopedSlots: { customRender: 'action' }
  732. }
  733. ],
  734. childColumns1: [
  735. {
  736. title: '序号',
  737. dataIndex: 'index',
  738. width: 100,
  739. checked: true,
  740. customRender: (text, record, index) => {
  741. return index + 1
  742. }
  743. },
  744. {
  745. title: '设备名称',
  746. checked: true,
  747. width: 200,
  748. dataIndex: 'sbName'
  749. },
  750. {
  751. title: '操作类型',
  752. checked: true,
  753. width: 200,
  754. dataIndex: 'otherType',
  755. customRender: (text, record, index) => {
  756. return this.BaseTool.Object.getField(this.otherTypeMap, text)
  757. }
  758. },
  759. {
  760. title: '操作人',
  761. checked: true,
  762. width: 200,
  763. dataIndex: 'createdUserName'
  764. },
  765. {
  766. title: '处理人员',
  767. checked: true,
  768. width: 200,
  769. dataIndex: 'updateUserName'
  770. },
  771. {
  772. title: '异常处理描述',
  773. checked: true,
  774. width: 200,
  775. dataIndex: 'exceptionDescription'
  776. },
  777. {
  778. title: '操作内容',
  779. checked: true,
  780. width: 200,
  781. dataIndex: 'content'
  782. },
  783. {
  784. title: '文件查看',
  785. checked: true,
  786. dataIndex: 'sbMeasureLogCredential',
  787. width: 120,
  788. scopedSlots: { customRender: 'sbMeasureLogCredential' }
  789. },
  790. {
  791. title: '操作时间',
  792. checked: true,
  793. width: 200,
  794. dataIndex: 'createdTime'
  795. }
  796. ],
  797. otherTypeMap: {},
  798. // 加载数据方法 必须为 Promise 对象
  799. loadData: (parameter) => {
  800. parameter = {
  801. ...parameter,
  802. ...this.queryParam,
  803. dataScope: {
  804. sortBy: 'asc',
  805. sortName: 'position_no'
  806. }
  807. }
  808. this.selectedRowKeys = []
  809. return getSbInfoPage2(Object.assign(parameter, this.queryParam)).then((res) => {
  810. return res.data
  811. })
  812. },
  813. selectedRowKeys: [],
  814. selectedRows: [],
  815. options: {
  816. alert: {
  817. show: true,
  818. clear: () => {
  819. this.selectedRowKeys = []
  820. }
  821. },
  822. rowSelection: {
  823. selectedRowKeys: this.selectedRowKeys,
  824. onChange: this.onSelectChange
  825. }
  826. },
  827. optionAlertShow: false
  828. }
  829. },
  830. created () {
  831. console.log('this.$route.query.parentId: ' + this.$route.query.parentId)
  832. this.queryParam.parentId = this.$route.query.parentId
  833. this.queryParam.parentName = this.$route.query.parentName
  834. this.tableOption()
  835. this.otherTypeMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SB_MEASURE_OTHER_TYPE)
  836. console.log(11)
  837. console.log(this.otherTypeMap)
  838. this.checkTypeMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.CHECK_TYPE)
  839. this.depreciationTypeMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SBINFO_DEPRECIATIONTYPE)
  840. this.levelMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SBINFO_LEVEL)
  841. this.statusMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SB_INFO_STATUS)
  842. this.unitMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SBINFO_UNIT)
  843. this.sourceTypeMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SBTYPE_SOURCETYPE)
  844. this.useTypeMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SB_USE_TYPE)
  845. this.isChildMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SB_IS_CHILD)
  846. this.isShowMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SB_IS_SHOW)
  847. this.lineMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.REMOTE_LINE)
  848. this.yesNoMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.YES_NO)
  849. querySbPosition().then((res) => {
  850. this.sbPositionData = res.data
  851. })
  852. },
  853. methods: {
  854. tableOption () {
  855. this.setTree()
  856. if (!this.optionAlertShow) {
  857. this.options = {
  858. alert: {
  859. show: true,
  860. clear: () => {
  861. this.selectedRowKeys = []
  862. }
  863. },
  864. rowSelection: {
  865. selectedRowKeys: this.selectedRowKeys,
  866. onChange: this.onSelectChange,
  867. getCheckboxProps: (record) => ({
  868. props: {
  869. disabled: false,
  870. name: record.id
  871. }
  872. })
  873. }
  874. }
  875. this.optionAlertShow = true
  876. } else {
  877. this.options = {
  878. alert: false,
  879. rowSelection: null
  880. }
  881. this.optionAlertShow = false
  882. }
  883. },
  884. batchDelete (id) {
  885. let ids = []
  886. if (this.BaseTool.String.isBlank(id)) {
  887. const length = this.selectedRows.length
  888. if (length === 0) {
  889. this.$message.info('请选择要删除的记录')
  890. return
  891. }
  892. ids = this.selectedRows.map((item) => item.id)
  893. } else {
  894. ids = [id]
  895. }
  896. deleteSbInfos(ids).then((res) => {
  897. this.$message.info('删除成功')
  898. this.handleOk()
  899. this.$refs.table.clearSelected()
  900. })
  901. },
  902. batchGenerate () {
  903. this.confirmLoading = true
  904. this.$message.info('正在生成请稍后')
  905. generateSbCodeAll().then((res) => {
  906. this.confirmLoading = false
  907. this.$message.info('生成成功')
  908. this.handleOk()
  909. this.$refs.table.clearSelected()
  910. })
  911. },
  912. handleEdit (record) {
  913. fetchSbInfo({ id: record.id }).then((res) => {
  914. this.visible = false
  915. const modal = this.$refs.baseModal
  916. modal.base(res.data)
  917. })
  918. },
  919. handlePrint (record) {
  920. this.visible = false
  921. fetchSbInfo({ id: record.id }).then((res) => {
  922. const modal = this.$refs.printInSbInfoBatch
  923. modal.base([res.data])
  924. })
  925. },
  926. batchLocation () {
  927. let ids = []
  928. const length = this.selectedRows.length
  929. if (length === 0) {
  930. this.$message.info('请选择设备')
  931. return
  932. }
  933. ids = this.selectedRows.map((item) => item.id)
  934. console.log(ids)
  935. batchLocationList({ ids }).then((res) => {
  936. this.visible = false
  937. const modal = this.$refs.baseFormLocation
  938. modal.base(res.data)
  939. })
  940. },
  941. batchIncorrect (id) {
  942. let ids = []
  943. if (this.BaseTool.String.isBlank(id)) {
  944. const length = this.selectedRows.length
  945. if (length === 0) {
  946. this.$message.info('请选择要填报的设备')
  947. return
  948. }
  949. ids = this.selectedRows
  950. } else {
  951. ids = [id]
  952. }
  953. this.visible = false
  954. const modal = this.$refs.baseModalMeasure
  955. modal.base(ids, this.correctType)
  956. },
  957. batchIncorrectInStore (id) {
  958. let ids = []
  959. if (this.BaseTool.String.isBlank(id)) {
  960. const length = this.selectedRows.length
  961. if (length === 0) {
  962. this.$message.info('请选择要填报的设备')
  963. return
  964. }
  965. ids = this.selectedRows
  966. } else {
  967. ids = [id]
  968. }
  969. this.visible = false
  970. const modal = this.$refs.baseModalMeasureInStore
  971. modal.base(ids, this.correctType)
  972. },
  973. handleMeasureBatch () {
  974. const modal = this.$refs.detailSbMeasureModal
  975. modal.base()
  976. },
  977. handlePrintBatch () {
  978. this.visible = false
  979. let ids = []
  980. const length = this.selectedRows.length
  981. if (length === 0) {
  982. this.$message.info('请选择要打印的设备')
  983. return
  984. }
  985. ids = this.selectedRows.map((item) => item.id)
  986. fetchSbInfos(ids).then((res) => {
  987. const modal = this.$refs.printInSbInfoBatch
  988. modal.base(res.data)
  989. })
  990. },
  991. handleBackBatch (status) {
  992. const length = this.selectedRowKeys.length
  993. if (length === 0) {
  994. this.$message.info('请选择设备')
  995. return
  996. }
  997. const modal = this.$refs.backForm
  998. modal.base(this.selectedRowKeys, status)
  999. },
  1000. handleStart (record) {
  1001. const modal = this.$refs.baseModalStatusLog
  1002. modal.base(null, {
  1003. sbId: record.id,
  1004. sbNo: record.no,
  1005. changeUserId: this.$store.getters.userInfo.userId,
  1006. actualUser: this.$store.getters.userInfo.realName,
  1007. preStatus: record.status,
  1008. afterStatus: this.DictCache.VALUE.SB_INFO_STATUS.IN_USE
  1009. })
  1010. },
  1011. handleStop (record) {
  1012. const modal = this.$refs.baseModalStatusLog
  1013. modal.base(null, {
  1014. sbId: record.id,
  1015. sbNo: record.no,
  1016. changeUserId: this.$store.getters.userInfo.userId,
  1017. actualUser: this.$store.getters.userInfo.realName,
  1018. preStatus: record.status,
  1019. afterStatus: this.DictCache.VALUE.SB_INFO_STATUS.IN_STOP
  1020. })
  1021. },
  1022. handleAdd () {
  1023. this.visible = false
  1024. this.$refs.baseModal.base()
  1025. },
  1026. handleView (record) {
  1027. fetchSbInfo({ id: record.id }).then((res) => {
  1028. this.visible = false
  1029. const modal = this.$refs.detailModal
  1030. modal.base(res.data)
  1031. })
  1032. },
  1033. showChangeLog (record) {
  1034. console.log(record)
  1035. console.log(this.$refs)
  1036. this.$refs.sbChangeRecordSelectModal.base({}, { sbId: record.id })
  1037. },
  1038. handleCopy (record) {
  1039. this.visible = false
  1040. fetchSbInfo({ id: record.id }).then((res) => {
  1041. const modal = this.$refs.baseModal
  1042. modal.base(res.data, 1)
  1043. })
  1044. },
  1045. handleOk () {
  1046. this.visible = true
  1047. this.setTree()
  1048. if (this.dateRange != null) {
  1049. this.queryParam.nextCheckDateStart = this.dateRange[0]
  1050. this.queryParam.nextCheckDateEnd = this.dateRange[1]
  1051. this.queryParam.nextCheckDateStart = this.queryParam.nextCheckDateStart
  1052. ? this.queryParam.nextCheckDateStart.format(this.BaseTool.Date.PICKER_NORM_DATE_PATTERN)
  1053. : null
  1054. this.queryParam.nextCheckDateEnd = this.queryParam.nextCheckDateEnd
  1055. ? this.queryParam.nextCheckDateEnd.format(this.BaseTool.Date.PICKER_NORM_DATE_PATTERN)
  1056. : null
  1057. }
  1058. if (this.dateRangeCheck != null) {
  1059. this.queryParam.checkDateStart = this.dateRangeCheck[0]
  1060. this.queryParam.checkDateEnd = this.dateRangeCheck[1]
  1061. this.queryParam.checkDateStart = this.queryParam.checkDateStart
  1062. ? this.queryParam.checkDateStart.format(this.BaseTool.Date.PICKER_NORM_DATE_PATTERN)
  1063. : null
  1064. this.queryParam.checkDateEnd = this.queryParam.checkDateEnd
  1065. ? this.queryParam.checkDateEnd.format(this.BaseTool.Date.PICKER_NORM_DATE_PATTERN)
  1066. : null
  1067. }
  1068. this.$refs.table.clearSelected()
  1069. this.$refs.table.refresh()
  1070. },
  1071. onSelectChange (selectedRowKeys, selectedRows) {
  1072. this.selectedRowKeys = selectedRowKeys
  1073. this.selectedRows = selectedRows
  1074. },
  1075. resetSearchForm () {
  1076. this.queryParam = {
  1077. filter: this.filter,
  1078. useType: this.useType,
  1079. measureStatus: this.measureStatus,
  1080. isMeasure: this.isMeasure,
  1081. isSelf: this.isSelf,
  1082. id: this.$route.query.id,
  1083. typeId: this.$route.query.typeId,
  1084. status: this.$route.query.status || this.status
  1085. }
  1086. this.visible = true
  1087. this.$refs.table.refresh(true)
  1088. },
  1089. doExport () {
  1090. const parameter = {
  1091. ...this.queryParam,
  1092. sbIds: this.selectedRowKeys,
  1093. dataScope: {
  1094. sortBy: 'asc',
  1095. sortName: 'no'
  1096. }
  1097. }
  1098. console.log(parameter)
  1099. exportSbInfo2(parameter).then((file) => {
  1100. this.BaseTool.UPLOAD.downLoadExportExcel(file)
  1101. })
  1102. },
  1103. setTree (record = {}) {
  1104. queryDept({ nature: this.DictCache.VALUE.SYS_DEPT_NATURE.JITUAN }).then((res) => {
  1105. this.areaList = res.data
  1106. })
  1107. getSbPositionTree().then((res) => {
  1108. this.positionTreeData = res.data
  1109. })
  1110. fetchSbTypeTree().then((res) => {
  1111. this.treeData = res.data
  1112. })
  1113. },
  1114. onSelect: function (selectedKeys, info) {
  1115. this.selectedKeys = selectedKeys
  1116. this.queryParam.typeId = selectedKeys.length > 0 ? selectedKeys[0] : ''
  1117. this.$refs.table.refresh(true)
  1118. },
  1119. onExpand (expanded, record) {
  1120. // expanded判断展开or收缩操作,record当前行数据
  1121. this.childMap = []
  1122. getLogBySbId({ sbId: record.id }).then((res) => {
  1123. record.childMap = res.data.rows
  1124. this.$forceUpdate()
  1125. })
  1126. },
  1127. getLogBySbId (record, createdUserName) {
  1128. getLogBySbId({ sbId: record.id, createdUserName }).then((res) => {
  1129. record.childMap = res.data.rows
  1130. this.$forceUpdate()
  1131. })
  1132. },
  1133. addLogBySb (record) {
  1134. this.record = record
  1135. this.$refs.addLogForm.base(record)
  1136. },
  1137. handleLogOk (val) {
  1138. getLogBySbId({ sbId: val.sbId }).then((res) => {
  1139. this.record.childMap = res.data.rows
  1140. this.$forceUpdate()
  1141. })
  1142. },
  1143. doImport () {
  1144. this.$refs.importModal.base(null, null)
  1145. },
  1146. doImportStandard () {
  1147. // this.$refs.importModalStandard.base()
  1148. this.$refs.importModalUpdate2.base(null, 1, this.typeFlag)
  1149. },
  1150. doImportForUpdate () {
  1151. this.$refs.importModalUpdate2.base(null, 2, 2)
  1152. },
  1153. doImportMeasure () {
  1154. this.$refs.importMeasure.base()
  1155. },
  1156. rowClassName (record, index) {
  1157. if (record.measureStatus === 1 && record.status !== 7) return 'orange'
  1158. switch (record.status) {
  1159. case 1:
  1160. return 'green'
  1161. case 3:
  1162. case 4:
  1163. return 'red'
  1164. case 5:
  1165. case 6:
  1166. case 7:
  1167. return 'gray'
  1168. }
  1169. }
  1170. }
  1171. }
  1172. </script>
  1173. <style lang="less" scoped>
  1174. /deep/ .green {
  1175. background: rgb(58, 233, 58);
  1176. }
  1177. /deep/ .red {
  1178. background: red;
  1179. }
  1180. /deep/ .gray {
  1181. background: #666;
  1182. }
  1183. /deep/ .orange {
  1184. background: rgb(245, 132, 91);
  1185. }
  1186. </style>