indexSZ.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398
  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" :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. <el-form-item label="照片" prop="zEngiineeringPhotoBoList" class="obsImage" v-if="'回填、撤场' != name">
  22. <ObsImageUpload ref="obsImageUpload" :limit="9999" :fileType="['png', 'jpg', 'jpeg']" :value="nodeInfo.zEngiineeringPhotoBoList"
  23. @input="getUrl"></ObsImageUpload>
  24. </el-form-item>
  25. <el-form-item label="回填前" prop="zEngiineeringPhotoBoListOne" class="obsImage" v-if="'回填、撤场' == name">
  26. <ObsImageUpload ref="obsImageUpload1" :limit="9999" :fileType="['png', 'jpg', 'jpeg']" :value="nodeInfo.zEngiineeringPhotoBoListOne"
  27. @input="getUrl1"></ObsImageUpload>
  28. </el-form-item>
  29. <el-form-item label="铺设警示带" prop="zEngiineeringPhotoBoListTwo" class="obsImage" v-if="'回填、撤场' == name">
  30. <ObsImageUpload ref="obsImageUpload2" :limit="9999" :fileType="['png', 'jpg', 'jpeg']" :value="nodeInfo.zEngiineeringPhotoBoListTwo"
  31. @input="getUrl2"></ObsImageUpload>
  32. </el-form-item>
  33. <el-form-item label="回填后" prop="zEngiineeringPhotoBoListThree" class="obsImage" v-if="'回填、撤场' == name">
  34. <ObsImageUpload ref="obsImageUpload3" :limit="9999" :fileType="['png', 'jpg', 'jpeg']" :value="nodeInfo.zEngiineeringPhotoBoListThree"
  35. @input="getUrl3"></ObsImageUpload>
  36. </el-form-item>
  37. <el-form-item label="施工内容" prop="remark">
  38. <el-input
  39. v-model="nodeInfo.remark"
  40. type="textarea"
  41. placeholder="请输入施工内容"
  42. maxlength="255"
  43. />
  44. </el-form-item>
  45. <div style="width: 25%;position: relative;left: 20.5%;top: -8px;" v-if="['焊接、防腐','架空管线','下管','沟下连头'].includes(name)">
  46. <el-button @click="addMaterial()">新增用料信息</el-button>
  47. </div>
  48. <el-row v-for="(item, index) in zEngineeringMaterialBo" v-if="['焊接、防腐','架空管线','下管','沟下连头'].includes(name)" :key="index" style="left: 13.5%;" :class="'rowStructure'">
  49. <el-col :span="7">
  50. <el-form-item
  51. :prop="'zEngineeringMaterialBo.' + index + '.materialQuality'"
  52. label-width="50px"
  53. label="材质"
  54. >
  55. <el-select v-model="item.materialQuality" placeholder="请选择材质" style="width: 100%" @change="getEnginSpecificationsList(item, index)" filterable @blur="selectBlur(arguments,index,'materialQuality')">
  56. <el-option
  57. v-for="e in materialQualityList"
  58. :key="e.id"
  59. :label="e.name"
  60. :value="e.id"
  61. ></el-option>
  62. </el-select>
  63. </el-form-item>
  64. </el-col>
  65. <el-col :span="7">
  66. <el-form-item
  67. :prop="'zEngineeringMaterialBo.' + index + '.specifications'"
  68. label-width="50px"
  69. label="规格"
  70. >
  71. <el-select v-model="item.specifications" placeholder="请选择规格" style="width: 100%" filterable @blur="selectBlur(arguments,index,'specifications')">
  72. <el-option
  73. v-for="e in specificationsList"
  74. :key="e.id"
  75. :label="e.name"
  76. :value="e.id"
  77. ></el-option>
  78. </el-select>
  79. </el-form-item>
  80. </el-col>
  81. <el-col :span="7">
  82. <el-form-item
  83. :prop="'zEngineeringMaterialBo.' + index + '.number'"
  84. label-width="50px"
  85. label="米数"
  86. >
  87. <div class="block" style="display: inline-block; margin-right: 20px;">
  88. <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>
  89. </div>
  90. </el-form-item>
  91. </el-col>
  92. <el-col :span="7">
  93. <el-form-item
  94. :prop="'zEngineeringMaterialBo.' + index + '.number'"
  95. label-width="50px"
  96. ><div class="block" style="display: inline-block; margin-right: 20px;"></div></el-form-item>
  97. </el-col>
  98. <el-button v-if="zEngineeringMaterialBo.length > 0" @click="removezEngineeringMaterialBo(index)">
  99. 删除
  100. </el-button>
  101. </el-row>
  102. <el-row v-for="(item, index) in zEngineeringMaterialBo" v-if="['阀井'].includes(name)" :key="index" style="left: 13.5%;" :class="'rowStructure'">
  103. <el-col :span="7">
  104. <el-form-item
  105. :prop="'zEngineeringMaterialBo.' + index + '.remark'"
  106. label-width="50px"
  107. label="型号"
  108. >
  109. <div class="block" style="display: inline-block; margin-right: 20px;">
  110. <el-input v-model="item.remark" placeholder="请输入型号" style="width: 100%" :disabled="status == 'read-only'"/>
  111. </div>
  112. </el-form-item>
  113. </el-col>
  114. <el-col :span="7">
  115. <el-form-item
  116. :prop="'zEngineeringMaterialBo.' + index + '.number'"
  117. label-width="50px"
  118. ><div class="block" style="display: inline-block; margin-right: 20px;"></div></el-form-item>
  119. </el-col>
  120. <el-button v-if="zEngineeringMaterialBo.length > 0" @click="removezEngineeringMaterialBo(index)">
  121. 删除
  122. </el-button>
  123. </el-row>
  124. <hr style="position: relative;left: 10%;">
  125. </el-form>
  126. </div>
  127. </template>
  128. <script>
  129. import {
  130. getEnginMaterialQualityList, // 材质
  131. getEnginSpecificationsList, // 规格
  132. getDictType, // 腐蚀程度
  133. } from '@/api/zdsz/enginee'
  134. import ObsVideoUpload from "@/components/ObsVideoUpload/index.vue";
  135. export default {
  136. name:'EnginNodeInfo',
  137. props:['types','enginType','enginSort','enginNode','name','currentContain','updateOption','status'],
  138. dicts:[
  139. 'visit_type',
  140. 'self_closing_valve_type',
  141. 'brand',
  142. 'construct_addre'
  143. ],
  144. components:{ObsVideoUpload},
  145. data(){
  146. return {
  147. constructAccordingDrawingsOption:[
  148. {
  149. value:'Y',
  150. label:'是'
  151. },
  152. {
  153. value:'N',
  154. label:'否'
  155. }
  156. ],
  157. segmentedCompressionQualifiedOption:[
  158. {
  159. value:'1',
  160. label:'合格'
  161. },
  162. {
  163. value:'0',
  164. label:'不合格'
  165. }
  166. ],
  167. materialQualityList_zbf:[], // 自闭阀option
  168. materialQualityList_zjg:[], // 灶具管option
  169. materialQualityList:[], // 材质
  170. specificationsList:[], // 规格
  171. materialComponList:[],
  172. nodeInfo:{
  173. backfillTime:'', // 回填时间
  174. constructTime:'',
  175. constructAccordingDrawings:'',
  176. segmentedCompressionQualified:'',
  177. zEngiineeringPhotoBoList:[], // 照片集合
  178. zEngiineeringPhotoBoListOne:[], // 照片集合
  179. zEngiineeringPhotoBoListTwo:[], // 照片集合
  180. zEngiineeringPhotoBoListThree:[], // 照片集合
  181. zEngineeringMaterialBo:[], // 用料集合
  182. remark:'',
  183. constructAddre:''
  184. },
  185. nodeInfoBo:{
  186. zEngineeringInfoBo:{
  187. }
  188. }, // 节点信息
  189. zEngineeringMaterialBo:[
  190. ], // 用料信息
  191. nodeRules:{
  192. zEngiineeringPhotoBoList: [
  193. {required: true, message: "至少上传一张图片", trigger: "change"}
  194. ],
  195. constructTime: [
  196. {required: true, message: "请选择施工时间", trigger: "change"}
  197. ]
  198. }
  199. }
  200. },
  201. created(){
  202. // 获取材质
  203. let enginType = '市政工程'
  204. getEnginMaterialQualityList({enginType:enginType}).then(res => {
  205. this.materialQualityList = res.data
  206. })
  207. },
  208. mounted(){
  209. console.log('当前节点name',this.name)
  210. console.log('update',this.updateOption)
  211. console.log('当前节点currentContain',this.types)
  212. this.materialComponList = this.currentContain.find(e => {
  213. if( e instanceof Array){
  214. return e
  215. }
  216. })
  217. if(this.status == '修改'){
  218. this.currentContain.find(e => {
  219. console.log(this.updateOption)
  220. if( e instanceof Array){
  221. this.zEngineeringMaterialBo = this.updateOption.zEngineeringInfoBoList[0].zEngineeringMaterialBo
  222. }
  223. this.nodeInfo[e] = this.updateOption[e]
  224. })
  225. this.nodeInfo.zEngiineeringPhotoBoList = this.updateOption.zEngineeringInfoBoList[0].zEngiineeringPhotoBoList
  226. this.nodeInfo.zEngiineeringPhotoBoListOne = this.updateOption.zEngineeringInfoBoList[0].zEngiineeringPhotoBoListOne
  227. this.nodeInfo.zEngiineeringPhotoBoListTwo = this.updateOption.zEngineeringInfoBoList[0].zEngiineeringPhotoBoListTwo
  228. }
  229. setTimeout(() => {
  230. // 至少存在一条物料
  231. this.addMaterial()
  232. },1500)
  233. console.log('用料组件',this.materialComponList)
  234. console.log('用料信息',this.zEngineeringMaterialBo)
  235. console.log('节点信息',this.nodeInfo)
  236. // 添加用料对象
  237. // this.addMaterial()
  238. },
  239. methods:{
  240. selectBlur(_,index,name) {
  241. this.zEngineeringMaterialBo[index][name] = [...arguments][0][0].target.value
  242. },
  243. // 收集节点信息
  244. infoCollection(){
  245. let result = null
  246. console.log(this.$refs.fangxianForm)
  247. this.$refs.fangxianForm.validate(valid => {
  248. if(valid){
  249. // 收集主节点信息
  250. this.currentContain.forEach(e => {
  251. if( e instanceof Array){
  252. // 包含用料 特殊处理
  253. return
  254. }
  255. this.nodeInfoBo[e] = this.nodeInfo[e]
  256. })
  257. this.nodeInfoBo.type = this.name
  258. // 接口数据格式修改 图片和用料放到nodeInfoBo节点详情对象中
  259. if (this.name!='回填、撤场'){
  260. this.nodeInfoBo.zEngineeringInfoBo.zEngiineeringPhotoBoList = []
  261. this.nodeInfoBo.zEngineeringInfoBo.zEngiineeringPhotoBoList = this.nodeInfo.zEngiineeringPhotoBoList
  262. }
  263. if (this.name=='回填、撤场'){
  264. this.nodeInfoBo.zEngineeringInfoBo.zEngiineeringPhotoBoListOne = []
  265. this.nodeInfoBo.zEngineeringInfoBo.zEngiineeringPhotoBoListTwo = []
  266. this.nodeInfoBo.zEngineeringInfoBo.zEngiineeringPhotoBoListThree = []
  267. this.nodeInfoBo.zEngineeringInfoBo.zEngiineeringPhotoBoListOne = this.nodeInfo.zEngiineeringPhotoBoListOne
  268. this.nodeInfoBo.zEngineeringInfoBo.zEngiineeringPhotoBoListTwo = this.nodeInfo.zEngiineeringPhotoBoListTwo
  269. this.nodeInfoBo.zEngineeringInfoBo.zEngiineeringPhotoBoListThree = this.nodeInfo.zEngiineeringPhotoBoListThree
  270. }
  271. this.nodeInfoBo.zEngineeringInfoBo.zEngineeringMaterialBo = this.zEngineeringMaterialBo
  272. this.nodeInfoBo.zEngineeringInfoBo.constructAddre=this.nodeInfo.constructAddre
  273. this.nodeInfoBo.zEngineeringInfoBo.constructTime=this.nodeInfo.constructTime
  274. this.nodeInfoBo.zEngineeringInfoBo.remark=this.nodeInfo.remark
  275. // delete this.nodeInfo.zEngiineeringPhotoBoList
  276. console.log('即将返回的节点Info',this.nodeInfoBo)
  277. result = this.nodeInfoBo
  278. } else {
  279. this.$message({
  280. message: '请完善信息',
  281. type: 'error'
  282. });
  283. throw 'valid Failed'
  284. }
  285. })
  286. return result
  287. },
  288. addMaterial(){
  289. let materialBo = {}
  290. // this.materialComponList.forEach(e => {
  291. // materialBo[e] = null
  292. // })
  293. this.zEngineeringMaterialBo.push(materialBo)
  294. this.nodeInfo.zEngineeringMaterialBo.push(materialBo)
  295. // console.log('节点用料参数对象',this.zEngineeringMaterialBo)
  296. },
  297. addzEngineeringMaterialBo(option,params){
  298. let material = {}
  299. params.forEach(e => {
  300. material[e] = ""
  301. })
  302. this[option].zEngineeringMaterialBo.push(
  303. material
  304. )
  305. },
  306. removezEngineeringMaterialBo(index){
  307. this.zEngineeringMaterialBo.splice(index, 1);
  308. },
  309. // 填充已有数据
  310. updateInfo(e){
  311. console.log('填充',e)
  312. },
  313. getUrl(url) {
  314. this.nodeInfo.zEngiineeringPhotoBoList = this.$refs.obsImageUpload.fileList ? this.$refs.obsImageUpload.fileList.map(e=>e.url):[];
  315. },
  316. getUrl1(url) {
  317. this.nodeInfo.zEngiineeringPhotoBoListOne = this.$refs.obsImageUpload1.fileList ? this.$refs.obsImageUpload1.fileList.map(e=>e.url):[];
  318. },
  319. getUrl2(url) {
  320. this.nodeInfo.zEngiineeringPhotoBoListTwo = this.$refs.obsImageUpload2.fileList ? this.$refs.obsImageUpload2.fileList.map(e=>e.url):[];
  321. },
  322. getUrl3(url) {
  323. this.nodeInfo.zEngiineeringPhotoBoListThree = this.$refs.obsImageUpload3.fileList ? this.$refs.obsImageUpload3.fileList.map(e=>e.url):[];
  324. },
  325. // 获取材质规格
  326. getEnginSpecificationsList(e,idx){
  327. this.zEngineeringMaterialBo[idx].specifications = null;
  328. getEnginSpecificationsList({materId:e.materialQuality}).then(res => {
  329. console.log('规格',res.data)
  330. this.specificationsList = res.data
  331. })
  332. },
  333. }
  334. }
  335. </script>
  336. <style lang="scss" scoped>
  337. ::v-deep .material_desc{
  338. .el-form-item__content{
  339. margin-left: 50px !important;
  340. }
  341. }
  342. ::v-deep .el-form{
  343. position: relative;
  344. left: -10%;
  345. .el-form-item{
  346. display: inline-block;
  347. }
  348. .obsImage{
  349. width: 100%;
  350. display: block;
  351. margin-left: 8%;
  352. .el-form-item__label{
  353. width: 113px !important;
  354. }
  355. .el-form-item__error{
  356. position: relative;
  357. left: -10%;
  358. }
  359. }
  360. .obsActiveImage{
  361. .el-form{
  362. left:-14% !important
  363. }
  364. .el-form-item__label{
  365. width: 97px !important;
  366. }
  367. }
  368. .obsActiveImageStructure{
  369. .el-form-item__label{
  370. width:161px !important;
  371. }
  372. }
  373. .rowStructure{
  374. padding-left: 3.6%;
  375. .el-col .el-form-item{
  376. width:73%
  377. }
  378. }
  379. }
  380. </style>