index.vue 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768
  1. <template>
  2. <div class="app-container">
  3. <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch">
  4. <el-form-item label="路段名称" prop="sectionName">
  5. <el-input
  6. v-model="queryParams.sectionName"
  7. placeholder="请输入路段名称"
  8. clearable
  9. size="small"
  10. @keyup.enter.native="handleQuery"
  11. />
  12. </el-form-item>
  13. <el-form-item label="发现问题" prop="findProblem">
  14. <el-select v-model="queryParams.findProblem" placeholder="请选择发现问题" clearable size="small">
  15. <el-option
  16. v-for="dict in dict.type.find_problem"
  17. :key="dict.value"
  18. :label="dict.label"
  19. :value="dict.value"
  20. />
  21. </el-select>
  22. </el-form-item>
  23. <el-form-item label="队伍" >
  24. <el-select v-model="queryParams.ranks" clearable placeholder="请选择队伍" @change="getUsers" :disabled="postName.indexOf('xx') > -1">
  25. <el-option
  26. v-for="item in postOptions"
  27. :key="item.postId"
  28. :label="item.postName"
  29. :value="item.postId"
  30. ></el-option>
  31. </el-select>
  32. </el-form-item>
  33. <el-form-item label="上传人" prop="createBy">
  34. <el-select v-model="queryParams.createBy" filterable placeholder="请选择上传人" clearable size="small">
  35. <el-option v-for="item in workerListSelect"
  36. :key="item.id"
  37. :label="item.name"
  38. :value="item.id"/>
  39. </el-select>
  40. </el-form-item>
  41. <el-form-item label="审核状态">
  42. <el-select v-model="queryParams.processStatus" placeholder="请选择审核状态" clearable size="small">
  43. <el-option
  44. v-for="dict in dict.type.process_status"
  45. :key="dict.value"
  46. :label="dict.label"
  47. :value="dict.value"
  48. />
  49. </el-select>
  50. </el-form-item>
  51. <el-form-item label="时间范围" prop="createTimes">
  52. <el-date-picker
  53. v-model="queryParams.createTimes"
  54. type="datetimerange"
  55. :picker-options="pickerOptions"
  56. range-separator="至"
  57. start-placeholder="开始日期"
  58. end-placeholder="结束日期"
  59. align="right">
  60. </el-date-picker>
  61. </el-form-item>
  62. <el-form-item>
  63. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  64. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  65. </el-form-item>
  66. </el-form>
  67. <el-row :gutter="10" class="mb8">
  68. <!-- <el-col :span="1.5">-->
  69. <!-- <el-button-->
  70. <!-- type="primary"-->
  71. <!-- plain-->
  72. <!-- icon="el-icon-plus"-->
  73. <!-- size="mini"-->
  74. <!-- @click="handleAdd"-->
  75. <!-- v-hasPermi="['gas:roadSectionInspection:add']"-->
  76. <!-- >新增</el-button>-->
  77. <!-- </el-col>-->
  78. <el-col :span="1.5">
  79. <el-button
  80. type="success"
  81. plain
  82. icon="el-icon-edit"
  83. size="mini"
  84. :disabled="single"
  85. @click="handleUpdate"
  86. v-hasPermi="['gas:roadSectionInspection:edit']"
  87. >修改</el-button>
  88. </el-col>
  89. <el-col :span="1.5">
  90. <el-button
  91. type="danger"
  92. plain
  93. icon="el-icon-delete"
  94. size="mini"
  95. :disabled="multiple"
  96. @click="handleDelete"
  97. v-hasPermi="['gas:roadSectionInspection:remove']"
  98. >删除</el-button>
  99. </el-col>
  100. <el-col :span="1.5">
  101. <el-button
  102. type="danger"
  103. plain
  104. icon="el-icon-delete"
  105. size="mini"
  106. :disabled="multiple"
  107. @click="openshShow"
  108. v-hasPermi="['gas:roadSectionInspection:edit']"
  109. >批量审核
  110. </el-button>
  111. </el-col>
  112. <el-col :span="1.5">
  113. <el-button
  114. type="danger"
  115. plain
  116. icon="el-icon-s-claim"
  117. size="mini"
  118. :disabled="multiple"
  119. @click="chushiBatch"
  120. v-if="['deputyDirector','director','admin'].includes(this.$store.state.user.postName)"
  121. >一键审核通过
  122. </el-button>
  123. </el-col>
  124. <el-col :span="1.5">
  125. <el-button
  126. type="warning"
  127. plain
  128. icon="el-icon-download"
  129. size="mini"
  130. :loading="exportLoading"
  131. @click="handleExport"
  132. v-hasPermi="['gas:roadSectionInspection:export']"
  133. >导出</el-button>
  134. </el-col>
  135. <!-- <el-col :span="1.5">-->
  136. <!-- <el-button-->
  137. <!-- type="danger"-->
  138. <!-- plain-->
  139. <!-- icon="el-icon-search"-->
  140. <!-- size="mini"-->
  141. <!-- :disabled="multiple"-->
  142. <!-- @click="openshShow(null,true)"-->
  143. <!-- v-hasPermi="['gas:regulatingBoxMaintenance:remove']"-->
  144. <!-- >批量审核-->
  145. <!-- </el-button>-->
  146. <!-- </el-col>-->
  147. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  148. </el-row>
  149. <el-table v-loading="loading" :data="roadSectionInspectionList" @selection-change="handleSelectionChange">
  150. <el-table-column type="selection" width="55" align="center" />
  151. <el-table-column label="主键id" align="center" prop="id" v-if="false"/>
  152. <el-table-column label="序号" width="70">
  153. <template slot-scope="scope">
  154. {{(queryParams.pageNum-1)*queryParams.pageSize+scope.$index+1}}
  155. </template>
  156. </el-table-column>
  157. <el-table-column label="路段名称" align="center" prop="sectionName" />
  158. <el-table-column label="抽检米数" align="center" prop="samplingMeterCount" />
  159. <el-table-column label="发现问题" align="center" prop="findProblem">
  160. <template slot-scope="scope">
  161. <dict-tag :options="dict.type.find_problem" :value="scope.row.findProblem"/>
  162. </template>
  163. </el-table-column>
  164. <el-table-column label="上传时间" align="center" prop="createTime" width="180">
  165. <template slot-scope="scope">
  166. <span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d} {h}:{i}') }}</span>
  167. </template>
  168. </el-table-column>
  169. <el-table-column label="上传人" align="center" prop="createByName" width="180"/>
  170. <el-table-column label="审核状态" align="center" prop="processStatus">
  171. <template slot-scope="scope">
  172. <dict-tag :options="dict.type.process_status" :value="scope.row.processStatus"
  173. v-if="scope.row.processStatus != null"/>
  174. <span v-else>未审核</span>
  175. </template>
  176. </el-table-column>
  177. <el-table-column label="照片" align="center">
  178. <template slot-scope="scope">
  179. <el-image
  180. style="width: 50px; height: 50px"
  181. :src="scope.row.photoList[0]"
  182. :preview-src-list="scope.row.photoList">
  183. </el-image>
  184. </template>
  185. </el-table-column>
  186. <el-table-column label="备注" align="center" prop="remark" show-overflow-tooltip/>
  187. <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
  188. <template slot-scope="scope">
  189. <!-- <el-button-->
  190. <!-- size="mini"-->
  191. <!-- type="text"-->
  192. <!-- icon="el-icon-view"-->
  193. <!-- @click="handleUpdate(scope.row,true)"-->
  194. <!-- v-hasPermi="['gas:regulatingBoxMaintenance:edit']"-->
  195. <!-- >查看-->
  196. <!-- </el-button>-->
  197. <el-button
  198. size="mini"
  199. type="text"
  200. icon="el-icon-edit"
  201. @click="handleUpdate(scope.row,false)"
  202. v-hasPermi="['gas:roadSectionInspection:edit']"
  203. >修改</el-button>
  204. <el-button
  205. size="mini"
  206. type="text"
  207. v-if="btnShow(scope.row)"
  208. icon="el-icon-edit"
  209. @click="process(scope.row)"
  210. v-hasPermi="['gas:regulatingBoxMaintenance:edit']"
  211. >审核
  212. </el-button>
  213. <el-button
  214. size="mini"
  215. type="text"
  216. icon="el-icon-view"
  217. @click="views(scope.row)"
  218. v-hasPermi="['gas:roadSectionInspection:views']"
  219. >查看详情</el-button>
  220. <el-button
  221. size="mini"
  222. type="text"
  223. icon="el-icon-edit"
  224. @click="reviewListOpen(scope.row)"
  225. >审核记录
  226. </el-button>
  227. <el-button
  228. size="mini"
  229. type="text"
  230. icon="el-icon-delete"
  231. @click="handleDelete(scope.row)"
  232. v-hasPermi="['gas:roadSectionInspection:remove']"
  233. >删除</el-button>
  234. </template>
  235. </el-table-column>
  236. </el-table>
  237. <pagination
  238. v-show="total>0"
  239. :total="total"
  240. :page.sync="queryParams.pageNum"
  241. :limit.sync="queryParams.pageSize"
  242. @pagination="getList"
  243. />
  244. <el-dialog title="审核记录" :visible.sync="reviewListShow" width="800px" append-to-body>
  245. <el-table
  246. :data="reviewList"
  247. style="width: 100%"
  248. border
  249. :header-cell-style="{'text-align':'center'}"
  250. height="500">
  251. <el-table-column label="历史审核记录">
  252. <el-table-column
  253. prop="createName"
  254. label="审核人"
  255. width="80">
  256. </el-table-column>
  257. <el-table-column
  258. prop="userPost"
  259. label="岗位"
  260. width="65">
  261. <template slot-scope="scope">
  262. <span v-if="scope.row.userPost == 'admin'">管理员</span>
  263. <span v-if="scope.row.userPost == 'deputyDirector'">副处长</span>
  264. <span v-if="scope.row.userPost == 'director'">处长</span>
  265. <span v-if="scope.row.userPost.indexOf('xx')>-1">队长</span>
  266. </template>
  267. </el-table-column>
  268. <el-table-column
  269. prop="processStatus"
  270. label="审核状态"
  271. width="75">
  272. <template slot-scope="scope">
  273. {{ scope.row.processStatus == '0' ? '通过' : '拒绝' }}
  274. </template>
  275. </el-table-column>
  276. <el-table-column
  277. prop="createTime"
  278. label="审核时间"
  279. width="155">
  280. </el-table-column>
  281. <el-table-column
  282. prop="processComments"
  283. label="审核意见"
  284. width="384">
  285. </el-table-column>
  286. </el-table-column>
  287. </el-table>
  288. <div slot="footer" class="dialog-footer">
  289. <el-button @click="reviewListShow = false">关 闭</el-button>
  290. </div>
  291. </el-dialog>
  292. <el-dialog
  293. title="审核"
  294. :visible.sync="openSH"
  295. width="30%">
  296. <el-form ref="formSH" :model="formSH" label-width="80px">
  297. <el-form-item label="审核状态" prop="processStatus">
  298. <el-select v-model="formSH.processStatus" @change="$forceUpdate" placeholder="请选择审核状态" clearable size="small">
  299. <el-option
  300. v-for="dict in dictList"
  301. :key="dict.value"
  302. :label="dict.label"
  303. :value="dict.value"
  304. />
  305. </el-select>
  306. </el-form-item>
  307. <el-form-item label="备注">
  308. <el-input type="textarea" v-model="formSH.processComments"></el-input>
  309. </el-form-item>
  310. </el-form>
  311. <span slot="footer" class="dialog-footer">
  312. <el-button @click="openSH = false">取 消</el-button>
  313. <el-button type="primary" @click="batchReviews">确 定</el-button>
  314. </span>
  315. </el-dialog>
  316. <el-dialog
  317. title="审核"
  318. :visible.sync="dialogVisible"
  319. width="30%">
  320. <el-form ref="shFrom" :model="shFrom" label-width="80px">
  321. <el-form-item label="审核状态" prop="processStatus">
  322. <el-select v-model="shFrom.processStatus" @change="$forceUpdate" placeholder="请选择审核状态" clearable size="small">
  323. <el-option
  324. v-for="dict in dictList"
  325. :key="dict.value"
  326. :label="dict.label"
  327. :value="dict.value"
  328. />
  329. </el-select>
  330. </el-form-item>
  331. <el-form-item label="备注">
  332. <el-input type="textarea" v-model="shFrom.processComments"></el-input>
  333. </el-form-item>
  334. </el-form>
  335. <span slot="footer" class="dialog-footer">
  336. <el-button @click="dialogVisible = false">取 消</el-button>
  337. <el-button type="primary" @click="upprocess">确 定</el-button>
  338. </span>
  339. </el-dialog>
  340. <!-- 添加或修改路段巡查对话框 -->
  341. <el-dialog :title="title" :visible.sync="open" width="50%" append-to-body>
  342. <el-form ref="form" :model="form" :rules="rules" label-width="80px" :disabled="isDisabled">
  343. <el-form-item label="路段名称" prop="sectionName">
  344. <el-input v-model="form.sectionName" placeholder="请输入路段名称" />
  345. </el-form-item>
  346. <el-form-item label="抽检米数" prop="samplingMeterCount">
  347. <el-input v-model="form.samplingMeterCount" placeholder="请输入抽检米数" />
  348. </el-form-item>
  349. <el-form-item label="发现问题" prop="findProblem">
  350. <el-select v-model="form.findProblem" placeholder="请选择发现问题" style="width: 100%">
  351. <el-option
  352. v-for="dict in dict.type.find_problem"
  353. :key="dict.value"
  354. :label="dict.label"
  355. :value="dict.value"
  356. ></el-option>
  357. </el-select>
  358. </el-form-item>
  359. <!-- <el-form-item label="发现时间" prop="findTime">-->
  360. <!-- <el-date-picker clearable size="small"-->
  361. <!-- v-model="form.findTime"-->
  362. <!-- type="datetime"-->
  363. <!-- value-format="yyyy-MM-dd HH:mm:ss"-->
  364. <!-- placeholder="选择发现时间" style="width: 100%">-->
  365. <!-- </el-date-picker>-->
  366. <!-- </el-form-item>-->
  367. <el-form-item label="备注" prop="remark">
  368. <el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
  369. </el-form-item>
  370. <el-col :span="24">
  371. <el-form-item label="照片" prop="photoList">
  372. <imageUpload v-model="form.photoList" :disabled="disabled"/>
  373. </el-form-item>
  374. </el-col>
  375. <el-form-item label="审核状态" v-show="isDisabled && form.processStatus!=null">
  376. <el-select v-model="form.processStatus" placeholder="请选择审核状态" clearable size="small" @change="$forceUpdate">
  377. <el-option
  378. v-for="dict in dict.type.process_status"
  379. :key="dict.value"
  380. :label="dict.label"
  381. :value="dict.value"
  382. />
  383. </el-select>
  384. </el-form-item>
  385. <el-form-item label="审核备注" v-show="isDisabled && form.processStatus!=null">
  386. <el-input type="textarea" v-model="form.processComments" placeholder=""/>
  387. </el-form-item>
  388. </el-form>
  389. <div slot="footer" class="dialog-footer">
  390. <el-button :loading="buttonLoading" type="primary" @click="submitForm">确 定</el-button>
  391. <el-button @click="cancel">取 消</el-button>
  392. </div>
  393. </el-dialog>
  394. </div>
  395. </template>
  396. <script>
  397. import {
  398. listRoadSectionInspection,
  399. getRoadSectionInspection,
  400. delRoadSectionInspection,
  401. addRoadSectionInspection,
  402. updateRoadSectionInspection,
  403. batchReviewsRoadSectionInspection
  404. } from "@/api/gas/roadSectionInspection";
  405. import {listPostAll} from "@/api/system/post";
  406. import Cookies from "js-cookie";
  407. import {getWorker} from "@/api/gas/user";
  408. import {getReviewList} from "@/api/gas/roadSectionInspection.js";
  409. export default {
  410. name: "RoadSectionInspection",
  411. dicts: ['find_problem','process_status'],
  412. data() {
  413. return {
  414. //审核记录
  415. reviewListShow: false,
  416. reviewList: [],
  417. // 按钮loading
  418. buttonLoading: false,
  419. dialogVisible: false,
  420. isDisabled: true,
  421. disabled: false,
  422. // 遮罩层
  423. loading: true,
  424. // 导出遮罩层
  425. exportLoading: false,
  426. // 选中数组
  427. ids: [],
  428. workerList: [],
  429. dictList:[{label:'通过',value:'0'},{label:'不通过',value:'1'}],
  430. // 非单个禁用
  431. single: true,
  432. // 非多个禁用
  433. multiple: true,
  434. // 显示搜索条件
  435. showSearch: true,
  436. postName:Cookies.get("postName"),
  437. // 总条数
  438. total: 0,
  439. // 路段巡查表格数据
  440. roadSectionInspectionList: [],
  441. // 弹出层标题
  442. title: "",
  443. // 是否显示弹出层
  444. open: false,
  445. pickerOptions: {
  446. shortcuts: [{
  447. text: '最近一周',
  448. onClick(picker) {
  449. const end = new Date();
  450. const start = new Date();
  451. start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
  452. picker.$emit('pick', [start, end]);
  453. }
  454. }, {
  455. text: '最近一个月',
  456. onClick(picker) {
  457. const end = new Date();
  458. const start = new Date();
  459. start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
  460. picker.$emit('pick', [start, end]);
  461. }
  462. }, {
  463. text: '最近三个月',
  464. onClick(picker) {
  465. const end = new Date();
  466. const start = new Date();
  467. start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
  468. picker.$emit('pick', [start, end]);
  469. }
  470. }]
  471. },
  472. // 岗位选项
  473. postOptions: [],
  474. // 查询参数
  475. queryParams: {
  476. pageNum: 1,
  477. pageSize: 10,
  478. sectionName: undefined,
  479. samplingMeterCount: undefined,
  480. findProblem: undefined,
  481. processStatus: undefined,
  482. findTime: undefined,
  483. createTimes: [],
  484. postNameArias:this.$store.state.user.postName,
  485. ranks:(Cookies.get("postName").indexOf('xx') > -1 ? parseInt(Cookies.get("postId")) : undefined),
  486. },
  487. // 表单参数
  488. form: {},
  489. shFrom:{
  490. id: '',
  491. processStatus:'',
  492. postNameArias:undefined,
  493. processComments: ""
  494. },
  495. openSH:false,
  496. formSH:{},
  497. // 表单校验
  498. rules: {
  499. sectionName: [
  500. { required: true, message: "路段名称不能为空", trigger: "blur" }
  501. ],
  502. samplingMeterCount: [
  503. { required: true, message: "抽检米数不能为空", trigger: "blur" }
  504. ],
  505. findProblem: [
  506. { required: true, message: "发现问题不能为空", trigger: "change" }
  507. ],
  508. findTime: [
  509. { required: true, message: "发现时间不能为空", trigger: "blur" }
  510. ]
  511. },
  512. workerListSelect:[]
  513. };
  514. },
  515. created() {
  516. this.getPostList();
  517. this.getList();
  518. },
  519. mounted() {
  520. setTimeout(
  521. this.getUsers(parseInt(Cookies.get("postId")))
  522. ,1000)
  523. },
  524. methods: {
  525. btnShow(row){
  526. let b = false;
  527. if (row.flag==true){
  528. b = true;
  529. }
  530. return b;
  531. },
  532. reviewListOpen(row){
  533. this.reviewList = [];
  534. this.reviewListShow=true;
  535. getReviewList({emrId: row.id}).then(res=>this.reviewList = res.rows);
  536. },
  537. getUsers(value){
  538. if (!value) return;
  539. getWorker({ranks:value}).then(response => {
  540. this.workerListSelect = response.data;
  541. });
  542. },
  543. chushiBatch(){
  544. if (this.ids.length > 0) {
  545. let chushiForm = {uids:[],processStatus:null,processComments:null,postNameArias:null}
  546. chushiForm.processStatus = '0';
  547. chushiForm.processComments = '一键审核通过';
  548. chushiForm.uids = this.ids;
  549. chushiForm.postNameArias = this.$store.state.user.postName;
  550. console.log(chushiForm)
  551. batchReviewsRoadSectionInspection(chushiForm).then(response => {
  552. if (response.code===200) {
  553. this.$modal.msgSuccess("审核成功");
  554. }
  555. this.getList();
  556. })
  557. }
  558. },
  559. openshShow() {
  560. this.formSH = {
  561. id: undefined,
  562. uids: [],
  563. postNameArias: undefined,
  564. processStatus: undefined,
  565. }
  566. this.resetForm("formSH");
  567. this.formSH.uids = this.ids
  568. this.openSH = true
  569. },
  570. getWorkerList(ranks) {
  571. let data = null
  572. if(ranks){
  573. data = {
  574. ranks:ranks
  575. }
  576. }
  577. getWorker(data).then(req => {
  578. this.workerList = req.data
  579. })
  580. },
  581. batchReviews(){
  582. const postNameArias = this.$store.state.user.postName;
  583. this.formSH.postNameArias = postNameArias
  584. if (this.formSH.processStatus == undefined || this.formSH.processStatus == ''){
  585. this.$message.warning("请选择审核状态")
  586. }
  587. batchReviewsRoadSectionInspection(this.formSH).then(response => {
  588. this.$modal.msgSuccess("审核成功");
  589. this.getList();
  590. }).finally(() => {
  591. this.openSH = false;
  592. });
  593. },
  594. upprocess(){
  595. const postNameArias = this.$store.state.user.postName;
  596. this.shFrom.postNameArias = postNameArias
  597. if (this.shFrom.processStatus == undefined || this.shFrom.processStatus == ''){
  598. this.$message.warning("请选择审核状态")
  599. }
  600. if (this.shFrom.id != null) {
  601. updateRoadSectionInspection(this.shFrom).then(response => {
  602. this.$modal.msgSuccess("审核成功");
  603. this.getList();
  604. }).finally(() => {
  605. this.dialogVisible = false;
  606. });
  607. }else if (this.shFrom.uids.length > 0) {
  608. batchReviewsRoadSectionInspection(this.shFrom).then(response => {
  609. this.$modal.msgSuccess("审核成功");
  610. this.openSH = false;
  611. this.getList();
  612. }).finally(() => {
  613. this.buttonLoading = false;
  614. });
  615. }
  616. },
  617. process(data) {
  618. this.shFrom.id = undefined
  619. this.shFrom.uids = [data.id];
  620. this.shFrom.processStatus = '';
  621. this.shFrom.processComments = '';
  622. this.dialogVisible = true;
  623. },
  624. getPostList(){
  625. listPostAll({remark:'ranks'}).then(response => {
  626. this.postOptions = response.data;
  627. });
  628. },
  629. /** 查询路段巡查列表 */
  630. getList() {
  631. this.loading = true;
  632. listRoadSectionInspection(this.queryParams).then(response => {
  633. this.roadSectionInspectionList = response.rows;
  634. this.total = response.total;
  635. this.loading = false;
  636. });
  637. },
  638. // 取消按钮
  639. cancel() {
  640. this.open = false;
  641. this.reset();
  642. },
  643. // 表单重置
  644. reset() {
  645. this.form = {
  646. id: undefined,
  647. sectionName: undefined,
  648. samplingMeterCount: undefined,
  649. findProblem: undefined,
  650. findTime: undefined,
  651. remark: undefined,
  652. delFlag: undefined,
  653. createBy: undefined,
  654. createTime: undefined,
  655. updateBy: undefined,
  656. updateTime: undefined
  657. };
  658. this.resetForm("form");
  659. },
  660. /** 搜索按钮操作 */
  661. handleQuery() {
  662. this.queryParams.pageNum = 1;
  663. this.getList();
  664. },
  665. /** 重置按钮操作 */
  666. resetQuery() {
  667. this.resetForm("queryForm");
  668. this.queryParams.createTimes=[]
  669. this.handleQuery();
  670. },
  671. // 多选框选中数据
  672. handleSelectionChange(selection) {
  673. this.ids = selection.map(item => item.id)
  674. this.single = selection.length!==1
  675. this.multiple = !selection.length
  676. },
  677. /** 新增按钮操作 */
  678. handleAdd() {
  679. this.reset();
  680. this.open = true;
  681. this.disabled = false
  682. this.title = "添加路段巡查";
  683. },
  684. /** 修改按钮操作 */
  685. handleUpdate(row,dis) {
  686. this.loading = true;
  687. this.isDisabled = dis
  688. this.reset();
  689. const id = row.id || this.ids
  690. getRoadSectionInspection(id).then(response => {
  691. this.loading = false;
  692. this.form = response.data;
  693. this.open = true;
  694. this.title = "修改路段巡查";
  695. this.disabled = false
  696. });
  697. },
  698. /** 修改按钮操作 */
  699. views(row) {
  700. this.loading = true;
  701. this.reset();
  702. const id = row.id || this.ids
  703. getRoadSectionInspection(id).then(response => {
  704. this.loading = false;
  705. this.form = response.data;
  706. this.open = true;
  707. this.title = "查看路段巡查";
  708. this.disabled = true
  709. });
  710. },
  711. /** 提交按钮 */
  712. submitForm() {
  713. this.$refs["form"].validate(valid => {
  714. if (valid) {
  715. this.buttonLoading = true;
  716. if (this.form.id != null) {
  717. if (typeof this.form.photoList === 'string') {
  718. this.form.photoList = this.form.photoList.split(',')
  719. }
  720. updateRoadSectionInspection(this.form).then(response => {
  721. this.$modal.msgSuccess("修改成功");
  722. this.open = false;
  723. this.getList();
  724. }).finally(() => {
  725. this.buttonLoading = false;
  726. });
  727. } else {
  728. this.form.photoList = this.form.photoList.split(',')
  729. addRoadSectionInspection(this.form).then(response => {
  730. this.$modal.msgSuccess("新增成功");
  731. this.open = false;
  732. this.getList();
  733. }).finally(() => {
  734. this.buttonLoading = false;
  735. });
  736. }
  737. }
  738. });
  739. },
  740. /** 删除按钮操作 */
  741. handleDelete(row) {
  742. const ids = row.id || this.ids;
  743. this.$modal.confirm('是否确认删除路段巡查编号为"' + ids + '"的数据项?').then(() => {
  744. this.loading = true;
  745. return delRoadSectionInspection(ids);
  746. }).then(() => {
  747. this.loading = false;
  748. this.getList();
  749. this.$modal.msgSuccess("删除成功");
  750. }).finally(() => {
  751. this.loading = false;
  752. });
  753. },
  754. /** 导出按钮操作 */
  755. handleExport() {
  756. this.$download.excel('/gas/roadSectionInspection/export', this.queryParams);
  757. }
  758. }
  759. };
  760. </script>