questionAdd.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510
  1. <template>
  2. <view>
  3. <cu-custom bgColor="bg-blue" :isBack="true" v-if="title == '问题诉求情况'">
  4. <block slot="backText">返回</block>
  5. <block slot="content">问题诉求情况</block>
  6. </cu-custom>
  7. <!-- <cu-custom bgColor="bg-blue" :isBack="true" v-if="title == '问题诉求情况'">
  8. <block slot="backText">返回</block>
  9. <block slot="content">问题诉求情况</block>
  10. </cu-custom>
  11. <cu-custom bgColor="bg-blue" :isBack="true" v-if="title == '问题诉求情况'">
  12. <block slot="backText">返回</block>
  13. <block slot="content">问题诉求情况</block>
  14. </cu-custom> -->
  15. <form @submit="formSubmit" class="cu-list menu">
  16. <view class="titlebg2">
  17. <view class="titlet1" ></view>
  18. <view class="titlet2" >企业信息</view>
  19. </view>
  20. <view class="textbg">
  21. <view class="text12">
  22. 企业名称
  23. </view>
  24. <view class="text22">
  25. {{inputForm.name}}
  26. </view>
  27. </view>
  28. <view class="textbg">
  29. <view class="text12">
  30. 属地
  31. </view>
  32. <view class="text22">
  33. {{inputForm.des1}}
  34. </view>
  35. </view>
  36. <view class="textbg">
  37. <view class="text12">
  38. 企业负责人
  39. </view>
  40. <view class="text22">
  41. {{inputForm.lxr}}
  42. </view>
  43. </view>
  44. <view class="textbg">
  45. <view class="text12">
  46. 负责人号码
  47. </view>
  48. <view class="text22">
  49. 11{{inputForm.phone}}
  50. </view>
  51. </view>
  52. <view style="height: 30rpx;background-color: white;"></view>
  53. <view class="titlebg2" style="margin-top:10rpx ;">
  54. <view class="titlet1" ></view>
  55. <view class="titlet2" >挂钩干部</view>
  56. </view>
  57. <view class="textbg">
  58. <view class="text12">
  59. 姓名
  60. </view>
  61. <view class="text22">
  62. {{inputForm.bz5}}
  63. </view>
  64. </view>
  65. <view style="height: 30rpx;background-color: white;"></view>
  66. <view class="titlebg2" style="margin-top:10rpx ;">
  67. <view class="titlet1" ></view>
  68. <view class="titlet2" >主要问题诉求</view>
  69. </view>
  70. <view v-for="(item, index2) in questionList">
  71. <view style="display: flex;background-color: #ffffff;justify-content: space-between; align-items: center;">
  72. <view class="titlebb">
  73. 问题{{index2+1}}
  74. </view>
  75. <icon v-if="index2!=0" @click="del(index2)" type="cancel" style="padding-right: 15rpx;padding-top: 5rpx;padding-left: 100rpx;"></icon>
  76. <!-- <image s style="height: 10rpx;width: 10rpx;"></image> -->
  77. </view>
  78. <view class="input1">
  79. <view class="title">
  80. 问题名称
  81. </view>
  82. <input v-model="item.qName" placeholder="请填写问题名称" :disabled="ischeck"></input>
  83. </view>
  84. <view class="cu-form-group margin-top">
  85. <view class="title">
  86. 问题类型
  87. </view>
  88. <picker class="title2" @change="bindPickerChange($event, index2)" :value="index" :range="parkList">
  89. <view class="input2">{{item.qType||'请选择问题类型'}}</view>
  90. </picker>
  91. </view>
  92. <view class="cu-form-group margin-top" v-if="item.t1!=''">
  93. <view class="title">
  94. {{item.t1}}
  95. </view>
  96. <input style="width: 200rpx;" v-model="item.gaps" :placeholder="item.t1s" :disabled="ischeck"></input>{{item.t1d}}
  97. </view>
  98. <view class="cu-form-group margin-top" style="border-bottom: 3px solid #eee;">
  99. <view class="title">
  100. 问题描述
  101. </view>
  102. <textarea v-model="item.des" placeholder="请填写问题描述" :disabled="ischeck"></textarea>
  103. </view>
  104. </view>
  105. <view style="width: 400rpx;margin-left: 20rpx;">
  106. <button @click="addp" style="height: 30px;" class="cu-btn block bg-blue margin-tb-sm lg">+增加问题</button>
  107. </view>
  108. <view style="height: 40rpx;"></view>
  109. <view class="flexC" v-if="!ischeck">
  110. <button @click="save" class="bt1 block margin-tb-sm lg">暂存</button>
  111. <button form-type="submit" class="bt1 cu-btn block bg-blue margin-tb-sm lg">提交</button>
  112. </view>
  113. </form>
  114. </view>
  115. </template>
  116. <script>
  117. var graceChecker = require("@/common/graceChecker.js");
  118. import revenueListService from '@/api/revenue/revenueListService'
  119. import loginService from '@/api/auth/loginService.js'
  120. export default {
  121. onShow() {
  122. this.$auth.checkLogin()
  123. },
  124. data() {
  125. return {
  126. title: '问题诉求情况',
  127. inputForm: {
  128. id:'',
  129. name: '',
  130. industry: '',
  131. lxr: '',
  132. phone: '',
  133. bz1: '',
  134. bz2: '',
  135. bz3: '',
  136. bz4: '',
  137. bz5: '',
  138. bz6: '',
  139. des1: '',
  140. des2: '',
  141. des3: '',
  142. des4: '',
  143. des6: '',
  144. },
  145. t1: '可供产品',
  146. t1s: '请填写可供产品',
  147. t2: '可供数量',
  148. t2s: '请填写可供数量',
  149. t3: '详细描述',
  150. t3s: '请填写详细描述',
  151. autoUpload: false,
  152. picLists: [],
  153. picUrl: [],
  154. imageStyles: {
  155. width: 90,
  156. height: 90
  157. },
  158. parkList: [ "用工人才", "资金需求", "土地厂房", "订单及配套", "政策兑现", "创新及品牌", "审批手续", "水电气供应", "安全环保消防", "其他(需详细说明)"],
  159. questionList:[{qName:"",qType:"",qTypeindex:"",gaps:"",des:"",t1:"",t1s:""}],
  160. index:0,
  161. ischeck: false,
  162. }
  163. },
  164. created() {
  165. //this.getParkList()
  166. },
  167. mounted() {
  168. },
  169. async onLoad(query) {
  170. let data2 = await loginService.queryByUserName()
  171. console.log(data2.data.name);
  172. this.inputForm = this.recover(this.inputForm, data2.data)
  173. if (query && query.id) {
  174. let {data} = await loginService.queryByIdBuild(query.id)
  175. console.log(data)
  176. if (data.pic != null) {
  177. data.pic = data.pic.split(",")
  178. var list = data.pic
  179. list.forEach(item => {
  180. this.picUrl.push({
  181. 'url': item,
  182. 'uuid': item
  183. })
  184. this.picLists.push({
  185. 'url': item,
  186. 'uuid': item
  187. })
  188. })
  189. } else {
  190. data.pic = []
  191. }
  192. this.inputForm = this.recover(this.inputForm, data)
  193. }
  194. },
  195. methods: {
  196. addp(){
  197. this.questionList.push({qName:"",qType:"",qTypeindex:"",gaps:"",des:"",t1:"",t1s:""})
  198. },
  199. del(index2){
  200. this.questionList.splice(index2, 1);
  201. },
  202. getParkList() {
  203. loginService.parkList({
  204. current: 1,
  205. size: 1000000,
  206. }).then(({
  207. data
  208. }) => {
  209. this.parkList = data.records.map((item) => {
  210. return {
  211. label: item.parkName,
  212. value: item.id
  213. }
  214. })
  215. console.log(this.parkList, '=============>')
  216. }).catch(e => {
  217. console.log(e)
  218. })
  219. },
  220. bindPickerChange: function(e,index2) {
  221. if(e.detail.value==0){
  222. this.questionList[index2].t1='缺口数';
  223. this.questionList[index2].t1s= '请填写缺口数';
  224. this.questionList[index2].t1d= '人';
  225. }else if(e.detail.value==1){
  226. this.questionList[index2].t1='缺口数';
  227. this.questionList[index2].t1s= '请填写缺口数';
  228. this.questionList[index2].t1d= '万元';
  229. }else if(e.detail.value==2){
  230. this.questionList[index2].t1='缺口数';
  231. this.questionList[index2].t1s= '请填写缺口数';
  232. this.questionList[index2].t1d= '';
  233. }else{
  234. this.questionList[index2].t1='';
  235. this.questionList[index2].t1s= '';
  236. this.questionList[index2].t1d= '';
  237. }
  238. this.questionList[index2].qTypeindex = e.detail.value;
  239. this.questionList[index2].qType=this.parkList[e.detail.value]
  240. },
  241. // 获取上传进度
  242. progress(e) {
  243. console.log('上传进度:', e)
  244. },
  245. // 上传成功
  246. success(e) {
  247. console.log('上传成功')
  248. },
  249. // 上传失败
  250. fail(e) {
  251. console.log('上传失败:', e)
  252. },
  253. deleteFile(e) {
  254. this.picUrl.splice(e.index, 1)
  255. },
  256. // 获取上传状态
  257. select(e) {
  258. console.log('选择文件:', e)
  259. var _this = this
  260. var i = 0
  261. upload()
  262. function upload() {
  263. if (i >= e.tempFiles.length) {
  264. return;
  265. }
  266. var item = e.tempFiles[i]
  267. uni.showLoading({
  268. title: "上传中",
  269. mask: true
  270. });
  271. uni.uploadFile({
  272. url: '/yd_qycpfb/file/upload?uploadPath=userdir', // 仅为示例,非真实的接口地址
  273. filePath: item.url,
  274. name: 'file',
  275. formData: {
  276. 'fileName': item.name
  277. },
  278. header: {
  279. 'token': _this.$auth.getUserToken()
  280. },
  281. success: (res) => {
  282. var data = res.data
  283. if (typeof data['error'] != "undefined") {
  284. uni.showToast({
  285. icon: 'none',
  286. title: '上传失败,请联系开发!'
  287. });
  288. _this.$refs.picFile.clearFiles(_this.picLists.length)
  289. } else {
  290. _this.picUrl.push({
  291. url: data,
  292. uuid: item.uuid
  293. })
  294. i++;
  295. upload()
  296. }
  297. },
  298. fail: () => {
  299. uni.hideLoading();
  300. uni.showToast({
  301. icon: 'none',
  302. title: '上传失败,请联系开发!'
  303. });
  304. _this.$refs.picFile.clearFiles(_this.picLists.length)
  305. },
  306. complete: function() {
  307. uni.hideLoading();
  308. }
  309. });
  310. }
  311. },
  312. save(){
  313. },
  314. formSubmit: function(e) {
  315. uni.showLoading()
  316. this.inputForm.des6 = [];
  317. this.picUrl.forEach(item => {
  318. this.inputForm.des6.push(item.url)
  319. })
  320. this.inputForm.des6 = this.inputForm.des6.toString();
  321. loginService.productSave(this.inputForm).then(({
  322. data
  323. }) => {
  324. uni.showToast({
  325. title: "产品供需发布成功!",
  326. icon: "success"
  327. });
  328. uni.navigateTo({
  329. url: '/pages/product/productList?w=1'
  330. })
  331. }).catch((e) => {
  332. })
  333. },
  334. checkinput(){
  335. let cou=0;
  336. if(this.hasDuplicateQName(this.questionList)){
  337. }
  338. //this.questionList:[{qName:"",qType:"",qTypeindex:"",gaps:"",des:"",t1:"",t1s:""}],
  339. },
  340. hasDuplicateQName(array) {
  341. const seen = new Set();
  342. for (const item of array) {
  343. if (seen.has(item.qName)) {
  344. return true; // 找到重复的 qName
  345. }
  346. seen.add(item.qName);
  347. }
  348. return false; // 没有重复的 qName
  349. }
  350. }
  351. }
  352. </script>
  353. <style>
  354. /* .file-title) {
  355. font-size: 17px !important;
  356. } */
  357. input,textarea{
  358. color: #8799a3;
  359. }
  360. .input1{
  361. background-color: #ffffff;
  362. padding: 1upx 40upx;
  363. display: flex;
  364. align-items: center;
  365. padding-top: 20upx;
  366. border-bottom: 1px solid #eee;
  367. }
  368. .input1 .title {
  369. text-align: justify;
  370. padding-right: 30upx;
  371. font-size: 30upx;
  372. position: relative;
  373. height: 60upx;
  374. line-height: 60upx;
  375. border: ;
  376. }
  377. .title2{
  378. width: 75%;
  379. text-align: left;
  380. }
  381. .input2 {
  382. flex: 1;
  383. font-size: 30upx;
  384. color: #555;
  385. padding-right: 20upx;
  386. width: 500rpx;
  387. }
  388. .uni-input{
  389. }
  390. .textbg{
  391. display: flex;
  392. background-color: white;
  393. padding-top: 29rpx;
  394. }
  395. .text12{
  396. width: 200rpx;
  397. margin-left: 30rpx;
  398. color: #000000;
  399. font-size: 29rpx;
  400. }
  401. .text2{
  402. flex: 1;
  403. color: #000000;
  404. font-size: 30rpx;
  405. padding-bottom: 2rpx;
  406. }
  407. .text22{
  408. flex: 1;
  409. color: #666666;
  410. font-size: 29rpx;
  411. padding-bottom: 2rpx;
  412. align-self: flex-end;
  413. }
  414. .titlebg2{
  415. display: flex;
  416. background-color: white;
  417. padding-left: 22rpx;
  418. padding-top: 35rpx;
  419. padding-bottom: 25rpx;
  420. margin-bottom: 2rpx;
  421. }
  422. .titlet1{
  423. width: 7rpx;
  424. margin-top: 7rpx;
  425. margin-bottom: 7rpx;
  426. background-color: #2752eb;
  427. margin-right: 8rpx;
  428. }
  429. .titlet2{
  430. font-weight: 800;
  431. color: #2752eb;
  432. }
  433. .titlebb{
  434. color: #000000;
  435. font-weight: 800;
  436. padding-left: 40rpx;
  437. background-color: #ffffff;
  438. padding-top: 20rpx;
  439. }
  440. .flexC{
  441. display: flex;
  442. }
  443. .bt1{
  444. flex:1;
  445. margin: 30rpx;
  446. }
  447. .bt2{
  448. flex:1;
  449. margin: 30rpx;
  450. }
  451. </style>