¶Ô±ÈÐÂÎļþ |
| | |
| | | import detailMethods from './detailMethods.js'; |
| | | //ä¸å¡å¤çæ¹æ³,å
¨é¨å¯ä»¥ç±å¼åè¦ç |
| | | import serviceFilter from './serviceFilter.js'; |
| | | let methods = { |
| | | //彿·»å æ©å±ç»ä»¶gridHeader/gridBody/gridFooteråæç»modelHeader/modelBody/modelFooteræ¶ï¼ |
| | | //妿è¦è·åç¶çº§Vue对象,è¯·ä½¿ç¨æ¤æ¹æ³è¿è¡åè° |
| | | parentCall(fun) { |
| | | if (typeof fun != 'function') { |
| | | return console.log('æ©å±ç»ä»¶éè¦ä¼ å
¥ä¸ä¸ªåè°æ¹æ³æè½è·åç¶çº§Vue对象'); |
| | | } |
| | | fun(this); |
| | | }, |
| | | getCurrentAction() { |
| | | if (this.currentReadonly) { |
| | | return ''; |
| | | } |
| | | return '--' + (this.currentAction == this.const.ADD ? 'æ°å¢' : 'ç¼è¾'); |
| | | }, |
| | | quickSearchKeyPress($event) { |
| | | //æ¥è¯¢å段为inputæ¶ï¼æå车æ¥è¯¢ |
| | | if ($event.keyCode == 13) { |
| | | if (this.searchFormFields[this.singleSearch.field] != '') { |
| | | this.search(); |
| | | } |
| | | } |
| | | }, |
| | | getButtons() { |
| | | //çæViewGridçé¢çæä½æé®åæ´å¤é项 |
| | | let searchIndex = this.buttons.findIndex((x) => { |
| | | return x.value == 'Search'; |
| | | }); |
| | | //æ·»å é«çº§æ¥è¯¢ |
| | | let hasOneFormItem = |
| | | this.searchFormOptions.length == 1 && |
| | | this.searchFormOptions[0].length == 1; |
| | | if (searchIndex != -1 && !hasOneFormItem) { |
| | | this.buttons.splice(searchIndex + 1, 0, { |
| | | icon: this.fiexdSearchForm ? 'el-icon-refresh-left' : 'el-icon-search', |
| | | name: this.fiexdSearchForm ? 'éç½®' : 'é«çº§æ¥è¯¢', |
| | | plain: true, |
| | | type: this.buttons[searchIndex].type, |
| | | onClick: () => { |
| | | if (this.fiexdSearchForm) { |
| | | return this.resetSearch(); |
| | | } |
| | | this.searchBoxShow = !this.searchBoxShow; |
| | | } |
| | | }); |
| | | } |
| | | if (hasOneFormItem) { |
| | | this.fiexdSearchForm = false; |
| | | } |
| | | this.maxBtnLength += searchIndex == -1 ? 0 : 1; |
| | | // if (this.buttons.length <= this.maxBtnLength) { |
| | | // return this.buttons; |
| | | // } |
| | | // let btns = this.buttons.slice(0, this.maxBtnLength); |
| | | // btns[this.maxBtnLength - 1].last = true; |
| | | // return btns; |
| | | }, |
| | | extendBtn(btns, source) { |
| | | //btnsæéæé®ï¼source为æ©å±æé® |
| | | if (!btns || !(source && source instanceof Array)) { |
| | | return; |
| | | } |
| | | //sourceéè¿å¨è¡¨çæ©å±jsæä»¶ä¸buttonså¯¹åºæé®ç屿§indexå³å®æé®ææ¾ä½ç½® |
| | | source.forEach((x) => { |
| | | //éè¿æé®çIndex屿§ï¼æ¾å°æå®çä½ç½® |
| | | btns.splice(x.index == undefined ? btns.length : x.index, 0, x); |
| | | }); |
| | | // if (this.extend.buttons.view) { |
| | | // this.extend.buttons.view.forEach((x) => { |
| | | // //éè¿æé®çIndex屿§ï¼æ¾å°æå®çä½ç½® |
| | | // this.buttons.splice(x.index == undefined ? this.buttons.length : x.index, 0, x); |
| | | // }) |
| | | // } |
| | | }, |
| | | initBoxButtons() { |
| | | //åå§åViewGirdä¸å¼¹åºæ¡/æç»è¡¨æé® |
| | | let path = this.$route.path; |
| | | //éè¿èåè·åç¨æ·æå¯¹åºèåéè¦æ¾ç¤ºçæé® |
| | | let permissionButtons = this.permission.getButtons( |
| | | path, |
| | | null, |
| | | this.extend.tableAction, |
| | | this.table.name |
| | | ); |
| | | if (permissionButtons) { |
| | | //2020.03.31æ·»å æ·±æ·è´æé®ç» |
| | | permissionButtons.forEach((p) => { |
| | | let _obj = {}; |
| | | for (const key in p) { |
| | | _obj[key] = p[key]; |
| | | } |
| | | this.buttons.push(_obj); |
| | | }); |
| | | // this.buttons.push(...permissionButtons); |
| | | } |
| | | if (!this.extend) { |
| | | this.extend = {}; |
| | | } |
| | | if (!this.extend.buttons) { |
| | | this.extend.buttons = {}; |
| | | } |
| | | //æ¥è¯¢ç颿©å±æé®(æ©å±æé®å¯èªè¡éè¿è®¾ç½®æé®çIndex屿§æ¾ç¤ºå°å
·ä½ä½ç½®) |
| | | if (this.extend.buttons.view) { |
| | | this.extendBtn(this.buttons, this.extend.buttons.view); |
| | | } |
| | | |
| | | //å¼¹åºæ¡æé® |
| | | let boxButtons = []; |
| | | |
| | | let saveBtn = this.buttons.some((x) => { |
| | | if ( |
| | | x.value && |
| | | (x.value.toLowerCase() == this.const.ADD.toLowerCase() || |
| | | x.value.toLowerCase() == this.const.EDIT.toLowerCase()) |
| | | ) |
| | | return true; |
| | | }); |
| | | this.currentReadonly = !saveBtn; |
| | | //ä»è¡¨è¡¨æ ¼æä½æé® |
| | | let detailGridButtons = { |
| | | name: 'å·æ°', |
| | | type: 'info', |
| | | icon: 'el-icon-refresh', |
| | | onClick() { |
| | | //妿æç»è¡¨å½åçç¶æä¸ºæ°å»ºæ¶ï¼ç¦æ¢å·æ° |
| | | if (this.currentAction == this.const.ADD) { |
| | | return; |
| | | } |
| | | this.refreshRow(); |
| | | } |
| | | }; |
| | | |
| | | let importExcel = this.buttons.some((x) => { |
| | | if (x.value == this.const.IMPORT) return true; |
| | | }); |
| | | //妿æå¯¼å
¥æé,åéè¦åå§å导å
¥ç»ä»¶ |
| | | if (importExcel) { |
| | | this.upload.url = this.getUrl(this.const.IMPORT); |
| | | //å®ä¹ä¸è½½æ¨¡æ¿çæä»¶å |
| | | this.upload.template.fileName = this.table.cnName; |
| | | //å®ä¹ä¸è½½æ¨¡æ¿çUrlè·¯å¾ |
| | | this.upload.template.url = |
| | | this.http.ipAddress + this.getUrl(this.const.DOWNLOADTEMPLATE, true); |
| | | } |
| | | |
| | | // disabled |
| | | //妿å½åè§è²æ²¡æç¼è¾ææ°å»ºåè½ï¼æ¥çæç»æ¶å段设置å
¨é¨åªè¯» |
| | | //åªææç»è¡¨ï¼å°æç»è¡¨ä¹è®¾ç½®ä¸ºä¸å¯è½ç¼è¾ï¼å¹¶ä¸ä¸æ¾ç¤ºæ·»å è¡ãå é¤è¡ |
| | | if (!saveBtn) { |
| | | this.editFormOptions.forEach((row) => { |
| | | row.forEach((x) => { |
| | | x.disabled = true; |
| | | }); |
| | | }); |
| | | //æ²¡ææ°å¢ç¼è¾æéçï¼å¼¹åºæ¡é½è®¾ç½®ä¸ºåªè¯» |
| | | this.detail.columns.forEach((column) => { |
| | | if (column.hasOwnProperty('edit')) { |
| | | column.readonly = true; |
| | | // row['edit'] = false; |
| | | } |
| | | }); |
| | | //å¼¹åºæ¡æ©å±æé® |
| | | this.extendBtn(boxButtons, this.extend.buttons.box); |
| | | //å¼¹åºå¼¹æ¡æé®(2020.04.21),没æç¼è¾ææ°å»ºæéæ¶ï¼ä¹å¯ä»¥éè¿buttons屿§æ·»å èªå®ä¹å¼¹åºæ¡æé® |
| | | this.boxButtons.push(...boxButtons); |
| | | this.detailOptions.buttons.push(detailGridButtons); |
| | | this.detailOptions.buttons.forEach((button) => { |
| | | if (!button.hasOwnProperty('hidden')) { |
| | | button.hidden = false; |
| | | } |
| | | }); |
| | | //å¼¹åºæ¡æ©å±æç»è¡¨æé® |
| | | this.extendBtn(this.detailOptions.buttons, this.extend.buttons.detail); |
| | | |
| | | return boxButtons; |
| | | } |
| | | |
| | | this.detailOptions.edit = true; |
| | | boxButtons.push( |
| | | ...[ |
| | | { |
| | | name: 'ä¿ å', |
| | | icon: 'el-icon-check', |
| | | type: 'danger', |
| | | disabled: false, |
| | | value: 'save', |
| | | onClick() { |
| | | this.save(); |
| | | } |
| | | } |
| | | // { |
| | | // name: 'é ç½®', |
| | | // icon: 'el-icon-refresh-right', |
| | | // type: 'primary', |
| | | // disabled: false, |
| | | // onClick() { |
| | | // this.resetEdit(); |
| | | // } |
| | | // } |
| | | ] |
| | | ); |
| | | //ä»è¡¨è¡¨æ ¼æä½æé® |
| | | this.detailOptions.buttons.push( |
| | | ...[ |
| | | { |
| | | name: 'æ·»å è¡', |
| | | icon: 'el-icon-plus', |
| | | type: 'primary', |
| | | hidden: false, |
| | | plain: true, |
| | | onClick() { |
| | | this.addRow(); |
| | | } |
| | | }, |
| | | { |
| | | type: 'danger', |
| | | plain: true, |
| | | name: 'å é¤è¡', |
| | | hidden: false, |
| | | icon: 'el-icon-delete', |
| | | onClick() { |
| | | this.delRow(); |
| | | } |
| | | }, |
| | | //2022.01.08å¢å æç»è¡¨å¯¼å
¥å¯¼åºåè½ |
| | | //注æéè¦éååå°æç»è¡¨æ¥å£ç导å
¥ä¸ä¸è½½æ¨¡æ¿ã导åºçæé,Sys_DictionaryListController.cs/SellOrderListController.cs |
| | | { |
| | | type: 'danger', |
| | | plain: true, |
| | | name: '导å
¥', |
| | | value: 'import', |
| | | hidden: false, |
| | | icon: 'el-icon-upload2', |
| | | onClick() { |
| | | this.upload.url = `${this.http.ipAddress}api/${this.detail.table}/${this.const.IMPORT}?table=1`; |
| | | this.upload.template.url = `${this.http.ipAddress}api/${this.detail.table}/${this.const.DOWNLOADTEMPLATE}`; |
| | | //å®ä¹ä¸è½½æ¨¡æ¿çæä»¶å |
| | | this.upload.template.fileName = this.detail.cnName; |
| | | this.upload.excel = true; |
| | | } |
| | | }, |
| | | { |
| | | type: 'danger', |
| | | plain: true, |
| | | name: '导åº', |
| | | value: 'export', |
| | | icon: 'el-icon-download', |
| | | hidden: false, |
| | | onClick() { |
| | | this.export(true); |
| | | } |
| | | } |
| | | ] |
| | | ); |
| | | this.detailOptions.buttons.forEach((button) => { |
| | | if (button.hasOwnProperty('hidden')) { |
| | | button.hidden = false; |
| | | } |
| | | }); |
| | | //å¼¹åºæ¡æ©å±æé® |
| | | this.extendBtn(boxButtons, this.extend.buttons.box); |
| | | |
| | | //å¼¹åºæ¡æ©å±æç»è¡¨æé® |
| | | this.detailOptions.buttons.push(detailGridButtons); |
| | | this.extendBtn(this.detailOptions.buttons, this.extend.buttons.detail); |
| | | |
| | | //å¼¹åºå¼¹æ¡æé® |
| | | this.boxButtons.push(...boxButtons); |
| | | }, |
| | | onClick(click) { |
| | | click.apply(this); |
| | | }, |
| | | changeDropdown(btnName, v1) { |
| | | let button = this.buttons.filter((x) => { |
| | | return x.name == btnName; |
| | | }); |
| | | if (button && button.length > 0) { |
| | | button[0].onClick.apply(this); |
| | | } |
| | | }, |
| | | emptyValue(value) { |
| | | if (typeof value == 'string' && value.trim() === '') { |
| | | return true; |
| | | } |
| | | if (value instanceof Array && !value.length) { |
| | | return true; |
| | | } |
| | | return value === null || value === undefined || value === ''; |
| | | }, |
| | | getSearchParameters() { |
| | | //è·åæ¥è¯¢åæ° |
| | | // 2020.09.11å¢å åºå®æ¥è¯¢è¡¨å,å¦æè®¾ç½®åºå®äºæ¥è¯¢è¡¨åï¼ç¹å»æ¥è¯¢æ¶ï¼ä¸åå
³é |
| | | if (!this.fiexdSearchForm) { |
| | | this.searchBoxShow = false; |
| | | } |
| | | |
| | | let query = { wheres: [] }; |
| | | for (const key in this.searchFormFields) { |
| | | let value = this.searchFormFields[key]; |
| | | if (this.emptyValue(value)) continue; |
| | | |
| | | if (typeof value == 'number') { |
| | | value = value + ''; |
| | | } |
| | | let displayType = this.getSearchItem(key); |
| | | |
| | | //è级åªä¿çéä¸èç¹çæåä¸ä¸ªå¼ |
| | | if (displayType == 'cascader') { |
| | | //æ¥è¯¢ä¸é¢ææçåèç¹ï¼å¦ï¼éä¸çæ¯ç¶èç¹ï¼åºè¯¥æ¥è¯¢ä¸é¢ææçèç¹æ°æ®--å¾
å® |
| | | value = value.length ? value[value.length - 1] + '' : ''; |
| | | } |
| | | //2021.05.02å¢å åºé´æ¥è¯¢ |
| | | if ( |
| | | typeof value == 'string' || |
| | | ['date', 'datetime', 'range'].indexOf(displayType) == -1 |
| | | ) { |
| | | query.wheres.push({ |
| | | name: key, |
| | | value: |
| | | typeof value == 'string' ? (value + '').trim() : value.join(','), |
| | | displayType: displayType |
| | | }); |
| | | continue; |
| | | } |
| | | for (let index = 0; index < value.length; index++) { |
| | | if (!this.emptyValue(value[index])) { |
| | | query.wheres.push({ |
| | | name: key, |
| | | value: (value[index] + '').trim(), |
| | | displayType: (() => { |
| | | if (['date', 'datetime', 'range'].indexOf(displayType) != -1) { |
| | | return index ? 'lessorequal' : 'thanorequal'; |
| | | } |
| | | return displayType; |
| | | })() |
| | | }); |
| | | } |
| | | } |
| | | } |
| | | return query; |
| | | }, |
| | | search() { |
| | | //æ¥è¯¢ |
| | | // let query = this.getSearchParameters(); |
| | | // this.$refs.table.load(query, true); |
| | | this.$refs.table.load(null, true); |
| | | }, |
| | | loadTableBefore(param, callBack) { |
| | | //æ¥è¯¢å设置æ¥è¯¢æ¡ä»¶ååé¡µä¿¡æ¯ |
| | | let query = this.getSearchParameters(); |
| | | if (query) { |
| | | param = Object.assign(param, query); |
| | | } |
| | | |
| | | if (this.$route.query.viewflow && this.$route.query.id) { |
| | | param.wheres.push({ |
| | | name: this.table.key, |
| | | value: this.$route.query.id |
| | | }); |
| | | } |
| | | // if (this.isViewFlow() && data && data.length) { |
| | | // let query = JSON.parse(JSON.stringify(this.$route.query)); |
| | | // query.viewflow = 0; |
| | | // this.$router.replace({ path: this.$route.path, query: query }); |
| | | // this.$nextTick(() => { |
| | | // this.getWorkFlowSteps(data[0]); |
| | | // }); |
| | | // } |
| | | let status = this.searchBefore(param); |
| | | callBack(status); |
| | | }, |
| | | |
| | | loadTableAfter(data, callBack, result) { |
| | | //æ¥è¯¢å |
| | | //2020.10.30å¢å æ¥è¯¢åè¿åææçæ¥è¯¢ä¿¡æ¯ |
| | | let status = this.searchAfter(data, result); |
| | | callBack(status); |
| | | //èªå¨å¼¹åºæ¡å®¡æ¹è¯¦æ
|
| | | }, |
| | | loadDetailTableBefore(param, callBack) { |
| | | //æç»æ¥è¯¢å |
| | | //æ°å»ºæ¶ç¦æ¢å è½½æç» |
| | | if (this.currentAction == this.const.ADD) { |
| | | callBack(false); |
| | | return false; |
| | | } |
| | | let status = this.searchDetailBefore(param); |
| | | callBack(status); |
| | | }, |
| | | loadDetailTableAfter(data, callBack) { |
| | | //æç»æ¥è¯¢å |
| | | let status = this.searchDetailAfter(data); |
| | | callBack(status); |
| | | }, |
| | | getSearchItem(field) { |
| | | //è·åæ¥è¯¢çåæ° |
| | | let data; |
| | | for (let index = 0; index < this.searchFormOptions.length; index++) { |
| | | if (data) return data.type; |
| | | const item = this.searchFormOptions[index]; |
| | | data = item.find((x) => { |
| | | return x.field == field; |
| | | }); |
| | | } |
| | | |
| | | return (data || {}).type; |
| | | }, |
| | | resetSearch() { |
| | | //éç½®æ¥è¯¢å¯¹è±¡ |
| | | this.resetSearchForm(); |
| | | //2020.10.17å¢å éç½®åæ¹æ³ |
| | | this.resetSearchFormAfter && this.resetSearchFormAfter(); |
| | | }, |
| | | resetEdit() { |
| | | //éç½®ç¼è¾çæ°æ® |
| | | let isEdit = this.currentAction != this.const.ADD; |
| | | //éç½®ä¹å |
| | | if (!this[isEdit ? 'resetUpdateFormBefore' : 'resetAddFormBefore']()) { |
| | | return; |
| | | } |
| | | let objKey = {}; |
| | | //ç¼è¾ç¶æä¸,ä¸éè¦é置主é®,å建æ¶é´å建人 |
| | | if (isEdit) { |
| | | objKey[this.table.key] = this.editFormFields[this.table.key]; |
| | | } |
| | | this.resetEditForm(objKey); |
| | | //éç½®ä¹å |
| | | |
| | | if (!this[isEdit ? 'resetUpdateFormAfter' : 'resetAddFormAfter']()) { |
| | | return; |
| | | } |
| | | }, |
| | | resetSearchForm(sourceObj) { |
| | | //éç½®æ¥è¯¢è¡¨ |
| | | this.resetForm('searchForm', sourceObj); |
| | | }, |
| | | resetEditForm(sourceObj) { |
| | | if (this.hasDetail && this.$refs.detail) { |
| | | // this.$refs.detail.rowData.splice(0); |
| | | this.$refs.detail.reset(); |
| | | } |
| | | this.resetForm('form', sourceObj); |
| | | if (this.$refs.form && this.$refs.form.$refs.volform) { |
| | | setTimeout(() => { |
| | | this.$refs.form.$refs.volform.clearValidate(); |
| | | }, 100); |
| | | } |
| | | }, |
| | | getKeyValueType(formData, isEditForm) { |
| | | try { |
| | | let keyLeft = (isEditForm ? 'e' : 's') + '_b_'; |
| | | formData.forEach((item) => { |
| | | item.forEach((x) => { |
| | | if (this.keyValueType.hasOwnProperty(keyLeft + x.field)) { |
| | | return true; |
| | | } |
| | | let data; |
| | | if (x.type == 'switch') { |
| | | this.keyValueType[x.field] = 1; |
| | | } else if (x.bind && x.bind.data) { |
| | | data = x.bind.data; |
| | | } else if (x.data) { |
| | | if (x.data instanceof Array) { |
| | | data = x.data; |
| | | } else if (x.data.data && x.data.data instanceof Array) { |
| | | data = x.data.data; |
| | | } |
| | | } |
| | | if ( |
| | | data && |
| | | data.length > 0 && |
| | | !this.keyValueType.hasOwnProperty(x.field) |
| | | ) { |
| | | this.keyValueType[x.field] = data[0].key; |
| | | this.keyValueType[keyLeft + x.field] = x.type; |
| | | } |
| | | }); |
| | | }); |
| | | } catch (error) { |
| | | console.log(error.message); |
| | | } |
| | | }, |
| | | resetForm(formName, sourceObj) { |
| | | // return; |
| | | //éç½®è¡¨åæ°æ® |
| | | if (this.$refs[formName]) { |
| | | this.$refs[formName].reset(); |
| | | } |
| | | |
| | | if (!sourceObj) return; |
| | | let form, keyLeft; |
| | | if (formName == 'searchForm') { |
| | | form = this.searchFormFields; |
| | | keyLeft = 's' + '_b_'; |
| | | } else { |
| | | form = this.editFormFields; |
| | | keyLeft = 'e' + '_b_'; |
| | | } |
| | | //è·åæ°æ®æºçdataç±»åï¼å¦åå¦ææ°æ®æºdataçkeyæ¯æ°åï¼éç½®ç弿¯åç¬¦ä¸²å°±æ æ³ç»å®å¼ |
| | | if (!this.keyValueType._dinit) { |
| | | this.getKeyValueType(this.editFormOptions, true); |
| | | this.getKeyValueType(this.searchFormOptions, false); |
| | | this.keyValueType._dinit = true; |
| | | } |
| | | var _cascaderParentTree; |
| | | for (const key in form) { |
| | | if (sourceObj.hasOwnProperty(key)) { |
| | | let newVal = sourceObj[key]; |
| | | let kv_type = this.keyValueType[keyLeft + key]; |
| | | |
| | | if ( |
| | | kv_type == 'selectList' || |
| | | kv_type == 'checkbox' || |
| | | kv_type == 'cascader' || |
| | | kv_type == 'treeSelect' |
| | | ) { |
| | | // 2020.05.31å¢å iviewç»ä»¶Cascader |
| | | // 2020.11.01å¢å iviewç»ä»¶Cascader表åéç½®æ¶æ¥è¯¢ææçç¶èç¹ |
| | | if (kv_type == 'cascader' || kv_type == 'treeSelect') { |
| | | var treeDic = this.dicKeys.find((dic) => { |
| | | return dic.fileds && dic.fileds.indexOf(key) != -1; |
| | | }); |
| | | |
| | | if (treeDic && treeDic.orginData && treeDic.orginData.length) { |
| | | let keyIsNum = typeof treeDic.orginData[0].id == 'number'; |
| | | |
| | | if (kv_type == 'cascader') { |
| | | newVal = keyIsNum ? newVal * 1 || 0 : newVal + ''; |
| | | if (kv_type == 'cascader') { |
| | | _cascaderParentTree = this.base.getTreeAllParent( |
| | | newVal, |
| | | treeDic.orginData |
| | | ); |
| | | if (_cascaderParentTree) { |
| | | newVal = _cascaderParentTree.map((x) => { |
| | | return x.id; |
| | | }); |
| | | } |
| | | } |
| | | } else { |
| | | if (newVal === null || newVal === undefined) { |
| | | newVal = []; |
| | | } else if (typeof newVal == 'string') { |
| | | newVal = newVal.split(','); |
| | | } |
| | | if (keyIsNum) { |
| | | if (Array.isArray(newVal)) { |
| | | newVal = newVal.map((x) => { |
| | | return x * 1 || 0; |
| | | }); |
| | | } |
| | | } else if (typeof newVal == 'number') { |
| | | newVal = [newVal + '']; |
| | | } |
| | | } |
| | | } else { |
| | | newVal = [newVal]; |
| | | } |
| | | } else if ( |
| | | newVal != '' && |
| | | newVal != undefined && |
| | | typeof newVal == 'string' |
| | | ) { |
| | | newVal = newVal.split(','); |
| | | } else if (kv_type == 'checkbox') { |
| | | newVal = []; |
| | | } |
| | | } else if ( |
| | | this.keyValueType.hasOwnProperty(key) && |
| | | typeof this.keyValueType[key] == 'number' && |
| | | newVal * 1 == newVal |
| | | ) { |
| | | newVal = newVal * 1; |
| | | } else { |
| | | if (newVal == null || newVal == undefined) { |
| | | newVal = ''; |
| | | } else if (this.numberFields.indexOf(key) != -1) { |
| | | newVal = newVal * 1 || 0; |
| | | } else { |
| | | newVal += ''; |
| | | } |
| | | } |
| | | if (newVal instanceof Array) { |
| | | if (form[key]) { |
| | | form[key] = []; |
| | | } |
| | | form[key] = newVal; |
| | | } else { |
| | | form[key] = newVal; |
| | | } |
| | | } else { |
| | | form[key] = form[key] instanceof Array ? [] : ''; |
| | | } |
| | | } |
| | | }, |
| | | onBtnClick(param) { |
| | | this[param.method](param.data); |
| | | }, |
| | | refresh() { |
| | | //å·æ° |
| | | this.search(); |
| | | // this.$refs.table.load(); |
| | | }, |
| | | saveBefore(formData) { |
| | | return true; |
| | | }, |
| | | saveAfter(formData, result) { |
| | | return true; |
| | | }, |
| | | save() { |
| | | //æ°å¢æç¼è¾æ¶ä¿å |
| | | // if (!this.$refs.form.validate()) return; |
| | | this.$refs.form.validate((result) => { |
| | | if (result) { |
| | | this.saveExecute(); |
| | | } |
| | | }); |
| | | }, |
| | | async saveExecute() { |
| | | let editFormFields = {}; |
| | | //ä¸ä¼ æä»¶ä»¥éå·éå¼ |
| | | for (const key in this.editFormFields) { |
| | | if ( |
| | | this.uploadfiled && |
| | | this.uploadfiled.length > 0 && |
| | | this.uploadfiled.indexOf(key) != -1 && |
| | | this.editFormFields[key] instanceof Array |
| | | ) { |
| | | let allPath = this.editFormFields[key].map((x) => { |
| | | return x.path; |
| | | }); |
| | | editFormFields[key] = allPath.join(','); |
| | | } else if (typeof this.editFormFields[key] == 'function') { |
| | | try { |
| | | editFormFields[key] = this.editFormFields[key](); |
| | | } catch (error) { } |
| | | } else { |
| | | //2021.05.30ä¿®å¤ä¸ææ¡æ¸
餿°æ®ååå°ä¸è½ä¿åçé®é¢ |
| | | if ( |
| | | this.editFormFields[key] === undefined && |
| | | this.dicKeys.some((x) => { |
| | | return x.fileds && x.fileds.indexOf(key) != -1; |
| | | }) |
| | | ) { |
| | | editFormFields[key] = null; |
| | | } else { |
| | | editFormFields[key] = this.editFormFields[key]; |
| | | } |
| | | } |
| | | } |
| | | //å°æ°ç»è½¬æ¢æstring |
| | | //2020.11.01å¢å 级èå¤ç |
| | | for (const key in editFormFields) { |
| | | if (editFormFields[key] instanceof Array) { |
| | | var iscascader = this.dicKeys.some((x) => { |
| | | return ( |
| | | x.type == 'cascader' && x.fileds && x.fileds.indexOf(key) != -1 |
| | | ); |
| | | }); |
| | | if (iscascader && editFormFields[key].length) { |
| | | editFormFields[key] = |
| | | editFormFields[key][editFormFields[key].length - 1]; |
| | | } else { |
| | | editFormFields[key] = editFormFields[key].join(','); |
| | | } |
| | | } |
| | | } |
| | | |
| | | let formData = { |
| | | mainData: editFormFields, |
| | | detailData: null, |
| | | delKeys: null |
| | | }; |
| | | |
| | | //è·åæç»æ°æ®(åå°æ°æ®æç»æªåæ ¡éªï¼å¾
å®.åå°å·²ç»æ ¡éª) |
| | | if (this.hasDetail) { |
| | | formData.detailData = this.$refs.detail.rowData; |
| | | let _fields = this.detail.columns |
| | | .filter((c) => { |
| | | return ( |
| | | c.type == 'selectList' || (c.edit && c.edit.type == 'selectList') |
| | | ); |
| | | }) |
| | | .map((c) => { |
| | | return c.field; |
| | | }); |
| | | //2022.06.20å¢å ä¿åæ¶å¯¹æç»è¡¨ä¸ææ¡å¤éç夿 |
| | | if (_fields.length) { |
| | | formData.detailData = JSON.parse(JSON.stringify(formData.detailData)); |
| | | formData.detailData.forEach((row) => { |
| | | for (let index = 0; index < _fields.length; index++) { |
| | | const _field = _fields[index]; |
| | | if (Array.isArray(row[_field])) { |
| | | row[_field] = row[_field].join(','); |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | } |
| | | if (this.detailOptions.delKeys.length > 0) { |
| | | formData.delKeys = this.detailOptions.delKeys; |
| | | } |
| | | //ä¿ååæ¦æª |
| | | let _currentIsAdd = this.currentAction == this.const.ADD; |
| | | if (_currentIsAdd) { |
| | | //2020.12.06å¢å æ°å»ºå弿¥å¤çæ¹æ³ |
| | | //2021.08.16ä¿®å¤å¼æ¥è¯æ³åéçé®é¢ |
| | | if (!this.addBefore(formData) || !(await this.addBeforeAsync(formData))) |
| | | return; |
| | | } else { |
| | | //2020.12.06å¢å ä¿®æ¹å弿¥å¤çæ¹æ³ |
| | | if ( |
| | | !this.updateBefore(formData) || |
| | | !(await this.updateBeforeAsync(formData)) |
| | | ) |
| | | return; |
| | | } |
| | | let url = this.getUrl(this.currentAction); |
| | | this.http.post(url, formData, true).then((x) => { |
| | | //ä¿åå |
| | | if (_currentIsAdd) { |
| | | if (!this.addAfter(x)) return; |
| | | //è¿ç»æ·»å |
| | | if (this.continueAdd && x.status) { |
| | | this.$success(x.message); |
| | | //æ°å»º |
| | | this.currentAction = this.const.ADD; |
| | | this.currentRow = {}; |
| | | this.resetAdd(); |
| | | this.refresh(); |
| | | return; |
| | | } |
| | | } else { |
| | | if (!this.updateAfter(x)) return; |
| | | } |
| | | if (!x.status) return this.$error(x.message); |
| | | this.$success(x.message || 'æä½æå'); |
| | | //妿ä¿åæååéè¦å
³éç¼è¾æ¡ï¼ç´æ¥è¿åä¸å¤çåé¢ |
| | | if (this.boxOptions.saveClose) { |
| | | this.boxModel = false; |
| | | //2020.12.27妿æ¯ç¼è¾ä¿ååä¸éç½®å页页æ°ï¼å·æ°é¡µé¢æ¶è¿æ¯æ¾ç¤ºå½åé¡µçæ°æ® |
| | | this.$refs.table.load(null, _currentIsAdd); |
| | | //this.refresh(); |
| | | return; |
| | | } |
| | | let resultRow; |
| | | if (typeof x.data == 'string' && x.data != '') { |
| | | resultRow = JSON.parse(x.data); |
| | | } else { |
| | | resultRow = x.data; |
| | | } |
| | | |
| | | if (this.currentAction == this.const.ADD) { |
| | | // this.currentRow=x.data; |
| | | this.editFormFields[this.table.key] = ''; |
| | | this.currentAction = this.const.EDIT; |
| | | this.currentRow = resultRow.data; |
| | | } |
| | | this.resetEditForm(resultRow.data); |
| | | // console.log(resultRow); |
| | | if (this.hasDetail) { |
| | | this.detailOptions.delKeys = []; |
| | | if (resultRow.list) { |
| | | this.$refs.detail.rowData.push(...resultRow.list); |
| | | } |
| | | } |
| | | this.$refs.table.load(null, _currentIsAdd); |
| | | // this.refresh(); |
| | | }); |
| | | }, |
| | | del(rows) { |
| | | if (rows) { |
| | | if (!(rows instanceof Array)) { |
| | | rows = [rows]; |
| | | } |
| | | } else { |
| | | rows = this.$refs.table.getSelected(); |
| | | } |
| | | //å 餿°æ® |
| | | |
| | | if (!rows || rows.length == 0) return this.$error('è¯·éæ©è¦å é¤çè¡!'); |
| | | let delKeys = rows.map((x) => { |
| | | return x[this.table.key]; |
| | | }); |
| | | if (!delKeys || delKeys.length == 0) |
| | | return this.$error('没æè·åè¦å é¤çè¡æ°æ®!'); |
| | | //å é¤å |
| | | if (!this.delBefore(delKeys, rows)) { |
| | | return; |
| | | } |
| | | let tigger = false; |
| | | this.$confirm('确认è¦å é¤éæ©çæ°æ®å?', 'è¦å', { |
| | | confirmButtonText: 'ç¡®å®', |
| | | cancelButtonText: 'åæ¶', |
| | | type: 'warning', |
| | | center: true |
| | | }).then(() => { |
| | | if (tigger) return; |
| | | tigger = true; |
| | | let url = this.getUrl(this.const.DEL); |
| | | this.http.post(url, delKeys, 'æ£å¨å 餿°æ®....').then((x) => { |
| | | if (!x.status) return this.$error(x.message); |
| | | this.$success("å 餿å"); |
| | | //å é¤å |
| | | if (!this.delAfter(x)) { |
| | | return; |
| | | } |
| | | this.refresh(); |
| | | }); |
| | | }); |
| | | }, |
| | | async modelOpenBeforeAsync(row) { |
| | | return true; |
| | | }, |
| | | async initBox() { |
| | | //2022.01.08å¢å æ°å»ºæ¶éèæç»è¡¨å¯¼åºåè½ |
| | | this.detailOptions.buttons.forEach((x) => { |
| | | if (x.value == 'export') { |
| | | x.hidden = this.currentAction == 'Add'; |
| | | } |
| | | }); |
| | | //åå§åæ°å»ºãç¼è¾çå¼¹åºæ¡ |
| | | if (!(await this.modelOpenBeforeAsync(this.currentRow))) return false; |
| | | this.modelOpenBefore(this.currentRow); |
| | | if (!this.boxInit) { |
| | | this.boxInit = true; |
| | | this.boxModel = true; |
| | | // this.detailUrl = this.url; |
| | | } |
| | | return true; |
| | | }, |
| | | setEditForm(row) { |
| | | // if (this.remoteColumns.length == 0 || !rows || rows.length == 0) return; |
| | | let remoteColumns = this.$refs.table.remoteColumns; |
| | | remoteColumns.forEach((column) => { |
| | | this.editFormOptions.forEach((option) => { |
| | | option.forEach((x) => { |
| | | if (x.field == column.field) { |
| | | x.data.data = Object.assign([], x.data, column.bind.data); |
| | | } |
| | | }); |
| | | }); |
| | | }); |
| | | this.editFormFields; |
| | | //éç½®ç¼è¾è¡¨åæ°æ® |
| | | this.editFormFields[this.table.key] = row[this.table.key]; |
| | | |
| | | this.resetEditForm(row); |
| | | this.currentAction = this.const.EDIT; |
| | | this.boxModel = true; |
| | | }, |
| | | async linkData(row, column) { |
| | | this.boxOptions.title = this.table.cnName + '(ç¼è¾)'; |
| | | //ç¹å»tableåå
æ ¼å¿«æ·é¾æ¥æ¾ç¤ºç¼è¾æ°æ® |
| | | this.currentAction = this.const.EDIT; |
| | | this.currentRow = row; |
| | | if (!(await this.initBox())) return; |
| | | this.resetDetailTable(row); |
| | | this.setEditForm(row); |
| | | this.setContinueAdd(false); |
| | | //设置è¿ç¨æ¥è¯¢è¡¨åçé»è®¤key/value |
| | | this.getRemoteFormDefaultKeyValue(); |
| | | //ç¹å»ç¼è¾æé®å¼¹åºæ¡åï¼å¯ä»¥å¨æ¤å¤åé»è¾ï¼å¦ï¼ä»åå°è·åæ°æ® |
| | | this.modelOpenProcess(row); |
| | | }, |
| | | setContinueAdd(isAdd) { |
| | | if (!this.continueAdd) return; |
| | | var _button = this.boxButtons.find((x) => { |
| | | return x.value == 'save'; |
| | | }); |
| | | if (_button) { |
| | | _button.name = isAdd ? this.continueAddName : 'ä¿ å'; |
| | | } |
| | | }, |
| | | resetAdd() { |
| | | if (this.hasDetail) { |
| | | this.$refs.detail && |
| | | // this.$refs.detail.rowData && |
| | | this.$refs.detail.reset(); |
| | | } |
| | | let obj = {}; |
| | | //妿æswitchæ ç¾ï¼é»è®¤é½è®¾ç½®ä¸ºå¦ |
| | | this.editFormOptions.forEach((x) => { |
| | | x.forEach((item) => { |
| | | if (item.type == 'switch') { |
| | | obj[item.field] = 0; |
| | | } |
| | | }); |
| | | }); |
| | | this.resetEditForm(obj); |
| | | }, |
| | | async add() { |
| | | this.boxOptions.title = this.table.cnName + '(æ°å»º)'; |
| | | //æ°å»º |
| | | this.currentAction = this.const.ADD; |
| | | this.currentRow = {}; |
| | | if (!(await this.initBox())) return; |
| | | |
| | | this.resetAdd(); |
| | | this.setContinueAdd(true); |
| | | // this.resetEditForm(); |
| | | this.boxModel = true; |
| | | //ç¹å»æ°å»ºæé®å¼¹åºæ¡åï¼å¯ä»¥å¨æ¤å¤åé»è¾ï¼å¦ï¼ä»åå°è·åæ°æ® |
| | | this.modelOpenProcess(); |
| | | // this.modelOpenAfter(); |
| | | }, |
| | | async edit(rows) { |
| | | this.boxOptions.title = 'ç¼è¾'; |
| | | //ç¼è¾ |
| | | this.currentAction = this.const.EDIT; |
| | | if (rows) { |
| | | if (!(rows instanceof Array)) { |
| | | rows = [rows]; |
| | | } |
| | | } else { |
| | | rows = this.$refs.table.getSelected(); |
| | | } |
| | | if (rows.length == 0) { |
| | | return this.$error('è¯·éæ©è¦ç¼è¾çè¡!'); |
| | | } |
| | | if (rows.length != 1) { |
| | | return this.$error('åªè½éæ©ä¸è¡æ°æ®è¿è¡ç¼è¾!'); |
| | | } |
| | | //è®°å½å½åç¼è¾çè¡ |
| | | this.currentRow = rows[0]; |
| | | //åå§åå¼¹åºæ¡ |
| | | if (!(await this.initBox())) return; |
| | | this.setContinueAdd(false); |
| | | //é置表å |
| | | this.resetDetailTable(); |
| | | |
| | | //设置å½åçæ°æ®å°è¡¨åä¸ |
| | | this.setEditForm(rows[0]); |
| | | //设置è¿ç¨æ¥è¯¢è¡¨åçé»è®¤key/value |
| | | this.getRemoteFormDefaultKeyValue(); |
| | | //ç¹å»ç¼è¾æé®å¼¹åºæ¡åï¼å¯ä»¥å¨æ¤å¤åé»è¾ï¼å¦ï¼ä»åå°è·åæ°æ® |
| | | this.modelOpenProcess(rows[0]); |
| | | // this.modelOpenAfter(rows[0]); |
| | | }, |
| | | getRemoteFormDefaultKeyValue() { |
| | | //设置表åè¿ç¨æ°æ®æºçé»è®¤key.value |
| | | if (this.currentAction != this.const.EDIT || this.remoteKeys.length == 0) |
| | | return; |
| | | this.editFormOptions.forEach((x, xIndex) => { |
| | | x.forEach((item, yIndex) => { |
| | | if (item.remote) { |
| | | let column = this.columns.find((x) => { |
| | | return x.bind && x.bind.key == item.dataKey; |
| | | }); |
| | | if (!column) return; |
| | | let key = this.currentRow[item.field]; |
| | | let obj = column.bind.data.find((x) => { |
| | | return x.key == key; |
| | | }); |
| | | // obj ? obj.value : keyå¦ææ²¡ææ¥å°æ°æ®æºï¼ç´æ¥ä½¿ç¨åæ°æ® |
| | | item.data = [{ key: key, value: obj ? obj.value : key }]; |
| | | this.editFormOptions[xIndex].splice(yIndex, 1, item); |
| | | // this.$set(item, 'data', [{ key: key + '', value: obj.value }]) |
| | | // item.data = [{ key: key + '', value: obj.value }]; |
| | | } |
| | | }); |
| | | }); |
| | | }, |
| | | modelOpenProcess(row) { |
| | | this.$nextTick(() => { |
| | | this.modelOpenAfter(row); |
| | | }); |
| | | return; |
| | | // if (!this.$refs.form) { |
| | | // let timeOut = setTimeout(x => { |
| | | // this.modelOpenAfter(row); |
| | | // }, 500) |
| | | // return; |
| | | // } |
| | | // this.modelOpenAfter(row); |
| | | }, |
| | | import() { |
| | | //导å
¥(ä¸ä¼ excel),å¼¹åºå¯¼å
¥ç»ä»¶UploadExcel.vue |
| | | this.upload.excel = true; |
| | | this.$refs.upload_excel && this.$refs.upload_excel.reset(); |
| | | }, |
| | | download(url, fileName) { |
| | | //ä¸è½½å¯¼åºçæä»¶ |
| | | let xmlResquest = new XMLHttpRequest(); |
| | | xmlResquest.open('GET', url, true); |
| | | xmlResquest.setRequestHeader('Content-type', 'application/json'); |
| | | xmlResquest.setRequestHeader( |
| | | 'Authorization', |
| | | this.$store.getters.getToken() |
| | | ); |
| | | let elink = this.$refs.export; |
| | | xmlResquest.responseType = 'blob'; |
| | | xmlResquest.onload = function (oEvent) { |
| | | if (xmlResquest.status != 200) { |
| | | this.$error('ä¸è½½æä»¶åºéäº..'); |
| | | return; |
| | | } |
| | | let content = xmlResquest.response; |
| | | // let elink = this.$refs.export;//document.createElement("a"); |
| | | elink.download = fileName; //+".xlsx"; |
| | | // elink.style.display = "none"; |
| | | let blob = new Blob([content]); |
| | | elink.href = URL.createObjectURL(blob); |
| | | // document.body.appendChild(elink); |
| | | elink.click(); |
| | | // document.body.removeChild(elink); |
| | | }; |
| | | xmlResquest.send(); |
| | | }, |
| | | getFileName(isDetail) { |
| | | //2021.01.08å¢å 导åºexcelæ¶èªå®ä¹æä»¶å |
| | | if (isDetail) { |
| | | return this.detail.cnName + '.xlsx'; |
| | | } |
| | | return this.table.cnName + '.xlsx'; |
| | | }, |
| | | export(isDetail) { |
| | | //å¯¼åº |
| | | let url, query, param; |
| | | if (isDetail) { |
| | | //æç»è¡¨å¯¼åºæ¶å¦ææ¯æ°å»ºç¶æï¼ç¦æ¢å¯¼åº |
| | | if (this.currentAction == 'Add') { |
| | | return; |
| | | } |
| | | url = `api/${this.detail.table}/${this.const.EXPORT}`; |
| | | param = { |
| | | wheres: [ |
| | | { name: this.table.key, value: this.editFormFields[this.table.key] } |
| | | ] |
| | | }; |
| | | } else { |
| | | //ä¸»è¡¨å¯¼åº |
| | | url = this.getUrl(this.const.EXPORT); |
| | | query = this.getSearchParameters(); |
| | | param = { order: this.pagination.order, wheres: query.wheres || [] }; |
| | | } |
| | | //2020.06.25å¢å 导åºåå¤ç |
| | | if (!isDetail && !this.exportBefore(param)) { |
| | | return; |
| | | } |
| | | |
| | | if (param.wheres && typeof param.wheres == 'object') { |
| | | param.wheres = JSON.stringify(param.wheres); |
| | | } |
| | | let $http = this.http; |
| | | //2022.09.26å¢å èªå®ä¹å¯¼åºæä»¶å |
| | | let fileName = this.downloadFileName || this.getFileName(isDetail); |
| | | //2021.01.08ä¼å导åºåè½ |
| | | $http |
| | | .post(url, param, 'æ£å¨å¯¼åºæ°æ®....', { responseType: 'blob' }) |
| | | .then((content) => { |
| | | const blob = new Blob([content]); |
| | | if ('download' in document.createElement('a')) { |
| | | // éIEä¸è½½ |
| | | const elink = document.createElement('a'); |
| | | elink.download = fileName; |
| | | elink.style.display = 'none'; |
| | | elink.href = URL.createObjectURL(blob); |
| | | document.body.appendChild(elink); |
| | | elink.click(); |
| | | URL.revokeObjectURL(elink.href); |
| | | document.body.removeChild(elink); |
| | | } else { |
| | | // IE10+ä¸è½½ |
| | | navigator.msSaveBlob(blob, fileName); |
| | | } |
| | | }); |
| | | //.then(result => { |
| | | // if (!result.status) { |
| | | // return this.$error(result.message); |
| | | // } |
| | | // let path = this.getUrl(this.const.DOWNLOAD); |
| | | // path = path[0] == "/" ? path.substring(1) : path; |
| | | // this.download( |
| | | // $http.ipAddress + path + "?path=" + result.data, |
| | | // this.table.cnName + ".xlsx" // filePath |
| | | // ); |
| | | /// window.open($http.ipAddress + path + "?fileName=" + filePath, "_self"); |
| | | // }); |
| | | }, |
| | | getSelectRows() { |
| | | //è·åéä¸çè¡ |
| | | return this.$refs.table.getSelected(); |
| | | }, |
| | | getDetailSelectRows() { |
| | | //æè·åæç»éä¸çè¡ |
| | | if (!this.$refs.detail) { |
| | | return []; |
| | | } |
| | | return this.$refs.detail.getSelected(); |
| | | }, |
| | | audit() { |
| | | //å®¡æ ¸å¼¹åºæ¡ |
| | | let rows = this.$refs.table.getSelected(); |
| | | if (rows.length == 0) return this.$error('è¯·éæ©è¦å®¡æ ¸çè¡!'); |
| | | let auditStatus = Object.keys(rows[0]).find(x => { return x.toLowerCase() === 'auditstatus' }); |
| | | if (!auditStatus) { |
| | | return this.$message.error(`表å¿
é¡»å
æ¬å®¡æ ¸å段ãAuditStatusã,并䏿¯intç±»å`) |
| | | } |
| | | // let checkStatus = rows.every((x) => { |
| | | // return this.$global.audit.status.some(c => { return c === x[auditStatus] || !x[auditStatus] }) |
| | | // }); |
| | | // if (!checkStatus) return this.$error('åªè½éæ©å¾
å®¡æ¹æå®¡æ ¸ä¸çæ°æ®!'); |
| | | this.$refs.audit.open(rows); |
| | | }, |
| | | saveAudit(params, rows, callback) { |
| | | |
| | | //ä¿åå®¡æ ¸ |
| | | let keys = rows.map(x => { return x[this.table.key] }); |
| | | if (!this.auditBefore(keys, rows)) { |
| | | return; |
| | | } |
| | | let url = `${this.getUrl(this.const.AUDIT)}?auditReason=${params.reason}&auditStatus=${params.value}` |
| | | this.http.post(url, keys, 'å®¡æ ¸ä¸....').then((x) => { |
| | | if (!this.auditAfter(x, keys)) { |
| | | return; |
| | | } |
| | | if (!x.status) return this.$error(x.message); |
| | | |
| | | callback && callback(x); |
| | | this.$success(x.message); |
| | | this.refresh(); |
| | | }); |
| | | }, |
| | | viewModelCancel() { |
| | | //æ¥çè¡¨ç»æ |
| | | this.viewModel = false; |
| | | }, |
| | | initFormOptions(formOptions, keys, formFields, isEdit) { |
| | | //åå§åæ¥è¯¢ãç¼è¾å¯¹è±¡çä¸ææ¡æ°æ®æºãå¾çä¸ä¼ 龿¥å°å |
| | | //let defaultOption = { key: "", value: "è¯·éæ©" }; |
| | | //æä¸ä¼ çåæ®µ |
| | | //2020.05.03æ°å¢ |
| | | //ç¼è¾æ°æ®æºçç±»å |
| | | formOptions.forEach((item) => { |
| | | item.forEach((d) => { |
| | | if (d.type == 'number') { |
| | | //2022.08.22ä¼å表åç±»å为numberæ¶çé»è®¤å¼ |
| | | if (formFields[d.field] === '') { |
| | | formFields[d.field] = undefined; |
| | | } |
| | | this.numberFields.push(d.field); |
| | | } |
| | | if ( |
| | | d.type == 'img' || |
| | | d.type == 'excel' || |
| | | d.type == 'file' || |
| | | d.columnType == 'img' |
| | | ) { |
| | | d.url = this.http.ipAddress + 'api' + this.table.url + 'Upload'; |
| | | this.uploadfiled.push(d.field); |
| | | } |
| | | if (!d.dataKey) return true; |
| | | //2022.02.20强å¶å¼å¯è级å¯ä»¥éæ©æä¸ªèç¹ |
| | | if (d.type == 'cascader' && !d.hasOwnProperty('changeOnSelect')) { |
| | | //强å¶å¼å¯è级å¯ä»¥éæ©æä¸ªèç¹ |
| | | d.changeOnSelect = true; |
| | | } |
| | | //å¼å¯è¿ç¨æç´¢ |
| | | if (d.remote) { |
| | | this.remoteKeys.push(d.dataKey); |
| | | d.data = []; //{ dicNo: d.dataKey, data: [] }; |
| | | return true; |
| | | } |
| | | //2020.05.03å¢å ç¼è¾è¡¨å对checkboxçæ¯æ |
| | | if (d.type == 'checkbox' && !(formFields[d.field] instanceof Array)) { |
| | | formFields[d.field] = []; |
| | | } |
| | | if (keys.indexOf(d.dataKey) == -1) { |
| | | //2020.05.03å¢å è®°å½ç¼è¾åæ®µçæ°æ®æºç±»å |
| | | |
| | | keys.push(d.dataKey); |
| | | //2020.05.03ä¿®å¤æ¥è¯¢è¡¨åä¸ç¼è¾è¡¨åtypeç±»ååæå¼ºä¸è´æ§çé®é¢ |
| | | //this.dicKeys.push({ dicNo: d.dataKey, data: [], type: d.type }); |
| | | // 2020.11.01å¢å iviewç»ä»¶Cascaderæ°æ®æºåå¨ |
| | | let _dic = { |
| | | dicNo: d.dataKey, |
| | | data: [], |
| | | fileds: [d.field], |
| | | orginData: [] |
| | | }; |
| | | if (d.type == 'cascader') { |
| | | _dic.type = 'cascader'; |
| | | } |
| | | if (isEdit) { |
| | | _dic['e_type'] = d.type; |
| | | } |
| | | this.dicKeys.push(_dic); |
| | | } else if (d.type == 'cascader') { |
| | | this.dicKeys.forEach((x) => { |
| | | if (x.dicNo == d.dataKey) { |
| | | x.type = 'cascader'; |
| | | x.fileds.push(d.field); |
| | | } |
| | | }); |
| | | } |
| | | if (d.type != 'cascader') { |
| | | //2020.01.30ç§»é¤å
é¨è¡¨åformOptionsæ°æ®æºé
ç½®æ ¼å¼data.dataï¼ææåæ°æ¹ä¸ºä¸ç»ä»¶apiæ ¼å¼ç¸å |
| | | Object.assign( |
| | | d, |
| | | this.dicKeys.filter((f) => { |
| | | return f.dicNo == d.dataKey; |
| | | })[0], |
| | | { type: d.type } |
| | | ); |
| | | } |
| | | }); |
| | | }); |
| | | }, |
| | | //åå§table䏿ç»è¡¨çæ°æ®æºæådicKeys对象ï¼åå»åå°å è½½æ°æ®æº |
| | | initColumns(scoure, dicKeys, keys) { |
| | | if (!scoure || !(scoure instanceof Array)) return; |
| | | scoure.forEach((item) => { |
| | | if (!item.bind || (item.bind.data && item.bind.data.length > 0)) |
| | | return true; |
| | | let key = item.bind.key || item.bind.dicNo; |
| | | if (this.remoteKeys.indexOf(key) != -1) { |
| | | item.bind.remote = true; |
| | | return true; |
| | | } |
| | | if (this.hasKeyField.indexOf(item.field) == -1) { |
| | | this.hasKeyField.push(item.field); |
| | | } |
| | | var dic = dicKeys.filter((x) => { |
| | | return x.dicNo == key; |
| | | }); |
| | | if (!dic || dic.length == 0) { |
| | | dicKeys.push({ dicNo: key, data: [] }); |
| | | dic = [dicKeys[dicKeys.length - 1]]; |
| | | keys.push(key); |
| | | } |
| | | //2020.11.01å¢å 级èå¤ç |
| | | if (dic[0].type == 'cascader' || dic[0].type == 'treeSelect') { |
| | | item.bind = { data: dic[0].orginData, type: 'select', key: key }; |
| | | } else { |
| | | item.bind = dic[0]; |
| | | } |
| | | //2020.05.03ä¼åtableæ°æ®æºcheckboxä¸selectç±»åä»ç¼è¾åä¸éå |
| | | item.bind.type = item.bind.e_type || 'string'; |
| | | }); |
| | | }, |
| | | bindOptions(dic) { |
| | | //ç»å®ä¸ææ¡çæ°æ®æº |
| | | //ç»å®åå°çåå
¸æ°æ® |
| | | dic.forEach((d) => { |
| | | if (d.data.length >= (this.select2Count || 500)) { |
| | | if ( |
| | | !this.dicKeys.some((x) => { |
| | | return ( |
| | | x.dicNo == d.dicNo && |
| | | (x.type == 'cascader' || x.type == 'treeSelect') |
| | | ); |
| | | }) |
| | | ) { |
| | | d.data.forEach((item) => { |
| | | item.label = item.value; |
| | | item.value = item.key; |
| | | }); |
| | | } |
| | | } |
| | | this.dicKeys.forEach((x) => { |
| | | if (x.dicNo != d.dicNo) return true; |
| | | //2020.10.26å¢å çº§èæ°æ®æºç»å®å¤ç |
| | | if (x.type == 'cascader' || x.type == 'treeSelect') { |
| | | // x.data=d.data; |
| | | //çætreeç»æ |
| | | let _data = JSON.parse(JSON.stringify(d.data)); |
| | | //2022.04.04å¢å 级èåå
¸æ°æ®æºå·æ°åtable没æååçé®é¢ |
| | | this.columns.forEach((column) => { |
| | | if (column.bind && column.bind.key == d.dicNo) { |
| | | column.bind.data = d.data; |
| | | } |
| | | }); |
| | | let arr = this.base.convertTree(_data, (node, data, isRoot) => { |
| | | if (!node.inited) { |
| | | node.inited = true; |
| | | node.label = node.value; |
| | | node.value = node.key; |
| | | } |
| | | }); |
| | | x.data.push(...arr); |
| | | x.orginData.push(...d.data); |
| | | //2021.10.17ä¿®å¤æ¥è¯¢çº§èä¸è½ç»å®æ°æ®æºçé®é¢ |
| | | this.searchFormOptions.forEach((searhcOption) => { |
| | | searhcOption.forEach((_option) => { |
| | | if (_option.type == 'cascader' && _option.dataKey == x.dicNo) { |
| | | _option.data = arr; |
| | | _option.orginData = d.data; |
| | | } |
| | | }); |
| | | }); |
| | | //2021.10.17ä¿®å¤çº§èä¸è½äºçº§å·æ°çé®é¢ |
| | | this.editFormOptions.forEach((editOption) => { |
| | | editOption.forEach((_option) => { |
| | | if ( |
| | | (_option.type == 'cascader' || _option.type == 'treeSelect') && |
| | | _option.dataKey == x.dicNo |
| | | ) { |
| | | _option.data = arr; |
| | | _option.orginData = d.data; |
| | | } |
| | | }); |
| | | }); |
| | | } else if (d.data.length > 0 && !d.data[0].hasOwnProperty('key')) { |
| | | let source = d.data, |
| | | newSource = new Array(source.length); |
| | | for (let index = 0; index < source.length; index++) { |
| | | newSource[index] = { |
| | | //é»è®¤ä»åå
¸æ°æ®è¯»åºæ¥çkey齿¯stringç±»å,ä½å¦ææ°æ®ä»sql䏿¥è¯¢çå¯è½ä¸ºéstring,妿¯async-validatoréè¦éç½®è®¾ç½®æ ¼å¼ |
| | | key: source['key'] + '', //source[index][x.config.valueField] + "", |
| | | value: source['value'] //source[index][x.config.textField] |
| | | }; |
| | | } |
| | | |
| | | x.data.push(...newSource); |
| | | } else { |
| | | //2020.06.06ï¼å¦ææ¯selectListæ°æ®æºä½¿ç¨çèªå®ä¹sqlå¹¶ä¸keyæ¯æ°åï¼å¼ºå¶è½¬æ¢æå符串 |
| | | if ( |
| | | x.e_type == 'selectList' && |
| | | d.data.length > 0 && |
| | | typeof d.data[0].key == 'number' |
| | | ) { |
| | | d.data.forEach((c) => { |
| | | c.key = c.key + ''; |
| | | }); |
| | | } |
| | | x.data.push(...d.data); |
| | | } |
| | | if ( |
| | | this.singleSearch && |
| | | this.singleSearch.dataKey && |
| | | this.singleSearch.dataKey == x.dicNo |
| | | ) { |
| | | this.singleSearch.data.splice(0, 1, ...x.data); |
| | | } |
| | | }); |
| | | }); |
| | | }, |
| | | getUrl(action, ingorPrefix) { |
| | | //æ¯å¦å¿½ç¥åç¼/ è·åæä½çurl |
| | | return (!ingorPrefix ? '/' : '') + 'api' + this.table.url + action; |
| | | }, |
| | | |
| | | initDicKeys() { |
| | | //åå§ååå
¸æ°æ® |
| | | let keys = []; |
| | | //2022.04.17ä¼åéæ°å è½½æ°æ®æº |
| | | this.dicKeys.forEach((item) => { |
| | | item.data.splice(0); |
| | | item.orginData && item.orginData.splice(0); |
| | | }); |
| | | //this.dicKeys.splice(0); |
| | | //åå§åç¼è¾æ°æ®æº,é»è®¤ä¸ºä¸ä¸ªç©ºæ°ç»ï¼å¦æè¦æ±å¿
填设置type=number/decimalçæå°å¼ |
| | | this.initFormOptions(this.editFormOptions, keys, this.editFormFields, true); |
| | | //åå§åæ¥è¯¢æ°æ®æº,é»è®¤ä¸ºä¸ä¸ªç©ºæ°ç» |
| | | this.initFormOptions( |
| | | this.searchFormOptions, |
| | | keys, |
| | | this.searchFormFields, |
| | | false |
| | | ); |
| | | //æ¥è¯¢æ¥æè®¾ç½®ä¸ºå¯éå¼å§ä¸ç»ææ¥æ |
| | | this.searchFormOptions.forEach((item) => { |
| | | item.forEach((x) => { |
| | | if (x.type == 'date' || x.type == 'datetime') x.range = true; |
| | | }); |
| | | }); |
| | | //åå§ådatatableè¡¨æ°æ®æº,é»è®¤ä¸ºä¸ä¸ªç©ºæ°ç»,dicKeys为ç颿æçæ°æ®åå
¸ç¼å· |
| | | this.initColumns(this.columns, this.dicKeys, keys); |
| | | //2021.05.23é»è®¤å¼å¯æ¥è¯¢é¡µé¢ææå段æåº,妿ä¸éè¦æåºï¼å¨onInitedéåcolumns设置sort=false |
| | | //2021.09.25ç§»é¤å¼ºå¶æåºåè½ |
| | | // this.columns.forEach(x => { |
| | | // x.sort = x.render ? false : true; |
| | | // }) |
| | | if (this.detailOptions && this.detailOptions.columns) { |
| | | this.initColumns(this.detailOptions.columns, this.dicKeys, keys); |
| | | } |
| | | //åå§åå¿«éæ¥è¯¢åæ®µ,é»è®¤ä½¿ç¨ä»£ç çæå¨é
ç½®ç第ä¸ä¸ªæ¥è¯¢å段 |
| | | if (this.searchFormOptions.length > 0) { |
| | | this.singleSearch = { |
| | | dataKey: this.searchFormOptions[0][0].dataKey, |
| | | dicNo: this.searchFormOptions[0][0].dicNo, |
| | | field: this.searchFormOptions[0][0].field, |
| | | title: this.searchFormOptions[0][0].title, |
| | | type: this.searchFormOptions[0][0].type, |
| | | data: [] |
| | | }; |
| | | // this.singleSearch = this.searchFormOptions[0][0]; |
| | | } |
| | | if (keys.length == 0) return; |
| | | let $this = this; |
| | | this.http.post('/api/Sys_Dictionary/GetVueDictionary', keys).then((dic) => { |
| | | |
| | | $this.bindOptions(dic); |
| | | //2022.04.04å¢å åå
¸å è½½å®ææ¹æ³ |
| | | $this.dicInited && $this.dicInited(dic); |
| | | }); |
| | | }, |
| | | setFiexdColumn(columns, containerWidth) { |
| | | //è®¡ç®æ´ä¸ªtableçå®½åº¦ï¼æ ¹æ®å®½åº¦å³å®æ¯å¦å¯ç¨ç¬¬ä¸è¡æ¾ç¤ºçå为åºå®å |
| | | //2021.09.21ç§»é¤å¼ºå¶åºå®ç¬¬ä¸å |
| | | // let columnsWidth = 0; |
| | | // columns.forEach(x => { |
| | | // if (!x.hidden && x.width) { |
| | | // columnsWidth += x.width; |
| | | // } |
| | | // }); |
| | | // //å¯ç¨ç¬¬ä¸å为åºå®å |
| | | // if (columnsWidth > containerWidth) { |
| | | // let firstColumn = columns.find(x => !x.hidden); |
| | | // if (firstColumn) { |
| | | // firstColumn.fixed = true; |
| | | // } |
| | | // } |
| | | }, |
| | | initBoxHeightWidth() { |
| | | //åå§åå¼¹åºæ¡çé«åº¦ä¸å®½åº¦ |
| | | let clientHeight = document.documentElement.clientHeight; |
| | | //å¼¹åºæ¡é«åº¦è³å°250px |
| | | clientHeight = clientHeight < 250 ? 250 : clientHeight; |
| | | let clientWidth = document.documentElement.clientWidth; |
| | | if ( |
| | | this.editFormOptions.some((x) => { |
| | | return x.some((item) => { |
| | | return item.type == 'editor'; |
| | | }); |
| | | }) |
| | | ) { |
| | | this.editor.uploadImgUrl = this.getUrl('upload'); |
| | | this.boxOptions.height = clientHeight * 0.8; |
| | | this.boxOptions.width = clientWidth * 0.8; |
| | | } else { |
| | | if (this.boxOptions.height) { |
| | | //妿é«åº¦ä¸å®½åº¦è¶
è¿äºè·åå°çå¯è§é«å®½åº¦ï¼å设为é»è®¤ç90%é«å®½ |
| | | if (this.boxOptions.height > clientHeight * 0.8) { |
| | | this.boxOptions.height = clientHeight * 0.8; |
| | | } |
| | | } |
| | | if (this.boxOptions.width) { |
| | | //妿é«åº¦ä¸å®½åº¦è¶
è¿äºè·åå°çå¯è§é«å®½åº¦ï¼å设为é»è®¤ç90%é«å®½ |
| | | if (this.boxOptions.width > clientWidth * 0.8) { |
| | | this.boxOptions.width = clientWidth * 0.8; |
| | | } |
| | | } |
| | | } |
| | | //è®¡ç®æ´ä¸ªtableçå®½åº¦ï¼æ ¹æ®å®½åº¦å³å®æ¯å¦å¯ç¨ç¬¬ä¸è¡æ¾ç¤ºçå为åºå®å |
| | | let maxTableWidth = clientWidth - 270; |
| | | this.setFiexdColumn(this.columns, maxTableWidth); |
| | | |
| | | this.height = this.tableHeight || clientHeight - 206; |
| | | this.url = this.getUrl(this.const.PAGE); |
| | | //计ç®å¼¹åºæ¡çé«ä¸å®½åº¦ |
| | | //妿ææç»è¡¨ï¼é«åº¦ä¸å®½å¸¦è®¾ç½®ä¸º0.9/0.82 |
| | | if (this.detail.columns && this.detail.columns.length > 0) { |
| | | this.hasDetail = true; |
| | | clientWidth = clientWidth * 0.8; |
| | | clientHeight = clientHeight * 0.85; |
| | | if (!this.detailOptions.height) { |
| | | this.detailOptions.height = |
| | | clientHeight - this.editFormOptions.length * 36 - 234; |
| | | this.detailOptions.height = |
| | | this.detailOptions.height < 240 ? 240 : this.detailOptions.height; |
| | | } |
| | | |
| | | this.detailOptions.columns = this.detail.columns; |
| | | this.detailOptions.pagination.sortName = this.detail.sortName; |
| | | this.detailOptions.cnName = this.detail.cnName; |
| | | this.detailOptions.key = this.detail.key; |
| | | this.detailOptions.url = this.getUrl('getDetailPage'); |
| | | //计ç®å¼¹åºæ¡æ´ä¸ªtableçå®½åº¦ï¼æ ¹æ®å®½åº¦å³å®æ¯å¦å¯ç¨ç¬¬ä¸è¡æ¾ç¤ºçå为åºå®å |
| | | this.setFiexdColumn(this.detail.columns, clientWidth); |
| | | } else { |
| | | let maxColumns = 1; //æå¤§åæ°ï¼æ ¹æ®å计ç®å¼¹æ¡ç宽度 |
| | | this.editFormOptions.forEach((x) => { |
| | | if (x.length > maxColumns) maxColumns = x.length; |
| | | }); |
| | | let maxHeightRate = 0.7, |
| | | maxWidthRate = 0.5; |
| | | maxWidthRate = maxColumns / 10 + 0.3; |
| | | maxHeightRate = (this.editFormOptions.length || 1) * 0.1 + 0.03; |
| | | maxHeightRate = maxHeightRate > 0.9 ? 0.9 : maxHeightRate; |
| | | clientWidth = clientWidth * maxWidthRate; |
| | | clientHeight = clientHeight * maxHeightRate; |
| | | // this.boxOptions.width = clientWidth * maxWidthRate; |
| | | // this.boxOptions.height = clientHeight * maxHeightRate; |
| | | } |
| | | if (!this.boxOptions.height) { |
| | | this.boxOptions.height = clientHeight + 10; |
| | | } |
| | | if (!this.boxOptions.width) { |
| | | this.boxOptions.width = clientWidth + 30; |
| | | } |
| | | }, |
| | | rowOnChange(row) { |
| | | this.rowChange(row); |
| | | }, |
| | | rowChange(row) { |
| | | //éä¸è¡checkboxè¡äºä»¶ |
| | | }, |
| | | rowOnClick({ row, column, event }) { |
| | | this.rowClick({ row, column, event }); |
| | | }, |
| | | rowClick({ row, column, event }) { |
| | | // ç¹å»è¡äºä»¶(2020.11.07) |
| | | }, |
| | | rowOnDbClick({ row, column, event }) { |
| | | this.rowDbClick({ row, column, event }); |
| | | }, |
| | | rowDbClick({ row, column, event }) { |
| | | // åå»å»è¡äºä»¶(2021.05.23) |
| | | }, |
| | | $error(message) { |
| | | this.$message.error(message); |
| | | // this.$message({ |
| | | // type: 'error', |
| | | // content: message, |
| | | // duration: 5 |
| | | // }); |
| | | }, |
| | | $success(message) { |
| | | this.$message.success(message); |
| | | }, |
| | | setFiexdSearchForm(visiable) { |
| | | //2020.09.011å¢å åºå®æ¥è¯¢è¡¨ååè½,visiable=trueé»è®¤å°æ¥è¯¢è¡¨åå±å¼ |
| | | this.fiexdSearchForm = true; |
| | | let refreshBtn = this.buttons.find((x) => x.name == 'å· æ°'); |
| | | if (visiable) { |
| | | this.searchBoxShow = true; |
| | | } |
| | | if (refreshBtn) { |
| | | refreshBtn.name = 'é ç½®'; |
| | | refreshBtn.onClick = function () { |
| | | this.resetSearch(); |
| | | }; |
| | | } |
| | | }, |
| | | tableBeginEdit(row, column, index) { |
| | | //2021.03.19æ¯å¦å¼å¯æ¥è¯¢çé¢è¡¨æ ¼åå»ç¼è¾ç»ææ¹æ³,è¿åfalseä¸ä¼ç»æç¼è¾ |
| | | return this.beginEdit(row, column, index); |
| | | }, |
| | | beginEdit(row, column, index) { |
| | | //2021.03.19æ¯å¦å¼å¯æ¥è¯¢çé¢è¡¨æ ¼åå»ç¼è¾ç»ææ¹æ³,è¿åfalseä¸ä¼ç»æç¼è¾ |
| | | return true; |
| | | }, |
| | | tableEndEditBefore(row, column, index) { |
| | | return this.endEditBefore(row, column, index); |
| | | }, |
| | | endEditBefore(row, column, index) { |
| | | //2021.03.19æ¯å¦å¼å¯æ¥è¯¢çé¢è¡¨æ ¼åå»ç¼è¾ç»ææ¹æ³,è¿åfalseä¸ä¼ç»æç¼è¾ |
| | | return true; |
| | | }, |
| | | filterPermission(tableName, permission) { |
| | | //2021.03.19夿æ¯å¦ææä¸ªè¡¨çæé®æé |
| | | //:["Search","Add","Delete","Update","Import","Export","Upload","Audit"] |
| | | const _result = (this.$store.state.permission || []).find((x) => { |
| | | return x.url == '/' + tableName; |
| | | }); |
| | | return _result && _result.permission.some((x) => x == permission); |
| | | }, |
| | | destroyed() { |
| | | //2021.04.11å¢å vue页é¢éæ¯æ¹æ³,è·¯ç±å¿
须设置keepLive:falseï¼è®¾ç½®æ¹æ³è§ï¼å端å¼åææ¡£-ã[ç¦ç¨é¡µé¢ç¼åkeepAlive] |
| | | }, |
| | | loadTreeTableChildren(tree, treeNode, resolve) { |
| | | this.loadTreeChildren.call(this, tree, treeNode, resolve); |
| | | }, |
| | | loadTreeChildren(tree, treeNode, resolve) { |
| | | //æ å½¢ç»æå è½½åèç¹(2021.05.02),å¨onInitä¸è®¾ç½®äºrowKey主é®å段åæä¼çæ |
| | | return resolve([]); |
| | | }, |
| | | importDetailAfter(data) { |
| | | //2022.01.08å¢å æç»è¡¨å¯¼å
¥åå¤ç |
| | | }, |
| | | importExcelAfter(data) { |
| | | //2022.01.08å¢å æç»è¡¨å¯¼å
¥åæ¹æ³å¤æ |
| | | |
| | | if (!data.status) { |
| | | return; // this.$message.error(data.message); |
| | | } |
| | | //æç»è¡¨å¯¼å
¥ |
| | | if (this.boxModel) { |
| | | if (data.data) { |
| | | data.data = JSON.parse(data.data); |
| | | } else { |
| | | data.data = []; |
| | | } |
| | | data.data.forEach((x) => { |
| | | x[this.detail.key] = undefined; |
| | | x[this.table.key] = undefined; |
| | | }); |
| | | this.importDetailAfter(data); //å¢å æç»è¡¨å¯¼å
¥åå¤ç |
| | | this.$refs.detail.rowData.unshift(...data.data); |
| | | this.upload.excel = false; |
| | | return; |
| | | } |
| | | this.importAfter(data); |
| | | }, |
| | | onGridModelClose(iconClick) { |
| | | if (this.isBoxAudit) { |
| | | this.initFormOptionType(false); |
| | | } |
| | | this.isBoxAudit = false; |
| | | this.onModelClose(iconClick); |
| | | }, |
| | | initAuditColumn() { |
| | | |
| | | }, |
| | | getWorkFlowSteps(row) { |
| | | let table = this.table.url.replaceAll('/', ''); |
| | | let url = `api/Sys_WorkFlow/getSteps?tableName=${table}&id=${row[this.table.key] |
| | | }`; |
| | | this.http.get(url, {}, true).then((result) => { |
| | | this.workFlowSteps.splice(0); |
| | | //æå¯è½æ²¡æé
ç½®å®¡æ¹æµç¨ |
| | | if (!result.list || !result.list.length) { |
| | | result.list = []; |
| | | this.auditParam.showAction = true; |
| | | this.auditParam.height = 240; |
| | | this.auditParam.showViewButton = row.AuditStatus == 0; |
| | | } else { |
| | | this.auditParam.showAction = result.list.some((c) => { |
| | | return c.isCurrentUser; |
| | | }); |
| | | this.auditParam.height = 511; |
| | | this.auditParam.showViewButton = true; |
| | | } |
| | | this.auditParam.reason = ''; |
| | | this.auditParam.status = -1; |
| | | this.auditParam.value = -1; |
| | | if (result.his) { |
| | | result.his.forEach((item) => { |
| | | item.auditStatus = this.getAuditStatus(item.auditStatus); |
| | | }); |
| | | } |
| | | |
| | | this.auditParam.auditHis = result.his; |
| | | this.workFlowSteps.push(...result.list); |
| | | this.isBoxAudit = true; |
| | | this.initFormOptionType(true); |
| | | this.edit(row); |
| | | this.boxOptions.title = 'å®¡æ ¸'; |
| | | }); |
| | | }, |
| | | initFormOptionType(isReadonly) { |
| | | this.editFormOptions.forEach((options) => { |
| | | options.forEach((option) => { |
| | | if (isReadonly) { |
| | | if (!option.readonly) { |
| | | this.formFieldsType.push(option.field); |
| | | option.readonly = true; |
| | | } |
| | | } else { |
| | | if (this.formFieldsType.indexOf(option.field) != -1) { |
| | | option.readonly = false; |
| | | } |
| | | } |
| | | }); |
| | | }); |
| | | }, |
| | | getAuditStatus(status) { |
| | | let data = this.auditParam.data.find((x) => { |
| | | return x.value == status; |
| | | }); |
| | | if (!data) { |
| | | return '-'; |
| | | // return `å®¡æ ¸å¼ä¸æ£ç¡®:${status}` |
| | | } |
| | | return data.text; |
| | | }, |
| | | initFlowQuery() { |
| | | if (this.$route.query.viewflow) { |
| | | this.$refs.table && this.search(); |
| | | } |
| | | }, |
| | | fullscreen(full) { //å¼¹åºæ¡å
¨å±æ¹æ³ |
| | | |
| | | } |
| | | }; |
| | | import customColumns from './ViewGridCustomColumn.js'; |
| | | //åå¹¶æ©å±æ¹æ³ |
| | | methods = Object.assign(methods, detailMethods, serviceFilter, customColumns); |
| | | export default methods; |