index.vue 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766
  1. <!--
  2. *@description: 工业工程
  3. *@author: yh Fu
  4. *@date: 2024-01-02 15:51:03
  5. *@version: V1.0.5
  6. -->
  7. <template>
  8. <div class="app-container">
  9. <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="110px">
  10. <el-form-item label="工程名称" prop="enginName">
  11. <el-input v-model="queryParams.enginName" placeholder="请输入建筑工程名称" maxlength="20"></el-input>
  12. </el-form-item>
  13. <el-form-item label="工程分类" prop="enginClassification" v-if="engineeType">
  14. <el-select v-model="queryParams.enginClassification" placeholder="请选择工程分类">
  15. <el-option
  16. v-for="e in dict.type.engin_classification"
  17. :key="e.value"
  18. :label="e.label"
  19. :value="e.value"
  20. ></el-option>
  21. </el-select>
  22. </el-form-item>
  23. <el-form-item>
  24. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  25. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  26. </el-form-item>
  27. </el-form>
  28. <el-row :gutter="10" class="mb8">
  29. <el-col :span="1.5">
  30. <el-button
  31. type="primary"
  32. plain
  33. icon="el-icon-plus"
  34. size="mini"
  35. @click="handleAdd"
  36. v-hasPermi="['zdsz:engineeringIndustry:add']"
  37. >新增
  38. </el-button>
  39. </el-col>
  40. <el-col :span="1.5">
  41. <el-button
  42. type="success"
  43. plain
  44. icon="el-icon-edit"
  45. size="mini"
  46. :disabled="single"
  47. @click="handleUpdate"
  48. v-hasPermi="['zdsz:engineeringIndustry:edit']"
  49. >修改
  50. </el-button>
  51. </el-col>
  52. <el-col :span="1.5">
  53. <el-button
  54. type="danger"
  55. plain
  56. icon="el-icon-delete"
  57. size="mini"
  58. :disabled="multiple"
  59. @click="handleDelete"
  60. v-hasPermi="['zdsz:engineeringIndustry:remove']"
  61. >删除
  62. </el-button>
  63. </el-col>
  64. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  65. </el-row>
  66. <el-table v-loading="loading" :data="comprehensiveList" @selection-change="handleSelectionChange">
  67. <el-table-column type="selection" width="55" align="center"/>
  68. <el-table-column label="工程名称" align="center" prop="enginName"/>
  69. <el-table-column label="建筑单位" align="center" prop="constructUnit"/>
  70. <el-table-column label="项目负责人" align="center" prop="projectHead"/>
  71. <el-table-column label="现场负责人" align="center" prop="sceneHead"/>
  72. <el-table-column label="设计负责人" align="center" prop="designHead"/>
  73. <el-table-column label="设计单位" align="center" prop="designUnit"/>
  74. <el-table-column label="监理负责人" align="center" prop="supervisionHead"/>
  75. <el-table-column label="监理单位" align="center" prop="supervisionUnit"/>
  76. <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
  77. <template v-slot="scope">
  78. <el-button
  79. size="mini"
  80. type="text"
  81. icon="el-icon-edit"
  82. @click="handleUpdate(scope.row)"
  83. v-hasPermi="['zdsz:engineeringIndustry:edit']"
  84. >修改
  85. </el-button>
  86. <el-button
  87. size="mini"
  88. type="text"
  89. icon="el-icon-delete"
  90. @click="handleDelete(scope.row)"
  91. v-hasPermi="['zdsz:engineeringIndustry:remove']"
  92. >删除
  93. </el-button>
  94. <el-button
  95. size="mini"
  96. type="text"
  97. icon="el-icon-edit"
  98. @click="addNewPipe(scope.row)"
  99. >新增顶管工程
  100. </el-button>
  101. <el-button
  102. type="text"
  103. icon="el-icon-edit"
  104. size="mini"
  105. @click="viewSource(scope.row)"
  106. >历史</el-button>
  107. </template>
  108. </el-table-column>
  109. </el-table>
  110. <pagination
  111. v-show="total>0"
  112. :total="total"
  113. :page.sync="queryParams.pageNum"
  114. :limit.sync="queryParams.pageSize"
  115. @pagination="getList"
  116. />
  117. <!-- 顶管工程新增 -->
  118. <EngineePipe ref="enginPipe"/>
  119. <!-- 添加或修改市政工程|工业工程对话框 -->
  120. <el-dialog :title="title" :visible.sync="open" append-to-body customClass="appendElDialog">
  121. <el-form ref="form" :model="form" :rules="rules" label-width="110px">
  122. <el-form-item label="工程名称" prop="enginName">
  123. <el-input v-model="form.enginName" placeholder="请填写工程名称" maxlength="20"></el-input>
  124. </el-form-item>
  125. <el-form-item label="建筑单位" prop="constructUnit">
  126. <el-input v-model="form.constructUnit" placeholder="请填写建筑单位" maxlength="50"></el-input>
  127. </el-form-item>
  128. <el-form-item label="项目负责人" prop="projectHead">
  129. <el-input v-model="form.projectHead" placeholder="请填写项目负责人" maxlength="20"></el-input>
  130. </el-form-item>
  131. <el-form-item label="现场负责人" prop="sceneHead">
  132. <el-input v-model="form.sceneHead" placeholder="请填写现场负责人" maxlength="20"></el-input>
  133. </el-form-item>
  134. <el-form-item label="设计单位" prop="designUnit">
  135. <el-input v-model="form.designUnit" placeholder="请填写设计单位" maxlength="50"></el-input>
  136. </el-form-item>
  137. <el-form-item label="设计负责人" prop="designHead">
  138. <el-input v-model="form.designHead" placeholder="请填写现场负责人" maxlength="20"></el-input>
  139. </el-form-item>
  140. <el-form-item label="设计联系方式" prop="designPhone">
  141. <el-input v-model="form.designPhone" placeholder="请填写设计联系方式" maxlength="11"></el-input>
  142. </el-form-item>
  143. <el-form-item label="监理单位" prop="supervisionUnit">
  144. <el-input v-model="form.supervisionUnit" placeholder="请填写监理单位" maxlength="50"/>
  145. </el-form-item>
  146. <el-form-item label="监理负责人" prop="supervisionHead">
  147. <el-input v-model="form.supervisionHead" placeholder="请填写监理负责人" maxlength="20"></el-input>
  148. </el-form-item>
  149. <el-form-item label="监理联系电话" prop="supervisionPhone">
  150. <el-input v-model="form.supervisionPhone" placeholder="请填写监理联系电话" maxlength="11"></el-input>
  151. </el-form-item>
  152. <el-form-item label="工程类型" prop="enginType">
  153. <el-select v-model="form.enginType" placeholder="请选择工程类型" style="width: 100%">
  154. <el-option
  155. v-for="e in EngineepipeType"
  156. :key="e.value"
  157. :label="e.label"
  158. :value="e.value"
  159. ></el-option>
  160. </el-select>
  161. </el-form-item>
  162. <el-form-item label="工程分类" prop="enginClassification" v-if="form.type === '1'">
  163. <el-select v-model="form.enginClassification" placeholder="请选择工程分类" style="width: 100%">
  164. <el-option
  165. v-for="e in dict.type.engin_classification"
  166. :key="e.value"
  167. :label="e.label"
  168. :value="e.value"
  169. ></el-option>
  170. </el-select>
  171. </el-form-item>
  172. <el-row :gutter="20">
  173. <el-col :span="24">
  174. <el-form-item label="附件" prop="files" v-if="currentType==='put'" style="width: 100%">
  175. <ObsFileUpload ref="obsFileUpload" :file-size="100" :file-type="['dwg','dwt','doc','docx','xls','xlsx','png', 'jpg', 'jpeg']" :limit="9999" :value="form.pics"
  176. ></ObsFileUpload>
  177. </el-form-item>
  178. <el-form-item label="附件" prop="files" v-if="currentType==='add'" style="width: 100%">
  179. <ObsFileUpload ref="obsFileUpload" :file-size="100" :file-type="['dwg','dwt','doc','docx','xls','xlsx','png', 'jpg', 'jpeg']" :limit="9999" :value="form.files"
  180. ></ObsFileUpload>
  181. </el-form-item>
  182. </el-col>
  183. </el-row>
  184. <div style="width: 20%; float: right">
  185. <el-button :loading="buttonLoading" type="primary" @click="toNodeDetail">填写施工信息</el-button>
  186. <el-button @click="cancel">取 消</el-button>
  187. </div>
  188. </el-form>
  189. </el-dialog>
  190. <!-- 施工信息dialog -->
  191. <el-dialog :visible.sync="nodeDetailVisible" title="施工信息" append-to-body customClass="appendElNodeDialog" width="70% !important">
  192. <!-- 节点表单 -->
  193. <el-form ref="nodeForm" :model="form.zEngineeringNodeBo.zEngineeringInfoBo" :rules="nodeRules" label-width="200px">
  194. <el-form-item label="施工时间" prop="constructTime">
  195. <el-date-picker
  196. v-model="form.zEngineeringNodeBo.zEngineeringInfoBo.constructTime"
  197. value-format="yyyy-MM-dd hh:mm:ss"
  198. type="datetime"
  199. style="width: 100%"
  200. placeholder="请选择施工时间">
  201. </el-date-picker>
  202. </el-form-item>
  203. <el-form-item label="施工人" prop="constructUser" v-if="form.id">
  204. <el-input v-model="form.zEngineeringNodeBo.zEngineeringInfoBo.constructUser" placeholder="请填写施工人" maxlength="20" disabled></el-input>
  205. </el-form-item>
  206. <el-row>
  207. <el-form-item label="照片" prop="zEngiineeringPhotoBoList" style="width: 100%;">
  208. <ObsImageUpload ref="obsImageUpload" :limit="9999" :fileType="['png', 'jpg', 'jpeg']" :value="form.zEngineeringNodeBo.zEngineeringInfoBo.zEngiineeringPhotoBoList"
  209. @input="getUrl"></ObsImageUpload>
  210. </el-form-item>
  211. </el-row>
  212. <el-row v-for="(item, index) in form.zEngineeringNodeBo.zEngineeringInfoBo.zEngineeringMaterialBo" :key="index" >
  213. <el-col :span="7" >
  214. <el-form-item
  215. :prop="`zEngineeringMaterialBo.${index}.materialQuality`"
  216. :rules="{ required:true, validator: validateState, trigger: 'blur', index:index }"
  217. label-width="auto"
  218. label="材质"
  219. >
  220. <el-select v-model="item.materialQuality" placeholder="请选择材质" style="width: 70%" @change="getEnginSpecificationsList(item, index)">
  221. <el-option
  222. v-for="e in materialQualityList"
  223. :key="e.id"
  224. :label="e.name"
  225. :value="e.id"
  226. ></el-option>
  227. </el-select>
  228. </el-form-item>
  229. </el-col>
  230. <el-col :span="7" >
  231. <el-form-item
  232. :prop="`zEngineeringMaterialBo.${index}.specifications`"
  233. :rules="{ required:true, validator: validateSize, trigger: 'blur', index:index }"
  234. label-width="auto"
  235. label="规格"
  236. >
  237. <el-select v-model="item.specifications" placeholder="请选择规格" style="width: 70%">
  238. <el-option
  239. v-for="e in specificationsList"
  240. :key="e.id"
  241. :label="e.name"
  242. :value="e.id"
  243. ></el-option>
  244. </el-select>
  245. </el-form-item>
  246. </el-col>
  247. <el-col :span="7" >
  248. <el-form-item
  249. :prop="`zEngineeringMaterialBo.${index}.number`"
  250. :rules="{ required:true, validator: validateNumber, trigger: 'blur', index:index }"
  251. label-width="auto"
  252. label="数量"
  253. >
  254. <div class="block" style="display: inline-block; margin-right: 20px;">
  255. <el-input v-model="item.number" placeholder="请输入数量" style="width: 100%" maxlength="8"/>
  256. </div>
  257. </el-form-item>
  258. </el-col>
  259. <el-col :span="3">
  260. <el-form-item style="margin-left: -120px;">
  261. <el-button v-if="form.zEngineeringNodeBo.zEngineeringInfoBo.zEngineeringMaterialBo.length > 1" @click="removezEngineeringMaterialBo(index)">
  262. 删除
  263. </el-button>
  264. </el-form-item>
  265. </el-col>
  266. </el-row>
  267. <div style="width: 25%; float: right">
  268. <el-button @click="addzEngineeringMaterialBo">新增用料信息</el-button>
  269. <el-button :loading="buttonLoading" type="primary" @click="submitForm">提交</el-button>
  270. <el-button @click="nodeCancel">取 消</el-button>
  271. </div>
  272. </el-form>
  273. </el-dialog>
  274. <ConstructionDetails
  275. ref="ConstructionDetails"
  276. :currentCollapses="currentCollapses"
  277. />
  278. </div>
  279. </template>
  280. <script>
  281. import {
  282. addEngineeEngineeIndustry,
  283. DelEngineeEngineeIndustry,
  284. EditEngineeEngineeIndustry,
  285. getEngineeIndustryList,
  286. putEngineeEngineeIndustry,
  287. QueryEngineeIndustry
  288. } from '@/api/zdsz/engineeringIndustry'
  289. import EngineePipe from '@/components/EngineePipe'
  290. import { validPhoneMobile } from '@/api/rules'
  291. import ConstructionDetails from '@/components/ConstructionDetails/index.vue'
  292. import { getEnginMaterialQualityList } from '@/api/zdsz/enginee'
  293. import { getEnginSpecificationsList } from '@/api/zdsz/enginSpecifications'
  294. export default {
  295. name: "openrepair",
  296. dicts: ['pass_check', 'is_repair', 'industry_engin_type', 'self_closing_valve_type', 'visit_type', 'engin_classification','engineering_infrastructure'],
  297. components: {
  298. ConstructionDetails,
  299. EngineePipe
  300. },
  301. data() {
  302. // 自定义校验
  303. const validatePicPass = (rule, value, callback) => {
  304. return new Promise((resolve, reject) => {
  305. // 至少有一个图片、一个创建时间
  306. if (this.form.zEngineeringNodeBo.zEngineeringInfoBo.zEngiineeringPhotoBoList.length !== 0
  307. && (this.form.zEngineeringNodeBo.zEngineeringInfoBo.constructTime !== null || undefined)) {
  308. resolve(true)
  309. } else {
  310. reject(new Error('no pass'))
  311. }
  312. })
  313. }
  314. return {
  315. // 按钮loading
  316. buttonLoading: false,
  317. // 遮罩层
  318. loading: true,
  319. // 选中数组
  320. ids: [],
  321. // 非单个禁用
  322. single: true,
  323. // 非多个禁用
  324. multiple: true,
  325. // 显示搜索条件
  326. showSearch: true,
  327. // 工程分类显示
  328. engineeType: true,
  329. // 总条数
  330. total: 0,
  331. currentNode:[],
  332. currentCollapses:[],
  333. // 市政工程|工业工程表格数据
  334. comprehensiveList: [],
  335. // 弹出层标题
  336. title: "",
  337. nodeList:[],
  338. // 是否显示弹出层
  339. open: false,
  340. // 查询参数
  341. queryParams: {
  342. enginName: '', // 工程名称
  343. enginClassification: '', // 工程分类
  344. zEngineeringNodeBo: {
  345. type: '',
  346. zEngineeringInfoBo: {}, //施工信息
  347. }
  348. },
  349. nodeDetailVisible: false, // 施工信息dialog
  350. // 表单参数
  351. form: {
  352. files:[], // 附件
  353. pics:[], // 附件返回
  354. type:'', // 用来区分工业工程、市政工程
  355. enginName:'', // 工程名称
  356. enginType:'', // 工程类型
  357. constructUnit:'', // 建筑单位
  358. projectHead:'', // 项目负责人
  359. sceneHead:'', // 现场负责人
  360. designUnit:'', // 设计单位
  361. designHead:'', // 设计负责人
  362. designPhone:'', // 设计联系电话
  363. supervisionUnit:'', // 监理单位
  364. supervisionHead:'', // 监理负责人
  365. supervisionPhone:'', // 监理联系电话
  366. enginClassification:'', // 工程分类
  367. zEngineeringNodeBo:{ // 工程节点
  368. type:'', // 节点类型
  369. zEngineeringInfoBo: { // 施工信息
  370. constructUser: '', // 施工人
  371. constructTime: '', // 施工时间
  372. zEngiineeringPhotoBoList: [], // 图片列表
  373. zEngineeringMaterialBo: [ // 用料对象
  374. {
  375. materialQuality: '', // 用料材质
  376. specifications: '', // 用料规格
  377. number: '' // 用料数量
  378. },
  379. ],
  380. },
  381. },
  382. },
  383. EngineepipeType: [], // 工程类型
  384. materialQualityList: [], // 用料材质List
  385. specificationsList: [], // 用料规格List
  386. // 表单校验
  387. rules: {
  388. sceneHead: [
  389. {required: true, message: "现场负责人不能为空", trigger: 'blur'}
  390. ],
  391. enginName: [
  392. {required: true, message: "工程名称不能为空", trigger: 'blur'}
  393. ],
  394. enginClassification: [
  395. {required: true, message: "工程分类不能为空", trigger: 'blur'}
  396. ],
  397. supervisionUnit: [
  398. {required: true, message: "监理单位不能为空", trigger: 'blur'}
  399. ],
  400. enginType: [
  401. {required: true, message: "工程类型不能为空", trigger: 'blur'}
  402. ],
  403. supervisionPhone: [
  404. {required: true, message: "监理联系电话不能为空", trigger: 'blur'},
  405. {validator: validPhoneMobile, trigger: 'blur'}
  406. ],
  407. constructUnit: [
  408. {required: true, message: "建筑单位不能为空", trigger: 'blur'}
  409. ],
  410. projectHead: [
  411. {required: true, message: "项目负责人不能为空", trigger: 'blur'}
  412. ],
  413. designHead: [
  414. {required: true, message: "设计负责人不能为空", trigger: 'blur'}
  415. ],
  416. designUnit: [
  417. {required: true, message: "设计单位不能为空", trigger: 'blur'}
  418. ],
  419. designPhone: [
  420. {required: true, message: "联系方式不能为空", trigger: 'blur'},
  421. {validator: validPhoneMobile, trigger: 'blur'}
  422. ],
  423. supervisionHead: [
  424. {required: true, message: "监理负责人不能为空", trigger: 'blur'}
  425. ],
  426. type: [
  427. {required: false, message: "类型不能为空", trigger: "blur"}
  428. ],
  429. files: [
  430. {required: false, message: "附件不能为空", trigger: "blur"}
  431. ],
  432. },
  433. // 节点规则校验
  434. nodeRules: {
  435. constructTime: [
  436. {required: true, message: "施工时间不能为空", trigger: 'change', validator: validatePicPass}
  437. ],
  438. zEngiineeringPhotoBoList: [
  439. {required: true, message: "图片不能为空", trigger: 'change', validator: validatePicPass}
  440. ],
  441. zEngineeringMaterialBo:[
  442. {required: true, message: "不能为空", trigger: 'change', validator: validatePicPass}
  443. ]
  444. },
  445. currentType: null, // 附件组件类型 put修改 add新增
  446. };
  447. },
  448. created() {
  449. // 根据url获取type节点类型
  450. this.getType();
  451. if (this.form.type === '2') {
  452. this.engineeType = false
  453. }
  454. this.getList();
  455. },
  456. mounted() {
  457. // 手动渲染
  458. setInterval(() =>{
  459. this.$forceUpdate()
  460. },500)
  461. },
  462. methods: {
  463. validateState(rule,value,callback){
  464. return new Promise((resolve, reject) => {
  465. if (value !==null && value !== undefined && value !== '' && value !== 0)
  466. {
  467. resolve(true)
  468. } else {
  469. return callback(new Error('材质不能为空'))
  470. }
  471. })
  472. },
  473. validateSize(rule,value,callback){
  474. return new Promise((resolve, reject) => {
  475. if (value !==null && value !== undefined && value !== '' && value !== 0)
  476. {
  477. resolve(true)
  478. } else {
  479. return callback(new Error('规格不能为空'))
  480. }
  481. })
  482. },
  483. validateNumber(rule,value,callback){
  484. return new Promise((resolve, reject) => {
  485. console.log("·························")
  486. console.log(value);
  487. // 至少有一个图片、一个用料信息、一个创建时间
  488. if (value !==null && value !== undefined && value !== '' && value !== 0 && !isNaN(value))
  489. {
  490. resolve(true)
  491. } else {
  492. return callback(new Error('数量不能为空且只能为数字'))
  493. }
  494. })
  495. },
  496. // 根据所选材质获取对应规格
  497. getEnginSpecificationsList(item, index){
  498. this.form.zEngineeringNodeBo.zEngineeringInfoBo.zEngineeringMaterialBo[index].specifications = null
  499. // 根据材质ID获取材质规格
  500. getEnginSpecificationsList(item.materialQuality).then(res => {
  501. this.specificationsList = res.data
  502. })
  503. },
  504. // 添加用料信息
  505. addzEngineeringMaterialBo(){
  506. this.form.zEngineeringNodeBo.zEngineeringInfoBo.zEngineeringMaterialBo.push({
  507. materialQuality: '', // 用料材质
  508. specifications: '', // 用料规格
  509. number: '' // 用料数量
  510. })
  511. },
  512. // 删除用料信息
  513. removezEngineeringMaterialBo(index){
  514. this.form.zEngineeringNodeBo.zEngineeringInfoBo.zEngineeringMaterialBo.splice(index, 1)
  515. },
  516. // 根据url获取type节点类型
  517. getType() {
  518. const queryString = window.location.search;
  519. const params = new URLSearchParams(queryString);
  520. const type = params.get('type');
  521. if (type) {
  522. this.form.type = type;
  523. this.form.zEngineeringNodeBo.type = (type === '1' ? "工业工程" : "市政工程")
  524. this.EngineepipeType = (type === '1' ? [{ value: '小微商服', label: '小微商服' },{ value: '新建工业', label: '新建工业' },{ value: '改造工业', label: '改造工业' }]
  525. : [{ value: '气源', label: '气源' },{ value: '排迁', label: '排迁' }])
  526. }
  527. },
  528. // 新增顶管工程
  529. addNewPipe(data) {
  530. this.$refs.enginPipe.openDialog({
  531. id: data.id,
  532. type: this.form.zEngineeringNodeBo.type
  533. }, 'add',data)
  534. },
  535. // 历史查询
  536. viewSource(e){
  537. this.currentId = e.id
  538. this.$refs.ConstructionDetails.open(_,this.form.type)
  539. },
  540. viewNodeSource(e){
  541. // todo: 获取数据
  542. QueryEngineeIndustry({
  543. id:this.currentId
  544. }).then(res => {
  545. try {
  546. this.currentCollapses = res.data.zEngineeringNodeBoList[0].zEngineeringInfoBoList
  547. } catch (error) {
  548. this.currentCollapses = [];
  549. }
  550. })
  551. },
  552. nodeCancel() {
  553. this.nodeDetailVisible = false
  554. // 反向赋值 - 为了让附件回显
  555. this.$refs.obsFileUpload.fileList =this.form.files
  556. },
  557. // 填写施工信息
  558. toNodeDetail() {
  559. this.form.files = this.$refs.obsFileUpload.fileList;
  560. if (this.form.files.length === 0){
  561. this.$message.warning( '必须上传附件!')
  562. return
  563. }
  564. // 根据材质id查询对应规格回显
  565. this.form.zEngineeringNodeBo.zEngineeringInfoBo.zEngineeringMaterialBo.forEach(item =>{
  566. getEnginSpecificationsList(item.materialQuality).then(res => {
  567. this.specificationsList = res.data
  568. })
  569. })
  570. this.$refs["form"].validate(valid => {
  571. if (valid) {
  572. this.nodeDetailVisible = true
  573. }
  574. })
  575. },
  576. getUrl(url) {
  577. this.form.zEngineeringNodeBo.zEngineeringInfoBo.zEngiineeringPhotoBoList = this.$refs.obsImageUpload.fileList ? this.$refs.obsImageUpload.fileList.map(e => e.url) : [];
  578. },
  579. /** 查询市政工程|工业工程列表 */
  580. getList() {
  581. this.loading = true;
  582. let enginType = this.form.zEngineeringNodeBo.type;
  583. // 获取材质
  584. getEnginMaterialQualityList({ enginType }).then(res => {
  585. this.materialQualityList = res.data
  586. });
  587. getEngineeIndustryList({
  588. type: this.form.type
  589. }).then(res => {
  590. this.comprehensiveList = res.rows;
  591. this.total = res.total;
  592. this.loading = false;
  593. });
  594. },
  595. // 取消按钮
  596. cancel() {
  597. this.open = false;
  598. this.reset();
  599. },
  600. // 表单重置
  601. reset() {
  602. for (let formKey in this.form) {
  603. this.form[formKey] = null
  604. }
  605. this.form.zEngineeringNodeBo={}
  606. this.form.zEngineeringNodeBo.zEngineeringInfoBo={}
  607. this.form.zEngineeringNodeBo.zEngineeringInfoBo.zEngineeringMaterialBo=[]
  608. this.form.zEngineeringNodeBo.zEngineeringInfoBo.zEngineeringMaterialBo.push({
  609. materialQuality: '', // 用料材质
  610. specifications: '', // 用料规格
  611. number: '' // 用料数量
  612. })
  613. this.getType()
  614. },
  615. /** 搜索按钮操作 */
  616. handleQuery() {
  617. this.queryParams.pageNum = 1;
  618. this.getList();
  619. },
  620. /** 重置按钮操作 */
  621. resetQuery() {
  622. this.resetForm("queryForm");
  623. this.handleQuery();
  624. },
  625. // 多选框选中数据
  626. handleSelectionChange(selection) {
  627. this.ids = selection.map(item => item.id)
  628. this.single = selection.length !== 1
  629. this.multiple = !selection.length
  630. },
  631. /** 新增按钮操作 */
  632. handleAdd() {
  633. this.reset();
  634. this.title = (this.form.type === '1' ? "新增工业工程":"新增市政工程");
  635. this.currentType = 'add'
  636. this.open = true;
  637. },
  638. /** 修改按钮操作 */
  639. handleUpdate(row) {
  640. this.loading = true;
  641. this.reset();
  642. const id = row.id || this.ids
  643. putEngineeEngineeIndustry(id).then(response => {
  644. this.loading = false;
  645. this.form = response.data;
  646. this.form.zEngineeringNodeBo = response.data.zEngineeringNodeBoList[0]
  647. this.form.zEngineeringNodeBo.zEngineeringInfoBo = response.data.zEngineeringNodeBoList[0].zEngineeringInfoBoList[0]
  648. this.title = (this.form.type === '1' ? "修改工业工程":"修改市政工程");
  649. this.currentType = 'put'
  650. this.open = true;
  651. });
  652. },
  653. /** 提交按钮 */
  654. submitForm() {
  655. this.$refs["nodeForm"].validate(valid => {
  656. if (valid) {
  657. if (this.form.id == null) {
  658. addEngineeEngineeIndustry(this.form).then(res => {
  659. this.$modal.msgSuccess("新增成功");
  660. this.open = false;
  661. this.nodeDetailVisible = false
  662. this.getList();
  663. })
  664. } else {
  665. EditEngineeEngineeIndustry(this.form).then(res => {
  666. this.$modal.msgSuccess("修改成功");
  667. this.open = false;
  668. this.nodeDetailVisible = false
  669. this.getList();
  670. })
  671. }
  672. }
  673. });
  674. },
  675. /** 删除按钮操作 */
  676. handleDelete(row) {
  677. const ids = row.id || this.ids;
  678. this.$modal.confirm('是否确认删除所选择的数据项?').then(() => {
  679. this.loading = true;
  680. return DelEngineeEngineeIndustry(ids);
  681. }).then(() => {
  682. this.loading = false;
  683. this.getList();
  684. this.$modal.msgSuccess("删除成功");
  685. }).catch(() => {
  686. }).finally(() => {
  687. this.loading = false;
  688. });
  689. },
  690. /** 导出按钮操作 */
  691. handleExport() {
  692. this.download('zdsz/engineeringIndustry/export', {
  693. ...this.queryParams
  694. }, `comprehensive_${new Date().getTime()}.xlsx`)
  695. }
  696. }
  697. };
  698. </script>
  699. <style lang="scss" scoped>
  700. ::v-deep .appendElDialog {
  701. width: 70%;
  702. height: 80%;
  703. .el-dialog__body {
  704. height: 85%;
  705. }
  706. .el-form-item {
  707. margin-bottom: 22px;
  708. width: 44%;
  709. display: inline-block;
  710. }
  711. .el-form-item:nth-child(2n+2) {
  712. margin-left: 5%;
  713. }
  714. .el-form-item:not(:nth-child(1):nth-child(2)) {
  715. margin-top: 0.5%;
  716. }
  717. .remark_input {
  718. .el-textarea__inner {
  719. width: 238%;
  720. height: 190px;
  721. }
  722. }
  723. }
  724. ::v-deep .appendElNodeDialog {
  725. // width: 70%;
  726. height: 80%;
  727. .el-select{
  728. width:70%
  729. }
  730. .el-dialog__body {
  731. height: 85%;
  732. }
  733. .el-form-item {
  734. margin-bottom: 22px;
  735. width: 100%;
  736. display: inline-block;
  737. }
  738. .el-form-item:nth-child(2n+2) {
  739. margin-left: 5%;
  740. }
  741. .el-form-item:not(:nth-child(1):nth-child(2)) {
  742. margin-top: 0.5%;
  743. }
  744. }
  745. </style>