questionAdd.vue 11 KB

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