factoryBuildingsInfo.vue 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101
  1. <template>
  2. <view>
  3. <view class="overlay" v-if="showfx" @click="showwx">
  4. <image style="height: 100%;width: 100%;" src="/static/img/zz.png"></image>
  5. </view>
  6. <view :class="['custom-header', { 'is-back': isBack }, bgColor]">
  7. <view class="back-container" @click="handleBack">
  8. <view class="back-text">返回</view>
  9. </view>
  10. <view class="content-container">
  11. <view class="content-text">{{title}}</view>
  12. </view>
  13. </view>
  14. <form class="cu-list menu">
  15. <view class="titlebg2">
  16. <view class="titlet1" ></view>
  17. <view class="titlet2" >厂房信息</view>
  18. </view>
  19. <view class="show1">
  20. <view class="textbg">
  21. <view class="text1">
  22. 厂房编号
  23. </view>
  24. <input class="text44" v-model="inputForm.des6" placeholder="输入厂房编号" :disabled="ischeck"></input>
  25. </view>
  26. <view class="textbg">
  27. <view class="text1">
  28. 厂房名称
  29. </view>
  30. <input class="text44" v-model="inputForm.name" placeholder="输入厂房名称" :disabled="ischeck"></input>
  31. </view>
  32. <view class="textbg">
  33. <view class="text1">
  34. 所属园区
  35. </view>
  36. <view v-if="ischeck" class="text2" :class="inputForm.des8 === '需' ? 'text33' : 'text44'" >
  37. {{inputForm.des8}}
  38. </view>
  39. <picker v-else class="title2" @change="bindPickerChange" rangeKey="label" rangeValue="value" :range="parkList">
  40. <view class="text44" :class="{ placeholder: selectedPark === '请选择' }">{{ selectedPark }}</view>
  41. </picker>
  42. </view>
  43. <view class="textbg">
  44. <view class="text1">
  45. 详细位置
  46. </view>
  47. <input class="text44" v-model="inputForm.address" placeholder="输入详细位置" :disabled="ischeck"></input>
  48. </view>
  49. <view class="textbg">
  50. <view class="text1">
  51. 联系人
  52. </view>
  53. <button v-if="showloginbt" @click="tologin" class="cu-btn block bg-blue ">{{dengtxt}}</button>
  54. <input v-else class="text44" v-model="inputForm.lxr" placeholder="输入联系人" :disabled="ischeck"></input>
  55. </view>
  56. <view class="textbg">
  57. <view class="text1">
  58. 联系电话
  59. </view>
  60. <button v-if="showloginbt" @click="tologin" class="cu-btn block bg-blue ">{{dengtxt}}</button>
  61. <input v-else class="text44" v-model="inputForm.phone" placeholder="输入联系电话" :disabled="ischeck"></input>
  62. </view>
  63. </view>
  64. <view class="titlebg2">
  65. <view class="titlet1" ></view>
  66. <view class="titlet2" >基本信息</view>
  67. </view>
  68. <view class="textbg">
  69. <view class="text12">
  70. {{t1}}
  71. </view>
  72. <view v-if="ischeck" class="text44" >
  73. {{ inputForm.ownership===1 ? '国有' :
  74. inputForm.ownership===2 ? '集体' : '民营' }}
  75. </view>
  76. <picker v-else class="title2" @change="bindPickerChange2" rangeKey="label" rangeValue="value" :range="parkList2">
  77. <view class="text44" :class="{ placeholder: selectedownership === '请选择' }">{{ selectedownership }}</view>
  78. </picker>
  79. </view>
  80. <view class="textbg">
  81. <view class="text12">
  82. 产权
  83. </view>
  84. <view v-if="ischeck" class="text44" >
  85. {{selecteddes7}}
  86. </view>
  87. <picker v-else class="title2" @change="bindPickerChange4" rangeKey="label" rangeValue="value" :range="parkList4">
  88. <view class="text44" :class="{ placeholder: selecteddes7 === '请选择' }">{{ selecteddes7 }}</view>
  89. </picker>
  90. </view>
  91. <view class="textbg">
  92. <view class="text12">
  93. {{t2}}(亩)
  94. </view>
  95. <view class="text22">
  96. <input class="text44" v-model="inputForm.area" placeholder="输入占地面积" :disabled="ischeck"></input>
  97. </view>
  98. </view>
  99. <view class="textbg">
  100. <view class="text12">
  101. {{t3}}
  102. </view>
  103. <view v-if="ischeck" class="text44">
  104. {{inputForm.singleLayer===1 ? '单层' : '多层'}}
  105. </view>
  106. <picker v-else class="title2" @change="bindPickerChange3" rangeKey="label" rangeValue="value" :range="parkList3">
  107. <view class="text44" :class="{ placeholder: selectedsingleLayer === '请选择' }">{{ selectedsingleLayer }}</view>
  108. </picker>
  109. </view>
  110. <view class="textbg">
  111. <view class="text12">
  112. {{t4}}(㎡)
  113. </view>
  114. <view class="text221">
  115. <input class="text44" v-model="inputForm.idleArea" placeholder="输入占地面积" :disabled="ischeck"></input>
  116. </view>
  117. </view>
  118. <view class="textbg">
  119. <view class="text12">
  120. {{t5}}
  121. </view>
  122. <view class="text221">
  123. <input class="text44" v-model="inputForm.numberLayers" placeholder="输入层数" :disabled="ischeck"></input>
  124. </view>
  125. </view>
  126. <view class="textbg">
  127. <view class="text12">
  128. {{t6}}
  129. </view>
  130. <view class="text221">
  131. <input class="text44" v-model="inputForm.floorHeight" placeholder="输入层高" :disabled="ischeck"></input>
  132. </view>
  133. </view>
  134. <view class="textbg">
  135. <view class="text12">
  136. 适用产业
  137. </view>
  138. <!-- 回显(查看模式) -->
  139. <view v-if="ischeck" class="text44">
  140. {{ inputForm.des2 || '暂无' }}
  141. </view>
  142. <!-- 编辑(选择模式) -->
  143. <zqs-select
  144. v-else
  145. class="input2"
  146. :multiple="true"
  147. :list="industryList"
  148. label-key="label"
  149. value-key="value"
  150. placeholder=" 请选择"
  151. title="请选择适用产业"
  152. clearable
  153. v-model="selectedIndustry"
  154. @search="searchEvent"
  155. @change="selectChange2"
  156. ></zqs-select>
  157. </view>
  158. <view class="textbg">
  159. <view class="text12">
  160. 厂房装修
  161. </view>
  162. <view v-if="ischeck" class="text44">
  163. {{ inputForm.des3==='1' ? '毛坯' :
  164. inputForm.des3==='2' ? '精装' : '' }}
  165. </view>
  166. <picker v-else class="title2" @change="bindPickerChange6" rangeKey="label" rangeValue="value" :range="parkList6">
  167. <view class="text44" :class="{ placeholder: selecteddes3 === '请选择' }">{{ selecteddes3 }}</view>
  168. </picker>
  169. </view>
  170. <view class="textbg">
  171. <view class="text12">
  172. 长宽
  173. </view>
  174. <view class="text221">
  175. <input class="text44" v-model="inputForm.des4" placeholder="输入长宽" :disabled="ischeck"></input>
  176. </view>
  177. </view>
  178. <view class="textbg">
  179. <view class="text12">
  180. 承载负荷(kg/m²)
  181. </view>
  182. <view class="text221">
  183. <input class="text44" v-model="inputForm.des5" placeholder="输入承载负荷" :disabled="ischeck"></input>
  184. </view>
  185. </view>
  186. <view class="textbg">
  187. <view class="text12">
  188. 行车数量
  189. </view>
  190. <view class="text221">
  191. <input class="text44" v-model="inputForm.drivingCount" placeholder="输入行车数量" :disabled="ischeck"></input>
  192. </view>
  193. </view>
  194. <view class="textbg">
  195. <view class="text12">
  196. 行车承载负荷(吨)
  197. </view>
  198. <view class="text221">
  199. <input class="text44" v-model="inputForm.drivingLoad" placeholder="输入行车承载负荷" :disabled="ischeck"></input>
  200. </view>
  201. </view>
  202. <view class="textbg">
  203. <view class="text12">
  204. 洁净车间
  205. </view>
  206. <view v-if="ischeck" class="text44">
  207. {{ selectedcleanRoom }}
  208. </view>
  209. <picker v-else class="title2" @change="bindPickerChange5" rangeKey="label" rangeValue="value" :range="parkList5">
  210. <view class="text44" :class="{ placeholder: selectedcleanRoom === '请选择' }">{{ selectedcleanRoom }}</view>
  211. </picker>
  212. </view>
  213. <view class="textbg">
  214. <view class="text12">
  215. 水电气情况
  216. </view>
  217. <view class="text221">
  218. <input class="text44" v-model="inputForm.situation" placeholder="输入水电气情况" :disabled="ischeck"></input>
  219. </view>
  220. </view>
  221. <view v-if="!ischeck" class="textbg">
  222. <view class="text12">
  223. 纳入板块统计
  224. </view>
  225. <picker class="title2" @change="bindPickerChange7" rangeKey="label" rangeValue="value" :range="parkList7">
  226. <view class="text44" :class="{ placeholder: selectedispark === '请选择' }">{{ selectedispark }}</view>
  227. </picker>
  228. </view>
  229. <view class="textbg" >
  230. <view class="text12">
  231. 备注
  232. </view>
  233. <view class="text221">
  234. <input class="text44" v-model="inputForm.remark" placeholder="输入备注" :disabled="ischeck"></input>
  235. </view>
  236. </view>
  237. <view v-if="!showloginbt&&!ischeck" class="cu-form-group margin-top" style="0.5px solid #eee;margin-top: 10rpx;">
  238. <uni-file-picker style="margin-bottom: 10px;margin-top: 10rpx;" limit="1" ref="picFile" v-model="picLists"
  239. fileMediatype="image" mode="grid" title="平面图" :auto-upload="autoUpload" @select="select"
  240. @progress="progress" @success="success" @fail="fail" @delete="deleteFile"
  241. :imageStyles="imageStyles" :disabled="ischeck">
  242. </uni-file-picker>
  243. </view>
  244. <view v-if="!showloginbt&&!ischeck" class="cu-form-group margin-top" style="0.5px solid #eee;margin-top: 10rpx;">
  245. <uni-file-picker style="margin-bottom: 10px;margin-top: 10rpx;" limit="4" ref="picFile2" v-model="picLists2"
  246. fileMediatype="image" mode="grid" title="厂房图" :auto-upload="autoUpload" @select="select2"
  247. @progress="progress" @success="success" @fail="fail" @delete="deleteFile2"
  248. :imageStyles="imageStyles" :disabled="ischeck">
  249. </uni-file-picker>
  250. </view>
  251. <view style="height: 30rpx;background-color: white;"></view>
  252. <view class="padding-xl" v-if="showloginbt">
  253. <button @click="tologin" class="cu-btn block bg-blue margin-tb-sm lg">登录查看厂房照片</button>
  254. </view>
  255. <view class="titlebg2" v-if="swiperList2.length>0" >
  256. <view class="titlet1" ></view>
  257. <view class="titlet2" >平面图</view>
  258. </view>
  259. <view v-for="(item, index) in swiperList2" :key="'pic1-'+index" style="width: 100%;">
  260. <image :src="item.url" mode="widthFix" style="width: 100%;" >
  261. </image>
  262. </view>
  263. <view style="height: 40rpx;"></view>
  264. <view class="titlebg2" v-if="swiperList.length>0" >
  265. <view class="titlet1" ></view>
  266. <view class="titlet2" >厂房图</view>
  267. </view>
  268. <view v-for="(item, index) in swiperList" :key="'pic2-'+index" style="width: 100%;">
  269. <image :src="item.url" mode="widthFix" style="width: 100%;" >
  270. </image>
  271. </view>
  272. <view style="height: 40rpx;"></view>
  273. <view class="padding-xl" v-if="!ischeck">
  274. <button @click="save" class="cu-btn block bg-blue margin-tb-sm lg">提交</button>
  275. </view>
  276. </form>
  277. </view>
  278. </template>
  279. <script>
  280. import loginService from '@/api/auth/loginService.js'
  281. import { wxShare } from "@/common/wxutils.js";
  282. export default {
  283. data() {
  284. return {
  285. title: '厂房资源详情',
  286. isBack: true, // 是否显示返回按钮
  287. backText: '返回', // 返回按钮的文本
  288. bgColor: 'bg-blue', // 背景颜色
  289. ischeck: true,
  290. isAdd: true,
  291. autoUpload: false,
  292. swiperList: [],
  293. swiperList2: [],
  294. inputForm: {
  295. id: '',
  296. name: '',
  297. park: '',
  298. address: '',
  299. ownership: '',
  300. area: '',
  301. singleLayer: '',
  302. cleanRoom: '',
  303. numberLayers: '',
  304. floorHeight: '',
  305. idleArea: '',
  306. remark: '',
  307. state: '',
  308. des1: '',
  309. des2: '',
  310. des3: '',
  311. des4: '',
  312. des5: '',
  313. des6: '',
  314. des7: '',
  315. des8: '',
  316. des9: '',
  317. lxr: '',
  318. phone: '',
  319. drivingCount: '',
  320. drivingLoad: '',
  321. situation: '',
  322. pic1: '',
  323. pic2: '',
  324. ispark: '',
  325. },
  326. t1: '厂房权属',
  327. t2: '占地面积',
  328. t3: '单层/多层',
  329. t4: '面积',
  330. t5: '层数',
  331. t6: '层高',
  332. text1:'',
  333. text2:'',
  334. parkList: [],
  335. parkList2: [],
  336. parkList3: [],
  337. parkList4: [],
  338. parkList5: [],
  339. parkList6: [],
  340. parkList7: [{label: '是',value: '1'},{label: '否',value: '0'}],
  341. selectedPark:'请选择',
  342. selectedownership:'请选择',
  343. selectedsingleLayer:'请选择',
  344. selecteddes7:'请选择',
  345. selecteddes3:'请选择',
  346. selectedcleanRoom:'请选择',
  347. selectedispark:'请选择',
  348. // 适用产业
  349. industryList: [], // 字典数组
  350. selectedIndustry: [], // 当前选中的 value 数组
  351. showIndustryPicker: false,
  352. showIndustryPop: false ,
  353. dengtxt: '登录查看',
  354. picLists: [],
  355. picUrl: [],
  356. picLists2: [],
  357. picUrl2: [],
  358. imageStyles: {
  359. width: 90,
  360. height: 90
  361. },
  362. index:0,
  363. isLogin:"",
  364. showloginbt:true,
  365. username:"",
  366. isadmin:false,
  367. lyIndex: '',
  368. showLYList: [],
  369. showfx:false,
  370. rules: {
  371. name: { label: '厂房名称', required: true },
  372. park: { label: '所属园区', required: true },
  373. address: { label: '详细位置', required: true },
  374. ownership: { label: '厂房权属', required: true },
  375. area: { label: '占地面积', required: true, pattern: /^\d+(\.\d{1,2})?$/ },
  376. singleLayer: { label: '单层/多层', required: true },
  377. idleArea: { label: '面积', required: true, pattern: /^\d+(\.\d{1,2})?$/ },
  378. numberLayers: { label: '层数', required: true, pattern: /^\d+$/ },
  379. floorHeight: { label: '层高', required: true, pattern: /^\d+(\.\d{1,2})?$/ }
  380. }
  381. }
  382. },
  383. created() {
  384. },
  385. mounted() {
  386. },
  387. computed: {
  388. },
  389. onShow() {
  390. this.isLogin=this.$auth.checkisLogin();
  391. //判断是否能新增
  392. if(this.isLogin!=null){
  393. this.getRole();
  394. this.showloginbt=false;
  395. }
  396. },
  397. onLoad(query) {
  398. this.isLogin=this.$auth.checkisLogin();
  399. this.username=this.$auth.getUserInfo();
  400. if(this.username!=undefined&&this.username!=''&&this.username!=null&&this.isLogin!=null){
  401. if(this.username.loginName=='admin'){
  402. this.isadmin=true;
  403. }
  404. }
  405. Promise.all([
  406. loginService.getDictListBytype("sys_park"),
  407. loginService.getDictListBytype("sys_ownership"),
  408. loginService.getDictListBytype("sys_single_layer"),
  409. loginService.getDictListBytype("sys_property_right"),
  410. loginService.getDictListBytype("sys_clean_room"),
  411. loginService.getDictListBytype("sys_renovation"),
  412. loginService.getDictListBytype("sys_industry")
  413. ]).then(([park, own, layer, propertyright, cleanroom,renovation,industry]) => {
  414. this.parkList = park.data;
  415. this.parkList2 = own.data;
  416. this.parkList3 = layer.data;
  417. this.parkList4 = propertyright.data;
  418. this.parkList5 = cleanroom.data;
  419. this.parkList6 = renovation.data;
  420. this.industryList = industry.data;
  421. // 字典到位后再回显详情
  422. if (query.id) { // 有 id → 编辑/查看
  423. this.isAdd = false
  424. this.title = '厂房资源详情'
  425. return loginService.factoryqueryById(query.id)
  426. } else { // 无 id → 新增
  427. this.isAdd = true
  428. this.title = '新增厂房资源'
  429. return Promise.resolve({ data: {} }) // 空对象,走 setData 不会报错
  430. }
  431. }).then(({ data }) => {
  432. this.setData(data);
  433. });
  434. },
  435. methods: {
  436. handleBack() {
  437. this.$router.go(-1);
  438. },
  439. getRole() {
  440. let userInfo = uni.getStorageSync('WMS-userinfo')
  441. var officeId = userInfo.officeDTO.id;
  442. var roleIds = userInfo.roleIds;
  443. //区“企业大走访”办公室、政府管理员、厂房板块维护人员
  444. if (roleIds.indexOf("1910175386924417025") != -1||roleIds.indexOf("ade960e8f02544998b07397304c059c1") != -1||roleIds.indexOf("1996038972899717121") != -1) {
  445. this.ischeck = false;
  446. }
  447. },
  448. bindPickerChange(e) {
  449. const idx = e.detail.value
  450. const item = this.parkList[idx]
  451. this.selectedPark = item.label
  452. this.inputForm.park = item.value
  453. },
  454. bindPickerChange2(e) {
  455. const idx = e.detail.value
  456. const item = this.parkList2[idx]
  457. this.selectedownership = item.label
  458. this.inputForm.ownership = item.value
  459. },
  460. bindPickerChange3(e) {
  461. const idx = e.detail.value
  462. const item = this.parkList3[idx]
  463. this.selectedsingleLayer = item.label
  464. this.inputForm.singleLayer = item.value
  465. },
  466. bindPickerChange4(e) {
  467. const idx = e.detail.value
  468. const item = this.parkList4[idx]
  469. this.selecteddes7 = item.label
  470. this.inputForm.des7 = item.value
  471. },
  472. bindPickerChange5(e) {
  473. const idx = e.detail.value
  474. const item = this.parkList5[idx]
  475. this.selectedcleanRoom = item.label
  476. this.inputForm.cleanRoom = item.value
  477. },
  478. bindPickerChange6(e) {
  479. const idx = e.detail.value
  480. const item = this.parkList6[idx]
  481. this.selecteddes3 = item.label
  482. this.inputForm.des3 = item.value
  483. },
  484. bindPickerChange7(e) {
  485. const idx = e.detail.value
  486. const item = this.parkList7[idx]
  487. this.selectedispark = item.label
  488. this.inputForm.ispark = item.value
  489. },
  490. selectChange2() {
  491. // 此处为点击的事件
  492. //this.pickerData=this.pickerDataOld;
  493. console.log(this.selectedIndustry);
  494. },
  495. searchEvent(val) {
  496. //this.pickerData=this.filteredItems(val);
  497. },
  498. // industryChange(e){
  499. // this.selectedIndustry = e.detail.value
  500. // // 同时拼好 label 字符串
  501. // const labels = this.selectedIndustry.map(v =>
  502. // this.industryList.find(d => d.value === v)?.label
  503. // ).filter(Boolean)
  504. // this.inputForm.des1 = this.selectedIndustry.join(',')
  505. // this.inputForm.des2 = labels.join(',')
  506. // },
  507. // 弹窗点确定
  508. // confirmIndustry () {
  509. // // 把 value 数组 -> 字符串
  510. // this.inputForm.des1 = this.selectedIndustry.join(',')
  511. // // 把对应 label 拼成字符串
  512. // const dict = this.industryList
  513. // const labels = this.selectedIndustry.map(v => {
  514. // const item = dict.find(d => d.value === v)
  515. // return item ? item.label : ''
  516. // })
  517. // this.inputForm.des2 = labels.join(',')
  518. // this.showIndustryPicker = false
  519. // },
  520. // 回显(setData 里调用)
  521. fillIndustry () {
  522. // 后端是字符串,先拆成数组
  523. if (this.inputForm.des1) {
  524. this.selectedIndustry = this.inputForm.des1.split(',')
  525. } else {
  526. this.selectedIndustry = []
  527. }
  528. },
  529. validate() {
  530. for (const key in this.rules) {
  531. const rule = this.rules[key]
  532. const val = this.inputForm[key]
  533. if (rule.required && (!val || val === '请选择')) {
  534. uni.showToast({ title: `请填写${rule.label}`, icon: 'none' })
  535. return false
  536. }
  537. if (rule.pattern && !rule.pattern.test(val)) {
  538. uni.showToast({ title: `${rule.label}格式有误`, icon: 'none' })
  539. return false
  540. }
  541. }
  542. return true
  543. },
  544. // 获取上传进度
  545. progress(e) {
  546. console.log('上传进度:', e)
  547. },
  548. // 上传成功
  549. success(e) {
  550. console.log('上传成功')
  551. },
  552. // 上传失败
  553. fail(e) {
  554. console.log('上传失败:', e)
  555. },
  556. deleteFile(e) {
  557. this.picUrl.splice(e.index, 1)
  558. },
  559. deleteFile2(e) {
  560. this.picUrl2.splice(e.index, 1)
  561. },
  562. // 获取上传状态
  563. select(e) {
  564. console.log('选择文件:', e)
  565. var _this = this
  566. var i = 0
  567. upload()
  568. function upload() {
  569. if (i >= e.tempFiles.length) {
  570. return;
  571. }
  572. var item = e.tempFiles[i]
  573. uni.showLoading({
  574. title: "上传中",
  575. mask: true
  576. });
  577. uni.uploadFile({
  578. url: '/yd_qycpfb/file/upload?uploadPath=userdir', // 仅为示例,非真实的接口地址
  579. filePath: item.url,
  580. name: 'file',
  581. formData: {
  582. 'fileName': item.name
  583. },
  584. header: {
  585. 'token': _this.$auth.getUserToken()
  586. },
  587. success: (res) => {
  588. var data = res.data
  589. if (typeof data['error'] != "undefined") {
  590. uni.showToast({
  591. icon: 'none',
  592. title: '上传失败,请联系开发!'
  593. });
  594. _this.$refs.picFile.clearFiles(_this.picLists.length)
  595. } else {
  596. _this.picUrl.push({
  597. url: data,
  598. uuid: item.uuid
  599. })
  600. i++;
  601. upload()
  602. }
  603. },
  604. fail: () => {
  605. uni.hideLoading();
  606. uni.showToast({
  607. icon: 'none',
  608. title: '上传失败,请联系开发!'
  609. });
  610. _this.$refs.picFile.clearFiles(_this.picLists.length)
  611. },
  612. complete: function() {
  613. uni.hideLoading();
  614. }
  615. });
  616. }
  617. },
  618. select2(e) {
  619. console.log('选择文件:', e)
  620. var _this = this
  621. var i = 0
  622. upload()
  623. function upload() {
  624. if (i >= e.tempFiles.length) {
  625. return;
  626. }
  627. var item = e.tempFiles[i]
  628. uni.showLoading({
  629. title: "上传中",
  630. mask: true
  631. });
  632. uni.uploadFile({
  633. url: '/yd_qycpfb/file/upload?uploadPath=userdir', // 仅为示例,非真实的接口地址
  634. filePath: item.url,
  635. name: 'file',
  636. formData: {
  637. 'fileName': item.name
  638. },
  639. header: {
  640. 'token': _this.$auth.getUserToken()
  641. },
  642. success: (res) => {
  643. var data = res.data
  644. if (typeof data['error'] != "undefined") {
  645. uni.showToast({
  646. icon: 'none',
  647. title: '上传失败,请联系开发!'
  648. });
  649. _this.$refs.picFile2.clearFiles(_this.picLists2.length)
  650. } else {
  651. _this.picUrl2.push({
  652. url: data,
  653. uuid: item.uuid
  654. })
  655. i++;
  656. upload()
  657. }
  658. },
  659. fail: () => {
  660. uni.hideLoading();
  661. uni.showToast({
  662. icon: 'none',
  663. title: '上传失败,请联系开发!'
  664. });
  665. _this.$refs.picFile2.clearFiles(_this.picLists2.length)
  666. },
  667. complete: function() {
  668. uni.hideLoading();
  669. }
  670. });
  671. }
  672. },
  673. save(){
  674. if (!this.validate()) return
  675. this.inputForm.state=1;
  676. //产业
  677. const labels = this.selectedIndustry.map(v =>
  678. this.industryList.find(d => d.value === v)?.label
  679. ).filter(Boolean)
  680. this.inputForm.des1 = this.selectedIndustry.join(',')
  681. this.inputForm.des2 = labels.join(',')
  682. this.inputForm.pic1 = [];
  683. this.inputForm.pic2 = [];
  684. this.picUrl.forEach(item => {
  685. this.inputForm.pic1.push(item.url.replace('https://ydwqfw.com.cn/yd_qycpfbWeb/', ''))
  686. })
  687. this.picUrl2.forEach(item => {
  688. this.inputForm.pic2.push(item.url.replace('https://ydwqfw.com.cn/yd_qycpfbWeb/', ''))
  689. })
  690. this.inputForm.pic1 = this.inputForm.pic1.toString();
  691. this.inputForm.pic2 = this.inputForm.pic2.toString();
  692. uni.showLoading()
  693. loginService.savefactoryBuildings(this.inputForm).then(({
  694. data
  695. }) => {
  696. uni.hideLoading();
  697. uni.showToast({
  698. title: "厂房资源提交成功!",
  699. icon: "success"
  700. });
  701. uni.navigateTo({
  702. url: '/pages/factoryBuildings/factoryBuildingsList'
  703. })
  704. }).catch((e) => {
  705. uni.hideLoading();
  706. })
  707. },
  708. tologin(){
  709. uni.showLoading()
  710. uni.reLaunch({
  711. url: '/pages/login/factorylogin'
  712. })
  713. },
  714. setData(data){
  715. this.inputForm = this.recover(this.inputForm, data)
  716. const parkItem = this.parkList.find(p => p.value == data.park);
  717. // 把中文名赋给用来显示的变量
  718. this.selectedPark = parkItem ? parkItem.label : '请选择';
  719. /* 同理,如果权属、单层多层也需要回显,照抄两行即可 */
  720. const ownItem = this.parkList2.find(p => p.value == data.ownership);
  721. this.selectedownership = ownItem ? ownItem.label : '请选择';
  722. const layerItem = this.parkList3.find(p => p.value == data.singleLayer);
  723. this.selectedsingleLayer = layerItem ? layerItem.label : '请选择';
  724. const des7Item = this.parkList4.find(p => p.value == data.des7);
  725. this.selecteddes7 = des7Item ? des7Item.label : '请选择';
  726. console.log("产权:"+this.selecteddes7)
  727. const des3Item = this.parkList6.find(p => p.value == data.des3);
  728. this.selecteddes3 = des3Item ? des3Item.label : '请选择';
  729. /* ===== 洁净车间回显 ===== */
  730. const cleanItem = this.parkList5.find(p => p.value == data.cleanRoom)
  731. this.selectedcleanRoom = cleanItem ? cleanItem.label : '请选择'
  732. const isparkItem = this.parkList7.find(p => p.value == data.ispark)
  733. this.selectedispark = isparkItem ? isparkItem.label : '请选择'
  734. this.fillIndustry()
  735. if(this.isLogin!=null){
  736. // 回显图片
  737. if(this.inputForm.pic2!=undefined&&this.inputForm.pic2!=''){
  738. let pics=this.inputForm.pic2.split(",");
  739. pics.forEach(item => {
  740. if(item!=''){
  741. this.swiperList.push({
  742. 'url': "https://ydwqfw.com.cn/yd_qycpfbWeb/"+item,
  743. })
  744. this.picUrl2.push({
  745. 'url': "https://ydwqfw.com.cn/yd_qycpfbWeb/"+item,
  746. 'uuid': item
  747. })
  748. this.picLists2.push({
  749. 'url': "https://ydwqfw.com.cn/yd_qycpfbWeb/"+item,
  750. 'uuid': item
  751. })
  752. }
  753. })
  754. }
  755. let pics2=this.inputForm.pic1;
  756. if(pics2!=undefined&&pics2!=''){
  757. this.swiperList2.push({
  758. 'url': "https://ydwqfw.com.cn/yd_qycpfbWeb/"+pics2,
  759. })
  760. this.picUrl.push({
  761. 'url': "https://ydwqfw.com.cn/yd_qycpfbWeb/"+pics2,
  762. 'uuid': pics2
  763. })
  764. this.picLists.push({
  765. 'url': "https://ydwqfw.com.cn/yd_qycpfbWeb/"+pics2,
  766. 'uuid': pics2
  767. })
  768. }
  769. }
  770. },
  771. }
  772. }
  773. </script>
  774. <style>
  775. input,textarea{
  776. color: #8799a3;
  777. }
  778. .swiper {
  779. width: 750rpx;
  780. height: 310rpx;
  781. }
  782. .swiper-item {
  783. width: 750rpx;
  784. height: 310rpx;
  785. background-color: aliceblue;
  786. }
  787. .show1{
  788. background-color: #2752eb;
  789. padding-left: 8rpx;
  790. }
  791. .textbg{
  792. display: flex;
  793. background-color: white;
  794. padding-top: 29rpx;
  795. }
  796. .text1{
  797. width: 200rpx;
  798. margin-left: 30rpx;
  799. color: #333333;
  800. font-size: 30rpx;
  801. }
  802. .text12{
  803. width: 260rpx;
  804. margin-left: 30rpx;
  805. color: #000000;
  806. font-size: 29rpx;
  807. }
  808. .text2{
  809. flex: 1;
  810. color: #000000;
  811. font-size: 30rpx;
  812. padding-bottom: 2rpx;
  813. }
  814. .text33{
  815. flex: 1;
  816. color: #FF4500;
  817. font-size: 30rpx;
  818. padding-bottom: 2rpx;
  819. }
  820. .text44{
  821. flex: 1;
  822. color: #1E8AD7;
  823. font-size: 30rpx;
  824. padding-bottom: 2rpx;
  825. }
  826. .text44.placeholder {
  827. color: #999; /* 灰色,用于未选择时 */
  828. }
  829. .text22{
  830. flex: 1;
  831. color: #666666;
  832. font-size: 29rpx;
  833. padding-bottom: 2rpx;
  834. }
  835. .text221{
  836. flex: 1;
  837. color: #666666;
  838. font-size: 29rpx;
  839. padding-right:15rpx ;
  840. padding-bottom: 2rpx;
  841. }
  842. .text3{
  843. display: flex;
  844. color: #000000;
  845. }
  846. .phone{
  847. display: flex;
  848. color: #1E8AD7;
  849. padding-left: 5rpx;
  850. padding-right: 5rpx;
  851. font-size: 30rpx;
  852. align-items: center
  853. }
  854. .phoneimg{
  855. margin-left: 10rpx;
  856. width: 35rpx;
  857. height: 35rpx;
  858. }
  859. .titlebg2{
  860. display: flex;
  861. background-color: white;
  862. padding-left: 22rpx;
  863. padding-top: 35rpx;
  864. padding-bottom: 25rpx;
  865. margin-bottom: 2rpx;
  866. }
  867. .titlet1{
  868. width: 7rpx;
  869. margin-top: 7rpx;
  870. margin-bottom: 7rpx;
  871. background-color: #2752eb;
  872. margin-right: 8rpx;
  873. }
  874. .titlet2{
  875. font-weight: 800;
  876. color: #2752eb;
  877. }
  878. .overlay{
  879. position: fixed; /* 固定定位,覆盖整个页面 */
  880. top: 0;
  881. left: 0;
  882. width: 100%;
  883. height: 100%;
  884. background-color: rgba(255, 255, 255, 0.5); /* 半透明白色背景 */
  885. z-index: 1000; /* 确保遮罩在页面内容之上 */
  886. }
  887. .custom-header {
  888. display: flex;
  889. align-items: center;
  890. justify-content: center;
  891. padding: 10px;
  892. width: 100%;
  893. }
  894. .is-back {
  895. position: relative;
  896. }
  897. .back-container {
  898. position: absolute;
  899. left: 10px;
  900. cursor: pointer;
  901. }
  902. .back-text {
  903. color: white; /* 返回按钮文本颜色 */
  904. }
  905. .content-container {
  906. flex: 1;
  907. text-align: center;
  908. }
  909. .content-text {
  910. color: white; /* 标题文本颜色 */
  911. font-weight: bold;
  912. }
  913. /* 背景颜色 */
  914. .bg-blue {
  915. background-color: #4285f4; /* 假设这是一个蓝色背景 */
  916. }
  917. .input2 {
  918. flex: 1;
  919. font-size: 30rpx;
  920. color: #1E8AD7; /* 想保持的蓝色 */
  921. padding-right: 20rpx;
  922. width: 100%;
  923. }
  924. /* 关键:把颜色强制透传到组件内部 input/占位节点 */
  925. .input2 .input, /* 有的版本用 .input */
  926. .input2 .uni-input, /* 有的版本用 .uni-input */
  927. .input2 input::placeholder,
  928. .input2 .placeholder {
  929. color: #1E8AD7 !important; /* 强制覆盖黑色 */
  930. }
  931. .input2 * {
  932. color: #1E8AD7 !important;
  933. }
  934. /* 强制让 zqs-select 内部所有文字都变成蓝色 */
  935. .input2,
  936. .input2 *,
  937. .input2 .input,
  938. .input2 .uni-input,
  939. .input2 .select-input,
  940. .input2 .select-tag,
  941. .input2 .placeholder,
  942. .input2 input,
  943. .input2 .input-placeholder,
  944. .input2 .uni-input-placeholder {
  945. color: #1E8AD7 !important;
  946. }
  947. /deep/ .input2 input {
  948. color: #1E8AD7 !important;
  949. font-size: 30rpx !important;
  950. }
  951. </style>