index.vue 33 KB

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