zx.vue 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810
  1. <template>
  2. <div class="app-container">
  3. <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
  4. <el-form-item :label="$t('装置')" prop="plantCode">
  5. <el-input
  6. v-model="queryParams.plantCode"
  7. :placeholder="$t('请输入') + $t('装置')"
  8. clearable
  9. size="small"
  10. @keyup.enter.native="handleQuery"
  11. />
  12. </el-form-item>
  13. <el-form-item :label="$t('单元')" prop="unit" label-width="50">
  14. <el-input
  15. v-model="queryParams.unit"
  16. :placeholder="$t('请输入') + $t('单元')"
  17. clearable
  18. size="small"
  19. @keyup.enter.native="handleQuery"
  20. />
  21. </el-form-item>
  22. <el-form-item :label="$t('设备名称')" prop="devname" label-width="50">
  23. <el-input
  24. v-model="queryParams.devname"
  25. :placeholder="$t('请输入') + $t('设备名称')"
  26. clearable
  27. size="small"
  28. @keyup.enter.native="handleQuery"
  29. />
  30. </el-form-item>
  31. <el-form-item :label="$t('设备位号')" prop="devno" label-width="50">
  32. <el-input
  33. v-model="queryParams.devno"
  34. :placeholder="$t('请输入') + $t('位号')"
  35. clearable
  36. size="small"
  37. @keyup.enter.native="handleQuery"
  38. />
  39. </el-form-item>
  40. <el-form-item>
  41. <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">{{ $t('搜索') }}</el-button>
  42. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">{{ $t('重置') }}</el-button>
  43. </el-form-item>
  44. </el-form>
  45. <el-row :gutter="10" class="mb8">
  46. <el-col :span="1.5">
  47. <el-button
  48. type="danger"
  49. icon="el-icon-delete"
  50. size="mini"
  51. :disabled="multiple"
  52. @click="handleDelete"
  53. v-hasPermi="['sems:specDzsb:remove']"
  54. >{{ $t('删除') }}</el-button>
  55. </el-col>
  56. <el-col :span="1.5">
  57. <el-button
  58. type="warning"
  59. icon="el-icon-download"
  60. size="mini"
  61. @click="handleExport"
  62. v-hasPermi="['sems:specDzsb:export']"
  63. >{{ $t('导出') }}</el-button>
  64. </el-col>
  65. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  66. </el-row>
  67. <el-table v-loading="loading" ref="deviceTable" :data="specDzsbList" @selection-change="handleSelectionChange" :height="clientHeight" border>
  68. <el-table-column type="selection" width="55" align="center" />
  69. <el-table-column :label="$t('装置')" align="center" fixed="left" prop="plantCode" :show-overflow-tooltip="true"/>
  70. <el-table-column :label="$t('装置维修组')" align="center" fixed="left" prop="plantMaint" :show-overflow-tooltip="true"/>
  71. <el-table-column :label="$t('装置维修工程师')" align="center" fixed="left" prop="engineer" :show-overflow-tooltip="true"/>
  72. <el-table-column :label="$t('状态')" align="center" fixed="left" prop="status" :formatter="statusFormat" />
  73. <el-table-column :label="$t('申请状态')" align="center" fixed="left" prop="approveStatus" :formatter="approveStatusFormat" />
  74. <el-table-column :label="$t('设备名称')" align="center" fixed="left" prop="devname" :show-overflow-tooltip="true"/>
  75. <el-table-column :label="$t('设备位号')" align="center" fixed="left" prop="devno" :show-overflow-tooltip="true"/>
  76. <el-table-column :label="$t('档案号')" align="center" prop="docno" :show-overflow-tooltip="true"/>
  77. <el-table-column :label="$t('设备型号')" align="center" prop="model" :show-overflow-tooltip="true"/>
  78. <el-table-column :label="$t('起吊重量')+'(Ton)'" align="center" prop="capacity" :show-overflow-tooltip="true"/>
  79. <el-table-column :label="$t('使用地点')" align="center" prop="location" :show-overflow-tooltip="true"/>
  80. <el-table-column :label="$t('设备注册编号')" align="center" prop="regno" :show-overflow-tooltip="true"/>
  81. <el-table-column :label="$t('投用日期')" align="center" prop="submitdate" width="100">
  82. <template slot-scope="scope">
  83. <span>{{ parseTime(scope.row.submitdate, '{y}-{m}-{d}') }}</span>
  84. </template>
  85. </el-table-column>
  86. <el-table-column :label="$t('制造单位')" align="center" prop="createUnit" :show-overflow-tooltip="true"/>
  87. <el-table-column :label="$t('是否防爆')" align="center" prop="isEx" :show-overflow-tooltip="true"/>
  88. <el-table-column :label="$t('检验单位')" align="center" prop="checkUnit" :show-overflow-tooltip="true"/>
  89. <el-table-column :label="$t('检验策略')" align="center" prop="checkStrategy" :show-overflow-tooltip="true"/>
  90. <el-table-column :label="$t('检验日期')" align="center" prop="warnDate" width="100">
  91. <template slot-scope="scope">
  92. <span>{{ parseTime(scope.row.warnDate, '{y}-{m}-{d}') }}</span>
  93. </template>
  94. </el-table-column>
  95. <el-table-column :label="$t('下次检验日期')" align="center" prop="nextWarnDate" width="100">
  96. <template slot-scope="scope">
  97. <span>{{ parseTime(scope.row.nextWarnDate, '{y}-{m}-{d}') }}</span>
  98. </template>
  99. </el-table-column>
  100. <el-table-column :label="$t('检验报告编号')" align="center" prop="reportNo" :show-overflow-tooltip="true"/>
  101. <el-table-column :label="$t('定期检验结论')" align="center" prop="perTestConclusion" :show-overflow-tooltip="true"/>
  102. <el-table-column :label="$t('备注')" align="center" prop="remarks" :show-overflow-tooltip="true"/>
  103. <el-table-column :label="$t('操作')" align="center" fixed="right" width="120" class-name="small-padding fixed-width">
  104. <template slot-scope="scope">
  105. <el-button v-if="scope.row.approveTime != null" type="text" size="small" @click="hisApprove(scope.row,devType)">
  106. {{ $t('申请记录') }}</el-button>
  107. <el-button
  108. type="text"
  109. size="mini"
  110. @click="checkList(scope.row,devType)"
  111. >{{ $t('检验记录') }}</el-button>
  112. <el-button
  113. type="text"
  114. size="mini"
  115. @click="hisReform(scope.row)"
  116. >{{ $t('改造记录') }}</el-button>
  117. </template>
  118. </el-table-column>
  119. </el-table>
  120. <pagination
  121. v-show="total>0"
  122. :total="total"
  123. :page.sync="queryParams.pageNum"
  124. :page-sizes="[20,100,300,500]"
  125. :limit.sync="queryParams.pageSize"
  126. @pagination="getList"
  127. />
  128. <!-- 添加或修改特种设备起重机械台账对话框 -->
  129. <el-dialog v-dialogDrag :title="title" :visible.sync="open" width="1200px" append-to-body>
  130. <el-form ref="form" :model="form" :rules="rules" label-width="130px">
  131. <el-row>
  132. <el-col :span="12">
  133. <el-form-item :label="$t('装置')" prop="plantCode">
  134. <el-select v-model="form.plantCode" :placeholder="$t('请选择')+ $t('装置')" filterable clearable size="small" v-bind:disabled="dataForm==1">
  135. <el-option
  136. v-for="dict in plantOptions"
  137. :key="dict.name"
  138. :label="dict.name"
  139. :value="dict.name"
  140. />
  141. </el-select>
  142. </el-form-item>
  143. </el-col>
  144. <el-col :span="12">
  145. <el-form-item :label="$t('装置维修组')" prop="plantMaint">
  146. <el-select v-model="form.plantMaint" :placeholder="$t('请选择')+ $t('装置维修组')" filterable clearable size="small">
  147. <el-option
  148. v-for="dict in plantMaintOptions"
  149. :key="dict.dictValue"
  150. :label="dict.dictValue"
  151. :value="dict.dictValue"
  152. />
  153. </el-select>
  154. </el-form-item>
  155. </el-col>
  156. </el-row>
  157. <el-row>
  158. <el-col :span="12">
  159. <el-form-item :label="$t('装置维修工程师')" prop="engineer">
  160. <el-input v-model="form.engineer" :placeholder="$t('请输入')+ $t('工程师')" />
  161. </el-form-item>
  162. </el-col>
  163. <el-col :span="12">
  164. <el-form-item :label="$t('设备名称')" prop="devname">
  165. <el-input v-model="form.devname" :placeholder="$t('请输入')+ $t('设备名称')" />
  166. </el-form-item>
  167. </el-col>
  168. </el-row>
  169. <el-row>
  170. <el-col :span="12">
  171. <el-form-item :label="$t('设备位号')" prop="devno">
  172. <el-input v-model="form.devno" :placeholder="$t('请输入')+ $t('设备位号')" />
  173. </el-form-item>
  174. </el-col>
  175. <el-col :span="12">
  176. <el-form-item :label="$t('档案号')" prop="docno">
  177. <el-input v-model="form.docno" :placeholder="$t('请输入')+ $t('档案号')" />
  178. </el-form-item>
  179. </el-col>
  180. </el-row>
  181. <el-row>
  182. <el-col :span="12">
  183. <el-form-item :label="$t('设备型号')" prop="model">
  184. <el-input v-model="form.model" :placeholder="$t('请输入')+ $t('设备型号')" />
  185. </el-form-item>
  186. </el-col>
  187. <el-col :span="12">
  188. <el-form-item :label="$t('起吊重量')+'(Ton)'" prop="capacity">
  189. <el-input v-model="form.capacity" :placeholder="$t('请输入')+ $t('起吊重量')" />
  190. </el-form-item>
  191. </el-col>
  192. </el-row>
  193. <el-row>
  194. <el-col :span="12">
  195. <el-form-item :label="$t('使用地点')" prop="location">
  196. <el-input v-model="form.location" :placeholder="$t('请输入')+ $t('设备使用地点')" />
  197. </el-form-item>
  198. </el-col>
  199. <el-col :span="12">
  200. <el-form-item :label="$t('设备注册编号')" prop="regno">
  201. <el-input v-model="form.regno" :placeholder="$t('请输入')+ $t('注册代码')" />
  202. </el-form-item>
  203. </el-col>
  204. </el-row>
  205. <el-row>
  206. <el-col :span="12">
  207. <el-form-item :label="$t('制造单位')" prop="createUnit">
  208. <el-input v-model="form.createUnit" :placeholder="$t('请输入')+ $t('制造单位')" />
  209. </el-form-item>
  210. </el-col>
  211. <el-col :span="12">
  212. <el-form-item :label="$t('是否防爆')" prop="isEx">
  213. <el-input v-model="form.isEx" :placeholder="$t('请输入')+ $t('是否防爆')" />
  214. </el-form-item>
  215. </el-col>
  216. </el-row>
  217. <el-row>
  218. <el-col :span="12">
  219. <el-form-item :label="$t('投用日期')" prop="submitdate">
  220. <el-date-picker clearable size="small" style="width: 200px"
  221. v-model="form.submitdate"
  222. type="date"
  223. value-format="yyyy-MM-dd"
  224. :placeholder="$t('请选择')+ $t('提交日期')">
  225. </el-date-picker>
  226. </el-form-item>
  227. </el-col>
  228. <el-col :span="12">
  229. <el-form-item :label="$t('检验单位')" prop="checkUnit">
  230. <el-input v-model="form.checkUnit" :placeholder="$t('请输入')+ $t('检验单位')" />
  231. </el-form-item>
  232. </el-col>
  233. </el-row>
  234. <el-row>
  235. <el-col :span="12">
  236. <el-form-item :label="$t('检验策略')" prop="checkStrategy">
  237. <el-input v-model="form.checkStrategy" :placeholder="$t('请输入')+ $t('检验策略')" />
  238. </el-form-item>
  239. </el-col>
  240. <el-col :span="12">
  241. <el-form-item :label="$t('检验日期')" prop="warnDate">
  242. <el-date-picker clearable size="small" style="width: 200px"
  243. v-model="form.warnDate"
  244. type="date"
  245. value-format="yyyy-MM-dd"
  246. :placeholder="$t('请选择')+ $t('上次年检时间')">
  247. </el-date-picker>
  248. </el-form-item>
  249. </el-col>
  250. </el-row>
  251. <el-row>
  252. <el-col :span="12">
  253. <el-form-item :label="$t('下次检验日期')" prop="nextWarnDate">
  254. <el-date-picker clearable size="small" style="width: 200px"
  255. v-model="form.nextWarnDate"
  256. type="date"
  257. value-format="yyyy-MM-dd"
  258. :placeholder="$t('请选择')+ $t('下次检验日期')">
  259. </el-date-picker>
  260. </el-form-item>
  261. </el-col>
  262. <el-col :span="12">
  263. <el-form-item :label="$t('检验报告编号')" prop="reportNo">
  264. <el-input v-model="form.reportNo" :placeholder="$t('请输入')+ $t('报告编号')" />
  265. </el-form-item>
  266. </el-col>
  267. </el-row>
  268. <el-row>
  269. <el-col :span="12">
  270. <el-form-item :label="$t('备注')" prop="remarks">
  271. <el-input v-model="form.remarks" :placeholder="$t('请输入')+ $t('备注')" />
  272. </el-form-item>
  273. </el-col>
  274. <el-col :span="12">
  275. <el-form-item :label="$t('归属部门')" prop="deptId">
  276. <treeselect v-model="form.deptId" :options="deptOptions" :show-count="true" :placeholder="$t('请选择')+ $t('归属部门')" />
  277. </el-form-item>
  278. </el-col>
  279. </el-row>
  280. <el-row>
  281. <el-col :span="12">
  282. <el-form-item :label="$t('定期检验结论')" prop="perTestConclusion">
  283. <el-input v-model="form.perTestConclusion" type="textarea" :placeholder="$t('请输入')+ $t('定期检验结论')" />
  284. </el-form-item>
  285. </el-col>
  286. </el-row>
  287. </el-form>
  288. <div slot="footer" class="dialog-footer">
  289. <el-button type="primary" @click="submitForm">{{ $t('确 定') }}</el-button>
  290. <el-button @click="cancel">{{ $t('取 消') }}</el-button>
  291. </div>
  292. </el-dialog>
  293. <!-- 用户导入对话框 -->
  294. <el-dialog v-dialogDrag :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body>
  295. <el-upload
  296. ref="upload"
  297. :limit="1"
  298. accept=".xlsx, .xls"
  299. :headers="upload.headers"
  300. :action="upload.url + '?updateSupport=' + upload.updateSupport"
  301. :disabled="upload.isUploading"
  302. :on-progress="handleFileUploadProgress"
  303. :on-success="handleFileSuccess"
  304. :auto-upload="false"
  305. drag
  306. >
  307. <i class="el-icon-upload"></i>
  308. <div class="el-upload__text">
  309. {{ $t('将文件拖到此处,或') }}
  310. <em>{{ $t('点击上传') }}</em>
  311. </div>
  312. <div class="el-upload__tip" slot="tip">
  313. <!-- <el-checkbox v-model="upload.updateSupport" />是否更新已经存在的用户数据-->
  314. <el-link type="info" style="font-size:12px" @click="importTemplate">{{ $t('下载模板') }}</el-link>
  315. </div>
  316. <form ref="downloadFileForm" :action="upload.downloadAction" target="FORMSUBMIT">
  317. <input name="type" :value="upload.type" hidden />
  318. </form>
  319. <div class="el-upload__tip" style="color:red" slot="tip">{{ $t('提示:仅允许导入“xls”或“xlsx”格式文件!') }}</div>
  320. </el-upload>
  321. <div slot="footer" class="dialog-footer">
  322. <el-button type="primary" @click="submitFileForm">{{ $t('确定') }}</el-button>
  323. <el-button @click="upload.open = false">{{ $t('取消') }}</el-button>
  324. </div>
  325. </el-dialog>
  326. <form ref="downloadDevForm" :action="downloadDevAction" target="FORMSUBMIT">
  327. <input name="devType" v-model="devType" hidden />
  328. <input name="ids" v-model="ids" hidden />
  329. <input name="downloadType" v-model="downloadType" hidden />
  330. </form>
  331. <el-dialog :title="$t('检验更新')" width="30%" :visible.sync="inspectionInformation">
  332. <el-form ref="dateform" label-width="120px">
  333. <el-form-item>
  334. <span>{{$t('已选择')}} {{dataListSelections.length}}</span>
  335. </el-form-item>
  336. <el-form-item>
  337. <el-button type="primary" :disabled="dataListSelections.length <= 0" @click="downloadDev(2)">{{$t('downloadSelect')}}</el-button>
  338. </el-form-item>
  339. <el-upload
  340. class="upload-demo"
  341. drag
  342. ref="upload"
  343. :limit="5"
  344. :show-file-list="false"
  345. :on-success="handleFileSuccess"
  346. :auto-upload="true"
  347. :headers="upload.headers"
  348. :action="uploadUrl(2)"
  349. multiple>
  350. <i class="el-icon-upload"></i>
  351. <div class="el-upload__text">{{$t('文件')}}<em>{{$t('点击上传')}}</em></div>
  352. <div class="el-upload__tip" slot="tip">{{$t('仅支持excel格式')}}</div>
  353. </el-upload>
  354. </el-form>
  355. <div slot="footer" class="dialog-footer">
  356. <el-button @click="inspectionInformation = false">{{$t('返回')}}</el-button>
  357. </div>
  358. </el-dialog>
  359. <el-dialog v-dialogDrag :title="modifyTitle" :visible.sync="modifyVisible" width="550px" append-to-body>
  360. <el-form>
  361. <el-form-item ref="modifyForm" :model="modifyForm" :label="$t('确认人')" prop="plantMaint">
  362. <el-select v-model="modifyForm.wxjl" :placeholder="$t('请选择')+ $t('装置维修经理')" filterable clearable size="small">
  363. <el-option
  364. v-for="dict in wxjlList"
  365. :key="dict.userId"
  366. :label="dict.nickName"
  367. :value="dict.userId"
  368. />
  369. </el-select>
  370. </el-form-item>
  371. </el-form>
  372. <el-button type="primary" @click="submitModofyForm">{{ $t('提交') }}</el-button>
  373. </el-dialog>
  374. <add-approve v-if="addAprroveVisible" ref="addApprove" @refreshDataList="getList"></add-approve>
  375. <his-approve v-if="hisAprroveVisible" ref="hisApprove" @refreshDataList="getList"></his-approve>
  376. <his-check v-if="hisCheckVisible" ref="hisCheck" @refreshDataList="getList"></his-check>
  377. <HisReform v-if="hisReformVisible" ref="hisReformList" ></HisReform>
  378. </div>
  379. </template>
  380. <script>
  381. import { listSpecDzsb, getSpecDzsb, delSpecDzsb, addSpecDzsb, updateSpecDzsb, exportSpecDzsb, importTemplate,updateSpecDzsbPre} from "@/api/sems/specDzsb";
  382. import { treeselect } from "@/api/system/dept";
  383. import { getToken } from "@/utils/auth";
  384. import Treeselect from "@riophae/vue-treeselect";
  385. import "@riophae/vue-treeselect/dist/vue-treeselect.css";
  386. import AddApprove from "../approve/tapprove-add"
  387. import {listPlant, mylistPlant} from "@/api/system/plant";
  388. import HisApprove from "../approve/tapprove-his";
  389. import HisCheck from "../check/check";
  390. import { addModify } from "@/api/sems/his/modify";
  391. import { listPostUser } from "@/api/system/user";
  392. import HisReform from "./specDzsb-hisReform";
  393. export default {
  394. name: "SpecDzsb",
  395. components: { Treeselect,AddApprove ,HisApprove,HisCheck,HisReform },
  396. data() {
  397. return {
  398. hisReformVisible: false,
  399. dataForm: 0,
  400. devType: 3,
  401. // 遮罩层
  402. loading: true,
  403. addAprroveVisible: false,
  404. hisAprroveVisible: false,
  405. hisCheckVisible: false,
  406. inspectionInformation: false,
  407. downloadType: '',
  408. downloadDevAction: process.env.VUE_APP_BASE_API + '/common/download/exportDevList',
  409. modifyTitle: this.$t('设备修改申请'),
  410. modifyVisible: false,
  411. // 选中数组
  412. ids: [],
  413. dataListSelections: [],
  414. // 非单个禁用
  415. single: true,
  416. // 非多个禁用
  417. multiple: true,
  418. // 显示搜索条件
  419. showSearch: false,
  420. // 总条数
  421. total: 0,
  422. // 特种设备起重机械台账表格数据
  423. specDzsbList: [],
  424. // 弹出层标题
  425. title: "",
  426. // 部门树选项
  427. deptOptions: undefined,
  428. clientHeight:300,
  429. // 是否显示弹出层
  430. open: false,
  431. // 状态字典
  432. statusOptions: [],
  433. plantOptions: [],
  434. plantMaintOptions: [],
  435. // 申请状态字典
  436. approveStatusOptions: [],
  437. wxjlList: [],
  438. // 用户导入参数
  439. upload: {
  440. downloadAction: process.env.VUE_APP_BASE_API + '/common/template',
  441. // 是否显示弹出层(用户导入)
  442. type: "specDzsb",
  443. // 是否显示弹出层(用户导入)
  444. open: false,
  445. // 弹出层标题(用户导入)
  446. title: "",
  447. // 是否禁用上传
  448. isUploading: false,
  449. // 是否更新已经存在的用户数据
  450. updateSupport: 0,
  451. // 设置上传的请求头部
  452. headers: { Authorization: "Bearer " + getToken() },
  453. // 上传的地址
  454. url: process.env.VUE_APP_BASE_API + "/sems/specDzsb/importData"
  455. },
  456. // 查询参数
  457. queryParams: {
  458. pageNum: 1,
  459. pageSize: 20,
  460. plantCode: null,
  461. unit: null,
  462. devname: null,
  463. devno: null,
  464. submitdate: null,
  465. remarks: null,
  466. approveStatus: null,
  467. regno: null,
  468. useno: null,
  469. warnDate: null,
  470. warnCycle: null,
  471. nextWarnDate: null,
  472. warnFlag: null,
  473. plantMaint: null,
  474. docno: null,
  475. model: null,
  476. capacity: null,
  477. location: null,
  478. isEX: null,
  479. status: -1,
  480. },
  481. // 表单参数
  482. form: {},
  483. modifyForm: {},
  484. // 表单校验
  485. rules: {
  486. id: [
  487. { required: true, message: this.$t('唯一标识ID')+this.$t('不能为空'), trigger: "blur" }
  488. ],
  489. plantCode: [
  490. { required: true, message: this.$t('装置名称')+this.$t('不能为空'), trigger: "blur" }
  491. ],
  492. }
  493. };
  494. },
  495. watch: {
  496. // 根据名称筛选部门树
  497. deptName(val) {
  498. this.$refs.tree.filter(val);
  499. }
  500. },
  501. created() {
  502. //设置表格高度对应屏幕高度
  503. this.$nextTick(() => {
  504. this.clientHeight = document.body.clientHeight -250
  505. })
  506. this.getList();
  507. this.getTreeselect();
  508. this.getDicts("spec_dev_status").then(response => {
  509. this.statusOptions = response.data;
  510. });
  511. this.getDicts("spec_approve_status").then(response => {
  512. for (let i = 0; i < response.data.length; i++) {
  513. if ( !["5","6","7","8" ,"16" , "17"].includes(response.data[i].dictValue)){
  514. this.approveStatusOptions.push(response.data[i])
  515. }
  516. }
  517. });
  518. this.getDicts("SPEC_PLANT_MAINT").then(response => {
  519. this.plantMaintOptions = response.data;
  520. });
  521. let plantParams = {
  522. pType: 1
  523. }
  524. mylistPlant(plantParams).then(response => {
  525. this.plantOptions = response.data;
  526. });
  527. },
  528. methods: {
  529. /** 查询特种设备起重机械台账列表 */
  530. getList() {
  531. this.loading = true;
  532. listSpecDzsb(this.queryParams).then(response => {
  533. this.specDzsbList = response.rows;
  534. this.total = response.total;
  535. this.$nextTick(() => {
  536. this.$refs.deviceTable.doLayout(); // 解决表格错位
  537. });
  538. this.loading = false;
  539. });
  540. },
  541. /** 查询部门下拉树结构 */
  542. getTreeselect() {
  543. treeselect().then(response => {
  544. this.deptOptions = response.data;
  545. });
  546. },
  547. // 状态字典翻译
  548. statusFormat(row, column) {
  549. return this.selectDictLabel(this.statusOptions, row.status);
  550. },
  551. // 申请状态字典翻译
  552. approveStatusFormat(row, column) {
  553. return this.selectDictLabel(this.approveStatusOptions, row.approveStatus);
  554. },
  555. // 取消按钮
  556. cancel() {
  557. this.open = false;
  558. this.reset();
  559. },
  560. // 表单重置
  561. reset() {
  562. this.form = {
  563. id: null,
  564. plantCode: null,
  565. unit: null,
  566. devname: null,
  567. devno: null,
  568. submitdate: null,
  569. status: -1,
  570. delFlag: null,
  571. createrCode: null,
  572. createdate: null,
  573. updaterCode: null,
  574. updatedate: null,
  575. deptId: null,
  576. remarks: null,
  577. perTestConclusion:null,
  578. approveStatus: 0,
  579. regno: null,
  580. useno: null,
  581. warnDate: null,
  582. warnCycle: null,
  583. nextWarnDate: null,
  584. warnFlag: null,
  585. plantMaint: null,
  586. docno: null,
  587. model: null,
  588. capacity: null,
  589. location: null,
  590. createUnit: null,
  591. checkStrategy: null,
  592. yearMaint: null,
  593. reportNo: null,
  594. approveTime: null,
  595. changeTime: null,
  596. checkUnit: null,
  597. engineer: null
  598. };
  599. this.resetForm("form");
  600. this.dataForm = 0;
  601. },
  602. /** 搜索按钮操作 */
  603. handleQuery() {
  604. this.queryParams.pageNum = 1;
  605. this.getList();
  606. },
  607. /** 重置按钮操作 */
  608. resetQuery() {
  609. this.resetForm("queryForm");
  610. this.handleQuery();
  611. },
  612. // 多选框选中数据
  613. handleSelectionChange(selection) {
  614. this.ids = selection.map(item => item.id)
  615. this.single = selection.length!==1
  616. this.multiple = !selection.length
  617. this.dataListSelections = selection
  618. },
  619. /** 新增按钮操作 */
  620. handleAdd() {
  621. this.reset();
  622. this.open = true;
  623. this.title = this.$t('添加')+this.$t('特种设备起重机械台账');
  624. },
  625. /** 修改按钮操作 */
  626. handleUpdate(row) {
  627. this.reset();
  628. const id = row.id || this.ids
  629. var rows = this.dataListSelections.map(item => {
  630. return item
  631. })
  632. for (let i = 0; i <rows.length ; i++) {
  633. if (rows[i].approveStatus != 0) {
  634. this.$alert(this.$t('当前设备正在申请中,无法修改'), this.$t('提示'), {
  635. type: 'warning'
  636. })
  637. return
  638. }
  639. }
  640. this.dataForm = 1;
  641. getSpecDzsb(id).then(response => {
  642. this.form = response.data;
  643. this.open = true;
  644. this.title = this.$t('修改')+this.$t('特种设备起重机械台账');
  645. });
  646. },
  647. /** 提交按钮 */
  648. submitForm() {
  649. this.$refs["form"].validate(valid => {
  650. if (valid) {
  651. if (this.form.id != null) {
  652. /*updateSpecDzsb(this.form).then(response => {
  653. this.msgSuccess(this.$t('修改成功'));
  654. this.open = false;
  655. this.getList();
  656. });*/
  657. updateSpecDzsbPre(this.form).then(response => {
  658. this.open = false;
  659. this.getList();
  660. this.modifyForm.hisId = response.data
  661. this.modifyForm.devId = this.form.id
  662. this.modifyForm.devType = this.devType
  663. this.modifyForm.approveType = 1
  664. this.modifyVisible = true
  665. this.modifyTitle = this.$t('设备修改申请')
  666. this.queryParams.postCode = 'wxjl'
  667. listPostUser(this.queryParams).then(response => {
  668. this.wxjlList = response;
  669. });
  670. });
  671. } else {
  672. addSpecDzsb(this.form).then(response => {
  673. this.msgSuccess(this.$t('新增成功'));
  674. this.open = false;
  675. this.getList();
  676. });
  677. }
  678. }
  679. });
  680. },
  681. /** 删除按钮操作 */
  682. handleDelete(row) {
  683. const ids = row.id || this.ids;
  684. this.$confirm(this.$t('是否确认删除?'), this.$t('警告'), {
  685. confirmButtonText: this.$t('确定'),
  686. cancelButtonText: this.$t('取消'),
  687. type: "warning"
  688. }).then(function() {
  689. return delSpecDzsb(ids);
  690. }).then(() => {
  691. this.getList();
  692. this.msgSuccess(this.$t('删除成功'));
  693. })
  694. },
  695. /** 导出按钮操作 */
  696. handleExport() {
  697. const queryParams = this.queryParams;
  698. this.$confirm(this.$t('是否确认导出所有特种设备起重机械台账数据项?'), this.$t('警告'), {
  699. confirmButtonText: this.$t('确定'),
  700. cancelButtonText: this.$t('取消'),
  701. type: "warning"
  702. }).then(function() {
  703. return exportSpecDzsb(queryParams);
  704. }).then(response => {
  705. this.download(response.msg);
  706. })
  707. },
  708. /** 导入按钮操作 */
  709. handleImport() {
  710. this.upload.title = this.$t('用户导入');
  711. this.upload.open = true;
  712. },
  713. /** 下载模板操作 */
  714. importTemplate() {
  715. this.$refs['downloadFileForm'].submit()
  716. },
  717. // 文件上传中处理
  718. handleFileUploadProgress(event, file, fileList) {
  719. this.upload.isUploading = true;
  720. },
  721. // 文件上传成功处理
  722. handleFileSuccess(response, file, fileList) {
  723. this.upload.open = false;
  724. this.upload.isUploading = false;
  725. this.$refs.upload.clearFiles();
  726. this.$alert(response.msg, this.$t('导入结果'), { dangerouslyUseHTMLString: true });
  727. this.getList();
  728. },
  729. // 提交上传文件
  730. submitFileForm() {
  731. this.$refs.upload.submit();
  732. },
  733. addAprrove (row, type) {
  734. var rows = row ? [row] : this.dataListSelections.map(item => {
  735. return item
  736. })
  737. for (let i = 0; i <rows.length ; i++) {
  738. if (rows[i].approveStatus != 0) {
  739. this.$alert(this.$t('当前设备正在申请中,无法重复申请'), this.$t('提示'), {
  740. type: 'warning'
  741. })
  742. return
  743. }
  744. }
  745. this.addAprroveVisible = true
  746. console.log(rows)
  747. console.log(type)
  748. this.$nextTick(() => {
  749. this.$refs.addApprove.init(rows, type)
  750. })
  751. },
  752. hisApprove (row, type) {
  753. this.hisAprroveVisible = true
  754. this.$nextTick(() => {
  755. this.$refs.hisApprove.init(row, type)
  756. })
  757. },
  758. checkList (row, type) {
  759. this.hisCheckVisible = true
  760. this.$nextTick(() => {
  761. this.$refs.hisCheck.init(row, type)
  762. })
  763. },
  764. hisReform (row) {
  765. this.hisReformVisible = true
  766. this.$nextTick(() => {
  767. this.$refs.hisReformList.init(row)
  768. })
  769. },
  770. //导出excel
  771. downloadDev(type){
  772. var rows = this.dataListSelections.map(item => {
  773. return item.id
  774. })
  775. this.ids = rows
  776. if (type == 1){
  777. this.downloadType = 1
  778. }else if (type == 2){
  779. this.downloadType = 2
  780. }
  781. this.$nextTick(() => {
  782. this.$refs['downloadDevForm'].submit()
  783. })
  784. },
  785. uploadUrl (uploadType) {
  786. return process.env.VUE_APP_BASE_API + "/sems/specDzsb/updateData"
  787. },
  788. submitModofyForm () {
  789. addModify(this.modifyForm).then(response => {
  790. this.msgSuccess(this.$t('提交成功'));
  791. this.modifyVisible = false
  792. this.getList();
  793. });
  794. }
  795. }
  796. };
  797. </script>