index.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379
  1. <template>
  2. <div class="app-container">
  3. <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
  4. <el-form-item label="位号" prop="devNo">
  5. <el-input
  6. v-model="queryParams.devNo"
  7. placeholder="请输入位号"
  8. clearable
  9. @keyup.enter.native="handleQuery"
  10. />
  11. </el-form-item>
  12. <el-form-item label="位置" prop="position">
  13. <el-input
  14. v-model="queryParams.position"
  15. placeholder="请输入位置"
  16. clearable
  17. @keyup.enter.native="handleQuery"
  18. />
  19. </el-form-item>
  20. <el-form-item label="年" prop="planYear">
  21. <el-date-picker
  22. v-model="year"
  23. :clearable="false"
  24. format="yyyy"
  25. placeholder="请选择年份"
  26. type="year"
  27. @change="handleQuery">
  28. </el-date-picker>
  29. </el-form-item>
  30. <el-form-item label="月" prop="planQuarter">
  31. <el-date-picker
  32. v-model="month"
  33. :clearable="false"
  34. format="MM"
  35. placeholder="选择月"
  36. popper-class="picker-date"
  37. type="month"
  38. @change="handleQuery">
  39. </el-date-picker>
  40. </el-form-item>
  41. <el-form-item label="计划名称" prop="planId">
  42. <el-select v-model="queryParams.planId" clearable
  43. @change="handleQuery">
  44. <el-option v-for="item in planList"
  45. :key="item.id"
  46. :label="item.planName"
  47. :value="item.id"/>
  48. </el-select>
  49. </el-form-item>
  50. <el-form-item>
  51. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  52. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  53. </el-form-item>
  54. </el-form>
  55. <el-row :gutter="10" class="mb8">
  56. <el-col :span="1.5">
  57. <el-button
  58. type="warning"
  59. plain
  60. icon="el-icon-download"
  61. size="mini"
  62. @click="handleExport"
  63. v-hasPermi="['commonuse:pump:export']"
  64. >导出</el-button>
  65. </el-col>
  66. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  67. </el-row>
  68. <el-table v-loading="loading" :data="pumpList" :height="clientHeight" @selection-change="handleSelectionChange" border>
  69. <el-table-column type="selection" width="55" align="center" />
  70. <el-table-column label="位号" align="center" prop="devNo" />
  71. <el-table-column label="位置" align="center" prop="position" />
  72. <el-table-column label="接合器外观" align="center" prop="appearance">
  73. <template slot-scope="scope">
  74. <dict-tag :options="dict.type.inspection_status" :value="scope.row.appearance"/>
  75. </template>
  76. </el-table-column>
  77. <el-table-column label="接合器编号标识" align="center" prop="numberingIdentification">
  78. <template slot-scope="scope">
  79. <dict-tag :options="dict.type.inspection_status" :value="scope.row.numberingIdentification"/>
  80. </template>
  81. </el-table-column>
  82. <el-table-column label="接合器闷盖及接口" align="center" prop="coverInterface">
  83. <template slot-scope="scope">
  84. <dict-tag :options="dict.type.inspection_status" :value="scope.row.coverInterface"/>
  85. </template>
  86. </el-table-column>
  87. <el-table-column label="确认人" align="center" prop="confirmed" />
  88. <el-table-column label="备注" align="center" prop="remarks" />
  89. <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
  90. <template slot-scope="scope">
  91. <el-button
  92. icon="el-icon-picture-outline"
  93. size="mini"
  94. type="text"
  95. @click="openFileDialog(scope.row)"
  96. >附件
  97. </el-button>
  98. </template>
  99. </el-table-column>
  100. </el-table>
  101. <el-dialog :close-on-click-modal="false":visible.sync="file.open" append-to-body title="附件详情" width="50%">
  102. <el-tabs v-model="tabName" :stretch="true" type="border-card">
  103. <el-tab-pane label="常规附件" name="a">
  104. <el-empty v-if="file.files.length==0" description="如你所见,这里什么都没有"></el-empty>
  105. <el-image v-for="url in file.files" v-else :key="url" :src="url"></el-image>
  106. </el-tab-pane>
  107. <el-tab-pane label="异常附件" name="b">
  108. <el-empty v-if="file.issuesFiles.length==0" description="如你所见,这里什么都没有"></el-empty>
  109. <el-image v-for="url in file.issuesFiles" v-else :key="url" :src="url"></el-image>
  110. </el-tab-pane>
  111. <el-tab-pane label="异常整改后附件" name="c">
  112. <el-empty v-if="file.repairFile.length==0" description="如你所见,这里什么都没有"></el-empty>
  113. <el-image v-for="url in file.repairFile" v-else :key="url" :src="url"></el-image>
  114. </el-tab-pane>
  115. </el-tabs>
  116. </el-dialog>
  117. <pagination
  118. v-show="total>0"
  119. :total="total"
  120. :page.sync="queryParams.pageNum"
  121. :limit.sync="queryParams.pageSize"
  122. @pagination="getList"
  123. />
  124. </div>
  125. </template>
  126. <script>
  127. import { listPump, getPump, delPump, addPump, updatePump } from "@/api/patrol/commonuse/pump";
  128. import {listAllPlan} from "@/api/patrol/patrol/plan";
  129. export default {
  130. name: "Pump",
  131. dicts: ['inspection_status'],
  132. data() {
  133. return {
  134. tabName: 'a',
  135. planList: [],
  136. file: {
  137. open: false,
  138. issuesFiles: [],
  139. repairFile: [],
  140. files: []
  141. },
  142. month: new Date(),
  143. year: new Date(),
  144. // 遮罩层
  145. loading: true,
  146. // 选中数组
  147. ids: [],
  148. // 非单个禁用
  149. single: true,
  150. // 非多个禁用
  151. multiple: true,
  152. // 显示搜索条件
  153. showSearch: false,
  154. // 页面高度
  155. clientHeight: 300,
  156. // 总条数
  157. total: 0,
  158. // 水泵接合器表格数据
  159. pumpList: [],
  160. // 弹出层标题
  161. title: "",
  162. // 是否显示弹出层
  163. open: false,
  164. // 查询参数
  165. queryParams: {
  166. pageNum: 1,
  167. pageSize: 20,
  168. id: null,
  169. devNo: null,
  170. position: null,
  171. appearance: null,
  172. numberingIdentification: null,
  173. coverInterface: null,
  174. confirmed: null,
  175. remarks: null,
  176. checkStatus: null,
  177. checkDate: null,
  178. month: null,
  179. year: null,
  180. createrCode: null,
  181. createdate: null,
  182. updaterCode: null,
  183. updatedate: null,
  184. deptId: null,
  185. planId: null,
  186. problemFileUrl: null,
  187. fileUrl: null,
  188. issuesStatus: null,
  189. issuesFlag: null,
  190. repairFile: null
  191. },
  192. // 表单参数
  193. form: {},
  194. // 表单校验
  195. rules: {
  196. }
  197. };
  198. },
  199. created() {
  200. if (this.$route.query.year && this.$route.query.month) {
  201. this.year.setFullYear(this.$route.query.year, this.$route.query.month, 1);
  202. this.month.setMonth(this.$route.query.month, 1);
  203. }
  204. if (this.$route.query.planId) {
  205. this.queryParams.planId = parseInt(this.$route.query.planId)
  206. }
  207. if (this.$route.query.id) {
  208. this.queryParams.id = parseInt(this.$route.query.id)
  209. this.queryParams.issuesFlag = '1';
  210. }
  211. //设置表格高度对应屏幕高度
  212. this.$nextTick(() => {
  213. this.clientHeight = document.body.clientHeight - 270
  214. });
  215. if (!this.queryParams.id) {
  216. let query = {planQuarter: this.month.getMonth() + 1, planYear: this.year.getFullYear(), patrolType: '26'}
  217. listAllPlan(query).then(res => {
  218. this.planList = res.data;
  219. if (res.data.length > 0) {
  220. this.queryParams.planId = res.data[0].id;
  221. }
  222. this.getList();
  223. })
  224. }else{
  225. this.getList();
  226. }
  227. },
  228. methods: {
  229. openFileDialog(row) {
  230. this.tabName = 'a'
  231. this.file.issuesFiles = []
  232. this.file.files = []
  233. this.file.repairFile = []
  234. this.file.open = true;
  235. if (row.problemFileUrl) {
  236. this.file.issuesFiles = row.problemFileUrl.split(',').map(item => process.env.VUE_APP_BASE_API + item);
  237. }
  238. if (row.fileUrl) {
  239. this.file.files = row.fileUrl.split(',').map(item => process.env.VUE_APP_BASE_API + item);
  240. }
  241. if (row.repairFile) {
  242. this.file.repairFile = row.repairFile.split(',').map(item => process.env.VUE_APP_BASE_API + item);
  243. }
  244. },
  245. getPlanList() {
  246. let query = {planQuarter: this.month.getMonth() + 1, planYear: this.year.getFullYear(), patrolType: '26'}
  247. listAllPlan(query).then(res => {
  248. this.planList = res.data;
  249. })
  250. },
  251. /** 查询水泵接合器列表 */
  252. getList() {
  253. this.loading = true;
  254. if (!this.queryParams.id) {
  255. this.queryParams.month = this.month.getMonth() + 1;
  256. this.queryParams.year = this.year.getFullYear();
  257. }
  258. listPump(this.queryParams).then(response => {
  259. this.pumpList = response.rows;
  260. this.total = response.total;
  261. this.loading = false;
  262. });
  263. },
  264. // 取消按钮
  265. cancel() {
  266. this.open = false;
  267. this.reset();
  268. },
  269. // 表单重置
  270. reset() {
  271. this.form = {
  272. id: null,
  273. devNo: null,
  274. position: null,
  275. appearance: null,
  276. numberingIdentification: null,
  277. coverInterface: null,
  278. confirmed: null,
  279. remarks: null,
  280. checkStatus: null,
  281. checkDate: null,
  282. month: null,
  283. year: null,
  284. delFlag: null,
  285. createrCode: null,
  286. createdate: null,
  287. updaterCode: null,
  288. updatedate: null,
  289. deptId: null,
  290. planId: null,
  291. problemFileUrl: null,
  292. fileUrl: null,
  293. issuesStatus: null,
  294. issuesFlag: null,
  295. repairFile: null
  296. };
  297. this.resetForm("form");
  298. },
  299. /** 搜索按钮操作 */
  300. handleQuery() {
  301. this.queryParams.pageNum = 1;
  302. this.getList();
  303. this.getPlanList();
  304. },
  305. /** 重置按钮操作 */
  306. resetQuery() {
  307. this.resetForm("queryForm");
  308. this.handleQuery();
  309. },
  310. // 多选框选中数据
  311. handleSelectionChange(selection) {
  312. this.ids = selection.map(item => item.id)
  313. this.single = selection.length!==1
  314. this.multiple = !selection.length
  315. },
  316. /** 新增按钮操作 */
  317. handleAdd() {
  318. this.reset();
  319. this.open = true;
  320. this.title = "添加水泵接合器";
  321. },
  322. /** 修改按钮操作 */
  323. handleUpdate(row) {
  324. this.reset();
  325. const id = row.id || this.ids
  326. getPump(id).then(response => {
  327. this.form = response.data;
  328. this.open = true;
  329. this.title = "修改水泵接合器";
  330. });
  331. },
  332. /** 提交按钮 */
  333. submitForm() {
  334. this.$refs["form"].validate(valid => {
  335. if (valid) {
  336. if (this.form.id != null) {
  337. updatePump(this.form).then(response => {
  338. this.msgSuccess("修改成功");
  339. this.open = false;
  340. this.getList();
  341. });
  342. } else {
  343. addPump(this.form).then(response => {
  344. this.msgSuccess("新增成功");
  345. this.open = false;
  346. this.getList();
  347. });
  348. }
  349. }
  350. });
  351. },
  352. /** 删除按钮操作 */
  353. handleDelete(row) {
  354. const ids = row.id || this.ids;
  355. this.$confirm('是否确认删除水泵接合器编号为"' + ids + '"的数据项?').then(function() {
  356. return delPump(ids);
  357. }).then(() => {
  358. this.getList();
  359. this.msgSuccess("删除成功");
  360. }).catch(() => {});
  361. },
  362. /** 导出按钮操作 */
  363. handleExport() {
  364. this.download2('commonuse/pump/export', {
  365. ...this.queryParams
  366. }, `pump_${new Date().getTime()}.xlsx`)
  367. }
  368. }
  369. };
  370. </script>