index.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567
  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="行政区" prop="district" >
  5. <el-select v-model="queryParams.district" placeholder="请选择行政区">
  6. <el-option
  7. v-for="dict in dict.type.district"
  8. :key="dict.value"
  9. :label="dict.label"
  10. :value="dict.value"
  11. ></el-option>
  12. </el-select>
  13. </el-form-item>
  14. <el-form-item label="所属小区" prop="areaId">
  15. <el-select v-model="queryParams.areaId" filterable clearable placeholder="请选择所属小区" @change="getBuilding(queryParams.areaId),resetqueryform()">
  16. <el-option v-for="item in areaList" :key="item.id" :value="item.id" :label="item.name">{{ item.name }}</el-option>
  17. </el-select>
  18. </el-form-item>
  19. <el-form-item label="所属楼宇" prop="buildingId">
  20. <el-select v-model="queryParams.buildingId" filterable clearable placeholder="请选择楼宇" @change="getUnit(queryParams.buildingId),resetqueryunitform()">
  21. <el-option v-for="item in buildingList" :key="item.id" :value="item.id" :label="item.name">{{ item.name }}</el-option>
  22. </el-select>
  23. </el-form-item>
  24. <el-form-item label="所属单元" prop="unitId">
  25. <el-select v-model="queryParams.unitId" filterable clearable placeholder="请选择单元" @change="getHouse(queryParams.unitId),resetqueryhouseform()">
  26. <el-option v-for="item in unitList" :key="item.id" :value="item.id" :label="item.name">{{ item.name }}</el-option>
  27. </el-select>
  28. </el-form-item>
  29. <el-form-item label="房屋" prop="houseId">
  30. <el-select v-model="queryParams.houseId" filterable clearable placeholder="请选择房屋">
  31. <el-option v-for="item in houseList" :key="item.id" :value="item.id" :label="item.name">{{ item.name }}</el-option>
  32. </el-select>
  33. </el-form-item>
  34. <el-form-item label="职工" prop="userId">
  35. <el-select v-model="queryParams.userId" filterable placeholder="请选择职工">
  36. <el-option v-for="item in workerList" :key="item.id" :value="item.id" :label="item.name">{{
  37. item.name
  38. }}
  39. </el-option>
  40. </el-select>
  41. </el-form-item>
  42. <el-form-item label="开始时间" prop="starTime">
  43. <el-date-picker clearable size="small"
  44. v-model="queryParams.starTime"
  45. type="date"
  46. value-format="yyyy-MM-dd"
  47. placeholder="选择日期">
  48. </el-date-picker>
  49. </el-form-item>
  50. <el-form-item label="结束时间" prop="endTime">
  51. <el-date-picker clearable size="small"
  52. v-model="queryParams.endTime"
  53. type="date"
  54. value-format="yyyy-MM-dd"
  55. placeholder="选择日期">
  56. </el-date-picker>
  57. </el-form-item>
  58. <el-form-item label="工号" prop="jobNum">
  59. <el-input
  60. v-model="queryParams.jobNum"
  61. :maxlength="4"
  62. placeholder="请输入工号前四位"
  63. clearable
  64. size="small"
  65. @keyup.enter.native="handleQuery"
  66. />
  67. </el-form-item>
  68. <el-form-item>
  69. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  70. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  71. </el-form-item>
  72. </el-form>
  73. <el-row :gutter="10" class="mb8">
  74. <!--<el-col :span="1.5">-->
  75. <!--<el-button-->
  76. <!--type="primary"-->
  77. <!--plain-->
  78. <!--icon="el-icon-plus"-->
  79. <!--size="mini"-->
  80. <!--@click="handleAdd"-->
  81. <!--v-hasPermi="['gas:order:add']"-->
  82. <!--&gt;新增-->
  83. <!--</el-button>-->
  84. <!--</el-col>-->
  85. <!--<el-col :span="1.5">-->
  86. <!--<el-button-->
  87. <!--type="danger"-->
  88. <!--plain-->
  89. <!--icon="el-icon-delete"-->
  90. <!--size="mini"-->
  91. <!--:disabled="multiple"-->
  92. <!--@click="handleDelete"-->
  93. <!--v-hasPermi="['gas:order:remove']"-->
  94. <!--&gt;删除</el-button>-->
  95. <!--</el-col>-->
  96. <el-col :span="1.5">
  97. <el-button
  98. type="warning"
  99. plain
  100. icon="el-icon-download"
  101. size="mini"
  102. :loading="exportLoading"
  103. @click="handleExport"
  104. >导出</el-button>
  105. </el-col>
  106. <!-- <el-col :span="1.5">-->
  107. <!-- <el-button-->
  108. <!-- type="warning"-->
  109. <!-- plain-->
  110. <!-- icon="el-icon-download"-->
  111. <!-- size="mini"-->
  112. <!-- :loading="exportLoading"-->
  113. <!-- @click="backup"-->
  114. <!-- v-hasPermi="['gas:order:export']"-->
  115. <!-- >备份</el-button>-->
  116. <!-- </el-col>-->
  117. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  118. </el-row>
  119. <el-table v-loading="loading" :data="orderList" @selection-change="handleSelectionChange">
  120. <el-table-column type="selection" width="55" align="center"/>
  121. <el-table-column label="职工" align="center" prop="userName"/>
  122. <el-table-column label="房屋" align="center" prop="house"/>
  123. <el-table-column label="创建时间" align="center" prop="time" />
  124. <el-table-column label="修改时间" align="center" prop="updateTime" />
  125. <el-table-column label="照片" align="center" prop="photoList">
  126. <template slot-scope="scope">
  127. <el-image
  128. v-if="scope.row.photoList.length> 0"
  129. style="width: 100px; height: 100px"
  130. :src="scope.row.photoList[0]"
  131. :preview-src-list="scope.row.photoList">
  132. </el-image>
  133. </template>
  134. </el-table-column>
  135. <el-table-column label="是否维修" align="center" prop="whether"/>
  136. <el-table-column label="备注" align="center" prop="remark"/>
  137. <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
  138. <template slot-scope="scope">
  139. <el-button
  140. size="mini"
  141. type="text"
  142. icon="el-icon-view"
  143. @click="handleUpdate(scope.row)"
  144. v-hasPermi="['gas:order:edit']"
  145. >详情
  146. </el-button>
  147. <!--<el-button-->
  148. <!--size="mini"-->
  149. <!--type="text"-->
  150. <!--icon="el-icon-edit"-->
  151. <!--@click="handleUpdate(scope.row)"-->
  152. <!--v-hasPermi="['gas:order:edit']"-->
  153. <!--&gt;修改-->
  154. <!--</el-button>-->
  155. <!--<el-button-->
  156. <!--size="mini"-->
  157. <!--type="text"-->
  158. <!--icon="el-icon-delete"-->
  159. <!--@click="handleDelete(scope.row)"-->
  160. <!--v-hasPermi="['gas:order:remove']"-->
  161. <!--&gt;删除</el-button>-->
  162. </template>
  163. </el-table-column>
  164. </el-table>
  165. <pagination
  166. v-show="total>0"
  167. :total="total"
  168. :page.sync="queryParams.pageNum"
  169. :limit.sync="queryParams.pageSize"
  170. @pagination="getList"
  171. />
  172. <!-- 添加或修改工程管理对话框 -->
  173. <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
  174. <el-form ref="form" :model="form" :rules="rules" label-width="80px">
  175. <el-form-item label="照片" prop="photoList">
  176. <!--<el-image-->
  177. <!--v-if="form.photoList && form.photoList.length> 0 && (form.photoList[0].substring(form.photoList[0].lastIndexOf('.')+1)!='mp4')"-->
  178. <!--style="width: 100px; height: 100px"-->
  179. <!--:src="form.photoList[0]"-->
  180. <!--:preview-src-list="form.photoList"-->
  181. <!--&gt;-->
  182. <!--</el-image>-->
  183. <!--<video-->
  184. <!--v-if="form.photoList && form.photoList.length> 0 && (form.photoList[0].substring(form.photoList[0].lastIndexOf('.')+1)=='mp4')"-->
  185. <!--style="width: 100px; height: 100px"-->
  186. <!--:src="form.photoList[0]"-->
  187. <!--&gt;-->
  188. <!--</video>-->
  189. <el-image
  190. v-for="photo in form.photoList"
  191. style="width: 100px; height: 100px; margin-right: 10px"
  192. :src="photo"
  193. :preview-src-list="form.photoList"
  194. >
  195. </el-image>
  196. <!--<imageUpload v-model="form.photoList"/>-->
  197. </el-form-item>
  198. <el-form-item label="职工" prop="userId">
  199. <el-select v-model="form.userId" filterable placeholder="请选择职工" disabled>
  200. <el-option v-for="item in workerList" :key="item.id" :value="item.id" :label="item.name">{{
  201. item.name
  202. }}
  203. </el-option>
  204. </el-select>
  205. </el-form-item>
  206. <el-form-item label="所属小区" prop="areaId">
  207. <el-select v-model="form.areaId" filterable placeholder="请选择小区"
  208. @change="getBuilding(form.areaId),resetform()" disabled>
  209. <el-option v-for="item in areaList" :key="item.id" :value="item.id" :label="item.name">{{
  210. item.name
  211. }}
  212. </el-option>
  213. </el-select>
  214. </el-form-item>
  215. <el-form-item label="所属楼宇" prop="buildingId">
  216. <el-select v-model="form.buildingId" filterable placeholder="请选择楼宇"
  217. @change="getUnit(form.buildingId),resetunitform()" disabled>
  218. <el-option v-for="item in buildingList" :key="item.id" :value="item.id" :label="item.name">{{
  219. item.name
  220. }}
  221. </el-option>
  222. </el-select>
  223. </el-form-item>
  224. <el-form-item label="所属单元" prop="unitId">
  225. <el-select v-model="form.unitId" filterable placeholder="请选择单元"
  226. @change="getHouse(form.unitId),resethouseform()" disabled>
  227. <el-option v-for="item in unitList" :key="item.id" :value="item.id" :label="item.name">{{
  228. item.name
  229. }}
  230. </el-option>
  231. </el-select>
  232. </el-form-item>
  233. <el-form-item label="房屋" prop="houseId">
  234. <el-select v-model="form.houseId" filterable placeholder="请选择房屋" disabled>
  235. <el-option v-for="item in houseList" :key="item.id" :value="item.id" :label="item.name">{{item.name}}
  236. </el-option>
  237. </el-select>
  238. </el-form-item>
  239. <el-form-item label="是否维修" prop="whether">
  240. <el-select v-model="form.whether" filterable placeholder="请选择" disabled>
  241. <el-option v-for="item in whetherList" :value="item.value" :label="item.label">{{item.label}}</el-option>
  242. </el-select>
  243. </el-form-item>
  244. <el-form-item label="备注" prop="remark">
  245. <el-input v-model="form.remark" type="textarea" placeholder="请输入内容" disabled/>
  246. </el-form-item>
  247. </el-form>
  248. <div slot="footer" class="dialog-footer">
  249. <!--<el-button :loading="buttonLoading" type="primary" @click="submitForm">确 定</el-button>-->
  250. <!--<el-button @click="cancel">取 消</el-button>-->
  251. <el-button @click="cancel">关 闭</el-button>
  252. </div>
  253. </el-dialog>
  254. </div>
  255. </template>
  256. <script>
  257. import {
  258. listOrder,
  259. getOrderForStatus,
  260. getListWeiXiu,
  261. getHouse,
  262. backup,
  263. getUnit,
  264. getArea,
  265. getBuilding,
  266. getOrder,
  267. getWorker,
  268. getPipeType,
  269. getValveType,
  270. getPipeLength,
  271. delOrder,
  272. addOrder,
  273. submitY,
  274. submitN,
  275. updateOrder
  276. } from "@/api/gas/order";
  277. export default {
  278. name: "Order",
  279. dicts: ['district'],
  280. data() {
  281. return {
  282. whetherList:[
  283. {
  284. value: '是',
  285. label: '是',
  286. },
  287. {
  288. value: '否',
  289. label: '否',
  290. }
  291. ],
  292. // 按钮loading
  293. buttonLoading: false,
  294. // 遮罩层
  295. loading: true,
  296. // 导出遮罩层
  297. exportLoading: false,
  298. //职工下拉
  299. workerList: [],
  300. pipeLengthList: [],
  301. pipeTypeList: [],
  302. valveTypeList: [],
  303. areaList: [],
  304. buildingList: [],
  305. unitList: [],
  306. houseList: [],
  307. // 选中数组
  308. ids: [],
  309. // 非单个禁用
  310. single: true,
  311. // 非多个禁用
  312. multiple: true,
  313. // 显示搜索条件
  314. showSearch: true,
  315. // 总条数
  316. total: 0,
  317. // 工程管理表格数据
  318. orderList: [],
  319. // 弹出层标题
  320. title: "",
  321. // 是否显示弹出层
  322. open: false,
  323. open1: false,
  324. // 查询参数
  325. queryParams: {
  326. pageNum: 1,
  327. pageSize: 10,
  328. serviceType: undefined,
  329. starTime: undefined,
  330. endTime: undefined,
  331. areaId: undefined,
  332. buildingId: undefined,
  333. unitId: undefined,
  334. houseId: undefined,
  335. userId: undefined,
  336. orderStatus: undefined,
  337. examineStatus: undefined,
  338. jobNum: undefined,
  339. },
  340. // 表单参数
  341. form: {
  342. serviceType: '005',
  343. orderStatus:'002',
  344. examineStatus:'001'
  345. },
  346. // 表单校验
  347. rules: {
  348. photoList: [
  349. {required: true, message: "请上传照片", trigger: "change"}
  350. ],
  351. userId: [
  352. {required: true, message: "职工不能为空", trigger: "blur"}
  353. ],
  354. houseId: [
  355. {required: true, message: "房屋不能为空", trigger: "change"}
  356. ],
  357. }
  358. };
  359. },
  360. created() {
  361. this.getList();
  362. this.getWorker();
  363. this.getArea();
  364. },
  365. methods: {
  366. backup() {
  367. backup().then(response => {
  368. });
  369. },
  370. /** 导出按钮操作 */
  371. handleExport() {
  372. this.$download.excel('/gas/order/getListWeiXiuExport', this.queryParams);
  373. },
  374. /** 查询工程管理列表 */
  375. getList() {
  376. this.loading = true;
  377. getListWeiXiu(this.queryParams).then(response => {
  378. this.orderList = response.rows;
  379. this.total = response.total;
  380. this.loading = false;
  381. });
  382. },
  383. /**职工下拉框*/
  384. getWorker() {
  385. getWorker().then(response => {
  386. this.workerList = response.data;
  387. });
  388. },
  389. /**小区下拉框*/
  390. getArea() {
  391. getArea().then(response => {
  392. this.areaList = response.data;
  393. });
  394. },
  395. /**楼宇下拉框*/
  396. getBuilding(areaId) {
  397. this.form.areaName = this.areaList.filter(item => item.id == areaId )[0].name
  398. getBuilding(areaId).then(response => {
  399. this.buildingList = response.data;
  400. this.getUnit(this.form.buildingId);
  401. });
  402. },
  403. getUnit(buildingId) {
  404. this.form.buildingName = this.buildingList.filter(item => item.id == buildingId )[0].name
  405. getUnit(buildingId).then(response => {
  406. this.unitList = response.data;
  407. this.getHouse(this.form.unitId);
  408. });
  409. },
  410. getHouse(unitId) {
  411. this.form.unitName = this.unitList.filter(item => item.id == unitId )[0].name
  412. getHouse(unitId).then(response => {
  413. this.houseList = response.data;
  414. });
  415. },
  416. /**
  417. * 联级清空
  418. */
  419. resetform() {
  420. this.form.buildingId = undefined;
  421. this.form.unitId = undefined;
  422. this.form.houseId = undefined;
  423. },
  424. resetunitform() {
  425. this.form.unitId = undefined;
  426. this.form.houseId = undefined;
  427. },
  428. resethouseform() {
  429. this.form.houseId = undefined;
  430. },
  431. resetqueryform(){
  432. this.queryParams.buildingId = undefined;
  433. this.queryParams.unitId = undefined;
  434. this.queryParams.houseId = undefined;
  435. },
  436. resetqueryunitform(){
  437. this.queryParams.unitId = undefined;
  438. this.queryParams.houseId = undefined;
  439. },
  440. resetqueryhouseform(){
  441. this.queryParams.houseId = undefined;
  442. },
  443. // 取消按钮
  444. cancel() {
  445. this.open = false;
  446. this.reset();
  447. },
  448. // 表单重置
  449. reset() {
  450. this.form = {
  451. id: undefined,
  452. serviceType: '005',
  453. photoList: [],
  454. userId: undefined,
  455. unitId: undefined,
  456. buildingId: undefined,
  457. areaId: undefined,
  458. houseId: undefined,
  459. remark: undefined,
  460. delFlag: undefined,
  461. createBy: undefined,
  462. createTime: undefined,
  463. updateBy: undefined,
  464. updateTime: undefined,
  465. orderStatus:'002',
  466. examineStatus:'001',
  467. whether:undefined
  468. };
  469. this.resetForm("form");
  470. },
  471. /** 搜索按钮操作 */
  472. handleQuery() {
  473. this.queryParams.pageNum = 1;
  474. this.getList();
  475. },
  476. /** 重置按钮操作 */
  477. resetQuery() {
  478. this.resetForm("queryForm");
  479. this.handleQuery();
  480. },
  481. // 多选框选中数据
  482. handleSelectionChange(selection) {
  483. this.ids = selection.map(item => item.id)
  484. this.single = selection.length !== 1
  485. this.multiple = !selection.length
  486. },
  487. /** 新增按钮操作 */
  488. handleAdd() {
  489. this.reset();
  490. this.open = true;
  491. this.title = "添加";
  492. this.getWorker();
  493. this.getArea();
  494. },
  495. /** 修改按钮操作 */
  496. handleUpdate(row) {
  497. this.reset();
  498. this.getWorker();
  499. this.getArea();
  500. const id = row.id || this.ids
  501. getOrder(id).then(response => {
  502. this.loading = false;
  503. this.form = response.data;
  504. this.open = true;
  505. // this.title = "修改";
  506. this.title = "详情";
  507. this.getBuilding(this.form.areaId);
  508. });
  509. },
  510. /** 提交按钮 */
  511. submitForm() {
  512. this.$refs["form"].validate(valid => {
  513. if (valid) {
  514. this.buttonLoading = true;
  515. if (this.form.id != null) {
  516. if (typeof this.form.photoList==='string'){
  517. this.form.photoList = this.form.photoList.split(',')
  518. }
  519. updateOrder(this.form).then(response => {
  520. this.$modal.msgSuccess("修改成功");
  521. this.open = false;
  522. this.getList();
  523. this.getWorker();
  524. }).finally(() => {
  525. this.buttonLoading = false;
  526. });
  527. } else {
  528. this.form.photoList = this.form.photoList.split(',')
  529. addOrder(this.form).then(response => {
  530. this.$modal.msgSuccess("新增成功");
  531. this.open = false;
  532. this.getList();
  533. this.getWorker();
  534. }).finally(() => {
  535. this.buttonLoading = false;
  536. });
  537. }
  538. }
  539. });
  540. },
  541. /** 删除按钮操作 */
  542. handleDelete(row) {
  543. const ids = row.id || this.ids;
  544. this.$modal.confirm('是否确认删除工程管理编号为"' + ids + '"的数据项?').then(() => {
  545. this.loading = true;
  546. return delOrder(ids);
  547. }).then(() => {
  548. this.loading = false;
  549. this.getList();
  550. this.getWorker();
  551. this.$modal.msgSuccess("删除成功");
  552. }).finally(() => {
  553. this.loading = false;
  554. });
  555. },
  556. }
  557. };
  558. </script>