my_form.vue 35 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939
  1. <template>
  2. <view>
  3. <view class="requiredFieldOnly-head" v-if="requiredFieldOnly">
  4. <view class="label">
  5. 基本信息
  6. </view>
  7. <view class="content">
  8. 仅显示必填信息<text style="padding: 0 2.5px;" /> <u-switch activeColor="#C40C24" v-model="unShowAll" />
  9. </view>
  10. </view>
  11. <slot name="head" />
  12. <block v-for="(item, index) in list " :key="item.key">
  13. <block v-if="item.isMust || !unShowAll">
  14. <!-- 文本输入 -->
  15. <view class="input-box" v-if="item.type == 'text'"
  16. :style="{ marginTop: tovw(item.marginTop || 0), opacity: item.disabled ? 0.7 : 1 }"
  17. @click="focusLabel = item.label">
  18. <view class="box" :class="item.unBorBot ? '' : 'borBot'">
  19. <view class="label">
  20. <text class="must" v-if="item.isMust">*</text>
  21. {{ item.label }}:
  22. </view>
  23. <view class="content-box">
  24. <view class="content">
  25. <input v-if="item.inputmode == 'number'" type="number" :disabled="item.disabled"
  26. placeholder-style="color: #BBBBBB;font-family: Source Han Sans SC, Source Han Sans SC;"
  27. :focus="focusLabel == item.label" :placeholder="item.placeholder || '请填写' + item.label"
  28. :value="item.value" :style="{ width: item.value ? '220px' : '240px' }"
  29. @input="onInput($event, index)" :maxlength="item.maxlength || '499'"
  30. confirm-type="done" />
  31. <input v-else-if="item.inputmode == 'digit'" type="digit" :disabled="item.disabled"
  32. placeholder-style="color: #BBBBBB;font-family: Source Han Sans SC, Source Han Sans SC;"
  33. :focus="focusLabel == item.label" :placeholder="item.placeholder || '请填写' + item.label"
  34. :value="item.value" :style="{ width: item.value ? '220px' : '240px' }"
  35. @input="onInput($event, index)" :maxlength="item.maxlength || '499'"
  36. confirm-type="done" />
  37. <textarea v-else :disabled="item.disabled"
  38. placeholder-style="color: #BBBBBB;font-family: Source Han Sans SC, Source Han Sans SC;"
  39. auto-height type="text" :focus="focusLabel == item.label"
  40. :placeholder="item.placeholder || '请填写' + item.label" :value="item.value"
  41. :style="{ width: item.value ? '220px' : '240px' }" @input="onInput($event, index)"
  42. :maxlength="item.maxlength || '499'" confirm-type="done" />
  43. <icon v-if="item.value && !item.disabled" class="icon" type="clear" size="3.733vw"
  44. @click="onClearInput(index)" />
  45. </view>
  46. <view v-if="item.errText" class="err-text">
  47. <icon class="icon" color="#E3041F" type="clear" size="2.733vw" />
  48. {{ item.errText }}
  49. </view>
  50. </view>
  51. </view>
  52. </view>
  53. <!-- 文本域 -->
  54. <view class="textarea-box" v-else-if="item.type == 'textarea'">
  55. <textarea class="textarea" :class="item.unBorBot ? '' : 'borBot'" :disabled="item.disabled"
  56. placeholder-style="color: #BBBBBB;font-family: Source Han Sans SC, Source Han Sans SC;" type="text"
  57. :placeholder="item.placeholder || '请填写' + item.label" :value="item.value"
  58. @input="onInput($event, index)" :maxlength="item.maxlength || '499'" confirm-type="done" />
  59. </view>
  60. <!-- 自定义选项分类 -->
  61. <view class="custom-class-box" v-else-if="item.type == 'customClass'"
  62. :style="{ marginTop: tovw(item.marginTop || 0) }">
  63. <view class="head">
  64. <view class="label">
  65. <text class="must" style="color: #E3041F;" v-if="item.isMust">*</text>
  66. {{ item.label }}
  67. </view>
  68. <view class="state">
  69. {{ item.isMultipleChoice ? '可多选' : '仅单选' }}
  70. </view>
  71. </view>
  72. <view class="options">
  73. <view class="option"
  74. :class="item.isMultipleChoice ? (item.value.includes(option.value) ? 'active' : '') : (item.value == option.value ? 'active' : '')"
  75. v-for=" option in item.list " :key="option.value" hover-class="navigator-hover"
  76. @click="changOptions(option.value, index)">
  77. {{ option.remarks }}
  78. </view>
  79. </view>
  80. </view>
  81. <!-- 选择所在地区 -->
  82. <picker class="region" @change="selectRegion($event, index)" mode='region' :disabled="item.disabled"
  83. :value="item.value" v-else-if="item.type == 'region'"
  84. :style="{ marginTop: tovw(item.marginTop || 0), opacity: item.disabled ? 0.7 : 1 }">
  85. <view class="box" :class="item.unBorBot ? '' : 'borBot'">
  86. <view class="label">
  87. <text class="must" v-if="item.isMust">*</text>
  88. {{ item.label }}:
  89. </view>
  90. <view class="content-box">
  91. <view class="value" v-if="item.value.length">
  92. {{ item.value.join(",") }}
  93. </view>
  94. <view v-else class="placeholder" hover-class="none">
  95. {{ item.placeholder || '请选择' + item.label }}
  96. </view>
  97. <view v-if="!item.disabled" class="iconfont icon-a-wodetiaozhuan" />
  98. </view>
  99. </view>
  100. </picker>
  101. <!-- 日期 -->
  102. <picker class="region" @change="selectRegion($event, index)" mode='date' :disabled="item.disabled"
  103. :value="item.value" v-else-if="item.type == 'date'"
  104. :style="{ marginTop: tovw(item.marginTop || 0), opacity: item.disabled ? 0.7 : 1 }">
  105. <view class="box" :class="item.unBorBot ? '' : 'borBot'">
  106. <view class="label">
  107. <text class="must" v-if="item.isMust">*</text>
  108. {{ item.label }}:
  109. </view>
  110. <view class="content-box">
  111. <view class="value" v-if="item.value">
  112. {{ item.value }}
  113. </view>
  114. <view v-else class="placeholder" hover-class="none">
  115. {{ item.placeholder || '请选择' + item.label }}
  116. </view>
  117. <view v-if="!item.disabled" class="iconfont icon-a-wodetiaozhuan" />
  118. </view>
  119. </view>
  120. </picker>
  121. <!-- 上传附件 -->
  122. <view class="custom-class-box" v-else-if="item.type == 'upload'"
  123. :style="{ marginTop: tovw(item.marginTop || 0) }">
  124. <view class="head">
  125. <view class="label">
  126. <text class="must" v-if="item.isMust">*</text>
  127. {{ item.label }}
  128. </view>
  129. <view class="state">
  130. {{ item.placeholder }}
  131. </view>
  132. </view>
  133. <view class="content">
  134. <view class="file-box" v-for="file in item.value" :key="file.attachmentid">
  135. <image class="image" v-if="file.fileType == 'image'" :src="file.url" mode="aspectFill"
  136. lazy-load="true" @click="previewImg(file)" />
  137. <video v-else-if="file.fileType == 'video'" class="video" :poster="file.subfiles[0].url"
  138. :src="file.url" />
  139. <image class="delete" @click.stop="deleteFile(file, index)"
  140. src="https://yossys06593.obs.cn-east-3.myhuaweicloud.com:443/202404241713944430197B47af9b2f.png"
  141. mode="widthFix" />
  142. </view>
  143. <My_upload v-if="item.allowUpload" :showLoading="false" :maxCount="item.maxCount || 99"
  144. :accept="item.accept" @uploadCallback="uploadCallback($event, index)"
  145. @onLoading="onUploadLoading($event, index)">
  146. <view class="upload-box"
  147. v-if="item.maxCount ? item.value.length != item.maxCount : item.value.length != 99"
  148. hover-class="navigator-hover">
  149. <u-loading-icon v-if="item.loading" />
  150. <text v-else class="iconfont icon-xiazai" />
  151. <text style="margin-left: 5px;">上传</text>
  152. </view>
  153. </My_upload>
  154. </view>
  155. </view>
  156. <!-- 开关 -->
  157. <view class="region" v-else-if="item.type == 'switch'">
  158. <view class="box" :class="item.unBorBot ? '' : 'borBot'">
  159. <view class="label">
  160. <text class="must" v-if="item.isMust">*</text>
  161. {{ item.label }}:
  162. </view>
  163. <view class="content-box">
  164. <view />
  165. <u-switch activeColor="#70D95D" v-model="item.value" :disabled="item.disabled"
  166. @change="switchChange($event, index)" />
  167. </view>
  168. </view>
  169. </view>
  170. <!-- 性别 -->
  171. <view class="region" v-else-if="item.type == 'sex'">
  172. <view class="box" :class="item.unBorBot ? '' : 'borBot'">
  173. <view class="label">
  174. <text class="must" v-if="item.isMust">*</text>
  175. {{ item.label }}:
  176. </view>
  177. <u-radio-group v-model="item.value" placement="row" @change="groupChange($event, index)">
  178. <u-radio :customStyle="{ marginRight: tovw(60) }" label="男" name="男" />
  179. <u-radio label="女" name="女" />
  180. </u-radio-group>
  181. </view>
  182. </view>
  183. <!-- 单选 -->
  184. <view class="region" v-else-if="item.type == 'radio'">
  185. <view class="box" :class="item.unBorBot ? '' : 'borBot'">
  186. <view class="label">
  187. <text class="must" v-if="item.isMust">*</text>
  188. {{ item.label }}:
  189. </view>
  190. <u-radio-group v-model="item.value" :placement="item.placement || 'row'"
  191. @change="groupChange($event, index)">
  192. <u-radio v-for="option in item.options"
  193. :customStyle="{ marginRight: tovw(option.marginRight || item.marginRight || 0), marginTop: tovw(option.marginTop || item.marginTop || 0) }"
  194. :key="option.label" :label="option.label" :name="option.name" />
  195. </u-radio-group>
  196. </view>
  197. </view>
  198. <!-- 路由选择器 -->
  199. <view class="region" v-else-if="item.type == 'route'"
  200. :style="{ marginTop: tovw(item.marginTop || 0), opacity: item.disabled ? 0.7 : 1 }"
  201. @click="item.disabled ? '' : toRoute(item, index)">
  202. <view class="box" :class="item.unBorBot ? '' : 'borBot'">
  203. <view class="label">
  204. <text class="must" v-if="item.isMust">*</text>
  205. {{ item.label }}:
  206. </view>
  207. <view class="content-box">
  208. <view class="value" v-if="item.showValue.length">
  209. {{ item.showValue.join(",") }}
  210. </view>
  211. <view v-else class="placeholder" hover-class="none">
  212. {{ item.placeholder || '请选择' + item.label }}
  213. </view>
  214. <view v-if="!item.disabled" class="iconfont icon-a-wodetiaozhuan" />
  215. </view>
  216. </view>
  217. </view>
  218. <!-- 标签 -->
  219. <view class="tag-box custom-class-box " v-else-if="item.type == 'tag'"
  220. :style="{ marginTop: tovw(item.marginTop || 0) }">
  221. <text class="label">{{ item.label }}</text>
  222. <view class="tag-list">
  223. <view class="tag" v-for="tag in item.value" :key="tag">
  224. <text>{{ tag }}</text>
  225. <view @click="delTag(tag, index)" class="del">x</view>
  226. </view>
  227. <view>
  228. <u-modal :title="item.label" :show="showTagModal" style="flex: 0 !important;"
  229. confirmColor='#C30D23' ref="uModal" showCancelButton :asyncClose="false"
  230. @confirm="addTagSend(index)" @cancel="showTagModal = false">
  231. <view class="slot-content">
  232. <view v-if="item.errText" class="err-text" style="margin-bottom: 10px;">
  233. <icon class="icon" color="#E3041F" type="clear" size="2.733vw" />
  234. {{ item.errText }}
  235. </view>
  236. <u--input :focus="showUModal" @input="onTagInput($event, index)"
  237. :placeholder="item.placeholder || '请输入'" v-model="tagValue" border="bottom"
  238. clearable />
  239. </view>
  240. </u-modal>
  241. <view class="add-tag" @click="showTagModal = true">+ 添加</view>
  242. </view>
  243. </view>
  244. </view>
  245. </block>
  246. </block>
  247. </view>
  248. </template>
  249. <script>
  250. import { formattedFiles, viewImage } from "../utils/settleFiles.js"
  251. export default {
  252. name: "my_form",
  253. props: {
  254. form: {
  255. type: Array,
  256. default: []
  257. },
  258. isUncomplete: {
  259. type: Function
  260. },
  261. onUploading: {
  262. type: Function
  263. },
  264. requiredFieldOnly: {
  265. type: Boolean
  266. },
  267. isShowAll: {
  268. type: Function
  269. },
  270. interrupt: {
  271. type: Function
  272. }
  273. },
  274. data() {
  275. return {
  276. list: [],
  277. focusLabel: "",
  278. unShowAll: false,
  279. showTagModal: false,
  280. tagValue: ''
  281. }
  282. },
  283. watch: {
  284. form: {
  285. handler: function (newVal) {
  286. if (newVal) {
  287. this.list = JSON.parse(JSON.stringify(newVal));
  288. setTimeout(() => {
  289. this.verify()
  290. }, 200);
  291. }
  292. },
  293. immediate: true,
  294. },
  295. unShowAll: function (newVal) {
  296. this.$emit("isShowAll", newVal)
  297. }
  298. },
  299. async created() {
  300. /* let list = [{
  301. key: "name",
  302. type: "text",
  303. label: "标题",
  304. isMust: true,//是否必填
  305. value: "",
  306. inputmode:"", //https://uniapp.dcloud.net.cn/component/input.html#type
  307. marginTop: 10,
  308. verify:[],
  309. }, {
  310. key: "Class",
  311. type: "customClass",
  312. label: "标题",
  313. isMust: false,//是否必填
  314. isMultipleChoice: true,//是否多选
  315. value: [],// 多选[] 单选 ""
  316. isMust: true,//是否必填
  317. list: await this.getCustomClass('picturespace'),
  318. marginTop: 10
  319. },{
  320. key: "attachmentids",
  321. type: "upload",
  322. label: "图片/视频",
  323. accept:"all",
  324. placeholder: "可上传多个视频或图片",
  325. ownertable: "temporary",
  326. ownerid: 999,
  327. usetype: 'default',
  328. allowUpload: true,
  329. allowDelete: true,
  330. value:[],
  331. marginTop: 10
  332. }, {
  333. key: "region",
  334. type: "region",
  335. label: "所在地区",
  336. isMust: true,//是否必填
  337. value: [],
  338. }, {
  339. key: "address",
  340. type: "textarea",
  341. label: "详细地址",
  342. isMust: true,//是否必填
  343. value: '',
  344. }, {
  345. key: "isdefault",
  346. type: "switch",
  347. label: "设为默认地址",
  348. isMust: false,//是否必填
  349. value: false,
  350. isNum: true,
  351. unBorBot: true
  352. }] */
  353. },
  354. methods: {
  355. delTag(tag, index) {
  356. let item = this.list[index];
  357. console.log(tag);
  358. item.value.splice(item.value.indexOf(tag), 1)
  359. this.$set(this.list[index], 'value', item.value)
  360. },
  361. addTagSend(index) {
  362. let item = this.list[index]
  363. if (!item.errText) {
  364. item.value.push(this.tagValue)
  365. this.$set(this.list[index], 'value', item.value)
  366. this.tagValue = ''
  367. this.showTagModal = false
  368. }
  369. },
  370. toRoute(item, index) {
  371. let url = item.path;
  372. if (item.showValue.length) {
  373. let obj = JSON.stringify({
  374. value: item.value,
  375. showValue: item.showValue
  376. })
  377. url += (url.indexOf("?") == -1 ? '?alreadySelecteds=' : '&alreadySelecteds=') + obj
  378. }
  379. uni.navigateTo({
  380. url
  381. });
  382. this.$Http.routeSelected = function (selected) {
  383. this.$emit('interrupt', item, selected, index)
  384. delete this.$Http.routeSelected;
  385. }.bind(this)
  386. },
  387. onTagInput(e, index) {
  388. let item = this.list[index];
  389. item.errText = "";
  390. if (item.verify && item.verify.length && this.tagValue != '') {
  391. let err = item.verify.find(r => !new RegExp(r.reg).test(this.tagValue));
  392. if (err) this.$set(this.list[index], 'errText', err.errText)
  393. }
  394. this.verify()
  395. },
  396. onInput(e, index) {
  397. let item = this.list[index];
  398. item.errText = "";
  399. this.$set(this.list[index], 'value', e.detail.value)
  400. if (item.verify && item.verify.length && item.value != '') {
  401. let err = item.verify.find(r => !new RegExp(r.reg).test(item.value));
  402. if (err) this.$set(this.list[index], 'errText', err.errText)
  403. }
  404. this.verify()
  405. },
  406. setItem(index, item, back = false) {
  407. this.$set(this.list, index, item)
  408. this.verify()
  409. if (back) uni.navigateBack();
  410. },
  411. setValue(index, value, back = false) {
  412. this.$set(this.list[index], 'value', value)
  413. this.verify()
  414. if (back) uni.navigateBack();
  415. },
  416. onClearInput(index) {
  417. let item = this.list[index];
  418. item.errText = ''
  419. this.$set(this.list[index], 'value', '')
  420. this.verify()
  421. },
  422. switchChange(e, index) {
  423. this.$set(this.list[index], 'value', e)
  424. this.verify()
  425. },
  426. changOptions(value, index) {
  427. let item = this.list[index];
  428. if (item.isMultipleChoice) {
  429. let i = -1;
  430. try {
  431. i = item.value.findIndex(v => v == value)
  432. } catch (error) {
  433. }
  434. if (i == -1) {
  435. item.value.push(value)
  436. } else {
  437. item.value.splice(i, 1)
  438. }
  439. this.$set(this.list[index], 'value', item.value)
  440. } else {
  441. this.$set(this.list[index], 'value', value)
  442. }
  443. this.verify()
  444. },
  445. verify() {
  446. let list = this.list.filter(v => v.isMust);
  447. let Uncomplete = false;
  448. if (list.length) Uncomplete = list.some(v => {
  449. let res = false;
  450. if (v.type == 'customClass') {
  451. if (v.isMultipleChoice) {
  452. res = v.value.length == 0;
  453. } else {
  454. res = v.value == "";
  455. }
  456. } else if (v.type == 'upload') {
  457. res = v.value.length == 0;
  458. } else if (v.type == 'text') {
  459. res = v.value == "";
  460. if (v.errText) res = true;
  461. } else if (v.type == 'route') {
  462. res = v.showValue.length == 0;
  463. } else {
  464. res = v.value == "";
  465. }
  466. return res
  467. })
  468. if (!Uncomplete) Uncomplete = this.list.filter(v => !v.isMust).some(v => v.errText);
  469. this.$emit("isUncomplete", Uncomplete)
  470. },
  471. previewImg(item) {
  472. viewImage(item.url)
  473. },
  474. uploadCallback(attachmentids, index) {
  475. let item = this.list[index];
  476. this.$Http.basic({
  477. "classname": "system.attachment.Attachment",
  478. "method": "createFileLink",
  479. "content": {
  480. ownertable: item.ownertable,
  481. ownerid: item.ownerid,
  482. usetype: item.usetype,
  483. attachmentids
  484. }
  485. }).then(res => {
  486. console.log('绑定附件', res)
  487. if (this.cutoff(res.msg)) return;
  488. res.data = formattedFiles(res.data)
  489. item.value.push(res.data[0]);
  490. //临时文件
  491. if (res.data[0].ownertable == "temporary") try {
  492. item.temporarys.push(attachmentids[0])
  493. } catch (error) {
  494. item.temporarys = [attachmentids[0]]
  495. }
  496. this.$set(this.list[index], 'value', item.value)
  497. this.verify()
  498. })
  499. },
  500. deleteFiles() {
  501. this.list.forEach(v => {
  502. if (v.type == 'upload') {
  503. let linksids = v.value.filter(v => v.ownertable == "temporary").map(v => v.linksid)
  504. if (linksids.length) this.$Http.basic({
  505. "classname": "system.attachment.Attachment",
  506. "method": "deleteFileLink",
  507. "content": {
  508. linksids
  509. }
  510. }).then(res => {
  511. console.log("处理删除附件", res)
  512. if (this.cutoff(res.msg)) return;
  513. });
  514. }
  515. });
  516. },
  517. onUploadLoading(e, index) {
  518. this.$set(this.list[index], 'loading', e)
  519. this.$emit("onUploading", e)
  520. },
  521. groupChange(e, index) {
  522. this.$set(this.list[index], 'loading', e)
  523. this.verify()
  524. },
  525. selectRegion({ detail }, index) {
  526. this.$set(this.list[index], 'value', detail.value)
  527. this.verify()
  528. },
  529. deleteFile(flie, index) {
  530. let item = this.list[index];
  531. item.value = item.value.filter(v => v.attachmentid != flie.attachmentid)
  532. //临时文件
  533. if (flie.ownertable == "temporary") {
  534. item.temporarys = item.temporarys.filter(v => v != flie.attachmentid)
  535. this.$Http.basic({
  536. "classname": "system.attachment.Attachment",
  537. "method": "deleteFileLink",
  538. "content": {
  539. linksids: [flie.linksid]
  540. }
  541. }).then(res => {
  542. console.log("处理删除附件", res)
  543. if (this.cutoff(res.msg)) return;
  544. });
  545. } else {
  546. try {
  547. item.linksids.push(flie.linksid)
  548. } catch (error) {
  549. item.linksids = [flie.linksid]
  550. }
  551. }
  552. this.$set(this.list[index], 'value', item.value)
  553. this.verify()
  554. },
  555. submit() {
  556. return new Promise((resolve, reject) => {
  557. let res = {};
  558. this.list.forEach(v => {
  559. if (v.type == 'upload') {
  560. res.files = {
  561. temporarys: [],
  562. linksids: [],
  563. }
  564. try {
  565. res.files.temporarys = v.temporarys || []
  566. } catch (error) {
  567. }
  568. try {
  569. res.files.linksids = v.linksids || []
  570. } catch (error) {
  571. }
  572. } else if (v.type == 'region') {
  573. if (v.value.length) {
  574. res.province = v.value[0];
  575. res.city = v.value[1];
  576. res.county = v.value[2];
  577. } else {
  578. res.province = ''
  579. res.city = ''
  580. res.county = ''
  581. }
  582. } else if (v.type == 'switch') {
  583. if (v.isNum) {
  584. res[v.key] = v.value ? 1 : 0;
  585. } else {
  586. res[v.key] = v.value;
  587. }
  588. } else if (v.type == 'route') {
  589. if (v.isRadio) {
  590. const routeValue = typeof v.value.length == 'number' ? v.value.length ? v.value[0] : '' : v.value || {}
  591. if (v.keys) {
  592. v.keys.forEach(e => {
  593. res[e] = routeValue ? routeValue[e] || '' : ''
  594. })
  595. } else {
  596. res[v.key] = {
  597. name: v.showValue[0] || '',
  598. value: routeValue
  599. };
  600. }
  601. } else {
  602. res[v.key] = {
  603. name: v.showValue || [],
  604. value: v.value || []
  605. };;
  606. }
  607. } else {
  608. try {
  609. res[v.key] = v.value.trim();
  610. } catch (error) {
  611. res[v.key] = v.value;
  612. }
  613. }
  614. })
  615. resolve(res)
  616. })
  617. }
  618. },
  619. }
  620. </script>
  621. <style lang="scss">
  622. .requiredFieldOnly-head {
  623. display: flex;
  624. align-items: center;
  625. justify-content: space-between;
  626. width: 100vw;
  627. height: 45px;
  628. background: #F7F7F7;
  629. padding: 0 10px;
  630. box-sizing: border-box;
  631. .label {
  632. font-family: PingFang SC, PingFang SC;
  633. font-weight: bold;
  634. font-size: 15px;
  635. color: #333333;
  636. line-height: 22px;
  637. }
  638. .content {
  639. display: flex;
  640. align-items: center;
  641. font-family: PingFang SC, PingFang SC;
  642. font-size: 14px;
  643. color: #999999;
  644. }
  645. }
  646. .borBot {
  647. border-bottom: 1px #DDDDDD solid;
  648. }
  649. .custom-class-box {
  650. width: 100%;
  651. background: #fff;
  652. padding: 15px 0 15px 10px;
  653. box-sizing: border-box;
  654. .head {
  655. width: 355px;
  656. height: 20px;
  657. display: flex;
  658. justify-content: space-between;
  659. align-items: flex-end;
  660. .label {
  661. font-size: 14px;
  662. color: #333333;
  663. line-height: 20px;
  664. }
  665. .state {
  666. font-family: Source Han Sans SC, Source Han Sans SC;
  667. font-size: 12px;
  668. color: #999999;
  669. }
  670. }
  671. .options {
  672. display: flex;
  673. flex-wrap: wrap;
  674. .option {
  675. padding: 6px 10px;
  676. text-align: center;
  677. min-width: 81px;
  678. font-family: PingFang SC, PingFang SC;
  679. font-size: 14px;
  680. color: #333333;
  681. border-radius: 5px;
  682. background: #F2F2F2;
  683. margin-top: 10px;
  684. margin-right: 10px;
  685. box-sizing: border-box;
  686. }
  687. .active {
  688. background: #C30D23;
  689. color: #fff;
  690. }
  691. }
  692. .content {
  693. .file-box {
  694. position: relative;
  695. width: 355px;
  696. height: 240px;
  697. margin-top: 10px;
  698. .video,
  699. .image {
  700. width: 355px;
  701. height: 240px;
  702. border-radius: 5px;
  703. }
  704. .delete {
  705. position: absolute;
  706. width: 30px;
  707. top: 0;
  708. right: 0;
  709. z-index: 1;
  710. }
  711. }
  712. .upload-box {
  713. display: flex;
  714. justify-content: center;
  715. align-items: center;
  716. width: 355px;
  717. height: 45px;
  718. background: #FFFFFF;
  719. border-radius: 5px;
  720. border: 1px dashed #C30D23;
  721. font-family: Source Han Sans SC, Source Han Sans SC;
  722. font-size: 14px;
  723. color: #C30D23;
  724. margin-top: 10px;
  725. }
  726. }
  727. }
  728. .textarea-box {
  729. width: 100%;
  730. .textarea {
  731. width: 355px;
  732. height: 160px;
  733. padding: 15px 10px;
  734. box-sizing: border-box;
  735. margin: 0 auto;
  736. }
  737. }
  738. .input-box {
  739. width: 100vw;
  740. background: #fff;
  741. box-sizing: border-box;
  742. padding-left: 10px;
  743. .box {
  744. display: flex;
  745. width: 100%;
  746. min-height: 54.4px;
  747. padding: 15px 0;
  748. box-sizing: border-box;
  749. align-items: center;
  750. }
  751. .label {
  752. width: 100px;
  753. margin-right: 10px;
  754. line-height: 20px;
  755. font-family: Source Han Sans SC, Source Han Sans SC;
  756. font-size: 14px;
  757. color: #666666;
  758. flex-shrink: 0;
  759. .must {
  760. color: #E3041F;
  761. margin-right: 5px;
  762. }
  763. }
  764. .content-box {
  765. padding-right: 10px;
  766. .content {
  767. flex: 1;
  768. display: flex;
  769. align-items: center;
  770. box-sizing: border-box;
  771. .icon {
  772. padding: 5px;
  773. }
  774. }
  775. .err-text {
  776. font-size: 12px;
  777. color: #E3041F;
  778. margin-bottom: -12px;
  779. .icon {
  780. margin-right: 2px;
  781. }
  782. }
  783. }
  784. }
  785. .region {
  786. width: 100vw;
  787. background: #fff;
  788. box-sizing: border-box;
  789. padding: 15px 0 0 10px;
  790. .box {
  791. display: flex;
  792. padding-bottom: 15px;
  793. padding-right: 10px;
  794. box-sizing: border-box;
  795. .label {
  796. width: 100px;
  797. margin-right: 10px;
  798. line-height: 20px;
  799. font-family: Source Han Sans SC, Source Han Sans SC;
  800. font-size: 14px;
  801. color: #666666;
  802. flex-shrink: 0;
  803. .must {
  804. color: #E3041F;
  805. margin-right: 5px;
  806. }
  807. }
  808. .content-box {
  809. flex: 1;
  810. display: flex;
  811. align-items: center;
  812. justify-content: space-between;
  813. height: 20px;
  814. line-height: 20px;
  815. .placeholder {
  816. font-family: Source Han Sans SC, Source Han Sans SC;
  817. font-size: 14px;
  818. color: #BBBBBB;
  819. }
  820. }
  821. }
  822. }
  823. .tag-box {
  824. .label {
  825. width: 100px;
  826. margin-right: 10px;
  827. line-height: 20px;
  828. font-family: Source Han Sans SC, Source Han Sans SC;
  829. font-size: 14px;
  830. color: #666666;
  831. flex-shrink: 0;
  832. .must {
  833. color: #E3041F;
  834. margin-right: 5px;
  835. }
  836. }
  837. .tag-list {
  838. display: flex;
  839. align-content: center;
  840. align-items: center;
  841. flex-wrap: wrap;
  842. font-family: PingFang SC, PingFang SC;
  843. margin-top: 10px;
  844. .err-text {
  845. font-size: 12px;
  846. color: #E3041F;
  847. margin-bottom: -12px;
  848. .icon {
  849. margin-right: 2px;
  850. }
  851. }
  852. .tag {
  853. padding: 6px 10px;
  854. background: #F2F2F2;
  855. border-radius: 5px 5px 5px 5px;
  856. margin-right: 10px;
  857. margin-bottom: 10px;
  858. font-weight: 400;
  859. font-size: 14px;
  860. color: #333333;
  861. display: flex;
  862. align-items: center;
  863. align-content: center;
  864. text-align: center;
  865. &:last-child {
  866. margin-right: 0 !important;
  867. }
  868. .del {
  869. margin-left: 10px;
  870. padding: 2px;
  871. }
  872. }
  873. .add-tag {
  874. border-radius: 5px 5px 5px 5px;
  875. border: 1px dashed #C30D23;
  876. padding: 6px 20px;
  877. color: #C30D23;
  878. font-weight: 400;
  879. margin-bottom: 10px;
  880. font-size: 14px;
  881. }
  882. }
  883. }
  884. </style>