index.vue 32 KB

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