index.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512
  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. <imageUpload v-model="form.photoList"/>
  166. </el-form-item>
  167. <el-form-item label="职工" prop="userId">
  168. <el-select v-model="form.userId" filterable placeholder="请选择职工">
  169. <el-option v-for="item in workerList" :key="item.id" :value="item.id" :label="item.name">{{
  170. item.name
  171. }}
  172. </el-option>
  173. </el-select>
  174. </el-form-item>
  175. <el-form-item label="所属小区" prop="areaId">
  176. <el-select v-model="form.areaId" filterable placeholder="请选择小区"
  177. @change="getBuilding(form.areaId),resetform()">
  178. <el-option v-for="item in areaList" :key="item.id" :value="item.id" :label="item.name">{{
  179. item.name
  180. }}
  181. </el-option>
  182. </el-select>
  183. </el-form-item>
  184. <el-form-item label="所属楼宇" prop="buildingId">
  185. <el-select v-model="form.buildingId" filterable placeholder="请选择楼宇"
  186. @change="getUnit(form.buildingId),resetunitform()">
  187. <el-option v-for="item in buildingList" :key="item.id" :value="item.id" :label="item.name">{{
  188. item.name
  189. }}
  190. </el-option>
  191. </el-select>
  192. </el-form-item>
  193. <el-form-item label="所属单元" prop="unitId">
  194. <el-select v-model="form.unitId" filterable placeholder="请选择单元"
  195. @change="getHouse(form.unitId),resethouseform()">
  196. <el-option v-for="item in unitList" :key="item.id" :value="item.id" :label="item.name">{{
  197. item.name
  198. }}
  199. </el-option>
  200. </el-select>
  201. </el-form-item>
  202. <el-form-item label="房屋" prop="houseId">
  203. <el-select v-model="form.houseId" filterable placeholder="请选择房屋">
  204. <el-option v-for="item in houseList" :key="item.id" :value="item.id" :label="item.name">{{item.name}}
  205. </el-option>
  206. </el-select>
  207. </el-form-item>
  208. <el-form-item label="备注" prop="remark">
  209. <el-input v-model="form.remark" type="textarea" placeholder="请输入内容"/>
  210. </el-form-item>
  211. </el-form>
  212. <div slot="footer" class="dialog-footer">
  213. <!--<el-button :loading="buttonLoading" type="primary" @click="submitForm">确 定</el-button>-->
  214. <!--<el-button @click="cancel">取 消</el-button>-->
  215. <el-button @click="cancel">关 闭</el-button>
  216. </div>
  217. </el-dialog>
  218. </div>
  219. </template>
  220. <script>
  221. import {
  222. listOrder,
  223. getOrderForStatus,
  224. getListKaiShuan,
  225. getHouse,
  226. backup,
  227. getUnit,
  228. getArea,
  229. getBuilding,
  230. getOrder,
  231. getWorker,
  232. getPipeType,
  233. getValveType,
  234. getPipeLength,
  235. delOrder,
  236. addOrder,
  237. submitY,
  238. submitN,
  239. updateOrder
  240. } from "@/api/gas/order";
  241. export default {
  242. name: "Order",
  243. dicts: ['district'],
  244. data() {
  245. return {
  246. // 按钮loading
  247. buttonLoading: false,
  248. // 遮罩层
  249. loading: true,
  250. // 导出遮罩层
  251. exportLoading: false,
  252. //职工下拉
  253. workerList: [],
  254. pipeLengthList: [],
  255. pipeTypeList: [],
  256. valveTypeList: [],
  257. areaList: [],
  258. buildingList: [],
  259. unitList: [],
  260. houseList: [],
  261. // 选中数组
  262. ids: [],
  263. // 非单个禁用
  264. single: true,
  265. // 非多个禁用
  266. multiple: true,
  267. // 显示搜索条件
  268. showSearch: true,
  269. // 总条数
  270. total: 0,
  271. // 工程管理表格数据
  272. orderList: [],
  273. // 弹出层标题
  274. title: "",
  275. // 是否显示弹出层
  276. open: false,
  277. open1: false,
  278. // 查询参数
  279. queryParams: {
  280. pageNum: 1,
  281. pageSize: 10,
  282. serviceType: undefined,
  283. starTime: undefined,
  284. endTime: undefined,
  285. areaId: undefined,
  286. buildingId: undefined,
  287. unitId: undefined,
  288. houseId: undefined,
  289. userId: undefined,
  290. orderStatus: undefined,
  291. examineStatus: undefined,
  292. jobNum: undefined,
  293. },
  294. // 表单参数
  295. form: {
  296. serviceType: '006',
  297. orderStatus:'002',
  298. examineStatus:'001'
  299. },
  300. // 表单校验
  301. rules: {
  302. photoList: [
  303. {required: true, message: "请上传照片", trigger: "change"}
  304. ],
  305. userId: [
  306. {required: true, message: "职工不能为空", trigger: "blur"}
  307. ],
  308. houseId: [
  309. {required: true, message: "房屋不能为空", trigger: "change"}
  310. ],
  311. }
  312. };
  313. },
  314. created() {
  315. this.getList();
  316. this.getWorker();
  317. this.getArea();
  318. },
  319. methods: {
  320. backup() {
  321. backup().then(response => {
  322. });
  323. },
  324. /** 查询工程管理列表 */
  325. getList() {
  326. this.loading = true;
  327. getListKaiShuan(this.queryParams).then(response => {
  328. this.orderList = response.rows;
  329. this.total = response.total;
  330. this.loading = false;
  331. });
  332. },
  333. /**职工下拉框*/
  334. getWorker() {
  335. getWorker().then(response => {
  336. this.workerList = response.data;
  337. });
  338. },
  339. /**小区下拉框*/
  340. getArea() {
  341. getArea().then(response => {
  342. this.areaList = response.data;
  343. });
  344. },
  345. /**楼宇下拉框*/
  346. getBuilding(areaId) {
  347. getBuilding(areaId).then(response => {
  348. this.buildingList = response.data;
  349. this.getUnit(this.form.buildingId);
  350. });
  351. },
  352. getUnit(buildingId) {
  353. getUnit(buildingId).then(response => {
  354. this.unitList = response.data;
  355. this.getHouse(this.form.unitId);
  356. });
  357. },
  358. getHouse(unitId) {
  359. getHouse(unitId).then(response => {
  360. this.houseList = response.data;
  361. });
  362. },
  363. /**
  364. * 联级清空
  365. */
  366. resetform() {
  367. this.form.buildingId = undefined;
  368. this.form.unitId = undefined;
  369. this.form.houseId = undefined;
  370. },
  371. resetunitform() {
  372. this.form.unitId = undefined;
  373. this.form.houseId = undefined;
  374. },
  375. resethouseform() {
  376. this.form.houseId = undefined;
  377. },
  378. resetqueryform(){
  379. this.queryParams.buildingId = undefined;
  380. this.queryParams.unitId = undefined;
  381. this.queryParams.houseId = undefined;
  382. },
  383. resetqueryunitform(){
  384. this.queryParams.unitId = undefined;
  385. this.queryParams.houseId = undefined;
  386. },
  387. resetqueryhouseform(){
  388. this.queryParams.houseId = undefined;
  389. },
  390. // 取消按钮
  391. cancel() {
  392. this.open = false;
  393. this.reset();
  394. },
  395. // 表单重置
  396. reset() {
  397. this.form = {
  398. id: undefined,
  399. serviceType: '006',
  400. photoList: [],
  401. userId: undefined,
  402. unitId: undefined,
  403. buildingId: undefined,
  404. areaId: undefined,
  405. houseId: undefined,
  406. remark: undefined,
  407. delFlag: undefined,
  408. createBy: undefined,
  409. createTime: undefined,
  410. updateBy: undefined,
  411. updateTime: undefined,
  412. orderStatus:'002',
  413. examineStatus:'001'
  414. };
  415. this.resetForm("form");
  416. },
  417. /** 搜索按钮操作 */
  418. handleQuery() {
  419. this.queryParams.pageNum = 1;
  420. this.getList();
  421. },
  422. /** 重置按钮操作 */
  423. resetQuery() {
  424. this.resetForm("queryForm");
  425. this.handleQuery();
  426. },
  427. // 多选框选中数据
  428. handleSelectionChange(selection) {
  429. this.ids = selection.map(item => item.id)
  430. this.single = selection.length !== 1
  431. this.multiple = !selection.length
  432. },
  433. /** 新增按钮操作 */
  434. handleAdd() {
  435. this.reset();
  436. this.open = true;
  437. this.title = "添加";
  438. this.getWorker();
  439. this.getArea();
  440. },
  441. /** 修改按钮操作 */
  442. handleUpdate(row) {
  443. this.reset();
  444. this.getWorker();
  445. this.getArea();
  446. const id = row.id || this.ids
  447. getOrder(id).then(response => {
  448. this.loading = false;
  449. this.form = response.data;
  450. this.open = true;
  451. this.title = "详情";
  452. // this.title = "修改";
  453. this.getBuilding(this.form.areaId);
  454. });
  455. },
  456. /** 提交按钮 */
  457. submitForm() {
  458. this.$refs["form"].validate(valid => {
  459. if (valid) {
  460. this.buttonLoading = true;
  461. if (this.form.id != null) {
  462. if (typeof this.form.photoList==='string'){
  463. this.form.photoList = this.form.photoList.split(',')
  464. }
  465. updateOrder(this.form).then(response => {
  466. this.$modal.msgSuccess("修改成功");
  467. this.open = false;
  468. this.getList();
  469. this.getWorker();
  470. }).finally(() => {
  471. this.buttonLoading = false;
  472. });
  473. } else {
  474. this.form.photoList = this.form.photoList.split(',')
  475. addOrder(this.form).then(response => {
  476. this.$modal.msgSuccess("新增成功");
  477. this.open = false;
  478. this.getList();
  479. this.getWorker();
  480. }).finally(() => {
  481. this.buttonLoading = false;
  482. });
  483. }
  484. }
  485. });
  486. },
  487. /** 删除按钮操作 */
  488. handleDelete(row) {
  489. const ids = row.id || this.ids;
  490. this.$modal.confirm('是否确认删除工程管理编号为"' + ids + '"的数据项?').then(() => {
  491. this.loading = true;
  492. return delOrder(ids);
  493. }).then(() => {
  494. this.loading = false;
  495. this.getList();
  496. this.getWorker();
  497. this.$modal.msgSuccess("删除成功");
  498. }).finally(() => {
  499. this.loading = false;
  500. });
  501. },
  502. }
  503. };
  504. </script>