index.vue 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741
  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. <!-- 在此处添加默认的行内容 -->
  214. <template v-if="index === null">
  215. <div>默认的行内容</div>
  216. </template>
  217. <!-- 循环输出的行内容 -->
  218. <template v-else>
  219. <div>{{ item }}</div>
  220. </template>
  221. <el-col :span="7">
  222. <el-form-item
  223. :prop="'zEngineeringMaterialBo.' + index + '.materialQuality'"
  224. label-width="50px"
  225. label="材质"
  226. >
  227. <!-- :rules="{required: true, message: '请输入材质', trigger: 'blur'}"-->
  228. <!-- <el-input v-model="item.materialQuality" placeholder="请输入材质" style="width: 100%"/>-->
  229. <el-select v-model="item.materialQuality" placeholder="请选择材质" style="width: 100%" @change="getEnginSpecificationsList(item, index)">
  230. <el-option
  231. v-for="e in materialQualityList"
  232. :key="e.id"
  233. :label="e.name"
  234. :value="e.id"
  235. ></el-option>
  236. </el-select>
  237. </el-form-item>
  238. </el-col>
  239. <el-col :span="7">
  240. <el-form-item
  241. :prop="'zEngineeringMaterialBo.' + index + '.specifications'"
  242. label-width="50px"
  243. label="规格"
  244. >
  245. <!-- :rules="{required: true, message: '请输入规格', trigger: 'blur'}"-->
  246. <!-- <el-input v-model="item.specifications" placeholder="请输入规格" style="width: 100%"/>-->
  247. <el-select v-model="item.specifications" placeholder="请选择规格" style="width: 100%">
  248. <el-option
  249. v-for="e in specificationsList"
  250. :key="e.id"
  251. :label="e.name"
  252. :value="e.id"
  253. ></el-option>
  254. </el-select>
  255. </el-form-item>
  256. </el-col>
  257. <el-col :span="7">
  258. <el-form-item
  259. :prop="'zEngineeringMaterialBo.' + index + '.number'"
  260. label-width="50px"
  261. label="数量"
  262. >
  263. <!-- :rules="[{required: true, message: '请输入数量', trigger: 'change'},{validator: [checkPositiveInteger], trigger: 'blur'}]"-->
  264. <div class="block" style="display: inline-block; margin-right: 20px;">
  265. <el-input v-model="item.number" placeholder="请输入数量" style="width: 100%" maxlength="8"/>
  266. </div>
  267. </el-form-item>
  268. </el-col>
  269. <el-col :span="3">
  270. <el-form-item style="margin-left: -120px;">
  271. <el-button v-if="form.zEngineeringNodeBo.zEngineeringInfoBo.zEngineeringMaterialBo.length > 1" @click="removezEngineeringMaterialBo(index)">
  272. 删除
  273. </el-button>
  274. </el-form-item>
  275. </el-col>
  276. </el-row>
  277. <div style="width: 25%; float: right">
  278. <el-button @click="addzEngineeringMaterialBo">新增用料信息</el-button>
  279. <el-button :loading="buttonLoading" type="primary" @click="submitForm">提交</el-button>
  280. <el-button @click="nodeCancel">取 消</el-button>
  281. </div>
  282. </el-form>
  283. </el-dialog>
  284. <ConstructionDetails
  285. ref="ConstructionDetails"
  286. :currentCollapses="currentCollapses"
  287. />
  288. </div>
  289. </template>
  290. <script>
  291. import {
  292. addEngineeEngineeIndustry,
  293. DelEngineeEngineeIndustry,
  294. EditEngineeEngineeIndustry,
  295. getEngineeIndustryList,
  296. putEngineeEngineeIndustry,
  297. QueryEngineeIndustry
  298. } from '@/api/zdsz/engineeringIndustry'
  299. import EngineePipe from '@/components/EngineePipe'
  300. import { checkPositiveInteger, validPhoneMobile } from '@/api/rules'
  301. import ConstructionDetails from '@/components/ConstructionDetails/index.vue'
  302. import { getEnginMaterialQualityList } from '@/api/zdsz/enginee'
  303. import { getEnginSpecificationsList } from '@/api/zdsz/enginSpecifications'
  304. export default {
  305. name: "openrepair",
  306. dicts: ['pass_check', 'is_repair', 'industry_engin_type', 'self_closing_valve_type', 'visit_type', 'engin_classification','engineering_infrastructure'],
  307. components: {
  308. ConstructionDetails,
  309. EngineePipe
  310. },
  311. data() {
  312. // 自定义校验
  313. const validatePicPass = (rule, value, callback) => {
  314. return new Promise((resolve, reject) => {
  315. // 至少有一个图片、一个用料信息、一个创建时间
  316. if (this.form.zEngineeringNodeBo.zEngineeringInfoBo.zEngiineeringPhotoBoList.length !== 0
  317. && (this.form.zEngineeringNodeBo.zEngineeringInfoBo.constructTime !== null || undefined)
  318. && this.form.zEngineeringNodeBo.zEngineeringInfoBo.zEngineeringMaterialBo.length !== 0) {
  319. resolve(true)
  320. } else {
  321. reject(new Error('no pass'))
  322. }
  323. })
  324. }
  325. return {
  326. // 按钮loading
  327. buttonLoading: false,
  328. // 遮罩层
  329. loading: true,
  330. // 选中数组
  331. ids: [],
  332. // 非单个禁用
  333. single: true,
  334. // 非多个禁用
  335. multiple: true,
  336. // 显示搜索条件
  337. showSearch: true,
  338. // 工程分类显示
  339. engineeType: true,
  340. // 总条数
  341. total: 0,
  342. currentNode:[],
  343. currentCollapses:[],
  344. // 市政工程|工业工程表格数据
  345. comprehensiveList: [],
  346. // 弹出层标题
  347. title: "",
  348. nodeList:[],
  349. // 是否显示弹出层
  350. open: false,
  351. // 查询参数
  352. queryParams: {
  353. enginName: '', // 工程名称
  354. enginClassification: '', // 工程分类
  355. zEngineeringNodeBo: {
  356. type: '',
  357. zEngineeringInfoBo: {}, //施工信息
  358. }
  359. },
  360. nodeDetailVisible: false, // 施工信息dialog
  361. // 表单参数
  362. form: {
  363. files:[], // 附件
  364. pics:[], // 附件返回
  365. type:'', // 用来区分工业工程、市政工程
  366. enginName:'', // 工程名称
  367. enginType:'', // 工程类型
  368. constructUnit:'', // 建筑单位
  369. projectHead:'', // 项目负责人
  370. sceneHead:'', // 现场负责人
  371. designUnit:'', // 设计单位
  372. designHead:'', // 设计负责人
  373. designPhone:'', // 设计联系电话
  374. supervisionUnit:'', // 监理单位
  375. supervisionHead:'', // 监理负责人
  376. supervisionPhone:'', // 监理联系电话
  377. enginClassification:'', // 工程分类
  378. zEngineeringNodeBo:{ // 工程节点
  379. type:'', // 节点类型
  380. zEngineeringInfoBo: { // 施工信息
  381. constructUser: '', // 施工人
  382. constructTime: '', // 施工时间
  383. zEngiineeringPhotoBoList: [], // 图片列表
  384. zEngineeringMaterialBo: [ // 用料对象
  385. {
  386. materialQuality: '', // 用料材质
  387. specifications: '', // 用料规格
  388. number: '' // 用料数量
  389. },
  390. ],
  391. },
  392. },
  393. },
  394. EngineepipeType: [], // 工程类型
  395. materialQualityList: [], // 用料材质List
  396. specificationsList: [], // 用料规格List
  397. // 表单校验
  398. rules: {
  399. sceneHead: [
  400. {required: true, message: "现场负责人不能为空", trigger: 'blur'}
  401. ],
  402. enginName: [
  403. {required: true, message: "工程名称不能为空", trigger: 'blur'}
  404. ],
  405. enginClassification: [
  406. {required: true, message: "工程分类不能为空", trigger: 'blur'}
  407. ],
  408. supervisionUnit: [
  409. {required: true, message: "监理单位不能为空", trigger: 'blur'}
  410. ],
  411. enginType: [
  412. {required: true, message: "工程类型不能为空", trigger: 'blur'}
  413. ],
  414. supervisionPhone: [
  415. {required: true, message: "监理联系电话不能为空", trigger: 'blur'},
  416. {validator: validPhoneMobile, trigger: 'blur'}
  417. ],
  418. constructUnit: [
  419. {required: true, message: "建筑单位不能为空", trigger: 'blur'}
  420. ],
  421. projectHead: [
  422. {required: true, message: "项目负责人不能为空", trigger: 'blur'}
  423. ],
  424. designHead: [
  425. {required: true, message: "设计负责人不能为空", trigger: 'blur'}
  426. ],
  427. designUnit: [
  428. {required: true, message: "设计单位不能为空", trigger: 'blur'}
  429. ],
  430. designPhone: [
  431. {required: true, message: "联系方式不能为空", trigger: 'blur'},
  432. {validator: validPhoneMobile, trigger: 'blur'}
  433. ],
  434. supervisionHead: [
  435. {required: true, message: "监理负责人不能为空", trigger: 'blur'}
  436. ],
  437. type: [
  438. {required: false, message: "类型不能为空", trigger: "blur"}
  439. ],
  440. files: [
  441. {required: false, message: "附件不能为空", trigger: "blur"}
  442. ],
  443. },
  444. // 节点规则校验
  445. nodeRules: {
  446. constructTime: [
  447. {required: true, message: "施工时间不能为空", trigger: 'change', validator: validatePicPass}
  448. ],
  449. zEngiineeringPhotoBoList: [
  450. {required: true, message: "图片不能为空", trigger: 'change', validator: validatePicPass}
  451. ],
  452. zEngineeringMaterialBo:[
  453. {required: true, message: "不能为空", trigger: 'change', validator: validatePicPass}
  454. ]
  455. },
  456. currentType: null, // 附件组件类型 put修改 add新增
  457. };
  458. },
  459. created() {
  460. // 根据url获取type节点类型
  461. this.getType();
  462. if (this.form.type === '2') {
  463. this.engineeType = false
  464. }
  465. this.getList();
  466. },
  467. mounted() {
  468. // 手动渲染
  469. setInterval(() =>{
  470. this.$forceUpdate()
  471. },500)
  472. },
  473. methods: {
  474. // 验证正整数(不包含0的正整数)
  475. checkPositiveInteger,
  476. getEnginSpecificationsList(item, index){
  477. let materialId = item.materialQuality
  478. this.form.zEngineeringNodeBo.zEngineeringInfoBo.zEngineeringMaterialBo[index].specifications = null
  479. // 根据材质ID获取材质规格
  480. getEnginSpecificationsList({ materialId }).then(res => {
  481. this.specificationsList = res.data
  482. })
  483. },
  484. addzEngineeringMaterialBo(){
  485. this.form.zEngineeringNodeBo.zEngineeringInfoBo.zEngineeringMaterialBo.push({
  486. materialQuality: '', // 用料材质
  487. specifications: '', // 用料规格
  488. number: '' // 用料数量
  489. })
  490. },
  491. removezEngineeringMaterialBo(index){
  492. this.form.zEngineeringNodeBo.zEngineeringInfoBo.zEngineeringMaterialBo.splice(index, 1)
  493. },
  494. // 根据url获取type节点类型
  495. getType() {
  496. const queryString = window.location.search;
  497. const params = new URLSearchParams(queryString);
  498. const type = params.get('type');
  499. if (type) {
  500. this.form.type = type;
  501. this.form.zEngineeringNodeBo.type = (type === '1' ? "工业工程" : "市政工程")
  502. this.EngineepipeType = (type === '1' ? [{ value: '小微商服', label: '小微商服' },{ value: '新建工业', label: '新建工业' },{ value: '改造工业', label: '改造工业' }]
  503. : [{ value: '气源', label: '气源' },{ value: '排迁', label: '排迁' }])
  504. }
  505. },
  506. // 新增顶管工程
  507. addNewPipe(data) {
  508. this.$refs.enginPipe.openDialog({
  509. id: data.id,
  510. type: this.form.zEngineeringNodeBo.type
  511. }, 'add')
  512. },
  513. // 历史查询
  514. viewSource(e){
  515. this.currentId = e.id
  516. this.$refs.ConstructionDetails.open(_,this.form.type)
  517. },
  518. viewNodeSource(e){
  519. // todo: 获取数据
  520. QueryEngineeIndustry({
  521. id:this.currentId
  522. }).then(res => {
  523. try {
  524. this.currentCollapses = res.data.zEngineeringNodeBoList[0].zEngineeringInfoBoList
  525. console.log('当前历史数据',this.currentCollapses)
  526. } catch (error) {
  527. this.currentCollapses = [];
  528. }
  529. console.log(this.currentCollapses)
  530. })
  531. },
  532. nodeCancel() {
  533. this.nodeDetailVisible = false
  534. },
  535. toNodeDetail() {
  536. this.$refs["form"].validate(valid => {
  537. if (valid) {
  538. this.form.files = this.$refs.obsFileUpload.fileList
  539. this.nodeDetailVisible = true
  540. }
  541. })
  542. },
  543. getUrl(url) {
  544. this.form.zEngineeringNodeBo.zEngineeringInfoBo.zEngiineeringPhotoBoList = this.$refs.obsImageUpload.fileList ? this.$refs.obsImageUpload.fileList.map(e => e.url) : [];
  545. },
  546. /** 查询市政工程|工业工程列表 */
  547. getList() {
  548. this.loading = true;
  549. let enginType = this.form.zEngineeringNodeBo.type;
  550. // 获取材质
  551. getEnginMaterialQualityList({ enginType }).then(res => {
  552. this.materialQualityList = res.data
  553. });
  554. getEngineeIndustryList({
  555. type: this.form.type
  556. }).then(res => {
  557. this.comprehensiveList = res.rows;
  558. this.total = res.total;
  559. this.loading = false;
  560. });
  561. },
  562. // 取消按钮
  563. cancel() {
  564. this.open = false;
  565. this.reset();
  566. },
  567. // 表单重置
  568. reset() {
  569. for (let formKey in this.form) {
  570. this.form[formKey] = null
  571. }
  572. this.form.zEngineeringNodeBo={}
  573. this.form.zEngineeringNodeBo.zEngineeringInfoBo={}
  574. this.form.zEngineeringNodeBo.zEngineeringInfoBo.zEngineeringMaterialBo=[]
  575. this.form.zEngineeringNodeBo.zEngineeringInfoBo.zEngineeringMaterialBo.push({
  576. materialQuality: '', // 用料材质
  577. specifications: '', // 用料规格
  578. number: '' // 用料数量
  579. })
  580. this.getType()
  581. },
  582. /** 搜索按钮操作 */
  583. handleQuery() {
  584. this.queryParams.pageNum = 1;
  585. this.getList();
  586. },
  587. /** 重置按钮操作 */
  588. resetQuery() {
  589. this.resetForm("queryForm");
  590. this.handleQuery();
  591. },
  592. // 多选框选中数据
  593. handleSelectionChange(selection) {
  594. this.ids = selection.map(item => item.id)
  595. this.single = selection.length !== 1
  596. this.multiple = !selection.length
  597. },
  598. /** 新增按钮操作 */
  599. handleAdd() {
  600. this.reset();
  601. this.title = (this.form.type === '1' ? "新增工业工程":"新增市政工程");
  602. this.currentType = 'add'
  603. this.open = true;
  604. },
  605. /** 修改按钮操作 */
  606. handleUpdate(row) {
  607. this.loading = true;
  608. this.reset();
  609. const id = row.id || this.ids
  610. putEngineeEngineeIndustry(id).then(response => {
  611. this.loading = false;
  612. this.form = response.data;
  613. this.form.zEngineeringNodeBo = response.data.zEngineeringNodeBoList[0]
  614. this.form.zEngineeringNodeBo.zEngineeringInfoBo = response.data.zEngineeringNodeBoList[0].zEngineeringInfoBoList[0]
  615. this.title = (this.form.type === '1' ? "修改工业工程":"修改市政工程");
  616. this.currentType = 'put'
  617. this.open = true;
  618. });
  619. },
  620. /** 提交按钮 */
  621. submitForm() {
  622. this.$refs["nodeForm"].validate(valid => {
  623. if (valid) {
  624. if (this.form.id == null) {
  625. console.log(this.form)
  626. // this.form.zEngineeringNodeBo = this.zEngineeringInfoBo
  627. // this.form.zEngineeringNodeBo.zEngineeringInfoBo = {}
  628. // this.form.zEngineeringNodeBo.zEngineeringInfoBo.zEngiineeringPhotoBoList = this.form.zEngineeringNodeBo.zEngiineeringPhotoBoList
  629. // this.form.zEngineeringNodeBo.zEngineeringInfoBo.zEngineeringMaterialBo = this.form.zEngineeringNodeBo.zEngineeringMaterialBo
  630. addEngineeEngineeIndustry(this.form).then(res => {
  631. this.$modal.msgSuccess("新增成功");
  632. this.open = false;
  633. this.nodeDetailVisible = false
  634. this.getList();
  635. })
  636. } else {
  637. // this.form.zEngineeringNodeBo = this.zEngineeringInfoBo
  638. // this.form.zEngineeringNodeBo.zEngineeringInfoBo = {}
  639. // this.form.zEngineeringNodeBo.zEngineeringInfoBo.zEngiineeringPhotoBoList = this.form.zEngineeringNodeBo.zEngiineeringPhotoBoList
  640. // this.form.zEngineeringNodeBo.zEngineeringInfoBo.zEngineeringMaterialBo = this.form.zEngineeringNodeBo.zEngineeringMaterialBo
  641. EditEngineeEngineeIndustry(this.form).then(res => {
  642. this.$modal.msgSuccess("修改成功");
  643. this.open = false;
  644. this.nodeDetailVisible = false
  645. this.getList();
  646. })
  647. }
  648. }
  649. });
  650. },
  651. /** 删除按钮操作 */
  652. handleDelete(row) {
  653. const ids = row.id || this.ids;
  654. this.$modal.confirm('是否确认删除所选择的数据项?').then(() => {
  655. this.loading = true;
  656. return DelEngineeEngineeIndustry(ids);
  657. }).then(() => {
  658. this.loading = false;
  659. this.getList();
  660. this.$modal.msgSuccess("删除成功");
  661. }).catch(() => {
  662. }).finally(() => {
  663. this.loading = false;
  664. });
  665. },
  666. /** 导出按钮操作 */
  667. handleExport() {
  668. this.download('zdsz/engineeringIndustry/export', {
  669. ...this.queryParams
  670. }, `comprehensive_${new Date().getTime()}.xlsx`)
  671. }
  672. }
  673. };
  674. </script>
  675. <style lang="scss" scoped>
  676. ::v-deep .appendElDialog {
  677. width: 70%;
  678. height: 80%;
  679. .el-dialog__body {
  680. height: 85%;
  681. }
  682. .el-form-item {
  683. margin-bottom: 22px;
  684. width: 44%;
  685. display: inline-block;
  686. }
  687. .el-form-item:nth-child(2n+2) {
  688. margin-left: 5%;
  689. }
  690. .el-form-item:not(:nth-child(1):nth-child(2)) {
  691. margin-top: 0.5%;
  692. }
  693. .remark_input {
  694. .el-textarea__inner {
  695. width: 238%;
  696. height: 190px;
  697. }
  698. }
  699. }
  700. ::v-deep .appendElNodeDialog {
  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. }
  718. </style>