index.vue 18 KB

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