当前位置:   article > 正文

element-ui. 表单组件封装_element ui 表单组件

element ui 表单组件

1.使用封装的from组件。组件见底部。

<FormQueryList ref="baseFormRef" :is-handle="false" :search-data="baseData" :search-form="searchForm" :form-rules="baseFormRules"></FormQueryList>
  1. baseFormRules: baseFormRulesVo, // 基本form表单校验
  2. baseData: {
  3. countersignType: 'B',
  4. countersignName: '',
  5. creatorName: '',
  6. applyDepartment: '',
  7. contact: '',
  8. applicantTime: '',
  9. settleCompanyName: ''
  10. },
  11. searchForm: [
  12. { type: 'Select', label: '类型', prop: 'countersignType', options: [], props: [], focus: (n) => { }, change: (row) => { this.changeType(row) }, placeholder: '请选择', noneRows: true, disabled: false },
  13. { type: 'Input', label: '会签名称', prop: 'countersignName', placeholder: '请输入', disabled: false },
  14. { type: 'Input', label: '申请人', prop: 'creatorName', disabled: true },
  15. { type: 'Input', label: '申请部门', prop: 'applyDepartment', disabled: true },
  16. { type: 'Input', label: '联系方式', prop: 'contact', disabled: true },
  17. { type: 'Input', label: '申请时间', prop: 'applicantTime', disabled: true },
  18. { type: 'Input', label: '所属公司', prop: 'settleCompanyName', disabled: true }
  19. ],

2.如果是循环的表单。验证必填

  1. <div v-for="(item,index) in bussinessItemLists" :key="index" class="param-arr">
  2. <div class="group-index">
  3. <FormQueryList ref="formRefOne" :is-handle="false" class="order-form" :search-data="item.businessData" :search-form="item.businessForm(item, index)" :form-rules="item.bussinessFormRules" :is-disabled="isDisabled"></FormQueryList>
  4. </div>
  5. </div>
  6. this.$refs.formRefOne.map(item => {
  7. item.$refs.searchForm.validate((valid) => {
  8. if (!valid) {
  9. count++
  10. return
  11. }
  12. })
  13. })

1.Form组件封装

  1. <template>
  2. <el-form ref="searchForm" :model="searchData" :rules="formRules" :disabled="isDisabled" size="mini" inline label-width="auto" class="search-forms" @submit.native.prevent>
  3. <el-form-item v-for="(item, index) in searchForm" :key="item.prop" :label="item.label" :prop="item.prop" :class="setFormClasses(item)" :tabindex="index">
  4. <!--自定义标题-->
  5. <template v-if="item.label2" slot="label">
  6. <div class="custom-label">
  7. <span>{{ item.label }}</span>
  8. <span class="label2" @click="labelToClickHandle(item, index)">{{ item.label2 }}</span>
  9. </div>
  10. </template>
  11. <!-- 输入框 -->
  12. <el-input
  13. v-if="item.type==='Input'"
  14. v-model="searchData[item.prop]"
  15. :dbc="item.dbc"
  16. :clearable="item.clearable"
  17. :title="item.isHideTitle ? '':searchData[item.prop]"
  18. :placeholder="item.placeholder"
  19. :disabled="item.disabled"
  20. :readonly="item.readingOnly"
  21. :maxlength="item.maxLength"
  22. :minlength="item.minLength"
  23. :max="item.max"
  24. :min="item.min"
  25. :type="item.inputWay?item.inputWay:'text'"
  26. :case="item.caseUpper?item.caseUpper:''"
  27. :trim="item.trim?item.trim:'trim'"
  28. @blur="setBlurHandle(item)"
  29. @focus="item.focus?item.focus(searchData[item.prop]):{}"
  30. @change="item.change?item.change(searchData[item.prop],itemIndex):{}"
  31. @input="item.input?item.input(searchData[item.prop]):{}"
  32. >
  33. <template v-if="item.isUnit" slot="append">{{ item.isUnit }}</template>
  34. <template v-if="item.hasIcons" slot="append">
  35. <div class="main-icons" @click="onClickSvgHandle(item, index)">
  36. <SvgIconFont :icon-class="item.hasIcons"></SvgIconFont>
  37. </div>
  38. </template>
  39. </el-input>
  40. <!-- 下拉框 -->
  41. <el-select
  42. v-if="item.type==='Select'&& item.customerDisplay === true"
  43. v-model="searchData[item.prop]"
  44. :clearable="!item.clearable"
  45. filterable
  46. :filter-method="item.dataFilter"
  47. :multiple="item.multiselect||false"
  48. :multiple-limit="item.multipleLimit||0"
  49. :disabled="item.disabled"
  50. allow-create
  51. @change="item.change?item.change(searchData[item.prop]):{}"
  52. @focus="item.focus?item.focus(index):{}"
  53. @clear="item.clear?item.clear(searchData[item.prop],itemIndex):{}"
  54. >
  55. <el-option
  56. v-for="op in item.options"
  57. :key="op.value || op.dictCode"
  58. :label="op.label || op.dictCode"
  59. :value="setBackSelectValue(item, op)"
  60. >
  61. <span style="float: left">{{ op.label || op.dictName }}</span>
  62. <span style="float: right; color: #8492a6; font-size: 13px">{{ op.value ||op.dictCode }}</span>
  63. </el-option>
  64. </el-select>
  65. <!-- 下拉框,不允许自己创建, -->
  66. <el-select
  67. v-if="item.type==='Select'&& item.customerDisplay !== true &&item.allowCreate!==true"
  68. v-model="searchData[item.prop]"
  69. :clearable="!item.clearable"
  70. filterable
  71. :multiple="item.multiselect||false"
  72. :multiple-limit="item.multipleLimit||0"
  73. :disabled="item.disabled"
  74. :placeholder="item.placeholder?item.placeholder:''"
  75. @change="item.change?item.change(searchData[item.prop]):{}"
  76. @focus="item.focus?item.focus(index):{}"
  77. @clear="item.clear?item.clear(searchData[item.prop],itemIndex):{}"
  78. >
  79. <el-option
  80. v-for="op in item.options"
  81. :key="op.value || op.dictCode ||op.baseCustomerId"
  82. :label="op.label || op.dictName||op.customerName"
  83. :value="setBackSelectValue(item, op)"
  84. >
  85. </el-option>
  86. </el-select>
  87. <el-popover
  88. v-if="item.label ==='企业分类' && showTips"
  89. v-model="visible"
  90. placement="bottom"
  91. title=""
  92. width="800"
  93. trigger="click"
  94. @show="showCustomerGroup"
  95. > <el-table
  96. id="custmerGroupTable"
  97. ref="singleClassTable"
  98. :data="gridData"
  99. height="350"
  100. highlight-current-row
  101. @current-change="handleCurrentChange"
  102. @row-click="rowClick"
  103. >
  104. <el-table-column label="选择" width="50">
  105. <template slot-scope="scope">
  106. <el-radio v-model="radioIdSelect" :label="scope.row.id" @change.native="handleSelectionChange(scope.$index,scope.row)">&nbsp;</el-radio>
  107. </template>
  108. </el-table-column>
  109. <el-table-column width="150" property="className" label="企业分类"></el-table-column>
  110. <el-table-column property="classDes" label="描述"></el-table-column>
  111. </el-table>
  112. <div id="btnGrop" class="linebuttons">
  113. <el-button class="blue-border" @click="visible = false">取 消</el-button>
  114. <el-button type="primary" @click="confirmSelet">确 定</el-button>
  115. </div>
  116. <span slot="reference" class="iconfont icon-a-icon41 "></span>
  117. </el-popover>
  118. <!-- 下拉允许创建 -->
  119. <el-select
  120. v-if="item.type==='Select'&& item.allowCreate===true"
  121. v-model="searchData[item.prop]"
  122. :clearable="!item.clearable"
  123. filterable
  124. allow-create
  125. :multiple="item.multiselect||false"
  126. :multiple-limit="item.multipleLimit||0"
  127. :disabled="item.disabled"
  128. @change="item.change?item.change(searchData[item.prop]):{}"
  129. @focus="item.focus?item.focus(index):{}"
  130. @clear="item.clear?item.clear(searchData[item.prop],itemIndex):{}"
  131. >
  132. <el-option
  133. v-for="op in item.options"
  134. :key="op.value || op.dictCode "
  135. :label="op.label || op.dictName "
  136. :value="setBackSelectValue(item, op)"
  137. >
  138. </el-option>
  139. </el-select>
  140. <!-- 下拉框含索引 -->
  141. <el-select
  142. v-if="item.type==='SelectHasIndex'"
  143. v-model="searchData[item.prop]"
  144. clearable
  145. filterable
  146. :multiple="item.multiselect||false"
  147. :multiple-limit="item.multipleLimit||0"
  148. :disabled="item.disabled"
  149. @change="(val)=>setSelectChange(val,searchData[item.prop],itemIndex,item)"
  150. @focus="item.focus?item.focus(index):{}"
  151. >
  152. <el-option
  153. v-for="op in item.options"
  154. :key="op.value || op.dictCode"
  155. :label="op.label || op.dictName"
  156. :value="setBackSelectValue(item, op)"
  157. ></el-option>
  158. </el-select>
  159. <!--联想控件-->
  160. <el-associate
  161. v-if="item.type==='Associate'"
  162. v-model="searchData[item.prop]"
  163. :popper-class="item.popperClass ? item.popperClass: ''"
  164. :columns="item.columns"
  165. :clearable="true"
  166. :dbc="item.dbc===false?item.dbc:true"
  167. :multiple="item.multiple"
  168. :multiple-limit="item.multipleLimit||0"
  169. :disabled="item.disabled"
  170. :value-prop="item.valueProp"
  171. :label-prop="item.labelProp"
  172. :display-init="item.displayInit ?searchData[item.displayInit]:searchData[item.prop]"
  173. :records-key="item.recordsKey"
  174. :total-key="item.totalKey"
  175. :keep-input-value="true"
  176. :init-search-keep-value="true"
  177. :query-method="item.queryMethod"
  178. :placeholder="item.placeholder"
  179. :popper-append-to-body="false"
  180. :allow-create="item.allowCreate?item.allowCreate:false"
  181. :allow-create-when-not-empty="item.allowCreateWhenNotEmpty?item.allowCreateWhenNotEmpty:false"
  182. :title="searchData[item.title]||searchData[item.prop]"
  183. :default-first-option="true"
  184. @visible-change="(val)=>item.visibleChange?item.visibleChange(val):{}"
  185. @change="(val,row)=>setAssociateChange(val,row,item,itemIndex)"
  186. @blur="(val)=>item.blur?item.blur(val):{}"
  187. @createMethod="(val)=>item.createMethod?item.createMethod(val):{}"
  188. ></el-associate>
  189. <!-- 单选 -->
  190. <el-radio-group
  191. v-if="item.type==='Radio'"
  192. v-model="searchData[item.prop]"
  193. @change="item.change && item.change(searchData[item.prop])"
  194. >
  195. <el-radio
  196. v-for="ra in item.radios"
  197. :key="ra.value"
  198. :label="ra.value"
  199. :disabled="item.disabled || ra.disabled"
  200. >{{ ra.label }}</el-radio>
  201. </el-radio-group>
  202. <!-- 单选按钮 -->
  203. <el-radio-group
  204. v-if="item.type==='RadioButton'"
  205. v-model="searchData[item.prop]"
  206. @change="item.change && item.change(searchData[item.prop])"
  207. >
  208. <el-radio-button
  209. v-for="ra in item.radios"
  210. :key="ra.value"
  211. :label="ra.value"
  212. :disabled="item.disabled"
  213. >{{ ra.label }}</el-radio-button>
  214. </el-radio-group>
  215. <!-- 复选框 -->
  216. <el-checkbox-group
  217. v-if="item.extraSingle"
  218. v-model="searchData[item.extraSingle.prop]"
  219. class="none-border"
  220. >
  221. <el-checkbox
  222. v-for="ch in item.extraSingle.checkboxs"
  223. :key="ch.value || ch.dictCode"
  224. :label="ch.value || ch.dictCode"
  225. >{{ ch.label || ch.dictName }}</el-checkbox>
  226. </el-checkbox-group>
  227. <el-checkbox-group
  228. v-if="item.type==='Checkbox'"
  229. v-model="searchData[item.prop]"
  230. >
  231. <el-checkbox
  232. v-for="ch in item.checkboxs"
  233. :key="ch.value || ch.dictCode||ch.uldCode"
  234. :label="ch.value || ch.dictCode||ch.uldCode"
  235. :disabled="item.disabled||ch.disabled"
  236. @change="item.change ? item.change(searchData[item.prop]) : {}"
  237. >{{ ch.label || ch.dictName ||ch.uldCode }}</el-checkbox>
  238. </el-checkbox-group>
  239. <!-- 日期-不带时分秒 -->
  240. <el-date-picker
  241. v-if="item.type==='Date'"
  242. v-model="searchData[item.prop]"
  243. :title="searchData[item.prop]"
  244. style="width: 100%"
  245. :value-format="setFormatDate(item.formatDate)"
  246. :format="setFormatHandle(item.formatType)"
  247. :disabled="item.disabled"
  248. :placeholder="item.placeholder"
  249. :picker-options="localPickerOptions(item)"
  250. @change="item.change?item.change(searchData[item.prop]):{}"
  251. ></el-date-picker>
  252. <!-- 时间 -->
  253. <el-time-select
  254. v-if="item.type==='Time'"
  255. v-model="searchData[item.prop]"
  256. :title="searchData[item.prop]"
  257. style="width: 100%"
  258. type=""
  259. :disabled="item.disabled"
  260. @change="item.change?item.change(searchData[item.prop]):{}"
  261. ></el-time-select>
  262. <!-- 日期时间-带时分秒或时分 -->
  263. <el-date-picker
  264. v-if="item.type==='DateTime'"
  265. v-model="searchData[item.prop]"
  266. :title="searchData[item.prop]"
  267. style="width: 100%"
  268. type="datetime"
  269. :value-format="setFormatDateTime(item.formatDate)"
  270. :format="setFormatTimeHandle(item.formatType)"
  271. :disabled="item.disabled"
  272. placeholder="选择日期时间"
  273. :picker-options="dateTimePickerOptions(item)"
  274. @change="item.change?item.change(searchData[item.prop]):{}"
  275. @onClick="item.onClick?item.change(searchData[item.prop]):{}"
  276. ></el-date-picker>
  277. <!--精确到分-->
  278. <el-date-picker
  279. v-if="item.type==='DateTimeMM'"
  280. v-model="searchData[item.prop]"
  281. style="width: 100%"
  282. type="datetime"
  283. :value-format="setFormatDateTimeMM(item.formatDate)"
  284. :format="setFormatTimeMM(item.formatType)"
  285. :disabled="item.disabled"
  286. :picker-options="dateTimePickerOptions(item)"
  287. placeholder="选择日期时间"
  288. @change="item.change?item.change(searchData[item.prop]):{}"
  289. ></el-date-picker>
  290. <!-- 滑块 -->
  291. <el-slider
  292. v-if="item.type==='Slider'"
  293. v-model="searchData[item.prop]"
  294. :disabled="item.disabled"
  295. ></el-slider>
  296. <!-- 开关 -->
  297. <el-switch
  298. v-if="item.type==='Switch'"
  299. v-model="searchData[item.prop]"
  300. :disabled="item.disabled"
  301. ></el-switch>
  302. <!--textarea文本框-->
  303. <el-input
  304. v-if="item.type==='TextArea'"
  305. v-model="searchData[item.prop]"
  306. :title="searchData[item.prop]"
  307. type="textarea"
  308. resize="none"
  309. :autosize="item.autosize || { minRows: 2, maxRows: 10}"
  310. :placeholder="item.placeholder"
  311. :maxlength="item.maxLength"
  312. :minlength="item.minLength"
  313. :disabled="item.disabled ? item.disabled : false"
  314. :show-word-limit="item.showWordLimit ? item.showWordLimit : false"
  315. @blur="setBlurHandle(item)"
  316. @input="(val)=>textInput(val,searchData[item.prop],itemIndex,item)"
  317. >
  318. </el-input>
  319. <!--按钮及icon-->
  320. <SvgIconFont
  321. v-if="item.type==='SvgIcon'"
  322. :icon-class="item.svgIconFont"
  323. class="form-svgicon"
  324. @click.native="item.click?item.click(searchData[item.prop]):{}"
  325. ></SvgIconFont>
  326. <!--控件左上角图标-->
  327. <SvgIconFont
  328. v-if="item.SvgIcon"
  329. :icon-class="item.svgIconFont"
  330. class="item-svg-icon-font"
  331. @click.native="item.svgIconClick?item.svgIconClick():{}"
  332. ></SvgIconFont>
  333. </el-form-item>
  334. <template v-if=" isHandle || isHandle&&!hideHandleBtn&&(unLoadOrder||appendQuery||isPlat||unMblNo||unQuo||unBuyBoard) ">
  335. <div class="btn-checkbox" :class="{ 'width-two' : isHandle&&!hideHandleBtn&&(unLoadOrder||appendQuery||isPlat||unMblNo||unQuo||unBuyBoard) }">
  336. <!--追加查询,过滤退载订单-->
  337. <el-form-item v-if="isHandle&&!hideHandleBtn&&(unLoadOrder||appendQuery||isPlat||unMblNo||unQuo||unBuyBoard)" label="none" class="form-checkbox operator-button">
  338. <el-checkbox v-if="isPlat === true" v-model="searchData.isPlat">过滤自打板</el-checkbox>
  339. <el-checkbox v-if="unLoadOrder === true" v-model="searchData.unLoadOrder" style="margin-right: 10px">过滤退载订单</el-checkbox>
  340. <el-checkbox v-if="unMblNo === true" v-model="searchData.unMblNo">过滤空主单号</el-checkbox>
  341. <el-checkbox v-if="appendQuery === true" v-model="searchData.appendQuery">追加查询</el-checkbox>
  342. <el-checkbox v-if="unQuo === true" v-model="searchData.unQuotation">过滤作废报价单</el-checkbox>
  343. <el-checkbox v-if="unBuyBoard === true" v-model="searchData.unBuyBoard">过滤作废临时买板</el-checkbox>
  344. </el-form-item>
  345. <!--查询按钮-->
  346. <template v-if="isHandle">
  347. <el-form-item v-show="!hideHandleBtn" label="none" class="form-button operator-button">
  348. <el-button
  349. v-for="item in searchHandle"
  350. :key="item.label"
  351. :type="item.type"
  352. size="mini"
  353. :class="item.class"
  354. @click.native="item.handle({item,searchData})"
  355. >{{ item.label }}</el-button>
  356. </el-form-item>
  357. </template>
  358. </div>
  359. </template>
  360. <!--列表查询展开收缩icon-->
  361. <template v-if="showIcon">
  362. <div v-if="isHandle && (hideTwoRow || searchForm.length > 12)" class="more-icons" @click="dropdownHandles">
  363. <img :src="setIconFontsSty" alt="more">
  364. </div>
  365. </template>
  366. </el-form>
  367. </template>
  368. <script>
  369. import { mapGetters } from 'vuex'
  370. import { trimHandle, formatDate } from '@/utils/commonss'
  371. import moment from 'moment'
  372. export default {
  373. name: 'FormQueryList',
  374. props: {
  375. itemIndex: {
  376. type: Number
  377. },
  378. isDisabled: {
  379. type: Boolean,
  380. default: false
  381. }, // 整个表单禁用
  382. isHandle: {
  383. type: Boolean,
  384. default: true
  385. }, // 是否有查询按钮
  386. unfoldHideHandle: {
  387. type: Boolean,
  388. default: false
  389. }, // 自定义收缩时:是否隐藏查询按钮
  390. labelWidth: {
  391. type: String,
  392. default: '100px'
  393. },
  394. size: {
  395. type: String,
  396. default: 'mini'
  397. },
  398. showTips: {
  399. type: Boolean,
  400. default: false
  401. },
  402. selectGroupId: {
  403. type: String,
  404. default: ''
  405. },
  406. searchForm: {
  407. type: Array,
  408. default: () => []
  409. }, // 表单控件
  410. searchHandle: {
  411. type: Array,
  412. default: () => []
  413. }, // 操作按钮
  414. searchData: {
  415. type: Object,
  416. default: () => {}
  417. }, // 表单数据变量
  418. formRules: {
  419. type: Object,
  420. default: () => {}
  421. }, // 表单校验
  422. appendQuery: {
  423. type: Boolean,
  424. default: false
  425. },
  426. unMblNo: {
  427. type: Boolean,
  428. default: false
  429. },
  430. unLoadOrder: {
  431. type: Boolean,
  432. default: false
  433. },
  434. isPlat: {
  435. type: Boolean,
  436. default: false
  437. },
  438. unQuo: {
  439. type: Boolean,
  440. default: false
  441. },
  442. unBuyBoard: {
  443. type: Boolean,
  444. default: false
  445. },
  446. showIcon: {
  447. type: Boolean,
  448. default: true
  449. },
  450. // hideHandleBtn: {
  451. // type: Boolean,
  452. // default: false
  453. // },
  454. hideTwoRow: {
  455. type: Boolean,
  456. default: false
  457. },
  458. unfoldForm: {
  459. type: Boolean,
  460. default: false
  461. } // 自定义展开还是收缩
  462. },
  463. data() {
  464. return {
  465. currentRow: null,
  466. visible: false,
  467. radioIdSelect: '',
  468. comboBox: {},
  469. gridData: [],
  470. // gridData: [{
  471. // id: 'A',
  472. // className: '民营企业',
  473. // classDes: '我国民营企业界定从广义上看,民营只与国有独资企业相对,而与任何非国有独资企业是相容的,包括国有持股和控股企业。因此,归纳民营企业的概念就是:非国有独资企业均为民营企业。从狭义的角度来看,“民营企业”仅指私营企业和以私营企业为主体的联营企业。'
  474. // },
  475. // {
  476. // id: 'B',
  477. // className: '政府机构',
  478. // classDes: '在广义上指中央和地方的全部立法、行政、司法和官僚机关。狭义的政府机构仅指中央和地方的行政机关、官僚机关,即依照国家法律设立并享有行政权力、担负行政管理职能的部分国家机构。'
  479. // },
  480. // {
  481. // id: 'C',
  482. // className: '外资企业',
  483. // classDes: '泛指依照我国有关法律规定,在我国境内设立的由外国投资者独自投资经营的企业。'
  484. // },
  485. // {
  486. // id: 'D',
  487. // className: '境外企业',
  488. // classDes: '是指依照外国(地区)法律成立且实际管理机构不在中国境内,但在中国境内设立机构、场所的,或者在中国境内未设立机构、场所,但有来源于中国境内所得的企业。'
  489. // },
  490. // {
  491. // id: 'E',
  492. // className: '国有企业及国有控股企业',
  493. // classDes: '1) 国有企业是指企业全部资产归国家所有,并按规定登记注册的非公司制的经济组织。不包括有限责任公司中的国有独资公司。\n2) 国有控股企业是指在企业的全部资本中,国家资本股本占较高比例,并且由国家实际控制的企业。包括绝对控股企业和相对控股企业。国有绝对控股企业是指国家资本比例大于50%(含50%)的企业,包含未经改制的国有企业。国有相对控股企业是指国家资本比例不足50%,但相对高于企业中的其他经济成分所占比例的企业(相对控股),或者虽不大于其他经济成份,但根据协议规定,由国家拥有实际控制权的企业(协议控制)。对于企业由三方合资,其中两家为国有企业,国家资本之和超过50%的,在填报"国有经济控股"时,国家资本不能按两家之和来计算,而应按企业的实际控股或控制情况来填报。'
  494. // },
  495. // {
  496. // id: 'F',
  497. // className: '合资企业',
  498. // classDes: '合资企业是指以法人投资者的身份,由国家、企业、个人的名义进行投资组建的企业。'
  499. // },
  500. // {
  501. // id: 'G',
  502. // className: '事业单位',
  503. // classDes: '事业单位,是指国家为了社会公益目的,由国家机关举办或者其他组织利用国有资产举办的,从事教育、科技、文化、卫生等活动的社会服务组织。事业单位接受政府领导,表现形式为组织或机构的法人实体。'
  504. // },
  505. // {
  506. // id: 'H',
  507. // className: '东航物流内部关联',
  508. // classDes: '由东航物流公司直接或间接控股,或存在重大影响的公司关联企业。'
  509. // },
  510. // {
  511. // id: 'I',
  512. // className: '东航集团内部关联',
  513. // classDes: '由东航集团内物流集团外直接或间接控股,或存在重大影响的公司关联企业。'
  514. // },
  515. // {
  516. // id: 'J',
  517. // className: '其他关联方-国企',
  518. // classDes: '非东航物流内非东航集团内的直接或间接控股,或存在重大影响的国有企业及国有控股关联企业。'
  519. // },
  520. // {
  521. // id: 'K',
  522. // className: '其他关联方-民营',
  523. // classDes: '非东航物流内非东航集团内的直接或间接控股,或存在重大影响的民营关联企业。'
  524. // },
  525. // {
  526. // id: 'L',
  527. // className: '其他关联方-外资',
  528. // classDes: '非东航物流内非东航集团内的直接或间接控股,或存在重大影响的外资关联企业。'
  529. // },
  530. // {
  531. // id: 'M',
  532. // className: '其他',
  533. // classDes: '其他。'
  534. // }
  535. // ],
  536. showMoreForm: this.unfoldForm || false, // 默认收缩部分表单
  537. hideHandleBtn: this.unfoldShowHandle || false, // 收缩时:默认不隐藏查询重置区域按钮
  538. upMore: require('@/assets/systembac/up.svg'),
  539. downMore: require('@/assets/systembac/down.svg')
  540. }
  541. },
  542. computed: {
  543. /*
  544. // 查询条件列表(展开折叠)
  545. showSearchList: {
  546. get: function() {
  547. if (!this.showMoreForm && this.isHandle) {
  548. if (this.searchForm.length <= 12) {
  549. return this.searchForm
  550. }
  551. const newArr = [] // 存储数据
  552. const classList = [] // 存储两个合并一起
  553. let maxLength = 11 // 默认11
  554. for (let i = 0; i < maxLength; i++) {
  555. const item = this.searchForm[i]
  556. newArr.push(item)
  557. // 当有合并之后显示处理
  558. if (item.class) {
  559. maxLength = 11
  560. maxLength += (classList.length / 2)
  561. classList.push(i)
  562. }
  563. }
  564. return newArr
  565. }
  566. return this.searchForm
  567. },
  568. set: function(val) {
  569. this.showSearchList = val
  570. }
  571. },
  572. */
  573. ...mapGetters(['autoTableHeights']),
  574. // 设置收缩展开
  575. setIconFontsSty() {
  576. const self = this
  577. if (self.showMoreForm) {
  578. for (const i in this.searchForm) {
  579. if (self.searchForm[i].showMoreForm === 'hidden') {
  580. self.searchForm[i].showMoreForm = 'show'
  581. self.$set(self.searchForm[i], 'showMoreForm', self.searchForm[i].showMoreForm)
  582. }
  583. }
  584. return this.upMore
  585. } else {
  586. for (const j in self.searchForm) {
  587. if (self.searchForm[j].showMoreForm === 'show') {
  588. self.searchForm[j].showMoreForm = 'hidden'
  589. self.$set(self.searchForm[j], 'showMoreForm', self.searchForm[j].showMoreForm)
  590. }
  591. }
  592. return this.downMore
  593. }
  594. },
  595. // 设置form表单样式
  596. setFormClasses() {
  597. return (item) => {
  598. if (item.showMoreForm === 'hidden') {
  599. return 'hiddenNoneItems'
  600. }
  601. if (item.label === 'empty') {
  602. if (item.type === 'TextArea') {
  603. return 'emptyLabel textareaStyles'
  604. }
  605. return 'emptyLabel'
  606. }
  607. if (item.label === 'none') {
  608. if (item.type === 'TextArea') {
  609. return 'noneLabel textareaStyles'
  610. }
  611. if (item.class === 'bubbleCheckbox') {
  612. return 'noneLabel bubbleCheckbox'
  613. }
  614. return 'noneLabel'
  615. }
  616. if (item.class === 'harf') {
  617. if (item.type === 'TextArea') {
  618. return 'harfLabel textareaStyles'
  619. }
  620. if (item.bubbleInp === 'bubbleInp') {
  621. return 'harfLabel bubbleInp'
  622. }
  623. return 'harfLabel'
  624. }
  625. if (item.label === 'check') {
  626. if (item.type === 'TextArea') {
  627. return 'checkLabel textareaStyles'
  628. }
  629. return 'checkLabel'
  630. }
  631. if (item.hasIcons) {
  632. return 'hasIcons'
  633. }
  634. if (item.class) {
  635. if (item.type === 'TextArea') {
  636. return item.class + ' textareaStyles'
  637. }
  638. return item.class
  639. }
  640. if (item.type === 'TextArea') {
  641. return 'textareaStyles'
  642. }
  643. return ''
  644. }
  645. },
  646. // 设置时间格式-可传formatDate属性-所得值类型
  647. setFormatDate() {
  648. return (val) => {
  649. if (val) {
  650. return val
  651. }
  652. return 'yyyy-MM-dd'
  653. }
  654. },
  655. // 设置时间格式-可传formatType属性
  656. // 所显示类型,如显示yyyy/MM/dd
  657. setFormatHandle() {
  658. return (val) => {
  659. if (val) {
  660. return val
  661. }
  662. return 'yyyy-MM-dd'
  663. }
  664. },
  665. // 设置时间格式-可传formatDate属性-所得值类型
  666. setFormatDateTime() {
  667. return (val) => {
  668. if (val) {
  669. return val
  670. }
  671. return 'yyyy-MM-dd HH:mm:ss'
  672. }
  673. },
  674. // 设置时间格式-可传formatType属性
  675. // 所显示类型,如显示yyyy/MM/dd
  676. setFormatTimeHandle() {
  677. return (val) => {
  678. if (val) {
  679. return val
  680. }
  681. return 'yyyy-MM-dd HH:mm:ss'
  682. }
  683. },
  684. setFormatTimeMM() {
  685. return (val) => {
  686. if (val) {
  687. return val
  688. }
  689. return 'yyyy-MM-dd HH:mm'
  690. }
  691. },
  692. setFormatDateTimeMM() {
  693. return (val) => {
  694. if (val) {
  695. return val
  696. }
  697. return 'yyyy-MM-dd HH:mm'
  698. }
  699. },
  700. // 年月日-不带时分秒
  701. // 设置时间控制-开始时间小于结束时间,结束时间大于开始时间
  702. localPickerOptions() {
  703. const self = this
  704. return (item) => {
  705. const shortcuts = [
  706. {
  707. text: '今天',
  708. onClick(picker) {
  709. picker.$emit('pick', new Date())
  710. }
  711. }, {
  712. text: '昨天',
  713. onClick(picker) {
  714. const date = new Date()
  715. date.setTime(date.getTime() - 3600 * 1000 * 24)
  716. picker.$emit('pick', date)
  717. }
  718. }, {
  719. text: '一周前',
  720. onClick(picker) {
  721. const date = new Date()
  722. date.setTime(date.getTime() - 3600 * 1000 * 24 * 7)
  723. picker.$emit('pick', date)
  724. }
  725. }
  726. ]
  727. // 禁用所有日期
  728. if (item.timeType && item.timeType.disabledAllDate) {
  729. return {
  730. // 设置快捷选项
  731. shortcuts,
  732. // 设置不能选择的日期
  733. disabledDate: (time) => {
  734. return true
  735. }
  736. }
  737. }
  738. // 限制自定义区间
  739. if (item.timeType && item.timeType.definedInterval) {
  740. const { start, end } = item.timeType.definedInterval
  741. return {
  742. // 设置快捷选项
  743. shortcuts,
  744. // 设置不能选择的日期
  745. disabledDate: (time) => {
  746. const startTime = new Date(start).getTime()
  747. const endTime = new Date(end).getTime()
  748. return time.getTime() < startTime - 8.64e7 || time.getTime() > endTime
  749. }
  750. }
  751. }
  752. // 限制一个月30天时间内:limitMonth: true
  753. if (item.timeType && item.timeType.limitMonth) {
  754. return {
  755. // 设置快捷选项
  756. shortcuts,
  757. // 设置不能选择的日期
  758. onPick: ({ maxDate, minDate }) => {
  759. self.searchData[item.timeType.time] = minDate.getTime()
  760. if (maxDate) {
  761. self.searchData[item.timeType.time] = ''
  762. }
  763. },
  764. disabledDate: (time) => {
  765. const compareTime = self.searchData[item.timeType.time]
  766. const choiceDateTime = new Date(compareTime)
  767. if (compareTime) {
  768. if (item.timeType.way === 'start') {
  769. const preMonth = moment(choiceDateTime).subtract(1, 'months').format()
  770. const preMontDate = new Date(preMonth) - 8.64e7
  771. return time.getTime() < preMontDate || time.getTime() > choiceDateTime.getTime()
  772. } else {
  773. const nextMonth = moment(choiceDateTime).add(1, 'months').format()
  774. const nextMontDate = new Date(nextMonth)
  775. return time.getTime() < (choiceDateTime - 8.64e7) || time.getTime() > nextMontDate
  776. }
  777. }
  778. }
  779. }
  780. }
  781. // 限制一周七天以内:limitWeek: true
  782. if (item.timeType && item.timeType.limitWeek) {
  783. return {
  784. // 设置快捷选项
  785. shortcuts,
  786. // 设置不能选择的日期
  787. onPick: ({ maxDate, minDate }) => {
  788. self.searchData[item.timeType.time] = minDate.getTime()
  789. if (maxDate) {
  790. self.searchData[item.timeType.time] = ''
  791. }
  792. },
  793. disabledDate: (time) => {
  794. const week = 7 * 24 * 60 * 60 * 1000
  795. const choiceDateTime = new Date(self.searchData[item.timeType.time])
  796. if (self.searchData[item.timeType.time]) {
  797. if (item.timeType.way === 'start') {
  798. return time.getTime() < (choiceDateTime.getTime() - week) || time.getTime() > choiceDateTime.getTime()
  799. } else {
  800. return time.getTime() < (choiceDateTime - 8.64e7) || time.getTime() > (choiceDateTime.getTime() + week - 8.64e7)
  801. }
  802. }
  803. }
  804. }
  805. }
  806. // 限制两周14天以内:twoWeek: true
  807. if (item.timeType && item.timeType.twoWeek) {
  808. return {
  809. // 设置快捷选项
  810. shortcuts,
  811. // 设置不能选择的日期
  812. onPick: ({ maxDate, minDate }) => {
  813. self.searchData[item.timeType.time] = minDate.getTime()
  814. if (maxDate) {
  815. self.searchData[item.timeType.time] = ''
  816. }
  817. },
  818. disabledDate: (time) => {
  819. const week = 14 * 24 * 60 * 60 * 1000
  820. const choiceDateTime = new Date(self.searchData[item.timeType.time])
  821. if (self.searchData[item.timeType.time]) {
  822. if (item.timeType.way === 'start') {
  823. return time.getTime() < (choiceDateTime.getTime() - week) || time.getTime() > choiceDateTime.getTime()
  824. } else {
  825. return time.getTime() < (choiceDateTime - 8.64e7) || time.getTime() > (choiceDateTime.getTime() + week - 8.64e7)
  826. }
  827. }
  828. }
  829. }
  830. }
  831. // 限制90天以内:limitMonthNine: true
  832. if (item.timeType && item.timeType.limitMonthNine) {
  833. return {
  834. // 设置快捷选项
  835. shortcuts,
  836. // 设置不能选择的日期
  837. onPick: ({ maxDate, minDate }) => {
  838. self.searchData[item.timeType.time] = minDate.getTime()
  839. if (maxDate) {
  840. self.searchData[item.timeType.time] = ''
  841. }
  842. },
  843. disabledDate: (time) => {
  844. const monthNine = 90 * 24 * 60 * 60 * 1000
  845. const choiceDateTime = new Date(self.searchData[item.timeType.time])
  846. if (self.searchData[item.timeType.time]) {
  847. if (item.timeType.way === 'start') {
  848. return time.getTime() < (choiceDateTime.getTime() - monthNine) || time.getTime() > choiceDateTime.getTime()
  849. } else {
  850. return time.getTime() < (choiceDateTime - 8.64e7) || time.getTime() > (choiceDateTime.getTime() + monthNine - 8.64e7)
  851. }
  852. }
  853. }
  854. }
  855. }
  856. if (item.timeType && item.timeType.limit180Day) {
  857. return {
  858. // 设置快捷选项
  859. shortcuts,
  860. // 设置不能选择的日期
  861. onPick: ({ maxDate, minDate }) => {
  862. self.searchData[item.timeType.time] = minDate.getTime()
  863. if (maxDate) {
  864. self.searchData[item.timeType.time] = ''
  865. }
  866. },
  867. disabledDate: (time) => {
  868. const monthNine = 180 * 24 * 60 * 60 * 1000
  869. const choiceDateTime = new Date(self.searchData[item.timeType.time])
  870. if (self.searchData[item.timeType.time]) {
  871. if (item.timeType.way === 'start') {
  872. return time.getTime() < (choiceDateTime.getTime() - monthNine) || time.getTime() > choiceDateTime.getTime()
  873. } else {
  874. return time.getTime() < (choiceDateTime - 8.64e7) || time.getTime() > (choiceDateTime.getTime() + monthNine - 8.64e7)
  875. }
  876. }
  877. }
  878. }
  879. }
  880. // 限制大于等于当前时间且限制开始时间小于结束时间及结束时间大于开始时间:
  881. // 参数限定:greaterNowTime: true
  882. if (item.timeType && item.timeType.greaterNowTime) {
  883. return {
  884. // 设置快捷选项
  885. shortcuts,
  886. // 设置不能选择的日期
  887. onPick: ({ maxDate, minDate }) => {
  888. self.searchData[item.timeType.time] = minDate.getTime()
  889. if (maxDate) {
  890. self.searchData[item.timeType.time] = ''
  891. }
  892. },
  893. disabledDate: (time) => {
  894. const choiceDateTime = new Date(self.searchData[item.timeType.time]).getTime()
  895. const nowTimes = Date.now() - 8.64e7
  896. if (self.searchData[item.timeType.time]) {
  897. if (item.timeType.way === 'start') {
  898. return (time.getTime() < nowTimes) || (time.getTime() >= choiceDateTime)
  899. } else {
  900. return (time.getTime() < nowTimes) || (time.getTime() < (choiceDateTime - 8.64e7))
  901. }
  902. } else {
  903. return time.getTime() < nowTimes
  904. }
  905. }
  906. }
  907. }
  908. // 限制开始时间小于结束时间,结束时间大于开始时间:
  909. if (item.timeType) {
  910. return {
  911. // 设置快捷选项
  912. shortcuts,
  913. // 设置不能选择的日期
  914. onPick: ({ maxDate, minDate }) => {
  915. self.searchData[item.timeType.time] = minDate.getTime()
  916. if (maxDate) {
  917. self.searchData[item.timeType.time] = ''
  918. }
  919. },
  920. disabledDate: (time) => {
  921. const choiceDateTime = new Date(self.searchData[item.timeType.time]).getTime()
  922. if (self.searchData[item.timeType.time]) {
  923. if (item.timeType.way === 'start') {
  924. return time.getTime() >= choiceDateTime
  925. } else {
  926. return time.getTime() < (choiceDateTime - 8.64e7)
  927. }
  928. }
  929. }
  930. }
  931. } else {
  932. return {
  933. // 设置快捷选项
  934. shortcuts
  935. }
  936. }
  937. }
  938. },
  939. // 年月日 时分秒-带时分秒或时分
  940. // 设置时间控制-开始时间小于结束时间,结束时间大于开始时间
  941. dateTimePickerOptions(item) {
  942. const self = this
  943. return (item) => {
  944. // 限制一个月30天时间内:limitMonth: true
  945. if (item.timeType && item.timeType.limitMonth) {
  946. return {
  947. // 设置不能选择的日期
  948. onPick: ({ maxDate, minDate }) => {
  949. self.searchData[item.timeType.time] = minDate.getTime()
  950. if (maxDate) {
  951. self.searchData[item.timeType.time] = ''
  952. }
  953. },
  954. disabledDate: (time) => {
  955. const month = 30 * 24 * 60 * 60 * 1000
  956. const choiceDateTime = new Date(self.searchData[item.timeType.time])
  957. if (self.searchData[item.timeType.time]) {
  958. if (item.timeType.way === 'start') {
  959. return time.getTime() < (choiceDateTime.getTime() - month) || time.getTime() > choiceDateTime.getTime()
  960. } else {
  961. return time.getTime() < choiceDateTime || time.getTime() > choiceDateTime.getTime() + month
  962. }
  963. }
  964. }
  965. }
  966. }
  967. // 限制一周七天以内:limitWeek: true
  968. if (item.timeType && item.timeType.limitWeek) {
  969. return {
  970. // 设置不能选择的日期
  971. onPick: ({ maxDate, minDate }) => {
  972. self.searchData[item.timeType.time] = minDate.getTime()
  973. if (maxDate) {
  974. self.searchData[item.timeType.time] = ''
  975. }
  976. },
  977. disabledDate: (time) => {
  978. const week = 7 * 24 * 60 * 60 * 1000
  979. const choiceDateTime = new Date(self.searchData[item.timeType.time])
  980. if (self.searchData[item.timeType.time]) {
  981. if (item.timeType.way === 'start') {
  982. return time.getTime() < (choiceDateTime.getTime() - week) || time.getTime() > choiceDateTime.getTime()
  983. } else {
  984. return time.getTime() < (choiceDateTime - 8.64e7) || time.getTime() > (choiceDateTime.getTime() + week - 8.64e7)
  985. }
  986. }
  987. }
  988. }
  989. }
  990. // 限制开始时间小于结束时间及结束时间大于开始时间:
  991. // 参数限定:greaterFlightTime: true, 不限当前时间, 限航班日期
  992. // 限制起飞时间大于等于航班日期,到达时间大于等于航班日期:hasFlightDate-航班日期
  993. if (item.timeType && item.timeType.greaterFlightTime && item.timeType.hasFlightDate) {
  994. return {
  995. // 设置不能选择的日期
  996. onPick: ({ maxDate, minDate }) => {
  997. self.searchData[item.timeType.time] = minDate.getTime()
  998. if (maxDate) {
  999. self.searchData[item.timeType.time] = ''
  1000. }
  1001. },
  1002. disabledDate: (time) => {
  1003. const choiceDateTime = new Date(self.searchData[item.timeType.time]).getTime()
  1004. const flightDt = formatDate(item.timeType.hasFlightDate)
  1005. if (self.searchData[item.timeType.time]) {
  1006. if (item.timeType.way === 'start') {
  1007. return (time.getTime() < flightDt) || (time.getTime() > choiceDateTime)
  1008. } else {
  1009. return (time.getTime() < flightDt) || (time.getTime() < (choiceDateTime - 8.64e7))
  1010. }
  1011. } else {
  1012. return time.getTime() < flightDt
  1013. }
  1014. }
  1015. }
  1016. }
  1017. // 限制大于等于当前时间且限制开始时间小于结束时间及结束时间大于开始时间:
  1018. // 参数限定:greaterNowTime: true, 限当前时间和航班日期
  1019. // 限制起飞时间大于等于航班日期,到达时间大于等于航班日期:hasFlightDate-航班日期
  1020. if (item.timeType && item.timeType.greaterNowTime && item.timeType.hasFlightDate) {
  1021. return {
  1022. // 设置不能选择的日期
  1023. onPick: ({ maxDate, minDate }) => {
  1024. self.searchData[item.timeType.time] = minDate.getTime()
  1025. if (maxDate) {
  1026. self.searchData[item.timeType.time] = ''
  1027. }
  1028. },
  1029. disabledDate: (time) => {
  1030. const choiceDateTime = new Date(self.searchData[item.timeType.time]).getTime()
  1031. let nowTimes = Date.now() - 8.64e7
  1032. const flightDt = formatDate(item.timeType.hasFlightDate)
  1033. if (nowTimes < flightDt) {
  1034. nowTimes = flightDt
  1035. }
  1036. if (self.searchData[item.timeType.time]) {
  1037. if (item.timeType.way === 'start') {
  1038. return (time.getTime() < nowTimes) || (time.getTime() > choiceDateTime)
  1039. } else {
  1040. return (time.getTime() < nowTimes) || (time.getTime() < (choiceDateTime - 8.64e7))
  1041. }
  1042. } else {
  1043. return time.getTime() < nowTimes
  1044. }
  1045. }
  1046. }
  1047. }
  1048. // 限制大于等于当前时间且限制开始时间小于结束时间及结束时间大于开始时间:
  1049. // 参数限定:greaterNowTime: true
  1050. if (item.timeType && item.timeType.greaterNowTime) {
  1051. return {
  1052. // 设置不能选择的日期
  1053. onPick: ({ maxDate, minDate }) => {
  1054. self.searchData[item.timeType.time] = minDate.getTime()
  1055. if (maxDate) {
  1056. self.searchData[item.timeType.time] = ''
  1057. }
  1058. },
  1059. disabledDate: (time) => {
  1060. const choiceDateTime = new Date(self.searchData[item.timeType.time]).getTime()
  1061. const nowTimes = Date.now() - 8.64e7
  1062. if (self.searchData[item.timeType.time]) {
  1063. if (item.timeType.way === 'start') {
  1064. return (time.getTime() < nowTimes) || (time.getTime() >= choiceDateTime)
  1065. } else {
  1066. return (time.getTime() < nowTimes) || (time.getTime() < (choiceDateTime - 8.64e7))
  1067. }
  1068. } else {
  1069. return time.getTime() < nowTimes
  1070. }
  1071. },
  1072. selectableRange: item.startTimeRange ? item.startTimeRange : ''
  1073. }
  1074. }
  1075. // 限制开始时间小于结束时间,结束时间大于开始时间:
  1076. if (item.timeType) {
  1077. if (item.timeType.way === 'start') {
  1078. return {
  1079. // 设置不能选择的日期
  1080. onPick: ({ maxDate, minDate }) => {
  1081. self.searchData[item.timeType.time] = minDate.getTime()
  1082. if (maxDate) {
  1083. self.searchData[item.timeType.time] = ''
  1084. }
  1085. },
  1086. disabledDate: (time) => {
  1087. const choiceDateTime = new Date(self.searchData[item.timeType.time]).getTime()
  1088. if (self.searchData[item.timeType.time]) {
  1089. if (item.timeType.way === 'start') {
  1090. return time.getTime() >= choiceDateTime
  1091. } else {
  1092. return time.getTime() < (choiceDateTime - 8.64e7)
  1093. }
  1094. }
  1095. },
  1096. selectableRange: item.startTimeRange ? item.startTimeRange : ''
  1097. }
  1098. } else {
  1099. return {
  1100. // 设置不能选择的日期
  1101. onPick: ({ maxDate, minDate }) => {
  1102. self.searchData[item.timeType.time] = minDate.getTime()
  1103. if (maxDate) {
  1104. self.searchData[item.timeType.time] = ''
  1105. }
  1106. },
  1107. disabledDate: (time) => {
  1108. const choiceDateTime = new Date(self.searchData[item.timeType.time]).getTime()
  1109. if (self.searchData[item.timeType.time]) {
  1110. if (item.timeType.way === 'beginning') {
  1111. return time.getTime() >= choiceDateTime
  1112. } else {
  1113. return time.getTime() <= (choiceDateTime - 8.64e7)
  1114. }
  1115. }
  1116. },
  1117. selectableRange: item.startTimeRange ? item.startTimeRange : ''
  1118. }
  1119. }
  1120. } else {
  1121. return {}
  1122. }
  1123. }
  1124. },
  1125. // 下拉框返回值逻辑处理:
  1126. // noneRows为true时只是拿到当前code
  1127. setBackSelectValue() {
  1128. return (item, op) => {
  1129. if (item.noneRows) {
  1130. return op.value || op.dictCode || op.baseCustomerId
  1131. }
  1132. return { value: op.value || op.dictCode, label: op.label || op.dictName, rows: op }
  1133. }
  1134. },
  1135. // 设置联想控件返回函数逻辑
  1136. setAssociateChange() {
  1137. return (val, row, item, itemIndex) => {
  1138. // 得到valueProp的值
  1139. if (item.noneRows) {
  1140. return item.change(val)
  1141. }
  1142. // 得到labelProp的值
  1143. if (item.onlyLable) {
  1144. return item.change(row[item.labelProp])
  1145. }
  1146. // 同时返回valueProp的值和labelProp的值
  1147. if (item.valAndLab) {
  1148. return item.change(val, row[item.labelProp])
  1149. }
  1150. // 默认得到整行数据
  1151. return item.change({ val, row, item, itemIndex })
  1152. }
  1153. },
  1154. // 下拉框chang
  1155. setSelectChange() {
  1156. return (val, row, itemIndex, item) => {
  1157. // 得到valueProp的值
  1158. if (item.noneRows) {
  1159. return item.change(val)
  1160. }
  1161. // 默认得到整行数据
  1162. return item.change({ row, itemIndex })
  1163. }
  1164. },
  1165. textInput() {
  1166. return (val, row, itemIndex, item) => {
  1167. // 得到valueProp的值
  1168. if (item.noneRows) {
  1169. return item.input(val)
  1170. }
  1171. // 默认得到整行数据
  1172. return item.input({ row, itemIndex })
  1173. }
  1174. },
  1175. // 设置输入框失焦事件-去除空格
  1176. setBlurHandle() {
  1177. return (item) => {
  1178. const self = this
  1179. if (!item.keepSpace) {
  1180. self.searchData[item.prop] = trimHandle(self.searchData[item.prop])
  1181. }
  1182. if (item.keepNumber) {
  1183. self.searchData[item.prop] = self.searchData[item.prop].replace(/[^0-9]/ig, '')
  1184. }
  1185. if (item.blur) {
  1186. return item.blur(trimHandle(self.searchData[item.prop]))
  1187. }
  1188. return {}
  1189. }
  1190. }
  1191. },
  1192. created() {
  1193. if (this.isHandle) {
  1194. this.$nextTick(() => {
  1195. const offsetTops = this.$refs.searchForm.$el.clientHeight
  1196. this.$store.dispatch('wayTracking/setSearchForms', offsetTops)
  1197. })
  1198. }
  1199. this.$dictionary.get(['CUSTOMER_GROUP'], true).then(res => {
  1200. for (const i in res) {
  1201. this.$set(this.comboBox, i, res[i])
  1202. }
  1203. this.customerGroupDict = this.comboBox['CUSTOMER_GROUP']
  1204. this.customerGroupDict.forEach((item) => {
  1205. if (item.isValid === true) {
  1206. const data = {
  1207. id: item.dictCode,
  1208. className: item.dictName,
  1209. classDes: item.remark
  1210. }
  1211. this.gridData.push(data)
  1212. }
  1213. })
  1214. })
  1215. },
  1216. methods: {
  1217. showCustomerGroup() {
  1218. this.radioIdSelect = this.selectGroupId
  1219. this.gridData.forEach((item) => {
  1220. if (item.id === this.radioIdSelect) {
  1221. this.setCurrent(item)
  1222. }
  1223. })
  1224. },
  1225. setCurrent(row) {
  1226. this.$nextTick(() => {
  1227. this.$refs.singleClassTable[0].setCurrentRow(row)
  1228. })
  1229. },
  1230. handleCurrentChange(val) {
  1231. this.currentRow = val
  1232. },
  1233. // 确定选择企业分类
  1234. confirmSelet() {
  1235. this.$emit('confirmCustomerGroup', this.radioIdSelect)
  1236. this.visible = false
  1237. },
  1238. // 单选框
  1239. handleSelectionChange(index, row) {
  1240. },
  1241. // // 企业分类下拉选择变化
  1242. // custmerGroupChange() {
  1243. // // this.radioIdSelect = this.formEnterpriseInfo.custmerGroup
  1244. // this.setCurrent(this.gridData[parseInt(this.radioIdSelect) - 1])
  1245. // },
  1246. rowClick(row) {
  1247. this.radioIdSelect = row.id
  1248. this.setCurrent(row)
  1249. },
  1250. // 收缩展开
  1251. dropdownHandles() {
  1252. this.showMoreForm = !this.showMoreForm
  1253. if (this.unfoldHideHandle) {
  1254. this.hideHandleBtn = !this.hideHandleBtn
  1255. }
  1256. this.$store.dispatch('wayTracking/setMoreFormTables', !this.autoTableHeights)
  1257. this.$nextTick(() => {
  1258. const offsetTops = this.$refs.searchForm.$el.clientHeight
  1259. this.$store.dispatch('wayTracking/setSearchForms', offsetTops)
  1260. this.$store.dispatch('wayTracking/setShowFormBool', this.showMoreForm)
  1261. // this.$emit('onDropClick', this.showMoreForm)
  1262. })
  1263. },
  1264. // label2触发事件
  1265. labelToClickHandle(item, index) {
  1266. this.$emit('labelToSubmit', { item, index })
  1267. },
  1268. // 按钮触发事件
  1269. onClickSvgHandle(item, index) {
  1270. this.$emit('onFormSvgIconClick', { item, index })
  1271. },
  1272. // 重置清空查询条件
  1273. resetForm() {
  1274. this.$nextTick(() => {
  1275. this.$refs.searchForm.resetFields()
  1276. })
  1277. }
  1278. }
  1279. }
  1280. </script>
  1281. <style lang="scss">
  1282. .search-forms {
  1283. position: relative;
  1284. .more-icons {
  1285. position: absolute;
  1286. left: 0;
  1287. right: 0;
  1288. bottom: -24px;
  1289. margin: auto;
  1290. z-index: 2;
  1291. width: 100px;
  1292. height: 30px;
  1293. &:hover {
  1294. cursor: pointer;
  1295. }
  1296. img {
  1297. display: block;
  1298. width: 100%;
  1299. height: 100%;
  1300. margin: auto;
  1301. }
  1302. }
  1303. .form-svgicon {
  1304. width: 25px !important;
  1305. height: 25px !important;
  1306. &:hover {
  1307. cursor: pointer;
  1308. }
  1309. }
  1310. .textareaStyles {
  1311. .el-form-item__content {
  1312. height: unset !important;
  1313. }
  1314. }
  1315. .el-form-item{
  1316. align-items: flex-end !important;
  1317. }
  1318. }
  1319. </style>
  1320. <style lang="scss" scoped>
  1321. // .making-task .search-forms .form-checkbox {
  1322. // margin-left: auto !important;
  1323. // }
  1324. .form-checkbox {
  1325. ::v-deep .el-form-item__label-wrap {
  1326. visibility: hidden;
  1327. }
  1328. }
  1329. .making-task .search-forms .form-checkbox ::v-deep .el-form-item__content {
  1330. justify-content: flex-end;
  1331. }
  1332. .making-task .btn-checkbox {
  1333. display: flex;
  1334. margin-left: auto;
  1335. width: 16.66%;
  1336. padding-right: 10px;
  1337. >.el-form-item {
  1338. width: 100%;
  1339. }
  1340. }
  1341. .making-task .width-two {
  1342. width: 33.32%;
  1343. >.el-form-item {
  1344. width: 50%;
  1345. }
  1346. }
  1347. .item-svg-icon-font {
  1348. position: absolute;
  1349. top: -21px;
  1350. left: 30%;
  1351. cursor: pointer;
  1352. }
  1353. #custmerGroupTable{
  1354. height: 300px ;
  1355. }
  1356. #custmerGroupTable ::v-deep th.is-leaf{
  1357. text-align: left !important;
  1358. background-color:#1C1D80 !important;
  1359. padding:5px 0 !important;
  1360. color:#fff;
  1361. }
  1362. #custmerGroupTable ::v-deep .cell.el-tooltip {
  1363. white-space: pre-wrap !important;
  1364. text-align: left !important;
  1365. }
  1366. #custmerGroupTable ::v-deep .el-radio__input.is-checked .el-radio__inner {
  1367. border-color: #1C1D80 !important;;
  1368. background: #1C1D80 !important;;
  1369. }
  1370. #btnGrop {
  1371. text-align: center;
  1372. padding-top: 10px;
  1373. .el-button:hover{
  1374. border-color: #1C1D80 !important;
  1375. color:#1C1D80 ;
  1376. background-color:#fff;
  1377. }
  1378. .el-button--primary{
  1379. border-color: #1C1D80 !important;;
  1380. background: #1C1D80 !important;;
  1381. }
  1382. .el-button--primary:hover{
  1383. color:#fff
  1384. }
  1385. }
  1386. .icon-a-icon41{
  1387. color: #FF5806;
  1388. margin-left: 4px;
  1389. }
  1390. .el-form-item.is-error .none-border {
  1391. border: 0px !important;
  1392. }
  1393. ::v-deep .selfAdaptionStyle {
  1394. right: 0px !important;
  1395. left: unset !important;
  1396. .popper__arrow{
  1397. left:unset !important;
  1398. right: 100px !important;
  1399. }
  1400. }
  1401. .making-task .search-forms {
  1402. .left-half {
  1403. width: 8.33%;
  1404. padding-right: 0;
  1405. }
  1406. .right-half {
  1407. width: 8.33%;
  1408. ::v-deep .el-form-item__label-wrap {
  1409. visibility: hidden;
  1410. }
  1411. }
  1412. }
  1413. .customer-item {
  1414. width: 33.33% !important;
  1415. }
  1416. </style>
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/我家自动化/article/detail/279786
推荐阅读
相关标签
  

闽ICP备14008679号