indexGY.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491
  1. <!--
  2. *@description: 节点信息form(新)
  3. *@author: yh Fu
  4. *@date: 2024-01-10 14:44:14
  5. *@version: V1.0.5
  6. -->
  7. <template>
  8. <div style="width: 100%; height: 100%;">
  9. <!-- 节点表单 -->
  10. <el-form ref="fangxianForm" v-if="flag=='gy_out'" :model="nodeInfo" :rules="nodeRules" label-width="200px">
  11. <h2 style="margin-left: 16%;font-weight: 800;">{{ name }}</h2>
  12. <el-form-item label="施工时间" prop="constructTime" :style=" 'margin-left: -27px' ">
  13. <el-date-picker
  14. :disabled="formType"
  15. v-model="nodeInfo.constructTime"
  16. value-format="yyyy-MM-dd hh:mm:ss"
  17. type="datetime"
  18. placeholder="请选择施工时间">
  19. </el-date-picker>
  20. </el-form-item>
  21. <br>
  22. <el-form-item label="照片" prop="zEngiineeringPhotoBoList" class="obsImage" v-if="'回填、撤场' != name">
  23. <ObsImageUpload ref="obsImageUpload" :limit="9999" :fileType="['png', 'jpg', 'jpeg']" :value="nodeInfo.zEngiineeringPhotoBoList"
  24. @input="getUrl"></ObsImageUpload>
  25. </el-form-item>
  26. <el-form-item label="回填前" prop="zEngiineeringPhotoBoListOne" class="obsImage" v-if="'回填、撤场' == name">
  27. <ObsImageUpload ref="obsImageUpload1" :limit="9999" :fileType="['png', 'jpg', 'jpeg']" :value="nodeInfo.zEngiineeringPhotoBoListOne"
  28. @input="getUrl1"></ObsImageUpload>
  29. </el-form-item>
  30. <el-form-item label="铺设警示带" prop="zEngiineeringPhotoBoListTwo" class="obsImage" v-if="'回填、撤场' == name">
  31. <ObsImageUpload ref="obsImageUpload2" :limit="9999" :fileType="['png', 'jpg', 'jpeg']" :value="nodeInfo.zEngiineeringPhotoBoListTwo"
  32. @input="getUrl2"></ObsImageUpload>
  33. </el-form-item>
  34. <el-form-item label="回填后" prop="zEngiineeringPhotoBoListThree" class="obsImage" v-if="'回填、撤场' == name">
  35. <ObsImageUpload ref="obsImageUpload3" :limit="9999" :fileType="['png', 'jpg', 'jpeg']" :value="nodeInfo.zEngiineeringPhotoBoListThree"
  36. @input="getUrl3"></ObsImageUpload>
  37. </el-form-item>
  38. <el-form-item label="文字说明" prop="remark" v-if="'隐蔽工程'== name">
  39. <el-input
  40. v-model="nodeInfo.remark"
  41. type="textarea"
  42. placeholder="请输入"
  43. maxlength="255"
  44. />
  45. </el-form-item>
  46. <div style="width: 25%;position: relative;left: 10.5%;top: -8px;" v-if="['焊接、防腐','架空管线','下管','沟下连头'].includes(name)">
  47. <el-button @click="addMaterial()">新增用料信息</el-button>
  48. </div>
  49. <el-row v-for="(item, index) in zEngineeringMaterialBo" v-if="['焊接、防腐','架空管线','下管','沟下连头'].includes(name)" :key="index" style="left: 10.5%;" :class="'rowStructure'">
  50. <el-col :span="7">
  51. <el-form-item
  52. :prop="'zEngineeringMaterialBo.' + index + '.materialQuality'"
  53. label-width="50px"
  54. label="材质"
  55. >
  56. <el-select v-model="item.materialQuality" placeholder="请选择材质" style="width: 100%" @change="getEnginSpecificationsList(item, index)" filterable @blur="selectBlur(arguments,index,'materialQuality')">
  57. <el-option
  58. v-for="e in materialQualityList"
  59. :key="e.id"
  60. :label="e.name"
  61. :value="e.id"
  62. ></el-option>
  63. </el-select>
  64. </el-form-item>
  65. </el-col>
  66. <el-col :span="7">
  67. <el-form-item
  68. :prop="'zEngineeringMaterialBo.' + index + '.specifications'"
  69. label-width="50px"
  70. label="规格"
  71. >
  72. <el-select v-model="item.specifications" placeholder="请选择规格" style="width: 100%" filterable @blur="selectBlur(arguments,index,'specifications')">
  73. <el-option
  74. v-for="e in specificationsList"
  75. :key="e.id"
  76. :label="e.name"
  77. :value="e.id"
  78. ></el-option>
  79. </el-select>
  80. </el-form-item>
  81. </el-col>
  82. <el-col :span="7">
  83. <el-form-item
  84. :prop="'zEngineeringMaterialBo.' + index + '.number'"
  85. label-width="50px"
  86. label="米数"
  87. >
  88. <div class="block" style="display: inline-block; margin-right: 20px;">
  89. <el-input v-model="item.number" placeholder="请输入米数" style="width: 100%" oninput="value=value.match(/\d+(\.\d{0,1})?/) ? value.match(/\d+(\.\d{0,1})?/)[0] : ''" :disabled="status == 'read-only'"><template slot="append">米</template></el-input>
  90. </div>
  91. </el-form-item>
  92. </el-col>
  93. <el-col :span="7">
  94. <el-form-item
  95. :prop="'zEngineeringMaterialBo.' + index + '.number'"
  96. label-width="50px"
  97. ><div class="block" style="display: inline-block; margin-right: 20px;"></div></el-form-item>
  98. </el-col>
  99. <el-button v-if="zEngineeringMaterialBo.length > 0" @click="removezEngineeringMaterialBo(index)">
  100. 删除
  101. </el-button>
  102. </el-row>
  103. <el-row v-for="(item, index) in zEngineeringMaterialBo" v-if="['阀井'].includes(name)" :key="index" style="left: 10.5%;" :class="'rowStructure'">
  104. <el-col :span="7">
  105. <el-form-item
  106. :prop="'zEngineeringMaterialBo.' + index + '.remark'"
  107. label-width="50px"
  108. label="型号"
  109. >
  110. <div class="block" style="display: inline-block; margin-right: 20px;">
  111. <el-input v-model="item.remark" placeholder="请输入型号" style="width: 100%" :disabled="status == 'read-only'"/>
  112. </div>
  113. </el-form-item>
  114. </el-col>
  115. <el-col :span="7">
  116. <el-form-item
  117. :prop="'zEngineeringMaterialBo.' + index + '.number'"
  118. label-width="50px"
  119. ><div class="block" style="display: inline-block; margin-right: 20px;"></div></el-form-item>
  120. </el-col>
  121. <el-button v-if="zEngineeringMaterialBo.length > 0" @click="removezEngineeringMaterialBo(index)">
  122. 删除
  123. </el-button>
  124. </el-row>
  125. <hr style="position: relative;left: 10%;">
  126. </el-form>
  127. <el-form ref="fangxianForm" v-if="flag=='gy_inner'" :model="nodeInfo" :rules="nodeRules" label-width="200px">
  128. <h2 style="margin-left: 16%;font-weight: 800;">{{ name }}</h2>
  129. <el-form-item label="施工时间" prop="constructTime" :style=" 'margin-left: -27px' ">
  130. <el-date-picker
  131. :disabled="formType"
  132. v-model="nodeInfo.constructTime"
  133. value-format="yyyy-MM-dd hh:mm:ss"
  134. type="datetime"
  135. placeholder="请选择施工时间">
  136. </el-date-picker>
  137. </el-form-item>
  138. <el-form-item label="照片" prop="zEngiineeringPhotoBoList" class="obsImage">
  139. <ObsImageUpload ref="obsImageUpload" :limit="9999" :fileType="['png', 'jpg', 'jpeg']" :value="nodeInfo.zEngiineeringPhotoBoList"
  140. @input="getUrl"></ObsImageUpload>
  141. </el-form-item>
  142. <div style="width: 25%;position: relative;left: 20.5%;top: -8px;" v-if="['焊接'].includes(name)">
  143. <el-button @click="addMaterial()">新增用料信息</el-button>
  144. </div>
  145. <el-row v-for="(item, index) in zEngineeringMaterialBo" v-if="['焊接'].includes(name)" :key="index" style="left: 13.5%;" :class="'rowStructure'">
  146. <el-col :span="7">
  147. <el-form-item
  148. :prop="'zEngineeringMaterialBo.' + index + '.materialQuality'"
  149. label-width="50px"
  150. label="材质"
  151. >
  152. <el-select v-model="item.materialQuality" placeholder="请选择材质" style="width: 100%" @change="getEnginSpecificationsList(item, index)" filterable @blur="selectBlur(arguments,index,'materialQuality')">
  153. <el-option
  154. v-for="e in materialQualityList"
  155. :key="e.id"
  156. :label="e.name"
  157. :value="e.id"
  158. ></el-option>
  159. </el-select>
  160. </el-form-item>
  161. </el-col>
  162. <el-col :span="7">
  163. <el-form-item
  164. :prop="'zEngineeringMaterialBo.' + index + '.specifications'"
  165. label-width="50px"
  166. label="规格"
  167. >
  168. <el-select v-model="item.specifications" placeholder="请选择规格" style="width: 100%" filterable @blur="selectBlur(arguments,index,'specifications')">
  169. <el-option
  170. v-for="e in specificationsList"
  171. :key="e.id"
  172. :label="e.name"
  173. :value="e.id"
  174. ></el-option>
  175. </el-select>
  176. </el-form-item>
  177. </el-col>
  178. <el-col :span="7">
  179. <el-form-item
  180. :prop="'zEngineeringMaterialBo.' + index + '.number'"
  181. label-width="50px"
  182. label="米数"
  183. >
  184. <div class="block" style="display: inline-block; margin-right: 20px;">
  185. <el-input v-model="item.number" placeholder="请输入米数" style="width: 100%" oninput="value=value.match(/\d+(\.\d{0,1})?/) ? value.match(/\d+(\.\d{0,1})?/)[0] : ''" :disabled="status == 'read-only'"><template slot="append">米</template></el-input>
  186. </div>
  187. </el-form-item>
  188. </el-col>
  189. <el-col :span="7">
  190. <el-form-item
  191. :prop="'zEngineeringMaterialBo.' + index + '.number'"
  192. label-width="50px"
  193. ><div class="block" style="display: inline-block; margin-right: 20px;"></div></el-form-item>
  194. </el-col>
  195. <el-button v-if="zEngineeringMaterialBo.length > 0" @click="removezEngineeringMaterialBo(index)">
  196. 删除
  197. </el-button>
  198. </el-row>
  199. <hr style="position: relative;left: 10%;">
  200. </el-form>
  201. <el-form ref="fangxianForm" v-if="flag=='gy_tyg'" :model="nodeInfo" :rules="nodeRules" label-width="200px">
  202. <h2 style="margin-left: 16%;font-weight: 800;">{{ name }}</h2>
  203. <el-form-item label="施工时间" prop="constructTime" :style=" 'margin-left: -27px' ">
  204. <el-date-picker
  205. :disabled="formType"
  206. v-model="nodeInfo.constructTime"
  207. value-format="yyyy-MM-dd hh:mm:ss"
  208. type="datetime"
  209. placeholder="请选择施工时间">
  210. </el-date-picker>
  211. </el-form-item>
  212. <el-form-item
  213. :prop="nodeInfo.remark"
  214. :class="'labelWidth'"
  215. label="施工内容"
  216. label-width="95px"
  217. >
  218. <div class="block" style="display: inline-block; margin-right: 20px;">
  219. <el-input v-model="nodeInfo.remark" placeholder="请输入施工内容" style="width: 100%" maxlength="100"
  220. type="textarea" ></el-input>
  221. </div>
  222. </el-form-item>
  223. <el-form-item label="照片" prop="zEngiineeringPhotoBoList" class="obsImage">
  224. <ObsImageUpload ref="obsImageUpload" :limit="9999" :fileType="['png', 'jpg', 'jpeg']" :value="nodeInfo.zEngiineeringPhotoBoList"
  225. @input="getUrl"></ObsImageUpload>
  226. </el-form-item>
  227. <hr style="position: relative;left: 10%;">
  228. </el-form>
  229. </div>
  230. </template>
  231. <script>
  232. import {
  233. getEnginMaterialQualityList, // 材质
  234. getEnginSpecificationsList, // 规格
  235. getDictType, // 腐蚀程度
  236. } from '@/api/zdsz/enginee'
  237. import ObsVideoUpload from "@/components/ObsVideoUpload/index.vue";
  238. export default {
  239. name:'EnginNodeInfoGY',
  240. props:['types','enginType','enginSort','enginNode','name','currentContain','updateOption','status','flag'],
  241. components:{ObsVideoUpload},
  242. data(){
  243. return {
  244. constructAccordingDrawingsOption:[
  245. {
  246. value:'Y',
  247. label:'是'
  248. },
  249. {
  250. value:'N',
  251. label:'否'
  252. }
  253. ],
  254. segmentedCompressionQualifiedOption:[
  255. {
  256. value:'1',
  257. label:'合格'
  258. },
  259. {
  260. value:'0',
  261. label:'不合格'
  262. }
  263. ],
  264. materialQualityList_zbf:[], // 自闭阀option
  265. materialQualityList_zjg:[], // 灶具管option
  266. materialQualityList:[], // 材质
  267. specificationsList:[], // 规格
  268. materialComponList:[],
  269. nodeInfo:{
  270. backfillTime:'', // 回填时间
  271. constructTime:'',
  272. constructAccordingDrawings:'',
  273. segmentedCompressionQualified:'',
  274. zEngiineeringPhotoBoList:[], // 照片集合
  275. zEngiineeringPhotoBoListOne:[], // 照片集合
  276. zEngiineeringPhotoBoListTwo:[], // 照片集合
  277. zEngiineeringPhotoBoListThree:[], // 照片集合
  278. zEngineeringMaterialBo:[], // 用料集合
  279. remark:'',
  280. constructAddre:''
  281. },
  282. nodeInfoBo:{
  283. zEngineeringInfoBo:{
  284. }
  285. }, // 节点信息
  286. zEngineeringMaterialBo:[
  287. ], // 用料信息
  288. nodeRules:{
  289. zEngiineeringPhotoBoList: [
  290. {required: true, message: "至少上传一张图片", trigger: "change"}
  291. ],
  292. constructTime: [
  293. {required: true, message: "请选择施工时间", trigger: "change"}
  294. ]
  295. }
  296. }
  297. },
  298. created(){
  299. // 获取材质
  300. let enginType = '工业工程'
  301. getEnginMaterialQualityList({enginType:enginType}).then(res => {
  302. this.materialQualityList = res.data
  303. })
  304. },
  305. mounted(){
  306. console.log('当前节点name',this.name)
  307. console.log('update',this.updateOption)
  308. console.log('当前节点currentContain',this.types)
  309. this.materialComponList = this.currentContain.find(e => {
  310. if( e instanceof Array){
  311. return e
  312. }
  313. })
  314. if(this.status == '修改'){
  315. this.currentContain.find(e => {
  316. console.log(this.updateOption)
  317. if( e instanceof Array){
  318. this.zEngineeringMaterialBo = this.updateOption.zEngineeringInfoBoList[0].zEngineeringMaterialBo
  319. }
  320. this.nodeInfo[e] = this.updateOption[e]
  321. })
  322. this.nodeInfo.zEngiineeringPhotoBoList = this.updateOption.zEngineeringInfoBoList[0].zEngiineeringPhotoBoList
  323. this.nodeInfo.zEngiineeringPhotoBoListOne = this.updateOption.zEngineeringInfoBoList[0].zEngiineeringPhotoBoListOne
  324. this.nodeInfo.zEngiineeringPhotoBoListTwo = this.updateOption.zEngineeringInfoBoList[0].zEngiineeringPhotoBoListTwo
  325. }
  326. setTimeout(() => {
  327. // 至少存在一条物料
  328. this.addMaterial()
  329. },1500)
  330. console.log('用料组件',this.materialComponList)
  331. console.log('用料信息',this.zEngineeringMaterialBo)
  332. console.log('节点信息',this.nodeInfo)
  333. // 添加用料对象
  334. // this.addMaterial()
  335. },
  336. methods:{
  337. selectBlur(_,index,name) {
  338. this.zEngineeringMaterialBo[index][name] = [...arguments][0][0].target.value
  339. },
  340. // 收集节点信息
  341. infoCollection(){
  342. let result = null
  343. console.log(this.$refs.fangxianForm)
  344. this.$refs.fangxianForm.validate(valid => {
  345. if(valid){
  346. // 收集主节点信息
  347. this.currentContain.forEach(e => {
  348. if( e instanceof Array){
  349. // 包含用料 特殊处理
  350. return
  351. }
  352. this.nodeInfoBo[e] = this.nodeInfo[e]
  353. })
  354. this.nodeInfoBo.type = this.name
  355. if (this.name!='回填、撤场'){
  356. this.nodeInfoBo.zEngineeringInfoBo.zEngiineeringPhotoBoList = []
  357. this.nodeInfoBo.zEngineeringInfoBo.zEngiineeringPhotoBoList = this.nodeInfo.zEngiineeringPhotoBoList
  358. }
  359. if (this.name=='回填、撤场'){
  360. this.nodeInfoBo.zEngineeringInfoBo.zEngiineeringPhotoBoListOne = []
  361. this.nodeInfoBo.zEngineeringInfoBo.zEngiineeringPhotoBoListTwo = []
  362. this.nodeInfoBo.zEngineeringInfoBo.zEngiineeringPhotoBoListThree = []
  363. this.nodeInfoBo.zEngineeringInfoBo.zEngiineeringPhotoBoListOne = this.nodeInfo.zEngiineeringPhotoBoListOne
  364. this.nodeInfoBo.zEngineeringInfoBo.zEngiineeringPhotoBoListTwo = this.nodeInfo.zEngiineeringPhotoBoListTwo
  365. this.nodeInfoBo.zEngineeringInfoBo.zEngiineeringPhotoBoListThree = this.nodeInfo.zEngiineeringPhotoBoListThree
  366. } this.nodeInfoBo.zEngineeringInfoBo.zEngineeringMaterialBo = this.zEngineeringMaterialBo
  367. this.nodeInfoBo.zEngineeringInfoBo.constructAddre=this.nodeInfo.constructAddre
  368. this.nodeInfoBo.zEngineeringInfoBo.constructTime=this.nodeInfo.constructTime
  369. this.nodeInfoBo.zEngineeringInfoBo.remark=this.nodeInfo.remark
  370. // delete this.nodeInfo.zEngiineeringPhotoBoList
  371. console.log('即将返回的节点Info',this.nodeInfoBo)
  372. result = this.nodeInfoBo
  373. } else {
  374. this.$message({
  375. message: '请完善信息',
  376. type: 'error'
  377. });
  378. throw 'valid Failed'
  379. }
  380. })
  381. return result
  382. },
  383. addMaterial(){
  384. let materialBo = {}
  385. // this.materialComponList.forEach(e => {
  386. // materialBo[e] = null
  387. // })
  388. this.zEngineeringMaterialBo.push(materialBo)
  389. this.nodeInfo.zEngineeringMaterialBo.push(materialBo)
  390. // console.log('节点用料参数对象',this.zEngineeringMaterialBo)
  391. },
  392. addzEngineeringMaterialBo(option,params){
  393. let material = {}
  394. params.forEach(e => {
  395. material[e] = ""
  396. })
  397. this[option].zEngineeringMaterialBo.push(
  398. material
  399. )
  400. },
  401. removezEngineeringMaterialBo(index){
  402. this.zEngineeringMaterialBo.splice(index, 1);
  403. },
  404. // 填充已有数据
  405. updateInfo(e){
  406. console.log('填充',e)
  407. },
  408. getUrl(url) {
  409. this.nodeInfo.zEngiineeringPhotoBoList = this.$refs.obsImageUpload.fileList ? this.$refs.obsImageUpload.fileList.map(e=>e.url):[];
  410. },
  411. getUrl1(url) {
  412. this.nodeInfo.zEngiineeringPhotoBoListOne = this.$refs.obsImageUpload1.fileList ? this.$refs.obsImageUpload1.fileList.map(e=>e.url):[];
  413. },
  414. getUrl2(url) {
  415. this.nodeInfo.zEngiineeringPhotoBoListTwo = this.$refs.obsImageUpload2.fileList ? this.$refs.obsImageUpload2.fileList.map(e=>e.url):[];
  416. },
  417. getUrl3(url) {
  418. this.nodeInfo.zEngiineeringPhotoBoListThree = this.$refs.obsImageUpload3.fileList ? this.$refs.obsImageUpload3.fileList.map(e=>e.url):[];
  419. },
  420. // 获取材质规格
  421. getEnginSpecificationsList(e,idx){
  422. this.zEngineeringMaterialBo[idx].specifications = null;
  423. getEnginSpecificationsList({materId:e.materialQuality}).then(res => {
  424. this.specificationsList = res.data
  425. })
  426. },
  427. }
  428. }
  429. </script>
  430. <style lang="scss" scoped>
  431. ::v-deep .material_desc{
  432. .el-form-item__content{
  433. margin-left: 50px !important;
  434. }
  435. }
  436. ::v-deep .el-form{
  437. position: relative;
  438. left: -10%;
  439. .el-form-item{
  440. display: inline-block;
  441. }
  442. .obsImage{
  443. width: 100%;
  444. display: block;
  445. margin-left: 8%;
  446. .el-form-item__label{
  447. width: 113px !important;
  448. }
  449. .el-form-item__error{
  450. position: relative;
  451. left: -10%;
  452. }
  453. }
  454. .obsActiveImage{
  455. .el-form{
  456. left:-14% !important
  457. }
  458. .el-form-item__label{
  459. width: 97px !important;
  460. }
  461. }
  462. .obsActiveImageStructure{
  463. .el-form-item__label{
  464. width:161px !important;
  465. }
  466. }
  467. .rowStructure{
  468. padding-left: 3.6%;
  469. .el-col .el-form-item{
  470. width:73%
  471. }
  472. }
  473. }
  474. </style>